From patchwork Wed Oct 19 08:21: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: 4501 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp202305wrs; Wed, 19 Oct 2022 01:40:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6jB34XyBG99/H53WUE7cATn6YJVHkpGeSSLpUNHslspoR3AWnMQwTRmF7kmhHiB8AYDhG6 X-Received: by 2002:a17:907:2da5:b0:78e:1208:8783 with SMTP id gt37-20020a1709072da500b0078e12088783mr5834793ejc.743.1666168820647; Wed, 19 Oct 2022 01:40:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666168820; cv=none; d=google.com; s=arc-20160816; b=RUKVttVexJobqlCD2LvToMC6go1s0fR/AO2a4e/Ki4gbXIBthEOiDTAJ47CHhIkFxk kPTX+WRVLmWxbKFwAhfUXKc6ZVRDow9UBha2QDIQfnG9CtEW2AqjODYc8jvYQKXhyKL7 /kf1aiW0WJ4+oTSVU+5Ke37K15x/ndabAYsSGashObb9rTyaSYBM7YI9HSqu+47kwvMf dAM1+b8+L7AKSWgc0omjrpFWsarOej6VmpLhHHSX4+YptnZ3DvV0VMQPTeW1lyNB/In9 kTn5WDVvqlFUOy51Yq43zPLWq84J31k/52mioC+eBEGLTp3tXdPe9MMkz4xaQ44iKp6D 0X6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/G36dJCdLqkpszEmr+hpK7zmuIiuwgS82vTsUp4p6/c=; b=hEBPz6hMqA9NIP9k6sfGGjM3Je4Jq63U/FbZYY/ParQ8Zrwondp5uJc+C6N78vYLGm ltihPgSPiY4biNPd/WpdER9BwjmwTF4mMvmxNjtX6pYu/nXRZJTEF9w+iTMOUQgV/Qhy W2xhUZsh1/joeiWnu4LqMl65+vugtPRai9ny2Xudyv65rssSUBFtAwPZKZhunxmp/wA5 TAem7Dh8omxKR5tQXOTixqbH3xX1b8y8uRizROwPhQ12YJxEU3ZM+Dd135eFLVFxR8wp TTPBO3bHAg1iX1ypWJbNoaleKAYl2Npf4cx4vWl+/p9GyhvMPG0m2qI5gVNNB3n3uttf UOGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZSkL4oiV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jx23-20020a170906ca5700b0078d148daf4bsi11619517ejb.409.2022.10.19.01.39.56; Wed, 19 Oct 2022 01:40: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=ZSkL4oiV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230369AbiJSIj3 (ORCPT + 99 others); Wed, 19 Oct 2022 04:39:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230308AbiJSIiy (ORCPT ); Wed, 19 Oct 2022 04:38:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 027CE786E3; Wed, 19 Oct 2022 01:38: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 ACF3CB822BC; Wed, 19 Oct 2022 08:38:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F14A6C433C1; Wed, 19 Oct 2022 08:38:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168682; bh=6eLQVFcIp4Vgqw1RS1upxwn5IKwsEUEOJKr3XYirb/k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZSkL4oiVDaS4SRGyoJ09lIc/QOz33+oL4by9HbmuzMKEQ2t9jTbbVbS/F738dSznM ipNrgKg4Swb42GOUN/ye6qVaZ2uOlppjQwhrv+kiWjE+HcElihatMiCQ4weLpwJdim jwdICwjfC/uw+KmTTzsV7tDk8+03wdh3njDNnSgA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 6.0 002/862] ALSA: rawmidi: Drop register_mutex in snd_rawmidi_free() Date: Wed, 19 Oct 2022 10:21:29 +0200 Message-Id: <20221019083250.085744456@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104637290339237?= X-GMAIL-MSGID: =?utf-8?q?1747104637290339237?= 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 @@ -1899,10 +1899,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 Wed Oct 19 08:21: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: 4515 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp203132wrs; Wed, 19 Oct 2022 01:42:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7EphdsX+olVskBYYd3TscpzdOxXi3MsidYwavIdf88iPJ6iqCGHTEY7G9MwMFKBODdBjVc X-Received: by 2002:a50:9991:0:b0:458:a612:bf5a with SMTP id m17-20020a509991000000b00458a612bf5amr6435439edb.22.1666168939818; Wed, 19 Oct 2022 01:42:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666168939; cv=none; d=google.com; s=arc-20160816; b=pHUTyAlt+zxim91V/y9fLIDS/Y5cxFxmf50gcx9nLLrV1pqBYpSglvryjHXXAgq4d8 cyhMMhUITNTxY9hvX2yIxjbYBjrmRBOU3xYobtbtu1Q3OWrSmE54kpZhbz5aXrpJQPrY FyDfAeAffVKduPkzZrUZ8R0wfzqIXCcDCz/jr1jQpBs0DPPFUarFbPfLrZjjYBtUN80W Khr5KxiVG9nLdBuqQgk0IInA0TAluQ8xpKqqNiFDaNeSvii+4W9R9SdCO6oq4npRnkXI xuCitrg0FXuWtJjhS8PO5ETSk6cY1MVU7Y17VClE+NTHmNV0fxCkvuyPe94LinZcBYiV /CvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+JWXyrfUpuPNSadoVrKpARPqPk4jtBbPH1fSNQ2syHo=; b=qFv8V2bpcPbWh4YJ/X/a09XhErkhSJrKUFNAkrMecDhSSPT64zUC65j4OPNpZf5ND7 AOrgqLYYew2bxOl928DBcA1n1mM1+p66W8SD/Pe+n6d69+xzZkeYsuX3Yp26jDKArT4n HRdsOFD/Q1D8ebCBuiEMHNw/J7XVtjhrTbrmWuvGTrnR+GSxtWw9WBlyVK7jU48AHkbC zwb4BpwR+6KNJ71aWHgnVgc0JOST9IFlk4I/lMbKBbVeVwcqOcnQw47yDqBHGhP4KjPh FrvaDPP/8mWe6PjY63LiKo/6S6m7c/ImzaU7lSthSaE5MVrBLjCIOb3zSIEYWg1bdSMo fdIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Sa31d34L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hv17-20020a17090760d100b007807e3f6766si7664409ejc.581.2022.10.19.01.41.54; Wed, 19 Oct 2022 01:42: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=Sa31d34L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230492AbiJSIlK (ORCPT + 99 others); Wed, 19 Oct 2022 04:41:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230274AbiJSIj4 (ORCPT ); Wed, 19 Oct 2022 04:39:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92CA881680; Wed, 19 Oct 2022 01:39: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 BAB34617D4; Wed, 19 Oct 2022 08:38:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BEDBCC433D6; Wed, 19 Oct 2022 08:38:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168710; bh=FAUBq+xOHHhAmdDXr0nUjCQSE5N3RTGbcKi+sVW2no4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Sa31d34L4KSDEg5qe1UPJe5rnJ4ASjaN1pJf1osSgrruA+TE9m7P+CbI7TsmYVmz9 vYfdQJvJiyGAc9sFOVQLKbPcTUynFi3dX+gVhYcv7DLrelbd41Ruq5NenbkcDYxGyA bNT5BkmPkwDXzuxVWUUiY3G3B8EM6pTtTbNvQBlw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 6.0 003/862] ALSA: usb-audio: Fix potential memory leaks Date: Wed, 19 Oct 2022 10:21:30 +0200 Message-Id: <20221019083250.136257599@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104762186638187?= X-GMAIL-MSGID: =?utf-8?q?1747104762186638187?= 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 @@ -1261,6 +1261,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; @@ -1280,8 +1281,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 Wed Oct 19 08:21: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: 4505 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp202603wrs; Wed, 19 Oct 2022 01:41:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Nn1jcD1zTyZ2kn2aw+J9KYSxt1SViaCajdu0OY37+t2foDNRQJe/l+eb58D9e1NWVzUo0 X-Received: by 2002:a17:907:1b1f:b0:72f:56db:cce9 with SMTP id mp31-20020a1709071b1f00b0072f56dbcce9mr5507694ejc.605.1666168860233; Wed, 19 Oct 2022 01:41:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666168860; cv=none; d=google.com; s=arc-20160816; b=pg2H/WSuYAvsUVJmOWGQ5XnwJo2mJxjY0xIS8pG3Tws/CzykxaX4HMDk9uJHi781Kz FvVL7M6RY8OJ2bkS+/LMwWOEKZNkwxr7ni6uFvkVAceJ0Wtjm1uHoHDsnrjBWeizSvzs 5uwAmwsRAF8uRhhW8h6RNS8ozc2hKQ907y9H0ynfrIM1kc8F5CL+tEOjMAEp681ltO6l BRS0it00IJ9dpgDWOaxkZI12EJM8xXEi7mo4FrbsjzHotRNM9h69BX8pZb9DllvJAcp/ Ftz+dGukIDo9TTOGHh4vLR+b810HUBiqNIc/L2kqEibsh4cFq+RJ3TygTPPZO6SJGxLT s4AQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=z80ZjE2YL/ZbpBogZGd3BFMn4gDm6TtkhkZ2yiRsiRA=; b=nZFZFC8jvQvn3F+lGVO536OkOv8KGXWOcdWEsmhNuayc+Znhxy1K4GdZGM9PBp2Mxq H8wLCBmH/HSKAfVpwTNm+/mDrI0YTkF0QrsJz3+TDQHM+9VTXenBDPilHGfOHcELYjDz wElBbeDkJAZjaKZFiT3xq1Oeur2Pwwx9rBxU7uZvaD2srcow9AtnMouU1T7gXbGfMUtp 87z8qWNV2wedKbGQ3YHdIKz2HvguHuAxwjIXsh3MZrI7FtSru4kH+S7FN/xLyN6AOO+r 46f+Ga46pJlbqfVMqMb93a0gmcVns5/IvSGjUGavqMGtWGs+RMdZgEwdtkkyyHn9tiBj wRQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="elwc1a/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 30-20020a508e1e000000b00458b204f294si11855637edw.298.2022.10.19.01.40.35; Wed, 19 Oct 2022 01:41: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="elwc1a/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 S230270AbiJSIjy (ORCPT + 99 others); Wed, 19 Oct 2022 04:39:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229971AbiJSIjD (ORCPT ); Wed, 19 Oct 2022 04:39: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 A62787F0B1; Wed, 19 Oct 2022 01:38: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 D481E617DF; Wed, 19 Oct 2022 08:38:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0186C433D7; Wed, 19 Oct 2022 08:38:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168713; bh=nqOrFT/Y66TGULVPHHQkkVqwTkFRjIX6uhUPep+lG1U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=elwc1a/Qav0Bmc5YpjsPcpseSSsUR6H7omx5rMuLpRarq1jvseELMvXyJNJjVWVz/ qkggq1G2jSWkzGWLmgmB4gq+x3g5p0moDNQOKFYt03HgwVx8eYY5T8G6kYI4O7RN8s Si0ei6z1E8ycp0o3R8W4iTXgazL3gnIzd9jRK+YM= 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 6.0 004/862] ALSA: usb-audio: Fix NULL dererence at error path Date: Wed, 19 Oct 2022 10:21:31 +0200 Message-Id: <20221019083250.187859993@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104678798061383?= X-GMAIL-MSGID: =?utf-8?q?1747104678798061383?= 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 @@ -93,12 +93,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 Wed Oct 19 08:21: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: 4506 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp202681wrs; Wed, 19 Oct 2022 01:41:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4fT8y8oyUkcOMHKSBphSehsHxn7GaRK9aX66gFROSWrqXZL995yh5fGBiKqbI5Rxdd3FCl X-Received: by 2002:a05:6402:4302:b0:45d:c9b4:c007 with SMTP id m2-20020a056402430200b0045dc9b4c007mr6354838edc.328.1666168870585; Wed, 19 Oct 2022 01:41:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666168870; cv=none; d=google.com; s=arc-20160816; b=ZiSc+vp2XqPzR5sV/iOm7a/qQdJACusjMTK5QPg+F2Fi2r99fj4Dm28KxsVU34S4G4 k8gkvBAxhvrS1nATdPG+w7WaMhpfi7rI59hpp8s6EZVZ/cLoF4GACmdHW/Qfon41uJow gGSLS6haRxyKlXdYuE8Qg89q7yGVIDVGLlqUXl91FZylK0Bh4yrGf4qoZSnOpF45/uu8 rfRBdK2chCfV+Q2jLaey594cP+7G3A8q5RdjFTV0jv5JheKHrKDIEzLV+MH3jXAbeJED yRMd+g7sCCT4QeJmWdsZ8+pzpkWw0xPrgs/t+8eewD/+zHkXlufXaRd+1UhpqFdLnXD0 fHVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=++KajkojadZfT3nN3+UFTEoeAn46AyIxE4aBLUBoRjc=; b=UNp2rnU7FviIn0Wn+jGhT7LJxYhNnrc3cyl8m+GlsazsIjWvl3pwP/N2CytqmGoijL nA0m4CJLC3svfmPmdbH0NfLirXuYubcXRVGoNI2KarhNKqT7iVNOXh1GJcVy/Vfl9jL0 HRL87iPyu6Zl/xKazz/LY2dT/TswbIzuKakRLakGha59BNPCCtHt7TwScdp8VyaUTmrZ jRYx46PM/XLQWm9zZDA1GX6ytrddZ/irGwiTr8Ilw60pEEc47/nqucDhTxYH4FE/EQIE 3tJO6ExTmY5MnlMvZisCz7EISRWbOQN/sFU9LztMz4n/hodJG/j/bTqNOPTWc3dOOS8E tgbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Fbqjh4ZJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b7-20020a056402084700b0045d39f946b4si13194448edz.20.2022.10.19.01.40.45; Wed, 19 Oct 2022 01:41: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=Fbqjh4ZJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230291AbiJSIj6 (ORCPT + 99 others); Wed, 19 Oct 2022 04:39:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230250AbiJSIjF (ORCPT ); Wed, 19 Oct 2022 04:39: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 C98257FE48; Wed, 19 Oct 2022 01:38: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 091F5617E7; Wed, 19 Oct 2022 08:38:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F1F3AC433C1; Wed, 19 Oct 2022 08:38:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168716; bh=c3J8aS+0mHc2rC1YOQ+gpl9CPH8bxkvxWZbbf19llkk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fbqjh4ZJtRwZkcB0/d2AfaqSkBCD3jLkBWkp2d5BcN3mbIjSLgfXlsbxUN/5zMx64 WQ/Xv1vhlVAOrt/jolO+PPtf01X/4qPARyU29Zt+RnZQGZ4U1wr2cEaw9CH3+WwZlE 1LzbQW3rU/0WjtLeWFBxBBSk71E76MZspQOilq1w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Callum Osmotherly , Takashi Iwai Subject: [PATCH 6.0 005/862] ALSA: hda/realtek: remove ALC289_FIXUP_DUAL_SPK for Dell 5530 Date: Wed, 19 Oct 2022 10:21:32 +0200 Message-Id: <20221019083250.237245212@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104689819334072?= X-GMAIL-MSGID: =?utf-8?q?1747104689819334072?= From: Callum Osmotherly commit 417b9c51f59734d852e47252476fadc293ad994a upstream. After some feedback from users with Dell Precision 5530 machines, this patch reverts the previous change to add ALC289_FIXUP_DUAL_SPK. While it improved the speaker output quality, it caused the headphone jack to have an audible "pop" sound when power saving was toggled. Fixes: 1885ff13d4c4 ("ALSA: hda/realtek: Enable 4-speaker output Dell Precision 5530 laptop") Signed-off-by: Callum Osmotherly Cc: Link: https://lore.kernel.org/r/Yz0uyN1zwZhnyRD6@piranha Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/pci/hda/patch_realtek.c | 1 - 1 file changed, 1 deletion(-) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -9186,7 +9186,6 @@ static const struct snd_pci_quirk alc269 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC), SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC), SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB), - SND_PCI_QUIRK(0x1028, 0x087d, "Dell Precision 5530", ALC289_FIXUP_DUAL_SPK), SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB), From patchwork Wed Oct 19 08:21: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: 4519 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp203263wrs; Wed, 19 Oct 2022 01:42:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7UoQDe6gc7qSMfwyAghB9urluqvleOZ0fdvyUGB0T5VFWdspkmJP0A0y/1ek7+xX0pJ3qO X-Received: by 2002:a05:6402:3509:b0:45d:c25b:b80e with SMTP id b9-20020a056402350900b0045dc25bb80emr6429370edd.250.1666168961416; Wed, 19 Oct 2022 01:42:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666168961; cv=none; d=google.com; s=arc-20160816; b=POf66KzDlT6RuZlPig/L2qy10QXKqfQdqTMQmG5iHck6+3Vp2+5/zHjgiMdlZeBW+o l8Nc+kol8ZYAZCvpEuio2YEEr9e+WwxJUtCilrfoACVc+KkGzhP10NNscjGPJ33pkoWg rXemzpC+WhkiA+awpkU41rYyxgQzoDXmpoRGubiUOsnfQ3lbwjiMgToh2VvOx37kXdBB lnyuvyoCUF+liEy/sAvDcH2KAdQNmRmuPuRhTfik6T2m88Bp0KUsOiDzT5+x7fpe8QGr U1DLW676Hu1Z6TF8dMPwX+pDI736zt/Ra1poez1pS7qzz5rVC/RyHXffCsk56S/AZhXd Ifeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RJrNxRL8py5F+s9hejmSdmDxFjJoigKVEPIxwonQi0Y=; b=CiPBnwf9DPEfg0GhQl843OG+3DuEQ6uVmwmd0cDiCDjrnHsnJs3J5Zb6vQslT2fcLg 31B6tFsKK0+XQUJFd/MI/lVyPGE4vAvFQ9kAesSpzNgB1yGK8afw3iByJA1zIbkd8Gdi wbXSXvlX9xQvTbh55gwWuSBF8V8VJ1NwjdDlF+RxKDK/2dpC7aTzaFVLSt8pQVu6NqZG SKkoxqLkVwh18qQG2ag4DMP5lwt9+o5HqP1pYJ2B0XRmcnIybWDI35mvWAaBUaLMIz+1 qcWAqELz+5Dpjyb4e2vyRzQGDsef2Pg2Dk2sK0lHs82WPF7k8V/moUqIjr6bMKmCnLZt YxVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bOPnRZe7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b9-20020aa7dc09000000b00456964d3369si11542939edu.230.2022.10.19.01.42.15; Wed, 19 Oct 2022 01:42: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=bOPnRZe7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231126AbiJSIlu (ORCPT + 99 others); Wed, 19 Oct 2022 04:41:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230336AbiJSIkb (ORCPT ); Wed, 19 Oct 2022 04:40:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD44580E8E; Wed, 19 Oct 2022 01:39:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B3428B82234; Wed, 19 Oct 2022 08:38:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EFF71C433D6; Wed, 19 Oct 2022 08:38:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168719; bh=ZW9qSv5ivmTtFBNetQJp/cf/srjieksFSRneH5TJDj8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bOPnRZe7SMZebt6c4eHurDo1r9x3emuXJbP0my8lXM5b5rMtprU/rfq+aOSCn/ZDv yQ2I+igTX59/RKCFQhcs2hQLHI4ExE+fUpJ5KMxfTdoXPzzplXMpp3+zV2EZPhP6ze EiwBbvobS93xrOws5zbEP0kFatYIM7xgpj4E25AA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Luke D. Jones" , Takashi Iwai Subject: [PATCH 6.0 006/862] ALSA: hda/realtek: Correct pin configs for ASUS G533Z Date: Wed, 19 Oct 2022 10:21:33 +0200 Message-Id: <20221019083250.276536300@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104784588367347?= X-GMAIL-MSGID: =?utf-8?q?1747104784588367347?= From: Luke D. Jones commit 66ba7c88507344dee68ad1acbdb630473ab36114 upstream. The initial fix for ASUS G533Z was based on faulty information. This fixes the pincfg to values that have been verified with no existing module options or other hacks enabled. Enables headphone jack, and 5.1 surround. [ corrected the indent level by tiwai ] Fixes: bc2c23549ccd ("ALSA: hda/realtek: Add pincfg for ASUS G533Z HP jack") Signed-off-by: Luke D. Jones Cc: Link: https://lore.kernel.org/r/20221010065702.35190-1-luke@ljones.dev Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/pci/hda/patch_realtek.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -8427,11 +8427,13 @@ static const struct hda_fixup alc269_fix [ALC285_FIXUP_ASUS_G533Z_PINS] = { .type = HDA_FIXUP_PINS, .v.pins = (const struct hda_pintbl[]) { - { 0x14, 0x90170120 }, + { 0x14, 0x90170152 }, /* Speaker Surround Playback Switch */ + { 0x19, 0x03a19020 }, /* Mic Boost Volume */ + { 0x1a, 0x03a11c30 }, /* Mic Boost Volume */ + { 0x1e, 0x90170151 }, /* Rear jack, IN OUT EAPD Detect */ + { 0x21, 0x03211420 }, { } }, - .chained = true, - .chain_id = ALC294_FIXUP_ASUS_G513_PINS, }, [ALC294_FIXUP_ASUS_COEF_1B] = { .type = HDA_FIXUP_VERBS, From patchwork Wed Oct 19 08:21: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: 4507 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp202691wrs; Wed, 19 Oct 2022 01:41:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Orpqc+FFOWRgzIukgzM9epO0t88NWQYf6sSzxHr5Wo3sCaqH/Ia4bF4CvdTU85KW/H0jZ X-Received: by 2002:a17:907:31c3:b0:770:852b:71a2 with SMTP id xf3-20020a17090731c300b00770852b71a2mr5767611ejb.557.1666168872438; Wed, 19 Oct 2022 01:41:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666168872; cv=none; d=google.com; s=arc-20160816; b=RB7ztDoo8FMzrHw3mWGeCw5ObjBOi7K4h4ED+oi5LgX9qbZKcYoviI3agYZiwjYnvH F5HC0AkFxCTRWsqDcK9uwNry1Kamk+LEcd9VyOcvfICbiElT+Aw6C7FlooFSQrFZhu2G A734rF6sL8irPyUWon/nosNYIhpPua4LzsTyUMZIePXORMu+BaVuTXBIT7296R2pccCK xm5JDAHpAYgjturoL2nDoola+rFM0/OWqDHcfS8xKOMpqAJs2YiE+Phtb3+OEQOLpRpF GQKJF9M4fUsNpmEd+2AeTKdx585GvblkqJ1DiqlXO3NkPrbbUZ/Y77S53HMGSfn0I6sU V57g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5MsY4lDF+pBResiaPA5mNDQzCwjCyjYZG7IgTa7aJHQ=; b=yY/BxHG+78XHKweApwNBd/TTLV+TTiloRK9hWpsV3d9s8JLmvcn7MwVmUW97y+axH5 CMrPZlUOpEujcgcc7kNRPVDcvu0usYKY43FEDtvccLgzV4Gklp9NNwMI8uXP6rFGFje/ Ij8ApMjN4ab6tDr3S8Senz6QTD8oGWobtf1vjXT2nXwpvMcmDBe0yqAVVT5wFgTFT6dJ idqAHJvoHSng9XXFK6BI4vAbE7uM9yzMoxhgdWqIsns5oaEju+4LO953SZ+SkKvABJrx rRm6DaiOhKCGYI7zuXUoJUyrz5/SzRHWf5Roj+lB59cMsU6gebM8IuXQ2OHrOOhqz9n+ x3lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PmFB7u3W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l13-20020a170906794d00b00781d6cda765si14990678ejo.913.2022.10.19.01.40.46; Wed, 19 Oct 2022 01:41: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=PmFB7u3W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230424AbiJSIkN (ORCPT + 99 others); Wed, 19 Oct 2022 04:40:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230294AbiJSIjJ (ORCPT ); Wed, 19 Oct 2022 04:39: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 2F3347F258; Wed, 19 Oct 2022 01:38:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A4337B822CC; Wed, 19 Oct 2022 08:38:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 062A8C433D7; Wed, 19 Oct 2022 08:38:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168722; bh=zRSWRcw5E+6yoos0UwjV7HgMir9iWUaOKmttt9PucWE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PmFB7u3WXKLAiPLdlI52Mx0BNaoue70x8nYMSlpoCuGSkdNPKkR5+3cNkQvzeslio MroNnDEO8Xxxw/PllRwtJ8u96/m7W71YZy/cOHOFzYOdhGVbkGFr11eArPTtqzM0b4 8EyqV0+j0jGO78bUTSaAIXwhx6/S/ZNFjqs+zNyE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Luke D. Jones" , Takashi Iwai Subject: [PATCH 6.0 007/862] ALSA: hda/realtek: Add quirk for ASUS GV601R laptop Date: Wed, 19 Oct 2022 10:21:34 +0200 Message-Id: <20221019083250.324793566@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104691183160250?= X-GMAIL-MSGID: =?utf-8?q?1747104691183160250?= From: Luke D. Jones commit 2ea8e1297801f7b0220ebf6ae61a5b74ca83981e upstream. The ASUS ROG X16 (GV601R) series laptop has the same node-to-DAC pairs as early models and the G14, this includes bass speakers which are by default mapped incorrectly to the 0x06 node. Add a quirk to use the same DAC pairs as the G14. Signed-off-by: Luke D. Jones Cc: Link: https://lore.kernel.org/r/20221010070347.36883-1-luke@ljones.dev Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -9411,6 +9411,7 @@ static const struct snd_pci_quirk alc269 SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401), SND_PCI_QUIRK(0x1043, 0x1c52, "ASUS Zephyrus G15 2022", ALC289_FIXUP_ASUS_GA401), SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401), + SND_PCI_QUIRK(0x1043, 0x1f92, "ASUS ROG Flow X16", ALC289_FIXUP_ASUS_GA401), SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2), SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC), SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC), From patchwork Wed Oct 19 08:21: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: 4509 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp202789wrs; Wed, 19 Oct 2022 01:41:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Eax9F/hNECqy61tzH6PASyTrRCKmLNqP/6wv9C1Y3XuPNqTlpreBdTruLpaVQtgKx2ix6 X-Received: by 2002:a17:907:1c86:b0:78d:b8dd:4826 with SMTP id nb6-20020a1709071c8600b0078db8dd4826mr5771200ejc.492.1666168876114; Wed, 19 Oct 2022 01:41:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666168876; cv=none; d=google.com; s=arc-20160816; b=yEDVVWZbD/odMcKeEtupPfUatw4xF0TtoQs+/PrHR9MhRPwry/856SzKhp2WbSPMZX DAgCmz9Vy8YUo1bSnwiWPDBiDe525sF/ZUPkTPxwAofax2l9Veltrs7oBnZN+45SOzRI iVSazVyV7wpZYtr73LkWfkcRJXI0RAablf/m7nHNlDwML98YQG/vEi0b6f+JuCOf9jjm GdLHLS7RtXsvsSh4EtGpuX73FfzRzBnyZVKcbNIsKM79IH7sSrTUgnFxwxPI1Ohcu+xH +gjKXb32288iy7aqvYkIhpi+ojcTyW8HV3EggDRQ2X5OFTVUgwEatCV8ICFTE4pmMUJt 8Y3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+OlDJmMHH8RREm/30OXFiLiS/qL1+qDs+gvKgMl0Dv4=; b=ZQ+Q1qPX6LEccgk7lvMMCzp0aOHSbzzPHVIspPmi0az4R5aHdKdy5GHSksMX5diePG irN1P0myIePWWc2W4EejBp1PyQISFH0UuUXf+NjrDzw4JsVOI2slKyhZoTORHRkXuM2f 9X84HtKwHsQWFo5B3QaEQaqFUbLEvGLjSbkO7sfBgvhLsjPXUgcU1g0jwGTFRlphuNi+ 5x4XrkG6/3H1tPcBvjr/9p+Wc2rRQx7u6y89mZow8MwNVQNxACjd3D2uWP12PTKfl34q XxL9Su6dY50ZjX6PYt1soQAJxlYumd++pHQtMsasX7mvvK8kmZ2XDFnwKwaNGd7H6QBX MAHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UU5g82Wz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hs40-20020a1709073ea800b0078df2f22f80si14554533ejc.647.2022.10.19.01.40.51; Wed, 19 Oct 2022 01:41: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=UU5g82Wz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230428AbiJSIkU (ORCPT + 99 others); Wed, 19 Oct 2022 04:40:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230006AbiJSIjS (ORCPT ); Wed, 19 Oct 2022 04:39: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 5940080516; Wed, 19 Oct 2022 01:38: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 0C114617E8; Wed, 19 Oct 2022 08:38:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05C76C433C1; Wed, 19 Oct 2022 08:38:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168725; bh=dParNyCeQ2CzxBbk8NujoIIreWyVOIfjh8THe3kF1GM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UU5g82WzngLm05RUqajPjgHc8aN1GpLB+Mw9QZgWnN71CFSvIzJauw4vlmkHMY7OP xDzsaJwfVeJN4J6R04FnNkzc2DOIGamTl1JCZEH2sntO0+Xsu3gcMKiCCXLsmDYN0Q wsRZFW9xuUPh7hmP4se//fyfukrHhjHacE13z7Ww= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Saranya Gopal , Ninad Naik , Takashi Iwai Subject: [PATCH 6.0 008/862] ALSA: hda/realtek: Add Intel Reference SSID to support headset keys Date: Wed, 19 Oct 2022 10:21:35 +0200 Message-Id: <20221019083250.365835097@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104695872517999?= X-GMAIL-MSGID: =?utf-8?q?1747104695872517999?= From: Saranya Gopal commit 4f2e56a59b9947b3e698d3cabcb858765c12b1e8 upstream. This patch fixes the issue with 3.5mm headset keys on RPL-P platform. [ Rearranged the entry in SSID order by tiwai ] Signed-off-by: Saranya Gopal Signed-off-by: Ninad Naik Cc: Link: https://lore.kernel.org/r/20221011044916.2278867-1-saranya.gopal@intel.com Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -9433,6 +9433,7 @@ static const struct snd_pci_quirk alc269 SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE), SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE), SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK), + SND_PCI_QUIRK(0x10ec, 0x124c, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK), SND_PCI_QUIRK(0x10ec, 0x1252, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK), SND_PCI_QUIRK(0x10ec, 0x1254, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK), SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE), From patchwork Wed Oct 19 08:21: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: 4508 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp202766wrs; Wed, 19 Oct 2022 01:41:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM71GT1gqaA3Sb2D6EI0PQOYoXX2BK2uZ3YokE+buDBhb/IoWmNGtxyzt5/PHrCxQBzeRSSl X-Received: by 2002:a17:907:2c75:b0:78d:c201:e9aa with SMTP id ib21-20020a1709072c7500b0078dc201e9aamr5777036ejc.235.1666168884343; Wed, 19 Oct 2022 01:41:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666168884; cv=none; d=google.com; s=arc-20160816; b=dBIQb8dXyuqhWDjSceku0fkIrSuwQsPLQSbEl8BmTQ6ev2OHLjIREnNeOR3YO2qUJq PDoMdPnglFAT9xI5w/lfh52cy8epCTG/6av/4FGnOnqnMHKvKn3dVbrDbNbB+jawhZnh MwvKXTsGptW4YmXxibkdKCtGp4L2tHG7p8rhwSjw/YTb7KdE5KVogX6HJzIEjzU1N7aV 0yDtAFTFyWWi0Rb5t+lAsSydRWN/MkywQMn/2s7NwCHgfmez6OE+5rJul+rPgC+JHLRN 1TXk97g1aOPweMNQkc6Xwyi3ziHH/8Cdg1kJfs5FiQFpQUNd/3u+DFaOVehZvD+x8ahR 85wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ICerq/AfOym981P0Y+JYGeCVM6Th1jVdBD5o94nQtNY=; b=pzR2AhtuTC9swlW5J4ojU5tDJ8pD1O+HYWl3HDRhJ7+9Q8cKx34q91T1mQ9ibOhGH/ rJQTcakukk06jK1rIPT0a/5om5oMrIG5cgo0+AGAXc18uRzm9MdKMW2VBQlBu6ePO6T8 Om/qbNs48yodwxBXvXG5Y9EE/mqONG5tB/uqz8wyx6QWWWK91+x2YwiaPLUCc/wqEe+r WlZvbJkk25ZIJeJAl8Vpv43JCMJDgtbmKLsU6gidePP0nmVxnM+duRTq/kmhewEZYJrp As8dILhc/cmA8xfPtEV+IkNKREYWRfcMa6AD2Yil1gub7Z03us/rrQT8lJ5RD3CFAKdw H1bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JgGSTNNC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t14-20020a056402524e00b0045dcc848b39si4795062edd.228.2022.10.19.01.40.59; Wed, 19 Oct 2022 01:41: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=JgGSTNNC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230328AbiJSIkb (ORCPT + 99 others); Wed, 19 Oct 2022 04:40:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230327AbiJSIj3 (ORCPT ); Wed, 19 Oct 2022 04:39:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EA6780BDA; Wed, 19 Oct 2022 01: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 1B832617D7; Wed, 19 Oct 2022 08:38:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11568C433C1; Wed, 19 Oct 2022 08:38:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168728; bh=0LcxMqzKBXHZAcPKt0pyDjPeM3azFWJ3SFXQ6kVQIP8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JgGSTNNCic+yDWIuNwSXH2R2meeF0U6UFhpmihyEDAEVcLD4x4f4HsdioteOV5uSa +7PnD5dLz/rrk7iabA0v1pqHCx+nwGRxVnCE1YSezhNDhkB601y72Iz30ZE9Z9f2qd sofHV23qji/Ab5FXtFd+f9I3zHAlL+WxJIpVIg/w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tudor Ambarus , Alexander Dahl , Peter Rosin , Boris Brezillon , Miquel Raynal Subject: [PATCH 6.0 009/862] mtd: rawnand: atmel: Unmap streaming DMA mappings Date: Wed, 19 Oct 2022 10:21:36 +0200 Message-Id: <20221019083250.416041539@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104704221463642?= X-GMAIL-MSGID: =?utf-8?q?1747104704221463642?= From: Tudor Ambarus commit 1161703c9bd664da5e3b2eb1a3bb40c210e026ea upstream. Every dma_map_single() call should have its dma_unmap_single() counterpart, because the DMA address space is a shared resource and one could render the machine unusable by consuming all DMA addresses. Link: https://lore.kernel.org/lkml/13c6c9a2-6db5-c3bf-349b-4c127ad3496a@axentia.se/ Cc: stable@vger.kernel.org Fixes: f88fc122cc34 ("mtd: nand: Cleanup/rework the atmel_nand driver") Signed-off-by: Tudor Ambarus Acked-by: Alexander Dahl Reported-by: Peter Rosin Tested-by: Alexander Dahl Reviewed-by: Boris Brezillon Tested-by: Peter Rosin Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20220728074014.145406-1-tudor.ambarus@microchip.com Signed-off-by: Greg Kroah-Hartman --- drivers/mtd/nand/raw/atmel/nand-controller.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/mtd/nand/raw/atmel/nand-controller.c +++ b/drivers/mtd/nand/raw/atmel/nand-controller.c @@ -405,6 +405,7 @@ static int atmel_nand_dma_transfer(struc dma_async_issue_pending(nc->dmac); wait_for_completion(&finished); + dma_unmap_single(nc->dev, buf_dma, len, dir); return 0; From patchwork Wed Oct 19 08:21: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: 4489 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp201778wrs; Wed, 19 Oct 2022 01:38:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7hbo3+X05QoJSbDBgAuouf3E8fJ7Hn40DMXI7JEre/mhL5yCEiSCnQK+wz2cBHNRqFr1qz X-Received: by 2002:a05:6402:1a4d:b0:459:319f:ff80 with SMTP id bf13-20020a0564021a4d00b00459319fff80mr6429349edb.144.1666168739760; Wed, 19 Oct 2022 01:38:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666168739; cv=none; d=google.com; s=arc-20160816; b=IGmWYb+LTogZjoxhL8V8Raovh71KXZ0OXHnizWZg6mzstXBbdZSvz7lxKzZ9IvVthg 5jmzUsdskLIEK6M6MSXP23pjlQVlsSlVG43j0Mq5ACk8/Un3IRDDlZ5zK4qtZ0gaz8j0 e/J2tyDSeRDyc7GBLd6AMdLH/rP3JhmM42cpwsNtIDg5OGkTaWberROX0vaC88Mh8fgd dNx1eBrARcVuI+vl8SaspECwmiWJ14CfyXywOToE/OaK0yV1AW/MV2dmiNsVAhaO4sam FMBjMsPthx1RkHIUEeMHD9T3JHvo5EmWHYqBThDrmHOYwHKuRwyIT6sD0jkM5QkqI9Us eNIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NihwllnY6AVdg/3Cz/8TgFaBHj1LSocb7Iiup20i7uo=; b=Vd79V6JxznZPzk9GRyoG60G0GdfmEKxYe5kMrOOVqVZ6cbBQFdACx60zgEPDru8yIe yegvfQVAmI1ujWrU3FP+iiv0n0BBcuYti3HOtJMrvcWejU2YohdG4mvK209951wAXhy1 X64GTKjex4T44H1xQMXJTyW1aslb+LdLEZN45W9VbmpUbNmYhstQzxb3EvS9FuMsc/VT 2M5ezMuOinJmjNRoHdLwrdyEBZy3KqfKZIhY+CgR4qD6HLHirt7yoO55U0BaRE/50GFp uZanv3lik1DhmQUJwYbU+EF3IwNxQ7BG6qR6EQgOH98a6nr1oCh3S8m892KzULT3zsKF bxrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iRicA+L0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id tb8-20020a1709078b8800b00781df71dbc1si12514951ejc.174.2022.10.19.01.38.32; Wed, 19 Oct 2022 01:38: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=iRicA+L0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229963AbiJSIhr (ORCPT + 99 others); Wed, 19 Oct 2022 04:37:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230106AbiJSIhb (ORCPT ); Wed, 19 Oct 2022 04:37:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14EED5F123; Wed, 19 Oct 2022 01:37: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 C8013617D1; Wed, 19 Oct 2022 08:37:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1212C433D6; Wed, 19 Oct 2022 08:37:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168647; bh=jQ+B1dF/CbazLraF4cxocdEvsIZ59fSeau73fNVHckg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iRicA+L00irScEO/xZO4IdenjyAmtUYc/D8wqRrdGbaUnPoWIz2mglCNJahmdtnCe +Whxb1e7yvNWaXppQ1YjsLO1k2ZAA6zjnkbTMWxOKc3n5MnY849HkWd2PG/ckRwKDg XQNG3TuTT61DKTXuE24s+r/DCN1Zt2i6AIjwtVgM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Begunkov , Jens Axboe Subject: [PATCH 6.0 010/862] io_uring: add custom opcode hooks on fail Date: Wed, 19 Oct 2022 10:21:37 +0200 Message-Id: <20221019083250.464199615@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104552437536882?= X-GMAIL-MSGID: =?utf-8?q?1747104552437536882?= From: Pavel Begunkov commit a47b255e90395bdb481975ab3d9e96fcf8b3165f upstream. Sometimes we have to do a little bit of a fixup on a request failuer in io_req_complete_failed(). Add a callback in opdef for that. Cc: stable@vger.kernel.org Signed-off-by: Pavel Begunkov Link: https://lore.kernel.org/r/b734cff4e67cb30cca976b9face321023f37549a.1663668091.git.asml.silence@gmail.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- io_uring/io_uring.c | 4 ++++ io_uring/opdef.h | 1 + 2 files changed, 5 insertions(+) --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -823,8 +823,12 @@ inline void __io_req_complete(struct io_ void io_req_complete_failed(struct io_kiocb *req, s32 res) { + const struct io_op_def *def = &io_op_defs[req->opcode]; + req_set_fail(req); io_req_set_res(req, res, io_put_kbuf(req, IO_URING_F_UNLOCKED)); + if (def->fail) + def->fail(req); io_req_complete_post(req); } --- a/io_uring/opdef.h +++ b/io_uring/opdef.h @@ -36,6 +36,7 @@ struct io_op_def { int (*issue)(struct io_kiocb *, unsigned int); int (*prep_async)(struct io_kiocb *); void (*cleanup)(struct io_kiocb *); + void (*fail)(struct io_kiocb *); }; extern const struct io_op_def io_op_defs[]; From patchwork Wed Oct 19 08:21: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: 4493 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp201957wrs; Wed, 19 Oct 2022 01:39:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM51D43cT9RMzfH5WhUVUxe0unxnfPQ1O6WcxFhZQwDXheLSjKk9vA1KZ8u4LDk6nwEJsYvM X-Received: by 2002:a17:907:805:b0:782:1a0d:337f with SMTP id wv5-20020a170907080500b007821a0d337fmr5838986ejb.475.1666168769057; Wed, 19 Oct 2022 01:39:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666168769; cv=none; d=google.com; s=arc-20160816; b=Qe9VR7sZLYK4h+oL6ygzKskxaNoMpassYbNkfVlhDRMZISfdfv/QQARq3k8yHx/M07 XuUU2234QrJr9cAabOVh7r0pfrTkjuxl5ATKMDPPomepihmjw7Oshr1cQSmElKSkIZY1 YFwg+3pB8qxgg+1/e2F15v/ksNUdMDWjZ+NoIj1XBfoRUCMY6UcC+AX43OLouGZmQKDL Bn4SFRPEV9W2I5RfrV/H4ri8/KsLTvRCBxiXQx8u1PBbj4tUs23Ia7TqxMqLElY8+twg Aep/Ib0a7KVw/E1YBtnKHGwBS59r7s6upQIxn9BYClnYNuWIMZnHqNUEZXerViaiMuiz aCFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=32AM7usezyIGkX1v9BuayHv1EJk/9gkwil1+bD7BaQw=; b=qtlKd63S/PxzcO1K+3ZNn6NDKaqgcTYwiRKNX1yDqQQ0SrcSj+J2fyzMKc9yZdOiRg jmI/shYMqunq8Yf5lh36whq5nfuJoUWeRVtNPObqlz3l/HK4+9z/awmwesh6wro10I1l q0X0Ph4ZQLJiBFBWlSYiqJEtVVc83o2JDrK5C5ca45nP5UwJg/JdZVmhiylAto3u2b/Q MY2uplV6wYrSB5Yb2PNGwKLBnw0zqq3Q5fQt5TMNmfoWwMbO/OZX0Lssx3K3mZ8PrPa9 tuP9cG4f29B3c6btkjo6owDQGUwPUEWpE0MuGRLJ4HDpg9rBV60AdYAbFyiX2GC+zA9c 5QdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nWAB9h1Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q10-20020a170906678a00b0078da83673a3si11670741ejp.138.2022.10.19.01.39.04; Wed, 19 Oct 2022 01:39: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=nWAB9h1Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229848AbiJSIia (ORCPT + 99 others); Wed, 19 Oct 2022 04:38:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230215AbiJSIiB (ORCPT ); Wed, 19 Oct 2022 04:38: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 25C437EFD9; Wed, 19 Oct 2022 01:37:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2ACE4617D1; Wed, 19 Oct 2022 08:37:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28A7EC433D7; Wed, 19 Oct 2022 08:37:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168654; bh=E3KbfE3JN8ZFZ/u0udqsUtKwyNtjegt0C+1iFAwMfeA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nWAB9h1Zb1Pae7YRh6R9cpp4lQUk60tTZV7QzvC4xBfY4Q+c3Q7ZgxDqELZXgITdA 3CELAtU0OSqu6vDXK7zKFyJ8K0Swya6JEYxA/V+DAZf9mX+XKw9exjji6aNjUmXyBT 1DUy5GnxrTwe+YNhPPLI9Mf+UDi+C3Yr/gXMyCUA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Begunkov , Jens Axboe Subject: [PATCH 6.0 011/862] io_uring/rw: dont lose partial IO result on fail Date: Wed, 19 Oct 2022 10:21:38 +0200 Message-Id: <20221019083250.513888626@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104583609290334?= X-GMAIL-MSGID: =?utf-8?q?1747104583609290334?= From: Pavel Begunkov commit 47b4c68660752facfa6247b1fc9ca9d722b8b601 upstream. A partially done read/write may end up in io_req_complete_failed() and loose the result, make sure we return the number of bytes processed. Cc: stable@vger.kernel.org Signed-off-by: Pavel Begunkov Link: https://lore.kernel.org/r/05e0879c226bcd53b441bf92868eadd4bf04e2fc.1663668091.git.asml.silence@gmail.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- io_uring/opdef.c | 6 ++++++ io_uring/rw.c | 8 ++++++++ io_uring/rw.h | 1 + 3 files changed, 15 insertions(+) --- a/io_uring/opdef.c +++ b/io_uring/opdef.c @@ -69,6 +69,7 @@ const struct io_op_def io_op_defs[] = { .issue = io_read, .prep_async = io_readv_prep_async, .cleanup = io_readv_writev_cleanup, + .fail = io_rw_fail, }, [IORING_OP_WRITEV] = { .needs_file = 1, @@ -85,6 +86,7 @@ const struct io_op_def io_op_defs[] = { .issue = io_write, .prep_async = io_writev_prep_async, .cleanup = io_readv_writev_cleanup, + .fail = io_rw_fail, }, [IORING_OP_FSYNC] = { .needs_file = 1, @@ -105,6 +107,7 @@ const struct io_op_def io_op_defs[] = { .name = "READ_FIXED", .prep = io_prep_rw, .issue = io_read, + .fail = io_rw_fail, }, [IORING_OP_WRITE_FIXED] = { .needs_file = 1, @@ -119,6 +122,7 @@ const struct io_op_def io_op_defs[] = { .name = "WRITE_FIXED", .prep = io_prep_rw, .issue = io_write, + .fail = io_rw_fail, }, [IORING_OP_POLL_ADD] = { .needs_file = 1, @@ -273,6 +277,7 @@ const struct io_op_def io_op_defs[] = { .name = "READ", .prep = io_prep_rw, .issue = io_read, + .fail = io_rw_fail, }, [IORING_OP_WRITE] = { .needs_file = 1, @@ -287,6 +292,7 @@ const struct io_op_def io_op_defs[] = { .name = "WRITE", .prep = io_prep_rw, .issue = io_write, + .fail = io_rw_fail, }, [IORING_OP_FADVISE] = { .needs_file = 1, --- a/io_uring/rw.c +++ b/io_uring/rw.c @@ -984,6 +984,14 @@ static void io_cqring_ev_posted_iopoll(s io_cqring_wake(ctx); } +void io_rw_fail(struct io_kiocb *req) +{ + int res; + + res = io_fixup_rw_res(req, req->cqe.res); + io_req_set_res(req, res, req->cqe.flags); +} + int io_do_iopoll(struct io_ring_ctx *ctx, bool force_nonspin) { struct io_wq_work_node *pos, *start, *prev; --- a/io_uring/rw.h +++ b/io_uring/rw.h @@ -21,3 +21,4 @@ int io_readv_prep_async(struct io_kiocb int io_write(struct io_kiocb *req, unsigned int issue_flags); int io_writev_prep_async(struct io_kiocb *req); void io_readv_writev_cleanup(struct io_kiocb *req); +void io_rw_fail(struct io_kiocb *req); From patchwork Wed Oct 19 08:21: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: 4491 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp201934wrs; Wed, 19 Oct 2022 01:39:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6dWaCRcd+SlxoQIFgRMEKZBkcf5KOQ7go0MhaVSF+nTo2lbESNpzgBDQM6wgxv2IAVIeKe X-Received: by 2002:a17:90a:5308:b0:20b:1eae:c94e with SMTP id x8-20020a17090a530800b0020b1eaec94emr44010668pjh.88.1666168764759; Wed, 19 Oct 2022 01:39:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666168764; cv=none; d=google.com; s=arc-20160816; b=Y+s1F5kagcNVwwfg3XAwsKmsS8+C2/d/ImVPesnZHVR8XKwRDT/tJ5YWmLYmON4yOd ABrtv6Zlacir/4io+t7qpHJ8ucqxaINQ7McnCWKlj2yF1g3LNM02FoG8noXdx099Azdm usQVeaF7x1yHD3mny9kUjzxEAKDC7cssX0j4zTY8dLU7o5uJT/ZFDiKXAvV5ZvQl0/ko M/jdTSV610Wv5TjIzarCv+aoIx0hzYToBiLoyPT6tpQnRMhyFvFTaKgYVciOUX3+OSCl lmuG/9Q7LK36cL+bg8fDSK+0UGo8M1KKxC6L3cUNTfi+x35RFDcff4t8DsMxs4tEztku CljA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=b49UaQzf4AMCHdUBigUkxEYRhmSlahKgJucpRHdvgSE=; b=gUSfGAgO8kEtukFWdczx1jO+qyw8hf1DXd1WzPa+ApKzm+FvQfJwQPR97KT7j87RD+ ueqm8ql9OYb0jJ0unZDalt5UX+rRr9yk0V8TADbslFr69VRzTaodhtj4XvwnehgN4mf/ ql0Se3L1tf42GEU23DSijLgq1bRJqt6oTXfN9yW9Fw8sGa44n3yQTuQRjeM+YJz0j76s nMlH4stP8bAa4v8KTT21UMEUWElvbwbRI9WKAT94JnP17G8g5OnF29jLdDqzrlh5P47i PBwwsD/HJlAVKW2wibgdDfwl0lWQ7H+FOHz5Ma5/4xCYh+C+kXncSIPeDPELSjmv7myo 5CuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yu5oBujC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o17-20020a17090ac71100b0020d23323b88si16296291pjt.133.2022.10.19.01.39.11; Wed, 19 Oct 2022 01:39: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=yu5oBujC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230219AbiJSIim (ORCPT + 99 others); Wed, 19 Oct 2022 04:38:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230217AbiJSIi3 (ORCPT ); Wed, 19 Oct 2022 04:38:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 676997F0B1; Wed, 19 Oct 2022 01:37: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 5A151617DE; Wed, 19 Oct 2022 08:37:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A1E9C433D7; Wed, 19 Oct 2022 08:37:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168657; bh=ZKHuwzbbayTKexEwFeJx2fK4RZ5sHCm4E9pO/aAbQDQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yu5oBujCCryBOT9R41A6v5vNPWc4HQoUeiZNS+P7H1jeX5JH6B701yucSLVxTDSoF ZwEq0E6+SIoMCBq6UMy7y94H1uwqL9fExVIeQu4QRs7nUvyCZOOoxhxcuZIq1Hky/J wgpabSTQqfhUz8IhYNBYBcQL3gpMZMKVEYCEg30g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Begunkov , Jens Axboe Subject: [PATCH 6.0 012/862] io_uring/net: dont lose partial send/recv on fail Date: Wed, 19 Oct 2022 10:21:39 +0200 Message-Id: <20221019083250.547079300@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104578844102511?= X-GMAIL-MSGID: =?utf-8?q?1747104578844102511?= From: Pavel Begunkov commit 7e6b638ed501cced4e472298d6b08dd16346f3a6 upstream. Just as with rw, partial send/recv may end up in io_req_complete_failed() and loose the result, make sure we return the number of bytes processed. Cc: stable@vger.kernel.org Signed-off-by: Pavel Begunkov Link: https://lore.kernel.org/r/a4ff95897b5419356fca9ea55db91ac15b2975f9.1663668091.git.asml.silence@gmail.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- io_uring/net.c | 10 ++++++++++ io_uring/net.h | 2 ++ io_uring/opdef.c | 4 ++++ 3 files changed, 16 insertions(+) --- a/io_uring/net.c +++ b/io_uring/net.c @@ -1087,6 +1087,16 @@ int io_sendzc(struct io_kiocb *req, unsi return IOU_OK; } +void io_sendrecv_fail(struct io_kiocb *req) +{ + struct io_sr_msg *sr = io_kiocb_to_cmd(req, struct io_sr_msg); + int res = req->cqe.res; + + if (req->flags & REQ_F_PARTIAL_IO) + res = sr->done_io; + io_req_set_res(req, res, req->cqe.flags); +} + int io_accept_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) { struct io_accept *accept = io_kiocb_to_cmd(req, struct io_accept); --- a/io_uring/net.h +++ b/io_uring/net.h @@ -43,6 +43,8 @@ int io_recvmsg_prep(struct io_kiocb *req int io_recvmsg(struct io_kiocb *req, unsigned int issue_flags); int io_recv(struct io_kiocb *req, unsigned int issue_flags); +void io_sendrecv_fail(struct io_kiocb *req); + int io_accept_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe); int io_accept(struct io_kiocb *req, unsigned int issue_flags); --- a/io_uring/opdef.c +++ b/io_uring/opdef.c @@ -157,6 +157,7 @@ const struct io_op_def io_op_defs[] = { .issue = io_sendmsg, .prep_async = io_sendmsg_prep_async, .cleanup = io_sendmsg_recvmsg_cleanup, + .fail = io_sendrecv_fail, #else .prep = io_eopnotsupp_prep, #endif @@ -174,6 +175,7 @@ const struct io_op_def io_op_defs[] = { .issue = io_recvmsg, .prep_async = io_recvmsg_prep_async, .cleanup = io_sendmsg_recvmsg_cleanup, + .fail = io_sendrecv_fail, #else .prep = io_eopnotsupp_prep, #endif @@ -316,6 +318,7 @@ const struct io_op_def io_op_defs[] = { #if defined(CONFIG_NET) .prep = io_sendmsg_prep, .issue = io_send, + .fail = io_sendrecv_fail, #else .prep = io_eopnotsupp_prep, #endif @@ -331,6 +334,7 @@ const struct io_op_def io_op_defs[] = { #if defined(CONFIG_NET) .prep = io_recvmsg_prep, .issue = io_recv, + .fail = io_sendrecv_fail, #else .prep = io_eopnotsupp_prep, #endif From patchwork Wed Oct 19 08:21: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: 4495 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp202041wrs; Wed, 19 Oct 2022 01:39:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7vAjaxQYwsU4+QZp14Q3/wjuNC6kWBeQFXgYYCCK4A3frrz2q/UqGHUyqNKYVEHJepabw0 X-Received: by 2002:a05:6402:3408:b0:43c:2dd3:d86b with SMTP id k8-20020a056402340800b0043c2dd3d86bmr6420192edc.108.1666168785678; Wed, 19 Oct 2022 01:39:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666168785; cv=none; d=google.com; s=arc-20160816; b=ciZFZaOy3dLzRhs9c26pIF1UiNnIrp+e6k0pi2pVIz1IT4+jklikkri2XFk3eHj34g HI5/f9y1De5hBHLlIObUK/gbmKoZ1By1Xb2GSlfEV0d32nuiW9RVWR7+dhcLvMd3wbu9 Jkj4PGlKlGvx8xJ4Oh0bapX7aimKdquxjH6LRrszkfA3eAYciOB2UcxWOnikAvR/OuIc OjxoWRUFW4bMbUZwQG1b85Out20Vtm3qBxBhboyLQP0dwg3SzBDxeO4PPtnbCOL/Q8cz aKW1bYQ+Y09+w3JxHiLqi+ppEwOVREylGH5ZrR9jrBqEyGYyjtIm3IKIBTs+mhKZJ6pP +FIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=E0r95wIv893gtz03d4t/36NTzh6TxpbQsyAIGqs+GAo=; b=cOXwnu5PRS4Zj5sKtTE1WqizVYzX3B7KIplUwAUFWwpHKnBtmKEif4q96NqZ7ALUYg uNuNfT7MQaS/flZbLChJEWH9LY/uxQhL5BYx37vjCo6xfEHKlTj5ZvvMIl8Ha/Zcl5bn OiLVoZZatH2N8pCCSEVPl5Y/FNl4vfHgmmS+ITGE5i7hbX7buh+k5jSMRms7B7kcI2sn YV7UaCZh62kZcitwf2ZKorlaVZR8HKMX41gOnvwRodDAszfBJUbC12k2vw0RTC7NMXqE QKHyE+eamP3jbEj+qFEieiTc68vM1OoSYjCshBgERnxXXGdI3zM6QCVem9rDBaM18EBV NfOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1bgSA8tT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g23-20020a50ec17000000b00459102fa225si12313791edr.137.2022.10.19.01.39.21; Wed, 19 Oct 2022 01:39: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=1bgSA8tT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230195AbiJSIjC (ORCPT + 99 others); Wed, 19 Oct 2022 04:39:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230121AbiJSIib (ORCPT ); Wed, 19 Oct 2022 04:38:31 -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 6FFB37FE4D; Wed, 19 Oct 2022 01:38: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 10542B822CD; Wed, 19 Oct 2022 08:37:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 690DCC433D7; Wed, 19 Oct 2022 08:37:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168660; bh=34Gr3PfE7aGRPmCyYfGLKbsdztwJ8w1JB2Ilz19qWMU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1bgSA8tT7zqZJR+VIjFxoLpTZeq0JOW/Szm+treDt8JLt0ss3Z68ELdX5AueIDRJh NxBmXZLedXFeDinkvQK0N3g0bro2Q9kHeu6oc3Lfc8zawqMxeU03e0+rt4nhxIz8FC IuAw65DHHZXDYs68vPbsVz4GgZLyFqoIXM54wC6E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Begunkov , Jens Axboe , Beld Zhang Subject: [PATCH 6.0 013/862] io_uring/rw: fix unexpected link breakage Date: Wed, 19 Oct 2022 10:21:40 +0200 Message-Id: <20221019083250.585656755@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104600590442277?= X-GMAIL-MSGID: =?utf-8?q?1747104600590442277?= From: Pavel Begunkov commit bf68b5b34311ee57ed40749a1257a30b46127556 upstream. req->cqe.res is set in io_read() to the amount of bytes left to be done, which is used to figure out whether to fail a read or not. However, io_read() may do another without returning, and we stash the previous value into ->bytes_done but forget to update cqe.res. Then we ask a read to do strictly less than cqe.res but expect the return to be exactly cqe.res. Fix the bug by updating cqe.res for retries. Cc: stable@vger.kernel.org Reported-and-Tested-by: Beld Zhang Signed-off-by: Pavel Begunkov Link: https://lore.kernel.org/r/3a1088440c7be98e5800267af922a67da0ef9f13.1664235732.git.asml.silence@gmail.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- io_uring/rw.c | 1 + 1 file changed, 1 insertion(+) --- a/io_uring/rw.c +++ b/io_uring/rw.c @@ -823,6 +823,7 @@ int io_read(struct io_kiocb *req, unsign return -EAGAIN; } + req->cqe.res = iov_iter_count(&s->iter); /* * Now retry read with the IOCB_WAITQ parts set in the iocb. If * we get -EIOCBQUEUED, then we'll get a notification when the From patchwork Wed Oct 19 08:21: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: 4494 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp201976wrs; Wed, 19 Oct 2022 01:39:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5GCGtGUw5Hdm3VkLYOfb9wg+PLeIiDh0noIx+UaddxKKPES8jzlIStQcClstpPmP4QhiqV X-Received: by 2002:a05:6402:b35:b0:45c:9c9d:2531 with SMTP id bo21-20020a0564020b3500b0045c9c9d2531mr6301814edb.410.1666168773008; Wed, 19 Oct 2022 01:39:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666168773; cv=none; d=google.com; s=arc-20160816; b=IJYHYjFrn5NGoLjjUX77HjN0WQTLQh9Ja8Wx1zA5ll3GB+wLOY3NaQmnOCIUagHPLu aunZsGqBLL8LZAxuxC2esD97LBMs8YanY1Nh8OvBKx2KocWErZSIsl6fX1ZZsqBxmUCz LYjAh3lfaoQfy6eox7apSEmkTTD+QHyyp7RvN3YCQf47pEPMDq7qD0sBV2vQK5Q3MqMs 3zxZeMPZx/TQebYrt8gm8qar0juhQa3Y4G1lIGJg/XYNe/UlD5pJt86Gg5mfeKQuHBG7 NZkKtW2UY/l2h4hN4TxgqMs+vI6crPuL05urnrMlPVwGdcHf636XJTxEIJoE3kzfdwmJ Gn1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yepoTGFW+of18CPBRdBJWn4GprzW71TYTbduBxG80sY=; b=U/t3Gz1w0mTrSp0DDNowOmYPTnv87+Vnj+N3ydZKAHoFV1L/68wuoJ8fhb3mLk99I6 JRVjcw3MkSQI4nRuCYR5iIiI8kMbTC7S7Kei9jAugqYt1yV3i5wBdkW8rQTC2oO1h1HJ lyy++nYiHKqr3i03DutFVknMBCwobJ7O6oQyB8FgJA15ElsOfKrG81O+UrdtArCMn2FL sMJQmntAHzcwD3tEawF02c6dOD1jCfj0zi0gyrLgVVox0SoPn51MVj6/8FSjJ9istNe1 7wWEICmHMLYIbeH2G6mVO1wiWuYJTXikp8Ygv9PdTjEyckQpQNJIvssaonl/jd07fEix W5FA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Wev42oRa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sh37-20020a1709076ea500b0078d9d69ae0dsi14174687ejc.877.2022.10.19.01.39.07; Wed, 19 Oct 2022 01:39: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=Wev42oRa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230262AbiJSIil (ORCPT + 99 others); Wed, 19 Oct 2022 04:38:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230212AbiJSIi3 (ORCPT ); Wed, 19 Oct 2022 04:38:29 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E052804A7; Wed, 19 Oct 2022 01:37: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 00B0DB822BC; Wed, 19 Oct 2022 08:37:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55B53C433D6; Wed, 19 Oct 2022 08:37:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168663; bh=xKUNb8xzWoGBdw3o8dM2lLi+Z8ucdUJntJX38Phs4e0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wev42oRaZV10GbsOZSM6QT7fG6QBfdEjQ6miniL0m8YX4AWXXn6H44anv/eRAMhp+ oSfAgTXPytgi2edYRy+3NgWImG8WrMAE40KNgD562iFr/RpHh8ywX6zGjwT5POyOqs rASW2N/zRoVUMHOiCZVq6RVj9Pp6fB57DGZQ5dyI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Begunkov , Jens Axboe Subject: [PATCH 6.0 014/862] io_uring/rw: dont lose short results on io_setup_async_rw() Date: Wed, 19 Oct 2022 10:21:41 +0200 Message-Id: <20221019083250.634664654@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104587435749124?= X-GMAIL-MSGID: =?utf-8?q?1747104587435749124?= From: Pavel Begunkov commit c278d9f8ac0db5590909e6d9e85b5ca2b786704f upstream. If a retry io_setup_async_rw() fails we lose result from the first io_iter_do_read(), which is a problem mostly for streams/sockets. Cc: stable@vger.kernel.org Signed-off-by: Pavel Begunkov Link: https://lore.kernel.org/r/0e8d20cebe5fc9c96ed268463c394237daabc384.1664235732.git.asml.silence@gmail.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- io_uring/rw.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) --- a/io_uring/rw.c +++ b/io_uring/rw.c @@ -794,10 +794,12 @@ int io_read(struct io_kiocb *req, unsign iov_iter_restore(&s->iter, &s->iter_state); ret2 = io_setup_async_rw(req, iovec, s, true); - if (ret2) - return ret2; - iovec = NULL; + if (ret2) { + ret = ret > 0 ? ret : ret2; + goto done; + } + io = req->async_data; s = &io->s; /* From patchwork Wed Oct 19 08:21: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: 4499 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp202292wrs; Wed, 19 Oct 2022 01:40:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4eXJKXRsCXkKdlnWKxNvAUVMJPRelIinLGildLCGuH2z4XuKJ8zFJuy2k82o1v1M3kpT3v X-Received: by 2002:a17:906:8a48:b0:78d:acdc:b7d9 with SMTP id gx8-20020a1709068a4800b0078dacdcb7d9mr5914614ejc.500.1666168819222; Wed, 19 Oct 2022 01:40:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666168819; cv=none; d=google.com; s=arc-20160816; b=oVr76sK7qhkqVcWAh4UlBkJNxXNp32M/VKec/uA6XmgkG2mwwmhjoMxOPzRaAte11i vq+A1XdH2YjMM+ypJghtidzVjG2Xi7SctMHpgtkHNkRAEvmL23uvhkDWyRVh8BJblf+p +2AGcPt2QzodrCFH/VR5lYGSkAd6+JmNI238zN4PzUf5zkVBV+dytdB4IFaYtGtlnEV0 3MMYN6wC4TR80eaf3UchgqIOVxJplZzZHYIFPq1WsyIfrAYbwrS7i6xv8aRrimIo+cNk 0dIO2M9fcoRD0vw2VOC7n8LYh5AZ/KDBNjibHmpakxYt0CoMsuCXHMmzLLMuXfykmefb NHzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+N5nLQVKkAN4nrxK3aDqgG7rFNCtQpOrSklnQPgCv0I=; b=tycobQt6q2U07FKbdB4YPlllWfh5hXnQsDFklgS9Tl3sRYF5YLyQ0f4TkH3vt+oKnH lMLEU7PtU3U6fZf/uYv0XrYgY49qHXM48Gn/cF1Vk5PzceIRYQX8XhT63kOfpzSCuEyK 0F0LO/KfW8SSQiuQ2LfoIB2V2s3/vXQfXMWASqJnHvZiE1yAjK/9tsQYoMygnjfZ/r2T vXNOjORqlejTveomLnkhs85sKZo4We+tJJsS9aRelfxauQwgKbdNWXLzRMINiNOAJMFu U3nuODA55uYIjUGvuv+PHeQC0qn/z53G9FZnu0yv9NbFioMgWHqE/8ucPmg7ernqmRME zZIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lJuUpEjy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p11-20020a056402500b00b0045d292ef641si13622580eda.493.2022.10.19.01.39.54; Wed, 19 Oct 2022 01:40: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=lJuUpEjy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230272AbiJSIjJ (ORCPT + 99 others); Wed, 19 Oct 2022 04:39:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230241AbiJSIii (ORCPT ); Wed, 19 Oct 2022 04:38:38 -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 C5B1780BD4; Wed, 19 Oct 2022 01:38: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 70DCCCE20DB; Wed, 19 Oct 2022 08:37:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 673F3C433D6; Wed, 19 Oct 2022 08:37:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168666; bh=B3ERKmsNnN430Zj+rZLDONZtKrHxu1wQ+S1atC0iTRk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lJuUpEjyzlaNFsGhcJ4pVFs4omO5dj9VlSF3b30po7RwNV9feOYaqoGUbbFPsNIuO w0BnOgqO1afFo8o3F4FjGHalv/JUfDc6/8yuruN7DAdlw28Isd/uHKcVkcW/hUDBha wdX7xmTyBe19AJnEk9vEP3Qf7KaOev5tHFN8wVpc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stefan Metzmacher , Pavel Begunkov , Jens Axboe Subject: [PATCH 6.0 015/862] io_uring/net: fix fast_iov assignment in io_setup_async_msg() Date: Wed, 19 Oct 2022 10:21:42 +0200 Message-Id: <20221019083250.679094053@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104636055079861?= X-GMAIL-MSGID: =?utf-8?q?1747104636055079861?= From: Stefan Metzmacher commit 3e4cb6ebbb2bad201c1186bc0b7e8cf41dd7f7e6 upstream. I hit a very bad problem during my tests of SENDMSG_ZC. BUG(); in first_iovec_segment() triggered very easily. The problem was io_setup_async_msg() in the partial retry case, which seems to happen more often with _ZC. iov_iter_iovec_advance() may change i->iov in order to have i->iov_offset being only relative to the first element. Which means kmsg->msg.msg_iter.iov is no longer the same as kmsg->fast_iov. But this would rewind the copy to be the start of async_msg->fast_iov, which means the internal state of sync_msg->msg.msg_iter is inconsitent. I tested with 5 vectors with length like this 4, 0, 64, 20, 8388608 and got a short writes with: - ret=2675244 min_ret=8388692 => remaining 5713448 sr->done_io=2675244 - ret=-EAGAIN => io_uring_poll_arm - ret=4911225 min_ret=5713448 => remaining 802223 sr->done_io=7586469 - ret=-EAGAIN => io_uring_poll_arm - ret=802223 min_ret=802223 => res=8388692 While this was easily triggered with SENDMSG_ZC (queued for 6.1), it was a potential problem starting with 7ba89d2af17aa879dda30f5d5d3f152e587fc551 in 5.18 for IORING_OP_RECVMSG. And also with 4c3c09439c08b03d9503df0ca4c7619c5842892e in 5.19 for IORING_OP_SENDMSG. However 257e84a5377fbbc336ff563833a8712619acce56 introduced the critical code into io_setup_async_msg() in 5.11. Fixes: 7ba89d2af17aa ("io_uring: ensure recv and recvmsg handle MSG_WAITALL correctly") Fixes: 257e84a5377fb ("io_uring: refactor sendmsg/recvmsg iov managing") Cc: stable@vger.kernel.org Signed-off-by: Stefan Metzmacher Reviewed-by: Pavel Begunkov Link: https://lore.kernel.org/r/b2e7be246e2fb173520862b0c7098e55767567a2.1664436949.git.metze@samba.org Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- io_uring/net.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/io_uring/net.c +++ b/io_uring/net.c @@ -165,8 +165,10 @@ static int io_setup_async_msg(struct io_ memcpy(async_msg, kmsg, sizeof(*kmsg)); async_msg->msg.msg_name = &async_msg->addr; /* if were using fast_iov, set it to the new one */ - if (!async_msg->free_iov) - async_msg->msg.msg_iter.iov = async_msg->fast_iov; + if (!kmsg->free_iov) { + size_t fast_idx = kmsg->msg.msg_iter.iov - kmsg->fast_iov; + async_msg->msg.msg_iter.iov = &async_msg->fast_iov[fast_idx]; + } return -EAGAIN; } From patchwork Wed Oct 19 08:21: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: 4496 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp202080wrs; Wed, 19 Oct 2022 01:39:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5M88kYOf/5y2DknD33JnDpJoUdp6+lgNn+gkKsHL8xwil8O20/2yKssUZOQ1o/DKbPAcLv X-Received: by 2002:aa7:c58a:0:b0:459:1511:6cff with SMTP id g10-20020aa7c58a000000b0045915116cffmr6419062edq.27.1666168792668; Wed, 19 Oct 2022 01:39:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666168792; cv=none; d=google.com; s=arc-20160816; b=fhcBIT4aCBiVySVivHCGqD4WBWr5GGGwZ2epKq9HgXJer+ySPSVi0SzeWOfT8kLQDV 6o1rSgTpSZNSp3SnxKCtaKUvuwc3uybXz9wdZM/0h8PwNLriwiAFw3Tq7KmbpfApOSwY LoApeNpTRKiVXrufyKNT+p6yGLl5dbBwtQpdM8laLHTvFzWqlJ0/ysZCPVOloseTPi+t Sw1RWCyWpr1ScHdm61PBu6KQkNxxjlbq1OjgrEprRi3cXqXGOdmuVfoc58VGnm377bWl zYrpxCQsnpVxeK/P+mklEvrxVMB72r4CIASajuv6gEIC2Pf7P+xNTDiDrMUM2MlPCZQK 2COw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rjdECyyZ+c4e9zhXoUuHu2Q0zpxW1WG+Lcf7217XDrU=; b=e8fosgy4dV9umGhcP6uRAAj3zvhnWacQdMre/gYhONq1udQgbC5Rbt9zOe3ajPCySo 2hq7/w6ZWWuX+NVU6fiCT5AD3oD8PrNjpwhiGZ2LVXojlaQmL9puJsTZtd4waxacqhQL yuThTYlwd3I1bHCyCmO0cKvHQ4uf+mXgVDniB5Aot58tSDyIBkeapKR1iMNrjkdG2qnl +lk9vbyo97Kd4PdhaUpBwiapELzdyab0t65s//SJE/0KXmqnYWoCG3F6+yRlC15Xfg1K d1yPRVi9I80Jauu3MORnkKgMt8IT0nsz/orafBwLCHUn/3+JYuk+/g2NEatshO6q5vzL NEJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Md3SfXS2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o9-20020a170906600900b0078054af5eeasi12832143ejj.374.2022.10.19.01.39.28; Wed, 19 Oct 2022 01:39: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=Md3SfXS2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230255AbiJSIjF (ORCPT + 99 others); Wed, 19 Oct 2022 04:39:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229958AbiJSIig (ORCPT ); Wed, 19 Oct 2022 04:38: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 AD2D781104; Wed, 19 Oct 2022 01:38:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 67A9B617DF; Wed, 19 Oct 2022 08:37:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6BC1CC4314F; Wed, 19 Oct 2022 08:37:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168669; bh=TCUsX9pBBpaSnQMGS5JBDj3c0U2M6hs+3F/Ihdd1P4Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Md3SfXS2nGKduRpJFAZGWOo+oGOOPoDOi+4MQDBJF7E0sBw/R/M5PwsNCG49kIa4V QOKqp39kzPuFk2o6qx+2cbCCKjH9cWQTE4bF2KB8DiQz6payDjU2ofpLx/NLm6Z7mG 2vFx8XNp+HUR7vtuhUVDDP4Ygj1BRLP1zcTErtTQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Begunkov , Jens Axboe Subject: [PATCH 6.0 016/862] io_uring/net: dont update msg_name if not provided Date: Wed, 19 Oct 2022 10:21:43 +0200 Message-Id: <20221019083250.727057238@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104608250548756?= X-GMAIL-MSGID: =?utf-8?q?1747104608250548756?= From: Pavel Begunkov commit 6f10ae8a155446248055c7ddd480ef40139af788 upstream. io_sendmsg_copy_hdr() may clear msg->msg_name if the userspace didn't provide it, we should retain NULL in this case. Cc: stable@vger.kernel.org Signed-off-by: Pavel Begunkov Link: https://lore.kernel.org/r/97d49f61b5ec76d0900df658cfde3aa59ff22121.1664486545.git.asml.silence@gmail.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- io_uring/net.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/io_uring/net.c +++ b/io_uring/net.c @@ -163,7 +163,8 @@ static int io_setup_async_msg(struct io_ } req->flags |= REQ_F_NEED_CLEANUP; memcpy(async_msg, kmsg, sizeof(*kmsg)); - async_msg->msg.msg_name = &async_msg->addr; + if (async_msg->msg.msg_name) + async_msg->msg.msg_name = &async_msg->addr; /* if were using fast_iov, set it to the new one */ if (!kmsg->free_iov) { size_t fast_idx = kmsg->msg.msg_iter.iov - kmsg->fast_iov; From patchwork Wed Oct 19 08:21: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: 4497 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp202113wrs; Wed, 19 Oct 2022 01:39:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Si69RfgUvuo+Ask6FCkQ1TyNx/fLoZGKUT84nZLVubLn+IX7uuIhFk6R6k5gVQnUjWfAj X-Received: by 2002:a05:6402:1d4e:b0:45c:b459:25cb with SMTP id dz14-20020a0564021d4e00b0045cb45925cbmr6413271edb.170.1666168798237; Wed, 19 Oct 2022 01:39:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666168798; cv=none; d=google.com; s=arc-20160816; b=yOsFclrp4Y/lDtzaP5RgjhrOWVPth0/G+UrJXJAVqiHlEMr++GBp1z2MMv4usK12CD bOSrwTqGnzFAGR+41RroO9aKmCFgCvtOoimHmx8MLaQqA51shhzky6guV6kzhLSuLNe4 4KeGHhIIK78je7MZm+i+Pt/KuOxyDltjJllkYRcevWOH6ksJgbec3B73jLHTwI89BzBA 9xB65ZcIAzujLj3HYUCxCZ3dSb0J5odPzMRorF8JRsgErrsk/UgfUgYsq2n95dA78z0q ciytPHfv/Yl8+SYxHu54Hgsecc5G2yuc1AvWYh7bSNgHJohntXHxvnnzwu3LSPY3vbZ/ LW4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UNTOP3a8ScbdLanu55IgUR0Wi2gtBF+VoxH8rPY6XMk=; b=rIr80dvSWH/NVBwARNScWnl4supiKI/0XjEcf8cdfZw0kkUArfH6NBN/oFy+FUgI5x 9uZgNf/nerbdAZAksB8yPItwo4RSXJeBsIvjtSWG8fMaygANBvIAhHgVDPiit1hoC5zs XncAikKYiU224JiJ+9AkcY7DRnl8BHI8yxDoaOeXZNCpjaOcrw7mixNWc8/UOHe964xh ItPS47xeRVKGUCwb1/DM50m8arVdiXMZsvPqwZm7DRavRXih7IVcjaWqLiv0xB+CcMTr WTqSFl/SiH1XiyZrdOI4douhHPNW7fRCFKDqFGPqXj30m6mEwmqWKzjBWynxx98Rn/0Z UhHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pE41ptUG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a056402190c00b0045d9a3adf48si8250137edz.591.2022.10.19.01.39.33; Wed, 19 Oct 2022 01:39: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=pE41ptUG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230241AbiJSIjM (ORCPT + 99 others); Wed, 19 Oct 2022 04:39:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230247AbiJSIii (ORCPT ); Wed, 19 Oct 2022 04:38:38 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6373981123; Wed, 19 Oct 2022 01:38: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 2B4FAB822BE; Wed, 19 Oct 2022 08:37:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 828C4C433C1; Wed, 19 Oct 2022 08:37:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168672; bh=6AAYlz6WMbyiz2zlzUmiFzfmzMYzCpqeoaRixFgbwJM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pE41ptUGKeM6c75YC0s9BvP+MKPFwWltgJuEAyu+SfzQ45F3X0pW9IZRoikK4pJuj iJ/EnMxbd58dUUudyEJKbmfs1o80zy1ppkPXgBBfSzx1ZCxSegqmNGr0yXKglkQy2T ldB/lMHuk0lQA3Tv+amJBmi0JKuHLkLb/oELkXgU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Begunkov , Jens Axboe Subject: [PATCH 6.0 017/862] io_uring: limit registration w/ SINGLE_ISSUER Date: Wed, 19 Oct 2022 10:21:44 +0200 Message-Id: <20221019083250.770950056@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104614231870789?= X-GMAIL-MSGID: =?utf-8?q?1747104614231870789?= From: Pavel Begunkov commit d7cce96c449e35bbfd41e830b341b95973891eed upstream. IORING_SETUP_SINGLE_ISSUER restricts what tasks can submit requests. Extend it to registration as well, so non-owning task can't do registrations. It's not necessary at the moment but might be useful in the future. Cc: # 6.0 Fixes: 97bbdc06a444 ("io_uring: add IORING_SETUP_SINGLE_ISSUER") Signed-off-by: Pavel Begunkov Link: https://lore.kernel.org/r/f52a6a9c8a8990d4a831f73c0571e7406aac2bba.1664237592.git.asml.silence@gmail.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- io_uring/io_uring.c | 3 +++ 1 file changed, 3 insertions(+) --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -3710,6 +3710,9 @@ static int __io_uring_register(struct io if (WARN_ON_ONCE(percpu_ref_is_dying(&ctx->refs))) return -ENXIO; + if (ctx->submitter_task && ctx->submitter_task != current) + return -EEXIST; + if (ctx->restricted) { if (opcode >= IORING_REGISTER_LAST) return -EINVAL; From patchwork Wed Oct 19 08:21: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: 4498 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp202222wrs; Wed, 19 Oct 2022 01:40:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7XFt8e4w5kI0NVupalqXB5c8aNPinJqpDAUronMrsGO+f63Aux6POJjxaf6pn6v+LFhd5a X-Received: by 2002:a17:906:4fca:b0:78d:b042:eeca with SMTP id i10-20020a1709064fca00b0078db042eecamr5612750ejw.685.1666168812384; Wed, 19 Oct 2022 01:40:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666168812; cv=none; d=google.com; s=arc-20160816; b=lRT3ZI0wp3gflI4CEtxWrF5/vn+Dn/LSQj9RU67288Kl7Gn/iM+mJQowGUH3KuWQ3I DQWqUftRbB8B08xhaPSt453puETtpOKlS2vpNnsrO3EbcBpYEiyAEnezC39dIbqyp69I myB7WO/e612+xygmqE+5hgZDd0q9xWPBe6HX+aoWsOjBPpTYPmodjGnm52BDVGUVr0QT oS6/rjIr7RxqJUksXT7jpdD60Kq3IvhDOGCFlyy0fbduEQUNYWvUgzhUxfH68YsSzmpP d95HRy3dZKs5RYF4dTZF5LLZWZUvRPHZYt+jolg6TRYd8ZQI709vpxDsSDgq8SRD9TB+ uufw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MoIGUngN6xxiQPS47laFp8Spogpof+Yt4rVgTTA/yQM=; b=dVJvkNlutMDoWPNm9zXXRBz1UuLVJE+yWbtP3uZs+hBrSnL05JMtz6fLivlWEZ/zm7 5vdapg34DjWxWW8cZfreHGBS8+O8Oxpnrig56uGqxVCuu450f3AbNmK3sTA7cNmZuQYp VEyCnD9RXCpFQG8gqAMRTRy3Q7Xfjm6oqN6pS1fOJKGUe6mVB9PoDdAGwrQRX02bV21g FRYw9yoPtt2xgrSupYGnuGiV+CFnbEAbCcpWS9tcEVlOphTXpLhfl4m24zF9y8uUO9rz DhJWNjLa3eX8odSD8zJQktxN4VoTFtja/7t+y0vkfCqsgcUo3cop6J9+0yQsp0OvBPk5 UUag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NkIYhfVf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id di10-20020a170906730a00b0078d51aa5967si16237436ejc.944.2022.10.19.01.39.47; Wed, 19 Oct 2022 01:40: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=NkIYhfVf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230314AbiJSIjU (ORCPT + 99 others); Wed, 19 Oct 2022 04:39:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230078AbiJSIik (ORCPT ); Wed, 19 Oct 2022 04:38: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 38EB38112C; Wed, 19 Oct 2022 01:38:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A9C17617AC; Wed, 19 Oct 2022 08:37:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4B48C43470; Wed, 19 Oct 2022 08:37:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168676; bh=72hmIiOc3TIOnfmh7t6u3JsBy/1wx4DTVUeW+p9gm0g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NkIYhfVfVbR4TXah9qmoTWoVzVSwPzhX66EG4VzNFPVJLWdTWeWtQ/EUsvMvdua2L 8eRg/iObNtg6PyzwieHahfyICEf24dugIFleWN/wj25Iycw663CmGRYtbDOE7mDoqV eIT2oJNCciQL5NutZWqCSq2W3443JEot21O/oBYg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aidan Sun , Jens Axboe Subject: [PATCH 6.0 018/862] io_uring/net: handle -EINPROGRESS correct for IORING_OP_CONNECT Date: Wed, 19 Oct 2022 10:21:45 +0200 Message-Id: <20221019083250.812246178@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104628426570766?= X-GMAIL-MSGID: =?utf-8?q?1747104628426570766?= From: Jens Axboe commit 3fb1bd68817288729179444caf1fd5c5c4d2d65d upstream. We treat EINPROGRESS like EAGAIN, but if we're retrying post getting EINPROGRESS, then we just need to check the socket for errors and terminate the request. This was exposed on a bluetooth connection request which ends up taking a while and hitting EINPROGRESS, and yields a CQE result of -EBADFD because we're retrying a connect on a socket that is now connected. Cc: stable@vger.kernel.org Fixes: 87f80d623c6c ("io_uring: handle connect -EINPROGRESS like -EAGAIN") Link: https://github.com/axboe/liburing/issues/671 Reported-by: Aidan Sun Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- io_uring/net.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) --- a/io_uring/net.c +++ b/io_uring/net.c @@ -46,6 +46,7 @@ struct io_connect { struct file *file; struct sockaddr __user *addr; int addr_len; + bool in_progress; }; struct io_sr_msg { @@ -1263,6 +1264,7 @@ int io_connect_prep(struct io_kiocb *req conn->addr = u64_to_user_ptr(READ_ONCE(sqe->addr)); conn->addr_len = READ_ONCE(sqe->addr2); + conn->in_progress = false; return 0; } @@ -1274,6 +1276,16 @@ int io_connect(struct io_kiocb *req, uns int ret; bool force_nonblock = issue_flags & IO_URING_F_NONBLOCK; + if (connect->in_progress) { + struct socket *socket; + + ret = -ENOTSOCK; + socket = sock_from_file(req->file); + if (socket) + ret = sock_error(socket->sk); + goto out; + } + if (req_has_async_data(req)) { io = req->async_data; } else { @@ -1290,13 +1302,17 @@ int io_connect(struct io_kiocb *req, uns ret = __sys_connect_file(req->file, &io->address, connect->addr_len, file_flags); if ((ret == -EAGAIN || ret == -EINPROGRESS) && force_nonblock) { - if (req_has_async_data(req)) - return -EAGAIN; - if (io_alloc_async_data(req)) { - ret = -ENOMEM; - goto out; + if (ret == -EINPROGRESS) { + connect->in_progress = true; + } else { + if (req_has_async_data(req)) + return -EAGAIN; + if (io_alloc_async_data(req)) { + ret = -ENOMEM; + goto out; + } + memcpy(req->async_data, &__io, sizeof(__io)); } - memcpy(req->async_data, &__io, sizeof(__io)); return -EAGAIN; } if (ret == -ERESTARTSYS) From patchwork Wed Oct 19 08:21: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: 4500 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp202294wrs; Wed, 19 Oct 2022 01:40:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM52lu80xXALCnvGvsETROXnO+YhgHDOXSXxKK7DOuNNCs35/pWfgyhMGDOnJbwWgO+eHV+d X-Received: by 2002:a17:907:7250:b0:791:9093:47f7 with SMTP id ds16-20020a170907725000b00791909347f7mr5769763ejc.278.1666168819291; Wed, 19 Oct 2022 01:40:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666168819; cv=none; d=google.com; s=arc-20160816; b=cB250zpCsrf1brC7FbQl5C9unMQXgQDwE6b2r58YvgxswoLht7CaGQrkMENP7bOCRV tf2wydglBbsOO4ZGHY9Kbn9wNqmwfRvyu3PZ1XYbrYGIfM2we2pA00Kr0gmScjeW7qPT +pT9mdLw0PPe/igzGj23viScWAYL8qJeDDewtJozMizHR6Aen6ImomLyxpu2D6M+K8x1 /WD9tHtfLpo43fD+WdEOcK6MQOr4afYBWJxix7K7dwxKIz6CFEXvHg66EA8Pyd/7YxKa 5GpGalffxc/rsC4T6GUqNSMEgnfTjGRVQkbg8V+3uqDFKjlwL61kGzRDHnDvKrI/bSXE L00A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=di7bIyz8mZqTg7DrvpQ5DLeKfcAqXXOvBq9ew3jNYt4=; b=sr53hy2ZdPlKTVyuD2Qg+BwZw+QaLhBlnxV8jNJRcUc7Zw0TaRTqPd+llKYFsh7GOa pYzRO5uenFuKxKO/dtLzcMEBOW3RykE8gqj9KbRjG22Zigj8/k9eQ/jIh1M7B6s9Cr2N Y6/SMFJCsVGguGrOHZtIr4STU7aWSC50iP5kboZQjrdLeLbJQ78eOs5D6XEDzGKNA/lR GuBk28o2V9gGtYru1jCkU/e6Kkmyumsovz3AtnYweqS5mK+m0C8yz3Utf3Ew/Ooxne8B 09Z2I9PehmO/gmH4dmlvBibD0az5ylU3jI+duazWlLOcnUmnThT6v8RIvUfqRfriAu6d B1LA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=At8c1W+o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sz15-20020a1709078b0f00b007803449809esi10395349ejc.355.2022.10.19.01.39.54; Wed, 19 Oct 2022 01:40: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=At8c1W+o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230362AbiJSIjW (ORCPT + 99 others); Wed, 19 Oct 2022 04:39:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230073AbiJSIiv (ORCPT ); Wed, 19 Oct 2022 04:38:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7829E7E800; Wed, 19 Oct 2022 01:38:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BAC5F617E8; Wed, 19 Oct 2022 08:37:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE86EC433D7; Wed, 19 Oct 2022 08:37:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168679; bh=1aSnAgEIxoUXRJjkP+ugGfCVPi0FykL8XuZGEY3ono4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=At8c1W+oRhwnBJUueo9CScyrJSuIilfX+gTZTbmG/bjV0tog7++hdqIV1ucXXph7Y MloS5sr4lGhkwEfLy868s00ImwUl/YW6DDuFg4QspUOFib7KW/HevOjozKmQYV50HF H7ReVvfMU1Xpp2BypID5LFgjfD0AwhFYIK8N1F28= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Begunkov , Thadeu Lima de Souza Cascardo , Jens Axboe , David Bouman Subject: [PATCH 6.0 019/862] io_uring/af_unix: defer registered files gc to io_uring release Date: Wed, 19 Oct 2022 10:21:46 +0200 Message-Id: <20221019083250.847689386@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104636092929711?= X-GMAIL-MSGID: =?utf-8?q?1747104636092929711?= From: Pavel Begunkov commit 0091bfc81741b8d3aeb3b7ab8636f911b2de6e80 upstream. Instead of putting io_uring's registered files in unix_gc() we want it to be done by io_uring itself. The trick here is to consider io_uring registered files for cycle detection but not actually putting them down. Because io_uring can't register other ring instances, this will remove all refs to the ring file triggering the ->release path and clean up with io_ring_ctx_free(). Cc: stable@vger.kernel.org Fixes: 6b06314c47e1 ("io_uring: add file set registration") Reported-and-tested-by: David Bouman Signed-off-by: Pavel Begunkov Signed-off-by: Thadeu Lima de Souza Cascardo [axboe: add kerneldoc comment to skb, fold in skb leak fix] Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- include/linux/skbuff.h | 2 ++ io_uring/rsrc.c | 1 + net/unix/garbage.c | 20 ++++++++++++++++++++ 3 files changed, 23 insertions(+) --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -796,6 +796,7 @@ typedef unsigned char *sk_buff_data_t; * @csum_level: indicates the number of consecutive checksums found in * the packet minus one that have been verified as * CHECKSUM_UNNECESSARY (max 3) + * @scm_io_uring: SKB holds io_uring registered files * @dst_pending_confirm: need to confirm neighbour * @decrypted: Decrypted SKB * @slow_gro: state present at GRO time, slower prepare step required @@ -975,6 +976,7 @@ struct sk_buff { #endif __u8 slow_gro:1; __u8 csum_not_inet:1; + __u8 scm_io_uring:1; #ifdef CONFIG_NET_SCHED __u16 tc_index; /* traffic control index */ --- a/io_uring/rsrc.c +++ b/io_uring/rsrc.c @@ -855,6 +855,7 @@ int __io_scm_file_account(struct io_ring UNIXCB(skb).fp = fpl; skb->sk = sk; + skb->scm_io_uring = 1; skb->destructor = unix_destruct_scm; refcount_add(skb->truesize, &sk->sk_wmem_alloc); } --- a/net/unix/garbage.c +++ b/net/unix/garbage.c @@ -204,6 +204,7 @@ void wait_for_unix_gc(void) /* The external entry point: unix_gc() */ void unix_gc(void) { + struct sk_buff *next_skb, *skb; struct unix_sock *u; struct unix_sock *next; struct sk_buff_head hitlist; @@ -297,11 +298,30 @@ void unix_gc(void) spin_unlock(&unix_gc_lock); + /* We need io_uring to clean its registered files, ignore all io_uring + * originated skbs. It's fine as io_uring doesn't keep references to + * other io_uring instances and so killing all other files in the cycle + * will put all io_uring references forcing it to go through normal + * release.path eventually putting registered files. + */ + skb_queue_walk_safe(&hitlist, skb, next_skb) { + if (skb->scm_io_uring) { + __skb_unlink(skb, &hitlist); + skb_queue_tail(&skb->sk->sk_receive_queue, skb); + } + } + /* Here we are. Hitlist is filled. Die. */ __skb_queue_purge(&hitlist); spin_lock(&unix_gc_lock); + /* There could be io_uring registered files, just push them back to + * the inflight list + */ + list_for_each_entry_safe(u, next, &gc_candidates, link) + list_move_tail(&u->link, &gc_inflight_list); + /* All candidates should have been detached by now. */ BUG_ON(!list_empty(&gc_candidates)); From patchwork Wed Oct 19 08:21: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: 4502 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp202345wrs; Wed, 19 Oct 2022 01:40:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7VMlzP7uL3soCdVThI5GERzFcucv7i9+z7dKhIrfuEYuZeDI/oW5r41YJGrkvttHx+oXpc X-Received: by 2002:a17:907:6d8f:b0:78d:9b5e:1a0f with SMTP id sb15-20020a1709076d8f00b0078d9b5e1a0fmr6069422ejc.23.1666168827099; Wed, 19 Oct 2022 01:40:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666168827; cv=none; d=google.com; s=arc-20160816; b=QfZ8lVira1eFIfy66HnwiUOYzw0eya1e0J6K1JLJsZaFw0eV36c/fj3zialPkCsZNW 2W60Z+sU4p1gi1djXyh6zzTU9PulSediO+ivgHG/Z0ZKOzEH44gF/nq2OTuDiFKiOG0F ehvcXVcjGsy01gNid+WGCXDeQzYsx7+kIwR2MKzxeykcth6GQl0scE+sLvHpWrb6aPrf vtbSHcLqQ/VaKpti2gKxXqFfUDnbeGnyQ8V/cMgvD+4mLGASZHExkl2FlIAN6p8MStyq miC6nu3s+Y/Jks817BYSBVKln6uyyDIRXzIDR83SZU5fCCr7y+kzddbrHXGx8gx3dZ4r s8FQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XeVumS+NEd+kHc1Bdeb+fiBViZTPt3pAVyRAdVVe9SQ=; b=cr9MjDsUZKbH5SinAYvhbpumY+Zp64XYdsIvqIZfA6XYsI5WMPekWHLFwyS0zks/3B 3e4CNPULPG4lM48zDiw0yaR4jt/5ovs2Wv41JYT/cRrKP8k1z0Swif9wRD0qeqqVyF5E mVMvTxLesP0rc6Vo4QWo3yGfPT0sXTh4JjY44MzHJlLUR4pu0cVotQM6076CP+MrNWeb 1nlR97aGMpvyXrASGuLs8jvAyNAErRRgzc3yOIE3tTASKvaNYV4M7tVdDalCamfvbH7h RhmmDk2gT+NbVPGlhQ0glrLZs2Utd9Ts/B6ZliUS6Vu9r0NlrlTycSFfJipTfX7nSRVV Do4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="qgMLAa/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 nb21-20020a1709071c9500b007832bdf1856si14266403ejc.740.2022.10.19.01.40.02; Wed, 19 Oct 2022 01:40: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="qgMLAa/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 S230375AbiJSIjd (ORCPT + 99 others); Wed, 19 Oct 2022 04:39:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230325AbiJSIi4 (ORCPT ); Wed, 19 Oct 2022 04:38:56 -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 DC8897E31B; Wed, 19 Oct 2022 01:38: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 365F2617D7; Wed, 19 Oct 2022 08:38:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28C1BC433D7; Wed, 19 Oct 2022 08:38:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168685; bh=++2qBMI08ax4Oz0qKL+h8G0hyr/3cH6JH8Jq+qo8nao=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qgMLAa/q1kjUQPP3TfE0umzY/r4pODjBQ+9CNX8SAMpJRqvcOrSDNrpxIHlQesgFh psoo8pNgoJXjKY8Q88MgNsvABiT8p+JGOm3Og7qts3u2GrrcSpjS5GqPC/H5JDgiGz 8JjcUgDmGmbMvhvooZwFkr+/22B2sJDpLBZ1sfEo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stable@vger.kernel.org, Pavel Begunkov , Jens Axboe Subject: [PATCH 6.0 020/862] io_uring: correct pinned_vm accounting Date: Wed, 19 Oct 2022 10:21:47 +0200 Message-Id: <20221019083250.895836622@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104644166533447?= X-GMAIL-MSGID: =?utf-8?q?1747104644166533447?= From: Pavel Begunkov commit 42b6419d0aba47c5d8644cdc0b68502254671de5 upstream. ->mm_account should be released only after we free all registered buffers, otherwise __io_sqe_buffers_unregister() will see a NULL ->mm_account and skip locked_vm accounting. Cc: Signed-off-by: Pavel Begunkov Link: https://lore.kernel.org/r/6d798f65ed4ab8db3664c4d3397d4af16ca98846.1664849932.git.asml.silence@gmail.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- io_uring/io_uring.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -2422,12 +2422,6 @@ static void io_req_caches_free(struct io static __cold void io_ring_ctx_free(struct io_ring_ctx *ctx) { io_sq_thread_finish(ctx); - - if (ctx->mm_account) { - mmdrop(ctx->mm_account); - ctx->mm_account = NULL; - } - io_rsrc_refs_drop(ctx); /* __io_rsrc_put_work() may need uring_lock to progress, wait w/o it */ io_wait_rsrc_data(ctx->buf_data); @@ -2470,6 +2464,10 @@ static __cold void io_ring_ctx_free(stru WARN_ON_ONCE(!list_empty(&ctx->ltimeout_list)); WARN_ON_ONCE(ctx->notif_slots || ctx->nr_notif_slots); + if (ctx->mm_account) { + mmdrop(ctx->mm_account); + ctx->mm_account = NULL; + } io_mem_free(ctx->rings); io_mem_free(ctx->sq_sqes); From patchwork Wed Oct 19 08:21: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: 4510 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp202809wrs; Wed, 19 Oct 2022 01:41:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6qT4nkl9y+CmpMO69piSAD8v9Uw3hIeA59ytYQlSxHGHGyDZ21+CbnpBuzOzEkPCQcl9Gu X-Received: by 2002:a05:6402:528a:b0:454:8613:6560 with SMTP id en10-20020a056402528a00b0045486136560mr6626325edb.252.1666168890017; Wed, 19 Oct 2022 01:41:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666168890; cv=none; d=google.com; s=arc-20160816; b=NYzjyc6B1ID4dIBnV9+0T/YGkkIenrnG7r3cen0yYL6ErynLAW+xi6RZccjosDsR/g ByI3TRPYF6Wgs6bcEDnRLVyMWQyMLweu38E2a27RFA4tN8pjHpB0GkGcYcOX0n0FF00H JuXnvTzGB+hmd8e4pr+Au2Il9WmF/nljO82+4Z9Galc8XDkt6qqgN6d93kMadRwjJ71u MJKbeHb1mMBL6I2t5LPe5tlLir9XXg4xao2F+2k/sWJcoUjftAXDXZIbWKgG1Gx5XBqn /QKQ9uvmxmayKLcCDLTr+SK2iO6y7if5S6r5tbZRbF8EHd0SfMErteiQyCzzK/PkFe8h YAlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=beT7UKZDXTZh/bPrJqdNaL8Bv0op8oPEPbElUbwPhjU=; b=ViwfkJVp/bBWqSIM7og+2GH6HPf5QHAVLdfcVcH2By+K0AjGGVkblNG1bihBZOrrPo MAIAi3Xik54qra4gQislEN6YaufqocjOrpLILD4i/C1WrQ/ymaD5lTZkKGNKF6ITcaOP Vff85wWRW/PnnZHDRpPJhgbjgn0XWSfnNP06a0eSXFAShttAErltlRy86TtKFsfqL05e UnIo933wV3LjG0vKWKtQNWrP8HPO0WUJDziu2/HaK1V/7UsabngtaZvxR3IcKBGgi5ba G4TPKotl/4upGwe8BOG3yJvQ9XLtwZ9FUXIhmIfie4O3GzJwdvnv0oBzbS4oJyS6zl1V vitg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cQASiP97; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a056402440f00b00459f6b0fa96si17024763eda.355.2022.10.19.01.41.04; Wed, 19 Oct 2022 01:41: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=cQASiP97; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230227AbiJSIkf (ORCPT + 99 others); Wed, 19 Oct 2022 04:40:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230338AbiJSIjn (ORCPT ); Wed, 19 Oct 2022 04:39:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E26E80BC7; Wed, 19 Oct 2022 01:38: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 0FAD7617DE; Wed, 19 Oct 2022 08:38:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21637C433B5; Wed, 19 Oct 2022 08:38:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168688; bh=db2V0LRd+meO9yClRgIgT7wRDLvS+JUnwgMu5rf4fkg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cQASiP97V/tf6i+Ead1dv2+jVbs+QEccLO0vKDNE8C6KpGS8A9x27qZU0S3/9DDRn qddxBHcNokTGrX5LOxGn4g8/ATgxULY3iU4CFA9+W/ysYST7AbStMCYo98uJ3NP77Y pJdBS4JSgdNge18LGaenGnOsbXg8ALf8SlZ4JZVQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Haiyang Zhang , Gaurav Kohli , "David S. Miller" Subject: [PATCH 6.0 021/862] hv_netvsc: Fix race between VF offering and VF association message from host Date: Wed, 19 Oct 2022 10:21:48 +0200 Message-Id: <20221019083250.943069438@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104709878372198?= X-GMAIL-MSGID: =?utf-8?q?1747104709878372198?= From: Gaurav Kohli commit 365e1ececb2905f94cc10a5817c5b644a32a3ae2 upstream. During vm boot, there might be possibility that vf registration call comes before the vf association from host to vm. And this might break netvsc vf path, To prevent the same block vf registration until vf bind message comes from host. Cc: stable@vger.kernel.org Fixes: 00d7ddba11436 ("hv_netvsc: pair VF based on serial number") Reviewed-by: Haiyang Zhang Signed-off-by: Gaurav Kohli Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/hyperv/hyperv_net.h | 3 ++- drivers/net/hyperv/netvsc.c | 4 ++++ drivers/net/hyperv/netvsc_drv.c | 19 +++++++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) --- a/drivers/net/hyperv/hyperv_net.h +++ b/drivers/net/hyperv/hyperv_net.h @@ -1051,7 +1051,8 @@ struct net_device_context { u32 vf_alloc; /* Serial number of the VF to team with */ u32 vf_serial; - + /* completion variable to confirm vf association */ + struct completion vf_add; /* Is the current data path through the VF NIC? */ bool data_path_is_vf; --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c @@ -1580,6 +1580,10 @@ static void netvsc_send_vf(struct net_de net_device_ctx->vf_alloc = nvmsg->msg.v4_msg.vf_assoc.allocated; net_device_ctx->vf_serial = nvmsg->msg.v4_msg.vf_assoc.serial; + + if (net_device_ctx->vf_alloc) + complete(&net_device_ctx->vf_add); + netdev_info(ndev, "VF slot %u %s\n", net_device_ctx->vf_serial, net_device_ctx->vf_alloc ? "added" : "removed"); --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -2313,6 +2313,18 @@ static struct net_device *get_netvsc_bys } + /* Fallback path to check synthetic vf with + * help of mac addr + */ + list_for_each_entry(ndev_ctx, &netvsc_dev_list, list) { + ndev = hv_get_drvdata(ndev_ctx->device_ctx); + if (ether_addr_equal(vf_netdev->perm_addr, ndev->perm_addr)) { + netdev_notice(vf_netdev, + "falling back to mac addr based matching\n"); + return ndev; + } + } + netdev_notice(vf_netdev, "no netdev found for vf serial:%u\n", serial); return NULL; @@ -2409,6 +2421,11 @@ static int netvsc_vf_changed(struct net_ if (net_device_ctx->data_path_is_vf == vf_is_up) return NOTIFY_OK; + if (vf_is_up && !net_device_ctx->vf_alloc) { + netdev_info(ndev, "Waiting for the VF association from host\n"); + wait_for_completion(&net_device_ctx->vf_add); + } + ret = netvsc_switch_datapath(ndev, vf_is_up); if (ret) { @@ -2440,6 +2457,7 @@ static int netvsc_unregister_vf(struct n netvsc_vf_setxdp(vf_netdev, NULL); + reinit_completion(&net_device_ctx->vf_add); netdev_rx_handler_unregister(vf_netdev); netdev_upper_dev_unlink(vf_netdev, ndev); RCU_INIT_POINTER(net_device_ctx->vf_netdev, NULL); @@ -2479,6 +2497,7 @@ static int netvsc_probe(struct hv_device INIT_DELAYED_WORK(&net_device_ctx->dwork, netvsc_link_change); + init_completion(&net_device_ctx->vf_add); spin_lock_init(&net_device_ctx->lock); INIT_LIST_HEAD(&net_device_ctx->reconfig_events); INIT_DELAYED_WORK(&net_device_ctx->vf_takeover, netvsc_vf_setup); From patchwork Wed Oct 19 08:21: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: 4503 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp202473wrs; Wed, 19 Oct 2022 01:40:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5TEKTDUdglXgPoO+2N66YuNzr3nn081v7f3ZxJQIvFeX37vR2vdzflKEUl4kFA4jvbPGjK X-Received: by 2002:a17:907:980e:b0:78d:b6ea:25b3 with SMTP id ji14-20020a170907980e00b0078db6ea25b3mr5839830ejc.98.1666168845315; Wed, 19 Oct 2022 01:40:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666168845; cv=none; d=google.com; s=arc-20160816; b=r/LC5exLwqBe7gkB8TZ0DCQAO1kPYGd+yY5kpqnXyCq92qS52+eFewyjyoFLWlOa9C YlmZ1CV5JdQLGs/zDf6WIoE6dMrAlSzOhvzoYu4GtzwZ96GXr2ttW75kHUtFyg5Mx3b1 peJQxxTzVBRZ4bo7Kme6y+xjEcuDaG2m9/66IY58kgWZ+UoCQlq5ftYcIlySE+GTHhBu iCZS9Y/C6ZHZ+05Y0Xt5deNS0vzv9HclqYYYYbW2gNUWOorcJUd/I+jYm43AcmBdA2Jn uqp6ioC9BAdLY5kvHs+QlqmDohR3Yj5M+mVhR704/AOqbllAxQ3UMGlTawxil0+j4e0l nzZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pVqSJnxRug444jNEudr90ybTk+AQG+ZyiDQYDnlRYso=; b=ytgTXGwHT3FJYPYeN3p2tp2Sz8jFMbr3fMpMJ/LtSzRej0R9QeOma0tzhjuD2QBMG7 AzW9QMclbIosNVl43JzgYj4pxPo0iN75sEjnwRrxmTJU5uv4bcz+uSm2u4yR0xV/PLma VXkykl1iNI4aC9tchnqtPRwZbNe7nWrlSBmh0N96m2QEdVVVhm/HBpa5BE3W0qqJTKV9 37sckJa3llxJJ9ndScYSAF0cEf1PYJbmmoRNQq7LYqjccUZ/fsPYCxcrQUZMdPwsEaan 8HcqvKMtupfdxTAiubRcjyRBDDYUvRDmLnCC9kdEBIuxk4YXIFjIFQEs3XF6aN3xXPan akPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lqU0s2n3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l11-20020a056402254b00b0045902845795si15181117edb.557.2022.10.19.01.40.21; Wed, 19 Oct 2022 01:40: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=lqU0s2n3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230356AbiJSIjr (ORCPT + 99 others); Wed, 19 Oct 2022 04:39:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230342AbiJSIi6 (ORCPT ); Wed, 19 Oct 2022 04:38:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B11937EFC5; Wed, 19 Oct 2022 01:38: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 27581617E3; Wed, 19 Oct 2022 08:38:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19B28C433C1; Wed, 19 Oct 2022 08:38:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168691; bh=7QQ5BKb8fQQrkexa28bsUpOKY8efYTmV3Cm9V0UzJ9U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lqU0s2n34r+5tqAjkMfyME7E0w1B6JFnDtS+P7Qpl3IS2JJQWLmXei/5niAOpgy19 Znp/0y82JOcLlBMu8DUXZlv5i0fyM7lqRgB9Ct0FSSV7t54lkjcyOTU1lRtmu/4tap Bo1sOonyJxNcV/qedQyci4i0IpACa2PpOaQxGa/k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Paulo Alcantara (SUSE)" , Enzo Matsumiya , Ronnie Sahlberg , Steve French Subject: [PATCH 6.0 022/862] cifs: destage dirty pages before re-reading them for cache=none Date: Wed, 19 Oct 2022 10:21:49 +0200 Message-Id: <20221019083250.989301100@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104662685781638?= X-GMAIL-MSGID: =?utf-8?q?1747104662685781638?= From: Ronnie Sahlberg commit bb44c31cdcac107344dd2fcc3bd0504a53575c51 upstream. This is the opposite case of kernel bugzilla 216301. If we mmap a file using cache=none and then proceed to update the mmapped area these updates are not reflected in a later pread() of that part of the file. To fix this we must first destage any dirty pages in the range before we allow the pread() to proceed. Cc: stable@vger.kernel.org Reviewed-by: Paulo Alcantara (SUSE) Reviewed-by: Enzo Matsumiya Signed-off-by: Ronnie Sahlberg Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- fs/cifs/file.c | 9 +++++++++ 1 file changed, 9 insertions(+) --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -4271,6 +4271,15 @@ static ssize_t __cifs_readv( len = ctx->len; } + if (direct) { + rc = filemap_write_and_wait_range(file->f_inode->i_mapping, + offset, offset + len - 1); + if (rc) { + kref_put(&ctx->refcount, cifs_aio_ctx_release); + return -EAGAIN; + } + } + /* grab a lock here due to read response handlers can access ctx */ mutex_lock(&ctx->aio_mutex); From patchwork Wed Oct 19 08:21: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: 4514 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp203109wrs; Wed, 19 Oct 2022 01:42:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7ERqPT9+Pn+b8FalByK9HdSU6i8eAWDyFA5E9Aorr5M9uNjHZSOqVtjlucYueyo0n3WN7r X-Received: by 2002:a17:906:fe45:b0:791:9624:9ea5 with SMTP id wz5-20020a170906fe4500b0079196249ea5mr5888108ejb.282.1666168933827; Wed, 19 Oct 2022 01:42:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666168933; cv=none; d=google.com; s=arc-20160816; b=HXOi5QWQ95flDksJ/wnbEAI4ZytLWzMNWCmjizn6EyhhcmF/qXvUqjhIxLH/UMlw6o 2l98v8nBRX57VJvkJHueFVWo22MATS7ejbtc3BM8a9mVT55DeEPvA9LK3gFJNwTe9bn8 lDROABIT1j/LSG76H1XuCYMJTaPptXNItd2ztqm8EoS0ass5dcsHOgOQ8HDOx1yaNjGh GzIAKkFwgb40JdY9gq40iJvH2nIwAfrhxqaeUsWwOU99y//Rko/CL2lWrZwT/hIstVCA ZyX108n10/pktxojPtUdIiz1xXTMMwGCk4QJTzDdsydiFWGjn0IZfUM7b4NOrclxOshk U4Uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=t9y4H2yG4aOtEDorIYtpQ6lXI2V0CQR9JjsfnIa4q5A=; b=ttYR67if96xZ417TD/9WzhPq5jaosB3dWiO2i+yRDnw+TR6ClXX0VCOnOjWQTP5C69 O2rRuQfkUOkd7LJwaHIiISKxEjxEGa55XKxV+WLQMvdtmGPxj4otsZKJ+mWy69moiI27 7sbJdzPUqaJRb44Bcet9LiCNAnsEaHC8R7GxpDgzOw7IE5fRT8msBEcdIkv1sBmLrJh8 f7wp/aBUbFEpI8iimNhTLEPn98DqgRgNGgaFVfIQrK6Q+jtRYzsFJU7YI2BAlhDJ9PQx UChunxbrCYxVeAN10aMgtGYrXccB7Ih64vom5B4QYt7Fpcm/r+lyjWIno/OnbqCwINv/ eOjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xBdwLJ49; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hp6-20020a1709073e0600b0077ea290986fsi16227089ejc.584.2022.10.19.01.41.48; Wed, 19 Oct 2022 01:42:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xBdwLJ49; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230483AbiJSIlD (ORCPT + 99 others); Wed, 19 Oct 2022 04:41:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230252AbiJSIjv (ORCPT ); Wed, 19 Oct 2022 04:39:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A0A98110C; Wed, 19 Oct 2022 01:38: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 263B9B821CD; Wed, 19 Oct 2022 08:38:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11599C433D6; Wed, 19 Oct 2022 08:38:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168694; bh=ueD2SFqWj/bYjwtd+JoqGKckBkUCZOJQi3XXO3Pu9Fk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xBdwLJ4986qjZT90lZcH9anBbSifyYFcZkd+HKjXYSXMcR4lR69B5o+73GE3cXq22 VpLkWp3kaNWiAgpSCB6M1fzZjSxosnK8lQ3LSHWd2Fpu1yfOya6AEF3R3ZzdcYJIRn xdawRpa6Rz+zfnsCnszzR4tgjgmluFEYpRUkIKes= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Xiaoxu , "Paulo Alcantara (SUSE)" , Tom Talpey , Steve French Subject: [PATCH 6.0 023/862] cifs: Fix the error length of VALIDATE_NEGOTIATE_INFO message Date: Wed, 19 Oct 2022 10:21:50 +0200 Message-Id: <20221019083251.029839151@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104755935823557?= X-GMAIL-MSGID: =?utf-8?q?1747104755935823557?= From: Zhang Xiaoxu commit e98ecc6e94f4e6d21c06660b0f336df02836694f upstream. Commit d5c7076b772a ("smb3: add smb3.1.1 to default dialect list") extend the dialects from 3 to 4, but forget to decrease the extended length when specific the dialect, then the message length is larger than expected. This maybe leak some info through network because not initialize the message body. After apply this patch, the VALIDATE_NEGOTIATE_INFO message length is reduced from 28 bytes to 26 bytes. Fixes: d5c7076b772a ("smb3: add smb3.1.1 to default dialect list") Signed-off-by: Zhang Xiaoxu Cc: Acked-by: Paulo Alcantara (SUSE) Reviewed-by: Tom Talpey Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- fs/cifs/smb2pdu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -1169,9 +1169,9 @@ int smb3_validate_negotiate(const unsign pneg_inbuf->Dialects[0] = cpu_to_le16(server->vals->protocol_id); pneg_inbuf->DialectCount = cpu_to_le16(1); - /* structure is big enough for 3 dialects, sending only 1 */ + /* structure is big enough for 4 dialects, sending only 1 */ inbuflen = sizeof(*pneg_inbuf) - - sizeof(pneg_inbuf->Dialects[0]) * 2; + sizeof(pneg_inbuf->Dialects[0]) * 3; } rc = SMB2_ioctl(xid, tcon, NO_FILE_ID, NO_FILE_ID, From patchwork Wed Oct 19 08:21:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4516 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp203169wrs; Wed, 19 Oct 2022 01:42:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6ZsPrgwFs+hMexps/nZykw48KnzYCzlHYtJ+nJ/qMHkjKTlXskkcc9XmKdYbtlJH0EEivt X-Received: by 2002:a17:906:ee89:b0:73d:70c5:1a4e with SMTP id wt9-20020a170906ee8900b0073d70c51a4emr5519916ejb.683.1666168945107; Wed, 19 Oct 2022 01:42:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666168945; cv=none; d=google.com; s=arc-20160816; b=jbmNm9uqJuwDWa3JPxbieQeDa/qvkH/bxYa1U9005xKxxG3xfMHuX9mOMkGtutejec +MCm4jfv+f9rMu6InQEFtTJu38WrOD/SbAR9Z1wNDAbRBGuymNn+e7+SAXML4K+y1Re/ 9IrWTH1ycpGKDLMMK00+Ye7844xfo9MpmikCoNL/HNnTIKT0DdA0Wvx1Ruu2YJ3gIAQZ mbH5FLgQ6oBt4RoBQQWoEftLhXkgY4xZTwGbiw6tZz3jeCQXl6lNdZ9yhkdLL3LpAeE3 QAeiP8lUtLcRNTbosVrp9CUbSDhVcoHCh4N3I6UZnA+ALhaxzjBf6y16BYMgA9W7Vxz/ 1xmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jQQ3lBtOkQf+d1Gg3b/h1c8ZppgjH0DXRnlUpyoFj+4=; b=DGjI9BurnBZ9CD0NZ0c3RBfkx9CiQ64U/O1U8BmBFxBBW0/rMzeP73hO6MmIWXhZXR shEzeF/jGqqlkznichjyX2YaJZed3tPshr8xUbDG7WyEndW8bgOh6wcfK+bH58X0emtZ rlId4BHpzWy6TpVKidZuxkdWsOqYqRElYgXTQRdHQsQRiMkMXanU1Kmbg0LKEVc3TcuY fLfnbtc+DJWdp/JzL66v+4uztCzVZ/UkNTV8yLW31CC/uup1HK+FblrhOSs7F6q6RhYU n7zY7ATrHBufeN+I3hmBtHRIl5xfjg4KTG8db6Hc6mCwuSzJulM+k8odh5ejO9CsvddA X86g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HmLaQ8Eq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ji6-20020a170907980600b0073d6ad8251asi14886230ejc.812.2022.10.19.01.42.00; Wed, 19 Oct 2022 01:42: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=HmLaQ8Eq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230006AbiJSIlb (ORCPT + 99 others); Wed, 19 Oct 2022 04:41:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230311AbiJSIkK (ORCPT ); Wed, 19 Oct 2022 04:40:10 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E76C581123; Wed, 19 Oct 2022 01:39:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 8E1CACE20EC; Wed, 19 Oct 2022 08:38:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 878DEC433C1; Wed, 19 Oct 2022 08:38:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168698; bh=LKzotlONbnZIXGa7AgoINdc1KVArDb4wRqS7Xv8qXCU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HmLaQ8Eqio0Z8ENHP28QCMObKKQHeI3GxsHhRkU8d9T9ybtiYj+K9f5z84QSZgSz2 2Uo76Hx6wlWAlQxD0oRC68lFnIinPMX1cwVocblTlESEatJJS63+eKz6gNiJ6NOL8H QK72+04Mp5EZoV9VddExSm4dfTVJ9+oQaG8+MQVE= 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 6.0 024/862] iio: dac: ad5593r: Fix i2c read protocol requirements Date: Wed, 19 Oct 2022 10:21:51 +0200 Message-Id: <20221019083251.069031817@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104767629534579?= X-GMAIL-MSGID: =?utf-8?q?1747104767629534579?= 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 @@ -13,6 +13,8 @@ #include #include +#include + #define AD5593R_MODE_CONF (0 << 4) #define AD5593R_MODE_DAC_WRITE (1 << 4) #define AD5593R_MODE_ADC_READBACK (4 << 4) @@ -20,6 +22,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); @@ -38,13 +58,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) @@ -58,25 +72,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 Wed Oct 19 08:21:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4504 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp202586wrs; Wed, 19 Oct 2022 01:40:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6n7ELsMknOIbPusbClHsQQu9EE2rUKChF2M4vdQ4MuD5xZDTRJUA1GtBrWzLwH5mX+1Ei0 X-Received: by 2002:a17:907:6297:b0:72f:9aad:fcb with SMTP id nd23-20020a170907629700b0072f9aad0fcbmr5752703ejc.161.1666168858503; Wed, 19 Oct 2022 01:40:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666168858; cv=none; d=google.com; s=arc-20160816; b=rc7DO18F0jefgRToKg861g9DKA9lSe26g2zEb8MckQ6SIDBzKDrbIWOyhMFGWFVvkB N20GkVIoZe/A+2PIv7ENukVyT5LDO0ZL0hCL0cMFOYXVVVf+4fS2ng6OzD+9qanZXe6Z QU4F4T6s3fTlbN/hts8T527VO+E0XKh3h093bzS8ARiiODvocDdOKCA7YSzkiJ3v6/AH 0/6SgKGESoZKTJanQiH2rSBIg23eGf3aXoMlOtw0QoUeIo8QJqJeG33XlaowdB2maUCX CcI2Sfg02BQsLxU6FtsYqjpqp1usrqi5KmAeQu8i/wgdDCoD2ItBnUjlwoB4WBmUxT0x lVbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bUz+5s37sHEm/1PxeiFhL6q43PpNa3f+qJgf9K8KdBU=; b=TBK49O/2i9UIc5FXYrLOuJXeHtNadqzzps9A/33Ik7RdAxZsH8JJhiDWE1hjwhV1Si w37VWIRoc2UkYCwFHye7o3wEw+LQMMPZoQ+mJMq0hTub3t3rSiYI7UKAT7dEXuiiBzo7 iUCeO9Qz6hXkUVy9lWfgv5Tl9OIOIRwn0rlX4zrK1M1v2wdxsWTiYnM7kTZ9VHYiaCBd 5H2dbBpfYWkj5kpBdNrc5Zx6Tc9osB14f7ckUahwynHvzsOi68EhLZHbOgumaMuxxVQt CcqafMRb5phqX7wCpT+NsvwgsXIkNdc1JWlRXxQLJVaSwZ3DmD2oYjR9izLCCFXyaUKp HiEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tbXmONHq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j20-20020a05640211d400b0045d3ed38ae1si12399421edw.16.2022.10.19.01.40.31; Wed, 19 Oct 2022 01:40: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=tbXmONHq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230215AbiJSIju (ORCPT + 99 others); Wed, 19 Oct 2022 04:39:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229890AbiJSIjB (ORCPT ); Wed, 19 Oct 2022 04:39: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 96CBC7E807; Wed, 19 Oct 2022 01:38:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A58AB617EC; Wed, 19 Oct 2022 08:38:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99117C433D6; Wed, 19 Oct 2022 08:38:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168701; bh=fS92YeGgAE7/jfevSZZ9qKCTlZHn8Zq5p+Rkx1Cwmg4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tbXmONHqJv0nLqxthGA8ub+lgJWLwVAPBxiMAYdudbb2QeWbRHF4Vu4kVTedPbzbf ee6SH9f4ul3hyZj+L9mjbrwPO9g8S1SdnHxBNGMRFHcetU0Xka+8run5prPVtbyfJQ YjIvu79b4NN8axJFpYES/2E94FtXnmVx/jdSGH9g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Meng Li , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Denys Zagorui , Stable@vger.kernel.org, Jonathan Cameron Subject: [PATCH 6.0 025/862] iio: ltc2497: Fix reading conversion results Date: Wed, 19 Oct 2022 10:21:52 +0200 Message-Id: <20221019083251.107696024@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104676882106923?= X-GMAIL-MSGID: =?utf-8?q?1747104676882106923?= From: Uwe Kleine-König commit 7f4f1096d5921f5d90547596f9ce80e0b924f887 upstream. After the result of the previous conversion is read the chip automatically starts a new conversion and doesn't accept new i2c transfers until this conversion is completed which makes the function return failure. So add an early return iff the programming of the new address isn't needed. Note this will not fix the problem in general, but all cases that are currently used. Once this changes we get the failure back, but this can be addressed when the need arises. Fixes: 69548b7c2c4f ("iio: adc: ltc2497: split protocol independent part in a separate module ") Reported-by: Meng Li Signed-off-by: Uwe Kleine-König Tested-by: Denys Zagorui Cc: Link: https://lore.kernel.org/r/20220815091647.1523532-1-dzagorui@cisco.com Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/adc/ltc2497.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) --- a/drivers/iio/adc/ltc2497.c +++ b/drivers/iio/adc/ltc2497.c @@ -41,6 +41,19 @@ static int ltc2497_result_and_measure(st } *val = (be32_to_cpu(st->buf) >> 14) - (1 << 17); + + /* + * The part started a new conversion at the end of the above i2c + * transfer, so if the address didn't change since the last call + * everything is fine and we can return early. + * If not (which should only happen when some sort of bulk + * conversion is implemented) we have to program the new + * address. Note that this probably fails as the conversion that + * was triggered above is like not complete yet and the two + * operations have to be done in a single transfer. + */ + if (ddata->addr_prev == address) + return 0; } ret = i2c_smbus_write_byte(st->client, From patchwork Wed Oct 19 08:21:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4513 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp203073wrs; Wed, 19 Oct 2022 01:42:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5lug2k6sWhhPszYmthuVBg/d8sZNB7KwZktituw+nOsJvYZyE6toMvyCqV9ZVIFqYJCGRY X-Received: by 2002:a17:906:8a4b:b0:78d:d475:ff74 with SMTP id gx11-20020a1709068a4b00b0078dd475ff74mr5542302ejc.131.1666168929614; Wed, 19 Oct 2022 01:42:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666168929; cv=none; d=google.com; s=arc-20160816; b=gYbCCuuuzlvxPxewKFntRmHpzaXJkXGq89c2GTxm6c+l6F5+6wMDr/kGgCDkBCeKbH gCoLFVPg1UPyNUCJte+zSG0H8X/AhxKlBvf9/vGp7lYt62BaAZTJ08EDvdTFbdPM9Ilz D/eJyicu+x8U6o4cn3KadToc/DBTnpksgvHZiG87+pLrErxUkbcnTGMqHeFBz6vgDQxq 7zICYmyfgvlRdUM5YHsv9/s+Ft9Ez50rmjY8A8F9fIaRhOlRf2sYucp0ZHd2o7lrNf09 8/EWrelLZkQ3L2Xg9azWUiQs/yRn2f+Dy0SraZpT+dTo/Hv434lwyGrWtRB33hlpLOiW 5VzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hwuEHQ4Yj4TnGatb2JRWwukiknIOVCPFr4FcDVO1pTA=; b=Kg5mRFm9aL1Ia3i/t2jy2IMRdT+4/L+HKaXBi2cafKWoZ6OR17U5eJmPquuzkQEZ7H 9mrLymJ2FacRUfYP1HfKpkt/pkzizPFWiJnHNf+/JVXN3/Otxy7o6rt63JAHydM1izu7 db64nk/tJnluxpkIcgdxEe+cCr3oSlVi9D1YCISfuuMx/nwtNXJ1IszB+lJl+Ac35xSf ccqyvIiwX5YgmG9QIG9DXBHBMU2hfP5De6vzsdcm4sIWJIIfGcWKuR3nTf4+2V9oEiCi uQUMo4yspZ4x7d7kcUSs3X2P7zloDnnL9ylL6cVDqbz+fsL6Zn5lpIy2D3DevIYupIkm QD4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pXgbJ2Q+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nb21-20020a1709071c9500b0078049ab4bbasi14898950ejc.526.2022.10.19.01.41.45; Wed, 19 Oct 2022 01:42:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pXgbJ2Q+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230319AbiJSIk6 (ORCPT + 99 others); Wed, 19 Oct 2022 04:40:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230186AbiJSIju (ORCPT ); Wed, 19 Oct 2022 04:39:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CD78814C0; Wed, 19 Oct 2022 01:39: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 88913617D1; Wed, 19 Oct 2022 08:38:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7D194C433D6; Wed, 19 Oct 2022 08:38:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168704; bh=ua2YKCret8Q3QdpyymxKIeW3ykV2g5RTC7x+GcOzxVY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pXgbJ2Q+GPQIHGGeDXoFXdfDPF8o9Eta5Inl6wFNqDZP8r3Wrq3vkYmXmegQcEgsz FNilUXbvBTh4qP991iqwT4x8ERwZrybFH6hPLlPOXaYhLa5Vca+sLTS3FAuGbSwPDX k+2xlTx7Ml1O4ioEjY+4hs7R6xy8u8o/rqjJ1vk0= 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?= , Stable@vger.kernel.org, Jonathan Cameron Subject: [PATCH 6.0 026/862] iio: adc: ad7923: fix channel readings for some variants Date: Wed, 19 Oct 2022 10:21:53 +0200 Message-Id: <20221019083251.144378655@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104751639920897?= X-GMAIL-MSGID: =?utf-8?q?1747104751639920897?= From: Nuno Sá commit f4f43f01cff2f29779343ade755191afd2581c77 upstream. Some of the supported devices have 4 or 2 LSB trailing bits that should not be taken into account. Hence we need to shift these bits out which fits perfectly on the scan type shift property. This change fixes both raw and buffered reads. Fixes: f2f7a449707e ("iio:adc:ad7923: Add support for the ad7904/ad7914/ad7924") Fixes: 851644a60d20 ("iio: adc: ad7923: Add support for the ad7908/ad7918/ad7928") Signed-off-by: Nuno Sá Link: https://lore.kernel.org/r/20220912081223.173584-2-nuno.sa@analog.com Cc: Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/adc/ad7923.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/iio/adc/ad7923.c +++ b/drivers/iio/adc/ad7923.c @@ -93,6 +93,7 @@ enum ad7923_id { .sign = 'u', \ .realbits = (bits), \ .storagebits = 16, \ + .shift = 12 - (bits), \ .endianness = IIO_BE, \ }, \ } @@ -268,7 +269,8 @@ static int ad7923_read_raw(struct iio_de return ret; if (chan->address == EXTRACT(ret, 12, 4)) - *val = EXTRACT(ret, 0, 12); + *val = EXTRACT(ret, chan->scan_type.shift, + chan->scan_type.realbits); else return -EIO; From patchwork Wed Oct 19 08:21: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: 4517 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp203208wrs; Wed, 19 Oct 2022 01:42:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4yFuNkEB19UzosY9lCVHhRGqbtdkodDwtdM5HAtEyE00fc3zYTuHFlUT+SmBSL2rrOaCTf X-Received: by 2002:a17:907:1b1c:b0:72f:9aac:ee41 with SMTP id mp28-20020a1709071b1c00b0072f9aacee41mr5843012ejc.56.1666168951507; Wed, 19 Oct 2022 01:42:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666168951; cv=none; d=google.com; s=arc-20160816; b=P0V8c7LxgjIdXBdx4cfozzYHNQJLKV2ThC/gYBSnRvtK4xj3NVbEEtNtQ2TrCPPiXl sXzzYNyqMwOzj71oiRs7yFZQE+uwwwC93r7EJ0UZMuIxesZQRxvGyP3ZXtOth2elTckG p7wYSmWVdc5oCA+pIA9xSQvxF/wScFkKa8omWvbeVMbOEufLPcR2SEjV+i+0g+fCZV6Z /TWngWZllE8ATRJNv72/PaleftALeQoh8dt1zCMnlSzej1DkCXBJO/WRzshviSGzjeOd u2mI7uxO2bN2PCMEgvJu809LFkxH5ZHiD90am/mhiPn+Qj1gz0r7HsdEHRT503NV3008 qHlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8FHYFr4Nwdv/iOPNXYj6eVcFWvQYx1EYUPazb6fkq3I=; b=wsdqY67imWwjMkKQbP8cnEc3Xr/JE3L3VUTYiWiuP/scq1nBFZryHJopoX6fR23ybU cBui8+kMzYoJ6yHYtzH0s8mXVzHP0RGv77Ynvlzf3ArAV0/B+p9741eZDZF8xy6qQP/Q bqtMg+6i9K4eYcit8rUnHn+jwiOcibJz6EqNgPYooMufz54KbbgqvVCEo2HZVe1AEAIM Q6qohp42yHywIAAor3cSA4RrwdD7mh3aicR7K0SOuzaQaOInNWmSNAeusNEhZQtM6Izl JT3tkaGPIULqf3LWwcn3jKN3jmeZUWd7X8ReL8PwEtuPsL2hBG4dPWL5tZAitGlZJQcW lrjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ea9fcAwy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m4-20020a1709062b8400b0073155abc1b8si11357110ejg.154.2022.10.19.01.42.07; Wed, 19 Oct 2022 01:42:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ea9fcAwy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230513AbiJSIlm (ORCPT + 99 others); Wed, 19 Oct 2022 04:41:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230322AbiJSIkW (ORCPT ); Wed, 19 Oct 2022 04:40:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C83B07FFBC; Wed, 19 Oct 2022 01:39: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 CC9E9617E2; Wed, 19 Oct 2022 08:38:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D488BC433D6; Wed, 19 Oct 2022 08:38:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168707; bh=lHA+zVgSOdyqCjkiWL6eqbyOGZwAZZm29Yp/49MU+HM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ea9fcAwy/7roH20l4SaEOgBWKLooWPk3bAiFZ5qvtywQwfWRfO5G16kGcDkeKvZyS kg8nPKcz36Ji98ATK0XihPP/w/G/wgbx/rCH7eqZ43MjXZdDI1OBhOoId1RL8rzHui 7OkRP0Wl7kRL5dJpv6+RYonMOek9XYjvM0TSnbT8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eddie James , Joel Stanley , Andy Shevchenko , Jonathan Cameron Subject: [PATCH 6.0 027/862] iio: pressure: dps310: Refactor startup procedure Date: Wed, 19 Oct 2022 10:21:54 +0200 Message-Id: <20221019083251.197123692@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104774792614594?= X-GMAIL-MSGID: =?utf-8?q?1747104774792614594?= From: Eddie James commit c2329717bdd3fa62f8a2f3d8d85ad0bee4556bd7 upstream. Move the startup procedure into a function, and correct a missing check on the return code for writing the PRS_CFG register. Cc: Signed-off-by: Eddie James Reviewed-by: Joel Stanley Reviewed-by: Andy Shevchenko Link: https://lore.kernel.org/r/20220915195719.136812-2-eajames@linux.ibm.com Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/pressure/dps310.c | 188 ++++++++++++++++++++++-------------------- 1 file changed, 99 insertions(+), 89 deletions(-) --- a/drivers/iio/pressure/dps310.c +++ b/drivers/iio/pressure/dps310.c @@ -159,6 +159,102 @@ static int dps310_get_coefs(struct dps31 return 0; } +/* + * Some versions of the chip will read temperatures in the ~60C range when + * it's actually ~20C. This is the manufacturer recommended workaround + * to correct the issue. The registers used below are undocumented. + */ +static int dps310_temp_workaround(struct dps310_data *data) +{ + int rc; + int reg; + + rc = regmap_read(data->regmap, 0x32, ®); + if (rc) + return rc; + + /* + * If bit 1 is set then the device is okay, and the workaround does not + * need to be applied + */ + if (reg & BIT(1)) + return 0; + + rc = regmap_write(data->regmap, 0x0e, 0xA5); + if (rc) + return rc; + + rc = regmap_write(data->regmap, 0x0f, 0x96); + if (rc) + return rc; + + rc = regmap_write(data->regmap, 0x62, 0x02); + if (rc) + return rc; + + rc = regmap_write(data->regmap, 0x0e, 0x00); + if (rc) + return rc; + + return regmap_write(data->regmap, 0x0f, 0x00); +} + +static int dps310_startup(struct dps310_data *data) +{ + int rc; + int ready; + + /* + * Set up pressure sensor in single sample, one measurement per second + * mode + */ + rc = regmap_write(data->regmap, DPS310_PRS_CFG, 0); + if (rc) + return rc; + + /* + * Set up external (MEMS) temperature sensor in single sample, one + * measurement per second mode + */ + rc = regmap_write(data->regmap, DPS310_TMP_CFG, DPS310_TMP_EXT); + if (rc) + return rc; + + /* Temp and pressure shifts are disabled when PRC <= 8 */ + rc = regmap_write_bits(data->regmap, DPS310_CFG_REG, + DPS310_PRS_SHIFT_EN | DPS310_TMP_SHIFT_EN, 0); + if (rc) + return rc; + + /* MEAS_CFG doesn't update correctly unless first written with 0 */ + rc = regmap_write_bits(data->regmap, DPS310_MEAS_CFG, + DPS310_MEAS_CTRL_BITS, 0); + if (rc) + return rc; + + /* Turn on temperature and pressure measurement in the background */ + rc = regmap_write_bits(data->regmap, DPS310_MEAS_CFG, + DPS310_MEAS_CTRL_BITS, DPS310_PRS_EN | + DPS310_TEMP_EN | DPS310_BACKGROUND); + if (rc) + return rc; + + /* + * Calibration coefficients required for reporting temperature. + * They are available 40ms after the device has started + */ + rc = regmap_read_poll_timeout(data->regmap, DPS310_MEAS_CFG, ready, + ready & DPS310_COEF_RDY, 10000, 40000); + if (rc) + return rc; + + rc = dps310_get_coefs(data); + if (rc) + return rc; + + return dps310_temp_workaround(data); +} + static int dps310_get_pres_precision(struct dps310_data *data) { int rc; @@ -677,52 +773,12 @@ static const struct iio_info dps310_info .write_raw = dps310_write_raw, }; -/* - * Some verions of chip will read temperatures in the ~60C range when - * its actually ~20C. This is the manufacturer recommended workaround - * to correct the issue. The registers used below are undocumented. - */ -static int dps310_temp_workaround(struct dps310_data *data) -{ - int rc; - int reg; - - rc = regmap_read(data->regmap, 0x32, ®); - if (rc < 0) - return rc; - - /* - * If bit 1 is set then the device is okay, and the workaround does not - * need to be applied - */ - if (reg & BIT(1)) - return 0; - - rc = regmap_write(data->regmap, 0x0e, 0xA5); - if (rc < 0) - return rc; - - rc = regmap_write(data->regmap, 0x0f, 0x96); - if (rc < 0) - return rc; - - rc = regmap_write(data->regmap, 0x62, 0x02); - if (rc < 0) - return rc; - - rc = regmap_write(data->regmap, 0x0e, 0x00); - if (rc < 0) - return rc; - - return regmap_write(data->regmap, 0x0f, 0x00); -} - static int dps310_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct dps310_data *data; struct iio_dev *iio; - int rc, ready; + int rc; iio = devm_iio_device_alloc(&client->dev, sizeof(*data)); if (!iio) @@ -747,54 +803,8 @@ static int dps310_probe(struct i2c_clien if (rc) return rc; - /* - * Set up pressure sensor in single sample, one measurement per second - * mode - */ - rc = regmap_write(data->regmap, DPS310_PRS_CFG, 0); - - /* - * Set up external (MEMS) temperature sensor in single sample, one - * measurement per second mode - */ - rc = regmap_write(data->regmap, DPS310_TMP_CFG, DPS310_TMP_EXT); - if (rc < 0) - return rc; - - /* Temp and pressure shifts are disabled when PRC <= 8 */ - rc = regmap_write_bits(data->regmap, DPS310_CFG_REG, - DPS310_PRS_SHIFT_EN | DPS310_TMP_SHIFT_EN, 0); - if (rc < 0) - return rc; - - /* MEAS_CFG doesn't update correctly unless first written with 0 */ - rc = regmap_write_bits(data->regmap, DPS310_MEAS_CFG, - DPS310_MEAS_CTRL_BITS, 0); - if (rc < 0) - return rc; - - /* Turn on temperature and pressure measurement in the background */ - rc = regmap_write_bits(data->regmap, DPS310_MEAS_CFG, - DPS310_MEAS_CTRL_BITS, DPS310_PRS_EN | - DPS310_TEMP_EN | DPS310_BACKGROUND); - if (rc < 0) - return rc; - - /* - * Calibration coefficients required for reporting temperature. - * They are available 40ms after the device has started - */ - rc = regmap_read_poll_timeout(data->regmap, DPS310_MEAS_CFG, ready, - ready & DPS310_COEF_RDY, 10000, 40000); - if (rc < 0) - return rc; - - rc = dps310_get_coefs(data); - if (rc < 0) - return rc; - - rc = dps310_temp_workaround(data); - if (rc < 0) + rc = dps310_startup(data); + if (rc) return rc; rc = devm_iio_device_register(&client->dev, iio); From patchwork Wed Oct 19 08:21: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: 4568 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp204853wrs; Wed, 19 Oct 2022 01:47:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5AGm9TZA8NvtKgaL3d+6KxEtRy8bgWDkCoX5p0b+iXc3srrKjryvCAiCiAW/gpFH+jkCUz X-Received: by 2002:a17:902:7c91:b0:17f:6711:1fac with SMTP id y17-20020a1709027c9100b0017f67111facmr7521797pll.118.1666169253700; Wed, 19 Oct 2022 01:47:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169253; cv=none; d=google.com; s=arc-20160816; b=KtjgyyHqCg85YVczDPMajOeMBkDrr/VNSxyU4orXjyBO68FeoesTDVSNvUxYn1U0s4 ijejv83WppCT6HBOxkpsogk8oLT73vrOiQpWzx5hVSB/Mk6L8/FlZtG64co4SGUeExae eX6YAJV/0oykqrCgyZeAB2bgW1l0Bp4DkxewsVM3PqT6CFA0nT38rK/BhS7t32mguYCN jHS0clsEbnfyMNfp5gn0slV7qOhLspq8WQKf4EbYTbaYQ7GOOvACSrO7k1OOlxMvsUM3 CP+V+Kh6ap69aOaIE1U1BD30g5sLfTHLY6+sH63naHmDzINbcRtdhxJcUjxvTABVROs2 pemA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gJZVwGfpFKJKpPU3C0p768rRfXZR8eoFVlxv7IglUho=; b=hgvUj0MOUyI6l+QXImOFjmZnf8WPfIZAWVBKUil8JSAbjm6G3Lt2K6TOEcJMvPJBwR 2wEUKAO5a5QFzQRctjKofBVqdgiSk/esZfBeY8IpRc0WD4P8NraTCGqXGiN2dYmn+KXY A6bdL6szxkdnzKoE3B2KfZkXSm9W/ucJwiXnjCc0ng8D7H4btodCxpbQnys51GTXSVkL YlvPMNFOYXHIIRBbdcEPjyoZFuI2723BHglBYZr1BqyV5BPRG7P98Zsl1zp05Vu7e9YF +KrdCpK5xfybTmutIPyyI6RC2OCSZAfAccFtZ2nkUZcJ+EP9YbrvgHBSsb1KGwgaVCCc 4BvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EcHf2maQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x187-20020a6331c4000000b0046aff26fe6dsi19787682pgx.498.2022.10.19.01.47.20; Wed, 19 Oct 2022 01:47: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=EcHf2maQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231543AbiJSIq4 (ORCPT + 99 others); Wed, 19 Oct 2022 04:46:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231368AbiJSIpX (ORCPT ); Wed, 19 Oct 2022 04:45:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 557155053B; Wed, 19 Oct 2022 01:44:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0518F617D7; Wed, 19 Oct 2022 08:40:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A967C433C1; Wed, 19 Oct 2022 08:40:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168853; bh=z6BUKnQXIYEmBq/uQLvhq8qTqLB0q2qvgDL8SK8Bizo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EcHf2maQ+V8AumTUUIMMO+ALOdHnSI+egh5dGaNG2dyfQQfxosRvvAACNxaoRBRay JmK7b9E440lSpwVAYDs/EW+Igd8a3YCZFzN0QOxTzJEeg1t48ZPV3sY221FS9IMeem /HEL/lcaVZqw7pDWkVKGC/5SDGR/oKil0C6KHhwk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eddie James , Andy Shevchenko , Jonathan Cameron Subject: [PATCH 6.0 028/862] iio: pressure: dps310: Reset chip after timeout Date: Wed, 19 Oct 2022 10:21:55 +0200 Message-Id: <20221019083251.249994910@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105091064367997?= X-GMAIL-MSGID: =?utf-8?q?1747105091064367997?= From: Eddie James commit 7b4ab4abcea4c0c10b25187bf2569e5a07e9a20c upstream. The DPS310 chip has been observed to get "stuck" such that pressure and temperature measurements are never indicated as "ready" in the MEAS_CFG register. The only solution is to reset the device and try again. In order to avoid continual failures, use a boolean flag to only try the reset after timeout once if errors persist. Fixes: ba6ec48e76bc ("iio: Add driver for Infineon DPS310") Cc: Signed-off-by: Eddie James Reviewed-by: Andy Shevchenko Link: https://lore.kernel.org/r/20220915195719.136812-3-eajames@linux.ibm.com Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/pressure/dps310.c | 74 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 64 insertions(+), 10 deletions(-) --- a/drivers/iio/pressure/dps310.c +++ b/drivers/iio/pressure/dps310.c @@ -89,6 +89,7 @@ struct dps310_data { s32 c00, c10, c20, c30, c01, c11, c21; s32 pressure_raw; s32 temp_raw; + bool timeout_recovery_failed; }; static const struct iio_chan_spec dps310_channels[] = { @@ -393,11 +394,69 @@ static int dps310_get_temp_k(struct dps3 return scale_factors[ilog2(rc)]; } +static int dps310_reset_wait(struct dps310_data *data) +{ + int rc; + + rc = regmap_write(data->regmap, DPS310_RESET, DPS310_RESET_MAGIC); + if (rc) + return rc; + + /* Wait for device chip access: 2.5ms in specification */ + usleep_range(2500, 12000); + return 0; +} + +static int dps310_reset_reinit(struct dps310_data *data) +{ + int rc; + + rc = dps310_reset_wait(data); + if (rc) + return rc; + + return dps310_startup(data); +} + +static int dps310_ready_status(struct dps310_data *data, int ready_bit, int timeout) +{ + int sleep = DPS310_POLL_SLEEP_US(timeout); + int ready; + + return regmap_read_poll_timeout(data->regmap, DPS310_MEAS_CFG, ready, ready & ready_bit, + sleep, timeout); +} + +static int dps310_ready(struct dps310_data *data, int ready_bit, int timeout) +{ + int rc; + + rc = dps310_ready_status(data, ready_bit, timeout); + if (rc) { + if (rc == -ETIMEDOUT && !data->timeout_recovery_failed) { + /* Reset and reinitialize the chip. */ + if (dps310_reset_reinit(data)) { + data->timeout_recovery_failed = true; + } else { + /* Try again to get sensor ready status. */ + if (dps310_ready_status(data, ready_bit, timeout)) + data->timeout_recovery_failed = true; + else + return 0; + } + } + + return rc; + } + + data->timeout_recovery_failed = false; + return 0; +} + static int dps310_read_pres_raw(struct dps310_data *data) { int rc; int rate; - int ready; int timeout; s32 raw; u8 val[3]; @@ -409,9 +468,7 @@ static int dps310_read_pres_raw(struct d timeout = DPS310_POLL_TIMEOUT_US(rate); /* Poll for sensor readiness; base the timeout upon the sample rate. */ - rc = regmap_read_poll_timeout(data->regmap, DPS310_MEAS_CFG, ready, - ready & DPS310_PRS_RDY, - DPS310_POLL_SLEEP_US(timeout), timeout); + rc = dps310_ready(data, DPS310_PRS_RDY, timeout); if (rc) goto done; @@ -448,7 +505,6 @@ static int dps310_read_temp_raw(struct d { int rc; int rate; - int ready; int timeout; if (mutex_lock_interruptible(&data->lock)) @@ -458,10 +514,8 @@ static int dps310_read_temp_raw(struct d timeout = DPS310_POLL_TIMEOUT_US(rate); /* Poll for sensor readiness; base the timeout upon the sample rate. */ - rc = regmap_read_poll_timeout(data->regmap, DPS310_MEAS_CFG, ready, - ready & DPS310_TMP_RDY, - DPS310_POLL_SLEEP_US(timeout), timeout); - if (rc < 0) + rc = dps310_ready(data, DPS310_TMP_RDY, timeout); + if (rc) goto done; rc = dps310_read_temp_ready(data); @@ -756,7 +810,7 @@ static void dps310_reset(void *action_da { struct dps310_data *data = action_data; - regmap_write(data->regmap, DPS310_RESET, DPS310_RESET_MAGIC); + dps310_reset_wait(data); } static const struct regmap_config dps310_regmap_config = { From patchwork Wed Oct 19 08:21: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: 4511 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp202856wrs; Wed, 19 Oct 2022 01:41:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM77zh2agU3hBaWG8zAZ40WrGtdekcGQ5Q5c0ukuW+viYddWAEG4FZgr+IRGY/KwdV7lrBo1 X-Received: by 2002:a17:907:96a6:b0:78d:b6f6:3886 with SMTP id hd38-20020a17090796a600b0078db6f63886mr5999347ejc.106.1666168896913; Wed, 19 Oct 2022 01:41:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666168896; cv=none; d=google.com; s=arc-20160816; b=aeUv9RnHABw0NcNqLy8RxIBM52swe8HETesnRUjmh8loyU92wy8ah9nbyxfiXeF2aL +LKlOjH4PpWrnvARcIxLr3eVZ197E7djGCNCSu/vwpOInw6wU0g8FVPxzLQKexxyedaU OFA910UODfue9UNgl99+RfNNyusN1RKqhuNKz1AjSJpUIuysqiUUAAJMZkmrjThBzvMD v+MRlhgxUsAWsfueRfnkx8eeufgCIL+wBVYsmUCl7k7/joTyJGQbaPW0tznAvAnLyps3 wn5jaQ+ecB/nv9urqhsSmDuo3DuFViLm/lluGiMJvUgT8xHs+gI47j5Z0GyJOm4wWReE 0Skw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+CvRpaSl0iUjdb4ggzzMlvLFPMYMUJaHhIUNJI4GGsk=; b=dnF34DmCBDjfKAuZE4hID19Xctm3OY+vIL4x6smPfV4IBFYkJfU59bTCU1HcuiEZbg sBLoWbaXSEEdPu6EJHA+3JwFqZr4ediCoJd0ht6ittKxPM2ypb7lnhdKQyNIHCf1vGbu +VF42xTSA+kcbH0EVkPDZp7IDcJgggwABwlV5I9NSiXyPa5OHxd72NMc5i23JyL5Xx5q LBwF481ClCSL/acZi2rqTg4dY8LPIgawj3GULZrmHgvZPm+lnK1LAT0AaUzxaf7pHknT zh7vro088BoC8AaZfkW1vZRByPbJBlq4e6s1buxJrn8BkGPsbud9GiplWLjRRqGuhFwf i0vA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yPX0izFW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qf33-20020a1709077f2100b00783c42d2da1si14166230ejc.425.2022.10.19.01.41.11; Wed, 19 Oct 2022 01:41: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=yPX0izFW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230458AbiJSIkp (ORCPT + 99 others); Wed, 19 Oct 2022 04:40:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230399AbiJSIjs (ORCPT ); Wed, 19 Oct 2022 04:39:48 -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 3086880EB1; Wed, 19 Oct 2022 01:38:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8B6CE617E7; Wed, 19 Oct 2022 08:38:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E551C433C1; Wed, 19 Oct 2022 08:38:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168735; bh=fgdXg1wobOdeihxoqquNWvbEhAq2SyCVppXeIRBGkRs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yPX0izFWn8RqJAxNCVRXGZqEJ5b5n3LQYIZ8JMkK1qMoRly5K3gCxp87LZO3eKbNt ETx+HmJeyNEYBz6FommNcEEIlrzHRj79qWV+OOmjSNnB5ex9tPV+H1MJrFoz/OHocZ fhkPUXdzog1e3OLB8vp9CFt7GzUEMLh7P1QsZs4c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rafael Mendonca , Mathias Nyman Subject: [PATCH 6.0 029/862] xhci: dbc: Fix memory leak in xhci_alloc_dbc() Date: Wed, 19 Oct 2022 10:21:56 +0200 Message-Id: <20221019083251.301923715@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104717216617412?= X-GMAIL-MSGID: =?utf-8?q?1747104717216617412?= From: Rafael Mendonca commit d591b32e519603524a35b172156db71df9116902 upstream. If DbC is already in use, then the allocated memory for the xhci_dbc struct doesn't get freed before returning NULL, which leads to a memleak. Fixes: 534675942e90 ("xhci: dbc: refactor xhci_dbc_init()") Cc: stable@vger.kernel.org Signed-off-by: Rafael Mendonca Signed-off-by: Mathias Nyman Link: https://lore.kernel.org/r/20220921123450.671459-3-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/xhci-dbgcap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/usb/host/xhci-dbgcap.c +++ b/drivers/usb/host/xhci-dbgcap.c @@ -988,7 +988,7 @@ xhci_alloc_dbc(struct device *dev, void dbc->driver = driver; if (readl(&dbc->regs->control) & DBC_CTRL_DBC_ENABLE) - return NULL; + goto err; INIT_DELAYED_WORK(&dbc->event_work, xhci_dbc_handle_events); spin_lock_init(&dbc->lock); From patchwork Wed Oct 19 08:21:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4526 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp203601wrs; Wed, 19 Oct 2022 01:43:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7tLzGNGeVhvVngLOa4vdsjQL9CqeyaFGz9r2APa22hlsUqsojtpSNo3vCysqvHcz2kZ4d7 X-Received: by 2002:aa7:8f04:0:b0:563:1a66:9f with SMTP id x4-20020aa78f04000000b005631a66009fmr7284006pfr.75.1666169011669; Wed, 19 Oct 2022 01:43:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169011; cv=none; d=google.com; s=arc-20160816; b=i4bK3RK0SAZneKYY28C4+RN+irzof6wsDldiSmis9e6lctKtI+06Vfh/I4cjjPht2K 1pL9RMlK8WAZzd5zjECS4FBW1RxYBsmHcylT8VJiWV4t7vdBz3UH/RjIedZcYzfFGIQE rJ9MmQNuwKZcLEAmJNdRlG/MoOew/tI3PgSeCr8vNkBXupvs1uwdE7oZ9xjBG7b5hP53 T8EA7RFBzwpYvBhnmNuYJhARYjBg+cgGbg2YM3t82SqojmQjhakCLvIIyP3p0YjAI/c6 xaNug1kGRbPu5pC515unUUR+SlMZmPGfNCoGCw7c8ERUyaVxXfdc9CAtg5IBYndAkO/p OIpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0ey07O3mw8bK6McbG2I2Q+4vEP2gq6ox0PK/zyk3hys=; b=KTsrHkmQjqcmnTZ10vk8Exqijj2p/jzlpPNUrIziDmVH2lDNQWuGs9wWOxqBXYCOl5 0OqW+XRKsP7tF5XlexlyCbOaXjjlqwceXca3OR3hBk/z7lTSKtPn+2+vRV72RZE67poQ tYn4BNgyOG2pgMuPVtGj5MFJS0JPzk35TqOXk+a5j+CctUgJPol8tmNpeF0F5WBAVL0/ L3YSzQtj0P6g0g/qZFzK0FFWDVwQ6zHsIrc95ZcR5MEY/AolfPLnAihKaX6V4kRkoEhZ yYF8RZNYYW6XebOKrUrCp2vvyX19vs2E2Yv0LaS74I72LjZPQ28zqIk9Wymhf2x3+y/Q ZUHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jPH7jBxN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s28-20020a63525c000000b00439e40a8664si18952257pgl.374.2022.10.19.01.43.18; Wed, 19 Oct 2022 01:43: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=jPH7jBxN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231218AbiJSImo (ORCPT + 99 others); Wed, 19 Oct 2022 04:42:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230322AbiJSIlp (ORCPT ); Wed, 19 Oct 2022 04:41:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5B0911C09; Wed, 19 Oct 2022 01:39: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 720B9617D1; Wed, 19 Oct 2022 08:39:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65550C433D7; Wed, 19 Oct 2022 08:39:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168768; bh=r6sndrCPLnTm7kILdqqn2LD7psgBrGdbjQMZY6nBT90=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jPH7jBxNwf/TkMy0LMu/vZpKfcUFXv79JFsqr0Ln6HAxVTySCMQDzbJqgWGBHC4XJ yegBzSDtNHhWOkrcJZfotCcHylY3tQnXoF1t0h1hu5fPxQPsiu1ocB+Xig9uYp2rrk eeRVcYHzNwzi2OXy74zwrLtmmZe2RSbS6p3GDqDM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Chancellor , Laurent Pinchart , Kees Cook Subject: [PATCH 6.0 030/862] usb: gadget: uvc: Fix argument to sizeof() in uvc_register_video() Date: Wed, 19 Oct 2022 10:21:57 +0200 Message-Id: <20221019083251.346309144@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104837109992096?= X-GMAIL-MSGID: =?utf-8?q?1747104837109992096?= From: Nathan Chancellor commit a15e17acce5aaae54243f55a7349c2225450b9bc upstream. When building s390 allmodconfig after commit 9b91a6523078 ("usb: gadget: uvc: increase worker prio to WQ_HIGHPRI"), the following error occurs: In file included from ../include/linux/string.h:253, from ../include/linux/bitmap.h:11, from ../include/linux/cpumask.h:12, from ../include/linux/smp.h:13, from ../include/linux/lockdep.h:14, from ../include/linux/rcupdate.h:29, from ../include/linux/rculist.h:11, from ../include/linux/pid.h:5, from ../include/linux/sched.h:14, from ../include/linux/ratelimit.h:6, from ../include/linux/dev_printk.h:16, from ../include/linux/device.h:15, from ../drivers/usb/gadget/function/f_uvc.c:9: In function ‘fortify_memset_chk’, inlined from ‘uvc_register_video’ at ../drivers/usb/gadget/function/f_uvc.c:424:2: ../include/linux/fortify-string.h:301:25: error: call to ‘__write_overflow_field’ declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Werror=attribute-warning] 301 | __write_overflow_field(p_size_field, size); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This points to the memset() in uvc_register_video(). It is clear that the argument to sizeof() is incorrect, as uvc->vdev (a 'struct video_device') is being zeroed out but the size of uvc->video (a 'struct uvc_video') is being used as the third arugment to memset(). pahole shows that prior to commit 9b91a6523078 ("usb: gadget: uvc: increase worker prio to WQ_HIGHPRI"), 'struct video_device' and 'struct ucv_video' had the same size, meaning that the argument to sizeof() is incorrect semantically but there is no visible issue: $ pahole -s build/drivers/usb/gadget/function/f_uvc.o | grep -E "(uvc_video|video_device)\s+" video_device 1400 4 uvc_video 1400 3 After that change, uvc_video becomes slightly larger, meaning that the memset() will overwrite by 8 bytes: $ pahole -s build/drivers/usb/gadget/function/f_uvc.o | grep -E "(uvc_video|video_device)\s+" video_device 1400 4 uvc_video 1408 3 Fix the arugment to sizeof() so that there is no overwrite. Cc: stable@vger.kernel.org Fixes: e4ce9ed835bc ("usb: gadget: uvc: ensure the vdev is unset") Signed-off-by: Nathan Chancellor Reviewed-by: Laurent Pinchart Reviewed-by: Kees Cook Link: https://lore.kernel.org/r/20220928201921.3152163-1-nathan@kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/usb/gadget/function/f_uvc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/usb/gadget/function/f_uvc.c +++ b/drivers/usb/gadget/function/f_uvc.c @@ -421,7 +421,7 @@ uvc_register_video(struct uvc_device *uv int ret; /* TODO reference counting. */ - memset(&uvc->vdev, 0, sizeof(uvc->video)); + memset(&uvc->vdev, 0, sizeof(uvc->vdev)); uvc->vdev.v4l2_dev = &uvc->v4l2_dev; uvc->vdev.v4l2_dev->dev = &cdev->gadget->dev; uvc->vdev.fops = &uvc_v4l2_fops; From patchwork Wed Oct 19 08:21: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: 4537 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp204018wrs; Wed, 19 Oct 2022 01:44:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4QZORR95WUHPTkXnteTW6uN/rMo7vS+fnrydHEAbLGoW1T/MSxkSu0LhPdXveZj7QBJf1r X-Received: by 2002:a17:90b:1281:b0:20f:bcbf:ab7 with SMTP id fw1-20020a17090b128100b0020fbcbf0ab7mr6568287pjb.82.1666169087944; Wed, 19 Oct 2022 01:44:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169087; cv=none; d=google.com; s=arc-20160816; b=UcS+/I1IpdRHeyOL00Wjca9U/rwgJ96W5Ruv7Fy9xEPeaXdK9u7HzjN3ianMii8Pd0 lxkLby3tJfqJy7HUX526Ms3wFLWF/qNh+SKOY1eFQrTwVxSwUruvLEdvTi3Skr9D+5F1 OKzh3ZH/jsh/Y/7j/1+UrlRcI085HqPIwGM2jkDSsgD5PYkLF0McxwZbD4U3t/3weKmX ef8E63Z1weHEphpYyUPQ1z0icVw9bGZvuHmil/OThpAo5OCOVyoOokIWvnG6dLmaVWBZ haVDzLVcUAQZo80sDyLLUFs97gQJBk/mJhYWhbNai5ipnIJHWDUZ+p0VTFCSJvuEY/TT XN6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=KuUp48M7v+OFGwnF4eGOvZlZMiZTxzsftYW+e6GOZfM=; b=VUy1/nC7TKnwnYLpMIEs6xYQeA36E8ACltP6p8u2fZbRZrm6Byhs9hpjjdh9G01D/b J84EWHlG6Ll/DzkyoWf7tIytfEVTd6bvJ16dvvyfcNUSwLyHjgYf9VEdDvZCM3qxfDFu tzV50v8xJ8pUfC/RPXRxvuEtOjKxbFTF3FLdmEJQFrSbOjiwyGRLLYsO/pIv3q4YX91I Vm5rd7wTwzkiRR8TC0tNdd7/36dm1wEyQPAv8JMx3IEtkelwPdA8gA4FRbQPK5UWJT70 H1V+pLATF8FAzgODXAEQbkbg4DjxN2w9qt+OdvyERyGR/3BOO/W4jvAqOIoH9LTMZ3la WM9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="0J5glN/L"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id my11-20020a17090b4c8b00b0020dbe59427fsi19712166pjb.160.2022.10.19.01.44.35; Wed, 19 Oct 2022 01:44: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="0J5glN/L"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231240AbiJSInq (ORCPT + 99 others); Wed, 19 Oct 2022 04:43:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231132AbiJSIm7 (ORCPT ); Wed, 19 Oct 2022 04:42:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9638682757; Wed, 19 Oct 2022 01:40: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 669F1617D1; Wed, 19 Oct 2022 08:40:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7D42FC433D7; Wed, 19 Oct 2022 08:40:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168802; bh=XjTpf1SwUn1ueTangGWnryxHJFIZLLzPWdM8TV5F8/A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0J5glN/LupEAm0mlQ4Qw7k/ulblXfsgXVe4hTgrEyzC/6SSt79SZ6IC44+CMGoslv uHYnXlv5OzO6Rg4zueLYuGABD/jaURBt8RmuAmpEsrtCFdcgnPA3gxo9teHGst9V5R YKRGU5hKKik/aVek+d/KcGCjJ293U1N8oEvx2Tt0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jean-Francois Le Fillatre , stable Subject: [PATCH 6.0 031/862] usb: add quirks for Lenovo OneLink+ Dock Date: Wed, 19 Oct 2022 10:21:58 +0200 Message-Id: <20221019083251.397602528@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104917432724865?= X-GMAIL-MSGID: =?utf-8?q?1747104917432724865?= From: Jean-Francois Le Fillatre commit 37d49519b41405b08748392c6a7f193d9f77ecd2 upstream. The Lenovo OneLink+ Dock contains two VL812 USB3.0 controllers: 17ef:1018 upstream 17ef:1019 downstream These hubs suffer from two separate problems: 1) After the host system was suspended and woken up, the hubs appear to be in a random state. Some downstream ports (both internal to the built-in audio and network controllers, and external to USB sockets) may no longer be functional. The exact list of disabled ports (if any) changes from wakeup to wakeup. Ports remain in that state until the dock is power-cycled, or until the laptop is rebooted. Wakeup sources connected to the hubs (keyboard, WoL on the integrated gigabit controller) will wake the system up from suspend, but they may no longer work after wakeup (and in that case will no longer work as wakeup source in a subsequent suspend-wakeup cycle). This issue appears in the logs with messages such as: usb 1-6.1-port4: cannot disable (err = -71) usb 1-6-port2: cannot disable (err = -71) usb 1-6.1: clear tt 1 (80c0) error -71 usb 1-6-port4: cannot disable (err = -71) usb 1-6.4: PM: dpm_run_callback(): usb_dev_resume+0x0/0x10 [usbcore] returns -71 usb 1-6.4: PM: failed to resume async: error -71 usb 1-7: reset full-speed USB device number 5 using xhci_hcd usb 1-6.1-port1: cannot reset (err = -71) usb 1-6.1-port1: cannot reset (err = -71) usb 1-6.1-port1: cannot reset (err = -71) usb 1-6.1-port1: cannot reset (err = -71) usb 1-6.1-port1: cannot reset (err = -71) usb 1-6.1-port1: Cannot enable. Maybe the USB cable is bad? usb 1-6.1-port1: cannot disable (err = -71) usb 1-6.1-port1: cannot reset (err = -71) usb 1-6.1-port1: cannot reset (err = -71) usb 1-6.1-port1: cannot reset (err = -71) usb 1-6.1-port1: cannot reset (err = -71) usb 1-6.1-port1: cannot reset (err = -71) usb 1-6.1-port1: Cannot enable. Maybe the USB cable is bad? usb 1-6.1-port1: cannot disable (err = -71) 2) Some USB devices cannot be enumerated properly. So far I have only seen the issue with USB 3.0 devices. The same devices work without problem directly connected to the host system, to other systems or to other hubs (even when those hubs are connected to the OneLink+ dock). One very reliable reproducer is this USB 3.0 HDD enclosure: 152d:9561 JMicron Technology Corp. / JMicron USA Technology Corp. Mobius I have seen it happen sporadically with other USB 3.0 enclosures, with controllers from different manufacturers, all self-powered. Typical messages in the logs: xhci_hcd 0000:00:14.0: Timeout while waiting for setup device command xhci_hcd 0000:00:14.0: Timeout while waiting for setup device command usb 2-1.4: device not accepting address 6, error -62 xhci_hcd 0000:00:14.0: Timeout while waiting for setup device command xhci_hcd 0000:00:14.0: Timeout while waiting for setup device command usb 2-1.4: device not accepting address 7, error -62 usb 2-1-port4: attempt power cycle xhci_hcd 0000:00:14.0: Timeout while waiting for setup device command xhci_hcd 0000:00:14.0: Timeout while waiting for setup device command usb 2-1.4: device not accepting address 8, error -62 xhci_hcd 0000:00:14.0: Timeout while waiting for setup device command xhci_hcd 0000:00:14.0: Timeout while waiting for setup device command usb 2-1.4: device not accepting address 9, error -62 usb 2-1-port4: unable to enumerate USB device Through trial and error, I found that the USB_QUIRK_RESET_RESUME solved the second issue. Further testing then uncovered the first issue. Test results are summarized in this table: ======================================================================================= Settings USB2 hotplug USB3 hotplug State after waking up --------------------------------------------------------------------------------------- power/control=auto works fails broken usbcore.autosuspend=-1 works works broken OR power/control=on power/control=auto works (1) works (1) works and USB_QUIRK_RESET_RESUME power/control=on works works works and USB_QUIRK_RESET_RESUME HUB_QUIRK_DISABLE_AUTOSUSPEND works works works and USB_QUIRK_RESET_RESUME ======================================================================================= In those results, the power/control settings are applied to both hubs, both on the USB2 and USB3 side, before each test. >From those results, USB_QUIRK_RESET_RESUME is required to reset the hubs properly after a suspend-wakeup cycle, and the hubs must not autosuspend to work around the USB3 issue. A secondary effect of USB_QUIRK_RESET_RESUME is to prevent the hubs' upstream links from suspending (the downstream ports can still suspend). This secondary effect is used in results (1). It is enough to solve the USB3 problem. Setting USB_QUIRK_RESET_RESUME on those hubs is the smallest patch that solves both issues. Prior to creating this patch, I have used the USB_QUIRK_RESET_RESUME via the kernel command line for over a year without noticing any side effect. Thanks to Oliver Neukum @Suse for explanations of the operations of USB_QUIRK_RESET_RESUME, and requesting more testing. Signed-off-by: Jean-Francois Le Fillatre Cc: stable Link: https://lore.kernel.org/r/20220927073407.5672-1-jflf_kernel@gmx.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/core/quirks.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/usb/core/quirks.c +++ b/drivers/usb/core/quirks.c @@ -437,6 +437,10 @@ static const struct usb_device_id usb_qu { USB_DEVICE(0x1532, 0x0116), .driver_info = USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL }, + /* Lenovo ThinkPad OneLink+ Dock twin hub controllers (VIA Labs VL812) */ + { USB_DEVICE(0x17ef, 0x1018), .driver_info = USB_QUIRK_RESET_RESUME }, + { USB_DEVICE(0x17ef, 0x1019), .driver_info = USB_QUIRK_RESET_RESUME }, + /* Lenovo USB-C to Ethernet Adapter RTL8153-04 */ { USB_DEVICE(0x17ef, 0x720c), .driver_info = USB_QUIRK_NO_LPM }, From patchwork Wed Oct 19 08:21: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: 4554 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp204531wrs; Wed, 19 Oct 2022 01:46:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6NSMhn+lczhS//kTQ/ohyHZfEN4mCAol4rtpENTNjBmPX8QOmvfyA70OxE5Rss2kNhMsfa X-Received: by 2002:a17:90a:f3ca:b0:20a:d4ee:3859 with SMTP id ha10-20020a17090af3ca00b0020ad4ee3859mr8643488pjb.70.1666169185411; Wed, 19 Oct 2022 01:46:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169185; cv=none; d=google.com; s=arc-20160816; b=lEc94D2q9HoQaJJLMxZ/WfESY1JgX3ycqJBJvR2NlkZm0ps1+Hy40NN3vt9kpO/EM5 Bh7R7hp7hfqyaVRLKB72L5mS3lDN2e1fqTPTtaEM3dHZLAhtp4r2qW0WuWd0smxFf/wb +5IQBxz1CTIAWJZAtVhWOkdABrvsKcJdKdnNUTgBOZO4WVJ98D8JhphjvvXiIt+Pk8Ia Gt0/hhWsCHwRzew+QXFCngZGkny3XLSY5mTANNv4hT32/Bj7uM5f3KniXCztCAxNRc0J ZJ+/Be+pOZ9aXmIe70WlSgOSuFe4tnI/XsydEE7q7koI66sD3L1Vt4mB/XGzgH2z1H9o 4BPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=szg3zva8xluSXotCoi5UXUU2f4N/N+Q990n1a2uu0cc=; b=egM/iNNeKeh141183ql56ZQTnxIpySNHNfiq4l1AmmUZuwWHu5aPApAz4e4n1Nsw8q hbCGXEtiWoec1LMWCKZYSDiIspGhVXFAqwpdos93GLihxLg1wKpu+drxRwcr0cg/k4GT /WOvXkML/VbCowixhcqpvv8MYW8XzTiKv04nV2LwUTLpRwO1iFcU/+3+I41/Y92srWgb 0CU2C91d58jUga0XP3wqcK+EmoNuIdOFGYnAXlwg0TmYNJNqC55qX6PW/vVBLMpvlKA4 +33Aiql9Ev4MGrZ4okNQi719Sh+Qtrkx57kpONjNVjhq8y9uMwwwye6mZ5h6K/CGS6ir FbVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hGYWIWDj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 184-20020a6302c1000000b004607161e35dsi17321179pgc.830.2022.10.19.01.46.12; Wed, 19 Oct 2022 01:46: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=hGYWIWDj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231314AbiJSIpe (ORCPT + 99 others); Wed, 19 Oct 2022 04:45:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231362AbiJSIoC (ORCPT ); Wed, 19 Oct 2022 04: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 4CB27578BE; Wed, 19 Oct 2022 01: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 087D7617EC; Wed, 19 Oct 2022 08:40:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D2C6C433C1; Wed, 19 Oct 2022 08:40:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168835; bh=AO6bebF1z40eus5tkLpFMLiEY8a5u2OEABA+TuAC3ug=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hGYWIWDji7qWaKo49jo/yO9R1mPm4zHT6P8ZILihSfmi/e7ad+4pw8k3+X+EeTKik B4UM+KwSXu01cIfYaYpowk+BJgGFJzwBuTjN2XuJwNmPi0KZp8ukkjwvWrEljN8ujp 8LwOkYDp55ATmmjPG1sX+E7rCIEVm+a1HYSNz9Xg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Avri Altman , Ulf Hansson Subject: [PATCH 6.0 032/862] mmc: core: Add SD card quirk for broken discard Date: Wed, 19 Oct 2022 10:21:59 +0200 Message-Id: <20221019083251.438437419@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105019720421825?= X-GMAIL-MSGID: =?utf-8?q?1747105019720421825?= From: Avri Altman commit 07d2872bf4c864eb83d034263c155746a2fb7a3b upstream. Some SD-cards from Sandisk that are SDA-6.0 compliant reports they supports discard, while they actually don't. This might cause mk2fs to fail while trying to format the card and revert it to a read-only mode. To fix this problem, let's add a card quirk (MMC_QUIRK_BROKEN_SD_DISCARD) to indicate that we shall fall-back to use the legacy erase command instead. Signed-off-by: Avri Altman Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20220928095744.16455-1-avri.altman@wdc.com [Ulf: Updated the commit message] Signed-off-by: Ulf Hansson Signed-off-by: Greg Kroah-Hartman --- drivers/mmc/core/block.c | 6 +++++- drivers/mmc/core/card.h | 6 ++++++ drivers/mmc/core/quirks.h | 6 ++++++ include/linux/mmc/card.h | 1 + 4 files changed, 18 insertions(+), 1 deletion(-) --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -1140,8 +1140,12 @@ static void mmc_blk_issue_discard_rq(str { struct mmc_blk_data *md = mq->blkdata; struct mmc_card *card = md->queue.card; + unsigned int arg = card->erase_arg; - mmc_blk_issue_erase_rq(mq, req, MMC_BLK_DISCARD, card->erase_arg); + if (mmc_card_broken_sd_discard(card)) + arg = SD_ERASE_ARG; + + mmc_blk_issue_erase_rq(mq, req, MMC_BLK_DISCARD, arg); } static void mmc_blk_issue_secdiscard_rq(struct mmc_queue *mq, --- a/drivers/mmc/core/card.h +++ b/drivers/mmc/core/card.h @@ -73,6 +73,7 @@ struct mmc_fixup { #define EXT_CSD_REV_ANY (-1u) #define CID_MANFID_SANDISK 0x2 +#define CID_MANFID_SANDISK_SD 0x3 #define CID_MANFID_ATP 0x9 #define CID_MANFID_TOSHIBA 0x11 #define CID_MANFID_MICRON 0x13 @@ -258,4 +259,9 @@ static inline int mmc_card_broken_hpi(co return c->quirks & MMC_QUIRK_BROKEN_HPI; } +static inline int mmc_card_broken_sd_discard(const struct mmc_card *c) +{ + return c->quirks & MMC_QUIRK_BROKEN_SD_DISCARD; +} + #endif --- a/drivers/mmc/core/quirks.h +++ b/drivers/mmc/core/quirks.h @@ -100,6 +100,12 @@ static const struct mmc_fixup __maybe_un MMC_FIXUP("V10016", CID_MANFID_KINGSTON, CID_OEMID_ANY, add_quirk_mmc, MMC_QUIRK_TRIM_BROKEN), + /* + * Some SD cards reports discard support while they don't + */ + MMC_FIXUP(CID_NAME_ANY, CID_MANFID_SANDISK_SD, 0x5344, add_quirk_sd, + MMC_QUIRK_BROKEN_SD_DISCARD), + END_FIXUP }; --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h @@ -293,6 +293,7 @@ struct mmc_card { #define MMC_QUIRK_BROKEN_IRQ_POLLING (1<<11) /* Polling SDIO_CCCR_INTx could create a fake interrupt */ #define MMC_QUIRK_TRIM_BROKEN (1<<12) /* Skip trim */ #define MMC_QUIRK_BROKEN_HPI (1<<13) /* Disable broken HPI support */ +#define MMC_QUIRK_BROKEN_SD_DISCARD (1<<14) /* Disable broken SD discard support */ bool reenable_cmdq; /* Re-enable Command Queue */ From patchwork Wed Oct 19 08:22: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: 4563 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp204751wrs; Wed, 19 Oct 2022 01:47:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4rTCraU/DzFh/q+/puHZ+RMopm92sd0/ipzxl7enH1tB1ZR6biZG9O7w9HZLJNfR8TvLOG X-Received: by 2002:a17:90b:3ecd:b0:20d:9ddb:f287 with SMTP id rm13-20020a17090b3ecd00b0020d9ddbf287mr39638637pjb.167.1666169230999; Wed, 19 Oct 2022 01:47:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169230; cv=none; d=google.com; s=arc-20160816; b=rF3EBwi2zf2B9AoIf+OEgm6XJxUHWPWQzzJ4BY+E5x1Dx0wkMDzklOh8zOWLb2IZTK XRPVbHBILVUvyAQv+1OwGFGA4RkNAbu4F3DjGLOyHB9Z1l+xLy3B9zK565cFiCsIjOxa XC5H69NDJim4S7JotffC3Scf6bQ3BizVGkQFA4xJHBF7Qz9frib3HpQVUMtgcmEMeddI 4HzYE8RGA6sr28fUe/Vme0Ss+Xx/IvjdvZVS5js2q5grbvUhzklD4IuPOvwft/KCuClm zEFzH/OEdGlDId2Xq8A0Www0CgwYfl5ZKc/L3sAAH4D5vCcDcpCP1twG1rG3gTqesCKc zflg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YRTif7NfarZ5Kgl0TnlJeFCWeCCMG1dqPnhKppj9yUI=; b=JV8p5fZ3m3RE+UEi0DwUgAmWYunP7XGV9GxAFw/R9Br/76HGh4Vbvsy5LDMGxMlRZQ 0sqiemVGD56bYEn6E/2ksGgOTj1yWJkdzcVHk4vpqnUDk96wT8XPc06/961kApy+4cj9 AtbNwJCL0XbAMIrsrw4VOlgU7yPI5k4x6LJRWDwXL/bjiXZWls02l+xS768yFrK6FG+Z W12SStYybtIwHpftq4NR5q8eMIc4f2MtkWvxkXWKFsPh2LTxD7hTDHApdjSP+l1F9jVg CEtqM8yUprFm7OUFeBvoadjIdAnf+8QvwZn2/DNXOF9fIZ4PXu6q8xu4kSs8m2JHn6nx CeKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Jg3HzK2l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e63-20020a636942000000b00434ac3b9915si14763928pgc.790.2022.10.19.01.46.57; Wed, 19 Oct 2022 01:47: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=Jg3HzK2l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231524AbiJSIqk (ORCPT + 99 others); Wed, 19 Oct 2022 04:46:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231355AbiJSIpA (ORCPT ); Wed, 19 Oct 2022 04:45: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 142E748CBF; Wed, 19 Oct 2022 01:43:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DA81A617AC; Wed, 19 Oct 2022 08:40:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC99EC433D7; Wed, 19 Oct 2022 08:40:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168838; bh=gAPNA266KQeQSGkOEShdOgJZHr8wW5LQFOxSvU+NFec=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Jg3HzK2lAcQlskLmP6PS/PQr/zYUC+WGl9WhXhwgWGTEbrU4FQ/fAR2+pmdqIf3yv xPH0rDgbQPZ9EwXmLrLW6c9T7nF6+xpVnmnZaL5gpmx2WW9fEL73QlVYCN5VZYaF7f Zp0g8TePHRyi0xDqimVBMfV5G4Y4aWadsCj5CTKc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jimmy Assarsson , Anssi Hannula , Marc Kleine-Budde Subject: [PATCH 6.0 033/862] can: kvaser_usb: Fix use of uninitialized completion Date: Wed, 19 Oct 2022 10:22:00 +0200 Message-Id: <20221019083251.490153394@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105067835315557?= X-GMAIL-MSGID: =?utf-8?q?1747105067835315557?= From: Anssi Hannula commit cd7f30e174d09a02ca2afa5ef093fb0f0352e0d8 upstream. flush_comp is initialized when CMD_FLUSH_QUEUE is sent to the device and completed when the device sends CMD_FLUSH_QUEUE_RESP. This causes completion of uninitialized completion if the device sends CMD_FLUSH_QUEUE_RESP before CMD_FLUSH_QUEUE is ever sent (e.g. as a response to a flush by a previously bound driver, or a misbehaving device). Fix that by initializing flush_comp in kvaser_usb_init_one() like the other completions. This issue is only triggerable after RX URBs have been set up, i.e. the interface has been opened at least once. Cc: stable@vger.kernel.org Fixes: aec5fb2268b7 ("can: kvaser_usb: Add support for Kvaser USB hydra family") Tested-by: Jimmy Assarsson Signed-off-by: Anssi Hannula Signed-off-by: Jimmy Assarsson Link: https://lore.kernel.org/all/20221010150829.199676-3-extja@kvaser.com Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman --- drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c | 1 + drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c @@ -729,6 +729,7 @@ static int kvaser_usb_init_one(struct kv init_usb_anchor(&priv->tx_submitted); init_completion(&priv->start_comp); init_completion(&priv->stop_comp); + init_completion(&priv->flush_comp); priv->can.ctrlmode_supported = 0; priv->dev = dev; --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c @@ -1916,7 +1916,7 @@ static int kvaser_usb_hydra_flush_queue( { int err; - init_completion(&priv->flush_comp); + reinit_completion(&priv->flush_comp); err = kvaser_usb_hydra_send_simple_cmd(priv->dev, CMD_FLUSH_QUEUE, priv->channel); From patchwork Wed Oct 19 08:22: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: 4556 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp204605wrs; Wed, 19 Oct 2022 01:46:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4uNLbySqpvNOjEIxYOxCgtRTLBf1YXwKxfMZ2hYV1mAf9iK79pfV/4CydM2CmMxUISs1F2 X-Received: by 2002:a63:5658:0:b0:43c:dac:9e24 with SMTP id g24-20020a635658000000b0043c0dac9e24mr6208986pgm.562.1666169199234; Wed, 19 Oct 2022 01:46:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169199; cv=none; d=google.com; s=arc-20160816; b=Yxkv6FLGHfLrM+UR8gcm3JrDhbkweo50GNbHjsGCtEBftIdV8R00tJMIDFGWFvzjBV BRnL+Ptq47748rnUdpLgCZX/sLdO9H3VoMhYoN+CsTKwXvku19KaBg94yKau1oNZMWvy h/WUuUgn5GNLheq+lT+A8c86DU5iAIbvH05Q5D22Z0gcbezIz8RuS/eifbA7qbI7DshR HUDummCjy6wES8I6DK2Tij8RNXtYNCcFMSxkb0fZf5Pqx9rFagg8+9FVzDSLipqg2kod LNT6vyhEqqcx/0X1ERt7N6mJeh+s6PDdMwr1YfJgKHgTsDUOs1x5HQNOjO/eYGbT08+b +trg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MNdViSOk++oY+izWvSrP9BmvCVSnkQCa/nIq+sPn5+M=; b=LpezOunVOlPAyA7XDOWIx/p/diu4IjE4litg147VMVri6lkjXAjsh/qybrvsyIf1LM nrI6FubG5A0jHk47/rSfxPr/rF/9uBKjzGMI1AvWbPm4I3V6ZzO5pj+7CqrT7wW7GxH6 UTDGjGCffAfaZAK8aNRHSIVk8uJIp2oPfx9ggnc6V5c2SdAIiwVMvUyRobr4A+xRAUB2 1alORQpEeEMDqCMkQ+vavWzR45a2/PBnaQWcR72OCTK7tH9kD4pgh20U+1VqWGdioDYO UjW3ViEofu6YOOad//4fGROze5e3qF2mUDLAOU01fVz/bm4Xs/JAHW5DEdqwua7aJaVb CCgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pxdnKG3J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i11-20020a17090332cb00b00172db9d9a01si18716434plr.616.2022.10.19.01.46.23; Wed, 19 Oct 2022 01: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=pxdnKG3J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231476AbiJSIqE (ORCPT + 99 others); Wed, 19 Oct 2022 04:46:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231171AbiJSIoZ (ORCPT ); Wed, 19 Oct 2022 04:44:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77167248C4; Wed, 19 Oct 2022 01:43: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 2DBC2617ED; Wed, 19 Oct 2022 08:40:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DEB2EC433C1; Wed, 19 Oct 2022 08:40:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168841; bh=fKJwUNj+WZmm2S+aDmii77muhA5lPrzqkWoRYL+Sruw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pxdnKG3J0rVIcikU/e4q5Hj6k9C6saM4ebylvtbQUbLiYw+/E/HXXJ5O8zxWyiDN7 nXGxSQV+pyfEhBK6SnpkDYsQFGo1pKIvUEilyudFrli1HxEoK2PlkEHT5bZVUMbfWb jYTxaZL1GmcdWDetJo9ce2Roes+46JZpV4XrI3a4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jimmy Assarsson , Anssi Hannula , Marc Kleine-Budde Subject: [PATCH 6.0 034/862] can: kvaser_usb_leaf: Fix overread with an invalid command Date: Wed, 19 Oct 2022 10:22:01 +0200 Message-Id: <20221019083251.531275455@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105034176911761?= X-GMAIL-MSGID: =?utf-8?q?1747105034176911761?= From: Anssi Hannula commit 1499ecaea9d2ba68d5e18d80573b4561a8dc4ee7 upstream. For command events read from the device, kvaser_usb_leaf_read_bulk_callback() verifies that cmd->len does not exceed the size of the received data, but the actual kvaser_cmd handlers will happily read any kvaser_cmd fields without checking for cmd->len. This can cause an overread if the last cmd in the buffer is shorter than expected for the command type (with cmd->len showing the actual short size). Maximum overread seems to be 22 bytes (CMD_LEAF_LOG_MESSAGE), some of which are delivered to userspace as-is. Fix that by verifying the length of command before handling it. This issue can only occur after RX URBs have been set up, i.e. the interface has been opened at least once. Cc: stable@vger.kernel.org Fixes: 080f40a6fa28 ("can: kvaser_usb: Add support for Kvaser CAN/USB devices") Tested-by: Jimmy Assarsson Signed-off-by: Anssi Hannula Signed-off-by: Jimmy Assarsson Link: https://lore.kernel.org/all/20221010150829.199676-2-extja@kvaser.com Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman --- drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c | 75 +++++++++++++++++++++++ 1 file changed, 75 insertions(+) --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c @@ -310,6 +310,38 @@ struct kvaser_cmd { } u; } __packed; +#define CMD_SIZE_ANY 0xff +#define kvaser_fsize(field) sizeof_field(struct kvaser_cmd, field) + +static const u8 kvaser_usb_leaf_cmd_sizes_leaf[] = { + [CMD_START_CHIP_REPLY] = kvaser_fsize(u.simple), + [CMD_STOP_CHIP_REPLY] = kvaser_fsize(u.simple), + [CMD_GET_CARD_INFO_REPLY] = kvaser_fsize(u.cardinfo), + [CMD_TX_ACKNOWLEDGE] = kvaser_fsize(u.tx_acknowledge_header), + [CMD_GET_SOFTWARE_INFO_REPLY] = kvaser_fsize(u.leaf.softinfo), + [CMD_RX_STD_MESSAGE] = kvaser_fsize(u.leaf.rx_can), + [CMD_RX_EXT_MESSAGE] = kvaser_fsize(u.leaf.rx_can), + [CMD_LEAF_LOG_MESSAGE] = kvaser_fsize(u.leaf.log_message), + [CMD_CHIP_STATE_EVENT] = kvaser_fsize(u.leaf.chip_state_event), + [CMD_CAN_ERROR_EVENT] = kvaser_fsize(u.leaf.error_event), + /* ignored events: */ + [CMD_FLUSH_QUEUE_REPLY] = CMD_SIZE_ANY, +}; + +static const u8 kvaser_usb_leaf_cmd_sizes_usbcan[] = { + [CMD_START_CHIP_REPLY] = kvaser_fsize(u.simple), + [CMD_STOP_CHIP_REPLY] = kvaser_fsize(u.simple), + [CMD_GET_CARD_INFO_REPLY] = kvaser_fsize(u.cardinfo), + [CMD_TX_ACKNOWLEDGE] = kvaser_fsize(u.tx_acknowledge_header), + [CMD_GET_SOFTWARE_INFO_REPLY] = kvaser_fsize(u.usbcan.softinfo), + [CMD_RX_STD_MESSAGE] = kvaser_fsize(u.usbcan.rx_can), + [CMD_RX_EXT_MESSAGE] = kvaser_fsize(u.usbcan.rx_can), + [CMD_CHIP_STATE_EVENT] = kvaser_fsize(u.usbcan.chip_state_event), + [CMD_CAN_ERROR_EVENT] = kvaser_fsize(u.usbcan.error_event), + /* ignored events: */ + [CMD_USBCAN_CLOCK_OVERFLOW_EVENT] = CMD_SIZE_ANY, +}; + /* Summary of a kvaser error event, for a unified Leaf/Usbcan error * handling. Some discrepancies between the two families exist: * @@ -397,6 +429,43 @@ static const struct kvaser_usb_dev_cfg k .bittiming_const = &kvaser_usb_flexc_bittiming_const, }; +static int kvaser_usb_leaf_verify_size(const struct kvaser_usb *dev, + const struct kvaser_cmd *cmd) +{ + /* buffer size >= cmd->len ensured by caller */ + u8 min_size = 0; + + switch (dev->driver_info->family) { + case KVASER_LEAF: + if (cmd->id < ARRAY_SIZE(kvaser_usb_leaf_cmd_sizes_leaf)) + min_size = kvaser_usb_leaf_cmd_sizes_leaf[cmd->id]; + break; + case KVASER_USBCAN: + if (cmd->id < ARRAY_SIZE(kvaser_usb_leaf_cmd_sizes_usbcan)) + min_size = kvaser_usb_leaf_cmd_sizes_usbcan[cmd->id]; + break; + } + + if (min_size == CMD_SIZE_ANY) + return 0; + + if (min_size) { + min_size += CMD_HEADER_LEN; + if (cmd->len >= min_size) + return 0; + + dev_err_ratelimited(&dev->intf->dev, + "Received command %u too short (size %u, needed %u)", + cmd->id, cmd->len, min_size); + return -EIO; + } + + dev_warn_ratelimited(&dev->intf->dev, + "Unhandled command (%d, size %d)\n", + cmd->id, cmd->len); + return -EINVAL; +} + static void * kvaser_usb_leaf_frame_to_cmd(const struct kvaser_usb_net_priv *priv, const struct sk_buff *skb, int *cmd_len, @@ -502,6 +571,9 @@ static int kvaser_usb_leaf_wait_cmd(cons end: kfree(buf); + if (err == 0) + err = kvaser_usb_leaf_verify_size(dev, cmd); + return err; } @@ -1133,6 +1205,9 @@ static void kvaser_usb_leaf_stop_chip_re static void kvaser_usb_leaf_handle_command(const struct kvaser_usb *dev, const struct kvaser_cmd *cmd) { + if (kvaser_usb_leaf_verify_size(dev, cmd) < 0) + return; + switch (cmd->id) { case CMD_START_CHIP_REPLY: kvaser_usb_leaf_start_chip_reply(dev, cmd); From patchwork Wed Oct 19 08:22: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: 4567 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp204850wrs; Wed, 19 Oct 2022 01:47:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5WV0o8It2vdK3r7YikbMs9EwsusXIiUVmMj53DzVM/LXeCwrALnBHrTnaWdI9EtBx5TpLF X-Received: by 2002:a17:90b:3850:b0:20d:54f2:a780 with SMTP id nl16-20020a17090b385000b0020d54f2a780mr44041589pjb.115.1666169188665; Wed, 19 Oct 2022 01:46:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169188; cv=none; d=google.com; s=arc-20160816; b=hSdWy6WHU5pyiOtUeTzIpGIqcB6JAo9XeOP4sox5zCg/82w56oAOLXieCvOVdRdmg4 RnRQLUBrNHW3vRkZxrmoYcX5c8dtlY/FlyynQxOYmZ7mSpUW1a8yQNlz4Iz5wMuuv8sm PosZ2ApPoB7wRTgNgtrJgvAfe0RSHk3jIlhjOIsOSSHkdFw316X11DjQEvqi0eCbuJHp pSM+116NmOXrxXbHRD0ktGN3moWIkotKMuscTG6r75M04asKZinJSCGfmjinMprSMXU4 KP/m0M9Zq9o4AjVTXBLLRfJxFyijNG8pVgnEGVKHkRm+b9cwKrzYUbPi3M03KXJwDZEM o5fQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=V5gcis1ss8NXQ58CIc+kGQNew0GC3iCRBxpmUYUIvlU=; b=WW9/RW5qkzBFCwlLXHU+kAmyy31YpOq95D6j2BYtiYCl/Hkiin0uo0L6tGSsm+J5p9 Vi+o0boSo15NLIJYsiOVHdfuZ0c4RWWH6T/XlcBnL4Qhwv020AV+2q9Y33TcNN87PURL nG9tXaXLovIrPyezI5MGIdLC376YkusSxzYz3vWfNzSlNftlwU1CY1QQGf8Oe8gtYBh2 cMyevHrG2sYNJtcZyYekH9IUa+QC11BfmEM+52tBgTM+bYE9YRcti5Z0vDcfX1adoMPG drNHfPUarev2UIasTPiOEoMdDBDZP6n0kCVnp5Ai8dmCQu2Wo4o81DPHeMaINwX38zdv ONGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=O8Ousj+F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y9-20020a655b09000000b004635d57777bsi18007683pgq.748.2022.10.19.01.46.15; Wed, 19 Oct 2022 01: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=O8Ousj+F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231343AbiJSIps (ORCPT + 99 others); Wed, 19 Oct 2022 04:45:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231449AbiJSIoL (ORCPT ); Wed, 19 Oct 2022 04:44:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AFAFD89963; Wed, 19 Oct 2022 01: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 218B9617D1; Wed, 19 Oct 2022 08:40:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2EA44C433D6; Wed, 19 Oct 2022 08:40:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168844; bh=O5hT/gQYm6/LEbKSOMr4FejGgecjPZtk9ndOZq8vVHM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O8Ousj+FGM/GJehWCEF6xT6gDQ6tBG3Jy4FeuHYsQjv/kLYj7thFnDACw9xX01pNk CuAo2EKpqj3K5MXMI2xI0wQ0SviEcwIVMdGXSHsZrTrg/hMkpUuF/xr4/Gl6maWAa9 2h4diY5Gp+Fmg8uJT66VS9qb0n7d3uqKx+jge4AA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jimmy Assarsson , Anssi Hannula , Marc Kleine-Budde Subject: [PATCH 6.0 035/862] can: kvaser_usb_leaf: Fix TX queue out of sync after restart Date: Wed, 19 Oct 2022 10:22:02 +0200 Message-Id: <20221019083251.563976478@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105022909661286?= X-GMAIL-MSGID: =?utf-8?q?1747105022909661286?= From: Anssi Hannula commit 455561fb618fde40558776b5b8435f9420f335db upstream. The TX queue seems to be implicitly flushed by the hardware during bus-off or bus-off recovery, but the driver does not reset the TX bookkeeping. Despite not resetting TX bookkeeping the driver still re-enables TX queue unconditionally, leading to "cannot find free context" / NETDEV_TX_BUSY errors if the TX queue was full at bus-off time. Fix that by resetting TX bookkeeping on CAN restart. Tested with 0bfd:0124 Kvaser Mini PCI Express 2xHS FW 4.18.778. Cc: stable@vger.kernel.org Fixes: 080f40a6fa28 ("can: kvaser_usb: Add support for Kvaser CAN/USB devices") Tested-by: Jimmy Assarsson Signed-off-by: Anssi Hannula Signed-off-by: Jimmy Assarsson Link: https://lore.kernel.org/all/20221010150829.199676-4-extja@kvaser.com Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman --- drivers/net/can/usb/kvaser_usb/kvaser_usb.h | 2 ++ drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c | 2 +- drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb.h +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb.h @@ -178,6 +178,8 @@ struct kvaser_usb_dev_cfg { extern const struct kvaser_usb_dev_ops kvaser_usb_hydra_dev_ops; extern const struct kvaser_usb_dev_ops kvaser_usb_leaf_dev_ops; +void kvaser_usb_unlink_tx_urbs(struct kvaser_usb_net_priv *priv); + int kvaser_usb_recv_cmd(const struct kvaser_usb *dev, void *cmd, int len, int *actual_len); --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c @@ -477,7 +477,7 @@ static void kvaser_usb_reset_tx_urb_cont /* This method might sleep. Do not call it in the atomic context * of URB completions. */ -static void kvaser_usb_unlink_tx_urbs(struct kvaser_usb_net_priv *priv) +void kvaser_usb_unlink_tx_urbs(struct kvaser_usb_net_priv *priv) { usb_kill_anchored_urbs(&priv->tx_submitted); kvaser_usb_reset_tx_urb_contexts(priv); --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c @@ -1426,6 +1426,8 @@ static int kvaser_usb_leaf_set_mode(stru switch (mode) { case CAN_MODE_START: + kvaser_usb_unlink_tx_urbs(priv); + err = kvaser_usb_leaf_simple_cmd_async(priv, CMD_START_CHIP); if (err) return err; From patchwork Wed Oct 19 08:22: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: 4558 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp204668wrs; Wed, 19 Oct 2022 01:46:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7DOSmu7HEFZVTmCRoFD1wOg3dRNCQvTgkWO09wI3hAEwbNWxOOJs4uBeIN13yf7KuH+Qdy X-Received: by 2002:a62:52d8:0:b0:562:3c8d:d427 with SMTP id g207-20020a6252d8000000b005623c8dd427mr7561254pfb.44.1666169209950; Wed, 19 Oct 2022 01:46:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169209; cv=none; d=google.com; s=arc-20160816; b=fD6HnHUmdzK6JUldaq7VhHcS90DEhWYyVJlPI45eQ/poCcyKfJDDOTcfMwe8vZKDFn gESWhvB/8h6qibvzDTwBrS9PicXL4WVpslHIPmSVLA0qM2fwTMnLHXrKLJstcuKeYnvc h37svEHOOdIWqVQvnf11qgPvOwlZgsE8SYqkXnAS1QKdvxY8OCa1aAWx1iJzcCeygvNl aWEuNXWlR9BrppXQei+TgYrYHSD97Zv2mpk89jiQwyxRSJgF1gYfdrpptFvZEu/6lRwi yOSeZdfLzTjNkW5IFAO15giqVWwNIYbO7bLVuGn2p4xFIuF8zk6miLZN1nFHjOHx4gpm 2EZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=L8g3F59D/XAZ2BCynqpXESPqD6tezmcyEtLEOJVquhc=; b=hTmoNoKCUpJWdz0B0BpMXhr/9eUP1SIXRUWyOD9jRkQiZvqO7sXhKbR5GdYVaA4LjG DUXwN/6uIagK+AoGeG6hTRhqxoOKO4zJBLM0+s5fvORP4ilkYO0Dm7/5VH9oy4WJgS9L vUYJKcJp1BWrT1urE61jrlVg+OtIK+51KdGxncwM2uQiPhd58ot9zjkx6Xdw10ddYLIO 3bAmUhBSQ9SDeh6PJwoAAICkGIc45AVvApTl74abOtILotnuiHY6CqEldlyua6rh7qWC eBROe4n197DfcgBBcUs44pT3TBgimTE9TSjH2Fow8XsLUO4L50lAayF2nGYP+Bh0cqSt y8gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qR9zoQAr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n34-20020a17090a5aa500b00203917479dcsi21526727pji.107.2022.10.19.01.46.34; Wed, 19 Oct 2022 01: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=qR9zoQAr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231485AbiJSIqM (ORCPT + 99 others); Wed, 19 Oct 2022 04:46:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231521AbiJSIoV (ORCPT ); Wed, 19 Oct 2022 04:44:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0592B8990F; Wed, 19 Oct 2022 01:43: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 E4E1BB822CE; Wed, 19 Oct 2022 08:40:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 417E8C433C1; Wed, 19 Oct 2022 08:40:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168847; bh=IqOeSFRkEtFe8p7jE88Il7lUnL9BT5aOsb6MHv3D1WQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qR9zoQAreLe/Q0PBOyIrzFV3CLrNAQ8w2KxHps38V5Q2XtAI6g/N7ZD9SU1QJF4Wf MP4FgkBpYHJows8ruCyMrWIp6+Fa3hTxBAPODNU2HAVguQ8r7bP+nZre9o3sVwgVHY vC1pebbL1655t1uAEaZg2llNW9NUC7KulUHcx81M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jimmy Assarsson , Anssi Hannula , Marc Kleine-Budde Subject: [PATCH 6.0 036/862] can: kvaser_usb_leaf: Fix CAN state after restart Date: Wed, 19 Oct 2022 10:22:03 +0200 Message-Id: <20221019083251.610456071@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105045629083877?= X-GMAIL-MSGID: =?utf-8?q?1747105045629083877?= From: Anssi Hannula commit 0be1a655fe68c8e6dcadbcbddb69cf2fb29881f5 upstream. can_restart() expects CMD_START_CHIP to set the error state to ERROR_ACTIVE as it calls netif_carrier_on() immediately afterwards. Otherwise the user may immediately trigger restart again and hit a BUG_ON() in can_restart(). Fix kvaser_usb_leaf set_mode(CMD_START_CHIP) to set the expected state. Cc: stable@vger.kernel.org Fixes: 080f40a6fa28 ("can: kvaser_usb: Add support for Kvaser CAN/USB devices") Tested-by: Jimmy Assarsson Signed-off-by: Anssi Hannula Signed-off-by: Jimmy Assarsson Link: https://lore.kernel.org/all/20221010150829.199676-5-extja@kvaser.com Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman --- drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c @@ -1431,6 +1431,8 @@ static int kvaser_usb_leaf_set_mode(stru err = kvaser_usb_leaf_simple_cmd_async(priv, CMD_START_CHIP); if (err) return err; + + priv->can.state = CAN_STATE_ERROR_ACTIVE; break; default: return -EOPNOTSUPP; From patchwork Wed Oct 19 08:22: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: 4561 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp204720wrs; Wed, 19 Oct 2022 01:47:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7+m+CIdJIlhv8NdCz5KPSE+ryj1Lx+wJhVaan4Ky468+Jagao9Xnm74v4izSR4HbFGotuh X-Received: by 2002:a05:6a00:198e:b0:566:9207:d340 with SMTP id d14-20020a056a00198e00b005669207d340mr7547081pfl.83.1666169225358; Wed, 19 Oct 2022 01:47:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169225; cv=none; d=google.com; s=arc-20160816; b=J0cv6f0/lhKHAa9WekqqKNB8TugEDN/4bia0lsDI/iP8VumPa25Am423HRditqLE8L qORtAwWfh0u0N+3WhKXDFC+7fiNMIjH9mTPiaVHk4W1X8Mg/woyNWiJU7qLShrCjNvix otvmY60Q9fcfwsgQ8ynetWNh4HrL0qN9TqW+DUtbXYIXPudjKKn93t7FsSJc+JZYPZQw E52bBtZlTVwGxong/8XfUmOfHyH18ZqCDuji8PbG6MFagDvQ2o2fuGy7mBvP+1/CwQgL 6JkgpZgyK/2DaE2Z38xrwPQpC4yDnjNwt5vZWbrPCCIkoFQ0PKDHLAKinaW2ClZyAVxQ Dl5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rQcYVprb7lq0eUVaMLISSGXF3Wck4rzGh+PlwoQIhYY=; b=J8WQ1iXW0ZmtI8/K6TVA1QRwC5lEPvZMNOWKXfAVg0PJjh0s6mfIR753j2l19JxMAm dGkTPnRDTkJqkaPZBwFCUY/+zGtApfeaJfowSrZnwvvMACenCceAKUoo8QXi5nHQWzLF HivVOykOirA47ZfBxwcupHF+eWRTNUSp4VBkbcYRVyO/Buxnm3FQNcVATCT6iMx2gXXu 3cjHto5d8vRq44fxHAiacvtfZxeYURe4PKMacMc4GK8RmbApc0p1fQ6HhpwcTGQpr5CS KM0BvOHXIIG0BIcQ0WdAgkeyPmWIqubaIL3UdBZj6s6WvKudqoU3GyzOvxuJuykNqyvo Nvzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qtvKdoGJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a056a00084700b00548d480e340si19475053pfk.92.2022.10.19.01.46.52; Wed, 19 Oct 2022 01:47: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=qtvKdoGJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231390AbiJSIqf (ORCPT + 99 others); Wed, 19 Oct 2022 04:46:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231336AbiJSIo6 (ORCPT ); Wed, 19 Oct 2022 04:44:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52C927B78A; Wed, 19 Oct 2022 01: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 CCD19B822BE; Wed, 19 Oct 2022 08:40:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F4BEC433D6; Wed, 19 Oct 2022 08:40:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168850; bh=OQ5+raYgpwxt5gHw9gmhOZpaGz9bNoTbg+XUHADCeTM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qtvKdoGJl1iteh8VtgSsBMc+Ct4Rrr21IbG+RUBATX8zO7ZEiC4eZoikmeJzb7Lzd CE6bHGcucG0xRkmiTAO6bChVJejDR3owPsYkgN4BuU85Rko2cMDLC/qGWa4kmW9vzZ RKMG6DEf9k571Yp+Sz8A2lpHv5AxPHXCdKph3lMc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Biju Das , Geert Uytterhoeven , Wolfram Sang , Ulf Hansson Subject: [PATCH 6.0 037/862] mmc: renesas_sdhi: Fix rounding errors Date: Wed, 19 Oct 2022 10:22:04 +0200 Message-Id: <20221019083251.643994926@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105061735315137?= X-GMAIL-MSGID: =?utf-8?q?1747105061735315137?= From: Biju Das commit f0c00454bf78975925eccc9737faaa4d4951edbf upstream. Due to clk rounding errors on RZ/G2L platforms, it selects a clock source with a lower clock rate compared to a higher one. For eg: The rounding error (533333333 Hz / 4 * 4 = 533333332 Hz < 5333333 33 Hz) selects a clk source of 400 MHz instead of 533.333333 MHz. This patch fixes this issue by adding a margin of (1/1024) higher to the clock rate. Signed-off-by: Biju Das Reviewed-by: Geert Uytterhoeven Tested-by: Geert Uytterhoeven Reviewed-by: Wolfram Sang Tested-by: Wolfram Sang Fixes: bb6d3fa98a41 ("clk: renesas: rcar-gen3: Switch to new SD clock handling") Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20220928110755.849275-1-biju.das.jz@bp.renesas.com Signed-off-by: Ulf Hansson Signed-off-by: Greg Kroah-Hartman --- drivers/mmc/host/renesas_sdhi_core.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) --- a/drivers/mmc/host/renesas_sdhi_core.c +++ b/drivers/mmc/host/renesas_sdhi_core.c @@ -128,6 +128,7 @@ static unsigned int renesas_sdhi_clk_upd struct clk *ref_clk = priv->clk; unsigned int freq, diff, best_freq = 0, diff_min = ~0; unsigned int new_clock, clkh_shift = 0; + unsigned int new_upper_limit; int i; /* @@ -153,13 +154,20 @@ static unsigned int renesas_sdhi_clk_upd * greater than, new_clock. As we can divide by 1 << i for * any i in [0, 9] we want the input clock to be as close as * possible, but no greater than, new_clock << i. + * + * Add an upper limit of 1/1024 rate higher to the clock rate to fix + * clk rate jumping to lower rate due to rounding error (eg: RZ/G2L has + * 3 clk sources 533.333333 MHz, 400 MHz and 266.666666 MHz. The request + * for 533.333333 MHz will selects a slower 400 MHz due to rounding + * error (533333333 Hz / 4 * 4 = 533333332 Hz < 533333333 Hz)). */ for (i = min(9, ilog2(UINT_MAX / new_clock)); i >= 0; i--) { freq = clk_round_rate(ref_clk, new_clock << i); - if (freq > (new_clock << i)) { + new_upper_limit = (new_clock << i) + ((new_clock << i) >> 10); + if (freq > new_upper_limit) { /* Too fast; look for a slightly slower option */ freq = clk_round_rate(ref_clk, (new_clock << i) / 4 * 3); - if (freq > (new_clock << i)) + if (freq > new_upper_limit) continue; } @@ -181,6 +189,7 @@ static unsigned int renesas_sdhi_clk_upd static void renesas_sdhi_set_clock(struct tmio_mmc_host *host, unsigned int new_clock) { + unsigned int clk_margin; u32 clk = 0, clock; sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, ~CLK_CTL_SCLKEN & @@ -194,7 +203,13 @@ static void renesas_sdhi_set_clock(struc host->mmc->actual_clock = renesas_sdhi_clk_update(host, new_clock); clock = host->mmc->actual_clock / 512; - for (clk = 0x80000080; new_clock >= (clock << 1); clk >>= 1) + /* + * Add a margin of 1/1024 rate higher to the clock rate in order + * to avoid clk variable setting a value of 0 due to the margin + * provided for actual_clock in renesas_sdhi_clk_update(). + */ + clk_margin = new_clock >> 10; + for (clk = 0x80000080; new_clock + clk_margin >= (clock << 1); clk >>= 1) clock <<= 1; /* 1/1 clock is option */ From patchwork Wed Oct 19 08:22: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: 4512 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp203061wrs; Wed, 19 Oct 2022 01:42:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5RrXiuPicvKn9KLKaZQ7NrgBvqUjtMpazPISenRAqTOQ4Wxen8ZsXg90bvH7xtW6EbFH0O X-Received: by 2002:a05:6402:1d86:b0:457:e84:f0e with SMTP id dk6-20020a0564021d8600b004570e840f0emr6293417edb.241.1666168927551; Wed, 19 Oct 2022 01:42:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666168927; cv=none; d=google.com; s=arc-20160816; b=L7z6KMP2txyzHvzk8p5LjKfsD6G0ACo/ZBsfWWv+rXg0zkodHfTTEQUqrNjXkW/02y f6BXCizyRNTW1JZp9xnphinQAAsJn/ubC+0Q4KZF6craCS5+YNezf7l3zfcAjKOlymiO 63HQsvShw6XL3CEeBfcsQZhiNamSITVBUvMYYMFw8W66P3xHfDyjbsdFLnLxzjW/TJKU KnPNRl4CtJErRWf7v0jgLPVcxd+P3QhThWkVtrzY6A/+92y9RGNtDaCtHPqL8CJy38RT BG5nmncLEDOEqtbclhWfkd2nXLDctgRzClxIj61lIMyjTEiVUGpopwsNYdDDAlTQc+TD XK/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=IjXcW/SeV8N4p9bNZuOiZS26fNFOrPxc1vzkfOVaOY4=; b=E4I8TkuIN9bu3Qnj9W+rTgUU+ceD8Zx5G9T7T0vAxNI9eyhlepdwg5hSJX7W6ZT2VS SwDXk7PavCRohM7DZH1uBLWWDUXqrPDiDoaNcej+Deaiw72RsOmNgs6cHboi8xVEeQUv wQEGAbmHNcwc2quq6ohb5adW/F1YFzmMDTfZySt8fRVLCvWwYPLaBNQSAFQMAkUOeim3 m0NqpzrsNgExp9vWO9wvP3HZGsyQRnUwU40za3oDHWImwCSwZcatZlmCo7SduO6dIKej pJdRnY1OkZ0rL5UNPTfHc6nk2dhaXujWooQVt6we5gMfzqRc10Ou1+KYf+rUSPu4UbAg +GlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KWCszQAB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a17090636d400b00781cde43588si12325255ejc.58.2022.10.19.01.41.42; Wed, 19 Oct 2022 01:42: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=KWCszQAB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230477AbiJSIkw (ORCPT + 99 others); Wed, 19 Oct 2022 04:40:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230234AbiJSIju (ORCPT ); Wed, 19 Oct 2022 04:39: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 163587FF90; Wed, 19 Oct 2022 01:38: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 262CEB822CC; Wed, 19 Oct 2022 08:38:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 768BAC433D7; Wed, 19 Oct 2022 08:38:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168738; bh=YOAwwPrV6/YirX98LJtbHU/XaaLQu0LAr2I1+3I1W6k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KWCszQABZqJs8Crgn6fgfo6vDCK8ZAWhmmzewtBkH+NfzmVfqO2n57Up6TNdZsVB3 VHYHpaatJXIAKLcnzjGEBfIEIj+kUIzd09kfET4GpfEfNl8COA7U4ODYnzge7M/OFY x//7i24FFVJuwC9k5qozyddv7/lK32z9FDD8dbWs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aniruddha TVS Rao , Prathamesh Shete , Adrian Hunter , Thierry Reding , Ulf Hansson Subject: [PATCH 6.0 038/862] mmc: sdhci-tegra: Use actual clock rate for SW tuning correction Date: Wed, 19 Oct 2022 10:22:05 +0200 Message-Id: <20221019083251.682421300@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104749405895159?= X-GMAIL-MSGID: =?utf-8?q?1747104749405895159?= From: Prathamesh Shete commit b78870e7f41534cc719c295d1f8809aca93aeeab upstream. Ensure tegra_host member "curr_clk_rate" holds the actual clock rate instead of requested clock rate for proper use during tuning correction algorithm. Actual clk rate may not be the same as the requested clk frequency depending on the parent clock source set. Tuning correction algorithm depends on certain parameters which are sensitive to current clk rate. If the host clk is selected instead of the actual clock rate, tuning correction algorithm may end up applying invalid correction, which could result in errors Fixes: ea8fc5953e8b ("mmc: tegra: update hw tuning process") Signed-off-by: Aniruddha TVS Rao Signed-off-by: Prathamesh Shete Acked-by: Adrian Hunter Acked-by: Thierry Reding Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20221006130622.22900-4-pshete@nvidia.com Signed-off-by: Ulf Hansson Signed-off-by: Greg Kroah-Hartman --- drivers/mmc/host/sdhci-tegra.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/mmc/host/sdhci-tegra.c +++ b/drivers/mmc/host/sdhci-tegra.c @@ -773,7 +773,7 @@ static void tegra_sdhci_set_clock(struct dev_err(dev, "failed to set clk rate to %luHz: %d\n", host_clk, err); - tegra_host->curr_clk_rate = host_clk; + tegra_host->curr_clk_rate = clk_get_rate(pltfm_host->clk); if (tegra_host->ddr_signaling) host->max_clk = host_clk; else From patchwork Wed Oct 19 08:22: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: 4520 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp203312wrs; Wed, 19 Oct 2022 01:42:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6pdQtvL+77RkfQUwInt5lD9y2sVUs6PVcJ+KPVukxoBshmMuMmls0q6r/95q6RxdxVaOwm X-Received: by 2002:a17:906:dac8:b0:741:545b:796a with SMTP id xi8-20020a170906dac800b00741545b796amr5668680ejb.240.1666168969552; Wed, 19 Oct 2022 01:42:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666168969; cv=none; d=google.com; s=arc-20160816; b=ICfSUBM8HQVL7qAfTDAQd2NbSvRnOzT3rjUSWxr/DrevdjjVxBn/ztfcW6Pomn/A1c vu6XhOiaTdzVgWkQyYvN6Bt0OSl8EMSHE+Wd3KnDofS56rhaZ5WMTCYFMe7Tbx1i4xiJ fpUCMAlm3VdkbNE7cFD/M3ylEyyj3//CseaWL0lPBWghlRnPu96l+1f6B/pe9YbvU7X2 baegFAGw3BZBrBimQR5fH3vLjB0sr69kyxed5UTNHn8WhCAxPAl1PrgB800bu6FLhrpA G5aubp6dTpSOPaEj3nyF1AXG8yuwYkRKUM+3mb/e2RmO1MuxK82iVHEJL/h2HXv1vkEp b7KQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Vt+YFb+bPtwxgVtxWHawy6D4lSr3RVMKh8ErEiJMb1o=; b=aQxOtHSY1t+6SHHgaTkvbiDrbUOwuhBH5nMA0GGh7bP71YntkykctVzbr6uNbqQN47 saebGuNg4xFZ48+oG3cDEyl5VyPsnwlvLciw8U9Ebl1LA7p7FRtMO4RnmQODES82M8BJ OtaXYFrP7RlgetMQ3K0EvnDLUhzygU3KRbfZDeCme0r6vSbAM7ubjjksn2DW0ykbmlTt wFSKMhx50wBJC+CZT2fTt9zpWiAc2IkaNHtOFbafQRwUwggueWvQUDZkcgzMWmrsaVYS +APBs5jPrl0/KiqUoms9VjbpWQw+4AES3n64wZKXXToHk9B3Ozh0k4dAdcxYJAsFYriU 1QqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Pzx7qZ1F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dn15-20020a17090794cf00b007919a242731si5449811ejc.95.2022.10.19.01.42.23; Wed, 19 Oct 2022 01:42: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=Pzx7qZ1F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231135AbiJSIl7 (ORCPT + 99 others); Wed, 19 Oct 2022 04:41:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230401AbiJSIko (ORCPT ); Wed, 19 Oct 2022 04:40:44 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91BC3816AB; Wed, 19 Oct 2022 01:39:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 64D77CE20DB; Wed, 19 Oct 2022 08:39:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A32FBC433D6; Wed, 19 Oct 2022 08:39:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168741; bh=lVh1oP4UqEge0pFZJpJr/ff3E2QK73mfpro3qwWesks=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Pzx7qZ1FKnaVb+FZZL8BkCUVhEdy/JFzDLY5kk5ODpBdK1jQUjj8V5KaTQ48Ui1co REizR/ch8P9jU8acN/4+v5Ziftf5nQIikm7Ho1yRtcQRWytxooS/nTqCGM05yLQYwm pYH+LrT9v4MZ24DpG0psrU+IUh2w2HJJqCSLmGV0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wenchao Chen , Adrian Hunter , Ulf Hansson Subject: [PATCH 6.0 039/862] mmc: sdhci-sprd: Fix minimum clock limit Date: Wed, 19 Oct 2022 10:22:06 +0200 Message-Id: <20221019083251.728627024@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104793095489351?= X-GMAIL-MSGID: =?utf-8?q?1747104793095489351?= From: Wenchao Chen commit 6e141772e6465f937458b35ddcfd0a981b6f5280 upstream. The Spreadtrum controller supports 100KHz minimal clock rate, which means that the current value 400KHz is wrong. Unfortunately this has also lead to fail to initialize some cards, which are allowed to require 100KHz to work. So, let's fix the problem by changing the minimal supported clock rate to 100KHz. Signed-off-by: Wenchao Chen Acked-by: Adrian Hunter Fixes: fb8bd90f83c4 ("mmc: sdhci-sprd: Add Spreadtrum's initial host controller") Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20221011104935.10980-1-wenchao.chen666@gmail.com [Ulf: Clarified to commit-message] Signed-off-by: Ulf Hansson Signed-off-by: Greg Kroah-Hartman --- drivers/mmc/host/sdhci-sprd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/mmc/host/sdhci-sprd.c +++ b/drivers/mmc/host/sdhci-sprd.c @@ -309,7 +309,7 @@ static unsigned int sdhci_sprd_get_max_c static unsigned int sdhci_sprd_get_min_clock(struct sdhci_host *host) { - return 400000; + return 100000; } static void sdhci_sprd_set_uhs_signaling(struct sdhci_host *host, From patchwork Wed Oct 19 08:22: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: 4521 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp203341wrs; Wed, 19 Oct 2022 01:42:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Hw7j+z9Md/qbG9nBO95AA6x2o5Cjj0oef4oLm/KLK6fUQNCQ0neuIGChLhknzJr+ry42i X-Received: by 2002:a05:6402:170f:b0:458:9653:6466 with SMTP id y15-20020a056402170f00b0045896536466mr6376096edu.181.1666168972828; Wed, 19 Oct 2022 01:42:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666168972; cv=none; d=google.com; s=arc-20160816; b=fvZvGPiItqCiCNnXC01rmzTsGxieb1e+QLMzTfmEZcWpV3q/QK7pH6KnC5VRyNsP0F maNt6pBC1klPX8pMdVIYBujzNf1CG/13gWIZ2SAmAjWJ7CCAnFeTc8sS0QveX57FjsYu YtX8RuRsUaAYCIW76X5TeeKYnGR8gpeze+LchK19hrE6kiV5bRdGPcy1AtLxlJ/hfLkU 0zlQbyMDgq4XB5Nz9iVM9mp8tkaN+ZHxW9Vl8Zc3UpmycgGCUky2YwYMfW/zLdJoBiTl 2XuganqqQ2qAWtn9kwE0xtpWDUngAnUWVQdElFxmqW3SVQQloseNSCNOrTaLzRsWu68y CL1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=SC1dvavRum/rZ+XA63jr5Pq4lYHqhje7TzAd/C62WBM=; b=ySB1lf84eDYRqZSoGngeCq7P13DP0W41ivYGItSMypTx6OrNiJxogo9d1CpUmr7PRy Pac5CaX7W76H4p8I4+oroxEmzYzfA3QRkT5pxBBp0LSnEftLLQDz9Sg1LvmKY5NfoQsj noY2YgbRj6W6awDZATSH76+y3oFQfzZ7BohboD3QAMk2duxgKZvF8LQCg0J4hyhOACdX wh9oYqm8D+snoQ11B0WviC1JvnwDXQeH3sycujgCrCxx4CEn8hkTxb5WD9TMYhCvLKrR MAH1wMOYkqAT6l/O58ehzpdgxrX/pefMPWJXcplNZwiWlurfdzEmmE8ouV5cWdFIiM27 t8fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OQ6HLMCY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jg37-20020a170907972500b00791a37e665esi2702605ejc.10.2022.10.19.01.42.28; Wed, 19 Oct 2022 01:42: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=OQ6HLMCY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230420AbiJSImF (ORCPT + 99 others); Wed, 19 Oct 2022 04:42:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230399AbiJSIkq (ORCPT ); Wed, 19 Oct 2022 04:40:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05B3F80BE0; Wed, 19 Oct 2022 01:39: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 ams.source.kernel.org (Postfix) with ESMTPS id 8D4B8B822BE; Wed, 19 Oct 2022 08:39:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E64CAC433D7; Wed, 19 Oct 2022 08:39:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168744; bh=HHK5F+bVk5ccs/l91De+g7lQ4jXHY0mt5/MgFWT9rdQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OQ6HLMCYEygX4CdoxKB2F1G4qJHJu/aQ8uK6jqMO1pFBxU7V8PpSh9hO4ZAKrU6es Afv4n1aa8+N/gFbK0W5f2LJAdy/d0ogvzFgy11XQAbacMENfEXFLV9fC+K8A0Pcd2z mDbXVtjmkTU1gzJNWlc6xfyDJqB3BNHxbzP95ExY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Samuel Clark , Jarkko Nikula , Andy Shevchenko , Wolfram Sang Subject: [PATCH 6.0 040/862] i2c: designware: Fix handling of real but unexpected device interrupts Date: Wed, 19 Oct 2022 10:22:07 +0200 Message-Id: <20221019083251.767513800@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104797300676004?= X-GMAIL-MSGID: =?utf-8?q?1747104797300676004?= From: Jarkko Nikula commit 301c8f5c32c8fb79c67539bc23972dc3ef48024c upstream. Commit c7b79a752871 ("mfd: intel-lpss: Add Intel Alder Lake PCH-S PCI IDs") caused a regression on certain Gigabyte motherboards for Intel Alder Lake-S where system crashes to NULL pointer dereference in i2c_dw_xfer_msg() when system resumes from S3 sleep state ("deep"). I was able to debug the issue on Gigabyte Z690 AORUS ELITE and made following notes: - Issue happens when resuming from S3 but not when resuming from "s2idle" - PCI device 00:15.0 == i2c_designware.0 is already in D0 state when system enters into pci_pm_resume_noirq() while all other i2c_designware PCI devices are in D3. Devices were runtime suspended and in D3 prior entering into suspend - Interrupt comes after pci_pm_resume_noirq() when device interrupts are re-enabled - According to register dump the interrupt really comes from the i2c_designware.0. Controller is enabled, I2C target address register points to a one detectable I2C device address 0x60 and the DW_IC_RAW_INTR_STAT register START_DET, STOP_DET, ACTIVITY and TX_EMPTY bits are set indicating completed I2C transaction. My guess is that the firmware uses this controller to communicate with an on-board I2C device during resume but does not disable the controller before giving control to an operating system. I was told the UEFI update fixes this but never the less it revealed the driver is not ready to handle TX_EMPTY (or RX_FULL) interrupt when device is supposed to be idle and state variables are not set (especially the dev->msgs pointer which may point to NULL or stale old data). Introduce a new software status flag STATUS_ACTIVE indicating when the controller is active in driver point of view. Now treat all interrupts that occur when is not set as unexpected and mask all interrupts from the controller. Fixes: c7b79a752871 ("mfd: intel-lpss: Add Intel Alder Lake PCH-S PCI IDs") Reported-by: Samuel Clark Link: https://bugzilla.kernel.org/show_bug.cgi?id=215907 Cc: stable@vger.kernel.org # v5.12+ Signed-off-by: Jarkko Nikula Reviewed-by: Andy Shevchenko Signed-off-by: Wolfram Sang Signed-off-by: Greg Kroah-Hartman --- drivers/i2c/busses/i2c-designware-core.h | 7 +++++-- drivers/i2c/busses/i2c-designware-master.c | 13 +++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) --- a/drivers/i2c/busses/i2c-designware-core.h +++ b/drivers/i2c/busses/i2c-designware-core.h @@ -126,8 +126,9 @@ * status codes */ #define STATUS_IDLE 0x0 -#define STATUS_WRITE_IN_PROGRESS 0x1 -#define STATUS_READ_IN_PROGRESS 0x2 +#define STATUS_ACTIVE 0x1 +#define STATUS_WRITE_IN_PROGRESS 0x2 +#define STATUS_READ_IN_PROGRESS 0x4 /* * operation modes @@ -334,12 +335,14 @@ void i2c_dw_disable_int(struct dw_i2c_de static inline void __i2c_dw_enable(struct dw_i2c_dev *dev) { + dev->status |= STATUS_ACTIVE; regmap_write(dev->map, DW_IC_ENABLE, 1); } static inline void __i2c_dw_disable_nowait(struct dw_i2c_dev *dev) { regmap_write(dev->map, DW_IC_ENABLE, 0); + dev->status &= ~STATUS_ACTIVE; } void __i2c_dw_disable(struct dw_i2c_dev *dev); --- a/drivers/i2c/busses/i2c-designware-master.c +++ b/drivers/i2c/busses/i2c-designware-master.c @@ -716,6 +716,19 @@ static int i2c_dw_irq_handler_master(str u32 stat; stat = i2c_dw_read_clear_intrbits(dev); + + if (!(dev->status & STATUS_ACTIVE)) { + /* + * Unexpected interrupt in driver point of view. State + * variables are either unset or stale so acknowledge and + * disable interrupts for suppressing further interrupts if + * interrupt really came from this HW (E.g. firmware has left + * the HW active). + */ + regmap_write(dev->map, DW_IC_INTR_MASK, 0); + return 0; + } + if (stat & DW_IC_INTR_TX_ABRT) { dev->cmd_err |= DW_IC_ERR_TX_ABRT; dev->status = STATUS_IDLE; From patchwork Wed Oct 19 08:22: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: 4522 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp203369wrs; Wed, 19 Oct 2022 01:42:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM479J4Bdn+nUeXhRsDOYLAbpyFI7djJy+7ZYgXKV5oVWgDokX2RgsJmfPrpQle6MfYcv4kc X-Received: by 2002:a17:907:2672:b0:781:dc01:6c5a with SMTP id ci18-20020a170907267200b00781dc016c5amr6008216ejc.191.1666168978002; Wed, 19 Oct 2022 01:42:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666168977; cv=none; d=google.com; s=arc-20160816; b=LbkcQZFUE89E7CcpjlMhouUsrUmRIVB2QB/nyn9OSbKRAwBs2Pachl7VbgebqqVkgh WFyawA2X1JIHLTljBpmtn32GnDrES0KACKWVnIknAEcbSD+zfGSO5b4tmz4DjtaQJyeK 3nwpHjreF0zbatkxQfaRTrUgOEyrvbexCGAYZswOvRZofw6GsALH45VRiut84szEWbFU EsHlccV9b9DvdWqdU9gl4jVmRcXRoNhQ/HKXqVI5BJbYnglZ7pF8GQLFN8gijVbPxugN /z1DjKgSLwvFMiFb85wkpgC01ESXPXAnIPCNBZZL8KK9Dgc2V+7/+QMtvnZaVtweAsJY 8TAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=j8Xomj0fQuqTrEPYs85LyPIT2S8pL5SEO58O73gA53g=; b=beQ5xwVOQa1mgGiZ0l1JCvcMt6y0k2gEADuQr2W0T+drxnTHIuUi+wtE8X8SRfq2qE E3kIyor3g60oeQTApyoE0IImoctcAyNFqX4FgaXdJj+X5lLJRvygmoc/Y2U7CZhw00iw WLR1l2kgdMQKd6A3OR9ZWU6oqaeNSO/zQtbjS/ZAXhKbmbe9H/di7hOWa+q/czBV73Dw Q3UHe1ED4cCSh/5plW9wuV3/z1oT8DDnApoR+aTdepbmAYZm8gyccCR2NvrqWMP/RSTv igCzfJBHLSAGcgixFJjETic4KEGMA1FwoyZqRN+SPWTyjSEBOsjYj52ef71ZalgMmBvA eLXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wrffrh7X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a1709072d2900b0078e030224fdsi16238162ejc.768.2022.10.19.01.42.32; Wed, 19 Oct 2022 01:42: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=wrffrh7X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231153AbiJSImI (ORCPT + 99 others); Wed, 19 Oct 2022 04:42:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230408AbiJSIku (ORCPT ); Wed, 19 Oct 2022 04:40:50 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1939680F7D; Wed, 19 Oct 2022 01:39: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 86E12B822D1; Wed, 19 Oct 2022 08:39:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE511C433D7; Wed, 19 Oct 2022 08:39:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168747; bh=jBoTbudxBixvFylnCwkGubpi1p23EEKMHTLT51gJ8yc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wrffrh7X06cksoPcc86hWA3se0axooEjBP8G1e6B0cXxnbQBoMrKbKURE2UTyWdMJ AH1vIvL5p5hU16p32zzCTkcDPCyved0+6RyXAUVF5jjDzdwyjZR1HeFTUYLBM7tXTh XZ8LCWr3+gqgRtYXO8YsTOD3Ve6KjY+U048cT24w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Aring , David Teigland Subject: [PATCH 6.0 041/862] fs: dlm: fix race between test_bit() and queue_work() Date: Wed, 19 Oct 2022 10:22:08 +0200 Message-Id: <20221019083251.817711321@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104802542021842?= X-GMAIL-MSGID: =?utf-8?q?1747104802542021842?= 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 @@ -200,13 +200,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); @@ -288,7 +288,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 Wed Oct 19 08:22: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: 4518 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp203253wrs; Wed, 19 Oct 2022 01:42:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM69WllS2cXWdqpURgNCd8ywIrAwt1nSIYuiKMALkQhjQYaMM7aXld28UKnDvAb0vxo2QZdt X-Received: by 2002:a17:907:7606:b0:78e:61d:757e with SMTP id jx6-20020a170907760600b0078e061d757emr5464540ejc.690.1666168959559; Wed, 19 Oct 2022 01:42:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666168959; cv=none; d=google.com; s=arc-20160816; b=RQ8NT+aqra06pkoI5DxseG4MXYvHBtb4ihJoxWeRbHXDkOXVoVqLg/o68AIvsRRJrX npl2QyuzFNm4VXklIBS5waIzwHbKpJT8kOAmOw2hvmcOOh+RiqDPv3oPrW+q0EGmqPqa 9LyTJHbSSBYMaJKjIu50BIyrPaXJ0nN5/lXT92ZGAhiPAvkGKGT1dUd4ODMFc9iXgcKr 1GdXB3cW8J8QQPfHAXnfyUOQUlpgSrALFe4dcTNhgNeIJS1pLj8FXWNv5t8iqRzhNgte EYPnQuRM37tg1vmGYnvE+7EGnMs1YfDK5PuAD32x3QJSY95TI5WqXmLxt+lji8zNWX8R f7HQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rkf5vDjaDmMsbeKKzd8lQpYwPy8z86ajz3rfzikKGpo=; b=ujNkHpWFv9v3pClcltbkXuPE8vR4ljX5l/O+pX0uK3Db6vgTXE/Z/HsuIF9DSJ7h1B ymTOhey4mX94cFITfBl0LuQle7NBXgDGJwFXl5nr6No2Tm9k1DViwY4jn6a7dksr5qa2 fC60hxud7XEWhQ1weQNAcqNB5kaGl71fAoNsmVyThEzdAgeV6ECFObr6JWUTAEwKY2D3 xi0GCFwo0E7TKVB3gjCSoDeLUIQwtoh+5EsqhazvI/aeSs5/FujEpab8s2WJ28lYtYkT lZSKgyuulvNzgZEnU5vR4DG/40/unvlBo7TZ+EFBo5YIVpejgIG7IM3w7lf+M+J8C7CE BBcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FpMVnUa5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q20-20020a1709060e5400b007835e4733cbsi10655299eji.201.2022.10.19.01.42.13; Wed, 19 Oct 2022 01:42: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=FpMVnUa5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230361AbiJSIlr (ORCPT + 99 others); Wed, 19 Oct 2022 04:41:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230346AbiJSIkc (ORCPT ); Wed, 19 Oct 2022 04:40:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F19C814D7; Wed, 19 Oct 2022 01:39: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 CA5D5617DF; Wed, 19 Oct 2022 08:39:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD127C433C1; Wed, 19 Oct 2022 08:39:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168750; bh=hO1PLpSoAE8YIp/WBagL/lFkvdLXZQq7FOg+I9oQ/K0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FpMVnUa58hcP6KVkEEdbYHG9wpLb5h8I094Jx+Db3nnWIagZK+zx1F70j1L9tr+Iv F0+TkF0kBkPOvS2m0izX73ffh2WDb4OTngaZpYPZ2RWAyoNicP2j1RclkPyUsZqDt8 RNd3GN93Hf5lYDDCvjFT12VIP6ki39x3aYrMUxcE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Aring , David Teigland Subject: [PATCH 6.0 042/862] fs: dlm: handle -EBUSY first in lock arg validation Date: Wed, 19 Oct 2022 10:22:09 +0200 Message-Id: <20221019083251.859555995@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104783244353863?= X-GMAIL-MSGID: =?utf-8?q?1747104783244353863?= 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 | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) --- a/fs/dlm/lock.c +++ b/fs/dlm/lock.c @@ -2864,17 +2864,9 @@ 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) - goto out; - - if (args->flags & DLM_LKF_QUECVT && - !__quecvt_compat_matrix[lkb->lkb_grmode+1][args->mode+1]) - goto out; - - rv = -EBUSY; if (lkb->lkb_status != DLM_LKSTS_GRANTED) goto out; @@ -2884,6 +2876,14 @@ static int validate_lock_args(struct dlm if (is_overlap(lkb)) goto out; + + rv = -EINVAL; + if (lkb->lkb_flags & DLM_IFL_MSTCPY) + goto out; + + if (args->flags & DLM_LKF_QUECVT && + !__quecvt_compat_matrix[lkb->lkb_grmode+1][args->mode+1]) + goto out; } lkb->lkb_exflags = args->flags; From patchwork Wed Oct 19 08:22: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: 4523 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp203396wrs; Wed, 19 Oct 2022 01:43:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4JPx3FNM5SIVBuDzmpYVqsYmhQ3fqqJ+4RlrmkM7hbjw8KDfZlaV7i0crR18WGKah9rM+G X-Received: by 2002:a17:906:58c7:b0:722:f4bf:cb75 with SMTP id e7-20020a17090658c700b00722f4bfcb75mr5777891ejs.450.1666168982543; Wed, 19 Oct 2022 01:43:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666168982; cv=none; d=google.com; s=arc-20160816; b=CQaRh7FBCSNdoyUUFGGZ8UZPpIXoziNltocvViriFzDnqTHE3d9zauV6mmSJV5dRf5 P44YQ5hz+96HaGAViE5SColRq+SzPGJs+rsV9kbE82JFdtw1QyjUT8wTn/3LEzcN9n55 R5OXDLbKyuRPx1HCEz00gP2IXDjXtrtbMsVxLqxSm/IF+DiBRinc2erYX7AQ0deNHGIT KOiMAxNfnB3asAClPkbyJpx4EIC+seKiiCRDmwnfKKwW8NwN5jpSY3izjPvcOIpeyw1a gjElvVLtf3vJfg0dy3GucGyQi7EbyerRPVq3XpWYHv4iJWvBffHa/e/8OSOJ2uNf6vq6 Mnzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=i4Omw1mogkpsM5I+i9XvruRx4ocHKP+7VIPWWbhFxBM=; b=pwxPIp0wusXUfQPPIXNmxv9HZAr2RIwL4Rrk8Rc3cF0dphm8sFdsUPOVNO/gjC5gbc J8CegbPIMd75KaHSkLZYafWs09guo+g/AXlibAQ8HQWqFmU23eQWQKdWKybt1dhYqZfd FcfEQSi2WihOIScRxWZP7Ym3m356cIJbRvmir5kBYKfk6mNh6SdsP8aiXubrHDsZLhA5 XfFslwYbCZKjTt7GMZA7XHs483RETj+mcg7C2SowbKpCwcuu9wwSnmrBtAmUA2m2jjXD p7qAOvHaNDAmWjQ6k9rNEL0hIn2ZQU2Ce2E/977N2Q2ctbmdThxTIEfltqWTgjkhOy4k g65A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qAZjieho; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u26-20020aa7d99a000000b0045be16903d0si12469012eds.310.2022.10.19.01.42.37; Wed, 19 Oct 2022 01:43: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=qAZjieho; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231169AbiJSImM (ORCPT + 99 others); Wed, 19 Oct 2022 04:42:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230417AbiJSIkw (ORCPT ); Wed, 19 Oct 2022 04:40: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 4372C7E31C; Wed, 19 Oct 2022 01:39:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3F125B822DA; Wed, 19 Oct 2022 08:39:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0297C4314E; Wed, 19 Oct 2022 08:39:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168753; bh=4YV9U22rMuVZHOD9Ed04txET9EO0qOS400nx64n0NYI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qAZjiehoG78j4p5Z0inWfLCxUAo4Dss70QcLrpA1trCgjgWWKaFLCk1aZneSgIOpK p8qs7VFnTYSxVGKSbp3lhVfFPcVbDXJpIn/N/i+lTNq3XoTXX5S1tGLX39RIxIWoQx r0DQ2PgxdcUHqSeJzxATTM+bd/S+gCoJeTDePrSI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Aring , David Teigland Subject: [PATCH 6.0 043/862] fs: dlm: fix invalid derefence of sb_lvbptr Date: Wed, 19 Oct 2022 10:22:10 +0200 Message-Id: <20221019083251.896817897@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104807209829391?= X-GMAIL-MSGID: =?utf-8?q?1747104807209829391?= From: Alexander Aring commit 7175e131ebba47afef47e6ac4d5bab474d1e6e49 upstream. I experience issues when putting a lkbsb on the stack and have sb_lvbptr field to a dangled pointer while not using DLM_LKF_VALBLK. It will crash with the following kernel message, the dangled pointer is here 0xdeadbeef as example: [ 102.749317] BUG: unable to handle page fault for address: 00000000deadbeef [ 102.749320] #PF: supervisor read access in kernel mode [ 102.749323] #PF: error_code(0x0000) - not-present page [ 102.749325] PGD 0 P4D 0 [ 102.749332] Oops: 0000 [#1] PREEMPT SMP PTI [ 102.749336] CPU: 0 PID: 1567 Comm: lock_torture_wr Tainted: G W 5.19.0-rc3+ #1565 [ 102.749343] Hardware name: Red Hat KVM/RHEL-AV, BIOS 1.16.0-2.module+el8.7.0+15506+033991b0 04/01/2014 [ 102.749344] RIP: 0010:memcpy_erms+0x6/0x10 [ 102.749353] Code: cc cc cc cc eb 1e 0f 1f 00 48 89 f8 48 89 d1 48 c1 e9 03 83 e2 07 f3 48 a5 89 d1 f3 a4 c3 66 0f 1f 44 00 00 48 89 f8 48 89 d1 a4 c3 0f 1f 80 00 00 00 00 48 89 f8 48 83 fa 20 72 7e 40 38 fe [ 102.749355] RSP: 0018:ffff97a58145fd08 EFLAGS: 00010202 [ 102.749358] RAX: ffff901778b77070 RBX: 0000000000000000 RCX: 0000000000000040 [ 102.749360] RDX: 0000000000000040 RSI: 00000000deadbeef RDI: ffff901778b77070 [ 102.749362] RBP: ffff97a58145fd10 R08: ffff901760b67a70 R09: 0000000000000001 [ 102.749364] R10: ffff9017008e2cb8 R11: 0000000000000001 R12: ffff901760b67a70 [ 102.749366] R13: ffff901760b78f00 R14: 0000000000000003 R15: 0000000000000001 [ 102.749368] FS: 0000000000000000(0000) GS:ffff901876e00000(0000) knlGS:0000000000000000 [ 102.749372] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 102.749374] CR2: 00000000deadbeef CR3: 000000017c49a004 CR4: 0000000000770ef0 [ 102.749376] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 102.749378] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 102.749379] PKRU: 55555554 [ 102.749381] Call Trace: [ 102.749382] [ 102.749383] ? send_args+0xb2/0xd0 [ 102.749389] send_common+0xb7/0xd0 [ 102.749395] _unlock_lock+0x2c/0x90 [ 102.749400] unlock_lock.isra.56+0x62/0xa0 [ 102.749405] dlm_unlock+0x21e/0x330 [ 102.749411] ? lock_torture_stats+0x80/0x80 [dlm_locktorture] [ 102.749416] torture_unlock+0x5a/0x90 [dlm_locktorture] [ 102.749419] ? preempt_count_sub+0xba/0x100 [ 102.749427] lock_torture_writer+0xbd/0x150 [dlm_locktorture] [ 102.786186] kthread+0x10a/0x130 [ 102.786581] ? kthread_complete_and_exit+0x20/0x20 [ 102.787156] ret_from_fork+0x22/0x30 [ 102.787588] [ 102.787855] Modules linked in: dlm_locktorture torture rpcsec_gss_krb5 intel_rapl_msr intel_rapl_common kvm_intel iTCO_wdt iTCO_vendor_support kvm vmw_vsock_virtio_transport qxl irqbypass vmw_vsock_virtio_transport_common drm_ttm_helper crc32_pclmul joydev crc32c_intel ttm vsock virtio_scsi virtio_balloon snd_pcm drm_kms_helper virtio_console snd_timer snd drm soundcore syscopyarea i2c_i801 sysfillrect sysimgblt i2c_smbus pcspkr fb_sys_fops lpc_ich serio_raw [ 102.792536] CR2: 00000000deadbeef [ 102.792930] ---[ end trace 0000000000000000 ]--- This patch fixes the issue by checking also on DLM_LKF_VALBLK on exflags is set when copying the lvbptr array instead of if it's just null which fixes for me the issue. I think this patch can fix other dlm users as well, depending how they handle the init, freeing memory handling of sb_lvbptr and don't set DLM_LKF_VALBLK for some dlm_lock() calls. It might a there could be a hidden issue all the time. However with checking on DLM_LKF_VALBLK the user always need to provide a sb_lvbptr non-null value. There might be more intelligent handling between per ls lvblen, DLM_LKF_VALBLK and non-null to report the user the way how DLM API is used is wrong but can be added for later, this will only fix the current behaviour. 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/dlm/lock.c +++ b/fs/dlm/lock.c @@ -3623,7 +3623,7 @@ static void send_args(struct dlm_rsb *r, case cpu_to_le32(DLM_MSG_REQUEST_REPLY): case cpu_to_le32(DLM_MSG_CONVERT_REPLY): case cpu_to_le32(DLM_MSG_GRANT): - if (!lkb->lkb_lvbptr) + if (!lkb->lkb_lvbptr || !(lkb->lkb_exflags & DLM_LKF_VALBLK)) break; memcpy(ms->m_extra, lkb->lkb_lvbptr, r->res_ls->ls_lvblen); break; From patchwork Wed Oct 19 08:22: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: 4525 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp203555wrs; Wed, 19 Oct 2022 01:43:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4nFXGg8DZgmKOSi8PHXLxpX2mH0kXvmMMtbsSFtiGuv87sekXt1ug+dX46Z9Wz8AJN2BAg X-Received: by 2002:a17:907:168c:b0:78d:8b6c:a209 with SMTP id hc12-20020a170907168c00b0078d8b6ca209mr6128875ejc.185.1666169003824; Wed, 19 Oct 2022 01:43:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169003; cv=none; d=google.com; s=arc-20160816; b=r6MMHOXb4kZDOtoL58wWBcDE4VmIvQ89XkKIoKHPaQlXSD146W5vUoMq+ywWD17O/B wjsIm8clSWMwaSX7ll7OEwXHYqngTzR+jfQLKQVwFQhMiqZoi4kbr1gWC1ZYEgWSwBjC Cfs1q1sjTDco+JfJ+ZTDhv9nIj/xOaRsTU6VSHVlw0CY1eVO+5aj14OYm0A8oCkcBp3o mpj7Hm6R93fkZ7kjXgWvOxDw6jqW+ghJHRO/j/Ibfse6XrgSWLtPANxgzF0ARKVNCjF6 MPqSRozw0ZiZ8/SLAj7gaHSPF5LjrNb6G/2rHsWchkWyYLFENFKabb7OWT/JPFXmcKHf lPYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=642PGjFqDZ0CGtOhYVSVDmanyvQBYmUfzM1qcwgz9LE=; b=CDbJKA7BdT2GsJEBgv8vhy1iaofDrACEpviY/EtIrHUkaMt1i7Zv1RzgYMLomgYvoE t2YxzYzzS+765wlRlIfdnRIDi9qK7kXKxEEDuZCvB/p1JS06L15u/Pg+mZ6zX2b+sLBn JIgkSPRdJi7o5CljY8ZpFa3mYUg8c+HzISNAobhM/gNcbXm5dnA1xJ75AtTEIGEr8aW0 w9G3zNfxFnOE7mSYXSUnaQXIncwaUh9xLNX5sF2nFHLQEAXJP2sstLT4cY8YPbr0mKgW 7umwhg08i1ot+W/RpMxwDxA0RsGOzzG5KFUkAFPgsB3cd4GNt/X/UiElIqVHyD4ZO8Vj PZ5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xp8LemG4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a05640250c900b00458bc949b45si16217451edb.488.2022.10.19.01.42.59; Wed, 19 Oct 2022 01:43:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xp8LemG4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231187AbiJSImW (ORCPT + 99 others); Wed, 19 Oct 2022 04:42:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230294AbiJSIl3 (ORCPT ); Wed, 19 Oct 2022 04:41:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C758A7EFFB; Wed, 19 Oct 2022 01:39:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BF652617E8; Wed, 19 Oct 2022 08:39:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95E69C433D7; Wed, 19 Oct 2022 08:39:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168756; bh=CJh7BEGtcX3x0wey5F8aR0SgwStg4GuMXPmHzzulGjc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xp8LemG4PfsYLsu6Nl8h/LFAFYI0FSYHGf1gVquXAaZqlPLVnj/kuxunZ5SHiZ6xm AHyanN3gfFXtHLVJqE4w7jrPYEoOlx1z8x696lce1g0co0USNT92VTYKFTEM65H/do aDl07haLg4G8KvH3N7z5CBemyp8tfcfcmO07Bui0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joanne Koong , Roberto Sassu , Yonghong Song , KP Singh , Alexei Starovoitov Subject: [PATCH 6.0 044/862] btf: Export bpf_dynptr definition Date: Wed, 19 Oct 2022 10:22:11 +0200 Message-Id: <20221019083251.945344355@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104829471639334?= X-GMAIL-MSGID: =?utf-8?q?1747104829471639334?= From: Roberto Sassu commit 00f146413ccb6c84308e559281449755c83f54c5 upstream. eBPF dynamic pointers is a new feature recently added to upstream. It binds together a pointer to a memory area and its size. The internal kernel structure bpf_dynptr_kern is not accessible by eBPF programs in user space. They instead see bpf_dynptr, which is then translated to the internal kernel structure by the eBPF verifier. The problem is that it is not possible to include at the same time the uapi include linux/bpf.h and the vmlinux BTF vmlinux.h, as they both contain the definition of some structures/enums. The compiler complains saying that the structures/enums are redefined. As bpf_dynptr is defined in the uapi include linux/bpf.h, this makes it impossible to include vmlinux.h. However, in some cases, e.g. when using kfuncs, vmlinux.h has to be included. The only option until now was to include vmlinux.h and add the definition of bpf_dynptr directly in the eBPF program source code from linux/bpf.h. Solve the problem by using the same approach as for bpf_timer (which also follows the same scheme with the _kern suffix for the internal kernel structure). Add the following line in one of the dynamic pointer helpers, bpf_dynptr_from_mem(): BTF_TYPE_EMIT(struct bpf_dynptr); Cc: stable@vger.kernel.org Cc: Joanne Koong Fixes: 97e03f521050c ("bpf: Add verifier support for dynptrs") Signed-off-by: Roberto Sassu Acked-by: Yonghong Song Tested-by: KP Singh Link: https://lore.kernel.org/r/20220920075951.929132-3-roberto.sassu@huaweicloud.com Signed-off-by: Alexei Starovoitov Signed-off-by: Greg Kroah-Hartman --- kernel/bpf/helpers.c | 2 ++ 1 file changed, 2 insertions(+) --- a/kernel/bpf/helpers.c +++ b/kernel/bpf/helpers.c @@ -1468,6 +1468,8 @@ BPF_CALL_4(bpf_dynptr_from_mem, void *, { int err; + BTF_TYPE_EMIT(struct bpf_dynptr); + err = bpf_dynptr_check_size(size); if (err) goto error; From patchwork Wed Oct 19 08:22: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: 4524 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp203454wrs; Wed, 19 Oct 2022 01:43:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4qhwaScMxYKhL0CNyHYc49D2n3cx6NWJ8sOEmD2uS7E3o7mh+pZAfvkUDY23Pisg4ZnUA5 X-Received: by 2002:a17:907:980e:b0:78d:b6d5:661e with SMTP id ji14-20020a170907980e00b0078db6d5661emr5848361ejc.46.1666168990606; Wed, 19 Oct 2022 01:43:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666168990; cv=none; d=google.com; s=arc-20160816; b=L4FD4MvXwxsoB4KtxjXxOttTJGWKqERXIeC7yYinDb7Ecdzj+UwxYf2EyBAW01rHwG vAD0+sAB62MMjLHlMDKWQGebKvB7+3eqRCyQiXYWGySEP03sxJ14KOireX+SjCQJJVwj SS/AOJUKbP3k84jhv2SYLnXQl1XO62Ub1/lIS8EhqOTwNSYbqy/rtj4iPfAAygVlMBOm hvwDqMeoD3NHlfs1jxnro0V9ZYqtELEsoEqYHOmlHxD+Zg0L/Uaq28zuvDhm2SWe5FAc j0p/eQfWIKJwTspYopDPmaIhqAeRBYaQzCiIKkbDTKEmoXMkw11k1aQVgpdanGOV/obj JSLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=SMkmCypDh3ROFboofcf5oLehDuaFhnUcUPvnh9Y4TRk=; b=pJDYsnCHcFuyPy4UVBkIo9kMAovimzy3UK6X178D3U4db2JwIpE0OpLZ8A2ItERnRu tRgU34QeYLK+4zf59B41TIB8n3ISgUtOf27KO6yk/fMb/q+5IsssjlQbETIi8y8tJ6dc 8kWjOXO55XmvAm67LkhdcBZjtp+VNGVqgnbwwxQdo3GC7iTcICdO/YPGsvj5RCuEm0Ey orj6TCebJAKiM+j3b6lllDlRwJTh4EAg2KzVsw7Sr/AH7d+c0zHw+qRqhkL03WeAOdaa uAhOHa16CIZDjCfjlgTOm+xdHfAU9INDND6hGN+kkpCj5MA2rhN+xd2/TlCbNBmXk1J9 SyWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IsMCmNa9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j14-20020a05640211ce00b0045d079c8f20si16078758edw.43.2022.10.19.01.42.45; Wed, 19 Oct 2022 01:43: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=IsMCmNa9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231173AbiJSImT (ORCPT + 99 others); Wed, 19 Oct 2022 04:42:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230495AbiJSIl2 (ORCPT ); Wed, 19 Oct 2022 04:41:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E94E28D; Wed, 19 Oct 2022 01:39: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 0EEA6617D1; Wed, 19 Oct 2022 08:39:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C053CC433D7; Wed, 19 Oct 2022 08:39:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168759; bh=GgGuYB/cFi90xrtwqmYT0ptnVlghrdpQ68XgLT2iUHw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IsMCmNa9fP15fyRMooNA3BnuO/cKaPWGH9f9UfV0QS1lpUqlP8XklDlqcrAqZQ5n4 uqZAdHgpXzvnqI+KmhHjY+8ANF5XRDyOShhBs4KU58hQUSiY/33s7GWplNmlxPBmle TwOkQVB129+JMpgDD7k7/KnAmu5OO4ZG/ISrXolU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Mike Galbraith , Jan Kara , Theodore Tso Subject: [PATCH 6.0 045/862] mbcache: Avoid nesting of cache->c_list_lock under bit locks Date: Wed, 19 Oct 2022 10:22:12 +0200 Message-Id: <20221019083251.985522115@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104815266162381?= X-GMAIL-MSGID: =?utf-8?q?1747104815266162381?= From: Jan Kara commit 5fc4cbd9fde5d4630494fd6ffc884148fb618087 upstream. Commit 307af6c87937 ("mbcache: automatically delete entries from cache on freeing") started nesting cache->c_list_lock under the bit locks protecting hash buckets of the mbcache hash table in mb_cache_entry_create(). This causes problems for real-time kernels because there spinlocks are sleeping locks while bitlocks stay atomic. Luckily the nesting is easy to avoid by holding entry reference until the entry is added to the LRU list. This makes sure we cannot race with entry deletion. Cc: stable@kernel.org Fixes: 307af6c87937 ("mbcache: automatically delete entries from cache on freeing") Reported-by: Mike Galbraith Signed-off-by: Jan Kara Link: https://lore.kernel.org/r/20220908091032.10513-1-jack@suse.cz Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/mbcache.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/fs/mbcache.c b/fs/mbcache.c index 47ccfcbe0a22..e272ad738faf 100644 --- a/fs/mbcache.c +++ b/fs/mbcache.c @@ -90,8 +90,14 @@ int mb_cache_entry_create(struct mb_cache *cache, gfp_t mask, u32 key, return -ENOMEM; INIT_LIST_HEAD(&entry->e_list); - /* Initial hash reference */ - atomic_set(&entry->e_refcnt, 1); + /* + * We create entry with two references. One reference is kept by the + * hash table, the other reference is used to protect us from + * mb_cache_entry_delete_or_get() until the entry is fully setup. This + * avoids nesting of cache->c_list_lock into hash table bit locks which + * is problematic for RT. + */ + atomic_set(&entry->e_refcnt, 2); entry->e_key = key; entry->e_value = value; entry->e_reusable = reusable; @@ -106,15 +112,12 @@ int mb_cache_entry_create(struct mb_cache *cache, gfp_t mask, u32 key, } } hlist_bl_add_head(&entry->e_hash_list, head); - /* - * Add entry to LRU list before it can be found by - * mb_cache_entry_delete() to avoid races - */ + hlist_bl_unlock(head); spin_lock(&cache->c_list_lock); list_add_tail(&entry->e_list, &cache->c_list); cache->c_entry_count++; spin_unlock(&cache->c_list_lock); - hlist_bl_unlock(head); + mb_cache_entry_put(cache, entry); return 0; } From patchwork Wed Oct 19 08:22: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: 4531 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp203658wrs; Wed, 19 Oct 2022 01:43:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM48QxJHsg87hWYcQlMZ2UkinxGOIyQtM4mN6PuhltSlT1ZdIF6TUPYR1CQmuRDR3F2NUoMi X-Received: by 2002:a17:903:284:b0:185:5537:f356 with SMTP id j4-20020a170903028400b001855537f356mr7461627plr.32.1666169023538; Wed, 19 Oct 2022 01:43:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169023; cv=none; d=google.com; s=arc-20160816; b=ERnXRj6TDLrdILxLayqRdxXkzppfFwmrpf64siXncZ9lEvYlXFEs/7A2M5AYux0GhK hXqdHHJVTdR94Na2rWt1Tb85NV/BkDoQT/cHgXO3xdHVomFlP4X6TlItKZvzAkt00Lqu ig0qWWHvA3IEPdYRp/hzzg1RxwWcpiqEENsfIoI1+vtPkJCbBsPm0/5c0093/AXoQXDI 5n4fFxTSjv6CLiUMraWW7mdbzlcsk2rfq9hqMVhmUDqx21a9/HU7ba+imFl4Lj1M6Ixs RKG1zMhItdRWqtz9Hx6A58R9ah9Vr56EF7Zeu4Cb+siPZTcX6Flkd7PQQk/vozqCJ7Cq 9hhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=iFeCblNChNlaSTZdY8WhlkVGglMokRRAR29ZlMmMZ70=; b=GwnrrmQwbUZrZCl3GX2+zM/FLBeGC871BVzA7moRg5tMVR/KwAdm+eznrPJZCt8Op6 J+E01ogrvcxmA3M3u8vXibYAVOnOVazVqpJb53ijTnayCJeLfPRePfEmdFXWFlS3Djui yoDr58p0TauRjVd4csrr8jO5q+ilTkA0jdwp+W5hLXT1zO7aGaboe0wZeu5ld/PEyHNX IioRiGnDgovrYmnNsgqXD/+Gt7sUKW4AE5EUd2jku4u6NugfEwKcW9Ce983UOi9pK9Bf l2rwcGXrc/Wy6CBhJ3trmHLaEIXAwF9uqTJViPHalwBp6cQf7dvAAhk5eLZ1Yzp+JBVJ mwnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=p9afWCva; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t24-20020a635358000000b0043634245eb1si17781412pgl.311.2022.10.19.01.43.29; Wed, 19 Oct 2022 01:43: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=p9afWCva; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231204AbiJSIma (ORCPT + 99 others); Wed, 19 Oct 2022 04:42:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230323AbiJSIlm (ORCPT ); Wed, 19 Oct 2022 04:41:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9231EC55; Wed, 19 Oct 2022 01:39: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 32C9F617F1; Wed, 19 Oct 2022 08:39:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28913C433D7; Wed, 19 Oct 2022 08:39:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168762; bh=HenN0VoiMNEdJ5jaJIOFFLb3urg5OvjE0Y0BVaFny5Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p9afWCva76FYfaTm4VKcIoT8SOuyeXvy+YIBD4wanpdQyJLxYkSuSUL5udhfjbCc0 EJqFx92izN3PriqkDJ/wIS49fu1nW7wTvFsr0j1emboWYGwdmH+Tnag9ri5DTBQmqU dE1DVQH2CpxBxBOc8lceYMHEsidXU3Hp3x+xXvbI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andri Yngvason , Benjamin Tissoires Subject: [PATCH 6.0 046/862] HID: multitouch: Add memory barriers Date: Wed, 19 Oct 2022 10:22:13 +0200 Message-Id: <20221019083252.034902935@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104850096759631?= X-GMAIL-MSGID: =?utf-8?q?1747104850096759631?= From: Andri Yngvason commit be6e2b5734a425941fcdcdbd2a9337be498ce2cf upstream. This fixes broken atomic checks which cause a race between the release-timer and processing of hid input. I noticed that contacts were sometimes sticking, even with the "sticky fingers" quirk enabled. This fixes that problem. Cc: stable@vger.kernel.org Fixes: 9609827458c3 ("HID: multitouch: optimize the sticky fingers timer") Signed-off-by: Andri Yngvason Signed-off-by: Benjamin Tissoires Link: https://lore.kernel.org/r/20220907150159.2285460-1-andri@yngvason.is Signed-off-by: Greg Kroah-Hartman --- drivers/hid/hid-multitouch.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c @@ -1186,7 +1186,7 @@ static void mt_touch_report(struct hid_d int contact_count = -1; /* sticky fingers release in progress, abort */ - if (test_and_set_bit(MT_IO_FLAGS_RUNNING, &td->mt_io_flags)) + if (test_and_set_bit_lock(MT_IO_FLAGS_RUNNING, &td->mt_io_flags)) return; scantime = *app->scantime; @@ -1267,7 +1267,7 @@ static void mt_touch_report(struct hid_d del_timer(&td->release_timer); } - clear_bit(MT_IO_FLAGS_RUNNING, &td->mt_io_flags); + clear_bit_unlock(MT_IO_FLAGS_RUNNING, &td->mt_io_flags); } static int mt_touch_input_configured(struct hid_device *hdev, @@ -1699,11 +1699,11 @@ static void mt_expired_timeout(struct ti * An input report came in just before we release the sticky fingers, * it will take care of the sticky fingers. */ - if (test_and_set_bit(MT_IO_FLAGS_RUNNING, &td->mt_io_flags)) + if (test_and_set_bit_lock(MT_IO_FLAGS_RUNNING, &td->mt_io_flags)) return; if (test_bit(MT_IO_FLAGS_PENDING_SLOTS, &td->mt_io_flags)) mt_release_contacts(hdev); - clear_bit(MT_IO_FLAGS_RUNNING, &td->mt_io_flags); + clear_bit_unlock(MT_IO_FLAGS_RUNNING, &td->mt_io_flags); } static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) From patchwork Wed Oct 19 08:22: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: 4527 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp203616wrs; Wed, 19 Oct 2022 01:43:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4VsJVVMUtHAqfqzSQRq9FEwQ16EHzpQ/jh1xEZX8Fn05yWJRMetMjfhyPXWG+UFwQM7Ub0 X-Received: by 2002:aa7:d289:0:b0:458:93a8:4789 with SMTP id w9-20020aa7d289000000b0045893a84789mr6366083edq.374.1666169016306; Wed, 19 Oct 2022 01:43:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169016; cv=none; d=google.com; s=arc-20160816; b=sBTsSXk/2e2GOyLhd0ZDHXCcsU4SIJ2b6NXtTSQYG4wySeBWKYFH+xxuxyNZjeRyVU 9i/YlZl+yQv60bszUBdfIhOCEtrw5EDINuQx+cX7d7NHGKMOYQiBA9Te4zMXkZfyVOpW hfR67oueuuHP9WwyFU4WwExxfDYTeDA020rkGXWgvdCrddkt5WHprl0ZfWAj7RliHl0i bvre9yTMuNVkPssmoi21Zs1djUJdUzWWBAp+Do5JG7VBpYXoV+lysdpwswpYALtFwRLw n/fHRTfy8ogJrtWlNrguq94o7xYWtnRtttsHcjbIJfuucKIr4Uge7Jp/AT9vy2NuZgHr 3YCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7TsOtbrUHU3FOxvbYMqoOl4X2gSxeqHZoyOC/5UxSMw=; b=czNGCz/z5rjJmSUfKZHIN1VpjQMW3WTqSNxvd2dR7ML4Ew2allhhC+uMM44XnhhAWZ Kw0Q+aCKfVWI/aciSDpiLFEFn1NRMKBs2DoQqpfx5BVmLH0nRpoz4pjUMHTny4moii0U apKcxnt/LxgkuHKepqR4zJPcNIcI6g3/7+91OlDZFO3uTWj7g4KEpzR5hfp+Nnf+/VKH DJVR6TeHUnBsV1DDSyeBFrpc72ffpzcy+8dUvlvUv7LxJgahHBqpRz7lhP+0U5mtlWet dPsBOY9/V1fQ3rV5omUf6vfVFfzPGVFrCngCtUHaffFxPT7X/St6L3OMgRs8IrFVrKAX QLVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JJ4a8ey6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170907160700b0078decbc3f73si14446149ejc.460.2022.10.19.01.43.11; Wed, 19 Oct 2022 01:43: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=JJ4a8ey6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231207AbiJSImh (ORCPT + 99 others); Wed, 19 Oct 2022 04:42:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230515AbiJSIln (ORCPT ); Wed, 19 Oct 2022 04:41:43 -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 33A37E0E5; Wed, 19 Oct 2022 01:39: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 0167EB82234; Wed, 19 Oct 2022 08:39:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A332C433D6; Wed, 19 Oct 2022 08:39:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168765; bh=Hqtjr7aNx0r86rF679oxrOM1V3mIW40F3zza30mBDt0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JJ4a8ey63qeTOJePdtokeUa1pewF8FfqNU6+m5pby+hT1kTa9wcpmBnYLKlwJw5N+ O2OagOzkCKaYjWlTBuvdy4RHgNv7juazMTi3pi59l/2jZwJT4ZKWKX3+M48vRiIVI5 WlK+GvpFcoYhQ+jhvNw9FJjcpFsug2jQ3C1a5f0o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhihao Cheng , Jan Kara Subject: [PATCH 6.0 047/862] quota: Check next/prev free block number after reading from quota file Date: Wed, 19 Oct 2022 10:22:14 +0200 Message-Id: <20221019083252.073999232@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104842103312049?= X-GMAIL-MSGID: =?utf-8?q?1747104842103312049?= 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 @@ -71,6 +71,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) { @@ -85,6 +114,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 { @@ -232,6 +264,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) { @@ -424,6 +459,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 Wed Oct 19 08:22: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: 4529 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp203643wrs; Wed, 19 Oct 2022 01:43:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM42Hmj28xnGqb0AacF+8nnvKSipaqFbU/+DZtL6cas4C6g1wRslD71RA3z3W+Zyz2K9314f X-Received: by 2002:a63:4e18:0:b0:43c:2fc7:2eea with SMTP id c24-20020a634e18000000b0043c2fc72eeamr6458569pgb.119.1666169019847; Wed, 19 Oct 2022 01:43:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169019; cv=none; d=google.com; s=arc-20160816; b=u05HrdLGIrfbKZJ7LfVdG0ilYHIHa7maexceVkg0OFmvsTgGsDP5ag7xYuQ7WU/ZFX rzxw1nWkPSIYkDvzb1m8xhmxRKOzff00jyC17g2KbJkKZnnFvbgX0Jhq7WlVNqOs2pH/ z/ZVP+HKJ3npRJJlFDkpOyyl13O9Ts832yyFcLJiffJqR4NOhC8V9Knr+61gQxLwTF/G OcufhnwaHJdUHkaBBWbtaQA/00LDP9iicIy5rFpyQ7FZQ3/iqvQgfvRx+WFdc/RKlaHn 3zdogH0qA9b0O9YZ8ppwhv6yYpR9XHri7vV8EHQWlnir7Ry+qSrvAxTB5ZqpUPE4LZg8 +3yA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VAg1aSmPBlZeLYGmbM5rrkhrZPyBZQ4CEEb+sKTns3M=; b=qsl4UqZQ/47ApTZpw4cjs2fnc1BTl5eefE7WUty+Rxd8cy0ReyOKVMAcQ0JPEXZqQl 4GkmmQNvernt8eUCrLkcvcFXZjjVRuI30eWF9mD8KzF4zjvCGC0AT1C9nKkYB+lX7lTP 2rpdS4b1S3QndcPU9ueoloiZ0S9gJM2ZCrLS8sUjzeoFDeBA0RengKyQSlzremMV4o63 bc0SXugy0hqW5FQ9u5aIvL2Y0pgnagPg0k9MGKPBFpuxowfkYwLOpsFcKDnmIaHOMw9l 18ZTvu/aza10bphACsQ6mOv4f+bHViPJq7xYbY8edmP1pQyA1yVFr4WVz53FB42ZntS9 /CuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VCV4Yoxr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k4-20020a170902d58400b001836e510540si17700536plh.114.2022.10.19.01.43.27; Wed, 19 Oct 2022 01:43: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=VCV4Yoxr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231163AbiJSInD (ORCPT + 99 others); Wed, 19 Oct 2022 04:43:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230452AbiJSIl4 (ORCPT ); Wed, 19 Oct 2022 04:41:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 997212BDE; Wed, 19 Oct 2022 01:39: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 5B18D617E4; Wed, 19 Oct 2022 08:39:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5ED30C433D6; Wed, 19 Oct 2022 08:39:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168771; bh=ANracX6QcKKFa/kJTbtWV/3I5dqKG+aQz5Kah9GF5dg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VCV4Yoxrb8nxS8lc8lOrs0cXKeBcUZkY2iOFUln5WOtG2DQ5lv6dAszGGZJOZGi21 Osj28AhsFCESQSsbLNLgldTrSF2uKrcryuK/teS1nRIi7M9lXazIwe81lUBQbiLgtt HGMLBeJCvT/hZNwZE/4ziAssdpMDqGWxFL38GdI4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guenter Roeck , Patryk Duda , Tzung-Bi Shih Subject: [PATCH 6.0 048/862] platform/chrome: cros_ec_proto: Update version on GET_NEXT_EVENT failure Date: Wed, 19 Oct 2022 10:22:15 +0200 Message-Id: <20221019083252.126138418@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104845757064821?= X-GMAIL-MSGID: =?utf-8?q?1747104845757064821?= From: Patryk Duda commit f74c7557ed0d321947e8bb4e9d47c1013f8b2227 upstream. Some EC based devices (e.g. Fingerpint MCU) can jump to RO part of the firmware (intentionally or due to device reboot). The RO part doesn't change during the device lifecycle, so it won't support newer version of EC_CMD_GET_NEXT_EVENT command. Function cros_ec_query_all() is responsible for finding maximum supported MKBP event version. It's usually called when the device is running RW part of the firmware, so the command version can be potentially higher than version supported by the RO. The problem was fixed by updating maximum supported version when the device returns EC_RES_INVALID_VERSION (mapped to -ENOPROTOOPT). That way the kernel will use highest common version supported by RO and RW. Fixes: 3300fdd630d4 ("platform/chrome: cros_ec: handle MKBP more events flag") Cc: # 5.10+ Reviewed-by: Guenter Roeck Signed-off-by: Patryk Duda Signed-off-by: Tzung-Bi Shih Link: https://lore.kernel.org/r/20220802154128.21175-1-pdk@semihalf.com Signed-off-by: Greg Kroah-Hartman --- drivers/platform/chrome/cros_ec_proto.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) --- a/drivers/platform/chrome/cros_ec_proto.c +++ b/drivers/platform/chrome/cros_ec_proto.c @@ -773,6 +773,7 @@ int cros_ec_get_next_event(struct cros_e u8 event_type; u32 host_event; int ret; + u32 ver_mask; /* * Default value for wake_event. @@ -794,6 +795,37 @@ int cros_ec_get_next_event(struct cros_e return get_keyboard_state_event(ec_dev); ret = get_next_event(ec_dev); + /* + * -ENOPROTOOPT is returned when EC returns EC_RES_INVALID_VERSION. + * This can occur when EC based device (e.g. Fingerprint MCU) jumps to + * the RO image which doesn't support newer version of the command. In + * this case we will attempt to update maximum supported version of the + * EC_CMD_GET_NEXT_EVENT. + */ + if (ret == -ENOPROTOOPT) { + dev_dbg(ec_dev->dev, + "GET_NEXT_EVENT returned invalid version error.\n"); + ret = cros_ec_get_host_command_version_mask(ec_dev, + EC_CMD_GET_NEXT_EVENT, + &ver_mask); + if (ret < 0 || ver_mask == 0) + /* + * Do not change the MKBP supported version if we can't + * obtain supported version correctly. Please note that + * calling EC_CMD_GET_NEXT_EVENT returned + * EC_RES_INVALID_VERSION which means that the command + * is present. + */ + return -ENOPROTOOPT; + + ec_dev->mkbp_event_supported = fls(ver_mask); + dev_dbg(ec_dev->dev, "MKBP support version changed to %u\n", + ec_dev->mkbp_event_supported - 1); + + /* Try to get next event with new MKBP support version set. */ + ret = get_next_event(ec_dev); + } + if (ret <= 0) return ret; From patchwork Wed Oct 19 08:22: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: 4530 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp203656wrs; Wed, 19 Oct 2022 01:43:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM45y/Zy/7A+ik4TLAMsq4Ero2bEr3qOyb46epCjgI8+1eQJhvGFaHtq5kJc6VOXor1/Uspd X-Received: by 2002:a17:903:32d2:b0:185:5211:c6cc with SMTP id i18-20020a17090332d200b001855211c6ccmr7609057plr.120.1666169023420; Wed, 19 Oct 2022 01:43:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169023; cv=none; d=google.com; s=arc-20160816; b=kMj86GftNX6f0EyjsIXfUrJuC6Ep26wi63ogNJo0/8LwHp7rgJ/GwCvEo6TFb1XTjq 5hgMICFo/yXHROJtI97qMxbO4bvhYWwmNc8LjF2a2G/TEoKQXsW+eTWf8JUrUS2vifkB 6Zqg0b2u16Jjx49BAfFwNq39iyQbRfyiDf9pkvvgp3vauHg84bqKU1bnQ26myX6FKohE kcEAla+FbMXIPFOdqiEptzaOLMkgz0T1qAZegCygt3/1MyTJNsNNtPz/s2//IyMtAoD9 0/PRdhvHo/YDRdUW9lpyBwWevJ7+PjantW2Y6vd7dxowzrTaEWHqsN1WhPIKYcMQdIpT 38VQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=mc22RDcpNcWmfoEAOrO2QFx3lZcVrWzMRzBUxy+G2N4=; b=s6iji+2GzdhdVdIWPGB0dkBRfCbsc5gaqQXcHasvjUHWpFuDw0rdNB/02hQjVKu/Rf DJnsuJXP5IUknqzroEsKYGJJ/RjlYV1mJQDD+h4tkvJRqDGi6rbdW6aWYMqVanIniKnv QIYLNkehUjEz6gjo0dsZkpHnoghazTj842hd5YgIA5x53Ld7IswNzVsjlDsrvuU9yLv8 dB1GU4Yphzlm4EV0b6bgTxRu7jyiPD3Hd9hqAvb045wLqKRUh4/NRujvlH1zl3wpmwBM IUYUGPgGJNHUf3mmy22xJYQtVylqXb/XC8CV/mU5cHjYQRMS3keIBRKKjGf6sShh3UL4 P0ZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KmWS28kh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b4-20020a170902d40400b0017f5ea2e8easi15445897ple.357.2022.10.19.01.43.30; Wed, 19 Oct 2022 01:43: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=KmWS28kh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231175AbiJSInG (ORCPT + 99 others); Wed, 19 Oct 2022 04:43:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229773AbiJSIlx (ORCPT ); Wed, 19 Oct 2022 04:41:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 935B01837A; Wed, 19 Oct 2022 01:39:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 99897617E8; Wed, 19 Oct 2022 08:39:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 88467C433C1; Wed, 19 Oct 2022 08:39:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168775; bh=TJwrFLLzUDARRz227XFqeD/qM+dImWjLpczpwfOOLTY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KmWS28khvOy59Vr52AjKFO5HoSXAMZuO7nAgdJr3Gx4aRP0QghzC3lnfZR6JZZHFM LPWcBY1RHk8syCBb7UImK53YyhRy7OrokbTtcmGgV3EJt+6adDdkE+Uc1yUHVwdgXr Ym3htPMQQyIe0t8/JZIUe5s1lEcYGeGHDJ/u8RWs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Stephen Boyd , Vinod Koul , David Heidelberg , Bjorn Andersson Subject: [PATCH 6.0 049/862] arm64: dts: qcom: sdm845-mtp: correct ADC settle time Date: Wed, 19 Oct 2022 10:22:16 +0200 Message-Id: <20221019083252.168645073@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104849892471016?= X-GMAIL-MSGID: =?utf-8?q?1747104849892471016?= From: Krzysztof Kozlowski commit 209a04885ab5f76722a1671d0fbf0a5b4bccacec upstream. The PMIC's VADC property for settle time is qcom,hw-settle-time, not qcom,hw-settle-time-us. The latter is used in PMIC's TM ADC. qcom/sdm845-mtp.dtb: pmic@0: adc@3100:adc-chan@4c: 'qcom,hw-settle-time-us' does not match any of the regexes: 'pinctrl-[0-9]+' Fixes: d5e12f3823ae ("arm64: dts: qcom: sdm845: mtp: Add vadc channels and thermal zones") Cc: Signed-off-by: Krzysztof Kozlowski Reviewed-by: Stephen Boyd Reviewed-by: Vinod Koul Reviewed-by: David Heidelberg Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220828084341.112146-13-krzysztof.kozlowski@linaro.org Signed-off-by: Greg Kroah-Hartman --- arch/arm64/boot/dts/qcom/sdm845-mtp.dts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) --- a/arch/arm64/boot/dts/qcom/sdm845-mtp.dts +++ b/arch/arm64/boot/dts/qcom/sdm845-mtp.dts @@ -536,42 +536,42 @@ reg = ; label = "xo_therm"; qcom,ratiometric; - qcom,hw-settle-time-us = <200>; + qcom,hw-settle-time = <200>; }; adc-chan@4d { reg = ; label = "msm_therm"; qcom,ratiometric; - qcom,hw-settle-time-us = <200>; + qcom,hw-settle-time = <200>; }; adc-chan@4f { reg = ; label = "pa_therm1"; qcom,ratiometric; - qcom,hw-settle-time-us = <200>; + qcom,hw-settle-time = <200>; }; adc-chan@51 { reg = ; label = "quiet_therm"; qcom,ratiometric; - qcom,hw-settle-time-us = <200>; + qcom,hw-settle-time = <200>; }; adc-chan@83 { reg = ; label = "vph_pwr"; qcom,ratiometric; - qcom,hw-settle-time-us = <200>; + qcom,hw-settle-time = <200>; }; adc-chan@85 { reg = ; label = "vcoin"; qcom,ratiometric; - qcom,hw-settle-time-us = <200>; + qcom,hw-settle-time = <200>; }; }; From patchwork Wed Oct 19 08:22: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: 4528 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp203629wrs; Wed, 19 Oct 2022 01:43:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5VE7FYJ0Kpi/fFH0TuyYRSrchoaUCLoq3MvidZkVqdl3ExqL/ctXtoyn2z6qj1N43T3g2B X-Received: by 2002:a63:86c7:0:b0:459:437c:ca90 with SMTP id x190-20020a6386c7000000b00459437cca90mr6400280pgd.33.1666169017766; Wed, 19 Oct 2022 01:43:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169017; cv=none; d=google.com; s=arc-20160816; b=B9X5YlTtMbEnUsTJpUH7X8rpX7iIt4Ug68/maAYWJPgYWNQpR9XOmY4COwNgwmuofs sfrraKB8GIRew3jqVIDD3vUoZAIVL3wVNLAMIaJwTPJzvHpPEVXaMvxBqHv96wZGDG/t tX0ypR6lCW6XbJu51LIm9kF9QzcorfV89lGVHE67oK1chwEbht0lcH7AL/CkOBzZuXbk zEUwJNX5OJi8BbMXNBaat8Zb7MPfEF2PlfuwNtLJJicCzmueI6rdAGeYdx5pCyg2BzFS /8ee1LI3SUgd+PIyHgsbkeb/ycwnXGhCFb6wTo+0Fq0M3ZuIvkGkqxpR3kQOtRk6bKU6 DlGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=V5IJaSimAjUncqQve6FnR+B5Lloz0VUcaMiFlpZvaC0=; b=EoWGrSiYk94f4T+kExTvTDJkPfK0zN/5OTYYheGT2yPCy6CI/h0fCkXCCANqbViAr4 lu1veKaU4ic6AbVfsyiNLt70X/chWOY1pQbng8cvSsFkpjKVJR0a4wuj8ST/yRT7sqDv Cl//uPdwx50I2UDe1VOlfjduER2zDqgXSPkkoIYJSkzOOQOj2c2CKHSaQrW5kTmfo4b7 d1ktQrM7iNBY7qsTiaLMZ11F/XXLCglY0j3Jq7JsPqZGtPusIE0NWU6jNPlWWQv7PnHD jKU/lYGYWCdsOAc22nXFi1LkF4smNyp12evXhYKJ2dzj3Ug2/fFtz8myMdCw3ewbq+DR IDkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=M93bjaLU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m4-20020a170902768400b00176db49b734si15928338pll.283.2022.10.19.01.43.23; Wed, 19 Oct 2022 01:43: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=M93bjaLU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230461AbiJSIm7 (ORCPT + 99 others); Wed, 19 Oct 2022 04:42:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230447AbiJSIlr (ORCPT ); Wed, 19 Oct 2022 04:41:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 936E62314C; Wed, 19 Oct 2022 01:39: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 5223CB82256; Wed, 19 Oct 2022 08:39:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 810C0C433D6; Wed, 19 Oct 2022 08:39:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168778; bh=obwycopaJ/uBms9NswMDeNgX5qTwLCACrJks60hkFjk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M93bjaLUzqS/IT7Ve9sJL0rl5pAiNcmW0jLk4cXow7yIdp5jCKF8Q8DVnm8vNkBQ8 As1dJ8B0HGfN0fMavLu7cXUB7CVvklXmyzXVYz3O+DVNij/2wIQ5n9q0NyalN+4vTO GGBldte3P/8QPfwHp0AmTIrVxjH6lhj7aH5fepQc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Srinivas Kandagatla , Mark Brown Subject: [PATCH 6.0 050/862] ASoC: wcd9335: fix order of Slimbus unprepare/disable Date: Wed, 19 Oct 2022 10:22:17 +0200 Message-Id: <20221019083252.209705544@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104843747421369?= X-GMAIL-MSGID: =?utf-8?q?1747104843747421369?= From: Krzysztof Kozlowski commit ea8ef003aa53ad23e7705c5cab1c4e664faa6c79 upstream. Slimbus streams are first prepared and then enabled, so the cleanup path should reverse it. The unprepare sets stream->num_ports to 0 and frees the stream->ports. Calling disable after unprepare was not really effective (channels was not deactivated) and could lead to further issues due to making transfers on unprepared stream. Fixes: 20aedafdf492 ("ASoC: wcd9335: add support to wcd9335 codec") Cc: Signed-off-by: Krzysztof Kozlowski Reviewed-by: Srinivas Kandagatla Link: https://lore.kernel.org/r/20220921145354.1683791-1-krzysztof.kozlowski@linaro.org Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- sound/soc/codecs/wcd9335.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/sound/soc/codecs/wcd9335.c +++ b/sound/soc/codecs/wcd9335.c @@ -1974,8 +1974,8 @@ static int wcd9335_trigger(struct snd_pc case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_SUSPEND: case SNDRV_PCM_TRIGGER_PAUSE_PUSH: - slim_stream_unprepare(dai_data->sruntime); slim_stream_disable(dai_data->sruntime); + slim_stream_unprepare(dai_data->sruntime); break; default: break; From patchwork Wed Oct 19 08:22: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: 4534 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp203776wrs; Wed, 19 Oct 2022 01:44:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4E0eI7YIMtaVbj+/076SNTURkeS+hzqv/YD6e515/58r5TdFO6ZUJz30kj3Ibk51wIeIRw X-Received: by 2002:a05:6a00:1309:b0:535:d421:1347 with SMTP id j9-20020a056a00130900b00535d4211347mr7371314pfu.5.1666169042283; Wed, 19 Oct 2022 01:44:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169042; cv=none; d=google.com; s=arc-20160816; b=PX6JcMu+f4TBFPq6fZKr7KrtFjdAzQ/myF8ENMedDGYBcqRzq48J3zhfMn5mSkuSQm dOz+8eskZ5Lzzyv36njnQ+nsGsgr1BXvvEGvfRXsWblRXJdf7tkP+N2wGkBiMHAXB3GS tyRu3q0byuBLG3H56gHP9ZEpW+YMG1GuNrxAfetNiHmzvR63mAj3RYZRDJelZDeTnvNj bAHodtcML9hAcJhsrNpNYp4g9Vu7D388igWvRq5zUWSxEzKll0d4ZABuqW+2pfOae6PD YvCIsG5LtOWc5sMgWrxwU8by0x3lMWR1/ItlBqJg9a6eRZDF2jIcdQ9mPLcBXbzaVXrB kLmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DYFMkEqEuQPqiZTlOVkacocWot7TykaL0hyRUIMhThw=; b=oPRvpmR8ytTFSrKu3yHt6yabgIv4onUz0HmRN96p0zvCaRDRC4cGFw8PwWmZipsSZz bdlcrHfLgBrrmn5haL4Ms5CD8RhR4S7IQdz6p1SCC+FUVFicCL8x97C+tCS57Q4FnJOK W7lUKpps0ScwYw72B6MYFdAdkJvnttspY3fKTor2QF1GHOCStyEYRqA0E0QNsXsqU+8w SQUBzovQBeF9obOFJEetTfAQYRFDS1BylaukAR/LC9le0wVsuChLdNfGraekR32F2PPs lx9TiE+Evvr1FuHDbXU/JmnYJMPNKYfIkhSHzcpUV86QOeU5qYWGVt96FgH/OxU8aQZg u0Hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rsPDkM93; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f22-20020a17090ace1600b0020038eb8b5asi16359162pju.21.2022.10.19.01.43.49; Wed, 19 Oct 2022 01:44: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=rsPDkM93; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231252AbiJSInL (ORCPT + 99 others); Wed, 19 Oct 2022 04:43:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231139AbiJSImC (ORCPT ); Wed, 19 Oct 2022 04:42:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CEF924943; Wed, 19 Oct 2022 01:39: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 BB79E617D7; Wed, 19 Oct 2022 08:39:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC540C433D6; Wed, 19 Oct 2022 08:39:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168781; bh=QISEug/oQPt/cNqoDbsduIJCybvN/wr90v+7N9BYJUc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rsPDkM93qZp/xDFKL5QyEAqHE8v+axbnpH6XWVWWMxf2fbuITtVf/JQWUh+fx3gKL WJO3KLO5M4Y6VtL6JNhyLv9nNCSfWlrpPd6NlmZyBBGWBimbZ8zJKCZXpQMYrO0j2d 1HcCRHjTiZkiKHETj9yN4/ymrsk+DZgQoTCAdA+o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Srinivas Kandagatla , Mark Brown Subject: [PATCH 6.0 051/862] ASoC: wcd934x: fix order of Slimbus unprepare/disable Date: Wed, 19 Oct 2022 10:22:18 +0200 Message-Id: <20221019083252.248252349@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104869563990488?= X-GMAIL-MSGID: =?utf-8?q?1747104869563990488?= From: Krzysztof Kozlowski commit e96bca7eaa5747633ec638b065630ff83728982a upstream. Slimbus streams are first prepared and then enabled, so the cleanup path should reverse it. The unprepare sets stream->num_ports to 0 and frees the stream->ports. Calling disable after unprepare was not really effective (channels was not deactivated) and could lead to further issues due to making transfers on unprepared stream. Fixes: a61f3b4f476e ("ASoC: wcd934x: add support to wcd9340/wcd9341 codec") Cc: Signed-off-by: Krzysztof Kozlowski Reviewed-by: Srinivas Kandagatla Link: https://lore.kernel.org/r/20220921145354.1683791-2-krzysztof.kozlowski@linaro.org Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- sound/soc/codecs/wcd934x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/sound/soc/codecs/wcd934x.c +++ b/sound/soc/codecs/wcd934x.c @@ -1913,8 +1913,8 @@ static int wcd934x_trigger(struct snd_pc case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_SUSPEND: case SNDRV_PCM_TRIGGER_PAUSE_PUSH: - slim_stream_unprepare(dai_data->sruntime); slim_stream_disable(dai_data->sruntime); + slim_stream_unprepare(dai_data->sruntime); break; default: break; From patchwork Wed Oct 19 08:22: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: 4533 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp203763wrs; Wed, 19 Oct 2022 01:43:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7B33xW6dl3mDwGrCgNl/ZMyl7Bo1gnywtV97OHZ6SSgug7ZoFTC0b8Sp7Nh63d0d0MdFrB X-Received: by 2002:a05:6a00:1306:b0:555:6d3f:11ed with SMTP id j6-20020a056a00130600b005556d3f11edmr7516739pfu.55.1666169039607; Wed, 19 Oct 2022 01:43:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169039; cv=none; d=google.com; s=arc-20160816; b=c+3D4riKLcOU5y8cSMfM3W6XJCoZW91OYSHolqy0e3c9HllU1MUEKqmYFpqcJbXnWs EaOFpOkTtb21kjH2Dy5HzBeif8GpjfJhQgVYkpblbuGhLOzp2u35RkloueHMfdKvaaqO mN3DfK854s+nkP1Kv2xDrbvqMUw4riQ7WpJ0rmesqcdzDEWFmk6zYcp5BX4xSs7m0qn0 jumRrXcyr4tHZAiAdyuib+N8FsnM0m53NUfF8KU0DaaiB8m+I/CXHQTkXIeJCPrCVqJL kqWHps4+K1qoVBPgGPpy3NUlr6Q+oECbDkGx+3hmH6LDjfi5Y0mMmFVYplxTBlAgI9qg NICA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=87J+Xbu2NgOxZkDmfpWuEUrSqNr9zdrQB2kaqDUuIJE=; b=xW1tfcyspOT+O/Urr6628MFr5WWF3sN86c48UTjrdVYNHhDXGGQdkUz7GH3gfvasyn WmSNe0zmYoteFYtd5BbA/61GWI49r6syZaXgioZOWZRg4aQAvRiqPrEU6TFFvtW8FM38 9dujzllcI9pIgQJ/QXgj7t9O5vl6sJ4xSHAHhkGZLydGV4t/RHGlhKSTwQz/QkOvADrJ 2QTwTUW47QtBaepbaoP485efwCNjksg8rY1K32IGt5ngsZznWcqYbBo+Bh06BUcrxv7U 4OxyQNswZRFKhJ93C9mHgV4HvfuyJgGELVPYABm+0/xiW7JZEz3v1Ax81APUY9TxNi3N kdmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vdc6q2bO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a17090a8d8100b001fde53d5d79si23331314pjo.5.2022.10.19.01.43.47; Wed, 19 Oct 2022 01:43: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=vdc6q2bO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231274AbiJSInV (ORCPT + 99 others); Wed, 19 Oct 2022 04:43:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231189AbiJSImW (ORCPT ); Wed, 19 Oct 2022 04:42: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 CD8F042AD9; Wed, 19 Oct 2022 01:39: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 ams.source.kernel.org (Postfix) with ESMTPS id 757E7B82234; Wed, 19 Oct 2022 08:39:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD57BC433C1; Wed, 19 Oct 2022 08:39:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168784; bh=p5/X/8K03kH+hgzQsYC4VASRtCEOfafEweUf2IKRMd4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vdc6q2bO5agx1VQa4q/2GrYsfBcNvkOEac1nQGJt214SW2j/GwUY715+dGDTeAsej UNV/3LUODO9kdRqjquYKxdm7JgvzjjhZik1g9sJgcGsNSqo/tLyAYAhyj8qj6C+1Wl a67dE1DW7k6cOT9lspRNwfDWmiLeLuQa44eTog00= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Mengda Chen , Guenter Roeck Subject: [PATCH 6.0 052/862] hwmon: (gsc-hwmon) Call of_node_get() before of_find_xxx API Date: Wed, 19 Oct 2022 10:22:19 +0200 Message-Id: <20221019083252.285526333@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104867144208004?= X-GMAIL-MSGID: =?utf-8?q?1747104867144208004?= From: Liang He commit 7f62cf781e6567d59c8935dc8c6068ce2bb904b7 upstream. In gsc_hwmon_get_devtree_pdata(), we should call of_node_get() before the of_find_compatible_node() which will automatically call of_node_put() for the 'from' argument. Fixes: 3bce5377ef66 ("hwmon: Add Gateworks System Controller support") Signed-off-by: Liang He Co-developed-by: Mengda Chen Signed-off-by: Mengda Chen Link: https://lore.kernel.org/r/20220916154708.3084515-1-chenmengda2009@163.com Cc: stable@vger.kernel.org Signed-off-by: Guenter Roeck Signed-off-by: Greg Kroah-Hartman --- drivers/hwmon/gsc-hwmon.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/hwmon/gsc-hwmon.c +++ b/drivers/hwmon/gsc-hwmon.c @@ -267,6 +267,7 @@ gsc_hwmon_get_devtree_pdata(struct devic pdata->nchannels = nchannels; /* fan controller base address */ + of_node_get(dev->parent->of_node); fan = of_find_compatible_node(dev->parent->of_node, NULL, "gw,gsc-fan"); if (fan && of_property_read_u32(fan, "reg", &pdata->fan_base)) { of_node_put(fan); From patchwork Wed Oct 19 08:22: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: 4532 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp203724wrs; Wed, 19 Oct 2022 01:43:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM76oNAxlV9/hBYsU/8uKrCz8Rn9RLLfPBm+/FiC0XMCFOTpBiS12JVgp5pPJwArb8JMQlUD X-Received: by 2002:a05:6a00:998:b0:563:3428:65a0 with SMTP id u24-20020a056a00099800b00563342865a0mr7432067pfg.22.1666169034061; Wed, 19 Oct 2022 01:43:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169034; cv=none; d=google.com; s=arc-20160816; b=0+/cTsNCrzjMlzxtW7TGKwNq2CvWW5WCrNHdIZpXvAzkV3y7vffWohrJ3TC/f+Ld7c UvAdPzmvKJn6uK5jTvHxNhjuj8On451EI7UqLQpIbxnwMBwVJwB9dfjHtdvxt9+sr3gn RcrS536fRxhP1Qp0pMmQI+50T7vxg5HgRVCSxUnNUB/Ir7f9orz44BMGAQ42vkngZeK9 4R8dStH1IUCr+yqKN6bknirYLlVm+8EPGk4re2F7M/FLnCTB0nwuoYCH7X7aX3c7knZG PUublW1h39YvgIoaTknHKJ38GMUGzFgqF2UBFXXhBvQQHQ4hE3Mb+MZc9sn6FJ6uKFaL Oi2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uXKqchtCfBTfSsss0+Af3fHqgjk1R3VG8xPchCBv0RU=; b=WRkAG0cJGWG6t0Rws9oa65QTv1K7LXNnWAgx6SdDl3mb4jcJaqAR/mRsBuBnxcTpva 8dmxybgHqsyP3VR9FoCCrI7fznn9LSVj880BoQYorHd/6MLnScfsb42xR8PUWsra2iU/ wHXmmOJCsScnQVZF2gqOl2qXcJcjCdELRAml0pPE1smISDm70djVtb4qZlPcH9SBUAOO n1/EDoECTuUO4g8Ikp4XZrhWewmpdQeUGyUO04i2nuYvTTIbcoqpVN7JuBkkQSofoKVf rggoAQ4PhVhUES1hBPhCmJMa94NFw7wy22x6gb2r7/7JioUdOh6+fUYg3G5/q/reWatT roAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mUqwV65b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f23-20020a63dc57000000b004197e33daf5si16829937pgj.863.2022.10.19.01.43.41; Wed, 19 Oct 2022 01:43:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mUqwV65b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230442AbiJSInP (ORCPT + 99 others); Wed, 19 Oct 2022 04:43:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231186AbiJSImW (ORCPT ); Wed, 19 Oct 2022 04:42:22 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D023A48CBF; Wed, 19 Oct 2022 01:39: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 7B216B821CD; Wed, 19 Oct 2022 08:39:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9218C433D6; Wed, 19 Oct 2022 08:39:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168787; bh=qzNPjTgfZEYYgdxUncWZqKaKdlo8w1SbSuDFg3W8BnA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mUqwV65buO035u8oCYlVYs/sh4QLan3nkLc5vaQYskmLmA86FiUmTBLAx9ErZM0xh l3v3DyLcn48Lg6LJPBoBgwJQRvOqGr/25W26iFvj6wjDGovobBy5YCk0T0Fgaa+1Xj fW4qgCoE5rn7Pwq6cwGp666i1W1aEIr1LUJ9XKk4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mika Westerberg , "David S. Miller" Subject: [PATCH 6.0 053/862] net: thunderbolt: Enable DMA paths only after rings are enabled Date: Wed, 19 Oct 2022 10:22:20 +0200 Message-Id: <20221019083252.323733118@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104860762239312?= X-GMAIL-MSGID: =?utf-8?q?1747104860762239312?= From: Mika Westerberg commit ff7cd07f306406493f7b78890475e85b6d0811ed upstream. If the other host starts sending packets early on it is possible that we are still in the middle of populating the initial Rx ring packets to the ring. This causes the tbnet_poll() to mess over the queue and causes list corruption. This happens specifically when connected with macOS as it seems start sending various IP discovery packets as soon as its side of the paths are configured. To prevent this we move the DMA path enabling to happen after we have primed the Rx ring. This makes sure no incoming packets can arrive before we are ready to handle them. Fixes: e69b6c02b4c3 ("net: Add support for networking over Thunderbolt cable") Cc: stable@vger.kernel.org Signed-off-by: Mika Westerberg Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/thunderbolt.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) --- a/drivers/net/thunderbolt.c +++ b/drivers/net/thunderbolt.c @@ -612,18 +612,13 @@ static void tbnet_connected_work(struct return; } - /* Both logins successful so enable the high-speed DMA paths and - * start the network device queue. + /* Both logins successful so enable the rings, high-speed DMA + * paths and start the network device queue. + * + * Note we enable the DMA paths last to make sure we have primed + * the Rx ring before any incoming packets are allowed to + * arrive. */ - ret = tb_xdomain_enable_paths(net->xd, net->local_transmit_path, - net->rx_ring.ring->hop, - net->remote_transmit_path, - net->tx_ring.ring->hop); - if (ret) { - netdev_err(net->dev, "failed to enable DMA paths\n"); - return; - } - tb_ring_start(net->tx_ring.ring); tb_ring_start(net->rx_ring.ring); @@ -635,10 +630,21 @@ static void tbnet_connected_work(struct if (ret) goto err_free_rx_buffers; + ret = tb_xdomain_enable_paths(net->xd, net->local_transmit_path, + net->rx_ring.ring->hop, + net->remote_transmit_path, + net->tx_ring.ring->hop); + if (ret) { + netdev_err(net->dev, "failed to enable DMA paths\n"); + goto err_free_tx_buffers; + } + netif_carrier_on(net->dev); netif_start_queue(net->dev); return; +err_free_tx_buffers: + tbnet_free_buffers(&net->tx_ring); err_free_rx_buffers: tbnet_free_buffers(&net->rx_ring); err_stop_rings: From patchwork Wed Oct 19 08:22: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: 4538 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp204047wrs; Wed, 19 Oct 2022 01:44:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6xBvreUgOtXgl6Hieuy6kCG6GqGkXdMO/2GXS9wI/i7Fn/R33kbeTF8CPRyhhhGZcIdgoh X-Received: by 2002:a17:90b:4a85:b0:20c:316d:e595 with SMTP id lp5-20020a17090b4a8500b0020c316de595mr8576324pjb.186.1666169092324; Wed, 19 Oct 2022 01:44:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169092; cv=none; d=google.com; s=arc-20160816; b=CP3Fa2SyvIKofREdidPgVF7AqifNYbaq6HMFcoyO4Ct7g+NLIVS7dZiiVHS6wPnnAh iExbWl4t2OF1iDCArTNdkeJOiEGKHAKxtHNUTEnoavnMle5Z/M55txT7ShXXhssfyNkU THk7QHwq4jfqd+dKR3UEQ/5WLkD8qos1H3rJdadOcBEwTGegNK6etwrUlTvHCH/wKfnt 6gbeuGy1Zxlr+T9IRnzoKzi9KnVykLZJtEa3x5ZrjRAEopKzTEsuf68rD12GyGNUSVVy rvzjcwXVlm7DtXixsD3HSuzde4kZyT+ag/1RLHTPHqPppNxy5W0ikTsEDs2eNUwZtCuE xiyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=e0oyloDANX4qZ7yYao6NhCN7UInk2+mtNG14rMuVRw8=; b=u/Z/MMpRcPqoX227pe59k7x1smJnZmmeN2u4vdCz1lgoAD8RQ7KMgv+PrwEIQHuUTh uyBt1WHFyqpWUQcf2S4G+aB316hV/Sih+ZokM357ccCs4N2sspHRdkNjeeC30/DX9PX6 gYjUMvSTAC7Q8sUr+7tseALISwdHfQJBkyAmjO6QXVtP2hfBrWhkbmtIrKDdDGLHTZyB bs3IccWSbRT5wAdXHiZZaOR+nAbhMHzGV1ykYCZ9E5/PUFDg2ukUqtWkbAyYjqgFc3Cw qkyVuh/5XJyIF638jXU500DqDHPUUjjW9HTHd5JaoogHoM1t9iEkLYAmjXuWg8kEC2Mp NelQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Yuc6OKj/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ng18-20020a17090b1a9200b0020a97a92a2fsi20095863pjb.135.2022.10.19.01.44.39; Wed, 19 Oct 2022 01:44: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="Yuc6OKj/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230344AbiJSIn1 (ORCPT + 99 others); Wed, 19 Oct 2022 04:43:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230517AbiJSIma (ORCPT ); Wed, 19 Oct 2022 04:42: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 CF1AD44CE7; Wed, 19 Oct 2022 01:39: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 0A6F3617E4; Wed, 19 Oct 2022 08:39:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0A10C433D7; Wed, 19 Oct 2022 08:39:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168790; bh=beAhWKXvQm9GjdNfxG+/MZqHkyVEr24AhaspX2hWJsw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yuc6OKj/H6JRXZtzKNw68LL+xG3SpiY0mkEIii5hUZ45i8OOjvHZqqmqA92ixGgx0 VNffNx02gzgIonF9tNdfsIT6k8SxAEBIk8114aMojDaGg0UQAjBjcw2Il0OhsoRCNy jPJ99NHH2LbmDBoQGJQp52iz9nfMizsFalx8Dpfg= 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 6.0 054/862] regulator: qcom_rpm: Fix circular deferral regression Date: Wed, 19 Oct 2022 10:22:21 +0200 Message-Id: <20221019083252.370989353@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104922136845612?= X-GMAIL-MSGID: =?utf-8?q?1747104922136845612?= 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 @@ -802,6 +802,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" }, @@ -829,12 +835,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" }, @@ -843,6 +843,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" }, @@ -851,12 +857,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 Wed Oct 19 08:22: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: 4535 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp203798wrs; Wed, 19 Oct 2022 01:44:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4yiJObXgx+N1bQrOef75ldbUQ26L/WXTQyA86DkVy6qk7UFSSjk4wRqOrHWQ3kiE6ussA8 X-Received: by 2002:a63:1112:0:b0:43c:7998:ac15 with SMTP id g18-20020a631112000000b0043c7998ac15mr6489262pgl.51.1666169046233; Wed, 19 Oct 2022 01:44:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169046; cv=none; d=google.com; s=arc-20160816; b=r+De6yJMvLuTbh2UTQSZ2xfWe8KMuB/yJb6SUjRACanvqglSxT6DdV5q6/YCWeeF99 +xdevnA/dHRYv7PNsyR+Mfpxmc+1Mm/VvObTKIVzrF2GUhGEx+b2oCvjzW1MlETVuBWr 2b3WHAMpNc4ZoRWGVY54wGLQYaE1VENiC+aUTAiqrGcLSy1Oo+jz0329tgxC5I23EXdN NucPIUhjNg/g5oufoqLftEWz3uZ9sQvi8tHQcSHrmGEf0yROheNME1zq6kbq0qQhsNyJ zrxj0so/eVcCSOjNSZiln5zyfN+adw3Op+i4pXpFy6SHlMExx9EuSpO+uBLGGFIGyT12 Joag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uyYr3a8rSMfbxvMeIufQCAxCcGGwezphBh/unxt4dj8=; b=Px3YW37A2eZ4zBnsNIX6E1rVMyW6J68b8dz1LZ5CNJeNkvYYazVFdvKnIEjIA3PzYQ w5QJWNrubrD+Q57Lul2wNEkiFuHccUHPqNDVclleTZ0dm9uQHwZZpZTwJAB6sqhJ1//W 5KLTpmaIpD3eeV0Pt1l5d4ewc1ls/JMrqtjn2AICPlcz6/nlh+JeJDmtzQ0bRylImbRQ trgyKJPhNiYNdkPkYnHNXy2GGf4SXA71dalH+pVcGwFCzgbn3Lby1m8U1LzWd/vgI2bZ YJjUN/nAXOBpcUDmpTK//QIlyX0qITcrzoUFmkxBt5sqKu1xGeG9w+guKTkYvQfkCZaE 1Kyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HVk4jeiP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k135-20020a633d8d000000b00461916bca4asi18350789pga.627.2022.10.19.01.43.53; Wed, 19 Oct 2022 01:44: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=HVk4jeiP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231284AbiJSInX (ORCPT + 99 others); Wed, 19 Oct 2022 04:43:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230515AbiJSImk (ORCPT ); Wed, 19 Oct 2022 04:42: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 89AC753A63; Wed, 19 Oct 2022 01:39: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 25E09617D6; Wed, 19 Oct 2022 08:39:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 177F5C433D6; Wed, 19 Oct 2022 08:39:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168793; bh=a2KNSKtYiPrIMjccfWprCEzKN1CyLwO/KdoTcBtdja8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HVk4jeiPGnCNn3FM0SCCBxVOdAUFcIBIvSKI297zOb9WgSYHGf9e9Vti3S+SR+jA6 QqFonKqtYd20ngClCeukaCRFNl6OyuLuQ2no8Hy7gqJEOIXSS7WMkKeI81ZAM2nvdd SKt62uvOjXgSlsCVXrU3ARtwg3nwAgAYLz4TpDjw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sudeep Holla , Catalin Marinas , Atish Patra , Conor Dooley Subject: [PATCH 6.0 055/862] arm64: topology: move store_cpu_topology() to shared code Date: Wed, 19 Oct 2022 10:22:22 +0200 Message-Id: <20221019083252.410045280@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104873922902684?= X-GMAIL-MSGID: =?utf-8?q?1747104873922902684?= From: Conor Dooley commit 456797da792fa7cbf6698febf275fe9b36691f78 upstream. arm64's method of defining a default cpu topology requires only minimal changes to apply to RISC-V also. The current arm64 implementation exits early in a uniprocessor configuration by reading MPIDR & claiming that uniprocessor can rely on the default values. This is appears to be a hangover from prior to '3102bc0e6ac7 ("arm64: topology: Stop using MPIDR for topology information")', because the current code just assigns default values for multiprocessor systems. With the MPIDR references removed, store_cpu_topolgy() can be moved to the common arch_topology code. Reviewed-by: Sudeep Holla Acked-by: Catalin Marinas Reviewed-by: Atish Patra Signed-off-by: Conor Dooley Signed-off-by: Greg Kroah-Hartman --- arch/arm64/kernel/topology.c | 40 ---------------------------------------- drivers/base/arch_topology.c | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 40 deletions(-) --- a/arch/arm64/kernel/topology.c +++ b/arch/arm64/kernel/topology.c @@ -22,46 +22,6 @@ #include #include -void store_cpu_topology(unsigned int cpuid) -{ - struct cpu_topology *cpuid_topo = &cpu_topology[cpuid]; - u64 mpidr; - - if (cpuid_topo->package_id != -1) - goto topology_populated; - - mpidr = read_cpuid_mpidr(); - - /* Uniprocessor systems can rely on default topology values */ - if (mpidr & MPIDR_UP_BITMASK) - return; - - /* - * This would be the place to create cpu topology based on MPIDR. - * - * However, it cannot be trusted to depict the actual topology; some - * pieces of the architecture enforce an artificial cap on Aff0 values - * (e.g. GICv3's ICC_SGI1R_EL1 limits it to 15), leading to an - * artificial cycling of Aff1, Aff2 and Aff3 values. IOW, these end up - * having absolutely no relationship to the actual underlying system - * topology, and cannot be reasonably used as core / package ID. - * - * If the MT bit is set, Aff0 *could* be used to define a thread ID, but - * we still wouldn't be able to obtain a sane core ID. This means we - * need to entirely ignore MPIDR for any topology deduction. - */ - cpuid_topo->thread_id = -1; - cpuid_topo->core_id = cpuid; - cpuid_topo->package_id = cpu_to_node(cpuid); - - pr_debug("CPU%u: cluster %d core %d thread %d mpidr %#016llx\n", - cpuid, cpuid_topo->package_id, cpuid_topo->core_id, - cpuid_topo->thread_id, mpidr); - -topology_populated: - update_siblings_masks(cpuid); -} - #ifdef CONFIG_ACPI static bool __init acpi_cpu_is_threaded(int cpu) { --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -841,4 +841,23 @@ void __init init_cpu_topology(void) return; } } + +void store_cpu_topology(unsigned int cpuid) +{ + struct cpu_topology *cpuid_topo = &cpu_topology[cpuid]; + + if (cpuid_topo->package_id != -1) + goto topology_populated; + + cpuid_topo->thread_id = -1; + cpuid_topo->core_id = cpuid; + cpuid_topo->package_id = cpu_to_node(cpuid); + + pr_debug("CPU%u: package %d core %d thread %d\n", + cpuid, cpuid_topo->package_id, cpuid_topo->core_id, + cpuid_topo->thread_id); + +topology_populated: + update_siblings_masks(cpuid); +} #endif From patchwork Wed Oct 19 08:22: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: 4536 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp203995wrs; Wed, 19 Oct 2022 01:44:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7afIahpPwZFmmqIEmV/cCPF632gI6oZIngYp1sZ/TiUYtb2sIqfAG6NG31dggMDTQ2JBhZ X-Received: by 2002:a05:6a00:2389:b0:565:328d:ed with SMTP id f9-20020a056a00238900b00565328d00edmr7368889pfc.84.1666169083742; Wed, 19 Oct 2022 01:44:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169083; cv=none; d=google.com; s=arc-20160816; b=dJbFT7npls9rfZljYiuOqoohc4JgSdJClyihsovqTFAMgBhJXqmIGCetNYKBLtqyMM J2RJnXDNVB9QkGt4vT4fi89cCduYb4qA3ofr9Za9+sKKQQV81lUMYnN0B2Tvjig2kNDM edqyDJ40lr5Fw1H4wDqTYgg7tc+2l/PF9FEloqZFy6UzSYDtbAlGvGdMbjK2Zu5jkr+M Hddd9NMK3yiXkOhLCNNJXRf+vb9nVF0yazcb9mRYKR9pGi420I7lkN+5e16XxTjiQx9Z xbJFbJzh+zkqfgO0aqqoFmZFihprR84w9NF9BpTfmMG35lLuLrcANRr8VamR88oKw8dM vuJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OYyDd0Eh3xL6PGaYojGuqPvarnc4dNhG94GPUfSJXcw=; b=qyASE/3JlGGqZ6ZFDK44M0EtadqWmnGRy6HxaOjKEiG/aNtCnQzA2a6h+vBBu4y7pH V+lhsF7nS6ENVUAUfgN+sUwIIUDQCrVd502mwLRNCp/ENv7UQsQp8Czw2AhGHhJFZIdw fxTgR1plYXDSW0Ee7e5IGVGi1vtaJp4iqs228kylLSsLoy1uj3PfVYnwzQgm7w5sS5gR LajAzngLyS+nRk2UNwCDFQn//kMsV+PYKXz9ECfMjvdFnnYLoszLrUE8YE46xQmm0/Pm t2+zYEQlYnHBdLn67jRgimRSz55V6qosC1JcSO00MnceLDGVbkjL7vxpyHIW0Qy4J4FJ 5bug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=u+TfPuuT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170902ec8600b0016efde92292si20902322plg.255.2022.10.19.01.44.29; Wed, 19 Oct 2022 01:44: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=u+TfPuuT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231228AbiJSInk (ORCPT + 99 others); Wed, 19 Oct 2022 04:43:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230357AbiJSIm4 (ORCPT ); Wed, 19 Oct 2022 04:42:56 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30DAD248C4; Wed, 19 Oct 2022 01:40:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 24CC6B822CE; Wed, 19 Oct 2022 08:39:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 734A4C433D6; Wed, 19 Oct 2022 08:39:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168796; bh=H8BgRzjL1+2W+ogrWJW1r8i0ST+WS7ejeg1DeAkqdLI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u+TfPuuT6ZyPqaTlxDBPfq6Y7OOlmziG/L6LoVY3qse3FQgPVk1hsqmInEbP7/np2 3tIuJa+9vbviqzxM9d5rcr/r5hQ38yXNB6dVZmaDVt3w9b7SyqifzYjLz/jCJJEqKx l7rTP1rePa7X18/OduTLjyg2yR9K+j5CUFSmzuMA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brice Goglin , Sudeep Holla , Atish Patra , Conor Dooley Subject: [PATCH 6.0 056/862] riscv: topology: fix default topology reporting Date: Wed, 19 Oct 2022 10:22:23 +0200 Message-Id: <20221019083252.457314325@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104912941243022?= X-GMAIL-MSGID: =?utf-8?q?1747104912941243022?= From: Conor Dooley commit fbd92809997a391f28075f1c8b5ee314c225557c upstream. RISC-V has no sane defaults to fall back on where there is no cpu-map in the devicetree. Without sane defaults, the package, core and thread IDs are all set to -1. This causes user-visible inaccuracies for tools like hwloc/lstopo which rely on the sysfs cpu topology files to detect a system's topology. On a PolarFire SoC, which should have 4 harts with a thread each, lstopo currently reports: Machine (793MB total) Package L#0 NUMANode L#0 (P#0 793MB) Core L#0 L1d L#0 (32KB) + L1i L#0 (32KB) + PU L#0 (P#0) L1d L#1 (32KB) + L1i L#1 (32KB) + PU L#1 (P#1) L1d L#2 (32KB) + L1i L#2 (32KB) + PU L#2 (P#2) L1d L#3 (32KB) + L1i L#3 (32KB) + PU L#3 (P#3) Adding calls to store_cpu_topology() in {boot,smp} hart bringup code results in the correct topolgy being reported: Machine (793MB total) Package L#0 NUMANode L#0 (P#0 793MB) L1d L#0 (32KB) + L1i L#0 (32KB) + Core L#0 + PU L#0 (P#0) L1d L#1 (32KB) + L1i L#1 (32KB) + Core L#1 + PU L#1 (P#1) L1d L#2 (32KB) + L1i L#2 (32KB) + Core L#2 + PU L#2 (P#2) L1d L#3 (32KB) + L1i L#3 (32KB) + Core L#3 + PU L#3 (P#3) CC: stable@vger.kernel.org # 456797da792f: arm64: topology: move store_cpu_topology() to shared code Fixes: 03f11f03dbfe ("RISC-V: Parse cpu topology during boot.") Reported-by: Brice Goglin Link: https://github.com/open-mpi/hwloc/issues/536 Reviewed-by: Sudeep Holla Reviewed-by: Atish Patra Signed-off-by: Conor Dooley Signed-off-by: Greg Kroah-Hartman --- arch/riscv/Kconfig | 2 +- arch/riscv/kernel/smpboot.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -52,7 +52,7 @@ config RISCV select COMMON_CLK select CPU_PM if CPU_IDLE select EDAC_SUPPORT - select GENERIC_ARCH_TOPOLOGY if SMP + select GENERIC_ARCH_TOPOLOGY select GENERIC_ATOMIC64 if !64BIT select GENERIC_CLOCKEVENTS_BROADCAST if SMP select GENERIC_EARLY_IOREMAP --- a/arch/riscv/kernel/smpboot.c +++ b/arch/riscv/kernel/smpboot.c @@ -49,6 +49,7 @@ void __init smp_prepare_cpus(unsigned in unsigned int curr_cpuid; curr_cpuid = smp_processor_id(); + store_cpu_topology(curr_cpuid); numa_store_cpu_info(curr_cpuid); numa_add_cpu(curr_cpuid); @@ -162,9 +163,9 @@ asmlinkage __visible void smp_callin(voi mmgrab(mm); current->active_mm = mm; + store_cpu_topology(curr_cpuid); notify_cpu_starting(curr_cpuid); numa_add_cpu(curr_cpuid); - update_siblings_masks(curr_cpuid); set_cpu_online(curr_cpuid, 1); /* From patchwork Wed Oct 19 08:22: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: 4539 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp204049wrs; Wed, 19 Oct 2022 01:44:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5whUVs3cfLpKAPSN26Yt3nOkVGshRyrwx9QE6xR2GbxtJOYnRZ7xZJlJvym5IT5yPh45zD X-Received: by 2002:a05:6a00:1145:b0:52b:78c:fa26 with SMTP id b5-20020a056a00114500b0052b078cfa26mr7342135pfm.27.1666169092415; Wed, 19 Oct 2022 01:44:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169092; cv=none; d=google.com; s=arc-20160816; b=SxI7sI0PcRFKY6opPsq7bUTwPaTYuGNJmJe6xzHHZgdcAVJamwCWogHoTq83lLLHmc ZN3xZNKLQWmZVJhVof3eQ8weK3SDfzABPOapQMPXrhBZ+yAMPEtOpRWcMu4iqSP3u7Zj ZIaRqK/Xq8pjo2mMgRusV2EEMYgmridFFUCXgk0wFu0OQqbfYCN/DwwTbD8yyPNCMxaG TKiis0iPo0Ps/hz8EH/ngp0tY0SKY8Xr/g3QDwVB1HD/AL4NcB3y378BElazuvtUREKL Uj712qPDqU4Q26K8OPefiMbxMJtE5BvC2IYSYX1oS/83pIJPwGjaUiYdJsBSuXsZYdRa 8trA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=E2ZdVVJRfoEsYsWUfZZAO6YyE2qPJxRAf6engqdE5b8=; b=nRlYZhDlJEL6KYjYjYcRorvZ0E7lm09BcG224GZmlCRDE+F/rFwmh0eh2RLHePAN17 SvfIK4FJAqOnuRs4KEdCzUVhSGgXA1wOa/vfJAl06d0x9I219qG1R7TdcYADDGcMTTbK DHrFhSmm205HuCfLsbvklr9W2kwhViXhqeGnL2KKM4mAGuIVarQEteWkmVkgTkv8RkzW qozm+rW1NHao0kOL5UjZScQLsj4NSzhS3PIFDYpYdSAkc9Y7Si1p5IYvlCbV1svIUYyB DysEfQzPRgLEkPTGuiZIvUSESEjxQqjHN/gWk+sPPaeie7cnYVj1Qprmw6KRtqd20o68 fvLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QJCsbt6+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 26-20020a63185a000000b0043949ac7067si18162716pgy.200.2022.10.19.01.44.39; Wed, 19 Oct 2022 01:44: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=QJCsbt6+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231317AbiJSIn5 (ORCPT + 99 others); Wed, 19 Oct 2022 04:43:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230137AbiJSIm7 (ORCPT ); Wed, 19 Oct 2022 04:42:59 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D75A57B78A; Wed, 19 Oct 2022 01:40:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 76085CE20F0; Wed, 19 Oct 2022 08:40:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B56DC433D7; Wed, 19 Oct 2022 08:39:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168799; bh=TZQmwUKjFwQPzZOwmCSzDveGHxx/GcI5wz6rikE8fwo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QJCsbt6+3OilC9R3C7CDNUbdslBBG9tANbqpu3yUfXpVDYaNwipjrHE1ddy9uW7SF 8fuVDZPJ4oQPKkgslS/Kh5rAMDj7TUYvZK0eROaYbNuziVJ4qxEbLWd20S1UsS217j QbDG28tJdHcCrbhfUE+8CLWtw8NQ8TfdAWxJF+a8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Conor Dooley , Palmer Dabbelt Subject: [PATCH 6.0 057/862] RISC-V: Re-enable counter access from userspace Date: Wed, 19 Oct 2022 10:22:24 +0200 Message-Id: <20221019083252.507436677@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104922318144523?= X-GMAIL-MSGID: =?utf-8?q?1747104922318144523?= From: Palmer Dabbelt commit 5a5294fbe0200d1327f0e089135dad77b45aa2ee upstream. These counters were part of the ISA when we froze the uABI, removing them breaks userspace. Link: https://lore.kernel.org/all/YxEhC%2FmDW1lFt36J@aurel32.net/ Fixes: e9991434596f ("RISC-V: Add perf platform driver based on SBI PMU extension") Tested-by: Conor Dooley Reviewed-by: Conor Dooley Link: https://lore.kernel.org/r/20220928131807.30386-1-palmer@rivosinc.com Cc: stable@vger.kernel.org Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman --- drivers/perf/riscv_pmu_sbi.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- a/drivers/perf/riscv_pmu_sbi.c +++ b/drivers/perf/riscv_pmu_sbi.c @@ -645,8 +645,11 @@ static int pmu_sbi_starting_cpu(unsigned struct riscv_pmu *pmu = hlist_entry_safe(node, struct riscv_pmu, node); struct cpu_hw_events *cpu_hw_evt = this_cpu_ptr(pmu->hw_events); - /* Enable the access for TIME csr only from the user mode now */ - csr_write(CSR_SCOUNTEREN, 0x2); + /* + * Enable the access for CYCLE, TIME, and INSTRET CSRs from userspace, + * as is necessary to maintain uABI compatibility. + */ + csr_write(CSR_SCOUNTEREN, 0x7); /* Stop all the counters so that they can be enabled from perf */ pmu_sbi_stop_all(pmu); From patchwork Wed Oct 19 08:22: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: 4543 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp204188wrs; Wed, 19 Oct 2022 01:45:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4cvYvekbbPHcklZSbds6GBT1vwHG0R3ZKGWs+1Ie/sJIdcQp6izOrE0837QOVjPshCkv5+ X-Received: by 2002:a17:902:be0b:b0:182:fd6:1293 with SMTP id r11-20020a170902be0b00b001820fd61293mr7351017pls.146.1666169121824; Wed, 19 Oct 2022 01:45:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169121; cv=none; d=google.com; s=arc-20160816; b=q5aapQHWEPm4Aasu/GfrK4zm3JM6gfAn1nimXxagADCtlzG969EiL/krXSmoZvckwU 1RjYIOiKz+X9107A6CxSe6ksNBquKLN+Hyi/vY0f8aNhW2i3nTlRUqXkg9fg9T8FXQHd sXO0lB43TQIPKFMKHe9Spt6K1Bq08ORT/ID3K4l2Ra5jkIo+YmLg8/ssxRbzFCAFsjEz vRPUpLjXFl1E8nWtDFnSpMtYXphllmMwpewaii1edff8Q5nz6Q83m6YDcqE5ZA13pKxA wNYCodC9203UDTuLVYZPY8GCZpOBdgjwI+hvXqnoIqm1jXUX0wEHa2dptS88sNHEokAq u5mA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0kv6cKgPHmHdPEBX0NttZpZ4pqU7Dh3TYoY5pk/re3c=; b=BrBjb7GYOKwVOTqkCTN060YDPPi3s8mg9gcACCLa+rmVrrBHunQjKf7kJLM+cCYbL8 Wyltw4YKc33nwDrWbv4poGzH0bxz04GvNMZdv50OAdI5affSkYMgLbpAfNO2oTggkPZ3 PNCAvyBGplN9hKhzYx2mcSu9+dbZnumq6YUHhQ6zilTwWuljfisARXDSiVKwV8ItWs9m Rax9ePA0mxy08YeNOnbuF5IqZTBXnibYGWCa+huPiwfgidIdWg6E2gfHCtOh5SUHn02H I3S+T40AcYPGUVzGa+Nfv/1tjhE4xxSS88ZUmxYBJ7/KonNS8ZO4nhSqsi3E/vdgbyzN 8Z8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wri5M4Ru; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170902ea8600b001853ad3944dsi16623580plb.480.2022.10.19.01.45.07; Wed, 19 Oct 2022 01:45:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wri5M4Ru; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231223AbiJSIok (ORCPT + 99 others); Wed, 19 Oct 2022 04:44:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231217AbiJSIng (ORCPT ); Wed, 19 Oct 2022 04:43:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A5DE868B2; Wed, 19 Oct 2022 01:40:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 25E00B821CD; Wed, 19 Oct 2022 08:40:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63765C433D6; Wed, 19 Oct 2022 08:40:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168805; bh=SlhrStvTgx3c8uQcJilQEUVVLx+czvdw+gcouuyd9TU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wri5M4Rue05PfX0mJDQ+Y7SnjnRT7dIuO2w4BZX2a4YOdghCEM1tAm7xX2fRmq9mc vrcIOkw0tJS9KiIaxxGy8pweDyJb0Dkg2O1zkAese3zIogczGP5/aVE2C6SgrULq4m PvD3X4IwNucQ2+gNUIdIzKkkHrz51cCMHWSKViK0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Maciej W. Rozycki" , Arnd Bergmann , Palmer Dabbelt Subject: [PATCH 6.0 058/862] RISC-V: Make port I/O string accessors actually work Date: Wed, 19 Oct 2022 10:22:25 +0200 Message-Id: <20221019083252.552791408@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104953274196664?= X-GMAIL-MSGID: =?utf-8?q?1747104953274196664?= From: Maciej W. Rozycki commit 9cc205e3c17d5716da7ebb7fa0c985555e95d009 upstream. Fix port I/O string accessors such as `insb', `outsb', etc. which use the physical PCI port I/O address rather than the corresponding memory mapping to get at the requested location, which in turn breaks at least accesses made by our parport driver to a PCIe parallel port such as: PCI parallel port detected: 1415:c118, I/O at 0x1000(0x1008), IRQ 20 parport0: PC-style at 0x1000 (0x1008), irq 20, using FIFO [PCSPP,TRISTATE,COMPAT,EPP,ECP] causing a memory access fault: Unable to handle kernel access to user memory without uaccess routines at virtual address 0000000000001008 Oops [#1] Modules linked in: CPU: 1 PID: 350 Comm: cat Not tainted 6.0.0-rc2-00283-g10d4879f9ef0-dirty #23 Hardware name: SiFive HiFive Unmatched A00 (DT) epc : parport_pc_fifo_write_block_pio+0x266/0x416 ra : parport_pc_fifo_write_block_pio+0xb4/0x416 epc : ffffffff80542c3e ra : ffffffff80542a8c sp : ffffffd88899fc60 gp : ffffffff80fa2700 tp : ffffffd882b1e900 t0 : ffffffd883d0b000 t1 : ffffffffff000002 t2 : 4646393043330a38 s0 : ffffffd88899fcf0 s1 : 0000000000001000 a0 : 0000000000000010 a1 : 0000000000000000 a2 : ffffffd883d0a010 a3 : 0000000000000023 a4 : 00000000ffff8fbb a5 : ffffffd883d0a001 a6 : 0000000100000000 a7 : ffffffc800000000 s2 : ffffffffff000002 s3 : ffffffff80d28880 s4 : ffffffff80fa1f50 s5 : 0000000000001008 s6 : 0000000000000008 s7 : ffffffd883d0a000 s8 : 0004000000000000 s9 : ffffffff80dc1d80 s10: ffffffd8807e4000 s11: 0000000000000000 t3 : 00000000000000ff t4 : 393044410a303930 t5 : 0000000000001000 t6 : 0000000000040000 status: 0000000200000120 badaddr: 0000000000001008 cause: 000000000000000f [] parport_pc_compat_write_block_pio+0xfe/0x200 [] parport_write+0x46/0xf8 [] lp_write+0x158/0x2d2 [] vfs_write+0x8e/0x2c2 [] ksys_write+0x52/0xc2 [] sys_write+0xe/0x16 [] ret_from_syscall+0x0/0x2 ---[ end trace 0000000000000000 ]--- For simplicity address the problem by adding PCI_IOBASE to the physical address requested in the respective wrapper macros only, observing that the raw accessors such as `__insb', `__outsb', etc. are not supposed to be used other than by said macros. Remove the cast to `long' that is no longer needed on `addr' now that it is used as an offset from PCI_IOBASE and add parentheses around `addr' needed for predictable evaluation in macro expansion. No need to make said adjustments in separate changes given that current code is gravely broken and does not ever work. Signed-off-by: Maciej W. Rozycki Fixes: fab957c11efe2 ("RISC-V: Atomic and Locking Code") Cc: stable@vger.kernel.org # v4.15+ Reviewed-by: Arnd Bergmann Link: https://lore.kernel.org/r/alpine.DEB.2.21.2209220223080.29493@angie.orcam.me.uk Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman --- arch/riscv/include/asm/io.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) --- a/arch/riscv/include/asm/io.h +++ b/arch/riscv/include/asm/io.h @@ -101,9 +101,9 @@ __io_reads_ins(reads, u32, l, __io_br(), __io_reads_ins(ins, u8, b, __io_pbr(), __io_par(addr)) __io_reads_ins(ins, u16, w, __io_pbr(), __io_par(addr)) __io_reads_ins(ins, u32, l, __io_pbr(), __io_par(addr)) -#define insb(addr, buffer, count) __insb((void __iomem *)(long)addr, buffer, count) -#define insw(addr, buffer, count) __insw((void __iomem *)(long)addr, buffer, count) -#define insl(addr, buffer, count) __insl((void __iomem *)(long)addr, buffer, count) +#define insb(addr, buffer, count) __insb(PCI_IOBASE + (addr), buffer, count) +#define insw(addr, buffer, count) __insw(PCI_IOBASE + (addr), buffer, count) +#define insl(addr, buffer, count) __insl(PCI_IOBASE + (addr), buffer, count) __io_writes_outs(writes, u8, b, __io_bw(), __io_aw()) __io_writes_outs(writes, u16, w, __io_bw(), __io_aw()) @@ -115,22 +115,22 @@ __io_writes_outs(writes, u32, l, __io_bw __io_writes_outs(outs, u8, b, __io_pbw(), __io_paw()) __io_writes_outs(outs, u16, w, __io_pbw(), __io_paw()) __io_writes_outs(outs, u32, l, __io_pbw(), __io_paw()) -#define outsb(addr, buffer, count) __outsb((void __iomem *)(long)addr, buffer, count) -#define outsw(addr, buffer, count) __outsw((void __iomem *)(long)addr, buffer, count) -#define outsl(addr, buffer, count) __outsl((void __iomem *)(long)addr, buffer, count) +#define outsb(addr, buffer, count) __outsb(PCI_IOBASE + (addr), buffer, count) +#define outsw(addr, buffer, count) __outsw(PCI_IOBASE + (addr), buffer, count) +#define outsl(addr, buffer, count) __outsl(PCI_IOBASE + (addr), buffer, count) #ifdef CONFIG_64BIT __io_reads_ins(reads, u64, q, __io_br(), __io_ar(addr)) #define readsq(addr, buffer, count) __readsq(addr, buffer, count) __io_reads_ins(ins, u64, q, __io_pbr(), __io_par(addr)) -#define insq(addr, buffer, count) __insq((void __iomem *)addr, buffer, count) +#define insq(addr, buffer, count) __insq(PCI_IOBASE + (addr), buffer, count) __io_writes_outs(writes, u64, q, __io_bw(), __io_aw()) #define writesq(addr, buffer, count) __writesq(addr, buffer, count) __io_writes_outs(outs, u64, q, __io_pbr(), __io_paw()) -#define outsq(addr, buffer, count) __outsq((void __iomem *)addr, buffer, count) +#define outsq(addr, buffer, count) __outsq(PCI_IOBASE + (addr), buffer, count) #endif #include From patchwork Wed Oct 19 08:22: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: 4542 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp204158wrs; Wed, 19 Oct 2022 01:45:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7fUjhqDLoiFfvx5E9Lb/NBoH2SlnjcDkFN7vSRryXqLHM2O5P6I7jQ2Kgy/URacxFu0eMo X-Received: by 2002:a05:6a00:1a92:b0:565:d5c0:f627 with SMTP id e18-20020a056a001a9200b00565d5c0f627mr7623416pfv.10.1666169115024; Wed, 19 Oct 2022 01:45:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169115; cv=none; d=google.com; s=arc-20160816; b=dC/pC9XWlOBo+2isuWFAtCjZY9RSkLhFVZWrAnTwnWLXPKbnvdiAPdw7SazQkU4fNq MjOFGpIk7rfWw5+YiSen/RavdMW8ay4q4H9kOZrirTFpx4sl2+MraAn1N22cv10GIdQc HuruqDnXmk4fVvuSQ2DHdVa7N3w+YCOoKYD60QT37SmZbAqa3eJiz5LPc6WEw4wsdINs Q/N7qja8FuxDSzf3RsIqjHxbAmdMx8lXvWxpzREhjngPKY+vk149koQNcZ0QCaMVuH2C UWfrRSQHimcmL9mAil3K4wl1R5nNPJkFqXrJ3MvYzNQM8PS1fx1jQGIm9uuCb8OE6CVF d4iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hBOXftv2TRYcUUsb8yOfh9Dw6hTrr1Ks6JvwCRYYDtY=; b=A2L+tvEWfrKpdsAwUPFMgXTQ4J51Ns98I06Lt8ENUWFUTbnnFzdYnXUunUkBRj3hi2 c7kfizSsR0GF1UUblA6UcBPsc2B6xS6qN08rCblaipLsi0DqMoxMQG0OMTKlw1J9uaLb LftUwdah3Lyfop/g8vXtbskAhEhHPCOZH9X7NeVMwEuSsPBCRVoVt4/oEdLnmsVCgqRn WvJ90/xVxikYL8xleTH6U5TzpzlIT9MefloIiK3cXbz9MABuyoZbxeLiuvnB7j1HS/L1 zmYUzdKIxuf5wkEeFSaBTJs/MKu7YdDLPIxkeT9R7e/ZrYBnYqEzC6umZgvF4GPebM5y 0d/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fmn6jq2A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w7-20020a170902e88700b0017a0d1d072dsi18812374plg.336.2022.10.19.01.45.00; Wed, 19 Oct 2022 01:45: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=fmn6jq2A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231247AbiJSIon (ORCPT + 99 others); Wed, 19 Oct 2022 04:44:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231124AbiJSInj (ORCPT ); Wed, 19 Oct 2022 04:43:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23BCA5789B; Wed, 19 Oct 2022 01:41: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 ECC3CB822D1; Wed, 19 Oct 2022 08:40:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2CB61C433C1; Wed, 19 Oct 2022 08:40:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168808; bh=FP0+Py/xiye3Lrwe1PTtluLDiVfZV2Fz/lWJUEeXaKY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fmn6jq2A+XoRka7PbxJlU23AYEF1oknkna+E6WLZ+K1th0EypeBP/TYgHIrBJWA88 u2cw14Czj1fIpK8lGT1Tq/yPApQOC/gLkj/xmFuvx7fKvAhrM6ZmaUavl4N6zcB8qY zWDQ+BwCf13m0K+UXyUW9BBGmzrPUZktsXJm/RsM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Helge Deller Subject: [PATCH 6.0 059/862] parisc: fbdev/stifb: Align graphics memory size to 4MB Date: Wed, 19 Oct 2022 10:22:26 +0200 Message-Id: <20221019083252.585903812@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104945575831008?= X-GMAIL-MSGID: =?utf-8?q?1747104945575831008?= 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 @@ -1298,7 +1298,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 Wed Oct 19 08:22: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: 4540 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp204080wrs; Wed, 19 Oct 2022 01:44:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7T769USMvFLGYhunZiXh200IJiBIiid3oc47GbRixLqahLDbpK9qwuMlGcNG6ppYxpCbUK X-Received: by 2002:a17:902:7c8c:b0:17f:7565:4a2d with SMTP id y12-20020a1709027c8c00b0017f75654a2dmr7496327pll.65.1666169096322; Wed, 19 Oct 2022 01:44:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169096; cv=none; d=google.com; s=arc-20160816; b=OozL30WpI/e/Bi9/cI6kxAQ1R3iGivE2h6vOUCeRHBEZ3r6izbw8/hc6zfIsEwBMLG UCUA+HYhPjJI0DCXcGnw0lyKZQjXrJYhHUQarfgqe0ExZdWAVN+zpAqdR0eVbPQdqtgx fCn4xRtPyk3ti6a5aKjuY1JnLVOFXYphchMNaA5r4tRSNfDpAc2cgMoV+dduo9styjd1 q2FQY2KeR7dEAbZsdF9VXMq36fNUlV5Bx01/+6HI4Hd8ny39zl641atXIDxLNvQS3bxH EgdckoUvZ8fzIwnexH0LFiOvFXvq3CKu+julFZtTfskWicqoQjtFNhGAQac32fQdvFVq rC0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wmv422MCiy74LRydq0A1Gsjax5JTZYnSkqYnZZomJwE=; b=HyKKVc9gmFZehlhGK8q7ii3SJagOsV0ocbk9wcvw9l85gEoApOnZIDRECnUzo2uP0h sHDF+/0RJqj9A1TG2X2MWVqkYu0bim/R0x6VGG53OthR56injinGohAzE+xuEL/gx7V3 n5eGKtRE60HEDIuCG/O/prBom+xRwVwD9njuynk+B/iSl4tyhcsgOcFOgISrwhUrbld6 Qq243yN3yWR1gpre4Q4i75OFZ206EKmlCrDIohRk2HIwYBSGF7zUM0r2rNUe2JgDBN/s RIeGKu6Qt77ObEUBQs6UP0T8e1HpUiKc4HiHTSkK5et5UaND7nDJEMfeQwjGPWewOu9v GuPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GNUix2Gz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c23-20020a170902849700b00182140f0836si16381183plo.459.2022.10.19.01.44.43; Wed, 19 Oct 2022 01:44: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=GNUix2Gz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230457AbiJSIo3 (ORCPT + 99 others); Wed, 19 Oct 2022 04:44:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230404AbiJSInB (ORCPT ); Wed, 19 Oct 2022 04:43: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 B200383F29; Wed, 19 Oct 2022 01:40: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 ams.source.kernel.org (Postfix) with ESMTPS id ED066B822D6; Wed, 19 Oct 2022 08:40:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4DA6FC433C1; Wed, 19 Oct 2022 08:40:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168811; bh=Y4qDb4mZNU20ip9zLWEr74fGK+TtVytsTmrTYBy7Its=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GNUix2Gzre1p4Enrfo82bU/uU6vYpnuXGXaWRlM36ZigXgxJGD/oHS6Kzck9kO6m7 hi5v7PUbMBSSMgvjVbn9g8c1quH4uo5zp51NpZG3X6Bn4CFRLu/I447/TY6/xfF33k vXP9nhV1D3P4TZze9ofJYpPAGMMmYErHtrni3f5I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Helge Deller Subject: [PATCH 6.0 060/862] parisc: Fix userspace graphics card breakage due to pgtable special bit Date: Wed, 19 Oct 2022 10:22:27 +0200 Message-Id: <20221019083252.617341641@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104926328963049?= X-GMAIL-MSGID: =?utf-8?q?1747104926328963049?= From: Helge Deller commit 70be49f2f6223ddd2fcddb0089a40864c37e1494 upstream. Commit df24e1783e6e ("parisc: Add vDSO support") introduced the vDSO support, for which a _PAGE_SPECIAL page table flag was needed. Since we wanted to keep every page table entry in 32-bits, this patch re-used the existing - but yet unused - _PAGE_DMB flag (which triggers a hardware break if a page is accessed) to store the special bit. But when graphics card memory is mmapped into userspace, the kernel uses vm_iomap_memory() which sets the the special flag. So, with the DMB bit set, every access to the graphics memory now triggered a hardware exception and segfaulted the userspace program. Fix this breakage by dropping the DMB bit when writing the page protection bits to the CPU TLB. In addition this patch adds a small optimization: if huge pages aren't configured (which is at least the case for 32-bit kernels), then the special bit is stored in the hpage (HUGE PAGE) bit instead. That way we can skip to reset the DMB bit. Fixes: df24e1783e6e ("parisc: Add vDSO support") Cc: # 5.18+ Signed-off-by: Helge Deller Signed-off-by: Greg Kroah-Hartman --- arch/parisc/include/asm/pgtable.h | 7 ++++++- arch/parisc/kernel/entry.S | 8 ++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) --- a/arch/parisc/include/asm/pgtable.h +++ b/arch/parisc/include/asm/pgtable.h @@ -192,6 +192,11 @@ extern void __update_cache(pte_t pte); #define _PAGE_PRESENT_BIT 22 /* (0x200) Software: translation valid */ #define _PAGE_HPAGE_BIT 21 /* (0x400) Software: Huge Page */ #define _PAGE_USER_BIT 20 /* (0x800) Software: User accessible page */ +#ifdef CONFIG_HUGETLB_PAGE +#define _PAGE_SPECIAL_BIT _PAGE_DMB_BIT /* DMB feature is currently unused */ +#else +#define _PAGE_SPECIAL_BIT _PAGE_HPAGE_BIT /* use unused HUGE PAGE bit */ +#endif /* N.B. The bits are defined in terms of a 32 bit word above, so the */ /* following macro is ok for both 32 and 64 bit. */ @@ -219,7 +224,7 @@ extern void __update_cache(pte_t pte); #define _PAGE_PRESENT (1 << xlate_pabit(_PAGE_PRESENT_BIT)) #define _PAGE_HUGE (1 << xlate_pabit(_PAGE_HPAGE_BIT)) #define _PAGE_USER (1 << xlate_pabit(_PAGE_USER_BIT)) -#define _PAGE_SPECIAL (_PAGE_DMB) +#define _PAGE_SPECIAL (1 << xlate_pabit(_PAGE_SPECIAL_BIT)) #define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | _PAGE_DIRTY | _PAGE_ACCESSED) #define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_SPECIAL) --- a/arch/parisc/kernel/entry.S +++ b/arch/parisc/kernel/entry.S @@ -499,6 +499,10 @@ * Finally, _PAGE_READ goes in the top bit of PL1 (so we * trigger an access rights trap in user space if the user * tries to read an unreadable page */ +#if _PAGE_SPECIAL_BIT == _PAGE_DMB_BIT + /* need to drop DMB bit, as it's used as SPECIAL flag */ + depi 0,_PAGE_SPECIAL_BIT,1,\pte +#endif depd \pte,8,7,\prot /* PAGE_USER indicates the page can be read with user privileges, @@ -529,6 +533,10 @@ * makes the tlb entry for the differently formatted pa11 * insertion instructions */ .macro make_insert_tlb_11 spc,pte,prot +#if _PAGE_SPECIAL_BIT == _PAGE_DMB_BIT + /* need to drop DMB bit, as it's used as SPECIAL flag */ + depi 0,_PAGE_SPECIAL_BIT,1,\pte +#endif zdep \spc,30,15,\prot dep \pte,8,7,\prot extru,= \pte,_PAGE_NO_CACHE_BIT,1,%r0 From patchwork Wed Oct 19 08:22: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: 4541 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp204106wrs; Wed, 19 Oct 2022 01:45:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7xj63aXuWmIOLi3Y6kFv+n7N/US2XmE+3fcs/knbo7vh0uc9YIj/wa7lHCarXfRyhS5ocW X-Received: by 2002:a17:90a:c09:b0:20d:7820:2e60 with SMTP id 9-20020a17090a0c0900b0020d78202e60mr42416953pjs.180.1666169103014; Wed, 19 Oct 2022 01:45:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169103; cv=none; d=google.com; s=arc-20160816; b=GZfVXNX9X6BdlYEZFDPYbNwEi34pc+PweQtMgyZZmkcLOdLz7btMItOrkbhjeJGwqk Kq/zMFoecz36Gf5mNhi/M8uQFc3QNE2Ab19tzHlIMFM2BG0gvQjjFid4cU3DVgNkGwc/ AjFuGotLDAGQh0qhd09PWQA25PyMjhglbYVv9HflfEw+ZG7TRd/sPSVYkh/VWgWUEC9O 9uL0ABx7WagNzb5xIL4IYL2qR4m/R2VCdpUii0rTiEBt98CyeQAP33tEAjuF6bJu9KkF ePPiVXD9BY5o+J0Cf+F2wlj+k3mCIgp9R1bi5mnLdhjH/DrzxZmmdcUiFeL3HHfo31LL q4tQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0yeKGAIcH/PnqD9ZjS7C8Kq7oyHCBz76xAXV0kd+apM=; b=rLYLhlw+53DupLo4bPJxGbgW4SRaJRyEsKZWSbF4IeU1Fuab1WO1jP3LZcSsQ1/H4b itCsQbwEF9JW3mN+YqAztWCYw1K03xx6LP60Xb9RgBM4NGB56zP82YuKjo0f3PC6WE78 PsH7c8ql0IHPsm5cqA4zknCuueiNyTpjdREqWiX8SZPPkFW/5BpdiTUeZkfPd1AkUSoe 1uCUjYjC7FncJKYDyMPt3OlzQrLC+EOkVYghdkl9TEoeYz4Mz9Xeizyhoj7RO71PkbmN fv0abSNFXqCLHBI+PaPUPqsbNDH2op/WuijMUwtQ7XG0mQ2z+SD4yfcE41ywKtC/KlFP WR8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YG+gze75; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n26-20020a63971a000000b0043c2e57961asi17312104pge.799.2022.10.19.01.44.49; Wed, 19 Oct 2022 01:45: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=YG+gze75; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231181AbiJSIof (ORCPT + 99 others); Wed, 19 Oct 2022 04:44:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231184AbiJSInN (ORCPT ); Wed, 19 Oct 2022 04:43:13 -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 E7F3B1743B; Wed, 19 Oct 2022 01: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 dfw.source.kernel.org (Postfix) with ESMTPS id 0B87F617E3; Wed, 19 Oct 2022 08:40:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B36FC4347C; Wed, 19 Oct 2022 08:40:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168814; bh=0xP8NJZRqFkAmh8Wb9Hjt2svBmJ+r6ZSDULnSavJM7Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YG+gze757dmKqYlgI0Dcvt4po/t3Y0Yt60x6FPY2d3h02611s48j5uHJY5yzs5AYD 0BfT7Aj+riL/+Dubyi3gD3bZBKbPRWBgiyCqqcWIPLjLrQa2kp/kQKi2XGylEjJTbL 7Vsz8P9PdhPO6fSgSyhmDcUlJdhlnQ0onykd6tfI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jisheng Zhang , Palmer Dabbelt Subject: [PATCH 6.0 061/862] riscv: vdso: fix NULL deference in vdso_join_timens() when vfork Date: Wed, 19 Oct 2022 10:22:28 +0200 Message-Id: <20221019083252.656779179@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104933591676413?= X-GMAIL-MSGID: =?utf-8?q?1747104933591676413?= From: Jisheng Zhang commit a8616d2dc193b6becc36b5f3cfeaa9ac7a5762f9 upstream. Testing tools/testing/selftests/timens/vfork_exec.c got below kernel log: [ 6.838454] Unable to handle kernel access to user memory without uaccess routines at virtual address 0000000000000020 [ 6.842255] Oops [#1] [ 6.842871] Modules linked in: [ 6.844249] CPU: 1 PID: 64 Comm: vfork_exec Not tainted 6.0.0-rc3-rt15+ #8 [ 6.845861] Hardware name: riscv-virtio,qemu (DT) [ 6.848009] epc : vdso_join_timens+0xd2/0x110 [ 6.850097] ra : vdso_join_timens+0xd2/0x110 [ 6.851164] epc : ffffffff8000635c ra : ffffffff8000635c sp : ff6000000181fbf0 [ 6.852562] gp : ffffffff80cff648 tp : ff60000000fdb700 t0 : 3030303030303030 [ 6.853852] t1 : 0000000000000030 t2 : 3030303030303030 s0 : ff6000000181fc40 [ 6.854984] s1 : ff60000001e6c000 a0 : 0000000000000010 a1 : ffffffff8005654c [ 6.856221] a2 : 00000000ffffefff a3 : 0000000000000000 a4 : 0000000000000000 [ 6.858114] a5 : 0000000000000000 a6 : 0000000000000008 a7 : 0000000000000038 [ 6.859484] s2 : ff60000001e6c068 s3 : ff6000000108abb0 s4 : 0000000000000000 [ 6.860751] s5 : 0000000000001000 s6 : ffffffff8089dc40 s7 : ffffffff8089dc38 [ 6.862029] s8 : ffffffff8089dc30 s9 : ff60000000fdbe38 s10: 000000000000005e [ 6.863304] s11: ffffffff80cc3510 t3 : ffffffff80d1112f t4 : ffffffff80d1112f [ 6.864565] t5 : ffffffff80d11130 t6 : ff6000000181fa00 [ 6.865561] status: 0000000000000120 badaddr: 0000000000000020 cause: 000000000000000d [ 6.868046] [] timens_commit+0x38/0x11a [ 6.869089] [] timens_on_fork+0x72/0xb4 [ 6.870055] [] begin_new_exec+0x3c6/0x9f0 [ 6.871231] [] load_elf_binary+0x628/0x1214 [ 6.872304] [] bprm_execve+0x1f2/0x4e4 [ 6.873243] [] do_execveat_common+0x16e/0x1ee [ 6.874258] [] sys_execve+0x3c/0x48 [ 6.875162] [] ret_from_syscall+0x0/0x2 [ 6.877484] ---[ end trace 0000000000000000 ]--- This is because the mm->context.vdso_info is NULL in vfork case. From another side, mm->context.vdso_info either points to vdso info for RV64 or vdso info for compat, there's no need to bloat riscv's mm_context_t, we can handle the difference when setup the additional page for vdso. Signed-off-by: Jisheng Zhang Suggested-by: Palmer Dabbelt Fixes: 3092eb456375 ("riscv: compat: vdso: Add setup additional pages implementation") Link: https://lore.kernel.org/r/20220924070737.3048-1-jszhang@kernel.org Cc: stable@vger.kernel.org Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman --- arch/riscv/include/asm/mmu.h | 1 - arch/riscv/kernel/vdso.c | 13 ++++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) --- a/arch/riscv/include/asm/mmu.h +++ b/arch/riscv/include/asm/mmu.h @@ -16,7 +16,6 @@ typedef struct { atomic_long_t id; #endif void *vdso; - void *vdso_info; #ifdef CONFIG_SMP /* A local icache flush is needed before user execution can resume. */ cpumask_t icache_stale_mask; --- a/arch/riscv/kernel/vdso.c +++ b/arch/riscv/kernel/vdso.c @@ -60,6 +60,11 @@ struct __vdso_info { struct vm_special_mapping *cm; }; +static struct __vdso_info vdso_info; +#ifdef CONFIG_COMPAT +static struct __vdso_info compat_vdso_info; +#endif + static int vdso_mremap(const struct vm_special_mapping *sm, struct vm_area_struct *new_vma) { @@ -114,15 +119,18 @@ int vdso_join_timens(struct task_struct { struct mm_struct *mm = task->mm; struct vm_area_struct *vma; - struct __vdso_info *vdso_info = mm->context.vdso_info; mmap_read_lock(mm); for (vma = mm->mmap; vma; vma = vma->vm_next) { unsigned long size = vma->vm_end - vma->vm_start; - if (vma_is_special_mapping(vma, vdso_info->dm)) + if (vma_is_special_mapping(vma, vdso_info.dm)) zap_page_range(vma, vma->vm_start, size); +#ifdef CONFIG_COMPAT + if (vma_is_special_mapping(vma, compat_vdso_info.dm)) + zap_page_range(vma, vma->vm_start, size); +#endif } mmap_read_unlock(mm); @@ -264,7 +272,6 @@ static int __setup_additional_pages(stru vdso_base += VVAR_SIZE; mm->context.vdso = (void *)vdso_base; - mm->context.vdso_info = (void *)vdso_info; ret = _install_special_mapping(mm, vdso_base, vdso_text_len, From patchwork Wed Oct 19 08:22: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: 4546 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp204267wrs; Wed, 19 Oct 2022 01:45:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM674CJ94rly9CtiO5+pbNsVme1H4eS/OkK6vpBXhSyPbIL/5XlCzcBQckFAyr3APFCwyNep X-Received: by 2002:a17:902:7c97:b0:17f:5abf:9450 with SMTP id y23-20020a1709027c9700b0017f5abf9450mr7125037pll.19.1666169138441; Wed, 19 Oct 2022 01:45:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169138; cv=none; d=google.com; s=arc-20160816; b=zBPHRZ0YkrmS5rxDu5kpSmX2rkihzLoll44bUgbQDgvDJs8jSHq7kx1bksZigBC8IW msgTxHANj1i1Eviwrd2ZHPsFUM8IfruYeKIm6XPsx8QaOV+yTY4xY5eJVzV1xs3m060z WQrmDaGf6FwN3wOkDPBd5Hlu3KDWkigy2gsYJN1npEz9Zy/weDUL9epTGeIhWxw/Xv4b RCK0SvGnxflxEQ/o7tNJS5pjhI1E7tYVG/AdZ6R1xEim/Yt7xakig/0IKBMsrkUUsy7U JaofwHREd+DFDYYfint84nxRM9DUHgUg+7b8oj0DdvGmgTOZD+7pwCCgVdkjCajro9ad KLQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TGsirIwj7n+/+mXu8Rw17nBfDG9OmYMcF6WaG/CsWPk=; b=a7n6nZg9REk4Q31NadSIla8gMnrWhkHvi2QHUFlnb0c+ZmIcfdYPdWBE3pk1Y/Gtt7 3x6wa18nLOq1QcH6X7Dn4m1IggxIoZcVtoXaFwHMBPfC8ZHjlwBq6AC0dOZXhkNIc4P4 LabAOUtDCjdCu+VSKL8iKAN90/lVeoHjWhZQsl/IJomUb8t8WRVg2+TA0HWE1Hpe5O3t +alyUtxxcWhbbtpcH0TfQ0v/S4+p8nXUCketL7s7+i2e0sM8fJdgmE3nkPQjUUPh3fH3 HIwHZqY/SGKqJy0JO+rfq5410pbGHjCShKMEGQq4dzAOQWPG7VLlZ7K19UhoskLST0UD KRBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="HShpK+/J"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s3-20020a170902c64300b001865a9586c1si156442pls.59.2022.10.19.01.45.25; Wed, 19 Oct 2022 01:45: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="HShpK+/J"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231286AbiJSIou (ORCPT + 99 others); Wed, 19 Oct 2022 04:44:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231229AbiJSInl (ORCPT ); Wed, 19 Oct 2022 04:43:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6922457BE4; Wed, 19 Oct 2022 01: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 19EFC617E2; Wed, 19 Oct 2022 08:40:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24831C433C1; Wed, 19 Oct 2022 08:40:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168817; bh=u8jCsQTg+AUQ8MfWiYmhRVCIrhrvAtAfKvtbHgYSGJM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HShpK+/JSNjThVg8MQG+4fpzS29Z0ItC2FWH4UQveGLRSx+BkSzOrbpK6Dacnbczi 4MZJ7OGgqaydxGk48agOSprhTSwDJNso2WvqXORJWYxoHwLErPNawFQDvuWMfsnKSn pcsgU+G2fdTl11UU8unXMEcdTZYdS2/VlqyVNzSg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Atish Patra , Andrew Bresticker , Palmer Dabbelt Subject: [PATCH 6.0 062/862] riscv: Allow PROT_WRITE-only mmap() Date: Wed, 19 Oct 2022 10:22:29 +0200 Message-Id: <20221019083252.695471466@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104970635883475?= X-GMAIL-MSGID: =?utf-8?q?1747104970635883475?= From: Andrew Bresticker commit 9e2e6042a7ec6504fe8e366717afa2f40cf16488 upstream. Commit 2139619bcad7 ("riscv: mmap with PROT_WRITE but no PROT_READ is invalid") made mmap() return EINVAL if PROT_WRITE was set wihtout PROT_READ with the justification that a write-only PTE is considered a reserved PTE permission bit pattern in the privileged spec. This check is unnecessary since we let VM_WRITE imply VM_READ on RISC-V, and it is inconsistent with other architectures that don't support write-only PTEs, creating a potential software portability issue. Just remove the check altogether and let PROT_WRITE imply PROT_READ as is the case on other architectures. Note that this also allows PROT_WRITE|PROT_EXEC mappings which were disallowed prior to the aforementioned commit; PROT_READ is implied in such mappings as well. Fixes: 2139619bcad7 ("riscv: mmap with PROT_WRITE but no PROT_READ is invalid") Reviewed-by: Atish Patra Signed-off-by: Andrew Bresticker Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20220915193702.2201018-3-abrestic@rivosinc.com/ Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman --- arch/riscv/kernel/sys_riscv.c | 3 --- 1 file changed, 3 deletions(-) --- a/arch/riscv/kernel/sys_riscv.c +++ b/arch/riscv/kernel/sys_riscv.c @@ -18,9 +18,6 @@ static long riscv_sys_mmap(unsigned long if (unlikely(offset & (~PAGE_MASK >> page_shift_offset))) return -EINVAL; - if (unlikely((prot & PROT_WRITE) && !(prot & PROT_READ))) - return -EINVAL; - return ksys_mmap_pgoff(addr, len, prot, flags, fd, offset >> (PAGE_SHIFT - page_shift_offset)); } From patchwork Wed Oct 19 08:22: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: 4549 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp204306wrs; Wed, 19 Oct 2022 01:45:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4ywn0lTr1gr+3n/FwTGlcwHfqmu3ZbS5Qc2w7//zb40u1VHRx+iC1qgENV7+bCNOmk40E8 X-Received: by 2002:a63:8a4b:0:b0:460:7c54:1b2b with SMTP id y72-20020a638a4b000000b004607c541b2bmr6246765pgd.499.1666169146096; Wed, 19 Oct 2022 01:45:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169146; cv=none; d=google.com; s=arc-20160816; b=n3EE4fikpH8/Bf2riilTyRaOKwztAMIlXUNuEy4li9+ty9knDhjXNmkc6PGuAhVW0d n3N9vQCRNUwwxqBVxXDNy0MAlVcf1gaVErypykg4+7ig95PF4PTF/BuyqrbQGBIrUyh5 dhft6Wke6aa3m95My0CKXSm+p9Oxh7Snpn+gWv0gpu0JjQrynVmtqaDOOpbORSGR7Q6H aI79FNZbBCg3AAnI4+mBhPzuX/jxm1o2cMdHrSCHs9+DN3BFWB6O/o/+Tcg4Ec2kbVRQ /2XZ3egPBP1zg1EP4y/tCcSUQafKdKnOOkk71Arrsenawc81RFlQcEIyu9IeGpQePIAI Xa1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MpoxWs+4RU7KPgafbWDZ7saYeqOSfW9VdtPGVQPSOUU=; b=0kTOEfTbx5+Cv1ZS2XnizOcmG/6GW863s/OB+RaE/HcVwJDjEDkoZHamkM9uZsqugN CqXk4rChKvOsf+3zcuUtg1cCqelAIl+kKADoMHBbe1veQgUhln1le7osnovWaeKG6TtR 54Ayk2gZZEi4jkaK/QOLt14FxybjCqWHgfvdCgnHueDfvQaPMbshTmcbjzpTAwS507S0 oMrPczSH504ECIIlp6r6ps9MN0wocJXyTT1Q5rsFeldiDj2SXcS7BUckAHl2ZDwWDCCw N1V72g0GxIR2VjjnaQb93b7KeUa9Pg0V8z689T3Slxns7BapP4r2bHUoO4xzwKiRZT+c kFMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EsIoLqH7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t186-20020a6381c3000000b004624e24b4e9si17241062pgd.543.2022.10.19.01.45.31; Wed, 19 Oct 2022 01:45: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=EsIoLqH7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231395AbiJSIpN (ORCPT + 99 others); Wed, 19 Oct 2022 04:45:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231315AbiJSIn5 (ORCPT ); Wed, 19 Oct 2022 04:43:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 150DF88DC3; Wed, 19 Oct 2022 01:41: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 45E2E617E4; Wed, 19 Oct 2022 08:40:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 376DBC433C1; Wed, 19 Oct 2022 08:40:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168820; bh=/2VWHXxCuruU2Yfpldt0LZ8uSfriJfdzL6Wr0+OwWB4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EsIoLqH7fJ3Wx81UjXoOXSWOK9qPpPu2JEEBOoUO9U+lVGrFPs4yDXbn2Em8pnuwc mPpp7YtqYhco61AsUVbERHnvv0BP4AnYHDawelFUosMW+iZ7WXJ3BOj9qXR+gniUGW 3/2O22qccp5dy1RmNUqP2JwQezUAATW1a3eT2mDg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Atish Patra , Andrew Bresticker , Palmer Dabbelt Subject: [PATCH 6.0 063/862] riscv: Make VM_WRITE imply VM_READ Date: Wed, 19 Oct 2022 10:22:30 +0200 Message-Id: <20221019083252.727982018@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104978409955259?= X-GMAIL-MSGID: =?utf-8?q?1747104978409955259?= From: Andrew Bresticker commit 7ab72c597356be1e7f0f3d856e54ce78527f43c8 upstream. RISC-V does not presently have write-only mappings as that PTE bit pattern is considered reserved in the privileged spec, so allow handling of read faults in VMAs that have VM_WRITE without VM_READ in order to be consistent with other architectures that have similar limitations. Fixes: 2139619bcad7 ("riscv: mmap with PROT_WRITE but no PROT_READ is invalid") Reviewed-by: Atish Patra Signed-off-by: Andrew Bresticker Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20220915193702.2201018-2-abrestic@rivosinc.com/ Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman --- arch/riscv/mm/fault.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/arch/riscv/mm/fault.c +++ b/arch/riscv/mm/fault.c @@ -184,7 +184,8 @@ static inline bool access_error(unsigned } break; case EXC_LOAD_PAGE_FAULT: - if (!(vma->vm_flags & VM_READ)) { + /* Write implies read */ + if (!(vma->vm_flags & (VM_READ | VM_WRITE))) { return true; } break; From patchwork Wed Oct 19 08:22:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4545 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp204247wrs; Wed, 19 Oct 2022 01:45:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM77PBcibUnTd4o68fJyY3EVHIicp5DmJVvesvpt861aACcHhyEwqdVNAD/HvC9dUERk8oMX X-Received: by 2002:a17:902:da92:b0:17f:9148:9b8c with SMTP id j18-20020a170902da9200b0017f91489b8cmr7568201plx.117.1666169134436; Wed, 19 Oct 2022 01:45:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169134; cv=none; d=google.com; s=arc-20160816; b=AzYvOcidEG4FP7Gdy0/siLkcTvAZQqwgYV03ikWfP7Ofw5mvUsd461M6jYHzncl3lo oA/DvDYFBCBw981BIoK0d0m1AE1tlR2yKht2yFeqLX5u9i6D4USSjPEwPMwvhvKO9AG7 sNVFpaq4PObOztJS/H+DQvTbpB07VE0vJCT9Tu0D4eFIVT5VBe8VtKbxLB+W8DRurePj KEmYaeZrZ41WZJL6kaNJ+rEypHcBP3HKI0f3VP/gsVMrgJ+fqPHywFSj9G0x1uuGcrHR CA8razQb89JO1SsiPgX0X+itVkuRicJN8ntDxlPrbvr71u58Bg3+8dwdmlZwliBu3gRM ZtMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Qx2SvrouxxznJevAd90aK51pDeV9j8TIkca2rWLQ2a8=; b=oEJmzxa9H958mH1yl2SUCxLUtSRrq7wfbxwsqYOQkCyhvx8fW1YxySLO9ggE3WyaWr btGvRSpnTDUU5KxndWUlgKgxT02F5IXc7XkofuryEsigA0Ck994Hl8XvHfe6r/VELDHs NlEHxXM3Px3Q8le4Sd5u9ZFnZqA2WUklGvvstswAXxvbJiIfjIXJWmIsfz+3/HbxhE1Z JcXennr1qRDMxiZP0Nve8bb10uU6Dv39/pD2JiHkSaaz/r0sV6xLNvNMyEiFS3+JiS0U jbUU6oFGENT7grOViD8NaelgrqGlImpKevanorUqetijcYRO3UHfwqOXBceeLmT5epf+ tffg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=a+37mUAF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i9-20020a17090332c900b0017f7de32cb0si19634219plr.85.2022.10.19.01.45.20; Wed, 19 Oct 2022 01:45:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=a+37mUAF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231262AbiJSIor (ORCPT + 99 others); Wed, 19 Oct 2022 04:44:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231308AbiJSInl (ORCPT ); Wed, 19 Oct 2022 04:43:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D55589806; Wed, 19 Oct 2022 01:41: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 27855617EF; Wed, 19 Oct 2022 08:40:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C848C433C1; Wed, 19 Oct 2022 08:40:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168823; bh=Nyd1WCddx4v9hzlBKLS7JQchgIUTsyH8TfhTYvZVeQc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a+37mUAFB6Azjhh5GNnamujL2Y54b6ITFFbt7w548O4vAHNE7mLulJkQ5xHKSEcFq +4ePXIJDRkTpxj2yPGs++u+zkiIgsZw6yXCC2bAUoxVBpXvMmtM18Q5/pED8zCPNVC mS6ZH0ABpUzTpULl2zFGdOVMbc9dANoTCRWrcoBM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wenting Zhang , =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= , Conor Dooley , Palmer Dabbelt Subject: [PATCH 6.0 064/862] riscv: always honor the CONFIG_CMDLINE_FORCE when parsing dtb Date: Wed, 19 Oct 2022 10:22:31 +0200 Message-Id: <20221019083252.766502213@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104966043269638?= X-GMAIL-MSGID: =?utf-8?q?1747104966043269638?= From: Wenting Zhang commit 10f6913c548b32ecb73801a16b120e761c6957ea upstream. When CONFIG_CMDLINE_FORCE is enabled, cmdline provided by CONFIG_CMDLINE are always used. This allows CONFIG_CMDLINE to be used regardless of the result of device tree scanning. This especially fixes the case where a device tree without the chosen node is supplied to the kernel. In such cases, early_init_dt_scan would return true. But inside early_init_dt_scan_chosen, the cmdline won't be updated as there is no chosen node in the device tree. As a result, CONFIG_CMDLINE is not copied into boot_command_line even if CONFIG_CMDLINE_FORCE is enabled. This commit allows properly update boot_command_line in this situation. Fixes: 8fd6e05c7463 ("arch: riscv: support kernel command line forcing when no DTB passed") Signed-off-by: Wenting Zhang Reviewed-by: Björn Töpel Reviewed-by: Conor Dooley Link: https://lore.kernel.org/r/PSBPR04MB399135DFC54928AB958D0638B1829@PSBPR04MB3991.apcprd04.prod.outlook.com Cc: stable@vger.kernel.org Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman --- arch/riscv/kernel/setup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/arch/riscv/kernel/setup.c +++ b/arch/riscv/kernel/setup.c @@ -252,10 +252,10 @@ static void __init parse_dtb(void) pr_info("Machine model: %s\n", name); dump_stack_set_arch_desc("%s (DT)", name); } - return; + } else { + pr_err("No DTB passed to the kernel\n"); } - pr_err("No DTB passed to the kernel\n"); #ifdef CONFIG_CMDLINE_FORCE strscpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE); pr_info("Forcing kernel command line to: %s\n", boot_command_line); From patchwork Wed Oct 19 08:22: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: 4548 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp204290wrs; Wed, 19 Oct 2022 01:45:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5eTlOMZW0A2c4g2wAAXMMmCx+QQP6bd0VDEgIfwNH5MbeV+UyPYZXYK8zfuPgP4tlLlkFj X-Received: by 2002:a17:902:d510:b0:185:4b76:6277 with SMTP id b16-20020a170902d51000b001854b766277mr7254980plg.82.1666169142388; Wed, 19 Oct 2022 01:45:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169142; cv=none; d=google.com; s=arc-20160816; b=eZ7LpHATOTF70+1N2neIItBCr9vBJMdp7MgWuthRLKS+HH/kTEpkWMhp0Ur7HarEmf ca3jVrCmiT2sXA8tWHpV+bHvV7E/dgEeY8kylhR+4s90VNoShdAx0Qvr6PYU+NHmcqW0 0cn0DVcUn3XrTExxbrgAbxdk4dPR9Jpci9FmrORIQUTmE4wLfo72mmVGd2EMMaF97xvv wYtLmaWNUTt+Niu0ck6LnTId9X2koICJyYgKg3wzFHfJCFCPyxZ0x88ZMubaPh8CCM1Y rQyqqv0KtlSNxcFWGoeWVQ6IUpR59EdMW4AHZImXLxrdh7YVTViL6m6q1prNYN0loMm4 X1Sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BIEPF+MSQ7lRp5vPBmB173yzLDRtzFdBFRo9ldmDQDY=; b=Ht1cQkQQF5x0S8owk+ugFuUtiqGHhRBhDdViN9dW/Q3owsNYnTu7tb4TAIsCPKCDN/ WgZBmA7sbYnuptS7p9domj+uMh8NKmz0UdxOKp855psyKfysNk7XigfRf+1MkT+WWlHY NJwsi2nM9yZs73IsPn25xyf0P+wVEGoPcVA07wessIpqkzqeNQl87SV6ZZ35Gu7wV5hg 0eJmUdRciJxcgf+0lHrCUfOyFOJmns4ZVgHJ9Q8jujBPd+RTqNa6m4cEifcAa6aqqSEo 0jzDTRQEXf8Vk1smtlOXnWcEgi/MiNzoVSjzJj7Z3bjlktLMTaXy5phwl05pafH/iHR4 F5SA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0Sop+Wj5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f10-20020a056a00238a00b0051bbbc5f0aasi18213636pfc.261.2022.10.19.01.45.27; Wed, 19 Oct 2022 01:45: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=0Sop+Wj5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231377AbiJSIpI (ORCPT + 99 others); Wed, 19 Oct 2022 04:45:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231327AbiJSIn7 (ORCPT ); Wed, 19 Oct 2022 04: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 E02335A3F3; Wed, 19 Oct 2022 01:41: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 4672D617E9; Wed, 19 Oct 2022 08:40:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 109DFC433D6; Wed, 19 Oct 2022 08:40:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168826; bh=c4NL67WudStCz85yeweG+NkIyETz6hxWtl4wxLcqfqE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0Sop+Wj5AZSZiWkbEtCX5TIj4uM2YRS1aK+HX8goYsUNkxSbFqmRPOJZRk73VEpo/ wzcPaiT3+vv96Asujdqecf18hqE35WEGSgEAGF2vxI8GOr473VBud2MBL2wWXDbXYb C1oCwYCtwQ7Cr5tP/PCSM+NTJF8BP9sgHhEDOBuQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fangrui Song , Nick Desaulniers , Nathan Chancellor , Conor Dooley , Palmer Dabbelt Subject: [PATCH 6.0 065/862] riscv: Pass -mno-relax only on lld < 15.0.0 Date: Wed, 19 Oct 2022 10:22:32 +0200 Message-Id: <20221019083252.805123179@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104974936270296?= X-GMAIL-MSGID: =?utf-8?q?1747104974936270296?= From: Fangrui Song commit 3cebf80e9a0d3adcb174053be32c88a640b3344b upstream. lld since llvm:6611d58f5bbc ("[ELF] Relax R_RISCV_ALIGN"), which will be included in the 15.0.0 release, has implemented some RISC-V linker relaxation. -mno-relax is no longer needed in KBUILD_CFLAGS/KBUILD_AFLAGS to suppress R_RISCV_ALIGN which older lld can not handle: ld.lld: error: capability.c:(.fixup+0x0): relocation R_RISCV_ALIGN requires unimplemented linker relaxation; recompile with -mno-relax but the .o is already compiled with -mno-relax Signed-off-by: Fangrui Song Link: https://lore.kernel.org/r/20220710071117.446112-1-maskray@google.com/ Link: https://lore.kernel.org/r/20220918092933.19943-1-palmer@rivosinc.com Reviewed-by: Nick Desaulniers Tested-by: Nick Desaulniers Tested-by: Nathan Chancellor Tested-by: Conor Dooley Cc: stable@vger.kernel.org Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman --- arch/riscv/Makefile | 2 ++ 1 file changed, 2 insertions(+) --- a/arch/riscv/Makefile +++ b/arch/riscv/Makefile @@ -37,6 +37,7 @@ else endif ifeq ($(CONFIG_LD_IS_LLD),y) +ifeq ($(shell test $(CONFIG_LLD_VERSION) -lt 150000; echo $$?),0) KBUILD_CFLAGS += -mno-relax KBUILD_AFLAGS += -mno-relax ifndef CONFIG_AS_IS_LLVM @@ -44,6 +45,7 @@ ifndef CONFIG_AS_IS_LLVM KBUILD_AFLAGS += -Wa,-mno-relax endif endif +endif # ISA string setting riscv-march-$(CONFIG_ARCH_RV32I) := rv32ima From patchwork Wed Oct 19 08:22: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: 5542 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp348640wrs; Wed, 19 Oct 2022 07:10:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM57qySOrGjlRvT73WVunAxXLIJb9K1ZZAKAiadAKpn+j9vHU5sMR04GNpKxl3zMT8EqrJur X-Received: by 2002:a17:902:868b:b0:185:be8:b316 with SMTP id g11-20020a170902868b00b001850be8b316mr8529505plo.157.1666188627026; Wed, 19 Oct 2022 07:10:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666188627; cv=none; d=google.com; s=arc-20160816; b=XuvDB+Z3p3Hht+/noCN2m0KQWh6TvvPcrKr6ebXMDU74LwEB6tD90mo3KsDYxSvMaY CqLQ55mqS2A32SNah9TN1/3iRYF8Gn77DpttAo1RnEI3kVr3sk83rcBqen0krE0li6cf 9ifUUDSCXqDzAZQ0xfWFUMjqUzP7oZV9+1MI3F0HE/krJx5XVRpelJhZMg9RPNZV7zoO l/XXLXpMiNh1QdSec++GmLOO+I4tgGbqNUmhyqw1Epq9qNmJV1gt0/lg6lDCGvj6qnFU IFuYmGQ/JN7whCwIvFJr/5HAycWULV7Fbk51MgQxgN+efqP6bjd4yqSeJl64lyr+1xxQ bGOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3Zng3YthuBRp7NoZr9y9jX2epyePvtk7v3twtnGcWmM=; b=OyfdsZLH38fnq0kHojKKU5lWsI6APiwb0xjqPB3EKh0/47/rjJJsVLFqB0TchKdApD FrXtzTytnbgo+tFklwN/YAqoL/fJgQUw5uyGdJtH88oJCdTdPvPlzqQfFIxXgqdnzNAN 5AzbmW722WkKkpEwnI9TkWupO4HBk5nbentSU83+ouF0RI8g9o2USXMBUGXi+cs4ElnT P7EZapMrrSa8862h8tqMkgat5y0YqE8t4/2Iq3N+SpRwTjDltdQ7c3RBZPjxv2ewd494 KPzFDPYcIVwWvRpcS6lP6hB0rZN+5nC1b9y+rMv+rGC19CFAOy6FpERGp8Eq4I6YrE6H jFmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rnJTD2Nt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a656806000000b0045f9f5763c4si18990390pgt.437.2022.10.19.07.10.06; Wed, 19 Oct 2022 07:10: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=rnJTD2Nt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231539AbiJSNxm (ORCPT + 99 others); Wed, 19 Oct 2022 09:53:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233732AbiJSNw4 (ORCPT ); Wed, 19 Oct 2022 09:52: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 D81FF1958E1; Wed, 19 Oct 2022 06:36: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 DCA16B822CD; Wed, 19 Oct 2022 08:40:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F0E2C433C1; Wed, 19 Oct 2022 08:40:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168829; bh=fb5bovRJE0OE1x/kjgr6r3QY9hhCN3d1H51HtnbhOcY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rnJTD2NtERibIpsdAqZj+QpRV850KYRkjQHNG08vqh7qUfT7AWUcNXFWpEve1bZ8V cmfCuFgy9MLP2y0aKK55hV1DVH2YhRYncizs30jwktdZC4orfePqBHOI5hsG+h+qRl JBgUCoZj0Z3Bd1JzToXf4kVZOGjvfoAb4ni1KeZI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Huacai Chen , Richard Weinberger Subject: [PATCH 6.0 066/862] UM: cpuinfo: Fix a warning for CONFIG_CPUMASK_OFFSTACK Date: Wed, 19 Oct 2022 10:22:33 +0200 Message-Id: <20221019083252.842157393@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747125406212484159?= X-GMAIL-MSGID: =?utf-8?q?1747125406212484159?= 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 @@ -96,7 +96,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 Wed Oct 19 08:22: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: 4761 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214756wrs; Wed, 19 Oct 2022 02:13:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5xrhTnJSkvHR1ZU3ayjlLhgI2Zyx5+KmeHJhScnjU330CJAvmApiDtu16XAxU7ErvsZ0On X-Received: by 2002:a50:cc07:0:b0:453:4427:a918 with SMTP id m7-20020a50cc07000000b004534427a918mr6470721edi.121.1666170821332; Wed, 19 Oct 2022 02:13:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170821; cv=none; d=google.com; s=arc-20160816; b=Y5m9/tx4muSZdzQdaOB08XElDjvgnOAlwfxLyzbdmpCRmX+4xVutx9dggtLQbjPywH mXhIdhHCHcMmOI4orlFD7wDB2kP7bwRuKPfh9Zj2nbozWk89NsLzgMmPfLeWbTW9/hqf GXy0qx32fxDIWlTBaDmIFVtHw/cnGEvMNJbPx0yeyzWH6PrlvOtxEs4PIJgavqHyNIFz I1kBn2nfHYok3oNAutczGxbYoQj+ElvrEX4MaLIHJPD9nmYqTcCwzeXRDzh33zuwQOvc kH4WMmkke+ABKIftIfOwoTe2egJ2X2VL2xwYxH8imT/BKL54bbbY5EHtLL1k50LisFR2 mEWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sgHzeYAd7yv+AaNLjROWREAUCgtt9WGGemK+vLNmO3U=; b=rwEVNV8U2LOAgMtogR4QjekhjWJTfF+jo19fh5hxee0ETcNkgk2NPJZLVG1QuCc1y1 mVOpaIvakf+boDHjn/QYekIzD8KdUx6Y21C1w1qNrXf+2s282zVvS/nMeVxU7w+scsDw f5ECPuh4Lz/WA5yX0HYApIZpIPs6jXkwcFRluJ2t6xrQ0R7mW5OU+NvNBSEQ26LlsDec usTk+wFFXvguUtmxwzQgdsyHNEdbQt/XgBFyg/JZ3C0ipB5r3id0E2CyaUZkZ90IoMWg b1HJLcVgVixDhnGzEqRp1zQJxFVSR002SBeQHcwhfHZQybEpBHVzQqfe9OAoZBylMX24 6egg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FYhv6Lmz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s5-20020a170906500500b0078255525a6fsi12614837ejj.671.2022.10.19.02.13.17; Wed, 19 Oct 2022 02:13: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=FYhv6Lmz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232474AbiJSJMU (ORCPT + 99 others); Wed, 19 Oct 2022 05:12:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232908AbiJSJJf (ORCPT ); Wed, 19 Oct 2022 05:09:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4E66AF18E; Wed, 19 Oct 2022 02:00: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 dfw.source.kernel.org (Postfix) with ESMTPS id 2B180617DE; Wed, 19 Oct 2022 08:40:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1ED6EC433D6; Wed, 19 Oct 2022 08:40:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168832; bh=7VdRluWHI+RLGwVR0BCIqAPVnPkYCKskJthMfKF0DfM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FYhv6Lmz3LCUwgsMr6Wo3vzvVZVxt8dy+cRusWyk8cYWG4iua1o//ym6GJrtgpmZ0 s3BHxrQBseYuUD25JiJ7cH5Gi4vHDLIqdL2tUsq+KRArMptkR9o0r1yfSJ7Ti9Eezn pevwEtQ3592gXPhO+kUB0lFhNI+W4RLPj18uAzM4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gaosheng Cui , Srinivas Kandagatla Subject: [PATCH 6.0 067/862] nvmem: core: Fix memleak in nvmem_register() Date: Wed, 19 Oct 2022 10:22:34 +0200 Message-Id: <20221019083252.879949086@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106734964012936?= X-GMAIL-MSGID: =?utf-8?q?1747106734964012936?= From: Gaosheng Cui commit bd1244561fa2a4531ded40dbf09c9599084f8b29 upstream. dev_set_name will alloc memory for nvmem->dev.kobj.name in nvmem_register, when nvmem_validate_keepouts failed, nvmem's memory will be freed and return, but nobody will free memory for nvmem->dev.kobj.name, there will be memleak, so moving nvmem_validate_keepouts() after device_register() and let the device core deal with cleaning name in error cases. Fixes: de0534df9347 ("nvmem: core: fix error handling while validating keepout regions") Cc: stable@vger.kernel.org Signed-off-by: Gaosheng Cui Signed-off-by: Srinivas Kandagatla Link: https://lore.kernel.org/r/20220916120402.38753-1-srinivas.kandagatla@linaro.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Greg Kroah-Hartman --- drivers/nvmem/core.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -829,21 +829,18 @@ struct nvmem_device *nvmem_register(cons nvmem->dev.groups = nvmem_dev_groups; #endif - if (nvmem->nkeepout) { - rval = nvmem_validate_keepouts(nvmem); - if (rval) { - ida_free(&nvmem_ida, nvmem->id); - kfree(nvmem); - return ERR_PTR(rval); - } - } - dev_dbg(&nvmem->dev, "Registering nvmem device %s\n", config->name); rval = device_register(&nvmem->dev); if (rval) goto err_put_device; + if (nvmem->nkeepout) { + rval = nvmem_validate_keepouts(nvmem); + if (rval) + goto err_device_del; + } + if (config->compat) { rval = nvmem_sysfs_setup_compat(nvmem, config); if (rval) From patchwork Wed Oct 19 08:22: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: 4663 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212707wrs; Wed, 19 Oct 2022 02:08:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ZkHb+aAUuK7lrIbilkqBBe2Vnz66G+EJBtupAJIdOBj4O+QMBlu/vnRxiNQy0wHLxuM1/ X-Received: by 2002:a05:6402:2489:b0:454:11de:7698 with SMTP id q9-20020a056402248900b0045411de7698mr6605332eda.214.1666170487099; Wed, 19 Oct 2022 02:08:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170487; cv=none; d=google.com; s=arc-20160816; b=PwnSsMaJGUBXcla3CLfMVAi94SDTsdV7mHkYnCIbkzNJoq28NAUopHRoxgH5Pr5Tme O5ehkzvMLDU6yU3ZPImckqZBx+Q9rEi4zNjb6qa90piHUciyS92+53wW8mnwlyg08y22 K5GLHYiBfKJBgnA3NE/jc2mNYcn1BK29dXRqN68x9Zwk1cXKN2Q4iexetzcS01GKK/Qu Sc2EoSGRVRt78qN8i1YRnZ3UztnP1HRNX3/HbdjRB5zE0CwV4ZRz/3l2FQji/QXV8GwC rWi7Gf+86Kt3csKEIvrIsaPLYaV2XARL4NaW3sXoSoiVHqkaMLrWjAFgWUn9HA344AJY YwhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TW826vAKXuOrryw/6+DW8pbOkbYkeAdYmnPeHLAfYP0=; b=dfmOQ9AgrNxGtfYJ/cehz+D3L6WZmmiEurgaT74i/IibVp9aZL91d9KPk732YFaYJs G4tq9WNWaO0FPzba5Q33sx8UC+ErwjEc8sMNaiMrgvRji7JSS2za/BiCVPmu3XSZunrB xQdb+qTq9ufEygbWoqMLI5XjSWIjgSksSSjQI0Z4DojTszOD0kPDGcJEQ6trfME1+zJC fC6Pqr1u/LzllorZMGZv3c/1Td7hFB8E7xNvyBAzdIqiHygFsIrJWnHHX++kaLacQk59 6UAdyWXOM4LHwsWgrS9B3xVIndIMKCcg3WZZxDc1mKRlCEvlqzgzU1vZGzWQ9Ive90F9 JSXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PoKjleNI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020aa7dd03000000b00456c837e3d0si12092828edv.77.2022.10.19.02.07.33; Wed, 19 Oct 2022 02:08: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=PoKjleNI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232238AbiJSJB0 (ORCPT + 99 others); Wed, 19 Oct 2022 05:01:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232214AbiJSI7R (ORCPT ); Wed, 19 Oct 2022 04:59: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 EAAB0BE35; Wed, 19 Oct 2022 01:54:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8AF66617E4; Wed, 19 Oct 2022 08:42:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B59AC433D7; Wed, 19 Oct 2022 08:42:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168976; bh=ON2evzD/PvT7GNtyEBzFcCThvASigkcrWtkR+/CpAo0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PoKjleNIQWbXH34kVp1zlgpYcrM/sO8XTNTkKjWZWfLgeKSW6mGYKwyO8VGA1cEaU A5lIXZuekNU35bO0Lzmyue7nKKK6XqLAOZCw1QhfNRZ7kntGeA+Fi8gVdmhC79HqkK kXQP3qJvFR3NrV/uJrJKoqxrxtqsjS44DVX+C+AU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yogev Cohen , Sagi Grimberg , Christoph Hellwig Subject: [PATCH 6.0 068/862] nvme-multipath: fix possible hang in live ns resize with ANA access Date: Wed, 19 Oct 2022 10:22:35 +0200 Message-Id: <20221019083252.928169244@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106384685065407?= X-GMAIL-MSGID: =?utf-8?q?1747106384685065407?= From: Sagi Grimberg commit 72e3b8883a36e80ebfa41015c7b6926ce31ace05 upstream. When we revalidate paths as part of ns size change (as of commit e7d65803e2bb), it is possible that during the path revalidation, the only paths that is IO capable (i.e. optimized/non-optimized) are the ones that ns resize was not yet informed to the host, which will cause inflight requests to be requeued (as we have available paths but none are IO capable). These requests on the requeue list are waiting for someone to resubmit them at some point. The IO capable paths will eventually notify the ns resize change to the host, but there is nothing that will kick the requeue list to resubmit the queued requests. Fix this by always kicking the requeue list, and if no IO capable path exists, these requests will be queued again. A typical log that indicates that IOs are requeued: --- nvme nvme1: creating 4 I/O queues. nvme nvme1: new ctrl: "testnqn1" nvme nvme2: creating 4 I/O queues. nvme nvme2: mapped 4/0/0 default/read/poll queues. nvme nvme2: new ctrl: NQN "testnqn1", addr 127.0.0.1:8009 nvme nvme1: rescanning namespaces. nvme1n1: detected capacity change from 2097152 to 4194304 block nvme1n1: no usable path - requeuing I/O block nvme1n1: no usable path - requeuing I/O block nvme1n1: no usable path - requeuing I/O block nvme1n1: no usable path - requeuing I/O block nvme1n1: no usable path - requeuing I/O block nvme1n1: no usable path - requeuing I/O block nvme1n1: no usable path - requeuing I/O block nvme1n1: no usable path - requeuing I/O block nvme1n1: no usable path - requeuing I/O block nvme1n1: no usable path - requeuing I/O nvme nvme2: rescanning namespaces. -- Reported-by: Yogev Cohen Fixes: e7d65803e2bb ("nvme-multipath: revalidate paths during rescan") Signed-off-by: Sagi Grimberg Cc: # v5.15+ Signed-off-by: Christoph Hellwig Signed-off-by: Greg Kroah-Hartman --- drivers/nvme/host/multipath.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/nvme/host/multipath.c +++ b/drivers/nvme/host/multipath.c @@ -182,6 +182,7 @@ void nvme_mpath_revalidate_paths(struct for_each_node(node) rcu_assign_pointer(head->current_path[node], NULL); + kblockd_schedule_work(&head->requeue_work); } static bool nvme_path_is_disabled(struct nvme_ns *ns) From patchwork Wed Oct 19 08:22: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: 4566 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp204847wrs; Wed, 19 Oct 2022 01:47:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7C2n7u6qX4lq6RyR6HikbZ2aKWLP/62182Ogd1nJP4J3FNjYgQUbSocKFxluvmPnMPZn84 X-Received: by 2002:a17:90a:6883:b0:20a:d58b:d690 with SMTP id a3-20020a17090a688300b0020ad58bd690mr44624481pjd.241.1666169251685; Wed, 19 Oct 2022 01:47:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169251; cv=none; d=google.com; s=arc-20160816; b=PphkjbjKZ1chMBHogKQoRYR9o0nofueHyvNoV8ze4DUojouDEOtb4B2WtdimI78tqE mP/lZp1tARLZswutD+pwNjbxL3beIvtnzbbSAmnGfKHRMljCQ0IgCbGmiDTGbdq14gP6 JQ+y1r/9oyc3Di03a4/0NwH23xaDephj07uplLL9J3dC9ByIqByDDJ/bQ8Lj4OabXubQ y5dT8dSJeHMFH1V/c9vrkMuC7UK9SEKtbsZmktCmNPlDEUasIfR6nHBeJ6I9HYskn0Xo wKuP47RprVON8jJstEBdihJK2oNyXbWIttJDgGMA+D8y1Tdrwu/mpY5Zy92rZ51nS2+a k77g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=m7THLKAQtE9miVW7RvCR+g9+bmTeQ2jR8Rt750+/Mfg=; b=hhMq5Whnjiluwe+MCqCKFPOkogDNL4HvniZ4kJ7AEGJqaBRY0TkDK1VEY9NDYBbtCB uALKJuqTxvzaDJavg/8FMBjFtm5JSuoc5eFf/G6SQByBzzccr9TDTDYnyZ1W8GO6uR5Z SwOYLgHAU5JeRalS6NYvcC3qMMQP8Vzei1iabkYq9eLFks8tbL//2qBQeLI1BD5Icx+3 QdZy0R51twoT2Iq9Batju2x/JKKLmYtWnoZkifvirpcv0imyDZUlXhvXPssPAXp9oLj7 muSXtbNS8u/C71Hrdmkn/m2DuYH7DGKU+bDsakHwSeFaq5M/9OfkUwPmNW+Xb7AYpHv9 M3gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KPBGNx11; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t185-20020a6381c2000000b00437e609414dsi16822194pgd.563.2022.10.19.01.47.18; Wed, 19 Oct 2022 01:47: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=KPBGNx11; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231444AbiJSIqy (ORCPT + 99 others); Wed, 19 Oct 2022 04:46:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231415AbiJSIpT (ORCPT ); Wed, 19 Oct 2022 04:45:19 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1863783204; Wed, 19 Oct 2022 01: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 83F16B82256; Wed, 19 Oct 2022 08:40:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ECF34C433D6; Wed, 19 Oct 2022 08:40:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168856; bh=J4GXFMdeRLZix8AZSV4/nBwMjiWe1xjgzdQTqZP/uF0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KPBGNx11kGqhHHgvIynAmBOxJ23NFj3rkwCYbiA39eBRkSdJVx3JA4M3hMzydJW2M TDrt64JHrdTyekVCevszTV6AHl4F33b1nHcpj8B3svMeTfVoIRzN9rntPbdlU9QUnU f2npV52gcTugcECeptU4XzhzDXo0s4v4k+/hFuBE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hamza Mahfooz , Alex Deucher Subject: [PATCH 6.0 069/862] Revert "drm/amdgpu: use dirty framebuffer helper" Date: Wed, 19 Oct 2022 10:22:36 +0200 Message-Id: <20221019083252.970352308@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105088982863380?= X-GMAIL-MSGID: =?utf-8?q?1747105088982863380?= From: Hamza Mahfooz commit 17d819e2828cacca2e4c909044eb9798ed379cd2 upstream. This reverts commit 66f99628eb24409cb8feb5061f78283c8b65f820. Unfortunately, that commit causes performance regressions on non-PSR setups. So, just revert it until FB_DAMAGE_CLIPS support can be added. Cc: stable@vger.kernel.org Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2189 Link: https://bugzilla.kernel.org/show_bug.cgi?id=216554 Fixes: 66f99628eb2440 ("drm/amdgpu: use dirty framebuffer helper") Fixes: abbc7a3dafb91b ("drm/amdgpu: don't register a dirty callback for non-atomic") Signed-off-by: Hamza Mahfooz Acked-by: Alex Deucher Signed-off-by: Alex Deucher Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c @@ -38,8 +38,6 @@ #include #include #include -#include -#include #include #include #include @@ -500,12 +498,6 @@ static const struct drm_framebuffer_func .create_handle = drm_gem_fb_create_handle, }; -static const struct drm_framebuffer_funcs amdgpu_fb_funcs_atomic = { - .destroy = drm_gem_fb_destroy, - .create_handle = drm_gem_fb_create_handle, - .dirty = drm_atomic_helper_dirtyfb, -}; - uint32_t amdgpu_display_supported_domains(struct amdgpu_device *adev, uint64_t bo_flags) { @@ -1108,10 +1100,8 @@ static int amdgpu_display_gem_fb_verify_ if (ret) goto err; - if (drm_drv_uses_atomic_modeset(dev)) - ret = drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs_atomic); - else - ret = drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs); + ret = drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs); + if (ret) goto err; From patchwork Wed Oct 19 08:22: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: 4658 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212601wrs; Wed, 19 Oct 2022 02:07:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5NPEcER7vdbZaVSABoX6TIngpu8imjrUydnBscgDx8raU5HQS17Lv9pfiu5ASjpdabG1TA X-Received: by 2002:a17:907:a425:b0:78d:b3ce:1e43 with SMTP id sg37-20020a170907a42500b0078db3ce1e43mr5800970ejc.95.1666170473104; Wed, 19 Oct 2022 02:07:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170473; cv=none; d=google.com; s=arc-20160816; b=ssuO+n3n2NZL2ORlJorJUOv+nSkt/HTQwYdxEAl0id/sdfv+BwqvL4OHORgGZbte2O QJxy3S2CjW5eJl5C3VuxFufYDIs8Ioj4JmWgtk8lQju+aOcqjH/21FKKJimAo/D84moa zXH3SNyT+TLV0rHDBHlURY76FzxlA+cKgAtjfP2Wp4eizY4ZZHzK27SZOtoHS27OBdyb jNYY5Oph7dSLdBMG9GWFrvNYFT8KsBo/8/F1HG12M+cahkAMaRpRgDei1a85t72snwkn pRCgDGlpF2tnwMB6YXZbpnWbMRVSd10mDf8QPgJZa2hsDqtR+1RByN2ZKLd/IrdMVi2D 81SQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=opn/53qimErf0hrwBWKe38k/erno6ancIbTRwIDiZxw=; b=k91YYrv5LvTHMU1L18uDc6J39P6l2RkKUyNspEPSNSixb/Bu2CPsjHnMFSNH8fYhIn iT5iOdYJ5B/NbXX51d4CB0xofzZFA4ReRe+FdxRYYWUVOrUk4SUq6Uz9dM8E8im1cIqR TeezRMOSAszLUA6/8+a3Z/vrI5ZQx71XGR8rfftwmX1dMk2qTFhWTbqLu66x8aFV+q37 rMjj4ENeILjeyPuXPuaioA1lYgE7EICr+o33piLhdXAE1nbWA8p0YGKBAG8eN9+oEzqJ WbgccpvNbYBj2pam/zy+k+1I9VImn4gs8pkSrA3UN0A0ZwbfAAi1mkpXSk5fjig+2Z3y W0aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qfLmhB14; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s11-20020a056402520b00b0045db2dcff0esi6250740edd.594.2022.10.19.02.07.23; Wed, 19 Oct 2022 02:07: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=qfLmhB14; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232202AbiJSJBC (ORCPT + 99 others); Wed, 19 Oct 2022 05:01:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232144AbiJSI7B (ORCPT ); Wed, 19 Oct 2022 04:59: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 AFB47915D5; Wed, 19 Oct 2022 01:54: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 70E81617FB; Wed, 19 Oct 2022 08:41:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7BDE6C433D6; Wed, 19 Oct 2022 08:41:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168887; bh=iBCE6CVpGhguyA1nbaVJy4nxf3CDqIVcTmrvTafBJQc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qfLmhB14Al3mqDOLiJJjjgmmDpyxJCH2fl9I9IVNWqFlqZsKM0QrSeKFhoQP8pHaq XYIL4pH4wtVFWKR0VC26SrKCfWulwy1AqaJH6fOTvbzTs61aePuN/pFckYvMIaG0oz ktV/E8hidB8XYWjiAjncmDueS+ums+2mJtExCdU0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sarthak Kukreti , Matthias Kaehlcke , Kees Cook Subject: [PATCH 6.0 070/862] dm: verity-loadpin: Only trust verity targets with enforcement Date: Wed, 19 Oct 2022 10:22:37 +0200 Message-Id: <20221019083253.012028710@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106370354123507?= X-GMAIL-MSGID: =?utf-8?q?1747106370354123507?= From: Matthias Kaehlcke commit 916ef6232cc4b84db7082b4c3d3cf1753d9462ba upstream. Verity targets can be configured to ignore corrupted data blocks. LoadPin must only trust verity targets that are configured to perform some kind of enforcement when data corruption is detected, like returning an error, restarting the system or triggering a panic. Fixes: b6c1c5745ccc ("dm: Add verity helpers for LoadPin") Reported-by: Sarthak Kukreti Signed-off-by: Matthias Kaehlcke Reviewed-by: Sarthak Kukreti Cc: stable@vger.kernel.org Signed-off-by: Kees Cook Link: https://lore.kernel.org/r/20220907133055.1.Ic8a1dafe960dc0f8302e189642bc88ebb785d274@changeid Signed-off-by: Greg Kroah-Hartman --- drivers/md/dm-verity-loadpin.c | 8 ++++++++ drivers/md/dm-verity-target.c | 16 ++++++++++++++++ drivers/md/dm-verity.h | 1 + 3 files changed, 25 insertions(+) diff --git a/drivers/md/dm-verity-loadpin.c b/drivers/md/dm-verity-loadpin.c index 387ec43aef72..4f78cc55c251 100644 --- a/drivers/md/dm-verity-loadpin.c +++ b/drivers/md/dm-verity-loadpin.c @@ -14,6 +14,7 @@ LIST_HEAD(dm_verity_loadpin_trusted_root_digests); static bool is_trusted_verity_target(struct dm_target *ti) { + int verity_mode; u8 *root_digest; unsigned int digest_size; struct dm_verity_loadpin_trusted_root_digest *trd; @@ -22,6 +23,13 @@ static bool is_trusted_verity_target(struct dm_target *ti) if (!dm_is_verity_target(ti)) return false; + verity_mode = dm_verity_get_mode(ti); + + if ((verity_mode != DM_VERITY_MODE_EIO) && + (verity_mode != DM_VERITY_MODE_RESTART) && + (verity_mode != DM_VERITY_MODE_PANIC)) + return false; + if (dm_verity_get_root_digest(ti, &root_digest, &digest_size)) return false; diff --git a/drivers/md/dm-verity-target.c b/drivers/md/dm-verity-target.c index 94b6cb599db4..8a00cc42e498 100644 --- a/drivers/md/dm-verity-target.c +++ b/drivers/md/dm-verity-target.c @@ -1446,6 +1446,22 @@ bool dm_is_verity_target(struct dm_target *ti) return ti->type->module == THIS_MODULE; } +/* + * Get the verity mode (error behavior) of a verity target. + * + * Returns the verity mode of the target, or -EINVAL if 'ti' is not a verity + * target. + */ +int dm_verity_get_mode(struct dm_target *ti) +{ + struct dm_verity *v = ti->private; + + if (!dm_is_verity_target(ti)) + return -EINVAL; + + return v->mode; +} + /* * Get the root digest of a verity target. * diff --git a/drivers/md/dm-verity.h b/drivers/md/dm-verity.h index 45455de1b4bc..98f306ec6a33 100644 --- a/drivers/md/dm-verity.h +++ b/drivers/md/dm-verity.h @@ -134,6 +134,7 @@ extern int verity_hash_for_block(struct dm_verity *v, struct dm_verity_io *io, sector_t block, u8 *digest, bool *is_zero); extern bool dm_is_verity_target(struct dm_target *ti); +extern int dm_verity_get_mode(struct dm_target *ti); extern int dm_verity_get_root_digest(struct dm_target *ti, u8 **root_digest, unsigned int *digest_size); From patchwork Wed Oct 19 08:22: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: 4654 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212526wrs; Wed, 19 Oct 2022 02:07:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4YOnTkqleMJ+AeCUqOcBq3n3MpL2KzFVOusl/KnZdOqsQ1uRsQGMe2bsl4qI0pSH1n+KgP X-Received: by 2002:a17:907:7f25:b0:78d:e76a:ef18 with SMTP id qf37-20020a1709077f2500b0078de76aef18mr5777707ejc.378.1666170463040; Wed, 19 Oct 2022 02:07:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170463; cv=none; d=google.com; s=arc-20160816; b=omqLg1p81HjC8OZFnrKOE0OqnxZHH+Zo8J11lvfXJvKkCv5vDVQafLTcy1XqxnAcan 6petHLE1t1lrPtUffa1SWnp/KNH2GVPjLbtLrM2YKajVzkGCB6olaxR99QpkH87iDXYF RvJuM3z/CcxmlXDE9sth0qBT+0QVry4T1nqw16pMxufmySIxpF8osKMQa8qai0/kWWMW w7oDD2jIQzOyphiecRFv78aVka+JJ+z90EW6SHLankSRotbAwvO1tE8fjJo9pJqXXmAr MhIpZprH6Ad8+emfeXPLjiBvH87QQeY3mdDZouWwYbNEAakvkIX1LO3mbp8VVeuVOp4A NrCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kXABIBFDsmyIZXBdT87jf+FURDwKlr8pTsQrKynsDIE=; b=vmC94njsEgL/tftie0TRrt6sP3vbMhwS5bS+IoMw8AMPpBvabGPrwrvEGgARD/fuCU RLHCIeRrvrU2mHuKgb2nj8lKkWSRCFsV3my1v+k77AlgcHHpb3iWFCmli+DRbjoIqwSL XpEsq6jb5PSG+kF6t2Gk/7FGSnhpkxIxKxvJszmNptVcl1sG+vhR8rVHIcw1QmiKwi55 3SCESVojBIo7bZtRGHbZHXhoq5GjjRI7G5i1CLkLXO7NMzErtWtCpnQ7JPcM9ernKf34 m19rwSVeaqapsRRIs4Ox9uJNi3uQUbXfqkURX2YwEDFgPaMqugycTejgJZPVGyDPetMs mq1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JQvOgoR1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a50ea81000000b00456cc6e1017si12113646edo.109.2022.10.19.02.07.13; Wed, 19 Oct 2022 02:07: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=JQvOgoR1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232151AbiJSJAd (ORCPT + 99 others); Wed, 19 Oct 2022 05:00:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231904AbiJSI6t (ORCPT ); Wed, 19 Oct 2022 04:58: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 5D55FA02D9; Wed, 19 Oct 2022 01:53: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 E3C95617F2; Wed, 19 Oct 2022 08:42:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0242BC433D6; Wed, 19 Oct 2022 08:41:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168920; bh=BX8VTQIPLJW77cNwpmkb/Yr53Pz0B1c4Ovk/HIEfias=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JQvOgoR1A3JjBqrZ65KmJNBqx/r5/LeLxzNXz+idzbblTXVXS/R7+9hER6J1H2B76 l22ozCwXsUikc4EMmqkKRk7LujbNH/pV0QP9KLHRd13++/MOKSvuHkRbKOn/53O93C 31A3PiAGtHriMh9wfMT5yisXWGPypuUIxM/D1JBA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Trimarchi , Dario Binacchi , Sascha Hauer , Vinod Koul Subject: [PATCH 6.0 071/862] dmaengine: mxs: use platform_driver_register Date: Wed, 19 Oct 2022 10:22:38 +0200 Message-Id: <20221019083253.064262397@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106359123150376?= X-GMAIL-MSGID: =?utf-8?q?1747106359123150376?= From: Dario Binacchi commit 26696d4657167112a1079f86cba1739765c1360e upstream. Driver registration fails on SOC imx8mn as its supplier, the clock control module, is probed later than subsys initcall level. This driver uses platform_driver_probe which is not compatible with deferred probing and won't be probed again later if probe function fails due to clock not being available at that time. This patch replaces the use of platform_driver_probe with platform_driver_register which will allow probing the driver later again when the clock control module will be available. The __init annotation has been dropped because it is not compatible with deferred probing. The code is not executed once and its memory cannot be freed. Fixes: a580b8c5429a ("dmaengine: mxs-dma: add dma support for i.MX23/28") Co-developed-by: Michael Trimarchi Signed-off-by: Michael Trimarchi Signed-off-by: Dario Binacchi Acked-by: Sascha Hauer Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman Link: https://lore.kernel.org/r/20220921170556.1055962-1-dario.binacchi@amarulasolutions.com Signed-off-by: Vinod Koul --- drivers/dma/mxs-dma.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) --- a/drivers/dma/mxs-dma.c +++ b/drivers/dma/mxs-dma.c @@ -670,7 +670,7 @@ static enum dma_status mxs_dma_tx_status return mxs_chan->status; } -static int __init mxs_dma_init(struct mxs_dma_engine *mxs_dma) +static int mxs_dma_init(struct mxs_dma_engine *mxs_dma) { int ret; @@ -741,7 +741,7 @@ static struct dma_chan *mxs_dma_xlate(st ofdma->of_node); } -static int __init mxs_dma_probe(struct platform_device *pdev) +static int mxs_dma_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; const struct mxs_dma_type *dma_type; @@ -839,10 +839,7 @@ static struct platform_driver mxs_dma_dr .name = "mxs-dma", .of_match_table = mxs_dma_dt_ids, }, + .probe = mxs_dma_probe, }; -static int __init mxs_dma_module_init(void) -{ - return platform_driver_probe(&mxs_dma_driver, mxs_dma_probe); -} -subsys_initcall(mxs_dma_module_init); +builtin_platform_driver(mxs_dma_driver); From patchwork Wed Oct 19 08:22: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: 5214 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp265059wrs; Wed, 19 Oct 2022 04:21:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7WbKapoRVosy4najYwrtuuiiXhOQCPxDzKOp7niHBRqgeQWAeAsRZMl/is//7Oi6YMW6jH X-Received: by 2002:a17:907:9493:b0:796:1166:70c4 with SMTP id dm19-20020a170907949300b00796116670c4mr196460ejc.59.1666178493214; Wed, 19 Oct 2022 04:21:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178493; cv=none; d=google.com; s=arc-20160816; b=wBja3xUUTgrvEJxdwiGjzqPw/jQojEdWADsovfEl4sEZD/lAcIImH7dNw9CtT2ljiN gSswGFJDvHydd0Dc+uliMp2R2HPDe6izDt8KXuuiYg8MXhUzgiG4crDnkDhBGitziuFy N3LCUoQ1vBTlvsX9j9OYEDVoW9cPFKy36vqB3mQfvgd/nJ5iAIZB0MTgYzpye5c24d7q 16GOJU83neaift45NO6wSoHHSNObC58IWvkQvaSpk4nLjWAleq6U0lIpXV9CJHtqKPxr Jj0dDhDp6ASPnXVLxteh5+iDOdIiJ9jcJDGgTujdI1CE//r6dgBDOKvtZUuPtOuuEE58 SK7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=LJ8bvoD3HZ9kGLyEXHZKDnMOHyNJQxzPTbjPj2ynIhM=; b=AGjrDVhBtOtNulu2WdAp1w887H+bhBOUumoUwonprj4f2rcr3wksLVywa/j2IiG946 pL8ffPId9Xi4M4x7pg2ARrVRBWfMjanTPjVNBRa+J8IiCNdViTkHSI5U1g/oa3qU5WM1 53JkXjk9NmAlOaO7Rf6+6vAAvjvxUI+NjK285ELCYJbOXGbYDJlLgyTdB6h4hb7fNg0/ 3FbshhboRy8khc9T+XfjiJ8SbjSjdD4Kxh6uDp1Uo/Nc/wWF3FK9c3x7rZ7Al5AGke9g Os15chBOVlwYTXJ0UdqONrtUl3cb/VFz/wsoPWwQ28DMzXMvDwMI0taMOo5eNZkXokpI 9bpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PwnBkhXT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gb6-20020a170907960600b0078b96722000si16248906ejc.608.2022.10.19.04.21.04; Wed, 19 Oct 2022 04:21: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=PwnBkhXT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232885AbiJSLLR (ORCPT + 99 others); Wed, 19 Oct 2022 07:11:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232922AbiJSLKI (ORCPT ); Wed, 19 Oct 2022 07:10:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2D9210A7F5; Wed, 19 Oct 2022 03:38: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 2BB71B822E3; Wed, 19 Oct 2022 08:42:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D6AEC433D7; Wed, 19 Oct 2022 08:42:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168955; bh=DuBg9+YDwGfVhiIKCEuJSBEIpdJSRSK0lHMA2+ye9Qk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PwnBkhXTuDQtJW3DpFhHttJU1ykUo7soO7SMyYCAUp/v6rQsHJFFJBkZuiIdQV96m 7bWYVTSgVY2L9LGN8CUWPv5+yg2EI9/A2jlWo9zZRb9ek+xWZ3u2Fw+gzSd4Z/K8FH UaLeAuVNTPPk6oDkII08rMM6lxDwiiTZ24AqJ2T8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christian Marangi , Arnd Bergmann , Dmitry Baryshkov , Vinod Koul Subject: [PATCH 6.0 072/862] dmaengine: qcom-adm: fix wrong sizeof config in slave_config Date: Wed, 19 Oct 2022 10:22:39 +0200 Message-Id: <20221019083253.109400728@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114779532409526?= X-GMAIL-MSGID: =?utf-8?q?1747114779532409526?= From: Christian Marangi commit 7c8765308371be30f50c1b5b97618b731514b207 upstream. Fix broken slave_config function that uncorrectly compare the peripheral_size with the size of the config pointer instead of the size of the config struct. This cause the crci value to be ignored and cause a kernel panic on any slave that use adm driver. To fix this, compare to the size of the struct and NOT the size of the pointer. Fixes: 03de6b273805 ("dmaengine: qcom-adm: stop abusing slave_id config") Signed-off-by: Christian Marangi Cc: stable@vger.kernel.org # v5.17+ Reviewed-by: Arnd Bergmann Reviewed-by: Dmitry Baryshkov Link: https://lore.kernel.org/r/20220915204844.3838-1-ansuelsmth@gmail.com Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman --- drivers/dma/qcom/qcom_adm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/dma/qcom/qcom_adm.c +++ b/drivers/dma/qcom/qcom_adm.c @@ -494,7 +494,7 @@ static int adm_slave_config(struct dma_c spin_lock_irqsave(&achan->vc.lock, flag); memcpy(&achan->slave, cfg, sizeof(struct dma_slave_config)); - if (cfg->peripheral_size == sizeof(config)) + if (cfg->peripheral_size == sizeof(*config)) achan->crci = config->crci; spin_unlock_irqrestore(&achan->vc.lock, flag); From patchwork Wed Oct 19 08:22: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: 4577 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp205319wrs; Wed, 19 Oct 2022 01:49:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6AGWNNuq015Ipb44IxsRFzeZxVvHZF7zYM/NS2QjFw5rIP/VNfk3wbV1xMKqpg+bU9/0AV X-Received: by 2002:a17:902:b589:b0:17f:5756:b3f9 with SMTP id a9-20020a170902b58900b0017f5756b3f9mr7415648pls.14.1666169344399; Wed, 19 Oct 2022 01:49:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169344; cv=none; d=google.com; s=arc-20160816; b=qBIv4XmbMcnazbGKR03ckI5LIDNG8gK5qaC/3DhU164jx9LiBbG1QVRtF1KD+EPbM7 CcocG6R0h9cMaL1QwCBqGEZdvQF8h40y6dgVt9LrcQN4ihgrW5BFjgmyk8ibuStEyBSd JkOAetIibik2ZaekoDulE1BcMwiFs6GDC+pvxEsnxjy+uAFbwzR3X9VKLdgF7oTT3zAJ Ln42qwj8WGmcClytbIT/iHKHccuPaNRYsHt0UzR7FuiX6eibQZaDNHuLhK26N/TPsHUR +g0U/YyU6sodCJPsRXjxuim2MTM/UuPDpdeBk9JiLZ9s4LBPyi/ELw2NTCiII6LG5Sn7 B0Ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0Iu0U5WwratT+qC9qW/lDkrKie8f6zBk3yq+2/poxVA=; b=sSa8epCXrsVuqdHGz/PYY6niLdwibO9wt3e4amQzLZ/DLFjdFWhOv0O2Z9p7wHLfqr a8CT2TBFP1LCyPo3MJhs2XVrNzDzUMxgkUtiyF4vi+1konk7ZccOAZNaUs86Pz22I7Kb fJwfWsMGcoNLPY5IDh3l1XdTpI5+lkRPLM8AbVDR+VU8gdRQ3zZHkBrwZz3w8xE94ghZ TAyfguyUsl1BO91Mjj9VWrK9eTzhBY5S9FBeBX0RWX/XdcwQ5Rc0Oz1z1zl1mdNHfGdO g49uVIwlvqyudVHdtUoEO06kXHFJ020hpSIxNV8hJ5J4SA+gs9OQFjiBPC9k3pkteNvK NA3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="pf3+/k5i"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k6-20020a17090a39c600b0020cccdfc970si27727280pjf.121.2022.10.19.01.48.49; Wed, 19 Oct 2022 01:49: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="pf3+/k5i"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231617AbiJSIs1 (ORCPT + 99 others); Wed, 19 Oct 2022 04:48:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231329AbiJSIry (ORCPT ); Wed, 19 Oct 2022 04:47:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EBD868882; Wed, 19 Oct 2022 01:45: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 6004761804; Wed, 19 Oct 2022 08:42:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71665C433D6; Wed, 19 Oct 2022 08:42:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168961; bh=DKXEvkae9Qlu8kF9vn+0R4ngMyO0P2H39NsbsvQknGY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pf3+/k5irivnJHcVhHx5pNJDwKxPwej9CzZN6KbU0hieVBgkQD/opq/VbuXA8x+Ur MJ7V1XKlytOiheIkdpReqZbBEcGLnKN0Qy9KB41qkHmac6dr2tWzRBSxyWZaWtHyel S4Zj6OERf8UTgNZ0r2Dg4dMlRCAvfFNYgol0sVF8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christian Marangi , Vinod Koul Subject: [PATCH 6.0 073/862] dmaengine: qcom-adm: fix wrong calling convention for prep_slave_sg Date: Wed, 19 Oct 2022 10:22:40 +0200 Message-Id: <20221019083253.160008981@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105186224579779?= X-GMAIL-MSGID: =?utf-8?q?1747105186224579779?= From: Christian Marangi commit b9d2140c3badf4107973ad77c5a0ec3075705c85 upstream. The calling convention for pre_slave_sg is to return NULL on error and provide an error log to the system. Qcom-adm instead provide error pointer when an error occur. This indirectly cause kernel panic for example for the nandc driver that checks only if the pointer returned by device_prep_slave_sg is not NULL. Returning an error pointer makes nandc think the device_prep_slave_sg function correctly completed and makes the kernel panics later in the code. While nandc is the one that makes the kernel crash, it was pointed out that the real problem is qcom-adm not following calling convention for that function. To fix this, drop returning error pointer and return NULL with an error log. Fixes: 03de6b273805 ("dmaengine: qcom-adm: stop abusing slave_id config") Fixes: 5c9f8c2dbdbe ("dmaengine: qcom: Add ADM driver") Signed-off-by: Christian Marangi Cc: stable@vger.kernel.org # v5.11+ Link: https://lore.kernel.org/r/20220916041256.7104-1-ansuelsmth@gmail.com Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman --- drivers/dma/qcom/qcom_adm.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) --- a/drivers/dma/qcom/qcom_adm.c +++ b/drivers/dma/qcom/qcom_adm.c @@ -379,13 +379,13 @@ static struct dma_async_tx_descriptor *a if (blk_size < 0) { dev_err(adev->dev, "invalid burst value: %d\n", burst); - return ERR_PTR(-EINVAL); + return NULL; } crci = achan->crci & 0xf; if (!crci || achan->crci > 0x1f) { dev_err(adev->dev, "invalid crci value\n"); - return ERR_PTR(-EINVAL); + return NULL; } } @@ -403,8 +403,10 @@ static struct dma_async_tx_descriptor *a } async_desc = kzalloc(sizeof(*async_desc), GFP_NOWAIT); - if (!async_desc) - return ERR_PTR(-ENOMEM); + if (!async_desc) { + dev_err(adev->dev, "not enough memory for async_desc struct\n"); + return NULL; + } async_desc->mux = achan->mux ? ADM_CRCI_CTL_MUX_SEL : 0; async_desc->crci = crci; @@ -414,8 +416,10 @@ static struct dma_async_tx_descriptor *a sizeof(*cple) + 2 * ADM_DESC_ALIGN; async_desc->cpl = kzalloc(async_desc->dma_len, GFP_NOWAIT); - if (!async_desc->cpl) + if (!async_desc->cpl) { + dev_err(adev->dev, "not enough memory for cpl struct\n"); goto free; + } async_desc->adev = adev; @@ -437,8 +441,10 @@ static struct dma_async_tx_descriptor *a async_desc->dma_addr = dma_map_single(adev->dev, async_desc->cpl, async_desc->dma_len, DMA_TO_DEVICE); - if (dma_mapping_error(adev->dev, async_desc->dma_addr)) + if (dma_mapping_error(adev->dev, async_desc->dma_addr)) { + dev_err(adev->dev, "dma mapping error for cpl\n"); goto free; + } cple_addr = async_desc->dma_addr + ((void *)cple - async_desc->cpl); @@ -454,7 +460,7 @@ static struct dma_async_tx_descriptor *a free: kfree(async_desc); - return ERR_PTR(-ENOMEM); + return NULL; } /** From patchwork Wed Oct 19 08:22: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: 4553 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp204498wrs; Wed, 19 Oct 2022 01:46:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6WGlLQexbl8n7fInXCObtru/UNUMog9boJJX/TyLthkyCw/7p+d1MslyMi7O138k2gn6Ml X-Received: by 2002:a17:90a:5914:b0:20a:ea11:2620 with SMTP id k20-20020a17090a591400b0020aea112620mr8619644pji.34.1666169177856; Wed, 19 Oct 2022 01:46:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169177; cv=none; d=google.com; s=arc-20160816; b=CrDjoi1+xJdQX12ezUuSsExfLsYzwiABP37oa8oGrqCnH3zyZu7iOHIChJgCQYAvno UoIWwV5aGbiwVniZctBC1A8EfiOw06JebiOvlwAu2ewX8vo7qD/0vySsprTJvWkHK4SU 2jTv1NZbk9cw6qBTsT283VcqhpL6ARGIsgVqUev+X6OJcruTj9vz+aJ+1TXsx0bEqidc clZPPU78guD4s7w5PSPc21lAyopQnHFSRhkETYSbsr18kBdhdgMLUug1oDsKa53PDCDA rjeQDvE7GQp0UoxMHDkrNz6yOH5QrBGU+rb5yGhXAKEEJcMIhdd/AOtUelnrSDpsK1Zs E15Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xlAMPZN5+Rzh3w2HEHD7JCccyqo0eG99osSh/QTzy84=; b=I+NpmoOg7voD7wYX8eborJLX5lfFpY+lUD/QOSLB7uDwW7R8VkhKc9AYTGlL8t06Fc lJ+ePFMUedUFCttCqutiE02DNoO+rBzrjkirydbv5CO77yOBy940jJPbOoWpVJVgF98y 8k/qtBKtoPoLp2sJpeINYUdCOpLjnv+ev4Z3ebjKlazKqDCwvu9aorxBtGVQWIED4gXb 8d1gYHZey3bYWPDhJKNfQPH4QqRcK+K7uP2lnXDc9vNLW9JB9zZm1DnTsDb0IYxF/viM /84IDdN0FNXtVtdtjMiJpshzB37H0xkGMqoTRG9QwJEpGsV01Vjo6m6Ry3mdVX4mnVdn GvEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0NqDg3XW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w9-20020a631609000000b00458ce4748f6si17884307pgl.409.2022.10.19.01.46.05; Wed, 19 Oct 2022 01:46: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=0NqDg3XW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231389AbiJSIpw (ORCPT + 99 others); Wed, 19 Oct 2022 04:45:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231488AbiJSIoQ (ORCPT ); Wed, 19 Oct 2022 04:44:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DED1C167D1; Wed, 19 Oct 2022 01:43: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 8725A617F7; Wed, 19 Oct 2022 08:42:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94BA8C433C1; Wed, 19 Oct 2022 08:42:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168965; bh=al3TEvPjWVGD/y+h+KKD9gzbsKzSiEXqSPPLy5XTUTc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0NqDg3XWm2GddXjoeMnO6vQmfeYGdxy4oieSa2dFk4XFSxmHnKrOLRmjWY1fMqtlI 5Nwdhz1xO215iwE7SgkTbkvbpsEIdWE3WECvAG1EUkywLGD6cMJ19Vz2hxSrtV25D6 zhDx3KFmXg2QZ3+mBLjbcFUA8EzxQ1BvGaEvd2fQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Emil Velikov , Dmitry Osipenko , Gerd Hoffmann Subject: [PATCH 6.0 074/862] drm/virtio: Check whether transferred 2D BO is shmem Date: Wed, 19 Oct 2022 10:22:41 +0200 Message-Id: <20221019083253.201327292@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105011730884067?= X-GMAIL-MSGID: =?utf-8?q?1747105011730884067?= From: Dmitry Osipenko commit e473216b42aa1fd9fc6b94b608b42c210c655908 upstream. Transferred 2D BO always must be a shmem BO. Add check for that to prevent NULL dereference if userspace passes a VRAM BO. Cc: stable@vger.kernel.org Reviewed-by: Emil Velikov Signed-off-by: Dmitry Osipenko Link: http://patchwork.freedesktop.org/patch/msgid/20220630200726.1884320-3-dmitry.osipenko@collabora.com Signed-off-by: Gerd Hoffmann Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/virtio/virtgpu_vq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpu/drm/virtio/virtgpu_vq.c +++ b/drivers/gpu/drm/virtio/virtgpu_vq.c @@ -597,7 +597,7 @@ void virtio_gpu_cmd_transfer_to_host_2d( bool use_dma_api = !virtio_has_dma_quirk(vgdev->vdev); struct virtio_gpu_object_shmem *shmem = to_virtio_gpu_shmem(bo); - if (use_dma_api) + if (virtio_gpu_is_shmem(bo) && use_dma_api) dma_sync_sgtable_for_device(vgdev->vdev->dev.parent, shmem->pages, DMA_TO_DEVICE); From patchwork Wed Oct 19 08:22: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: 4576 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp205280wrs; Wed, 19 Oct 2022 01:48:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7jLPGUuZKln3bo3riQPz9rBWjiRHfLi8Fw14a+Ihkmqivqxur46N7wl5YYpO2dudBLgnXU X-Received: by 2002:a65:6e4a:0:b0:438:874c:53fd with SMTP id be10-20020a656e4a000000b00438874c53fdmr6505962pgb.355.1666169334800; Wed, 19 Oct 2022 01:48:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169334; cv=none; d=google.com; s=arc-20160816; b=rzLaIudEmEoBDl4Em5LccFBh4jBP1qNKhb396bes1H9Z+I8xt6BeHk94H8TV1ejNmu HSFFRiSkNuq5qRhRxBBex3RgEuvEbp4zl1UBZeyWgs/QhrgWi5xK0mYqE889iDtKzp52 RDlS+c2lMJBlU8jR9RTwYOhoIjHbT652/KSh3i26ifMIEQ9XuqoQdlNVliCzmHmCzYPE mI2OaHyzR4YARuuAkyfcc1yJqhOVGGk3gH2TxcnIw9rC1ucrhwsXZwVK9I+aWEcnkoQX eUDe7qQvfryy0DgVrzudyzZaqmTNpmKGsmRDbnmDSnQQ5wfaI/ikar9Dl44Dhiwa4sC/ giVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fs0www+8PA7T57IXMJKXSnpp9C1s8zgnr8gK4cYj7iY=; b=KO8F+VO9UZqHrXteEGaYptsIoNIJtgLuC56EmbJ2pAGs6VtOm5O2waXpFbMkDZ8QEo VicSt0YCKDmzZh+UBKcjXaeiTQxY2AEPr9vhr0rDOlyAnwIicU5CEThkmn0m98xZ5PsF zB2UvKg/ixw6W6DX0vQddnANFOfJc3pQZCYVAzlFnRxRhx1KLeLhuApeKsiXR23fHBUW 3qaBleC11kMJN2FJNS8QjQQhxFkYB9rpSnNSUZTJSEaIpjXSfcfJe1CFvZ6sWDrpmHq2 hnnLD+hqs5nxfGcL6CccwWwXvv7ThIHQV67Kvntbd+fyyXuleHIjjL1HFA1yjSKNH+eC xM6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dJld7rpY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h123-20020a636c81000000b0045a62fd80e8si17415101pgc.468.2022.10.19.01.48.41; Wed, 19 Oct 2022 01:48:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dJld7rpY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231586AbiJSIsQ (ORCPT + 99 others); Wed, 19 Oct 2022 04:48:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231577AbiJSIrs (ORCPT ); Wed, 19 Oct 2022 04:47:48 -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 4A93278202; Wed, 19 Oct 2022 01:45: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 27B1A617E7; Wed, 19 Oct 2022 08:42:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3BA8DC433C1; Wed, 19 Oct 2022 08:42:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168967; bh=ZizTAglFEXVj37CKMUyIA+z7OphHdSQB1tjv3W2T0vQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dJld7rpYfvGv4UtRKuV/yU6nTSDFuu1Hk1cmMxVcbQh0cytgALcCwbNFhXvjpkU8s aDOyusFb5ZAe2DmP0B4ePBVzs9o03f8ihaabw9E6w/T4cYkgCKPGWBz/cz4sj/AAAD a7LryYxOqhthU8vVawrTv70m7fYq4tSNnjauzdQI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Emil Velikov , Dmitry Osipenko , Gerd Hoffmann Subject: [PATCH 6.0 075/862] drm/virtio: Unlock reservations on virtio_gpu_object_shmem_init() error Date: Wed, 19 Oct 2022 10:22:42 +0200 Message-Id: <20221019083253.250754203@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105176509297675?= X-GMAIL-MSGID: =?utf-8?q?1747105176509297675?= From: Dmitry Osipenko commit fdf0ff4d12cbcd76b53f27c96ce51ddca400884a upstream. Unlock reservations in the error code path of virtio_gpu_object_create() to silence debug warning splat produced by ww_mutex_destroy(&obj->lock) when GEM is released with the held lock. Cc: stable@vger.kernel.org Fixes: 30172efbfb84 ("drm/virtio: blob prep: refactor getting pages and attaching backing") Reviewed-by: Emil Velikov Signed-off-by: Dmitry Osipenko Link: http://patchwork.freedesktop.org/patch/msgid/20220630200726.1884320-4-dmitry.osipenko@collabora.com Signed-off-by: Gerd Hoffmann Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/virtio/virtgpu_object.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/gpu/drm/virtio/virtgpu_object.c +++ b/drivers/gpu/drm/virtio/virtgpu_object.c @@ -248,6 +248,8 @@ int virtio_gpu_object_create(struct virt ret = virtio_gpu_object_shmem_init(vgdev, bo, &ents, &nents); if (ret != 0) { + if (fence) + virtio_gpu_array_unlock_resv(objs); virtio_gpu_array_put_free(objs); virtio_gpu_free_object(&shmem_obj->base); return ret; From patchwork Wed Oct 19 08:22:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4581 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp205829wrs; Wed, 19 Oct 2022 01:50:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM45D6hPXWqmaPmUaSt/+06JB8rPEDwtTVty40aYzQelx3uag8vwue+YntATTOHw2BjTtZBg X-Received: by 2002:a17:902:b94c:b0:178:336f:13d6 with SMTP id h12-20020a170902b94c00b00178336f13d6mr7645082pls.64.1666169446966; Wed, 19 Oct 2022 01:50:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169446; cv=none; d=google.com; s=arc-20160816; b=vwHguBVpHWeytTPZtMj3VzvVVpEAQ2fvlhrG3JlabaCrO0MmGdSZoTxQcJZcedTwTm hzy+UrD73IvzpK8XeLTD+JQ2PUfdaYt7B6TH2YRf2ObqwRSxhIpC2da//2V1JdZgUD9s 6nberrAGyT2hAjiU5g0C0sv7DfEQpDN3G1b7fITCF3Iai0Ztpx/7xCugHH1DdRoIvQSs WzjqU5P0u6dIG/FsJckJGhixPWDYN4/AiaFuVh0nsIGiX8n7/YTpwVozaoeNFEp47NyM 2WwIFurfw4iGuTG4FvRnUlNGzPUs1HLQLcApVPK5AKIbhYd033eGYpYDGLpxN9ZCsS/y 8ExQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MkxjeU6M3abUBCp7GZI0PK1TC043mqKPBVbpxao033c=; b=w6FDPTSnI2TfUyfqswUuhSl86oCiFR8jTzEgZogoVe1l84MH15gF4sUNRjYmaWJ4ud 0vgXkgOsfGEJovI6114HV4md4CK17LUNpbUoSNc5lzKSLJWjFuIhvwFI9iqJwsr8g/ff V/1OMm5VSzD8NPz1BO3OHNzOXwi1RC3ksh++9sGsceq0uiZD5I5AtIM1VkfqQS+gVNVm lbhZj/vcTF3Wc9nKfeqND1NIyHr+syGu+tafNSIMiU6S6T10x/Z1FldS7ThTRmruchNg G2EI9Ny/vlTjov3t264do/GTAvvDF3K9a+WRvMmpq3oj3fF+Bf1GaRAxGFC4Ug2qyHz6 vRfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dA0I0WsG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lp16-20020a17090b4a9000b00202c32c06bcsi25594131pjb.126.2022.10.19.01.50.33; Wed, 19 Oct 2022 01:50: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=dA0I0WsG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229977AbiJSIsy (ORCPT + 99 others); Wed, 19 Oct 2022 04:48:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231584AbiJSIsQ (ORCPT ); Wed, 19 Oct 2022 04:48:16 -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 D5EC733848; Wed, 19 Oct 2022 01:46:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id AE38CB822DC; Wed, 19 Oct 2022 08:42:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C958C433D6; Wed, 19 Oct 2022 08:42:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168970; bh=agcjuSq3bveQHzBFdiNuBuaHvt3WmD6K+sd8Pe9wgqw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dA0I0WsG7Hog9z0YK2P3s36zPv7G7tCU69RiXQfy45hay7hHRMMRy8yzsXDPN44Gq kgQXaWz6dzEtuiXKjJ+KZHZc+07eRCa2BhnsNE/0bCW2tGKD7wZLKXte41ZFd0BALG o1Sf2IZCgTB4nE6AHb7jCG83v3V95k2TsOvPp17Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Thomas_Hellstr=C3=B6m?= , Dmitry Osipenko , Gerd Hoffmann Subject: [PATCH 6.0 076/862] drm/virtio: Unlock reservations on dma_resv_reserve_fences() error Date: Wed, 19 Oct 2022 10:22:43 +0200 Message-Id: <20221019083253.299039750@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105294475610348?= X-GMAIL-MSGID: =?utf-8?q?1747105294475610348?= From: Dmitry Osipenko commit 0f877398d30e1df657a31a62f7c7de1869b072b5 upstream. Unlock reservations on dma_resv_reserve_fences() error to fix recursive locking of the reservations when this error happens. Cc: stable@vger.kernel.org Fixes: c8d4c18bfbc4 ("dma-buf/drivers: make reserving a shared slot mandatory v4") Reviewed-by: Thomas Hellström Signed-off-by: Dmitry Osipenko Link: http://patchwork.freedesktop.org/patch/msgid/20220630200726.1884320-5-dmitry.osipenko@collabora.com Signed-off-by: Gerd Hoffmann Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/virtio/virtgpu_gem.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/virtio/virtgpu_gem.c +++ b/drivers/gpu/drm/virtio/virtgpu_gem.c @@ -228,8 +228,10 @@ int virtio_gpu_array_lock_resv(struct vi for (i = 0; i < objs->nents; ++i) { ret = dma_resv_reserve_fences(objs->objs[i]->resv, 1); - if (ret) + if (ret) { + virtio_gpu_array_unlock_resv(objs); return ret; + } } return ret; } From patchwork Wed Oct 19 08:22: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: 4557 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp204663wrs; Wed, 19 Oct 2022 01:46:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM78l39jepVt1pp6HlO6fDZ1jLn4cWk7xd88lx5fc3M9RYEpvS9VR2YY8kvLDkNrGd8DtVP/ X-Received: by 2002:a17:90b:4a90:b0:20d:5c5e:1622 with SMTP id lp16-20020a17090b4a9000b0020d5c5e1622mr44618678pjb.50.1666169209266; Wed, 19 Oct 2022 01:46:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169209; cv=none; d=google.com; s=arc-20160816; b=w48jO1G3cVwgaeYm15bjLCBMhjbi52JX93IA9YKOV25FPezIsNPEoQPeF0TC1TiYo9 M8D3a90/PbsqJxD4Bat4XA40B3L4rlkwlWj2O9YY1+GO9N7WM00qILgG5R/QkQz+Baoa XDx7I+l1oOeV4lQycjghNNmhL6quGLMzSD4VUJ17MBoKg5FSkHLSWFsHItuGK5KRE2EA 3nBx17ppSqJ/RsJpWA5AST6FtHsGhmhZJgHsLarJ/Qfdq+0vG+muKlJNXX3esCmMvuzt cFurQUru72Lo/P9LdcA8/TaJNqyFBQxEP+t78f3jRzB9zG5Se1qN+2gOre3iAu65oT8m tArQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Fi7CoqUq7ZQ/iKNziBkLwqLr8c0taNoRZVPEr7KMkEs=; b=KFg7ejayLppcufrsxPtRLvmfSYFR9MgVs97zopU1tEj8EOkOQTbyt3N6llX14XQvh4 DsB58c6CqEbu9aspx+vnJFPOBzDCdo1HUQDTq75y4GzawjvP+OC3zozbwDwk4YuO1Y0n DR7C7wwrqdqXW7VyiAmEtVkrMCwLUKh2IxgI5n8jSGS6qGJu2IM+0RKF123s9SiAP4/i Big4LV94fxtxtI/whCxcbYSp8SBurPhUF1hbnfjLsU7Ayzfl1aLoPU2f65fthL40r7DR zesKchWNI2QcAJ4uKswXy8+vs7OLQar/ZX6fNvq3lO4IfVR2szCuCfjFANtbOdI28HY+ J0sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BoXLGdYE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 69-20020a630448000000b0046af6471adasi19034082pge.282.2022.10.19.01.46.27; Wed, 19 Oct 2022 01: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=BoXLGdYE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231349AbiJSIqI (ORCPT + 99 others); Wed, 19 Oct 2022 04:46:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231522AbiJSIoV (ORCPT ); Wed, 19 Oct 2022 04: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 B77C688DE9; Wed, 19 Oct 2022 01:43: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 C67E961805; Wed, 19 Oct 2022 08:42:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E019FC433D6; Wed, 19 Oct 2022 08:42:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168973; bh=MbFzbGmRV9ls7pOfhD3dBXJvQ3BbcGXsMvn+R0z7rNM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BoXLGdYE01ZpsBLxMXD4E18Mciopu3kel3d44ABH/q2as4XdIIuAINmvAzR/eP7// Mo+fsaMsUay06w4/3/W7oebfX1E7auEx087qAU+AQxREn0/UzrenukbbGGbxvz7rI7 sef4K01tNem9BcLgXp4a0lmWKOh2vYfibPk1v5LQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Osipenko , Gerd Hoffmann Subject: [PATCH 6.0 077/862] drm/virtio: Use appropriate atomic state in virtio_gpu_plane_cleanup_fb() Date: Wed, 19 Oct 2022 10:22:44 +0200 Message-Id: <20221019083253.347461689@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105044578304745?= X-GMAIL-MSGID: =?utf-8?q?1747105044578304745?= From: Dmitry Osipenko commit 4656b3a26a9e9fe5f04bfd2ab55b066266ba7f4d upstream. Make virtio_gpu_plane_cleanup_fb() to clean the state which DRM core wants to clean up and not the current plane's state. Normally the older atomic state is cleaned up, but the newer state could also be cleaned up in case of aborted commits. Cc: stable@vger.kernel.org Signed-off-by: Dmitry Osipenko Link: http://patchwork.freedesktop.org/patch/msgid/20220630200726.1884320-6-dmitry.osipenko@collabora.com Signed-off-by: Gerd Hoffmann Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/virtio/virtgpu_plane.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/gpu/drm/virtio/virtgpu_plane.c +++ b/drivers/gpu/drm/virtio/virtgpu_plane.c @@ -266,14 +266,14 @@ static int virtio_gpu_plane_prepare_fb(s } static void virtio_gpu_plane_cleanup_fb(struct drm_plane *plane, - struct drm_plane_state *old_state) + struct drm_plane_state *state) { struct virtio_gpu_framebuffer *vgfb; - if (!plane->state->fb) + if (!state->fb) return; - vgfb = to_virtio_gpu_framebuffer(plane->state->fb); + vgfb = to_virtio_gpu_framebuffer(state->fb); if (vgfb->fence) { dma_fence_put(&vgfb->fence->f); vgfb->fence = NULL; From patchwork Wed Oct 19 08:22: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: 5497 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp335981wrs; Wed, 19 Oct 2022 06:46:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM58P2PC+DeIaHZZ4l7OqlUNciU2aZuSnrqQ3r/lQHR2XekVlTyENyLu9beQIJC0cZ15xlex X-Received: by 2002:a17:90b:350d:b0:20d:5438:f594 with SMTP id ls13-20020a17090b350d00b0020d5438f594mr46416937pjb.216.1666187169273; Wed, 19 Oct 2022 06:46:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666187169; cv=none; d=google.com; s=arc-20160816; b=W3i2PQt13cFZFj8eB8xcbI7TswUrXmqicD/ZtqwWuVPUtOL5fFsCmIyPaBHXsu69Q7 THBvSk9tOeJ8uRUjQKXAGsP1/iEidvuE04J8UKGlrd+O7XT0wBzldJNnIGT45nZ7In+f LJFJfulUfMx10fxx+N4hjXp0dVC7zqWo9kluSVxOxrAYR1lU2nxGVFH1D3hQblgPPoy0 nJuKs4woIH46e0E0YdQOEKzkEvE1+38aoLOY6U8088NqwMt3n/5+Z9YeLNQafZHAk6xh 4yTRUlMyplsjeXuBxWQw3UKDZiN8hdcpr84zIwjg22bwoxRKM0SUJgPhYn8yhqR3nmjq Cujg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lIr7zUBh7gEOnVYkFX4fK5I1VdldRrFJBAM1RtwXnjI=; b=jgkB7UxiwLZMt7c89+pgtuEyoAAi2isclWFMJj0qXgwRcb3uapDTGewellgyDzJdYb LA5vw2IG4S3tWm/Rp4llP/TPuyFqJ+UATFlvncRCVMLv1j2q3p4v3EQhdumQ58VmAmJ/ pGWsbZU57SpM68iKbf5OgzS8c15CDltEP0wzzH/ZyGkGOewjdMfWP9+iFIbFURf5nJM2 Jiphdl7Chy+J94azEKwpDJq4v85+/6viOs72QNNyi4q7/nHofM3xY+e24vnDekiVRN4U 5PB8zOdDpATihVlTtwuJBGedapH/2OCWWFvTAOS1Vz830hz3iUyIHUdUT54abskDCx6T gsLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=neQiCSSC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w63-20020a636242000000b0043c24cec6b4si17628485pgb.739.2022.10.19.06.45.56; Wed, 19 Oct 2022 06:46: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=neQiCSSC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233104AbiJSNpc (ORCPT + 99 others); Wed, 19 Oct 2022 09:45:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233551AbiJSNoX (ORCPT ); Wed, 19 Oct 2022 09:44:23 -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 436A31BE1FE; Wed, 19 Oct 2022 06:31: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 sin.source.kernel.org (Postfix) with ESMTPS id E2869CE20F0; Wed, 19 Oct 2022 08:41:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E51D6C433C1; Wed, 19 Oct 2022 08:40:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168859; bh=gMan5kpbovKahV/1vwN9rBg7BvTH6IpSR+9l0CZ8VNw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=neQiCSSCOEvLsfJWN21OS4Qy36XWm48vWD6YRoxZrU0LnpZ3OsJ1qfUVXlSkEcDcf 9BO65YJpr9CYwWnkyUacecwCQT4qjpOiW3xjRBbzWtHJjSzmD7k6nTABKuHPm11DSW w0LITC8wrHShXKL8LzXHnC94AQX65DEb34QPeipY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Vetter , Takashi Iwai , Thomas Zimmermann Subject: [PATCH 6.0 078/862] drm/udl: Restore display mode on resume Date: Wed, 19 Oct 2022 10:22:45 +0200 Message-Id: <20221019083253.385002253@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123876814273739?= X-GMAIL-MSGID: =?utf-8?q?1747123876814273739?= From: Takashi Iwai commit 6d6e732835db92e66c28dbcf258a7e3d3c71420d upstream. Restore the display mode whne resuming from suspend. Currently, the display remains dark. On resume, the CRTC's mode does not change, but the 'active' flag changes to 'true'. Taking this into account when considering a mode switch restores the display mode. The bug is reproducable by using Gnome with udl and observing the adapter's suspend/resume behavior. Actually, the whole check added in udl_simple_display_pipe_enable() about the crtc_state->mode_changed was bogus. We should drop the whole check and always apply the mode change in this function. [ tiwai -- Drop the mode_changed check entirely instead, per Daniel's suggestion ] Fixes: 997d33c35618 ("drm/udl: Inline DPMS code into CRTC enable and disable functions") Cc: Suggested-by: Daniel Vetter Reviewed-by: Daniel Vetter Signed-off-by: Takashi Iwai Signed-off-by: Thomas Zimmermann Link: https://patchwork.freedesktop.org/patch/msgid/20220908095115.23396-2-tiwai@suse.de Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/udl/udl_modeset.c | 3 --- 1 file changed, 3 deletions(-) --- a/drivers/gpu/drm/udl/udl_modeset.c +++ b/drivers/gpu/drm/udl/udl_modeset.c @@ -382,9 +382,6 @@ udl_simple_display_pipe_enable(struct dr udl_handle_damage(fb, &shadow_plane_state->data[0], 0, 0, fb->width, fb->height); - if (!crtc_state->mode_changed) - return; - /* enable display */ udl_crtc_write_mode_to_hw(crtc); } From patchwork Wed Oct 19 08:22: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: 4601 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp206454wrs; Wed, 19 Oct 2022 01:52:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7/G8J8+paeU5LrTRFLnHNR+OKBj8MZyN2jijXRBo9MAjloYhMqomH9IH3lI6DMP0bxW/NQ X-Received: by 2002:a05:6a02:303:b0:458:1e4b:1e89 with SMTP id bn3-20020a056a02030300b004581e4b1e89mr6065285pgb.123.1666169546442; Wed, 19 Oct 2022 01:52:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169546; cv=none; d=google.com; s=arc-20160816; b=SzlH+4BAsHhF2FEYFtQpN0SEPQ9z9m71qU6XczfrwIEVRs2LMIVlV6XtUq1lvjzEEs lgbG9v8UuObenZzVBIyMY3E2eInW2/8JTBGqFNaCb7gdqf23yjWeCcC3wjDoYT+DD1qS Mwzouud12OZ7v9Z2ff1QJCswrlRqUoKVm+BL1oX4M2bPbbKFutLzzJrgScNavN0ZjRzV 8bHhK8JkCL9MkxA6yQG30yGtvv1WMIcpVtagVs/BgdttRToRGmkaCT0rEe8OilBPxKmG 8J2fsxfnxino9FJM3AGPlmEgu7eWIS8Mh+8sEjYutNZXDEYmASgbVATdmNYtWuIHU1K1 2qSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JiXRU/f9/IT+BOf12Wi3Y62+Y5wxn8CTBhoKOGvbs0I=; b=kXmOaMIJJ1brp3lDDZNG4HluBdtT16CsyCzZI5d3VIiRjLk9mEbAIqWiXzP0sgwDKW nL9xtaKSuH0WxZXY2L6A33DmxPbytiQtWR1H4HHVTRPiZ77OsIFWfcM+zj5uRC8h4S19 Cf6eDAEwIJecH1iUEPSlYcrWu+whg0C2r8loDoDXYyq57NFX++M3unvj1QQ3jb88tW8j sKngf61BaeGeuzwd8u9c8xQ4u2yyQvXaUbXy63FXIY+IWi22htZENUuZ6nmRBSLOC43p 4/J/vPoTflv8+lM5s0lFQgEfx30L9V9CaE2ZuWWkbzTz6DvlLtTA1QsInleqhweQzkll FkEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="g1kgd/xY"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rm9-20020a17090b3ec900b001faf9ba369fsi25696093pjb.164.2022.10.19.01.52.14; Wed, 19 Oct 2022 01: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="g1kgd/xY"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231740AbiJSIv6 (ORCPT + 99 others); Wed, 19 Oct 2022 04:51:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231977AbiJSIuD (ORCPT ); Wed, 19 Oct 2022 04:50: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 674B27E820; Wed, 19 Oct 2022 01:48: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 112AE617D4; Wed, 19 Oct 2022 08:41:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 045F8C4314E; Wed, 19 Oct 2022 08:41:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168862; bh=B3Gc/Ox7Kvpw0MAEuv2peOAmDbDxIk82ntLd8mN+vlw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g1kgd/xYWXEizTgjau2to9c/GlqCvLIJYiQi2HeYywxbrm8vJsX0NQvcDBXMejVVU JfGsgYArIQRedVE1cLevy513bbc0s9vMwnGHMkqtoLSiTUBTnXglep/yhlm3hAa0k7 M1dolTavTSluU9YiTIFc7maD2i5RxjZpaTdVWraE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Collingbourne , Evgenii Stepanov , Catalin Marinas , kernel test robot Subject: [PATCH 6.0 079/862] arm64: mte: move register initialization to C Date: Wed, 19 Oct 2022 10:22:46 +0200 Message-Id: <20221019083253.425125732@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105398469480174?= X-GMAIL-MSGID: =?utf-8?q?1747105398469480174?= From: Peter Collingbourne commit 973b9e37330656dec719ede508e4dc40e5c2d80c upstream. If FEAT_MTE2 is disabled via the arm64.nomte command line argument on a CPU that claims to support FEAT_MTE2, the kernel will use Tagged Normal in the MAIR. If we interpret arm64.nomte to mean that the CPU does not in fact implement FEAT_MTE2, setting the system register like this may lead to UNSPECIFIED behavior. Fix it by arranging for MAIR to be set in the C function cpu_enable_mte which is called based on the sanitized version of the system register. There is no need for the rest of the MTE-related system register initialization to happen from assembly, with the exception of TCR_EL1, which must be set to include at least TBI1 because the secondary CPUs access KASan-allocated data structures early. Therefore, make the TCR_EL1 initialization unconditional and move the rest of the initialization to cpu_enable_mte so that we no longer have a dependency on the unsanitized ID register value. Co-developed-by: Evgenii Stepanov Signed-off-by: Peter Collingbourne Signed-off-by: Evgenii Stepanov Suggested-by: Catalin Marinas Reported-by: kernel test robot Fixes: 3b714d24ef17 ("arm64: mte: CPU feature detection and initial sysreg configuration") Cc: # 5.10.x Link: https://lore.kernel.org/r/20220915222053.3484231-1-eugenis@google.com Signed-off-by: Catalin Marinas Signed-off-by: Greg Kroah-Hartman --- arch/arm64/include/asm/mte.h | 5 ++++ arch/arm64/kernel/cpufeature.c | 3 +- arch/arm64/kernel/mte.c | 51 +++++++++++++++++++++++++++++++++++++++++ arch/arm64/kernel/suspend.c | 2 + arch/arm64/mm/proc.S | 46 ++++-------------------------------- 5 files changed, 65 insertions(+), 42 deletions(-) --- a/arch/arm64/include/asm/mte.h +++ b/arch/arm64/include/asm/mte.h @@ -42,7 +42,9 @@ void mte_sync_tags(pte_t old_pte, pte_t void mte_copy_page_tags(void *kto, const void *kfrom); void mte_thread_init_user(void); void mte_thread_switch(struct task_struct *next); +void mte_cpu_setup(void); void mte_suspend_enter(void); +void mte_suspend_exit(void); long set_mte_ctrl(struct task_struct *task, unsigned long arg); long get_mte_ctrl(struct task_struct *task); int mte_ptrace_copy_tags(struct task_struct *child, long request, @@ -72,6 +74,9 @@ static inline void mte_thread_switch(str static inline void mte_suspend_enter(void) { } +static inline void mte_suspend_exit(void) +{ +} static inline long set_mte_ctrl(struct task_struct *task, unsigned long arg) { return 0; --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -2034,7 +2034,8 @@ static void bti_enable(const struct arm6 static void cpu_enable_mte(struct arm64_cpu_capabilities const *cap) { sysreg_clear_set(sctlr_el1, 0, SCTLR_ELx_ATA | SCTLR_EL1_ATA0); - isb(); + + mte_cpu_setup(); /* * Clear the tags in the zero page. This needs to be done via the --- a/arch/arm64/kernel/mte.c +++ b/arch/arm64/kernel/mte.c @@ -285,6 +285,49 @@ void mte_thread_switch(struct task_struc mte_check_tfsr_el1(); } +void mte_cpu_setup(void) +{ + u64 rgsr; + + /* + * CnP must be enabled only after the MAIR_EL1 register has been set + * up. Inconsistent MAIR_EL1 between CPUs sharing the same TLB may + * lead to the wrong memory type being used for a brief window during + * CPU power-up. + * + * CnP is not a boot feature so MTE gets enabled before CnP, but let's + * make sure that is the case. + */ + BUG_ON(read_sysreg(ttbr0_el1) & TTBR_CNP_BIT); + BUG_ON(read_sysreg(ttbr1_el1) & TTBR_CNP_BIT); + + /* Normal Tagged memory type at the corresponding MAIR index */ + sysreg_clear_set(mair_el1, + MAIR_ATTRIDX(MAIR_ATTR_MASK, MT_NORMAL_TAGGED), + MAIR_ATTRIDX(MAIR_ATTR_NORMAL_TAGGED, + MT_NORMAL_TAGGED)); + + write_sysreg_s(KERNEL_GCR_EL1, SYS_GCR_EL1); + + /* + * If GCR_EL1.RRND=1 is implemented the same way as RRND=0, then + * RGSR_EL1.SEED must be non-zero for IRG to produce + * pseudorandom numbers. As RGSR_EL1 is UNKNOWN out of reset, we + * must initialize it. + */ + rgsr = (read_sysreg(CNTVCT_EL0) & SYS_RGSR_EL1_SEED_MASK) << + SYS_RGSR_EL1_SEED_SHIFT; + if (rgsr == 0) + rgsr = 1 << SYS_RGSR_EL1_SEED_SHIFT; + write_sysreg_s(rgsr, SYS_RGSR_EL1); + + /* clear any pending tag check faults in TFSR*_EL1 */ + write_sysreg_s(0, SYS_TFSR_EL1); + write_sysreg_s(0, SYS_TFSRE0_EL1); + + local_flush_tlb_all(); +} + void mte_suspend_enter(void) { if (!system_supports_mte()) @@ -301,6 +344,14 @@ void mte_suspend_enter(void) mte_check_tfsr_el1(); } +void mte_suspend_exit(void) +{ + if (!system_supports_mte()) + return; + + mte_cpu_setup(); +} + long set_mte_ctrl(struct task_struct *task, unsigned long arg) { u64 mte_ctrl = (~((arg & PR_MTE_TAG_MASK) >> PR_MTE_TAG_SHIFT) & --- a/arch/arm64/kernel/suspend.c +++ b/arch/arm64/kernel/suspend.c @@ -43,6 +43,8 @@ void notrace __cpu_suspend_exit(void) { unsigned int cpu = smp_processor_id(); + mte_suspend_exit(); + /* * We are resuming from reset with the idmap active in TTBR0_EL1. * We must uninstall the idmap and restore the expected MMU --- a/arch/arm64/mm/proc.S +++ b/arch/arm64/mm/proc.S @@ -48,17 +48,19 @@ #ifdef CONFIG_KASAN_HW_TAGS #define TCR_MTE_FLAGS TCR_TCMA1 | TCR_TBI1 | TCR_TBID1 -#else +#elif defined(CONFIG_ARM64_MTE) /* * The mte_zero_clear_page_tags() implementation uses DC GZVA, which relies on * TBI being enabled at EL1. */ #define TCR_MTE_FLAGS TCR_TBI1 | TCR_TBID1 +#else +#define TCR_MTE_FLAGS 0 #endif /* * Default MAIR_EL1. MT_NORMAL_TAGGED is initially mapped as Normal memory and - * changed during __cpu_setup to Normal Tagged if the system supports MTE. + * changed during mte_cpu_setup to Normal Tagged if the system supports MTE. */ #define MAIR_EL1_SET \ (MAIR_ATTRIDX(MAIR_ATTR_DEVICE_nGnRnE, MT_DEVICE_nGnRnE) | \ @@ -426,46 +428,8 @@ SYM_FUNC_START(__cpu_setup) mov_q mair, MAIR_EL1_SET mov_q tcr, TCR_TxSZ(VA_BITS) | TCR_CACHE_FLAGS | TCR_SMP_FLAGS | \ TCR_TG_FLAGS | TCR_KASLR_FLAGS | TCR_ASID16 | \ - TCR_TBI0 | TCR_A1 | TCR_KASAN_SW_FLAGS - -#ifdef CONFIG_ARM64_MTE - /* - * Update MAIR_EL1, GCR_EL1 and TFSR*_EL1 if MTE is supported - * (ID_AA64PFR1_EL1[11:8] > 1). - */ - mrs x10, ID_AA64PFR1_EL1 - ubfx x10, x10, #ID_AA64PFR1_MTE_SHIFT, #4 - cmp x10, #ID_AA64PFR1_MTE - b.lt 1f - - /* Normal Tagged memory type at the corresponding MAIR index */ - mov x10, #MAIR_ATTR_NORMAL_TAGGED - bfi mair, x10, #(8 * MT_NORMAL_TAGGED), #8 + TCR_TBI0 | TCR_A1 | TCR_KASAN_SW_FLAGS | TCR_MTE_FLAGS - mov x10, #KERNEL_GCR_EL1 - msr_s SYS_GCR_EL1, x10 - - /* - * If GCR_EL1.RRND=1 is implemented the same way as RRND=0, then - * RGSR_EL1.SEED must be non-zero for IRG to produce - * pseudorandom numbers. As RGSR_EL1 is UNKNOWN out of reset, we - * must initialize it. - */ - mrs x10, CNTVCT_EL0 - ands x10, x10, #SYS_RGSR_EL1_SEED_MASK - csinc x10, x10, xzr, ne - lsl x10, x10, #SYS_RGSR_EL1_SEED_SHIFT - msr_s SYS_RGSR_EL1, x10 - - /* clear any pending tag check faults in TFSR*_EL1 */ - msr_s SYS_TFSR_EL1, xzr - msr_s SYS_TFSRE0_EL1, xzr - - /* set the TCR_EL1 bits */ - mov_q x10, TCR_MTE_FLAGS - orr tcr, tcr, x10 -1: -#endif tcr_clear_errata_bits tcr, x9, x5 #ifdef CONFIG_ARM64_VA_BITS_52 From patchwork Wed Oct 19 08:22: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: 4615 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp211824wrs; Wed, 19 Oct 2022 02:06:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Vk5KtRr7vKjaXKcS9LCuvLV7U1FfZrurhSOfkjKkjeAWluk/YVQbHeSZp3FkrNAOLFf4c X-Received: by 2002:a05:6402:11c9:b0:45d:aa9b:5193 with SMTP id j9-20020a05640211c900b0045daa9b5193mr6443456edw.372.1666170360104; Wed, 19 Oct 2022 02:06:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170360; cv=none; d=google.com; s=arc-20160816; b=S/d5VFqAIIGz0lh4QNDcuO7Ql+/k1BoVfsIXe1q5NsLEDb38Ldtt9Lb89IlJZO8TId E15pQHmREZf1m1jUbB2u1Sl2BSYTnOZPzesc52pWefnlAJZfkQ0eoCozNjf8xGjlB82l FIdndGgkLZvDNPfpusGsSeB+Bo6xN27Gjhuew+PLuWWMRVi8H2miiCjwEPYW5dNl53oZ iYdSToir/cHt6P7f/wbhk6sbahyeNjfJ8yslATMG6PMMW/Haz7ryTbZ2HXc2vYfZw+pL xRlGBG6iovu9X9QHhEMGXWkjlNY5R/q2EENXle5oJILNuBpKQbv+TVd1uWmABJ3H6A4i IWmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=N2misS1w1ONroJWCNocTK5akbnnYQRk/5rVXcJ/7nS8=; b=qWONAtYRzZZU+P0Rg8H1AobnrIUiFCy98I6ACRb4tv5CanCa3/qILtxYHAd5nmKouY rf5oPLkUwwK1OL4fx/n+L7EZQ862mf+mQ54lA1S42Nmpr1qvocQcj9TdSXQi50AVZiQQ Vp7CtFtmU5Nw8DdlHK7aq0F6zLMNvyDZou7JJtRlpSin4kW3Taxe2C9cQs+Ah2AoC4HA x/19B3JBFQY/bCVmoypdj7q2cJ+PNet5IMhsO7vUCS7g2AL6jm4/2PTdOzhJHzHMwIg1 kBahrb++O2DGXOPgFXnfWrFPN2DCqMG9iRxtWEu3ImbWdlIiSwyeIs5WdfQFqfHJ3QWg qLMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HUXjKpV8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f14-20020a056402354e00b00457dcfa56cbsi15929592edd.343.2022.10.19.02.05.29; Wed, 19 Oct 2022 02:06: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=HUXjKpV8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231672AbiJSIzN (ORCPT + 99 others); Wed, 19 Oct 2022 04:55:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231700AbiJSIxa (ORCPT ); Wed, 19 Oct 2022 04:53: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 B97CCB1C7; Wed, 19 Oct 2022 01:50:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 091EA617D6; Wed, 19 Oct 2022 08:41:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EEDC4C433C1; Wed, 19 Oct 2022 08:41:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168865; bh=je0W2XLdwrvLTtP83c1MCms7oFNpxun5DNxSf+R8vrU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HUXjKpV8yX6ffgMhn2TCcJzVJBmMryNxHqIDfeQRWDwSV+0/wzHUxrTVgz+oM8/vv QAytusM2xVrS2YzJ9310Pyyj5CAmvroEoZDVXZOILriTY80bEoM5re+os3HGZZOxuO U7C4aLPHCgmOdFoDug4KdichjIPTB4f2uiT2nzPc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Catalin Marinas , syzbot+c2c79c6d6eddc5262b77@syzkaller.appspotmail.com, Steven Price , Andrey Konovalov , Vincenzo Frascino , Will Deacon Subject: [PATCH 6.0 080/862] arm64: mte: Avoid setting PG_mte_tagged if no tags cleared or restored Date: Wed, 19 Oct 2022 10:22:47 +0200 Message-Id: <20221019083253.465868363@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106251402455468?= X-GMAIL-MSGID: =?utf-8?q?1747106251402455468?= From: Catalin Marinas commit a8e5e5146ad08d794c58252bab00b261045ef16d upstream. Prior to commit 69e3b846d8a7 ("arm64: mte: Sync tags for pages where PTE is untagged"), mte_sync_tags() was only called for pte_tagged() entries (those mapped with PROT_MTE). Therefore mte_sync_tags() could safely use test_and_set_bit(PG_mte_tagged, &page->flags) without inadvertently setting PG_mte_tagged on an untagged page. The above commit was required as guests may enable MTE without any control at the stage 2 mapping, nor a PROT_MTE mapping in the VMM. However, the side-effect was that any page with a PTE that looked like swap (or migration) was getting PG_mte_tagged set automatically. A subsequent page copy (e.g. migration) copied the tags to the destination page even if the tags were owned by KASAN. This issue was masked by the page_kasan_tag_reset() call introduced in commit e5b8d9218951 ("arm64: mte: reset the page tag in page->flags"). When this commit was reverted (20794545c146), KASAN started reporting access faults because the overriding tags in a page did not match the original page->flags (with CONFIG_KASAN_HW_TAGS=y): BUG: KASAN: invalid-access in copy_page+0x10/0xd0 arch/arm64/lib/copy_page.S:26 Read at addr f5ff000017f2e000 by task syz-executor.1/2218 Pointer tag: [f5], memory tag: [f2] Move the PG_mte_tagged bit setting from mte_sync_tags() to the actual place where tags are cleared (mte_sync_page_tags()) or restored (mte_restore_tags()). Signed-off-by: Catalin Marinas Reported-by: syzbot+c2c79c6d6eddc5262b77@syzkaller.appspotmail.com Fixes: 69e3b846d8a7 ("arm64: mte: Sync tags for pages where PTE is untagged") Cc: # 5.14.x Cc: Steven Price Cc: Andrey Konovalov Cc: Vincenzo Frascino Cc: Will Deacon Link: https://lore.kernel.org/r/0000000000004387dc05e5888ae5@google.com/ Reviewed-by: Steven Price Link: https://lore.kernel.org/r/20221006163354.3194102-1-catalin.marinas@arm.com Signed-off-by: Catalin Marinas Signed-off-by: Greg Kroah-Hartman --- arch/arm64/kernel/mte.c | 9 +++++++-- arch/arm64/mm/mteswap.c | 7 ++++++- 2 files changed, 13 insertions(+), 3 deletions(-) --- a/arch/arm64/kernel/mte.c +++ b/arch/arm64/kernel/mte.c @@ -48,7 +48,12 @@ static void mte_sync_page_tags(struct pa if (!pte_is_tagged) return; - mte_clear_page_tags(page_address(page)); + /* + * Test PG_mte_tagged again in case it was racing with another + * set_pte_at(). + */ + if (!test_and_set_bit(PG_mte_tagged, &page->flags)) + mte_clear_page_tags(page_address(page)); } void mte_sync_tags(pte_t old_pte, pte_t pte) @@ -64,7 +69,7 @@ void mte_sync_tags(pte_t old_pte, pte_t /* if PG_mte_tagged is set, tags have already been initialised */ for (i = 0; i < nr_pages; i++, page++) { - if (!test_and_set_bit(PG_mte_tagged, &page->flags)) + if (!test_bit(PG_mte_tagged, &page->flags)) mte_sync_page_tags(page, old_pte, check_swap, pte_is_tagged); } --- a/arch/arm64/mm/mteswap.c +++ b/arch/arm64/mm/mteswap.c @@ -53,7 +53,12 @@ bool mte_restore_tags(swp_entry_t entry, if (!tags) return false; - mte_restore_page_tags(page_address(page), tags); + /* + * Test PG_mte_tagged again in case it was racing with another + * set_pte_at(). + */ + if (!test_and_set_bit(PG_mte_tagged, &page->flags)) + mte_restore_page_tags(page_address(page), tags); return true; } From patchwork Wed Oct 19 08:22: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: 4569 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp204873wrs; Wed, 19 Oct 2022 01:47:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5oO7Cx43fPTqIju6LxpjZaIA/D0tV7qGulYW+Psyb5/YkB17M5JgFAaluUTFvO3DAGoSjG X-Received: by 2002:a17:902:d302:b0:17f:814e:5825 with SMTP id b2-20020a170902d30200b0017f814e5825mr7133205plc.40.1666169259126; Wed, 19 Oct 2022 01:47:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169259; cv=none; d=google.com; s=arc-20160816; b=WsGu82G13e7su3ZmakoriUoS5zOu3DgB7Rb9JhG1FsBaE38t57oQMcvRmuu2kjb2K+ TAnfk/4WsuO7biwG11oqeMMw+adyy+B5K4NSnPkl8phXlwluDrIKWhEjGoY3pEDOWZYb DyWN55BdPAeqYjjnUWyJI2/t1xQP+q3mq7BrOF8FZ5GjhrBn0FfE0Z22JqFLIzFfJ7Qm 6wEj5XQlaVk5v3gsQ6khkafCgwQkBEltUGbZWTs1hE2xia3hCd8rDVmJjB9Q3GDQcyN5 AaN0OqGTAvlgYVSKkg9IEvMUp3wt2KJzloQx9Zng9XxCM1qYg4LMiBE1CgsguGaaEYnq YXeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sQ2jsBZXZEUJQXHFWiXnUPu7WQvu1OGPsV02ob4Gc3Y=; b=jvtn1o/5u/KN4KHuZ1PsiYa9i7fFTayHyzU/C2uOrfMRVEXX3hBfIqYmYAkB5yJuf6 bbpvGoiwX3KZsLDAaob1YIbV5xP7W4crAd689cOX38cGnRZf/OkhslKGw3SEVEVYZHFn WPxsJHaVX7bM78nD99FAQX/jhpZepZBgGIkUpxq7hyk852AtO2E4qNcrf53atm5qSxS/ 8caVO62cot1xKlp59Pen7b3jjyaeHgTinvutpDx9InNWUgxajZm+hgurtSmUoy9Zs4/7 7+0ml2BzbyCBmDgTdJHQoChWvhQ6stLrYVmeQNyr3KadlQw+tYiqKkCmmBLc0IZeW+MU hdig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=chd6Fy8d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w4-20020a656944000000b0044b5e15db73si17732019pgq.249.2022.10.19.01.47.25; Wed, 19 Oct 2022 01:47: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=chd6Fy8d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231551AbiJSIq7 (ORCPT + 99 others); Wed, 19 Oct 2022 04:46:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231433AbiJSIpX (ORCPT ); Wed, 19 Oct 2022 04:45:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 069137FF97; Wed, 19 Oct 2022 01: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 dfw.source.kernel.org (Postfix) with ESMTPS id D099F617E8; Wed, 19 Oct 2022 08:41:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6FF7C433C1; Wed, 19 Oct 2022 08:41:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168868; bh=ErxrWl722wXIty3H7Pgaq1NO4W94OcHK1F2Tf3zP8vs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=chd6Fy8dkSMHt+E0lKvxuQVpzJ38q1bI3A254x59LAKoEh9+nILdno5UuTcCiyyDr cOsGjrKKkfW/6BnhEXJEqrD6fjJjcaxm4ShrOZrNivf2stRZhQseoCiPwJQHktdhtL S9pizkB2NYuIhm5raW38T0GjBASkISRb3SMkZA00= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, James Morse , Catalin Marinas Subject: [PATCH 6.0 081/862] arm64: errata: Add Cortex-A55 to the repeat tlbi list Date: Wed, 19 Oct 2022 10:22:48 +0200 Message-Id: <20221019083253.511410995@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105097456897988?= X-GMAIL-MSGID: =?utf-8?q?1747105097456897988?= From: James Morse commit 171df58028bf4649460fb146a56a58dcb0c8f75a upstream. Cortex-A55 is affected by an erratum where in rare circumstances the CPUs may not handle a race between a break-before-make sequence on one CPU, and another CPU accessing the same page. This could allow a store to a page that has been unmapped. Work around this by adding the affected CPUs to the list that needs TLB sequences to be done twice. Signed-off-by: James Morse Cc: Link: https://lore.kernel.org/r/20220930131959.3082594-1-james.morse@arm.com Signed-off-by: Catalin Marinas Signed-off-by: Greg Kroah-Hartman --- Documentation/arm64/silicon-errata.rst | 2 ++ arch/arm64/Kconfig | 17 +++++++++++++++++ arch/arm64/kernel/cpu_errata.c | 5 +++++ 3 files changed, 24 insertions(+) --- a/Documentation/arm64/silicon-errata.rst +++ b/Documentation/arm64/silicon-errata.rst @@ -76,6 +76,8 @@ stable kernels. +----------------+-----------------+-----------------+-----------------------------+ | ARM | Cortex-A55 | #1530923 | ARM64_ERRATUM_1530923 | +----------------+-----------------+-----------------+-----------------------------+ +| ARM | Cortex-A55 | #2441007 | ARM64_ERRATUM_2441007 | ++----------------+-----------------+-----------------+-----------------------------+ | ARM | Cortex-A57 | #832075 | ARM64_ERRATUM_832075 | +----------------+-----------------+-----------------+-----------------------------+ | ARM | Cortex-A57 | #852523 | N/A | --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -632,6 +632,23 @@ config ARM64_ERRATUM_1530923 config ARM64_WORKAROUND_REPEAT_TLBI bool +config ARM64_ERRATUM_2441007 + bool "Cortex-A55: Completion of affected memory accesses might not be guaranteed by completion of a TLBI" + default y + select ARM64_WORKAROUND_REPEAT_TLBI + help + This option adds a workaround for ARM Cortex-A55 erratum #2441007. + + Under very rare circumstances, affected Cortex-A55 CPUs + may not handle a race between a break-before-make sequence on one + CPU, and another CPU accessing the same page. This could allow a + store to a page that has been unmapped. + + Work around this by adding the affected CPUs to the list that needs + TLB sequences to be done twice. + + If unsure, say Y. + config ARM64_ERRATUM_1286807 bool "Cortex-A76: Modification of the translation table for a virtual address might lead to read-after-read ordering violation" default y --- a/arch/arm64/kernel/cpu_errata.c +++ b/arch/arm64/kernel/cpu_errata.c @@ -214,6 +214,11 @@ static const struct arm64_cpu_capabiliti ERRATA_MIDR_RANGE(MIDR_QCOM_KRYO_4XX_GOLD, 0xc, 0xe, 0xf, 0xe), }, #endif +#ifdef CONFIG_ARM64_ERRATUM_2441007 + { + ERRATA_MIDR_ALL_VERSIONS(MIDR_CORTEX_A55), + }, +#endif #ifdef CONFIG_ARM64_ERRATUM_2441009 { /* Cortex-A510 r0p0 -> r1p1. Fixed in r1p2 */ From patchwork Wed Oct 19 08:22: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: 4573 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp205070wrs; Wed, 19 Oct 2022 01:48:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM58BLMUuFHI9WmhEDZpSMlx+gxYKbZKuWwy1j+yMuNpfcupL6kRcWZqxny8VtNyHkALUH7i X-Received: by 2002:a17:90b:4b42:b0:20d:954e:28d with SMTP id mi2-20020a17090b4b4200b0020d954e028dmr41508313pjb.93.1666169299833; Wed, 19 Oct 2022 01:48:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169299; cv=none; d=google.com; s=arc-20160816; b=hgdDcovR+wnOQfVmK5VXq/qYcV5roGxSgUmduLDz4761ZrxnxKw/XQZSyGG6wLiSwL GeykwrxEt6/JG4xxbDC5DZL7+i43z1DPTouCUvGoqNXmYXnJXBfr/vCCJb8Rxmm9Kqqb o8WMdYyAfqkMxJSRSdjDqZZ2yPbYVD3SRYIjZex4iNUQm0CthR1HiEoASnTsFX/5HeQU Ir1JAlBOfOrpBewFJcFP5ln4dc/RWL2Fv5SJHHS1IQZ11O00DBVpVR937utNIEQOwYD7 M4INRkqty/J1pl0bQImQw7wlfSqSmroYFCaOaAHYktGdFuJmhS06GyKcK8VjOxIJn5mv dL9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=f1H1hKr2UijXs6Wuu+8G8FiM68vTXKmq9zmWrDR8tCQ=; b=pLYlOQJ4B5PLnx9vSM+94wEykeeKMViP2b4RcrbcF9j/2LL4LOGqwxJ2FqdeAmEvyZ 3Nd0OEf9L2ce5rC4YVkhPSsAJCvHlSleqoaDNtdDAIPKDD827USFFNDmnt1Zp9fm2VSl s+8vNF5dJ8Od/bgbteRyCsWSuAGQ1zUDu6JesKsz344b/fSda+dwC8DO4/ssQzJX1YNU lINwpRLRWr6aYG26EEYpz2w+f06gtcwIGnkeKX1SLHE1HW//2c+opHm247RxyBW+88Vr vFoJg+sw5+vXfdHHSjJDpG/mwxOgKuLJMd8aTbZCmMmANhQztz3EoWrTzC9vnem7dnHV 2Pgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yOmNk8VK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a6302c9000000b00462f77bcd26si16335275pgc.768.2022.10.19.01.48.07; Wed, 19 Oct 2022 01:48: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=yOmNk8VK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231518AbiJSIrS (ORCPT + 99 others); Wed, 19 Oct 2022 04:47:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231383AbiJSIqa (ORCPT ); Wed, 19 Oct 2022 04:46: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 D5216AE56; Wed, 19 Oct 2022 01:44: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 C596F61800; Wed, 19 Oct 2022 08:41:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D53F2C433D6; Wed, 19 Oct 2022 08:41:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168871; bh=UzWcRCSCGAHYUtnLJmb+NhEh2plIKFuHU5nHeprqRTA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yOmNk8VKHdGSdLDriZPyth2B5hN7k2PTWrxcvIEQts0ZnekKrtYegRaGAFZbgWp7b PjBJth/i90MthZLvlgyqfUWzL+wwwfQsRwdgO5cmTb3URMNw51eo5otUlCAozXvTIh PPp8v51hspq/ngqbMIZItc6b8417YGiycxyCAvuQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Lezcano , Thomas Gleixner , Marc Zyngier , Mark Rutland , Yang Guo , Shaokun Zhang Subject: [PATCH 6.0 082/862] clocksource/drivers/arm_arch_timer: Fix CNTPCT_LO and CNTVCT_LO value Date: Wed, 19 Oct 2022 10:22:49 +0200 Message-Id: <20221019083253.559428691@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105139528684712?= X-GMAIL-MSGID: =?utf-8?q?1747105139528684712?= From: Yang Guo commit af246cc6d0ed11318223606128bb0b09866c4c08 upstream. CNTPCT_LO and CNTVCT_LO are defined by mistake in commit '8b82c4f883a7', so fix them according to the Arm ARM DDI 0487I.a, Table I2-4 "CNTBaseN memory map" as follows: Offset Register Type Description 0x000 CNTPCT[31:0] RO Physical Count register. 0x004 CNTPCT[63:32] RO 0x008 CNTVCT[31:0] RO Virtual Count register. 0x00C CNTVCT[63:32] RO Fixes: 8b82c4f883a7 ("clocksource/drivers/arm_arch_timer: Move MMIO timer programming over to CVAL") Cc: stable@vger.kernel.org Cc: Daniel Lezcano Cc: Thomas Gleixner Cc: Marc Zyngier Cc: Mark Rutland Acked-by: Marc Zyngier Signed-off-by: Yang Guo Signed-off-by: Shaokun Zhang Link: https://lore.kernel.org/r/20220927033221.49589-1-zhangshaokun@hisilicon.com Signed-off-by: Daniel Lezcano Signed-off-by: Greg Kroah-Hartman --- drivers/clocksource/arm_arch_timer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c @@ -44,8 +44,8 @@ #define CNTACR_RWVT BIT(4) #define CNTACR_RWPT BIT(5) -#define CNTVCT_LO 0x00 -#define CNTPCT_LO 0x08 +#define CNTPCT_LO 0x00 +#define CNTVCT_LO 0x08 #define CNTFRQ 0x10 #define CNTP_CVAL_LO 0x20 #define CNTP_CTL 0x2c From patchwork Wed Oct 19 08:22: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: 4717 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp213908wrs; Wed, 19 Oct 2022 02:11:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7LnWySFOREo2zynpamF+TkBdyKP5uvzJZys1vrRmt0VdFV9+wLy3+E6RfYZ+eKf7zckKzX X-Received: by 2002:a50:9991:0:b0:458:a612:bf5a with SMTP id m17-20020a509991000000b00458a612bf5amr6538313edb.22.1666170684631; Wed, 19 Oct 2022 02:11:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170684; cv=none; d=google.com; s=arc-20160816; b=XqYgI9rcNPdoqh9qOFUsuRqKhQdQOTyBXrq70J+m/H/CcvyYpr5yHXHPNY01JHSnwP N7K0R/9E/dwO9bCgYcDxvmjI6vRB3id8LK5etw3kJVoObsiWuliTZFsUlxqfqNWxp1ZB UhuSyUrUKrqJsKqV7XMxA0wwUZK58K+8oQlmJ4Db2EzDXsWAoM/M7lLMTP5bKsKSJGb2 LKQevNEI5TgIU67vlzJIf75vDKTkvkDHJ5r5FvPbdCZUyIl7HW1VWZwGjgA7eAc7H81k 2RWecwPwJnWL4Y5L3WT4ECoTdYAQ/w1/ihcVUALQAQLdBaGMtrUxc9ZzXwgmyQontH6g 4sww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RvDJyGG5SsvyczOl/Z29OV7FhHrvUlnocRXaSg3GGXs=; b=ODOQSHooV8Ap5iK77oKcSTB7uGZrjNLuUgbI8rhp+hxPuQ5RwZwmeskgmNJ9yon5QU A7LSoGngODxd3uK/HZ3CGjASd5ZBQrcOsS0H7PZSIuCAxqXu1fAGl//h1XT8rdmjNWKo ObD3u5Oj9RRzoiabDA6pDisHw2FN66DTx69gxqoJkOjCyXERovPu6KnOLJS/tKqlZOpr Pq7D2VVX02o6wqJn+diOGyhfGgmoz/DGzx9tdP5geNkujkLSDtWGlyyYEW8E4WKVEY4P +606Kr16uwojuGrPzkhSB1W9SWT7OcP8XRTBWrBDAoF0/6a8kFAvM/I4doWJGkah5zAw fr/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GHU9e3CP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h8-20020a056402280800b0045927324653si17564418ede.6.2022.10.19.02.10.58; Wed, 19 Oct 2022 02:11: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=GHU9e3CP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232574AbiJSJH1 (ORCPT + 99 others); Wed, 19 Oct 2022 05:07:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232767AbiJSJFE (ORCPT ); Wed, 19 Oct 2022 05:05: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 5E97E9E0EF; Wed, 19 Oct 2022 01:58: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 6ABD1617E3; Wed, 19 Oct 2022 08:41:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78AB9C4314D; Wed, 19 Oct 2022 08:41:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168873; bh=CFlSxKDqPqmaHavHsonWzkrN7ANb3aaoKnjMGkwvPkg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GHU9e3CPHmtv+pMjaztqKoXkMlOzh3T4ZhsyLfjXmOGNOvMFAXPb/Nvhmyac+OSdN rrxJyixF/xEKazed/rwjCdbnke1XwLPBrpQdb8jnwzB4iCMaVjZ59Cmczjnef2b1MT H5f5xWW5/GFz36tzBIOoAKA2ogWeBK8eoCTuEyW8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Baolin Wang , Mike Kravetz , David Hildenbrand , Muchun Song , Andrew Morton Subject: [PATCH 6.0 083/862] mm/hugetlb: fix races when looking up a CONT-PTE/PMD size hugetlb page Date: Wed, 19 Oct 2022 10:22:50 +0200 Message-Id: <20221019083253.609690715@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106592071548065?= X-GMAIL-MSGID: =?utf-8?q?1747106592071548065?= From: Baolin Wang commit fac35ba763ed07ba93154c95ffc0c4a55023707f upstream. On some architectures (like ARM64), it can support CONT-PTE/PMD size hugetlb, which means it can support not only PMD/PUD size hugetlb (2M and 1G), but also CONT-PTE/PMD size(64K and 32M) if a 4K page size specified. So when looking up a CONT-PTE size hugetlb page by follow_page(), it will use pte_offset_map_lock() to get the pte entry lock for the CONT-PTE size hugetlb in follow_page_pte(). However this pte entry lock is incorrect for the CONT-PTE size hugetlb, since we should use huge_pte_lock() to get the correct lock, which is mm->page_table_lock. That means the pte entry of the CONT-PTE size hugetlb under current pte lock is unstable in follow_page_pte(), we can continue to migrate or poison the pte entry of the CONT-PTE size hugetlb, which can cause some potential race issues, even though they are under the 'pte lock'. For example, suppose thread A is trying to look up a CONT-PTE size hugetlb page by move_pages() syscall under the lock, however antoher thread B can migrate the CONT-PTE hugetlb page at the same time, which will cause thread A to get an incorrect page, if thread A also wants to do page migration, then data inconsistency error occurs. Moreover we have the same issue for CONT-PMD size hugetlb in follow_huge_pmd(). To fix above issues, rename the follow_huge_pmd() as follow_huge_pmd_pte() to handle PMD and PTE level size hugetlb, which uses huge_pte_lock() to get the correct pte entry lock to make the pte entry stable. Mike said: Support for CONT_PMD/_PTE was added with bb9dd3df8ee9 ("arm64: hugetlb: refactor find_num_contig()"). Patch series "Support for contiguous pte hugepages", v4. However, I do not believe these code paths were executed until migration support was added with 5480280d3f2d ("arm64/mm: enable HugeTLB migration for contiguous bit HugeTLB pages") I would go with 5480280d3f2d for the Fixes: targe. Link: https://lkml.kernel.org/r/635f43bdd85ac2615a58405da82b4d33c6e5eb05.1662017562.git.baolin.wang@linux.alibaba.com Fixes: 5480280d3f2d ("arm64/mm: enable HugeTLB migration for contiguous bit HugeTLB pages") Signed-off-by: Baolin Wang Suggested-by: Mike Kravetz Reviewed-by: Mike Kravetz Cc: David Hildenbrand Cc: Muchun Song Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- include/linux/hugetlb.h | 8 ++++---- mm/gup.c | 14 +++++++++++++- mm/hugetlb.c | 27 +++++++++++++-------------- 3 files changed, 30 insertions(+), 19 deletions(-) --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -207,8 +207,8 @@ struct page *follow_huge_addr(struct mm_ struct page *follow_huge_pd(struct vm_area_struct *vma, unsigned long address, hugepd_t hpd, int flags, int pdshift); -struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address, - pmd_t *pmd, int flags); +struct page *follow_huge_pmd_pte(struct vm_area_struct *vma, unsigned long address, + int flags); struct page *follow_huge_pud(struct mm_struct *mm, unsigned long address, pud_t *pud, int flags); struct page *follow_huge_pgd(struct mm_struct *mm, unsigned long address, @@ -312,8 +312,8 @@ static inline struct page *follow_huge_p return NULL; } -static inline struct page *follow_huge_pmd(struct mm_struct *mm, - unsigned long address, pmd_t *pmd, int flags) +static inline struct page *follow_huge_pmd_pte(struct vm_area_struct *vma, + unsigned long address, int flags) { return NULL; } --- a/mm/gup.c +++ b/mm/gup.c @@ -530,6 +530,18 @@ static struct page *follow_page_pte(stru if (WARN_ON_ONCE((flags & (FOLL_PIN | FOLL_GET)) == (FOLL_PIN | FOLL_GET))) return ERR_PTR(-EINVAL); + + /* + * Considering PTE level hugetlb, like continuous-PTE hugetlb on + * ARM64 architecture. + */ + if (is_vm_hugetlb_page(vma)) { + page = follow_huge_pmd_pte(vma, address, flags); + if (page) + return page; + return no_page_table(vma, flags); + } + retry: if (unlikely(pmd_bad(*pmd))) return no_page_table(vma, flags); @@ -662,7 +674,7 @@ static struct page *follow_pmd_mask(stru if (pmd_none(pmdval)) return no_page_table(vma, flags); if (pmd_huge(pmdval) && is_vm_hugetlb_page(vma)) { - page = follow_huge_pmd(mm, address, pmd, flags); + page = follow_huge_pmd_pte(vma, address, flags); if (page) return page; return no_page_table(vma, flags); --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -6946,12 +6946,13 @@ follow_huge_pd(struct vm_area_struct *vm } struct page * __weak -follow_huge_pmd(struct mm_struct *mm, unsigned long address, - pmd_t *pmd, int flags) +follow_huge_pmd_pte(struct vm_area_struct *vma, unsigned long address, int flags) { + struct hstate *h = hstate_vma(vma); + struct mm_struct *mm = vma->vm_mm; struct page *page = NULL; spinlock_t *ptl; - pte_t pte; + pte_t *ptep, pte; /* * FOLL_PIN is not supported for follow_page(). Ordinary GUP goes via @@ -6961,17 +6962,15 @@ follow_huge_pmd(struct mm_struct *mm, un return NULL; retry: - ptl = pmd_lockptr(mm, pmd); - spin_lock(ptl); - /* - * make sure that the address range covered by this pmd is not - * unmapped from other threads. - */ - if (!pmd_huge(*pmd)) - goto out; - pte = huge_ptep_get((pte_t *)pmd); + ptep = huge_pte_offset(mm, address, huge_page_size(h)); + if (!ptep) + return NULL; + + ptl = huge_pte_lock(h, mm, ptep); + pte = huge_ptep_get(ptep); if (pte_present(pte)) { - page = pmd_page(*pmd) + ((address & ~PMD_MASK) >> PAGE_SHIFT); + page = pte_page(pte) + + ((address & ~huge_page_mask(h)) >> PAGE_SHIFT); /* * try_grab_page() should always succeed here, because: a) we * hold the pmd (ptl) lock, and b) we've just checked that the @@ -6987,7 +6986,7 @@ retry: } else { if (is_hugetlb_entry_migration(pte)) { spin_unlock(ptl); - __migration_entry_wait_huge((pte_t *)pmd, ptl); + __migration_entry_wait_huge(ptep, ptl); goto retry; } /* From patchwork Wed Oct 19 08:22: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: 4544 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp204208wrs; Wed, 19 Oct 2022 01:45:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ElTBTdildl9+hEWo1jfzoM/jvr40os1jO5/Vk7NpihHOHO9T3M5qJL37kZMpk5uq+ya+G X-Received: by 2002:a63:8149:0:b0:461:f9f7:f64a with SMTP id t70-20020a638149000000b00461f9f7f64amr6273020pgd.338.1666169127185; Wed, 19 Oct 2022 01:45:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169127; cv=none; d=google.com; s=arc-20160816; b=mVhaR0UVNcD7uSf6OJ90/q4NLo7DBwEgtsoE6uqNAvlsLb4mfLM5Q+Bdw3FEG8g2Pq 399Bj5ugHv8hGjziUASDnho0cubWmlWeni+S7OricgoeM5LmfRFh4nFYIbypMaT431/G WdWTwlaHHbReuvEzmzrouZrto9q3DMRO92xQhq4Nb5ebW/yLl5E4ji1So7kZayIs7aqq xWQbC/AZJJEdwP38QYo4sczCRJ7L138gxh1V0CAkfBp55s38udo4e44YMzoEhAAfVJyo hy/EdSuAEGCs31iyUiMnldAtjkuLSzmXB5Zo7wlfpOoxN1EtSzcU+XWthBpKkwSgQuXV pLdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RGwaLVJROyG+xukoRwaAjzO2VtOKfTbFcHqQ254I78Y=; b=SB0JEIebzdBek0ao9ROb0FHnE7BZuK0SwEUI2xuaNOJDL4o2Ja2Kt0jMA+6bfBe4ZW E1vNLU1l3sckmtRz7XL46znqPuYdKpii0YzzFGw3neZenVHglKX3pDkh8/TRU+JaoIBo SXKZ5ZpCUD0UF/BfR1rpJSI3PPQCv4EZez7L8C4feq/OAmdnkeTFdCk4PW/QvJPat3ey gcPeZF3eZoc5aPQ0q1U8zsR8xRFyJUM+q6Bwm58lZU2tgtGCT80aLHJcDhPfy3OLX4PU c5y+MtU17sjOAADW+oc2WDpQQrGXNMCqzcsxxE3oUcIP68kbyF0vxLk+tR8IjYbaYNkq ZAAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ns9Yfy95; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e14-20020a170902ef4e00b001825b1375ebsi17055634plx.544.2022.10.19.01.45.13; Wed, 19 Oct 2022 01:45: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=ns9Yfy95; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231294AbiJSIox (ORCPT + 99 others); Wed, 19 Oct 2022 04:44:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231329AbiJSIn7 (ORCPT ); Wed, 19 Oct 2022 04: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 2134F7FFA8; Wed, 19 Oct 2022 01:41: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 3B548617F2; Wed, 19 Oct 2022 08:41:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3BEEAC433D7; Wed, 19 Oct 2022 08:41:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168876; bh=I6MFGlUEj5EUaxpuOQQn/MHXXgwh2qEtqurcxmSeeuQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ns9Yfy95osqnpTJttDjdi8pzcy12KIxreYWwK/VmvpYVejM82T/5gALnjiEAUlxM/ GN8BNdMLMCJmiCz+zUogL9MNBz/2JwomZ+4Uj++d5FseuVSG5ISazFihs03XF0zr4f QflzDPXWlaUIx4woFdRX7HRI1gOXbEkvD0ZMC8ZE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Baolin Wang , SeongJae Park , Muchun Song , Mike Kravetz , Andrew Morton Subject: [PATCH 6.0 084/862] mm/damon: validate if the pmd entry is present before accessing Date: Wed, 19 Oct 2022 10:22:51 +0200 Message-Id: <20221019083253.646689056@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104958522701485?= X-GMAIL-MSGID: =?utf-8?q?1747104958522701485?= From: Baolin Wang commit c8b9aff419303e4d4219b5ff64b1c7e062dee48e upstream. pmd_huge() is used to validate if the pmd entry is mapped by a huge page, also including the case of non-present (migration or hwpoisoned) pmd entry on arm64 or x86 architectures. This means that pmd_pfn() can not get the correct pfn number for a non-present pmd entry, which will cause damon_get_page() to get an incorrect page struct (also may be NULL by pfn_to_online_page()), making the access statistics incorrect. This means that the DAMON may make incorrect decision according to the incorrect statistics, for example, DAMON may can not reclaim cold page in time due to this cold page was regarded as accessed mistakenly if DAMOS_PAGEOUT operation is specified. Moreover it does not make sense that we still waste time to get the page of the non-present entry. Just treat it as not-accessed and skip it, which maintains consistency with non-present pte level entries. So add pmd entry present validation to fix the above issues. Link: https://lkml.kernel.org/r/58b1d1f5fbda7db49ca886d9ef6783e3dcbbbc98.1660805030.git.baolin.wang@linux.alibaba.com Fixes: 3f49584b262c ("mm/damon: implement primitives for the virtual memory address spaces") Signed-off-by: Baolin Wang Reviewed-by: SeongJae Park Reviewed-by: Muchun Song Cc: Mike Kravetz Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- mm/damon/vaddr.c | 10 ++++++++++ 1 file changed, 10 insertions(+) --- a/mm/damon/vaddr.c +++ b/mm/damon/vaddr.c @@ -304,6 +304,11 @@ static int damon_mkold_pmd_entry(pmd_t * if (pmd_huge(*pmd)) { ptl = pmd_lock(walk->mm, pmd); + if (!pmd_present(*pmd)) { + spin_unlock(ptl); + return 0; + } + if (pmd_huge(*pmd)) { damon_pmdp_mkold(pmd, walk->mm, addr); spin_unlock(ptl); @@ -431,6 +436,11 @@ static int damon_young_pmd_entry(pmd_t * #ifdef CONFIG_TRANSPARENT_HUGEPAGE if (pmd_huge(*pmd)) { ptl = pmd_lock(walk->mm, pmd); + if (!pmd_present(*pmd)) { + spin_unlock(ptl); + return 0; + } + if (!pmd_huge(*pmd)) { spin_unlock(ptl); goto regular_page; From patchwork Wed Oct 19 08:22: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: 4661 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212639wrs; Wed, 19 Oct 2022 02:07:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7I6yeOqrC5YofjAJFPL5VX3yXqu5yGH/D1qDUucC62FE9q4D83ywj/q4AHWngoP22BUPiB X-Received: by 2002:a05:6402:2802:b0:43a:9098:55a0 with SMTP id h2-20020a056402280200b0043a909855a0mr6309003ede.179.1666170477953; Wed, 19 Oct 2022 02:07:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170477; cv=none; d=google.com; s=arc-20160816; b=LkadoAd3NT3q/kP+gYiqZT/m9QQHbxmE8WRIiH6xbx/iYVcitn0e+Wd2HpHy46oB+J VrdB8vT2iOYqkngTuGkQGdWR6b/xy0BVO18hnj9QjQ8B0+07Qnt8wsrBqvCwhSNHvT40 KBCPvPctfxKmEykcEifFdrze5PijetbBxMU8MZ2Hfq7VFrLpSIzsC3vOaIgJho4Mq3+8 gOxJXJcLS1VYAlE+blbwgdsa3bTW8aVUsTZmbV57g3Er3zfj0PED6c88rGbA+l8QdesZ CvnvW4lz3y4JMiJCxu6k8vxWo8u4GFVB+3WPCAo/7EIyyvhBKp1hEoxCUMZvMyt/ZFfW WfHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zFB6Z1Po/zYe2ZYqx7k8Tl/YstB4yReHhVT35OYopDc=; b=YWqCCfeAMgDDr1EySSz2SBsvvhSXmRvJ1xk+ZtM3gobv55sPcWFWTSlSR5OyeaBBWI vHVBzq7BuoVbP5mrzOiEwYYp3MHXqkWh5SsmuBsymSIkH4LYe9Vl6VGH5YXUdOJnFw0I cLrkQYe8+UhBphJCv/6JUKlngH/8EjFQ0qHHOtdXFk32+Wwsn3Y1CityhLNNTHn8x3LF 0laKSFXpFc3vcxVq7ZowXoNf6NGJGT9jIsJOz4niokb0I216VaWWRxXdaISfG9S5hOb1 5mdTnVpBkHa0UKYnZJM8R9b9sfSlFwmUqwNLgTePquDMaF7e9EKLMHizVkPAuATMohLF O9hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IOlkN0f5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170906259600b0073ced0e9bb1si12216656ejb.189.2022.10.19.02.07.28; Wed, 19 Oct 2022 02:07: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=IOlkN0f5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229862AbiJSJBS (ORCPT + 99 others); Wed, 19 Oct 2022 05:01:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232182AbiJSI7I (ORCPT ); Wed, 19 Oct 2022 04:59:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1455691856; Wed, 19 Oct 2022 01:54: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 0BBC6617EE; Wed, 19 Oct 2022 08:41:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE734C433C1; Wed, 19 Oct 2022 08:41:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168879; bh=k3pbYwELAWZwoUJWPTFl+CxzU1z5/tRjW0u2LqamOj8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IOlkN0f52wrc+OjKTa0tLckO2ivJa2CeI1r1tJv6BGdq9dBmpfML2w37GF5Ya92mA miuwm1KyyA71OIaksRrR6m3GNOnQlHYMQ1fotVoC+HG+TGuSViIX84ZXacn7YJRGCr 2dI3DjB098W3z9NrtY3y2hJQnB7rYlwltKNq1yng= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Xu , syzbot+2b9b4f0895be09a6dec3@syzkaller.appspotmail.com, Axel Rasmussen , Brian Geffon , Edward Liaw , Liu Shixin , Mike Kravetz , Andrew Morton Subject: [PATCH 6.0 085/862] mm/uffd: fix warning without PTE_MARKER_UFFD_WP compiled in Date: Wed, 19 Oct 2022 10:22:52 +0200 Message-Id: <20221019083253.679416520@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106375136889868?= X-GMAIL-MSGID: =?utf-8?q?1747106375136889868?= From: Peter Xu commit 515778e2d790652a38a24554fdb7f21420d91efc upstream. When PTE_MARKER_UFFD_WP not configured, it's still possible to reach pte marker code and trigger an warning. Add a few CONFIG_PTE_MARKER_UFFD_WP ifdefs to make sure the code won't be reached when not compiled in. Link: https://lkml.kernel.org/r/YzeR+R6b4bwBlBHh@x1n Fixes: b1f9e876862d ("mm/uffd: enable write protection for shmem & hugetlbfs") Signed-off-by: Peter Xu Reported-by: Cc: Axel Rasmussen Cc: Brian Geffon Cc: Edward Liaw Cc: Liu Shixin Cc: Mike Kravetz Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- mm/hugetlb.c | 4 ++++ mm/memory.c | 2 ++ mm/mprotect.c | 2 ++ 3 files changed, 8 insertions(+) --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -5059,6 +5059,7 @@ static void __unmap_hugepage_range(struc * unmapped and its refcount is dropped, so just clear pte here. */ if (unlikely(!pte_present(pte))) { +#ifdef CONFIG_PTE_MARKER_UFFD_WP /* * If the pte was wr-protected by uffd-wp in any of the * swap forms, meanwhile the caller does not want to @@ -5070,6 +5071,7 @@ static void __unmap_hugepage_range(struc set_huge_pte_at(mm, address, ptep, make_pte_marker(PTE_MARKER_UFFD_WP)); else +#endif huge_pte_clear(mm, address, ptep, sz); spin_unlock(ptl); continue; @@ -5098,11 +5100,13 @@ static void __unmap_hugepage_range(struc tlb_remove_huge_tlb_entry(h, tlb, ptep, address); if (huge_pte_dirty(pte)) set_page_dirty(page); +#ifdef CONFIG_PTE_MARKER_UFFD_WP /* Leave a uffd-wp pte marker if needed */ if (huge_pte_uffd_wp(pte) && !(zap_flags & ZAP_FLAG_DROP_MARKER)) set_huge_pte_at(mm, address, ptep, make_pte_marker(PTE_MARKER_UFFD_WP)); +#endif hugetlb_count_sub(pages_per_huge_page(h), mm); page_remove_rmap(page, vma, true); --- a/mm/memory.c +++ b/mm/memory.c @@ -1393,10 +1393,12 @@ zap_install_uffd_wp_if_needed(struct vm_ unsigned long addr, pte_t *pte, struct zap_details *details, pte_t pteval) { +#ifdef CONFIG_PTE_MARKER_UFFD_WP if (zap_drop_file_uffd_wp(details)) return; pte_install_uffd_wp_if_needed(vma, addr, pte, pteval); +#endif } static unsigned long zap_pte_range(struct mmu_gather *tlb, --- a/mm/mprotect.c +++ b/mm/mprotect.c @@ -260,6 +260,7 @@ static unsigned long change_pte_range(st } else { /* It must be an none page, or what else?.. */ WARN_ON_ONCE(!pte_none(oldpte)); +#ifdef CONFIG_PTE_MARKER_UFFD_WP if (unlikely(uffd_wp && !vma_is_anonymous(vma))) { /* * For file-backed mem, we need to be able to @@ -271,6 +272,7 @@ static unsigned long change_pte_range(st make_pte_marker(PTE_MARKER_UFFD_WP)); pages++; } +#endif } } while (pte++, addr += PAGE_SIZE, addr != end); arch_leave_lazy_mmu_mode(); From patchwork Wed Oct 19 08:22: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: 4547 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp204279wrs; Wed, 19 Oct 2022 01:45:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6OHWEeij4WbuVESFj3rLN8PWCLlS9JD8seTJMXmRFuOH3/jlKphI0odpCRfy0CY8NvaCcY X-Received: by 2002:a17:90a:5781:b0:20a:9962:bb4a with SMTP id g1-20020a17090a578100b0020a9962bb4amr43027705pji.185.1666169140174; Wed, 19 Oct 2022 01:45:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169140; cv=none; d=google.com; s=arc-20160816; b=cyn45lnA7+he0gpSW6/C3/IbacL1Uk07Ww9TE+hLAnKTovAg+rc4rPbZuHngX0xQ6A QOdqzZIZZA0ZNLBBahasvytUafAdcvhOIcb/sZIFpOyHUw+w2F/YuYyWA8d7WFex9YaX cHsLKnfOVs57Cvo9l8AN3pGfyf14sJQ2JzepsIMIffaCPqqBG0qSMQLSGK6C9Z7C7h/t zb2iM+jAPXA2L1A3j7AlVruJZN/PY1mNmgWvXNbRcek8Q1o35dMknVhYCn4Ye/wPjEvh Ol03+BlKe7tkT+mF8NnyMrV/1YlPWoIbF7rMbb6/TX34Mbf6V3C0pXPg88mgFynrLsNl 3TAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=c9eLqxFR/7pP6spyG5kRfOqSkYZMvPYNzo5Nx1zcWJ4=; b=xjA3+OUAA+JldB3qFQv2WDtw+NlL0OS0yZ+Qx+zYAILGPdPBO3GUPvhJH5kD76bglj 7GT0/1VtGmdTzIe8sogZXzDiDgNr4gFjhLUGdWqJCzdMW3//nDanD/YneVzAPucfGAJA E4d41tMjXoNzoYFitAXC7Z/+XW1VD3untrk4WB1buMp5NqpgtJ86diKC2WzLSQymwIaV xEPLkvZd0RmCKoECWMVvmp9/XIje5WYcsM+q2EYA5BMYSqduHL5WMrS0BlAaOZTCrVp8 8ykTIcq2UJjQ4J6UcmHqYKrlUWioo9MfhK3gghyrmZ986/H28w5MjP2at8iiKUekejwr xVPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="F0SG/Xhw"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mq8-20020a17090b380800b0020daab63f66si18932713pjb.31.2022.10.19.01.45.25; Wed, 19 Oct 2022 01: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="F0SG/Xhw"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231350AbiJSIpA (ORCPT + 99 others); Wed, 19 Oct 2022 04:45:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231328AbiJSIn7 (ORCPT ); Wed, 19 Oct 2022 04: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 5F2DC7E812; Wed, 19 Oct 2022 01: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 dfw.source.kernel.org (Postfix) with ESMTPS id BD7FE617FE; Wed, 19 Oct 2022 08:41:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D06A9C433C1; Wed, 19 Oct 2022 08:41:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168882; bh=dpVcpzHt1fIFRVKlgbYHP6miojOg+vDegfBehVXCHZk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F0SG/Xhwt5Ms0bQKK1Lwg9BIBySuo32lJMygkCO3nnv9x/shG/V95C9obWf7ylErV X6d06LQxCcttmFs/DvpzckG4wQ7cCh17Q5hA2NyMUKtZW33xr5A5gJBxkgLup7qvwl tRMB4Dy4wO56G1UiZoSatnC38js0y5gJF8EIf5b4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Carlos Llamas , Catalin Marinas , Andrii Nakryiko , Liam Howlett , "Christian Brauner (Microsoft)" , Michal Hocko , Suren Baghdasaryan , Andrew Morton Subject: [PATCH 6.0 086/862] mm/mmap: undo ->mmap() when arch_validate_flags() fails Date: Wed, 19 Oct 2022 10:22:53 +0200 Message-Id: <20221019083253.727286986@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104971853094160?= X-GMAIL-MSGID: =?utf-8?q?1747104971853094160?= From: Carlos Llamas commit deb0f6562884b5b4beb883d73e66a7d3a1b96d99 upstream. Commit c462ac288f2c ("mm: Introduce arch_validate_flags()") added a late check in mmap_region() to let architectures validate vm_flags. The check needs to happen after calling ->mmap() as the flags can potentially be modified during this callback. If arch_validate_flags() check fails we unmap and free the vma. However, the error path fails to undo the ->mmap() call that previously succeeded and depending on the specific ->mmap() implementation this translates to reference increments, memory allocations and other operations what will not be cleaned up. There are several places (mainly device drivers) where this is an issue. However, one specific example is bpf_map_mmap() which keeps count of the mappings in map->writecnt. The count is incremented on ->mmap() and then decremented on vm_ops->close(). When arch_validate_flags() fails this count is off since bpf_map_mmap_close() is never called. One can reproduce this issue in arm64 devices with MTE support. Here the vm_flags are checked to only allow VM_MTE if VM_MTE_ALLOWED has been set previously. From userspace then is enough to pass the PROT_MTE flag to mmap() syscall to trigger the arch_validate_flags() failure. The following program reproduces this issue: #include #include #include #include #include int main(void) { union bpf_attr attr = { .map_type = BPF_MAP_TYPE_ARRAY, .key_size = sizeof(int), .value_size = sizeof(long long), .max_entries = 256, .map_flags = BPF_F_MMAPABLE, }; int fd; fd = syscall(__NR_bpf, BPF_MAP_CREATE, &attr, sizeof(attr)); mmap(NULL, 4096, PROT_WRITE | PROT_MTE, MAP_SHARED, fd, 0); return 0; } By manually adding some log statements to the vm_ops callbacks we can confirm that when passing PROT_MTE to mmap() the map->writecnt is off upon ->release(): With PROT_MTE flag: root@debian:~# ./bpf-test [ 111.263874] bpf_map_write_active_inc: map=9 writecnt=1 [ 111.288763] bpf_map_release: map=9 writecnt=1 Without PROT_MTE flag: root@debian:~# ./bpf-test [ 157.816912] bpf_map_write_active_inc: map=10 writecnt=1 [ 157.830442] bpf_map_write_active_dec: map=10 writecnt=0 [ 157.832396] bpf_map_release: map=10 writecnt=0 This patch fixes the above issue by calling vm_ops->close() when the arch_validate_flags() check fails, after this we can proceed to unmap and free the vma on the error path. Link: https://lkml.kernel.org/r/20220930003844.1210987-1-cmllamas@google.com Fixes: c462ac288f2c ("mm: Introduce arch_validate_flags()") Signed-off-by: Carlos Llamas Reviewed-by: Catalin Marinas Acked-by: Andrii Nakryiko Reviewed-by: Liam Howlett Cc: Christian Brauner (Microsoft) Cc: Michal Hocko Cc: Suren Baghdasaryan Cc: [5.10+] Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- mm/mmap.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/mm/mmap.c +++ b/mm/mmap.c @@ -1797,7 +1797,7 @@ unsigned long mmap_region(struct file *f if (!arch_validate_flags(vma->vm_flags)) { error = -EINVAL; if (file) - goto unmap_and_free_vma; + goto close_and_free_vma; else goto free_vma; } @@ -1844,6 +1844,9 @@ out: return addr; +close_and_free_vma: + if (vma->vm_ops && vma->vm_ops->close) + vma->vm_ops->close(vma); unmap_and_free_vma: fput(vma->vm_file); vma->vm_file = NULL; From patchwork Wed Oct 19 08:22: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: 5362 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp299413wrs; Wed, 19 Oct 2022 05:32:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4PPawXoQBjWSp3JVr7b8GRejHuc9aU1YGqS/a/0WG23QewxZfThynVQDUqyCl2ZYIVtgqG X-Received: by 2002:a05:6402:274c:b0:45d:4015:cd8c with SMTP id z12-20020a056402274c00b0045d4015cd8cmr7436382edd.268.1666182731572; Wed, 19 Oct 2022 05:32:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666182731; cv=none; d=google.com; s=arc-20160816; b=cy7yCaFP64otyVsPdTyf5Ps64wIcPCajuT4PiaA8FFl7ABubvZaSC7lStbq0te4ujE K5wLZwTu1Bsl5b6+43uLacRYIr1+Gw2W1jZZdUqT4SYjo0ljsr5I5A1997ZTmbwQ8MyZ fi8VUPpkvjUxhJC7RvAhMq2CckXoggo2oE5974Z78OjeS9tdqIitfZZB8VwQs5bhc94a Z0I9TXRZWB9BA8mFJ39ZJC9yO6Gboa9DeARJSqhJ8JGMCWH24bRpmboApq/6ipZZaGgr pv22MWgHcCm80GLoYkqJlBxWMlLonZbvjyo8EF/WNfMEXLuetMLypXekXNxK12s0iBfW LjHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fIrbt1EsO7KTJfFyiqO8JF/iBRj4/PZEuOWAzGyzza8=; b=A7OhsofpsI01Gq0rM+xt7aud6bPz908A5zc+FvU29yKvsOpxpx3lFojKdpHdloi2ve U7YfDnJtcOsvBj8iYTIFXDUy59eKspE5As9XP333iHGo4oS4u3rj2fwGnKdzpt6NMWqR AhDnWFWKKyZ6BiLdHPTwPTDDsN6dEHKx10JOTvaylSp43WJ7/jcZwEuMBWgLRoZaPd16 XiaWjDnp2V1GVB6Km21r102vcMBo/RGRMrAnH9xtYLzeMl94593D35YTVNMM716m/9ar 5SZX6HiVjyQ70yv0vQF2qKt1kyQyhUdwBUuEBCMPCm0gjenj0j/vVAyq/ZwfQPfbyLfM enuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WZZEN9vj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g12-20020a1709065d0c00b007707ab4be23si15645118ejt.560.2022.10.19.05.31.46; Wed, 19 Oct 2022 05:32: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=WZZEN9vj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231642AbiJSMUJ (ORCPT + 99 others); Wed, 19 Oct 2022 08:20:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233152AbiJSMTG (ORCPT ); Wed, 19 Oct 2022 08:19:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBE2E1781E3; Wed, 19 Oct 2022 04:54: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 2AD47B821CD; Wed, 19 Oct 2022 08:41:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8FA63C433C1; Wed, 19 Oct 2022 08:41:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168885; bh=z1jpo4UkD4Ly2oimtwNpPZSx9SB4oraktF/ZPcHwwwA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WZZEN9vj5o9yGwIN9cprRgFsC0ZLUoz8Bho7xb+/ap3sQCj76mIY2R6bEENkSUl/2 8PZyGYZ0lAMp6iMGtjTnkquILBqWYxIMwFPaMj9OsRBRMJ1n5d9hTh3u3BPq/XnbiO Rl/qJg6PRZ/u4jR+AOWIUdZMye072DfQLXal76Ig= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "M. Vefa Bicakci" , Demi Marie Obenour , Juergen Gross Subject: [PATCH 6.0 087/862] xen/gntdev: Prevent leaking grants Date: Wed, 19 Oct 2022 10:22:54 +0200 Message-Id: <20221019083253.776126425@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747119224140303149?= X-GMAIL-MSGID: =?utf-8?q?1747119224140303149?= From: M. Vefa Bicakci commit 0991028cd49567d7016d1b224fe0117c35059f86 upstream. Prior to this commit, if a grant mapping operation failed partially, some of the entries in the map_ops array would be invalid, whereas all of the entries in the kmap_ops array would be valid. This in turn would cause the following logic in gntdev_map_grant_pages to become invalid: for (i = 0; i < map->count; i++) { if (map->map_ops[i].status == GNTST_okay) { map->unmap_ops[i].handle = map->map_ops[i].handle; if (!use_ptemod) alloced++; } if (use_ptemod) { if (map->kmap_ops[i].status == GNTST_okay) { if (map->map_ops[i].status == GNTST_okay) alloced++; map->kunmap_ops[i].handle = map->kmap_ops[i].handle; } } } ... atomic_add(alloced, &map->live_grants); Assume that use_ptemod is true (i.e., the domain mapping the granted pages is a paravirtualized domain). In the code excerpt above, note that the "alloced" variable is only incremented when both kmap_ops[i].status and map_ops[i].status are set to GNTST_okay (i.e., both mapping operations are successful). However, as also noted above, there are cases where a grant mapping operation fails partially, breaking the assumption of the code excerpt above. The aforementioned causes map->live_grants to be incorrectly set. In some cases, all of the map_ops mappings fail, but all of the kmap_ops mappings succeed, meaning that live_grants may remain zero. This in turn makes it impossible to unmap the successfully grant-mapped pages pointed to by kmap_ops, because unmap_grant_pages has the following snippet of code at its beginning: if (atomic_read(&map->live_grants) == 0) return; /* Nothing to do */ In other cases where only some of the map_ops mappings fail but all kmap_ops mappings succeed, live_grants is made positive, but when the user requests unmapping the grant-mapped pages, __unmap_grant_pages_done will then make map->live_grants negative, because the latter function does not check if all of the pages that were requested to be unmapped were actually unmapped, and the same function unconditionally subtracts "data->count" (i.e., a value that can be greater than map->live_grants) from map->live_grants. The side effects of a negative live_grants value have not been studied. The net effect of all of this is that grant references are leaked in one of the above conditions. In Qubes OS v4.1 (which uses Xen's grant mechanism extensively for X11 GUI isolation), this issue manifests itself with warning messages like the following to be printed out by the Linux kernel in the VM that had granted pages (that contain X11 GUI window data) to dom0: "g.e. 0x1234 still pending", especially after the user rapidly resizes GUI VM windows (causing some grant-mapping operations to partially or completely fail, due to the fact that the VM unshares some of the pages as part of the window resizing, making the pages impossible to grant-map from dom0). The fix for this issue involves counting all successful map_ops and kmap_ops mappings separately, and then adding the sum to live_grants. During unmapping, only the number of successfully unmapped grants is subtracted from live_grants. The code is also modified to check for negative live_grants values after the subtraction and warn the user. Link: https://github.com/QubesOS/qubes-issues/issues/7631 Fixes: dbe97cff7dd9 ("xen/gntdev: Avoid blocking in unmap_grant_pages()") Cc: stable@vger.kernel.org Signed-off-by: M. Vefa Bicakci Acked-by: Demi Marie Obenour Reviewed-by: Juergen Gross Link: https://lore.kernel.org/r/20221002222006.2077-2-m.v.b@runbox.com Signed-off-by: Juergen Gross Signed-off-by: Greg Kroah-Hartman --- drivers/xen/gntdev.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) --- a/drivers/xen/gntdev.c +++ b/drivers/xen/gntdev.c @@ -367,8 +367,7 @@ int gntdev_map_grant_pages(struct gntdev for (i = 0; i < map->count; i++) { if (map->map_ops[i].status == GNTST_okay) { map->unmap_ops[i].handle = map->map_ops[i].handle; - if (!use_ptemod) - alloced++; + alloced++; } else if (!err) err = -EINVAL; @@ -377,8 +376,7 @@ int gntdev_map_grant_pages(struct gntdev if (use_ptemod) { if (map->kmap_ops[i].status == GNTST_okay) { - if (map->map_ops[i].status == GNTST_okay) - alloced++; + alloced++; map->kunmap_ops[i].handle = map->kmap_ops[i].handle; } else if (!err) err = -EINVAL; @@ -394,8 +392,14 @@ static void __unmap_grant_pages_done(int unsigned int i; struct gntdev_grant_map *map = data->data; unsigned int offset = data->unmap_ops - map->unmap_ops; + int successful_unmaps = 0; + int live_grants; for (i = 0; i < data->count; i++) { + if (map->unmap_ops[offset + i].status == GNTST_okay && + map->unmap_ops[offset + i].handle != INVALID_GRANT_HANDLE) + successful_unmaps++; + WARN_ON(map->unmap_ops[offset + i].status != GNTST_okay && map->unmap_ops[offset + i].handle != INVALID_GRANT_HANDLE); pr_debug("unmap handle=%d st=%d\n", @@ -403,6 +407,10 @@ static void __unmap_grant_pages_done(int map->unmap_ops[offset+i].status); map->unmap_ops[offset+i].handle = INVALID_GRANT_HANDLE; if (use_ptemod) { + if (map->kunmap_ops[offset + i].status == GNTST_okay && + map->kunmap_ops[offset + i].handle != INVALID_GRANT_HANDLE) + successful_unmaps++; + WARN_ON(map->kunmap_ops[offset + i].status != GNTST_okay && map->kunmap_ops[offset + i].handle != INVALID_GRANT_HANDLE); pr_debug("kunmap handle=%u st=%d\n", @@ -411,11 +419,15 @@ static void __unmap_grant_pages_done(int map->kunmap_ops[offset+i].handle = INVALID_GRANT_HANDLE; } } + /* * Decrease the live-grant counter. This must happen after the loop to * prevent premature reuse of the grants by gnttab_mmap(). */ - atomic_sub(data->count, &map->live_grants); + live_grants = atomic_sub_return(successful_unmaps, &map->live_grants); + if (WARN_ON(live_grants < 0)) + pr_err("%s: live_grants became negative (%d) after unmapping %d pages!\n", + __func__, live_grants, successful_unmaps); /* Release reference taken by __unmap_grant_pages */ gntdev_put_map(NULL, map); From patchwork Wed Oct 19 08:22: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: 5213 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp264913wrs; Wed, 19 Oct 2022 04:21:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ock0izLYxVg5QTvMbavqp+8vS1cv1RL+LQCHm7MjIQuF+6czskJ+KZzG/TH0vF4lESwR7 X-Received: by 2002:a63:8a42:0:b0:460:58ec:cc66 with SMTP id y63-20020a638a42000000b0046058eccc66mr6772239pgd.195.1666178473131; Wed, 19 Oct 2022 04:21:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178473; cv=none; d=google.com; s=arc-20160816; b=UmlaUxXYcvUZT8hq+ihJrpIK+qdYaJICwtLriEMlgv6Fr9F5rJh/AKHaXDesy1avXE F4mKvcR5eIMJ4L2KJ3mcwGPJ6I98OwM1A7EM22CWS4fBIerDdi7frFpb1sLqMardOFtJ dS1PIL5ougMgGRbRC71L5sWcl2nIpAijDhXNnk0v2k/TG1aZsXBJNoiN5pCiBoLaao91 fsW5gEtKexbLlfonUCkhQv0JvnRcjmO2bi/OrvDQyQyPHRD++pHsBKncK+UEwgwXRi3+ nKlvSVGNKnPr7fl9dnzhNXxZPlHIu/bryHO3Nju2PDWk87JlJskymB1GfpXGjWLZkbCG Y9TA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=KK9tGpzZpMc11jUUwgNCoYLmYURDSdOw5HimTocEIE8=; b=J0n5u5E6U9B7r8pV+c9PHo10SFroCzuy7T40PtTbHaRF6TQHlU2s93GnrDMWRR5ln2 MinhFeqk2Arg4CE+4fUxunnOS4ykNun85DYOco6wM9u2pOOrJ3Gygnm9boA3Cnubbduo An8koFkTodauwasih23/BQ68fCOHAAmw28Q982q2QiWasFEmLrk8MErBcF7Wrt/CsAfW NcC/57gzULoCE9YwBB6G+A27adoA/F6UoVQtmNy/FSAKryHXVDlt0GF43Gry5+OO4o1W 4YUu0Pqh49njQp6PXCX+BGz0g7YAKZvQiVrkbSEJ8uY3BxEafSHKlwbMdrgT80FODU9X aXgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dAh9GVgm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y35-20020a056a00182300b0053641d594b2si18771235pfa.40.2022.10.19.04.20.58; Wed, 19 Oct 2022 04:21:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dAh9GVgm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232819AbiJSLLN (ORCPT + 99 others); Wed, 19 Oct 2022 07:11:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232944AbiJSLKI (ORCPT ); Wed, 19 Oct 2022 07:10:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7960B180256; Wed, 19 Oct 2022 03:38: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 06711B822D6; Wed, 19 Oct 2022 08:41:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B31CC433D6; Wed, 19 Oct 2022 08:41:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168890; bh=dDEgC9WFXRGUcgTqtVWIJfnABWNhCQtyM3jd2yNVvEU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dAh9GVgmKfSRVCXgr56HAvUzCuYLFQnSZhT2QYSNmu8c+b4FCnckaveiCXCJxy7IK hLlnht2aIttMZzVudRuc7pI5/H0BfnT0oOQYgJQNKK2EiirMLl3kbgPZj1CiryC94p K+RbZ94Ewc0EDaZ9kYM68COdxE8USkTkBbnebLH8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "M. Vefa Bicakci" , Juergen Gross Subject: [PATCH 6.0 088/862] xen/gntdev: Accommodate VMA splitting Date: Wed, 19 Oct 2022 10:22:55 +0200 Message-Id: <20221019083253.825047464@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114758530185855?= X-GMAIL-MSGID: =?utf-8?q?1747114758530185855?= From: M. Vefa Bicakci commit 5c13a4a0291b30191eff9ead8d010e1ca43a4d0c upstream. Prior to this commit, the gntdev driver code did not handle the following scenario correctly with paravirtualized (PV) Xen domains: * User process sets up a gntdev mapping composed of two grant mappings (i.e., two pages shared by another Xen domain). * User process munmap()s one of the pages. * User process munmap()s the remaining page. * User process exits. In the scenario above, the user process would cause the kernel to log the following messages in dmesg for the first munmap(), and the second munmap() call would result in similar log messages: BUG: Bad page map in process doublemap.test pte:... pmd:... page:0000000057c97bff refcount:1 mapcount:-1 \ mapping:0000000000000000 index:0x0 pfn:... ... page dumped because: bad pte ... file:gntdev fault:0x0 mmap:gntdev_mmap [xen_gntdev] readpage:0x0 ... Call Trace: dump_stack_lvl+0x46/0x5e print_bad_pte.cold+0x66/0xb6 unmap_page_range+0x7e5/0xdc0 unmap_vmas+0x78/0xf0 unmap_region+0xa8/0x110 __do_munmap+0x1ea/0x4e0 __vm_munmap+0x75/0x120 __x64_sys_munmap+0x28/0x40 do_syscall_64+0x38/0x90 entry_SYSCALL_64_after_hwframe+0x61/0xcb ... For each munmap() call, the Xen hypervisor (if built with CONFIG_DEBUG) would print out the following and trigger a general protection fault in the affected Xen PV domain: (XEN) d0v... Attempt to implicitly unmap d0's grant PTE ... (XEN) d0v... Attempt to implicitly unmap d0's grant PTE ... As of this writing, gntdev_grant_map structure's vma field (referred to as map->vma below) is mainly used for checking the start and end addresses of mappings. However, with split VMAs, these may change, and there could be more than one VMA associated with a gntdev mapping. Hence, remove the use of map->vma and rely on map->pages_vm_start for the original start address and on (map->count << PAGE_SHIFT) for the original mapping size. Let the invalidate() and find_special_page() hooks use these. Also, given that there can be multiple VMAs associated with a gntdev mapping, move the "mmu_interval_notifier_remove(&map->notifier)" call to the end of gntdev_put_map, so that the MMU notifier is only removed after the closing of the last remaining VMA. Finally, use an atomic to prevent inadvertent gntdev mapping re-use, instead of using the map->live_grants atomic counter and/or the map->vma pointer (the latter of which is now removed). This prevents the userspace from mmap()'ing (with MAP_FIXED) a gntdev mapping over the same address range as a previously set up gntdev mapping. This scenario can be summarized with the following call-trace, which was valid prior to this commit: mmap gntdev_mmap mmap (repeat mmap with MAP_FIXED over the same address range) gntdev_invalidate unmap_grant_pages (sets 'being_removed' entries to true) gnttab_unmap_refs_async unmap_single_vma gntdev_mmap (maps the shared pages again) munmap gntdev_invalidate unmap_grant_pages (no-op because 'being_removed' entries are true) unmap_single_vma (For PV domains, Xen reports that a granted page is being unmapped and triggers a general protection fault in the affected domain, if Xen was built with CONFIG_DEBUG) The fix for this last scenario could be worth its own commit, but we opted for a single commit, because removing the gntdev_grant_map structure's vma field requires guarding the entry to gntdev_mmap(), and the live_grants atomic counter is not sufficient on its own to prevent the mmap() over a pre-existing mapping. Link: https://github.com/QubesOS/qubes-issues/issues/7631 Fixes: ab31523c2fca ("xen/gntdev: allow usermode to map granted pages") Cc: stable@vger.kernel.org Signed-off-by: M. Vefa Bicakci Reviewed-by: Juergen Gross Link: https://lore.kernel.org/r/20221002222006.2077-3-m.v.b@runbox.com Signed-off-by: Juergen Gross Signed-off-by: Greg Kroah-Hartman --- drivers/xen/gntdev-common.h | 3 +- drivers/xen/gntdev.c | 58 ++++++++++++++++++-------------------------- 2 files changed, 27 insertions(+), 34 deletions(-) --- a/drivers/xen/gntdev-common.h +++ b/drivers/xen/gntdev-common.h @@ -44,9 +44,10 @@ struct gntdev_unmap_notify { }; struct gntdev_grant_map { + atomic_t in_use; struct mmu_interval_notifier notifier; + bool notifier_init; struct list_head next; - struct vm_area_struct *vma; int index; int count; int flags; --- a/drivers/xen/gntdev.c +++ b/drivers/xen/gntdev.c @@ -286,6 +286,9 @@ void gntdev_put_map(struct gntdev_priv * */ } + if (use_ptemod && map->notifier_init) + mmu_interval_notifier_remove(&map->notifier); + if (map->notify.flags & UNMAP_NOTIFY_SEND_EVENT) { notify_remote_via_evtchn(map->notify.event); evtchn_put(map->notify.event); @@ -298,7 +301,7 @@ void gntdev_put_map(struct gntdev_priv * static int find_grant_ptes(pte_t *pte, unsigned long addr, void *data) { struct gntdev_grant_map *map = data; - unsigned int pgnr = (addr - map->vma->vm_start) >> PAGE_SHIFT; + unsigned int pgnr = (addr - map->pages_vm_start) >> PAGE_SHIFT; int flags = map->flags | GNTMAP_application_map | GNTMAP_contains_pte | (1 << _GNTMAP_guest_avail0); u64 pte_maddr; @@ -508,11 +511,7 @@ static void gntdev_vma_close(struct vm_a struct gntdev_priv *priv = file->private_data; pr_debug("gntdev_vma_close %p\n", vma); - if (use_ptemod) { - WARN_ON(map->vma != vma); - mmu_interval_notifier_remove(&map->notifier); - map->vma = NULL; - } + vma->vm_private_data = NULL; gntdev_put_map(priv, map); } @@ -540,29 +539,30 @@ static bool gntdev_invalidate(struct mmu struct gntdev_grant_map *map = container_of(mn, struct gntdev_grant_map, notifier); unsigned long mstart, mend; + unsigned long map_start, map_end; if (!mmu_notifier_range_blockable(range)) return false; + map_start = map->pages_vm_start; + map_end = map->pages_vm_start + (map->count << PAGE_SHIFT); + /* * If the VMA is split or otherwise changed the notifier is not * updated, but we don't want to process VA's outside the modified * VMA. FIXME: It would be much more understandable to just prevent * modifying the VMA in the first place. */ - if (map->vma->vm_start >= range->end || - map->vma->vm_end <= range->start) + if (map_start >= range->end || map_end <= range->start) return true; - mstart = max(range->start, map->vma->vm_start); - mend = min(range->end, map->vma->vm_end); + mstart = max(range->start, map_start); + mend = min(range->end, map_end); pr_debug("map %d+%d (%lx %lx), range %lx %lx, mrange %lx %lx\n", - map->index, map->count, - map->vma->vm_start, map->vma->vm_end, - range->start, range->end, mstart, mend); - unmap_grant_pages(map, - (mstart - map->vma->vm_start) >> PAGE_SHIFT, - (mend - mstart) >> PAGE_SHIFT); + map->index, map->count, map_start, map_end, + range->start, range->end, mstart, mend); + unmap_grant_pages(map, (mstart - map_start) >> PAGE_SHIFT, + (mend - mstart) >> PAGE_SHIFT); return true; } @@ -1042,18 +1042,15 @@ static int gntdev_mmap(struct file *flip return -EINVAL; pr_debug("map %d+%d at %lx (pgoff %lx)\n", - index, count, vma->vm_start, vma->vm_pgoff); + index, count, vma->vm_start, vma->vm_pgoff); mutex_lock(&priv->lock); map = gntdev_find_map_index(priv, index, count); if (!map) goto unlock_out; - if (use_ptemod && map->vma) - goto unlock_out; - if (atomic_read(&map->live_grants)) { - err = -EAGAIN; + if (!atomic_add_unless(&map->in_use, 1, 1)) goto unlock_out; - } + refcount_inc(&map->users); vma->vm_ops = &gntdev_vmops; @@ -1074,15 +1071,16 @@ static int gntdev_mmap(struct file *flip map->flags |= GNTMAP_readonly; } + map->pages_vm_start = vma->vm_start; + if (use_ptemod) { - map->vma = vma; err = mmu_interval_notifier_insert_locked( &map->notifier, vma->vm_mm, vma->vm_start, vma->vm_end - vma->vm_start, &gntdev_mmu_ops); - if (err) { - map->vma = NULL; + if (err) goto out_unlock_put; - } + + map->notifier_init = true; } mutex_unlock(&priv->lock); @@ -1099,7 +1097,6 @@ static int gntdev_mmap(struct file *flip */ mmu_interval_read_begin(&map->notifier); - map->pages_vm_start = vma->vm_start; err = apply_to_page_range(vma->vm_mm, vma->vm_start, vma->vm_end - vma->vm_start, find_grant_ptes, map); @@ -1128,13 +1125,8 @@ unlock_out: out_unlock_put: mutex_unlock(&priv->lock); out_put_map: - if (use_ptemod) { + if (use_ptemod) unmap_grant_pages(map, 0, map->count); - if (map->vma) { - mmu_interval_notifier_remove(&map->notifier); - map->vma = NULL; - } - } gntdev_put_map(priv, map); return err; } From patchwork Wed Oct 19 08:22: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: 5357 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp298239wrs; Wed, 19 Oct 2022 05:30:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM72ZtosrHgwcxrkhetUO7+f1sfBkUG9OzJQtfgBmGVvMgH7yo6pr52/wMM4JOb/Yb9ccCPq X-Received: by 2002:a17:902:6a87:b0:181:c6c6:1d38 with SMTP id n7-20020a1709026a8700b00181c6c61d38mr8183897plk.74.1666182610673; Wed, 19 Oct 2022 05:30:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666182610; cv=none; d=google.com; s=arc-20160816; b=06exaVqu0wg35+acaqcQ+LDFGWy6tfd2I2B6nIcfRIuyISbTAFyUEOYlFoEktMVAAP o+TnoIeSvVOz6isEb9jQQoRRtyMQJYun1C9SjwJvEaj1frDDqayx7pbD5e/bD+ReEM9n aCBXGP4hA3BewQSLMmiw3HYGthv1OdDJP94PD+xt5iRheeIMnzQBnIe78RIOG2nK7/yo HiyoixgzzuWjET9X+PiuBoumvFqyDnKDgY5cAIZki2oldg4ic5OplwJesSFwp2dlXAkw lpnYjofJRwgfngANUxP1+E6K3OvREr2X9N0U/OEW2eqknDN5cIgd6R4DHlGcg3o4iFuT jkUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=s1zjmXELSvV/oJD3JjtvmTTEeP+8aYUv3ehpRZZMQaCHvTUkYO3TQFGY7Q2Kcz2IMt rhKZtRVPpiexyoMscGIMgzDOMcdgUrbey4zcKBFc6/StO3DZONMlDgDFQEiEjDAnUS1l Q0jHkLBp+eRb10tCAxZGYduAX/+W6p4a+G6lPnY0LfP26Yr+pnZEIpALv5CMzILz/U2T w2YByXCS5vlPOqeynZ5dVlbyCVmK1XNzJDM3/DKKJ9QCr27RDLGy9KgvKC41nJwuGeU+ 1/S6no7h+snXKR9XsTsZAC65BMVV8em/reOCoxdfSgp8LqkGD68pMiFUJXpaOAjLNjpS HSwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CgcDRmfB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q14-20020a17090311ce00b001789fa8f90esi20935314plh.408.2022.10.19.05.29.56; Wed, 19 Oct 2022 05:30: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=CgcDRmfB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233044AbiJSMTc (ORCPT + 99 others); Wed, 19 Oct 2022 08:19:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232515AbiJSMSu (ORCPT ); Wed, 19 Oct 2022 08:18: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 D5EF34057D; Wed, 19 Oct 2022 04:54: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 E018BB822D1; Wed, 19 Oct 2022 08:41:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2FD25C433C1; Wed, 19 Oct 2022 08:41:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168893; bh=14mKDapbgbuh31OpS2MIP0VbUg71zVnPdpLmFUC99dY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CgcDRmfBEb49+QMIR5yQjxQlo65we6mF4NExLEK0DBFXFl1G6mkQUFq2WaitP5+C8 cxh8OUphrAIaR6wftULc47DOLv9uxImsDsCToj49EQzrjDOWmvgJvtXSg6c+2+2IKI KhpXOXpiIVIF2jXCRyvr/+5GJepcJSyF6jN5+VCo= 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 6.0 089/862] PCI: Sanitise firmware BAR assignments behind a PCI-PCI bridge Date: Wed, 19 Oct 2022 10:22:56 +0200 Message-Id: <20221019083253.874350484@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747119097072299658?= X-GMAIL-MSGID: =?utf-8?q?1747119097072299658?= 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 Wed Oct 19 08:22: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: 5222 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp265548wrs; Wed, 19 Oct 2022 04:22:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4LidKKbP8UGobQwjxACTP2VTixJFjN/S+lu9XnrzCW7mp8wigx+2b1hN8sNMbk2WniFRjs X-Received: by 2002:a17:903:258e:b0:17b:a251:c80a with SMTP id jb14-20020a170903258e00b0017ba251c80amr8024180plb.110.1666178560253; Wed, 19 Oct 2022 04:22:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178560; cv=none; d=google.com; s=arc-20160816; b=Yan+0qdOSzaf95ZVpUtnvF5qBFV0pbQcLva1E1vxYLwtdF51cfpCok3ziLYPQb9WJz dV2VZH8az5H+v6ZDlDvcWzhGFrFMuI7cz+BcSI4nXg/0FUhzZGy7F291fhODdJGZKrwu qlQoeSZZboykPwgD66CodZsnoaK3uTXvkqj7GsdsL2EAo0qPu77Pw0Zf6BHOisIBia3S FIZZG00lwHUP3r+WAL+9KU6i4M+72oBJPB0GoBYoGJHV8f+7hVIP16xOp7+zGJNQ5Bbn CPSeXC4QPO+P5KNPv+HdYlXGL4LiTXAS3tBS9DCZ+k/HwH3P1Q1lc6p88pBYTpAFNMN7 eSFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JhSCCrgEMkeDeIUMI+ygNto2o9LXqzQNoXwaeAOPCsM=; b=l0N2cVsAoCZ9zvMnPc7uqtRXvOak1tVl7YRil8NAEwX216bruEeLGyvC1HWSZwb1ek 1Eqo6KOe7Z6uYNrzb+582/ev8EEfzcAO9LO9xvZc9rY0k4t4o8+H07ZIvI5U5KkmM9io WxtKD4UKJXuVn1mljXVRqxZrUaBRmOvqLcx3lFoygKQ9epzsL+tXDf5u46Q46uq1UeBN WZt85NA2SdiH33fQM5mgKu2aJhqr2MaD5GqV4vaZV1OH5L1PkIGxbHKDxO8UWcMQZkAU JklqCZb5J60ZJ5B93Zq4bjrX5/tfTOuB8EYHbMrOkLDxsmKOy/qqa6yiYG2KUZa8qs+D 00FA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sZQEZ5iJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f70-20020a636a49000000b0042b9117b723si17440502pgc.794.2022.10.19.04.22.26; Wed, 19 Oct 2022 04:22: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=sZQEZ5iJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231736AbiJSLM2 (ORCPT + 99 others); Wed, 19 Oct 2022 07:12:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229716AbiJSLLR (ORCPT ); Wed, 19 Oct 2022 07:11:17 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66B8115381C; Wed, 19 Oct 2022 03:38: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 0DC92B822CC; Wed, 19 Oct 2022 08:41:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4BEE2C433C1; Wed, 19 Oct 2022 08:41:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168896; bh=1rW26+ZwcA6tiLBS6hz+rgjIIBis7sdQ7KSHF1iXPo0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sZQEZ5iJxSbcYNFQa5lnAm3NkfGAzSzfkSt2WLXWcCNjO2fvImsdQw+At9kN1ck9j Xad1bSk8vEUGuH5A+Spm5EIqDPSTyxcXwFsNaSIuIrGSjDJEq4Qq1oPFnfMl7SlQWm BCMGvDmczwU6B1wrSEYrxl+14En59KlrEDXT5R84= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe Leroy Subject: [PATCH 6.0 090/862] serial: cpm_uart: Dont request IRQ too early for console port Date: Wed, 19 Oct 2022 10:22:57 +0200 Message-Id: <20221019083253.923565134@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114850095517745?= X-GMAIL-MSGID: =?utf-8?q?1747114850095517745?= From: Christophe Leroy commit 30963b2f75bfdbbcf1cc5d80bf88fec7aaba808d upstream. The following message is seen during boot and the activation of console port gets delayed until normal serial ports activation. [ 0.001346] irq: no irq domain found for pic@930 ! The console port doesn't need irq, perform irq reservation later, during cpm_uart probe. While at it, don't use NO_IRQ but 0 which is the value returned by irq_of_parse_and_map() in case of error. By chance powerpc's NO_IRQ has value 0 but on some architectures it is -1. Fixes: 14d893fc6846 ("powerpc/8xx: Convert CPM1 interrupt controller to platform_device") Cc: stable@vger.kernel.org Signed-off-by: Christophe Leroy Link: https://lore.kernel.org/r/8bed0f30c2e9ef16ae64fb1243a16d54a48eb8da.1664526717.git.christophe.leroy@csgroup.eu Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/cpm_uart/cpm_uart_core.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) --- a/drivers/tty/serial/cpm_uart/cpm_uart_core.c +++ b/drivers/tty/serial/cpm_uart/cpm_uart_core.c @@ -1214,12 +1214,6 @@ static int cpm_uart_init_port(struct dev pinfo->port.fifosize = pinfo->tx_nrfifos * pinfo->tx_fifosize; spin_lock_init(&pinfo->port.lock); - pinfo->port.irq = irq_of_parse_and_map(np, 0); - if (pinfo->port.irq == NO_IRQ) { - ret = -EINVAL; - goto out_pram; - } - for (i = 0; i < NUM_GPIOS; i++) { struct gpio_desc *gpiod; @@ -1229,7 +1223,7 @@ static int cpm_uart_init_port(struct dev if (IS_ERR(gpiod)) { ret = PTR_ERR(gpiod); - goto out_irq; + goto out_pram; } if (gpiod) { @@ -1255,8 +1249,6 @@ static int cpm_uart_init_port(struct dev return cpm_uart_request_port(&pinfo->port); -out_irq: - irq_dispose_mapping(pinfo->port.irq); out_pram: cpm_uart_unmap_pram(pinfo, pram); out_mem: @@ -1436,11 +1428,17 @@ static int cpm_uart_probe(struct platfor /* initialize the device pointer for the port */ pinfo->port.dev = &ofdev->dev; + pinfo->port.irq = irq_of_parse_and_map(ofdev->dev.of_node, 0); + if (!pinfo->port.irq) + return -EINVAL; + ret = cpm_uart_init_port(ofdev->dev.of_node, pinfo); - if (ret) - return ret; + if (!ret) + return uart_add_one_port(&cpm_reg, &pinfo->port); + + irq_dispose_mapping(pinfo->port.irq); - return uart_add_one_port(&cpm_reg, &pinfo->port); + return ret; } static int cpm_uart_remove(struct platform_device *ofdev) From patchwork Wed Oct 19 08:22:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5212 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp264827wrs; Wed, 19 Oct 2022 04:21:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6nd07NuMvK02DZ0x7X33PeDNIDPOsP/UnPWhAuyPY7v+rvZvudod0k0sGsH7BpbvR7AWwL X-Received: by 2002:a62:164d:0:b0:562:bc4e:253 with SMTP id 74-20020a62164d000000b00562bc4e0253mr7784456pfw.26.1666178461019; Wed, 19 Oct 2022 04:21:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178461; cv=none; d=google.com; s=arc-20160816; b=Xyi+zCG2p1DeLVN2CBtA6gggUHB41RTqLvBp5renb3YB76qOdNgJlsi7johF1rLlaP KvnWTRdNPn1s8wNY2EJdnI+BDcYb73wXXSsD5pJUCjDG9uUyDxjNI0cy5rGiPB22Yy8I 4VuEKlxVTF6bsY5ljX1cEo6KexjDTDHHrodINbUl1Z3YlJjizxlKpZEjjmtq7z6l+MFk fPY8FPpl+V1VZ7+n8TZyQfhe6W1RpmdOzJAOCDqLS8guYw+HvxMjiEzMt7GcUGLvbO+q KBLCl4Kzza7t2KMmG9Pr8VgXqV9RBJtg3vowLk2XIbmgDf5EEAXG6G6zBFvexhMzTb/v agyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=KNHHbuCshV3tca/TkLJ2FP6x2yxVsoiqpZYrR2E2vpw=; b=nwuXNxtAgMrFhSG4CiCG0vWjgVjpa+MdABD1Ft9/rImr0geXwkxyq63capPstkcbAx 1vazISOA+KvdsR3jy+4IUj8j6cBYbMInHsQ2RQoBurCK8cyh6pQSMM+kM6gJxxJpnfhf ceSPpHkJihTFed/sa0wsCbLa8WR+1ZNkAc851sr9yzUTXr5d3A/Msk3NqrnQR5TRTrC0 ViMvAY9sfS1DgUOQ7x5cnKtka0h8IKIhp/a314/j6TDFNK6y4YFNp9+6mNZzDdnOmXDy efJzTEuMABHDqzyhKWLi7mzEiBYyyYUiSyyyTyhIE6AOXIIjKD5g6ISkZQ4ltjOSzDpf hehw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SmJ+sY1t; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b3-20020a17090a6ac300b0020a84ae69b1si22726085pjm.71.2022.10.19.04.20.47; Wed, 19 Oct 2022 04:21: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=SmJ+sY1t; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231370AbiJSLLH (ORCPT + 99 others); Wed, 19 Oct 2022 07:11:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230137AbiJSLJx (ORCPT ); Wed, 19 Oct 2022 07:09: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 3FED210A7EE; Wed, 19 Oct 2022 03:38: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 CCD35B822D7; Wed, 19 Oct 2022 08:41:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45449C433D6; Wed, 19 Oct 2022 08:41:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168899; bh=QoioZ0jqf5sTqzB/x1/0xIS1uWbsoDtDsR033d+gNwc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SmJ+sY1t4XdReK1SUDNFWo9A3rzyWvfz8PBjRDN3N2cghTz68MAEYlcgfl0SLbUjy yXXyvwSvcuNXJgXmlQ/sYeJOR5GRcOzwQyNAA7eKEwG2NTDMVaVIRUgyaY9zZ6ie4y 8JNHRVSGN/2yxKBYj6EfRqU6ATJe9Mv87LyMRzDQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marek Vasut , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Lukas Wunner Subject: [PATCH 6.0 091/862] serial: stm32: Deassert Transmit Enable on ->rs485_config() Date: Wed, 19 Oct 2022 10:22:58 +0200 Message-Id: <20221019083253.972281403@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114745774162835?= X-GMAIL-MSGID: =?utf-8?q?1747114745774162835?= From: Lukas Wunner commit adafbbf6895eb0ce41a313c6ee68870ab9aa93cd upstream. The STM32 USART can control RS-485 Transmit Enable in hardware. Since commit 7df5081cbf5e ("serial: stm32: Add RS485 RTS GPIO control"), it can alternatively be controlled in software. That was done to allow RS-485 even if the RTS pin is unavailable because it's pinmuxed to a different function. However the commit neglected to deassert Transmit Enable upon invocation of the ->rs485_config() callback. Fix it. Avoid forward declarations by moving stm32_usart_tx_empty(), stm32_usart_rs485_rts_enable() and stm32_usart_rs485_rts_disable() further up in the driver. Fixes: 7df5081cbf5e ("serial: stm32: Add RS485 RTS GPIO control") Cc: stable@vger.kernel.org # v5.9+ Cc: Marek Vasut Reviewed-by: Ilpo Järvinen Signed-off-by: Lukas Wunner Link: https://lore.kernel.org/r/6059eab35dba394468335ef640df8b0050fd9dbd.1662886616.git.lukas@wunner.de Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/stm32-usart.c | 100 ++++++++++++++++++++------------------- 1 file changed, 53 insertions(+), 47 deletions(-) --- a/drivers/tty/serial/stm32-usart.c +++ b/drivers/tty/serial/stm32-usart.c @@ -131,6 +131,53 @@ static void stm32_usart_clr_bits(struct writel_relaxed(val, port->membase + reg); } +static unsigned int stm32_usart_tx_empty(struct uart_port *port) +{ + struct stm32_port *stm32_port = to_stm32_port(port); + const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs; + + if (readl_relaxed(port->membase + ofs->isr) & USART_SR_TC) + return TIOCSER_TEMT; + + return 0; +} + +static void stm32_usart_rs485_rts_enable(struct uart_port *port) +{ + struct stm32_port *stm32_port = to_stm32_port(port); + struct serial_rs485 *rs485conf = &port->rs485; + + if (stm32_port->hw_flow_control || + !(rs485conf->flags & SER_RS485_ENABLED)) + return; + + if (rs485conf->flags & SER_RS485_RTS_ON_SEND) { + mctrl_gpio_set(stm32_port->gpios, + stm32_port->port.mctrl | TIOCM_RTS); + } else { + mctrl_gpio_set(stm32_port->gpios, + stm32_port->port.mctrl & ~TIOCM_RTS); + } +} + +static void stm32_usart_rs485_rts_disable(struct uart_port *port) +{ + struct stm32_port *stm32_port = to_stm32_port(port); + struct serial_rs485 *rs485conf = &port->rs485; + + if (stm32_port->hw_flow_control || + !(rs485conf->flags & SER_RS485_ENABLED)) + return; + + if (rs485conf->flags & SER_RS485_RTS_ON_SEND) { + mctrl_gpio_set(stm32_port->gpios, + stm32_port->port.mctrl & ~TIOCM_RTS); + } else { + mctrl_gpio_set(stm32_port->gpios, + stm32_port->port.mctrl | TIOCM_RTS); + } +} + static void stm32_usart_config_reg_rs485(u32 *cr1, u32 *cr3, u32 delay_ADE, u32 delay_DDE, u32 baud) { @@ -214,6 +261,12 @@ static int stm32_usart_config_rs485(stru stm32_usart_set_bits(port, ofs->cr1, BIT(cfg->uart_enable_bit)); + /* Adjust RTS polarity in case it's driven in software */ + if (stm32_usart_tx_empty(port)) + stm32_usart_rs485_rts_disable(port); + else + stm32_usart_rs485_rts_enable(port); + return 0; } @@ -529,42 +582,6 @@ static void stm32_usart_tc_interrupt_dis stm32_usart_clr_bits(port, ofs->cr1, USART_CR1_TCIE); } -static void stm32_usart_rs485_rts_enable(struct uart_port *port) -{ - struct stm32_port *stm32_port = to_stm32_port(port); - struct serial_rs485 *rs485conf = &port->rs485; - - if (stm32_port->hw_flow_control || - !(rs485conf->flags & SER_RS485_ENABLED)) - return; - - if (rs485conf->flags & SER_RS485_RTS_ON_SEND) { - mctrl_gpio_set(stm32_port->gpios, - stm32_port->port.mctrl | TIOCM_RTS); - } else { - mctrl_gpio_set(stm32_port->gpios, - stm32_port->port.mctrl & ~TIOCM_RTS); - } -} - -static void stm32_usart_rs485_rts_disable(struct uart_port *port) -{ - struct stm32_port *stm32_port = to_stm32_port(port); - struct serial_rs485 *rs485conf = &port->rs485; - - if (stm32_port->hw_flow_control || - !(rs485conf->flags & SER_RS485_ENABLED)) - return; - - if (rs485conf->flags & SER_RS485_RTS_ON_SEND) { - mctrl_gpio_set(stm32_port->gpios, - stm32_port->port.mctrl & ~TIOCM_RTS); - } else { - mctrl_gpio_set(stm32_port->gpios, - stm32_port->port.mctrl | TIOCM_RTS); - } -} - static void stm32_usart_transmit_chars_pio(struct uart_port *port) { struct stm32_port *stm32_port = to_stm32_port(port); @@ -807,17 +824,6 @@ static irqreturn_t stm32_usart_threaded_ return IRQ_HANDLED; } -static unsigned int stm32_usart_tx_empty(struct uart_port *port) -{ - struct stm32_port *stm32_port = to_stm32_port(port); - const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs; - - if (readl_relaxed(port->membase + ofs->isr) & USART_SR_TC) - return TIOCSER_TEMT; - - return 0; -} - static void stm32_usart_set_mctrl(struct uart_port *port, unsigned int mctrl) { struct stm32_port *stm32_port = to_stm32_port(port); From patchwork Wed Oct 19 08:22: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: 4551 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp204453wrs; Wed, 19 Oct 2022 01:46:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4aXwpT5Q32R7B0dWuugd+EzN9gQE3gJMOHO/dtCJUvzipEIJBGob4sfV0fSZNkRiLJW+n8 X-Received: by 2002:a17:902:dccb:b0:181:a83b:2a8c with SMTP id t11-20020a170902dccb00b00181a83b2a8cmr7413649pll.10.1666169167526; Wed, 19 Oct 2022 01:46:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169167; cv=none; d=google.com; s=arc-20160816; b=FZctuM7WsoTYoibucLyAQWsAtgzP7jFjDW97yVj4LuJPHdhL6OBMmzjNIcJOLg5XbR jz1H4UXVdyDseYrQTSb2dvFclKbEg7hRnEUlXz2cnXo9LL6gtqlEmnEU/dIY+CoeIO+v 2yFD+zQ8myFVtfOXPc6I3xQYf/CDYqVQRHfZLrpCoOLD7tmuK2aORT4fto30UexrjzSV +FBag0RMg6E5Jqd1viTNjMkaUtPKDXoLse5WIUCOMsfENqZ89dV3p4tmkkNAkzjgFqHF EQdobTF9ktQutzxgySbTzr80c5GflHhiNFi61XXomeDXaSo/OaVbksortBkSTjHYT55c cqYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ttVdgfkAgWhzCs2Qo34lPGaVFoTiDZyIIbgMtqD9+Fg=; b=qHjq+mmyBCeF8S/aiD+4PoU+YmPzwFJwiGWWskUsBrep+N0E5YLBbgo8XpTtP26q7v gF6vKbi/bv57knOoWL5Wqv/eWqt5bSFGhHpE+3wp3qfJwXrRAOUeq94GSwwQvO/XNHAT /y5Kh8MdJFyXcxzHAxmxoOf/gjYiuppdQOBGPxZK1PsZJ5oKOzrXh/i4KXWIJjXVj4dE ayJi86AG4TeM8M2ja27uMnie+WhrDRinJcobfO0yrX/9u7U9vp90NEh6oZyreq1G/S2i lsAwUxN3Rp4TwmrrUNoMLw/WwqpIGuB9fEoNcV64si7h11/7XCP5sRwZcSmdhUhJIy/o g2OA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2mhlpzxW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pw13-20020a17090b278d00b00200a5e50091si21917156pjb.57.2022.10.19.01.45.52; Wed, 19 Oct 2022 01:46: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=2mhlpzxW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231359AbiJSIp2 (ORCPT + 99 others); Wed, 19 Oct 2022 04:45:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231358AbiJSIoC (ORCPT ); Wed, 19 Oct 2022 04: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 228A28260C; Wed, 19 Oct 2022 01:41:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D1671617F7; Wed, 19 Oct 2022 08:41:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4358C433C1; Wed, 19 Oct 2022 08:41:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168902; bh=qgGQeYsc2Mi+QRQ5XO4mvjem28TQWZFhp/92ecMktAw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2mhlpzxWUf+KRl/B5pq4sgecHr+/MlggqPBo0W62wkiQOs+bTOOPt97pAebrYcIXs pn141KihGPci4wjB0CGMtyoTqMlNah+sTyFoCbm2uA/TXgM3dzKDzPyoXjoHwG0rjK OAGhyTVApXuX8eVhCw9qcHunVbZEX78/ssE60oMQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Matthias Schiffer , Roosen Henri , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Lukas Wunner Subject: [PATCH 6.0 092/862] serial: Deassert Transmit Enable on probe in driver-specific way Date: Wed, 19 Oct 2022 10:22:59 +0200 Message-Id: <20221019083254.011400450@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105001094023010?= X-GMAIL-MSGID: =?utf-8?q?1747105001094023010?= From: Lukas Wunner commit 7c7f9bc986e698873b489c371a08f206979d06b7 upstream. When a UART port is newly registered, uart_configure_port() seeks to deassert RS485 Transmit Enable by setting the RTS bit in port->mctrl. However a number of UART drivers interpret a set RTS bit as *assertion* instead of deassertion: Affected drivers include those using serial8250_em485_config() (except 8250_bcm2835aux.c) and some using mctrl_gpio (e.g. imx.c). Since the interpretation of the RTS bit is driver-specific, it is not suitable as a means to centrally deassert Transmit Enable in the serial core. Instead, the serial core must call on drivers to deassert it in their driver-specific way. One way to achieve that is to call ->rs485_config(). It implicitly deasserts Transmit Enable. So amend uart_configure_port() and uart_resume_port() to invoke uart_rs485_config(). That allows removing calls to uart_rs485_config() from drivers' ->probe() hooks and declaring the function static. Skip any invocation of ->set_mctrl() if RS485 is enabled. RS485 has no hardware flow control, so the modem control lines are irrelevant and need not be touched. When leaving RS485 mode, reset the modem control lines to the state stored in port->mctrl. That way, UARTs which are muxed between RS485 and RS232 transceivers drive the lines correctly when switched to RS232. (serial8250_do_startup() historically raises the OUT1 modem signal because otherwise interrupts are not signaled on ancient PC UARTs, but I believe that no longer applies to modern, RS485-capable UARTs and is thus safe to be skipped.) imx.c modifies port->mctrl whenever Transmit Enable is asserted and deasserted. Stop it from doing that so port->mctrl reflects the RS232 line state. 8250_omap.c deasserts Transmit Enable on ->runtime_resume() by calling ->set_mctrl(). Because that is now a no-op in RS485 mode, amend the function to call serial8250_em485_stop_tx(). fsl_lpuart.c retrieves and applies the RS485 device tree properties after registering the UART port. Because applying now happens on registration in uart_configure_port(), move retrieval of the properties ahead of uart_add_one_port(). Link: https://lore.kernel.org/all/20220329085050.311408-1-matthias.schiffer@ew.tq-group.com/ Link: https://lore.kernel.org/all/8f538a8903795f22f9acc94a9a31b03c9c4ccacb.camel@ginzinger.com/ Fixes: d3b3404df318 ("serial: Fix incorrect rs485 polarity on uart open") Cc: stable@vger.kernel.org # v4.14+ Reported-by: Matthias Schiffer Reported-by: Roosen Henri Tested-by: Matthias Schiffer Reviewed-by: Ilpo Järvinen Signed-off-by: Lukas Wunner Link: https://lore.kernel.org/r/2de36eba3fbe11278d5002e4e501afe0ceaca039.1663863805.git.lukas@wunner.de Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/8250/8250_omap.c | 3 +++ drivers/tty/serial/8250/8250_pci.c | 9 +-------- drivers/tty/serial/8250/8250_port.c | 12 +++++++----- drivers/tty/serial/fsl_lpuart.c | 10 ++++------ drivers/tty/serial/imx.c | 8 ++------ drivers/tty/serial/serial_core.c | 36 ++++++++++++++++++++---------------- include/linux/serial_core.h | 1 - 7 files changed, 37 insertions(+), 42 deletions(-) --- a/drivers/tty/serial/8250/8250_omap.c +++ b/drivers/tty/serial/8250/8250_omap.c @@ -342,6 +342,9 @@ static void omap8250_restore_regs(struct omap8250_update_mdr1(up, priv); up->port.ops->set_mctrl(&up->port, up->port.mctrl); + + if (up->port.rs485.flags & SER_RS485_ENABLED) + serial8250_em485_stop_tx(up); } /* --- a/drivers/tty/serial/8250/8250_pci.c +++ b/drivers/tty/serial/8250/8250_pci.c @@ -1627,7 +1627,6 @@ static int pci_fintek_init(struct pci_de resource_size_t bar_data[3]; u8 config_base; struct serial_private *priv = pci_get_drvdata(dev); - struct uart_8250_port *port; if (!(pci_resource_flags(dev, 5) & IORESOURCE_IO) || !(pci_resource_flags(dev, 4) & IORESOURCE_IO) || @@ -1674,13 +1673,7 @@ static int pci_fintek_init(struct pci_de pci_write_config_byte(dev, config_base + 0x06, dev->irq); - if (priv) { - /* re-apply RS232/485 mode when - * pciserial_resume_ports() - */ - port = serial8250_get_port(priv->line[i]); - uart_rs485_config(&port->port); - } else { + if (!priv) { /* First init without port data * force init to RS232 Mode */ --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -600,7 +600,7 @@ EXPORT_SYMBOL_GPL(serial8250_rpm_put); static int serial8250_em485_init(struct uart_8250_port *p) { if (p->em485) - return 0; + goto deassert_rts; p->em485 = kmalloc(sizeof(struct uart_8250_em485), GFP_ATOMIC); if (!p->em485) @@ -616,7 +616,9 @@ static int serial8250_em485_init(struct p->em485->active_timer = NULL; p->em485->tx_stopped = true; - p->rs485_stop_tx(p); +deassert_rts: + if (p->em485->tx_stopped) + p->rs485_stop_tx(p); return 0; } @@ -2042,6 +2044,9 @@ EXPORT_SYMBOL_GPL(serial8250_do_set_mctr static void serial8250_set_mctrl(struct uart_port *port, unsigned int mctrl) { + if (port->rs485.flags & SER_RS485_ENABLED) + return; + if (port->set_mctrl) port->set_mctrl(port, mctrl); else @@ -3187,9 +3192,6 @@ static void serial8250_config_port(struc if (flags & UART_CONFIG_TYPE) autoconfig(up); - if (port->rs485.flags & SER_RS485_ENABLED) - uart_rs485_config(port); - /* if access method is AU, it is a 16550 with a quirk */ if (port->type == PORT_16550A && port->iotype == UPIO_AU) up->bugs |= UART_BUG_NOMSR; --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c @@ -2729,15 +2729,13 @@ static int lpuart_probe(struct platform_ if (ret) goto failed_reset; - ret = uart_add_one_port(&lpuart_reg, &sport->port); - if (ret) - goto failed_attach_port; - ret = uart_get_rs485_mode(&sport->port); if (ret) goto failed_get_rs485; - uart_rs485_config(&sport->port); + ret = uart_add_one_port(&lpuart_reg, &sport->port); + if (ret) + goto failed_attach_port; ret = devm_request_irq(&pdev->dev, sport->port.irq, handler, 0, DRIVER_NAME, sport); @@ -2747,9 +2745,9 @@ static int lpuart_probe(struct platform_ return 0; failed_irq_request: -failed_get_rs485: uart_remove_one_port(&lpuart_reg, &sport->port); failed_attach_port: +failed_get_rs485: failed_reset: lpuart_disable_clks(sport); return ret; --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -380,8 +380,7 @@ static void imx_uart_rts_active(struct i { *ucr2 &= ~(UCR2_CTSC | UCR2_CTS); - sport->port.mctrl |= TIOCM_RTS; - mctrl_gpio_set(sport->gpios, sport->port.mctrl); + mctrl_gpio_set(sport->gpios, sport->port.mctrl | TIOCM_RTS); } /* called with port.lock taken and irqs caller dependent */ @@ -390,8 +389,7 @@ static void imx_uart_rts_inactive(struct *ucr2 &= ~UCR2_CTSC; *ucr2 |= UCR2_CTS; - sport->port.mctrl &= ~TIOCM_RTS; - mctrl_gpio_set(sport->gpios, sport->port.mctrl); + mctrl_gpio_set(sport->gpios, sport->port.mctrl & ~TIOCM_RTS); } static void start_hrtimer_ms(struct hrtimer *hrt, unsigned long msec) @@ -2347,8 +2345,6 @@ static int imx_uart_probe(struct platfor dev_err(&pdev->dev, "low-active RTS not possible when receiver is off, enabling receiver\n"); - uart_rs485_config(&sport->port); - /* Disable interrupts before requesting them */ ucr1 = imx_uart_readl(sport, UCR1); ucr1 &= ~(UCR1_ADEN | UCR1_TRDYEN | UCR1_IDEN | UCR1_RRDYEN | UCR1_RTSDEN); --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -158,15 +158,10 @@ uart_update_mctrl(struct uart_port *port unsigned long flags; unsigned int old; - if (port->rs485.flags & SER_RS485_ENABLED) { - set &= ~TIOCM_RTS; - clear &= ~TIOCM_RTS; - } - spin_lock_irqsave(&port->lock, flags); old = port->mctrl; port->mctrl = (old & ~clear) | set; - if (old != port->mctrl) + if (old != port->mctrl && !(port->rs485.flags & SER_RS485_ENABLED)) port->ops->set_mctrl(port, port->mctrl); spin_unlock_irqrestore(&port->lock, flags); } @@ -1391,7 +1386,7 @@ static void uart_set_rs485_termination(s !!(rs485->flags & SER_RS485_TERMINATE_BUS)); } -int uart_rs485_config(struct uart_port *port) +static int uart_rs485_config(struct uart_port *port) { struct serial_rs485 *rs485 = &port->rs485; int ret; @@ -1405,7 +1400,6 @@ int uart_rs485_config(struct uart_port * return ret; } -EXPORT_SYMBOL_GPL(uart_rs485_config); static int uart_get_rs485_config(struct uart_port *port, struct serial_rs485 __user *rs485) @@ -1444,8 +1438,13 @@ static int uart_set_rs485_config(struct spin_lock_irqsave(&port->lock, flags); ret = port->rs485_config(port, &tty->termios, &rs485); - if (!ret) + if (!ret) { port->rs485 = rs485; + + /* Reset RTS and other mctrl lines when disabling RS485 */ + if (!(rs485.flags & SER_RS485_ENABLED)) + port->ops->set_mctrl(port, port->mctrl); + } spin_unlock_irqrestore(&port->lock, flags); if (ret) return ret; @@ -2352,7 +2351,8 @@ int uart_suspend_port(struct uart_driver spin_lock_irq(&uport->lock); ops->stop_tx(uport); - ops->set_mctrl(uport, 0); + if (!(uport->rs485.flags & SER_RS485_ENABLED)) + ops->set_mctrl(uport, 0); /* save mctrl so it can be restored on resume */ mctrl = uport->mctrl; uport->mctrl = 0; @@ -2440,7 +2440,8 @@ int uart_resume_port(struct uart_driver uart_change_pm(state, UART_PM_STATE_ON); spin_lock_irq(&uport->lock); - ops->set_mctrl(uport, 0); + if (!(uport->rs485.flags & SER_RS485_ENABLED)) + ops->set_mctrl(uport, 0); spin_unlock_irq(&uport->lock); if (console_suspend_enabled || !uart_console(uport)) { /* Protected by port mutex for now */ @@ -2451,7 +2452,10 @@ int uart_resume_port(struct uart_driver if (tty) uart_change_speed(tty, state, NULL); spin_lock_irq(&uport->lock); - ops->set_mctrl(uport, uport->mctrl); + if (!(uport->rs485.flags & SER_RS485_ENABLED)) + ops->set_mctrl(uport, uport->mctrl); + else + uart_rs485_config(uport); ops->start_tx(uport); spin_unlock_irq(&uport->lock); tty_port_set_initialized(port, 1); @@ -2558,10 +2562,10 @@ uart_configure_port(struct uart_driver * */ spin_lock_irqsave(&port->lock, flags); port->mctrl &= TIOCM_DTR; - if (port->rs485.flags & SER_RS485_ENABLED && - !(port->rs485.flags & SER_RS485_RTS_AFTER_SEND)) - port->mctrl |= TIOCM_RTS; - port->ops->set_mctrl(port, port->mctrl); + if (!(port->rs485.flags & SER_RS485_ENABLED)) + port->ops->set_mctrl(port, port->mctrl); + else + uart_rs485_config(port); spin_unlock_irqrestore(&port->lock, flags); /* --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -950,5 +950,4 @@ static inline int uart_handle_break(stru !((cflag) & CLOCAL)) int uart_get_rs485_mode(struct uart_port *port); -int uart_rs485_config(struct uart_port *port); #endif /* LINUX_SERIAL_CORE_H */ From patchwork Wed Oct 19 08:23:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4550 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp204445wrs; Wed, 19 Oct 2022 01:46:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM47wehkbboWhQbPd3CnQOIiwJLCLXzg2XYvk+FF4rwfYg7qNSJY2J5YGs3lz5QYHcPgwvLR X-Received: by 2002:a17:902:ec89:b0:185:581a:12 with SMTP id x9-20020a170902ec8900b00185581a0012mr7465261plg.29.1666169156435; Wed, 19 Oct 2022 01:45:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169156; cv=none; d=google.com; s=arc-20160816; b=KFyuRcwfc+Z0cpAMpljjQUMYYIOGXUJy+0W4Yc1WMDfG4HnPhJYQea0FiCbkRLnT3s gOKhFvIQFG315OS8glB5R+GkWfUlO5yGPuqV9oM9SnyOJHG2Mn+iVr7xbhFFiJVeMctx 0BJk4PNRyH/JA542nZArw0TwF4cXGv9ylxkI8+Kj+P5GCJ5bvMLh/fPjfkZ4es47q08j d1SVuRD7m7rX9eaXgA4A58gduj6AHNUNps9J8K/LdexNgBciEQPK+kcfzsqCv1Qbw9tQ Pqqk0Lv46DFchBvkeFA+gdh3fXiaR5eAU1dXdY8HGNcjZoy2pK4rBBV9g+0EXiJC/Lwq sc5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+WJMoY21gHgtYe+UpW+LrNdAYID8eGsY7oos0RNv37w=; b=A6k2/CV6Z6h99JSwGXCvHjbqpMCg1L927vkdinJop0vMJ/aLMDcknQzHfhd2clYEgF o4lN6XYUNdRFE4LZD8gQ1xMrIoIuldxyquMO8OVbOcZKuNgxoaVv5Ps+MmTydTJAKgqN jhNuKPgvgnZ34fxLF/XgkI0Y79PHvpxNK8bUigng3zHTixvOXZHei7eNDwk4OEeSpVcR m7LunbDVMSwxloZ8ugp+v47YRz/HYM+Ffwx+G65H1Tf8Yq8UFl+TZj1WrM4V688KRpu5 wVFJwaYpLnGr00eRQpfK2ELWQQCdDGFX2TN1blkwakCZOZ3vrnwN+e/1gkxgc+bH7FDc NkIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="HbU/a/B9"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p6-20020a17090ab90600b001fd9be4fb6csi21579885pjr.39.2022.10.19.01.45.43; Wed, 19 Oct 2022 01:45: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="HbU/a/B9"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231421AbiJSIpV (ORCPT + 99 others); Wed, 19 Oct 2022 04:45:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231359AbiJSIoC (ORCPT ); Wed, 19 Oct 2022 04: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 1F7DF82626; Wed, 19 Oct 2022 01:41:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6F265617EF; Wed, 19 Oct 2022 08:41:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80708C433D6; Wed, 19 Oct 2022 08:41:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168904; bh=gp4XCDaj/ECkiOHH8Oy0tRGOZDp14WeL7Yte4jTXnp8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HbU/a/B9Sh8TRL5rbUpf7/yb3wSwEX496R/J6k1Wf0sS9opVr4fAJab8GjvlBvAxb E074FFMLfgghsZy4WpBcF2PhQHD0xQr/ifUdJzpp+faH8XYm1m4Oo3gR0W8t96Rz1s HMSBP2zv6ehn20aY+oq7Yz3PUcwh0Wkqu1dBhIRI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Golle , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Lukas Wunner Subject: [PATCH 6.0 093/862] serial: ar933x: Deassert Transmit Enable on ->rs485_config() Date: Wed, 19 Oct 2022 10:23:00 +0200 Message-Id: <20221019083254.057777674@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747104989429517059?= X-GMAIL-MSGID: =?utf-8?q?1747104989429517059?= From: Lukas Wunner commit 3a939433ddc1bab98be028903aaa286e5e7461d7 upstream. The ar933x_uart driver neglects to deassert Transmit Enable when ->rs485_config() is invoked. Fix it. Fixes: 9be1064fe524 ("serial: ar933x_uart: add RS485 support") Cc: stable@vger.kernel.org # v5.7+ Cc: Daniel Golle Reviewed-by: Ilpo Järvinen Signed-off-by: Lukas Wunner Link: https://lore.kernel.org/r/5b36af26e57553f084334666e7d24c7fd131a01e.1662887231.git.lukas@wunner.de Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/ar933x_uart.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/drivers/tty/serial/ar933x_uart.c +++ b/drivers/tty/serial/ar933x_uart.c @@ -583,6 +583,13 @@ static const struct uart_ops ar933x_uart static int ar933x_config_rs485(struct uart_port *port, struct ktermios *termios, struct serial_rs485 *rs485conf) { + struct ar933x_uart_port *up = + container_of(port, struct ar933x_uart_port, port); + + if (port->rs485.flags & SER_RS485_ENABLED) + gpiod_set_value(up->rts_gpiod, + !!(rs485conf->flags & SER_RS485_RTS_AFTER_SEND)); + return 0; } From patchwork Wed Oct 19 08:23: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: 5561 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp350162wrs; Wed, 19 Oct 2022 07:13:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Aqj2rPSiJtDGMVIT3UalM0jMMXwCRoPovZqXi/VD+6Tbf7Z4SRkls0syjfdCWSDpApp6r X-Received: by 2002:a17:90b:314c:b0:20d:83c1:5297 with SMTP id ip12-20020a17090b314c00b0020d83c15297mr9992770pjb.18.1666188789290; Wed, 19 Oct 2022 07:13:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666188789; cv=none; d=google.com; s=arc-20160816; b=WxSja7klHRY1yn8NrTD9nCBpiIz5hmUpY/b24kz1CjBPKq7EW0RdkP8IFD5fawBndv G3+WZma7I43jiFMusYagmSn6dWdYly6qeT5xyKrxV+rxaIsdns5nt05ckLeyUMvy995j qggapha91fyh1A2Uwa+43fLygQgrwCrjuufDoHAOcs9D0zY9TfYa/9/QxU/7MWuGUSTb hUuwNXv6gCDl+ci1ls2RbEMI4cjaK4lSZ5gQMKDyU2QULnqfjm5oiA47116cylMjNup/ +Fe60R/FJDdPXnI3L5irfmp+fNuZRo681KKqKZ71D2IzNd1TsJ0ukb1pGueDJvr4XITn zSrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=g38vqkK3Rz4sCuOUVjrRuj3/0ShZhjTbvRNAZIhFJIg=; b=0cW1UaUKQ7BjRQA84Dkg01gihwRb0HV6iesvYZuuZkMLaFiNWjgLCsaJl90WUX8sY1 AXdahXjBmhCToEk9FeOJrNR4nEVJab+j6FsCTaZsDfspwQGFriedxWXVxOE89VlEQZpP 4RAF0B3SIlCXc0vjNXk+Z4Zql1XfmWIBVZty6lZyiGyI81j4rymCAKjDmgh4/z3mZD0r 9CfldHri4Iu+mBo8NMYwFX8ueEyhuKofUG4Q5nLobsb+j3g/49CgJYvgj4fl+mAZ2sJl QHVDPse5qUarWD381pLwI/C6qRQ8BjthOwWRwPtSIX0bQC2YOBejtvGMXPUoRSca16qW V9KA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PrcnaS1I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l11-20020a170902f68b00b0017f7f68da4esi11730604plg.334.2022.10.19.07.12.43; Wed, 19 Oct 2022 07:13: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=PrcnaS1I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233718AbiJSNwc (ORCPT + 99 others); Wed, 19 Oct 2022 09:52:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231347AbiJSNv7 (ORCPT ); Wed, 19 Oct 2022 09:51:59 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6C95106930; Wed, 19 Oct 2022 06:35: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 3BE99CE20ED; Wed, 19 Oct 2022 08:41:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A13FC433D6; Wed, 19 Oct 2022 08:41:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168907; bh=KM5aJ8W23YxmKOBqyJnPA3XBpiJZ3LNYv8qiLaoe1eM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PrcnaS1ITy2q32Jr8ey9mH7zDRuZb3tU//5Za3LtbpUd+bn7U2DOvtuZLCFu/dUD+ 0+qJdTwOcb3w8co7N7N6koumnrob4X1lilTzBzQ8fgFhVnjWSj+Sl6f3sVt7/kCHfh 5eWyWwXCZ2T9m+s3JbdHMekomIUDyaM54ugR4Uy8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anders Blomdell , "Maciej W. Rozycki" Subject: [PATCH 6.0 094/862] serial: 8250: Let drivers request full 16550A feature probing Date: Wed, 19 Oct 2022 10:23:01 +0200 Message-Id: <20221019083254.093554124@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747125576317639744?= X-GMAIL-MSGID: =?utf-8?q?1747125576317639744?= From: Maciej W. Rozycki commit 9906890c89e4dbd900ed87ad3040080339a7f411 upstream. A SERIAL_8250_16550A_VARIANTS configuration option has been recently defined that lets one request the 8250 driver not to probe for 16550A device features so as to reduce the driver's device startup time in virtual machines. Some actual hardware devices require these features to have been fully determined however for their driver to work correctly, so define a flag to let drivers request full 16550A feature probing on a device-by-device basis if required regardless of the SERIAL_8250_16550A_VARIANTS option setting chosen. Fixes: dc56ecb81a0a ("serial: 8250: Support disabling mdelay-filled probes of 16550A variants") Cc: stable@vger.kernel.org # v5.6+ Reported-by: Anders Blomdell Signed-off-by: Maciej W. Rozycki Link: https://lore.kernel.org/r/alpine.DEB.2.21.2209202357520.41633@angie.orcam.me.uk Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/8250/8250_port.c | 3 ++- include/linux/serial_core.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -1023,7 +1023,8 @@ static void autoconfig_16550a(struct uar up->port.type = PORT_16550A; up->capabilities |= UART_CAP_FIFO; - if (!IS_ENABLED(CONFIG_SERIAL_8250_16550A_VARIANTS)) + if (!IS_ENABLED(CONFIG_SERIAL_8250_16550A_VARIANTS) && + !(up->port.flags & UPF_FULL_PROBE)) return; /* --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -422,7 +422,7 @@ struct uart_icount { __u32 buf_overrun; }; -typedef unsigned int __bitwise upf_t; +typedef u64 __bitwise upf_t; typedef unsigned int __bitwise upstat_t; struct uart_port { @@ -530,6 +530,7 @@ struct uart_port { #define UPF_FIXED_PORT ((__force upf_t) (1 << 29)) #define UPF_DEAD ((__force upf_t) (1 << 30)) #define UPF_IOREMAP ((__force upf_t) (1 << 31)) +#define UPF_FULL_PROBE ((__force upf_t) (1ULL << 32)) #define __UPF_CHANGE_MASK 0x17fff #define UPF_CHANGE_MASK ((__force upf_t) __UPF_CHANGE_MASK) From patchwork Wed Oct 19 08:23: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: 4572 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp205069wrs; Wed, 19 Oct 2022 01:48:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM62aorLOJbL8MdfqRk9mph6zts5OX4wsYPNICzzzujGxoRG7etRJed/YVpk/ws2pyheX/oP X-Received: by 2002:a17:902:d2cc:b0:182:d901:5d28 with SMTP id n12-20020a170902d2cc00b00182d9015d28mr7615615plc.142.1666169299565; Wed, 19 Oct 2022 01:48:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169299; cv=none; d=google.com; s=arc-20160816; b=pWIivqsKG4AXCOoAv0ALtovfKTjV7hgFl9QAwMaPtbbbiDJ+s0Ty6QYw1nJEdC2VH4 t8fT2bHvjHv0ER34dAQ70TLe/3W339zTD/WzwitZBVY9P9q+6wDfnYv9fZwOjDx34a0i KNXYnSn+ppVpu2o9YbEhifyqZT4X5VmP2dEpsUtqK3vXjO43dqbCHnSw4c3vMOABtM1g Zmk9Mnmb7UkBAecsRzHNt5mtH4E/unPXcIMA1TR5CG14zoKpjinBxxRCw6/i9NYPSriX RUdc2oGzz/JTdikq/3zJBr7axgr3bN3+s3Ux7JBtGCwwE9I/u0w29NrxFUkw3w9HMVPP 788Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=35nkcKqg/djFkP+ku/hANpLWIdFwCEvViUVnXhUKETQ=; b=vEwd1oYHjn7tDH3KvSJeFbRgpLA5GFG1adImG47Ls0LzoMT+QgVvsgq84j9fhLPrnp Nlboigb5nA9J+XO7TQmaniateb1jbBl8Ryo1c4Aciku7Gj6EFXbuEn8PDw24FpPXcq8D /ZbqQt1ymE0ffe3xmQkO9ag7vnlQYbyU4l6pZLcXWT26BbEY8NRlDPQTw3D/eOCsJ83I eArzP+aCRAemeH+huOelUQ4OoPAxopJzxTcFtVI3eD/tdcuof38xR96fxekGW2271aYc qccASFFqCzviJbzMLBag4ck/ETDfRgBiiV+qvCu4vJWEOxzlf2RThIHaAkjbx4xwYJ7P O3YA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FvGJBOb5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j63-20020a638b42000000b00429b4bd247asi17451282pge.397.2022.10.19.01.48.06; Wed, 19 Oct 2022 01:48: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=FvGJBOb5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231515AbiJSIrj (ORCPT + 99 others); Wed, 19 Oct 2022 04:47:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231503AbiJSIrO (ORCPT ); Wed, 19 Oct 2022 04:47: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 6E6E05F10C; Wed, 19 Oct 2022 01:44: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 15500617E2; Wed, 19 Oct 2022 08:41:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1CF7BC433D7; Wed, 19 Oct 2022 08:41:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168910; bh=4utioZOXlyo9oAiwlzw67riLL6LaXsoNJjJMJzcvKEs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FvGJBOb5Q4quKApFD4NsAiVMPvAjOGW+j/4f5XznF8hJoXZvJxl5iyzrbsmSYYBUU muWjDKMgbz781ssWk4zAZhh9W/lY3V7Q/uPqviQsRg5ucXs6fGg08g5mSKvL5qGZ8/ rwcC/iC2PYO6wDtw1Ks78zjIm1a1OTlZ6+jKomxs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anders Blomdell , "Maciej W. Rozycki" Subject: [PATCH 6.0 095/862] serial: 8250: Request full 16550A feature probing for OxSemi PCIe devices Date: Wed, 19 Oct 2022 10:23:02 +0200 Message-Id: <20221019083254.144209988@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105139786059805?= X-GMAIL-MSGID: =?utf-8?q?1747105139786059805?= From: Maciej W. Rozycki commit 00b7a4d4ee42be1c515e56cb1e8ba0f25e271d8e upstream. Oxford Semiconductor PCIe (Tornado) 950 serial port devices need to operate in the enhanced mode via the EFR register for the Divide-by-M N/8 baud rate generator prescaler to be used in their native UART mode. Otherwise the prescaler is fixed at 1 causing grossly incorrect baud rates to be programmed. Accessing the EFR register requires 16550A features to have been probed for, so request this to happen regardless of SERIAL_8250_16550A_VARIANTS by setting UPF_FULL_PROBE in port flags. Fixes: 366f6c955d4d ("serial: 8250: Add proper clock handling for OxSemi PCIe devices") Cc: stable@vger.kernel.org # v5.19+ Reported-by: Anders Blomdell Signed-off-by: Maciej W. Rozycki Link: https://lore.kernel.org/r/alpine.DEB.2.21.2209210005040.41633@angie.orcam.me.uk Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/8250/8250_pci.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/drivers/tty/serial/8250/8250_pci.c +++ b/drivers/tty/serial/8250/8250_pci.c @@ -1232,6 +1232,10 @@ static void pci_oxsemi_tornado_set_mctrl serial8250_do_set_mctrl(port, mctrl); } +/* + * We require EFR features for clock programming, so set UPF_FULL_PROBE + * for full probing regardless of CONFIG_SERIAL_8250_16550A_VARIANTS setting. + */ static int pci_oxsemi_tornado_setup(struct serial_private *priv, const struct pciserial_board *board, struct uart_8250_port *up, int idx) @@ -1239,6 +1243,7 @@ static int pci_oxsemi_tornado_setup(stru struct pci_dev *dev = priv->dev; if (pci_oxsemi_tornado_p(dev)) { + up->port.flags |= UPF_FULL_PROBE; up->port.get_divisor = pci_oxsemi_tornado_get_divisor; up->port.set_divisor = pci_oxsemi_tornado_set_divisor; up->port.set_mctrl = pci_oxsemi_tornado_set_mctrl; From patchwork Wed Oct 19 08:23: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: 4552 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp204485wrs; Wed, 19 Oct 2022 01:46:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6DEhjCKmQgyH6w+3uLotYCtsK4WsQa8vI+pvPqpZBgNKLaywlpQgCifKMHkcuwRI0RZ77d X-Received: by 2002:a17:90b:1b4f:b0:20d:6ddd:9ef6 with SMTP id nv15-20020a17090b1b4f00b0020d6ddd9ef6mr8493741pjb.200.1666169175264; Wed, 19 Oct 2022 01:46:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169175; cv=none; d=google.com; s=arc-20160816; b=r79rLjIZoyHOJLxQEYaGaMaIkRScx4afxCBQFqcvHXxd0Oc2gDKPpLa+pFNX5EYxIX oAai+S/RErnlhxz76A113ktROWepPIh14Z5S3aXESV41xO4+UvlUisOxVwntVjjB0YOz yvBL3yoBZncqYz34RIO5cI6VZfJREKRbApmByrlcVejsGuySd7/XYF2MaZk8GkmsY3G6 MaK9o4ohkql92I81FeeFKeX19AQCluKqGULxTSaOTDHnhYRSuFqa/nft5XkSMFlr+k5e 1LSiK0juPo8ura+loniyIZcl4hRG1ZZ+r5bugoey8CvCTMj7Ml5VwMnIrgEPEJmTUjWK I9tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PEIrDojAwxTfeN7i7xWFl2K+at3eToOyC4NJGEI2D0c=; b=Gz1uURA5SgHXhhV68g7qajfobzDD0/BRNDfp3S14VTsQoxJiUxqWW3erBFPMuqb+zs gU/qRrAd5DDebVwnofOw7hWM7YERjwCLE1LUqiP/Mvxai+78cFQLTbZvKtbOw9jwJk5T 4R7eL26Hx0UnqxwTKa1aE6m374Pkp+e0fUtRkWUJuyASPA6/v1MLe4x0rvF97qHMDt3J 3YmhF67o9Thbh0/kpcyofc3C5kvZbZCYKFQdpHyFTGiNgBmKc0WZyo3muq2A3JCMic+7 N/YXTNErjZewCAgJYBllMHF0MJ/HGoIhf2Kff8KQSWgkGB7pcp7I2S3pYrTPYHePfU// CrLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YW5rqpOf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k9-20020aa788c9000000b00565977791a3si19242756pff.202.2022.10.19.01.45.59; Wed, 19 Oct 2022 01:46: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=YW5rqpOf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231301AbiJSIpo (ORCPT + 99 others); Wed, 19 Oct 2022 04:45:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231389AbiJSIoF (ORCPT ); Wed, 19 Oct 2022 04:44:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FDA080F58; Wed, 19 Oct 2022 01:41:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E354F617F0; Wed, 19 Oct 2022 08:41:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01394C433D7; Wed, 19 Oct 2022 08:41:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168913; bh=h3+uSWwiOmr3NWvZgRpyVR7rxSNYaUIg45Onin/ZWNM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YW5rqpOfH9eEvo3jMpr76Hz9bpFP1aVSIHaubI2uPNYg6WjtQ/UbHevT9AZtzJvXp 70aGSJZmM/0OFOqeI/hzeZmUn82l4AqmVHLOQA4HUOdDttVz5FM2k/kYdHbmpPuevm M4o29nhV64YRLZU7u1o7yhaCgFbFzILy3rVypOnU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ben Ronallo , Chuck Lever , Jeff Layton Subject: [PATCH 6.0 096/862] NFSD: Protect against send buffer overflow in NFSv3 READDIR Date: Wed, 19 Oct 2022 10:23:03 +0200 Message-Id: <20221019083254.182334043@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105008921369740?= X-GMAIL-MSGID: =?utf-8?q?1747105008921369740?= From: Chuck Lever commit 640f87c190e0d1b2a0fcb2ecf6d2cd53b1c41991 upstream. Since before the git era, NFSD has conserved the number of pages held by each nfsd thread by combining the RPC receive and send buffers into a single array of pages. This works because there are no cases where an operation needs a large RPC Call message and a large RPC Reply message at the same time. Once an RPC Call has been received, svc_process() updates svc_rqst::rq_res to describe the part of rq_pages that can be used for constructing the Reply. This means that the send buffer (rq_res) shrinks when the received RPC record containing the RPC Call is large. A client can force this shrinkage on TCP by sending a correctly- formed RPC Call header contained in an RPC record that is excessively large. The full maximum payload size cannot be constructed in that case. Thanks to Aleksi Illikainen and Kari Hulkko for uncovering this issue. Reported-by: Ben Ronallo Cc: Signed-off-by: Chuck Lever Reviewed-by: Jeff Layton Signed-off-by: Chuck Lever Signed-off-by: Greg Kroah-Hartman --- fs/nfsd/nfs3proc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) --- a/fs/nfsd/nfs3proc.c +++ b/fs/nfsd/nfs3proc.c @@ -563,13 +563,14 @@ static void nfsd3_init_dirlist_pages(str { struct xdr_buf *buf = &resp->dirlist; struct xdr_stream *xdr = &resp->xdr; - - count = clamp(count, (u32)(XDR_UNIT * 2), svc_max_payload(rqstp)); + unsigned int sendbuf = min_t(unsigned int, rqstp->rq_res.buflen, + svc_max_payload(rqstp)); memset(buf, 0, sizeof(*buf)); /* Reserve room for the NULL ptr & eof flag (-2 words) */ - buf->buflen = count - XDR_UNIT * 2; + buf->buflen = clamp(count, (u32)(XDR_UNIT * 2), sendbuf); + buf->buflen -= XDR_UNIT * 2; buf->pages = rqstp->rq_next_page; rqstp->rq_next_page += (buf->buflen + PAGE_SIZE - 1) >> PAGE_SHIFT; From patchwork Wed Oct 19 08:23: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: 5219 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp265268wrs; Wed, 19 Oct 2022 04:22:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4X7LFVBMk82BI4IM4RZlY0gQW+L93ISFW40sdyS3fnh2WDDCvONto0mSeohAjh2TuimWRw X-Received: by 2002:a05:6a00:1c99:b0:562:6292:9e4e with SMTP id y25-20020a056a001c9900b0056262929e4emr8237270pfw.22.1666178520971; Wed, 19 Oct 2022 04:22:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178520; cv=none; d=google.com; s=arc-20160816; b=ydUzlPx9MLb73fWgH6wFlzPBIBSNWrOzuWhiEa4kTyAOVAWxNkNa9jYWveit0cCvL8 Psm5f7kalvrc48hTauyg3auy3+GxfTsZPz/Hii5rH7WIpvon7RGZu+68LM6fL7+VatP5 PQAJKKIkZkhG/FaTPeVNegvK5Vzc5GKIiKDH8srL4QffnKT42lCMmT4nNRnv5hEmFQ0p eBBvQMuR5I9K9kbszk+V5PZWu/qeW8XIzqFfcVFV3VIB0fbmdxMqhcSXP+2Uwhy5beuD u+NJim0/lx+8fZlQWktWxsZQMTQWbVX0y35HBUKfMtB6mTh7/bMojhkL003DvD7g1aAg EP1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=mqWq54k46wPizfmcGtuziCCPlOuS8vQO6RBAw/89XXM=; b=tMJby+AAVrlqw9HygiZW7s3kDlifTHRZleKwS/nhuBtukF6PJ53eUOzmYKI9N9MkKa /IlfI9BkpS2TKgpirrUEWzBJ1iabf+oDsGxq2XLWahEvodQPBL94pVFpC6zpplXZSnnO o6nny0PxAgxhJw7Y2tQ/L5F97go53YpOKKNw5bjqop7uQB8E+7GlYwXVe4Wm8l/oouHg FBI6rTkzZUEr1cpx4/6RxnGwd0eNh1XELU5m/b+/h1LMFeL5X8y6mLFBQDzyScLZjVi8 oQ9pSI3p90RXr+L8d7Mc9rPQkO9Rvx3i9jMMWp42nzE1BfrIsDQ8KnEzErxL3cRhagYU xesQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=L2tVfxXx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lr1-20020a17090b4b8100b002034e5450f0si26925324pjb.131.2022.10.19.04.21.45; Wed, 19 Oct 2022 04:22: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=L2tVfxXx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231997AbiJSLL5 (ORCPT + 99 others); Wed, 19 Oct 2022 07:11:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231702AbiJSLKy (ORCPT ); Wed, 19 Oct 2022 07:10:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16643108DC1; Wed, 19 Oct 2022 03:38: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 685DCB822DA; Wed, 19 Oct 2022 08:41:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D753CC433D6; Wed, 19 Oct 2022 08:41:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168916; bh=3kmaUKiFlPfcYVCduoERC7tchXK2w82pKHJ6gYQ0xiE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L2tVfxXxC3MY2oYxHVsJg4p4Wq4vjHJT4giN7J1BNfoRxwLIKdTClVppdSaIWny0F aI6rq4SxbWycJzcLzsQITvt1uHxD4ACE6C3m2/wU41uo9kBXTFhxlO6svxhWAHjPUY mdelNiGzEqizdVEdLDcFqRVKifJ2uDTsnX1KGeSA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chuck Lever , Jeff Layton Subject: [PATCH 6.0 097/862] NFSD: Protect against send buffer overflow in NFSv2 READ Date: Wed, 19 Oct 2022 10:23:04 +0200 Message-Id: <20221019083254.216282279@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114808726504096?= X-GMAIL-MSGID: =?utf-8?q?1747114808726504096?= From: Chuck Lever commit 401bc1f90874280a80b93f23be33a0e7e2d1f912 upstream. Since before the git era, NFSD has conserved the number of pages held by each nfsd thread by combining the RPC receive and send buffers into a single array of pages. This works because there are no cases where an operation needs a large RPC Call message and a large RPC Reply at the same time. Once an RPC Call has been received, svc_process() updates svc_rqst::rq_res to describe the part of rq_pages that can be used for constructing the Reply. This means that the send buffer (rq_res) shrinks when the received RPC record containing the RPC Call is large. A client can force this shrinkage on TCP by sending a correctly- formed RPC Call header contained in an RPC record that is excessively large. The full maximum payload size cannot be constructed in that case. Cc: Signed-off-by: Chuck Lever Reviewed-by: Jeff Layton Signed-off-by: Chuck Lever Signed-off-by: Greg Kroah-Hartman --- fs/nfsd/nfsproc.c | 1 + 1 file changed, 1 insertion(+) --- a/fs/nfsd/nfsproc.c +++ b/fs/nfsd/nfsproc.c @@ -185,6 +185,7 @@ nfsd_proc_read(struct svc_rqst *rqstp) argp->count, argp->offset); argp->count = min_t(u32, argp->count, NFSSVC_MAXBLKSIZE_V2); + argp->count = min_t(u32, argp->count, rqstp->rq_res.buflen); v = 0; len = argp->count; From patchwork Wed Oct 19 08:23: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: 5226 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp265929wrs; Wed, 19 Oct 2022 04:23:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM75dRREYiaQMXWoMMZjYwfhSq6dpVYcDu1+OG6o5hwDuTRJPdI9q6JhujfY4MXhj8QZW/Gh X-Received: by 2002:a17:90b:78e:b0:205:c9ae:21f9 with SMTP id l14-20020a17090b078e00b00205c9ae21f9mr9329175pjz.112.1666178610043; Wed, 19 Oct 2022 04:23:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178610; cv=none; d=google.com; s=arc-20160816; b=J3zfk/gc+srbsjyC/294GsgOMv75xFZZU8CYVpiW8yI1td6ONXyN4SUZpytS+exdZb SIK9w7JjZqclUcVX+v4zmnKR6FFpBL8Pga6Nfhz+SUl+rXBe0oKrl4cvf061FzZ7uFRh IiCaea4CqWcpcvmlbrL9aAOxhlgej8kRIU55ipQ/BOd+R2NBKsPgtJhRhdKX2gsPmCgz WoAGR+cHSBQE45jI6d1Use45ZfItzwoURMET+jnlVucmfiTgFVkl6/k7s0HjdB7iIg/K akK+XmTl4FNe0s3yRFC8Q+w3omabkI2EjQ7cEphc/x4Gs6ZhfFUA24MsmB1722Arc/hJ jIkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jK+dQAgJtjnkuhHU5PsG4dq/cbNUp6IrYyxd5ybFMKg=; b=rrNslOzCkj5ypfq0JsLnPI4TVof0bEjW+2gnpr+uhuMU/W8BNSoFEnUukrHT77Exrr qF9ZNDZlVWBT1XF6/Iy5mKaSEVhLo07szHDmc0uC1/aSqOaqmPGjyWGw1JG/EMtg2AA0 Qj3NvuJ9cQYg5JdZdc3KZzZTgshDmmXGYyYIZS15M/cUgKxE81kPZeYcOulnkSln7suv ZuueVljXI/R76tIbeX+NvtyoiNJnWabZAxUwKiKUf/CwkHzdQhog05EVxd8MTA+VFlH5 uKYNhRzeQvqzDDzZExY4h9uIx1gP74tJRX4L5RXK6to7jIZe8wca7VfpRaCZ/LnLIGVd ucVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=c9AgSY9g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y23-20020a17090aa41700b0020ae29877besi15951094pjp.20.2022.10.19.04.23.13; Wed, 19 Oct 2022 04:23: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=c9AgSY9g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229648AbiJSLMR (ORCPT + 99 others); Wed, 19 Oct 2022 07:12:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232869AbiJSLLR (ORCPT ); Wed, 19 Oct 2022 07:11: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 CE90C15383F; Wed, 19 Oct 2022 03:38: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 C519DB822E0; Wed, 19 Oct 2022 08:42:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C2E3C433D6; Wed, 19 Oct 2022 08:42:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168923; bh=3fmz19ziBoeqOLteTXpvy4wRMaFIWZi67aTh2vCakBE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c9AgSY9gAKiqr3BN6qRQyfK9KKonGIJxeyqcI0WdURpBK1fbUnuVB06TlC/lGiQ9m 9E4syEfPHGNycXF/4VAzIELsfdOMwVhsZXIVY0NLGWdM/hSvQPrw+7BXzRkjAp44cI IXZIyBwNiupiDDe+ubIAWFuBZFoRO64HoVmHTq6g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chuck Lever , Jeff Layton Subject: [PATCH 6.0 098/862] NFSD: Protect against send buffer overflow in NFSv3 READ Date: Wed, 19 Oct 2022 10:23:05 +0200 Message-Id: <20221019083254.250027544@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114901975983740?= X-GMAIL-MSGID: =?utf-8?q?1747114901975983740?= From: Chuck Lever commit fa6be9cc6e80ec79892ddf08a8c10cabab9baf38 upstream. Since before the git era, NFSD has conserved the number of pages held by each nfsd thread by combining the RPC receive and send buffers into a single array of pages. This works because there are no cases where an operation needs a large RPC Call message and a large RPC Reply at the same time. Once an RPC Call has been received, svc_process() updates svc_rqst::rq_res to describe the part of rq_pages that can be used for constructing the Reply. This means that the send buffer (rq_res) shrinks when the received RPC record containing the RPC Call is large. A client can force this shrinkage on TCP by sending a correctly- formed RPC Call header contained in an RPC record that is excessively large. The full maximum payload size cannot be constructed in that case. Cc: Signed-off-by: Chuck Lever Reviewed-by: Jeff Layton Signed-off-by: Chuck Lever Signed-off-by: Greg Kroah-Hartman --- fs/nfsd/nfs3proc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/fs/nfsd/nfs3proc.c +++ b/fs/nfsd/nfs3proc.c @@ -150,7 +150,6 @@ nfsd3_proc_read(struct svc_rqst *rqstp) { struct nfsd3_readargs *argp = rqstp->rq_argp; struct nfsd3_readres *resp = rqstp->rq_resp; - u32 max_blocksize = svc_max_payload(rqstp); unsigned int len; int v; @@ -159,7 +158,8 @@ nfsd3_proc_read(struct svc_rqst *rqstp) (unsigned long) argp->count, (unsigned long long) argp->offset); - argp->count = min_t(u32, argp->count, max_blocksize); + argp->count = min_t(u32, argp->count, svc_max_payload(rqstp)); + argp->count = min_t(u32, argp->count, rqstp->rq_res.buflen); if (argp->offset > (u64)OFFSET_MAX) argp->offset = (u64)OFFSET_MAX; if (argp->offset + argp->count > (u64)OFFSET_MAX) From patchwork Wed Oct 19 08:23: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: 4571 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp205009wrs; Wed, 19 Oct 2022 01:48:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM73d+iMhtl/ZXisWBieBu7Brx5MOdyzfcgUx1f/S/NiZm9Or0tIGN45S4+oUc4ydHHjaL89 X-Received: by 2002:a17:90b:1f86:b0:205:d3d0:1931 with SMTP id so6-20020a17090b1f8600b00205d3d01931mr8570242pjb.211.1666169288056; Wed, 19 Oct 2022 01:48:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169288; cv=none; d=google.com; s=arc-20160816; b=PAmt2Vgya6usvto3wYaJXu22U3Zwk4nVLkQg+ol57eazOTqVZdTH4u44r/OGjMbEDS /jtMMgU8e9ZOt/30HeKoxX3D5TZ+GwX/KZLG59XX52aHVFZjk1ALKHMvrYxH7uIyFkkB Ai6FjFyeWx7bZz4RWRs3hg3mFR8KX6PC+Qzvwjfht0sev4QAFfcCqymBfkl67qQ05T2t QpxNZViHZZ8L68rUoSHXBKRtXlIGg2Q6uleo9bNHZJTY8yx/c/8DoAPKofTHyr2/PRYP YJqqyO7fF1FO0+wUwX8IHGHAYVgs4FuAai51OuScuzb4xJOx0Igi7p7VX/3Y2XZTYmNZ HJTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OZGnzfHsDALCPUTT/zT8M1F4hurlkfVYtnSLk6ncnGI=; b=gxCYJHsG1ztz7DBd9TO0vEpE0I8vaIimo1j7KByXltnNOlMD1l0ET48EoWdm0LQGzz V9lmSgYkThSDIt8RT25dE40VIkNWHm53m+K4Q2D/H3RBGVtN8RcErur3Zsn9+yvGEomA Ip1P58X0+SuDINQ3Um8WbhFP3VJB6mCXdiw5UtDpRapctyMIKvbzpUGMzlmfT6MxacwW ZiTWluJSIjGkDNzTMqkiFTViXJL1pnacT5tJ/gpnea9unkWVUAXlH3jwLgA4lox4IQbz LrsKbN392mrkVIlZiKBjbUCeDBSnvr55lhq8de+d/8sHaI6z/Qc/OXBJ79NcvMrYuCTM B6HQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aiZEOP6l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h132-20020a636c8a000000b0045ceb2c2eb7si14801035pgc.760.2022.10.19.01.47.55; Wed, 19 Oct 2022 01:48: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=aiZEOP6l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229920AbiJSIrV (ORCPT + 99 others); Wed, 19 Oct 2022 04:47:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231165AbiJSIqk (ORCPT ); Wed, 19 Oct 2022 04:46: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 A2DEC22288; Wed, 19 Oct 2022 01: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 dfw.source.kernel.org (Postfix) with ESMTPS id 83225617FF; Wed, 19 Oct 2022 08:42:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93C3CC433D6; Wed, 19 Oct 2022 08:42:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168926; bh=VlsoAZyMNoWaMW908pM9s6G3OfDrD2WYDrbzgNPWB8U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aiZEOP6lyouuZp3Iei/Y8cwMnmlpFKN5Xf7OEyIm1zfz7FeB6nMAAvJ83qC3vjnl/ aKkgxsfmI8og6G8jpdvdM26g7e+ebT5VkLyHuloBSJn3h6glyEy/GnlS932dsQqqMe 85SMvueYiRDYUS0DmaE6j+UKZKdU5kTIiEDURvYI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Dan Carpenter , Neil Armstrong , Viresh Kumar Subject: [PATCH 6.0 099/862] cpufreq: qcom-cpufreq-hw: Fix uninitialized throttled_freq warning Date: Wed, 19 Oct 2022 10:23:06 +0200 Message-Id: <20221019083254.293177390@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105127448704612?= X-GMAIL-MSGID: =?utf-8?q?1747105127448704612?= From: Viresh Kumar commit 91dc90fdb8b8199519a3aac9c46a433b02223c5b upstream. Commit 6240aaad75e1 was supposed to drop the reference count to the OPP, instead it avoided more stuff if the OPP isn't found. This isn't entirely correct. We already have a frequency value available, we just couldn't align it with an OPP in case of IS_ERR(opp). Lets continue with updating thermal pressure, etc, even if we aren't able to find an OPP here. This fixes warning generated by the 'smatch' tool. Fixes: 6240aaad75e1 ("cpufreq: qcom-hw: fix the opp entries refcounting") Cc: v5.18+ # v5.18+ Reported-by: kernel test robot Reported-by: Dan Carpenter Reviewed-by: Neil Armstrong Signed-off-by: Viresh Kumar Signed-off-by: Greg Kroah-Hartman --- drivers/cpufreq/qcom-cpufreq-hw.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) --- a/drivers/cpufreq/qcom-cpufreq-hw.c +++ b/drivers/cpufreq/qcom-cpufreq-hw.c @@ -316,14 +316,14 @@ static void qcom_lmh_dcvs_notify(struct if (IS_ERR(opp)) { dev_warn(dev, "Can't find the OPP for throttling: %pe!\n", opp); } else { - throttled_freq = freq_hz / HZ_PER_KHZ; - - /* Update thermal pressure (the boost frequencies are accepted) */ - arch_update_thermal_pressure(policy->related_cpus, throttled_freq); - dev_pm_opp_put(opp); } + throttled_freq = freq_hz / HZ_PER_KHZ; + + /* Update thermal pressure (the boost frequencies are accepted) */ + arch_update_thermal_pressure(policy->related_cpus, throttled_freq); + /* * In the unlikely case policy is unregistered do not enable * polling or h/w interrupt From patchwork Wed Oct 19 08:23: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: 4580 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp205818wrs; Wed, 19 Oct 2022 01:50:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4oKIt6bFp5lyyrUXMusndzqKcBf4sGEnLCqxyzaqyKoSFvzVcgkb1lXP8hWj4yb12YGIXp X-Received: by 2002:a05:6a00:705:b0:562:b9e1:d0e8 with SMTP id 5-20020a056a00070500b00562b9e1d0e8mr7649786pfl.0.1666169443737; Wed, 19 Oct 2022 01:50:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169443; cv=none; d=google.com; s=arc-20160816; b=PREMfZheeQWTfo1Zr3aOBym2ve/js66VjTvrHtJlntZMqBU+DkMqMpWrctT4q1CMRM xLuwvHAwisVXf/+N5Qa54gmWHSN+tDc1VLp+4Oa8DteWNqhUqpV1+y7HraLjyYVAi5Wx sgCLmAhbr+iRBSIVJR+AB7ugG6EEm4kZsU5ch2oxFfm5Q3Ub9fFr9O/35ZMGp5pSA35h +iyujN9rO1IHzPwlJAcghmX26umxBMP7wzCCpiHaZbLXkMZaqyYMmv6BU+sdujvBIYnC /+MpFqLFTA/ObccPMxXdejg7LkI2cQff+SAKMW80544sf5sP5ATBNMhS3k5kz4xyIeag JEPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=EuDUQlE6ZVmuNyYupMJyJkZrmtusfCOd3BcjAC9SHv8=; b=qeMD46urF7wtLg2E7fRXdCBy2kMHH7MJe7gHVhNFoQpmkPD8a+ZgpRaiRaW06GdGTG /M0TsAASHRzyeZ/oqrD0TW8AGfYBgImHnp1e5qkTbgeLQNdh3aV+im8cCgq1eCUnK+3T Wxae+ttqhCeP+wPtlyMltjM2Ozq1sSPJ2egQjEOsBecTtySwStUXrVf1oSYLSu6VSvRk LoOTTRu4maNLN2nsxMZ5eeU2vt/vXFsNZQq0e3AESxxrFoDctz9grIhkVC76n+uYF+Wk R6qa2+ZDyD6d7TLU0o+UTh8NIiDzPuqM0UDMMOqsCqyNJKeWKnePagdFk1yv12qNU7ax 1xuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UvAAavH7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p9-20020a056a000b4900b00562617987a1si17217731pfo.264.2022.10.19.01.50.30; Wed, 19 Oct 2022 01:50: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=UvAAavH7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231600AbiJSIss (ORCPT + 99 others); Wed, 19 Oct 2022 04:48:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231534AbiJSIsG (ORCPT ); Wed, 19 Oct 2022 04:48:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F070A14003; Wed, 19 Oct 2022 01:46: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 107FEB822DE; Wed, 19 Oct 2022 08:42:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5EBB5C433C1; Wed, 19 Oct 2022 08:42:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168929; bh=qab0Rnt+T/tqzgVYqDfBj7DaAjjs/8A7KfmD14WqWuM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UvAAavH7mSafJB4pIj6FAcuAh7BHWaLSoJ1Ux3uSMpI/zRkyRwRPLrADTUz7ERZsb m17vWpthamZkcQZ3MISS6GBOIMzM0xABIom9uT3aM64oqwhE3lbcJkX5WD2OV9MyIN xR0Om9/w9gJtt2j6iEpbVM40gUGtWB/D8cac3ecw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jae Hoon Kim , Matthias Kaehlcke , Kees Cook Subject: [PATCH 6.0 100/862] LoadPin: Fix Kconfig doc about format of file with verity digests Date: Wed, 19 Oct 2022 10:23:07 +0200 Message-Id: <20221019083254.328176929@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105290393314234?= X-GMAIL-MSGID: =?utf-8?q?1747105290393314234?= From: Matthias Kaehlcke commit aafc203bbad4bf6cf394a34ea698c2b0b8affae0 upstream. The doc for CONFIG_SECURITY_LOADPIN_VERITY says that the file with verity digests must contain a comma separated list of digests. That was the case at some stage of the development, but was changed during the review process to one digest per line. Update the Kconfig doc accordingly. Reported-by: Jae Hoon Kim Signed-off-by: Matthias Kaehlcke Fixes: 3f805f8cc23b ("LoadPin: Enable loading from trusted dm-verity devices") Cc: stable@vger.kernel.org Signed-off-by: Kees Cook Link: https://lore.kernel.org/r/20220829174557.1.I5d202d1344212a3800d9828f936df6511eb2d0d1@changeid Signed-off-by: Greg Kroah-Hartman --- security/loadpin/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/security/loadpin/Kconfig +++ b/security/loadpin/Kconfig @@ -33,4 +33,4 @@ config SECURITY_LOADPIN_VERITY on the LoadPin securityfs entry 'dm-verity'. The ioctl expects a file descriptor of a file with verity digests as parameter. The file must be located on the pinned root and - contain a comma separated list of digests. + contain one digest per line. From patchwork Wed Oct 19 08:23: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: 5198 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp264473wrs; Wed, 19 Oct 2022 04:20:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Kk+IfNL8aSiLBzJFP8cGgBjarXtC5tC2BGYy/rK+8Yf3jVaeY4IP602iIEpwkliTESb0s X-Received: by 2002:a17:906:5daa:b0:791:8933:f9f0 with SMTP id n10-20020a1709065daa00b007918933f9f0mr6265709ejv.335.1666178406554; Wed, 19 Oct 2022 04:20:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178406; cv=none; d=google.com; s=arc-20160816; b=OsRpO+EjIYAhAweUV3wlDP0+NFPcs3m2vN3rHY+gZ7yDJOp3PBJqqNLoExaOcxCGLC 1pVaj3YvWnPdNg0naQSf/JEWFgjc4hkX7LrU6LLn2N3fVRKZtrervEGcvBSO4asViK5v 8PpX+1j+UozGNDuAvhZEYWSskPk9ljXsHVA1pU/UNxyNbdJYKfrRhuRsHM6IxfV9u/9A LC7I+hS91t7ED2nNRmRUz3pIcoh6ojQiMFY77xrR3tD+5QwtOCounTPHt6mEN1tbrkEQ aF6JxKxu7cLNPXzMTX54SPfeiq5g5G3uHhJQQ1dZnhoD2p5pEVxDxotIFwYxpQJ4Nq7h YgbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pbR5Iq2QNzQXZ3bhiHLKQ7yyMXCbZ850s6WlML3zi+A=; b=OfgyzlQSkaVmP4HZ5nkib5r7hvH7TrLxdcovrVYebsZddTMKjdsuX9Hb+6Nw5liaf/ GyrYyKmoD3Py7HrxeQDEb0xzTgjOLKoEywqsD/jYrs9n5o6fV4YzdhCo/41i1RCleoOI EKMMBCqFm3CKVHiOPFsB3b8vC3ZEI6QKF9Nir/tqTpHUFYbhcsvOh+LcF+IaEov6cQt3 1CGsHzNU2ylYcCRe6OI3nNPaZyeSgmCqVvfz/h/GD99Fs05BR5zpt6xXpUrvW7CJe+zV GCXOCoWQucQSjWQm7Z7e7l0wDP8ZOAJ9n4jevZ/dXCHV76kMkhaxhw7fEqrQog03xt83 GHzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DQZmfMwV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hq13-20020a1709073f0d00b0073317d6b047si8016892ejc.569.2022.10.19.04.19.41; Wed, 19 Oct 2022 04:20: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=DQZmfMwV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233719AbiJSLI6 (ORCPT + 99 others); Wed, 19 Oct 2022 07:08:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232549AbiJSLI2 (ORCPT ); Wed, 19 Oct 2022 07:08:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA35F17C55E; Wed, 19 Oct 2022 03:37:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BFD5FB822DD; Wed, 19 Oct 2022 08:42:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36825C433B5; Wed, 19 Oct 2022 08:42:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168932; bh=60PZ+RY33//MRdOs+d0W6qXIbeFiZGLYctjbhfQDJfs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DQZmfMwV6jhX7nNMhuAgAav1UfGjEyrIAqe5nzvMxUIvmL/o6jCAwGqMSJtrPZ1eW pw2e+ZD49aEDP4aDq3uL8WVIQWeFS5+vlBW6tOGDFvV5z37GetiGtOyivwDm3vIgCd AYssaVSuwU7vU3LJwvdF0dZxcbYG+EE05wiru81g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Rui , Wang Wendy , "Rafael J. Wysocki" Subject: [PATCH 6.0 101/862] powercap: intel_rapl: Use standard Energy Unit for SPR Dram RAPL domain Date: Wed, 19 Oct 2022 10:23:08 +0200 Message-Id: <20221019083254.368732759@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114688916623442?= X-GMAIL-MSGID: =?utf-8?q?1747114688916623442?= From: Zhang Rui commit 4c081324df5608b73428662ca54d5221ea03a6bd upstream. Intel Xeon servers used to use a fixed energy resolution (15.3uj) for Dram RAPL domain. But on SPR, Dram RAPL domain follows the standard energy resolution as described in MSR_RAPL_POWER_UNIT. Remove the SPR dram_domain_energy_unit quirk. Fixes: 2d798d9f5967 ("powercap: intel_rapl: add support for Sapphire Rapids") Signed-off-by: Zhang Rui Tested-by: Wang Wendy Cc: 5.9+ # 5.9+ Signed-off-by: Rafael J. Wysocki Signed-off-by: Greg Kroah-Hartman --- drivers/powercap/intel_rapl_common.c | 1 - 1 file changed, 1 deletion(-) --- a/drivers/powercap/intel_rapl_common.c +++ b/drivers/powercap/intel_rapl_common.c @@ -1035,7 +1035,6 @@ static const struct rapl_defaults rapl_d .check_unit = rapl_check_unit_core, .set_floor_freq = set_floor_freq_default, .compute_time_window = rapl_compute_time_window_core, - .dram_domain_energy_unit = 15300, .psys_domain_energy_unit = 1000000000, .spr_psys_bits = true, }; From patchwork Wed Oct 19 08:23: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: 5223 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp265553wrs; Wed, 19 Oct 2022 04:22:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM77armrZp/OsZm8pGNIUQxDkZkg4nSSqP/wjELKRDLgQaJ0ypHWEIObXsMWWaVmongcA6o5 X-Received: by 2002:a17:90b:4f46:b0:20d:1fe8:dcd2 with SMTP id pj6-20020a17090b4f4600b0020d1fe8dcd2mr44614244pjb.235.1666178560992; Wed, 19 Oct 2022 04:22:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178560; cv=none; d=google.com; s=arc-20160816; b=aodUiAtZD1ee7Ve5nHobO6BNqVr1unE+R2d523W565XkrtlVyXJunjUZAoamGQK/ve J2j8XaiMbIqFa+m/rJhsc159BJzc36SOnZ41wAynAeVOJq5P7b2dQiXkbOzGuBy3InA+ S0E8P4zoppVMSiJrS82pszmf2vQ9Tgytlmf1iAX+VFyME9BpfeEPdE4WLsByIkMV42bg MNQTSgEvSx00p4i2DMmW3TzTzI8uMvvm5uYWVg8bDnmsljkqWKMqAAN6DNHchmBeR0s/ 4HwgO2CzhVq580A2rQBNg+6IUi5XPfvRvd92xU0/gb4dsHwvAqx38ucmBKZm0BVAZbW8 czzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Ih2faZnCL84xy0HONy9gmM7WQomB5NBGlY+NWM02VAg=; b=NkgpMJAwL34pJ4TYSD+9aAD/scpMY4fh9z4OX/1ha48d+ywbEpbjfYd9oDN0rho3xA J7Vpo90sHE/bpG2St9+B5WUP0VcHZDTYCSzVM/anxu2zhgxbv090eE3D/ufl/6QY6OT5 9XsoG1MI7oQBCTZf+ar6X+pQt9FU2Un4Y0eTR1eIVWIwr8xn4qW66SiMpU+zFPVkjDeJ /AZ8+snsPEIVGsarJGOKU1gEpGZE9GWtgG4i9tnt5F4pjR0XhpCdTYXfGBfjGt9G4i34 UVl87KRBxcN6wX98Ha33qWAzlpsOQm1riAa/ZepAoR6W5/DGDgka7nLgbW+rECD8dOs1 m1Qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oEP68VBm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f1-20020a637541000000b0045a2b6e23b6si18560809pgn.290.2022.10.19.04.22.28; Wed, 19 Oct 2022 04:22: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=oEP68VBm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232120AbiJSLL1 (ORCPT + 99 others); Wed, 19 Oct 2022 07:11:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230090AbiJSLKr (ORCPT ); Wed, 19 Oct 2022 07:10:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44A1517D856; Wed, 19 Oct 2022 03:38: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 E5DDCB822E4; Wed, 19 Oct 2022 08:42:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1EBF9C433D6; Wed, 19 Oct 2022 08:42:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168935; bh=/vyTLvtjXMq73ygQ+QM9aR5+/yBlM03oiribJFWms2s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oEP68VBmXxn90Zqfav4zafjkq1kmTSd2pb39aXXVqa+JGeiK/TA2/aNNNc37LCc5R YORJw0D7/FIik9gsHwy/oBfaZaulYt4gGqTkLD2WiCFBRzfqlnh8dHFy0GWzRpwIm6 SQpGKumCsNPLwSMh53ipuGQXTKvIrUl8lcyHtZ/g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe Leroy , Michael Ellerman Subject: [PATCH 6.0 102/862] powerpc/Kconfig: Fix non existing CONFIG_PPC_FSL_BOOKE Date: Wed, 19 Oct 2022 10:23:09 +0200 Message-Id: <20221019083254.415369614@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114850297914079?= X-GMAIL-MSGID: =?utf-8?q?1747114850297914079?= From: Christophe Leroy commit d1203f32d86987a3ccd7de9ba2448ba12d86d125 upstream. CONFIG_PPC_FSL_BOOKE doesn't exist. Should be CONFIG_FSL_BOOKE. Fixes: 49e3d8ea6248 ("powerpc/fsl_booke: Enable STRICT_KERNEL_RWX") Cc: stable@vger.kernel.org Signed-off-by: Christophe Leroy Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/828f6a64eeb51ce9abfa1d4e84c521a02fecebb8.1663606875.git.christophe.leroy@csgroup.eu Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -828,7 +828,7 @@ config DATA_SHIFT default 24 if STRICT_KERNEL_RWX && PPC64 range 17 28 if (STRICT_KERNEL_RWX || DEBUG_PAGEALLOC || KFENCE) && PPC_BOOK3S_32 range 19 23 if (STRICT_KERNEL_RWX || DEBUG_PAGEALLOC || KFENCE) && PPC_8xx - range 20 24 if (STRICT_KERNEL_RWX || DEBUG_PAGEALLOC || KFENCE) && PPC_FSL_BOOKE + range 20 24 if (STRICT_KERNEL_RWX || DEBUG_PAGEALLOC || KFENCE) && FSL_BOOKE default 22 if STRICT_KERNEL_RWX && PPC_BOOK3S_32 default 18 if (DEBUG_PAGEALLOC || KFENCE) && PPC_BOOK3S_32 default 23 if STRICT_KERNEL_RWX && PPC_8xx From patchwork Wed Oct 19 08:23:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4657 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212602wrs; Wed, 19 Oct 2022 02:07:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6KcMCmQJD9o9HRrq5fcRPMMORsRDSoa35NG9G05x+PyJRAtZ6kLwhB5xBwxtHqmNbbSUIw X-Received: by 2002:a05:6402:90c:b0:457:b5ce:5f18 with SMTP id g12-20020a056402090c00b00457b5ce5f18mr6539870edz.309.1666170473107; Wed, 19 Oct 2022 02:07:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170473; cv=none; d=google.com; s=arc-20160816; b=TFIeJ7HoJDjteIafytktuJT5N9jhD9DYKSUUPnkaNwwkyZmz8y0im6qIysA+cqLRGT kd7CyJn5cyA+IA98WgpBc5Y6gsefTkkgp/57Ev/eUyXefXLGnYQiz2pG3p2lTGMDGQUN uxIs7z4QcckfD5X/C9DMwGeN9vlarjYzJaICBplgmj+n2Wx1saRruev7nbMzjJGXjHzp w1MpkgG3q2Bi33jUwNl7uVC4/A5v0kD3gk3CZrH72zTJb8rLtuE7z/18H49Inhyk9QTB HeNvECNrGODQtGceyNnA0YIOW+yQVL0m0jseN7n2lLn6AOK39XrmOF+RAboNnWkquMpJ V4Aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4GLxZbz3PZ4hR5ukritfiOK4AXC4/UWZG8QprTeCQz8=; b=VDw7vMSRCB/KGCSZQis4JpyUp+RgpP40Okn1rhcYlgvkPdUNPM7Ysx/3CLHU+RmG9/ DgB6iKKq59qYoRQnbfEunkNuZx92Asab1ZPT/NiIe/st/TWB+zx0AkwAGf1OtibflVgz ZrDkAJoiIqRv7mEwUO55rALLAa9A8pQ/CTAekM8MNI3kF0mXAZkfPrMLh06RMOT7L00g CkdIRtxP9IYQAG7HtbEvSOT7C/WumvbWTYzCIc1ghqCWmkQ+8wiczZEp8PZVSIphDQtN Zc9MUBvJUynqMygQji7gYSS4mIcpPDVGqAmA0wxcNm6HaEItarEfjAw1g78ljKxjuAsE HZ3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YUbnmWUY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b12-20020a056402278c00b0045b68639617si14429429ede.608.2022.10.19.02.07.22; Wed, 19 Oct 2022 02:07: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=YUbnmWUY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232011AbiJSJAR (ORCPT + 99 others); Wed, 19 Oct 2022 05:00:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231959AbiJSI6c (ORCPT ); Wed, 19 Oct 2022 04:58:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8D049DFA7; Wed, 19 Oct 2022 01:53:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2599D61811; Wed, 19 Oct 2022 08:42:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27485C433D7; Wed, 19 Oct 2022 08:42:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168938; bh=tdIxaMXshIpDgKMPQUIn1JKQxwzuc+FAbzhb3VjbmOg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YUbnmWUYMZVkBdaAoYaMZQZZ5db8CTSd+G9Hzk9v8d0Tdxt49j2/rzibeN6BlhjsD iO9zd6EzDW63eGz2wGzTSvATVWhS254uwQ2kDNaSck/FHtUJRKh8ewgO60cTmxZ16m AlAbGp5wbk4BMULCwIsfIQfUIp9ldHOOzLq7gyxQ= 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 Subject: [PATCH 6.0 103/862] powerpc/boot: Explicitly disable usage of SPE instructions Date: Wed, 19 Oct 2022 10:23:10 +0200 Message-Id: <20221019083254.465544185@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106370287113990?= X-GMAIL-MSGID: =?utf-8?q?1747106370287113990?= From: Pali Rohár commit 110a58b9f91c66f743c01a2c217243d94c899c23 upstream. uImage boot wrapper should not use SPE instructions, like kernel itself. Boot wrapper has already disabled Altivec and VSX instructions but not SPE. Options -mno-spe and -mspe=no already set when compilation of kernel, but not when compiling uImage wrapper yet. Fix it. Cc: stable@vger.kernel.org Signed-off-by: Pali Rohár Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220827134454.17365-1-pali@kernel.org Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/boot/Makefile | 1 + 1 file changed, 1 insertion(+) --- a/arch/powerpc/boot/Makefile +++ b/arch/powerpc/boot/Makefile @@ -34,6 +34,7 @@ endif BOOTCFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ -fno-strict-aliasing -O2 -msoft-float -mno-altivec -mno-vsx \ + $(call cc-option,-mno-spe) $(call cc-option,-mspe=no) \ -pipe -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \ $(LINUXINCLUDE) From patchwork Wed Oct 19 08:23: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: 4651 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212433wrs; Wed, 19 Oct 2022 02:07:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7UE/HJsEaLNkJWQlcl3Yk0zF62bI8sLoyeSoezg6fAPG1ymHAuKHQFurVDAUa7OlSXEHXZ X-Received: by 2002:a17:906:478e:b0:78e:4b5:a547 with SMTP id cw14-20020a170906478e00b0078e04b5a547mr5909027ejc.81.1666170450024; Wed, 19 Oct 2022 02:07:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170450; cv=none; d=google.com; s=arc-20160816; b=usAek6EGz3S76C9GnyPvrKLOnhidnpVwxM4dJo4Ws9tmf3avmClndq6vH84CGwPIYW XMwXgRwPxYGnNVF+jY9THJeAT0Qx6P+I09XJ7Ppsa8WutaJtOUgg1srEqmAunxFw12zb Mihf9FuSOUC/5NJ/kStk5OV/yy3UFcgCvwNy3iO4yb668Gif0A4sqxqYITMUqICKn9Qi vnv0NCaibPliV9xLqTd2Ooya4SD3/+nu6d4/6HQuDOp0VjUXqNBbjCCsOpUudHnjQi1N xAN2FYl4TlkuwrHsKmeVVTQwN/+V/MLx3TSrhv4mgQMh/dkYylL0WVTH23R2DTq9e4oF Zdqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gfxxX0aUX/pg6s0PohU/GMlYSATe2edQ4rb60JFnBQ4=; b=zgDuA/5e67gHI/u9GLQr9isOTyTHmpwkkpLRlEgEj9bVS8kYCk6njiyGjZFxeW3ueh Cp3+6SFfWiknXF44xen1I0G4IlT13/tjXhfPXmlchN9lC3yq52+ly9HUe/BOWZzCJKAp 11OfPM3W4HUODTTdcWR1ONbzmph+Njblgphq8lgL9d0wtNAUYl5PYSjes/wg5WULQLuz sYaDvJbeUhu42XaJAUSIEZ7LZFzGw+fr1CgJMq95ygACCsXM0RVxgzjq+6bOQMnrhcxb YrEdnvHlS3N4Hnle95z17nUAP5dn6ja6Cp9hiHmIK6JX++u3Q0OudP89uTVhOm5FHdNK alHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fBm4Ylx4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dm5-20020a170907948500b0078cff711da6si1892395ejc.976.2022.10.19.02.07.00; Wed, 19 Oct 2022 02:07: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=fBm4Ylx4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232051AbiJSJAV (ORCPT + 99 others); Wed, 19 Oct 2022 05:00:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232008AbiJSI6e (ORCPT ); Wed, 19 Oct 2022 04:58:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70BB59E2D0; Wed, 19 Oct 2022 01:53: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 4443B617F1; Wed, 19 Oct 2022 08:42:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4AC25C433D6; Wed, 19 Oct 2022 08:42:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168943; bh=D2jgQwQo364439T549ihHR/3+u5XK1iy4v8lN4klREE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fBm4Ylx46hZEGfW4lH7z6sypBXZ4npP5LnyTXil3/w8P/NBrVU5iXh3vjKHHUkRSp NNAM0CllbBRWsFNLw58GtPILutUi2INzseQOoMaMIssjNTpLNhIkywfwvY94PXy5ZR fd4R5x2XnL6WFLWJ74ZfPH9E8Vpu1jhK8fhj0wls= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Srinivas Kandagatla Subject: [PATCH 6.0 104/862] slimbus: qcom-ngd: use correct error in message of pdr_add_lookup() failure Date: Wed, 19 Oct 2022 10:23:11 +0200 Message-Id: <20221019083254.513496073@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106346206140615?= X-GMAIL-MSGID: =?utf-8?q?1747106346206140615?= From: Krzysztof Kozlowski commit 5038d21dde818fe74ba1fcb6f2cee35b8c2ebbf2 upstream. Use correct error code, instead of previous 'ret' value, when printing error from pdr_add_lookup() failure. Fixes: e1ae85e1830e ("slimbus: qcom-ngd-ctrl: add Protection Domain Restart Support") Cc: Signed-off-by: Krzysztof Kozlowski Signed-off-by: Srinivas Kandagatla Link: https://lore.kernel.org/r/20220916122910.170730-2-srinivas.kandagatla@linaro.org Signed-off-by: Greg Kroah-Hartman --- drivers/slimbus/qcom-ngd-ctrl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/slimbus/qcom-ngd-ctrl.c +++ b/drivers/slimbus/qcom-ngd-ctrl.c @@ -1581,8 +1581,9 @@ static int qcom_slim_ngd_ctrl_probe(stru pds = pdr_add_lookup(ctrl->pdr, "avs/audio", "msm/adsp/audio_pd"); if (IS_ERR(pds) && PTR_ERR(pds) != -EALREADY) { + ret = PTR_ERR(pds); dev_err(dev, "pdr add lookup failed: %d\n", ret); - return PTR_ERR(pds); + return ret; } platform_driver_register(&qcom_slim_ngd_driver); From patchwork Wed Oct 19 08:23: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: 5345 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp295594wrs; Wed, 19 Oct 2022 05:26:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4WevWT1S7UqRWD/tyZm1YqtPGrlujcGWdXtxjxy3lARJZT7Q9DTqjEw0yaclG3fDGFZZLI X-Received: by 2002:a17:906:9be2:b0:78d:957d:9efa with SMTP id de34-20020a1709069be200b0078d957d9efamr6417459ejc.411.1666182361220; Wed, 19 Oct 2022 05:26:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666182361; cv=none; d=google.com; s=arc-20160816; b=IUUZ0IYO3tAXydO4rJ9Ca1hClfJNgf0GgAcjcnNHdsWhkITnb76kwrEYVre8vA2kV7 0EoHLHLy7sfsJ7/Urfd5mnu9gHvepsCgeRMsGc3MlvxP//Bt2tv32P5eX1SCczx0SwFJ OG+ALRFJj2JUbia0RhF/nL7bBiwn3TKEZj6v1YTrXQQu8nPUCaGCF7t/bNkHyx5UhyT0 iHcRlE6CvcTQKhv2AURehrr8b134EZe9dlPudXhG5RL/nk7noi/axwbiQ4QuDrec1Eml vZjBrgijNEq8yrz0VXbl0Ghvnq13Xrqi6INhonKIqPFcU4bI9KG3RsEj0MbRlf+mjjzc NLiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WaELeuUaIETpvupQo2MMCFvLN6d3Wv7/9CW3249WKas=; b=HlHMgwizz5QT2oWXkphukZF0sFuXHaJGgKEdVU15J2LN+l9hFk1Cy7ciKMEthNChwn O+oK82XDMvsR+CFFY/+b5ZRp9jInnpQct+DPBRE4PKAbGOf6NYcwgZ2FnxUsVgN9sdL3 CEHLSu3rSsXM+7mH87lFhezune2kW7hYfL9D9tY76Yxe6wEqX8KlJrFeQ18BYvhAMH9Q sib8AiEm80l4pxLN/c0zBgq3CjOv0FXauRQvl+5DN/21KyL8worj4XqtGLiMKVjU5xXG 5mBPDBFqQTq9ixEUG9kgPZRlyNtSN1+Vnx9+XN077DLhvHLBo/oowQbqNkoPqXk5Uiac 4k8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HEn2ioHo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a12-20020aa7cf0c000000b0045698986b50si12651164edy.511.2022.10.19.05.25.35; Wed, 19 Oct 2022 05:26: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=HEn2ioHo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232912AbiJSMQa (ORCPT + 99 others); Wed, 19 Oct 2022 08:16:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232873AbiJSMQA (ORCPT ); Wed, 19 Oct 2022 08:16:00 -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 9E22A11455; Wed, 19 Oct 2022 04:52: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 50AB6B822E5; Wed, 19 Oct 2022 08:42:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A56F9C433D6; Wed, 19 Oct 2022 08:42:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168948; bh=oIZz2kCGl4WXF7IUGUkjXWSCBViv/dAcbheVseTAqUw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HEn2ioHoQeXIGFsV/qWEOYys4+F9NhEOvJ/9ONmPcvSqvJ0bjbbkgMQ9IbnWxqA0/ hShvEHrI/YV6/sqXqF1UPc7wVcOUhpGfBlY7uGnbp6hs8U1dilWhrNCuPlhKzU+P/e HW13g7Hzlju8Dei+1WXfIuC7LskEW2pmbDiXSYRQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Srinivas Kandagatla Subject: [PATCH 6.0 105/862] slimbus: qcom-ngd: cleanup in probe error path Date: Wed, 19 Oct 2022 10:23:12 +0200 Message-Id: <20221019083254.560695838@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747118835994039167?= X-GMAIL-MSGID: =?utf-8?q?1747118835994039167?= From: Krzysztof Kozlowski commit 16f14551d0df9e7cd283545d7d748829594d912f upstream. Add proper error path in probe() to cleanup resources previously acquired/allocated to fix warnings visible during probe deferral: notifier callback qcom_slim_ngd_ssr_notify already registered WARNING: CPU: 6 PID: 70 at kernel/notifier.c:28 notifier_chain_register+0x5c/0x90 Modules linked in: CPU: 6 PID: 70 Comm: kworker/u16:1 Not tainted 6.0.0-rc3-next-20220830 #380 Call trace: notifier_chain_register+0x5c/0x90 srcu_notifier_chain_register+0x44/0x90 qcom_register_ssr_notifier+0x38/0x4c qcom_slim_ngd_ctrl_probe+0xd8/0x400 platform_probe+0x6c/0xe0 really_probe+0xbc/0x2d4 __driver_probe_device+0x78/0xe0 driver_probe_device+0x3c/0x12c __device_attach_driver+0xb8/0x120 bus_for_each_drv+0x78/0xd0 __device_attach+0xa8/0x1c0 device_initial_probe+0x18/0x24 bus_probe_device+0xa0/0xac deferred_probe_work_func+0x88/0xc0 process_one_work+0x1d4/0x320 worker_thread+0x2cc/0x44c kthread+0x110/0x114 ret_from_fork+0x10/0x20 Fixes: e1ae85e1830e ("slimbus: qcom-ngd-ctrl: add Protection Domain Restart Support") Cc: Signed-off-by: Krzysztof Kozlowski Signed-off-by: Srinivas Kandagatla Link: https://lore.kernel.org/r/20220916122910.170730-3-srinivas.kandagatla@linaro.org Signed-off-by: Greg Kroah-Hartman --- drivers/slimbus/qcom-ngd-ctrl.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) --- a/drivers/slimbus/qcom-ngd-ctrl.c +++ b/drivers/slimbus/qcom-ngd-ctrl.c @@ -1576,18 +1576,27 @@ static int qcom_slim_ngd_ctrl_probe(stru ctrl->pdr = pdr_handle_alloc(slim_pd_status, ctrl); if (IS_ERR(ctrl->pdr)) { dev_err(dev, "Failed to init PDR handle\n"); - return PTR_ERR(ctrl->pdr); + ret = PTR_ERR(ctrl->pdr); + goto err_pdr_alloc; } pds = pdr_add_lookup(ctrl->pdr, "avs/audio", "msm/adsp/audio_pd"); if (IS_ERR(pds) && PTR_ERR(pds) != -EALREADY) { ret = PTR_ERR(pds); dev_err(dev, "pdr add lookup failed: %d\n", ret); - return ret; + goto err_pdr_lookup; } platform_driver_register(&qcom_slim_ngd_driver); return of_qcom_slim_ngd_register(dev, ctrl); + +err_pdr_alloc: + qcom_unregister_ssr_notifier(ctrl->notifier, &ctrl->nb); + +err_pdr_lookup: + pdr_handle_release(ctrl->pdr); + + return ret; } static int qcom_slim_ngd_ctrl_remove(struct platform_device *pdev) From patchwork Wed Oct 19 08:23: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: 4705 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp213762wrs; Wed, 19 Oct 2022 02:11:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7AQMw/A1dk5mJNzByCvxhNxhCLjoROvRF9QYe/xrbi0lT8wHsS/4IFXLstETNn0Hz4ezhC X-Received: by 2002:a50:fb0f:0:b0:458:df03:c3aa with SMTP id d15-20020a50fb0f000000b00458df03c3aamr6322600edq.83.1666170660677; Wed, 19 Oct 2022 02:11:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170660; cv=none; d=google.com; s=arc-20160816; b=UNTOUcjuoQ5yDAfFalAsFn29KRlSn/JDWwCRAXRl1ipyomc/0pskapfMH+w43E92ej JBHIbevQaNBmQCgIc7sa9ZMNuUggw/V8YS93ZPr7hkfvgF2dtPZ2NUnGJbSDMIbzP9NZ kQ9dkmfQK5dgPE4HXV4TJSbAMdmrod2JXvmxAJiGrW/izFXKx0ALmB8kmf/7yLuT2/DU xP5wzAREYqSppaAt3d1maoy/NyipAdTxbHbRpmu54orFaOxaPS6jY+AXfNcE7JH2GW7u EGzZg2lTliszy8ETM1TCBZYF8HieZZYtGObs3BrJKLd4J+WYkHzgLQlZLKjmXkoEJBIF IktA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TV0Ov0weLr/jjXzx4HI19NkuTCOa7DQCxQWN0FCtMvY=; b=RDbuvDQfZD1Len0n5vIpGRAqA2MeeAwWInuxxPpt0O7MRtKjSmGsqR5AwN+CDgTz53 9inGIibBQABbQmSiYIcodRP51LbGjm8yCxm7Lx0HVvWJYQCWU9Iq3+ioryUs3AX/8eQJ U8ApCvTYhBs+xSGHO/yuYXk+ZIjBvQHKpiiS3SvX9+BktjTiiC+jEwgQALWyN7XrRaZB l0Ey/iQi0EGUxD7eo21H92W9lYyI1acAT0L4Wx3y08HlcTrcAKW9uwQL7JU3HGvTtL7q WzvK/n8GcDBVxqwLnyiIc5/Pk5MU9tqVq3w8NtxMUgqW6xryM4hSW6mKZaLbGcYCuOzA M6hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eKXXH3P6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sd42-20020a1709076e2a00b0078dcdbb3e87si14018980ejc.530.2022.10.19.02.10.33; Wed, 19 Oct 2022 02:11: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=eKXXH3P6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232281AbiJSJB4 (ORCPT + 99 others); Wed, 19 Oct 2022 05:01:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232289AbiJSI7Z (ORCPT ); Wed, 19 Oct 2022 04:59:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FF42DFB6; Wed, 19 Oct 2022 01:54: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 3C982617EF; Wed, 19 Oct 2022 08:42:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D370C433D7; Wed, 19 Oct 2022 08:42:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168950; bh=2kB5eJHSDf3RMUldMrmAyfvwAw/Amc3ZDZu4rybTKUE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eKXXH3P6mblvS9SGbUetvdWthWEcTinIuTTU3vR1fw29D3vv8FKHc0AP4k5urXuPM ItY0QGwv7PF7N+qo9ICSnUe1ARk0DACVmG+wE8U3DsH+/uDkN90t3xl2d7Cd6U17nN XtdFJ6PNRElxDmcAiBU943lUXOt8B/pKQc+L/2u4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Justin Tee , James Smart , "Martin K. Petersen" Subject: [PATCH 6.0 106/862] scsi: lpfc: Rework MIB Rx Monitor debug info logic Date: Wed, 19 Oct 2022 10:23:13 +0200 Message-Id: <20221019083254.600462267@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106566528654462?= X-GMAIL-MSGID: =?utf-8?q?1747106566528654462?= From: James Smart commit bd269188ea94e40ab002cad7b0df8f12b8f0de54 upstream. The kernel test robot reported the following sparse warning: arch/arm64/include/asm/cmpxchg.h:88:1: sparse: sparse: cast truncates bits from constant value (369 becomes 69) On arm64, atomic_xchg only works on 8-bit byte fields. Thus, the macro usage of LPFC_RXMONITOR_TABLE_IN_USE can be unintentionally truncated leading to all logic involving the LPFC_RXMONITOR_TABLE_IN_USE macro to not work properly. Replace the Rx Table atomic_t indexing logic with a new lpfc_rx_info_monitor structure that holds a circular ring buffer. For locking semantics, a spinlock_t is used. Link: https://lore.kernel.org/r/20220819011736.14141-4-jsmart2021@gmail.com Fixes: 17b27ac59224 ("scsi: lpfc: Add rx monitoring statistics") Cc: # v5.15+ Co-developed-by: Justin Tee Signed-off-by: Justin Tee Signed-off-by: James Smart Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/lpfc/lpfc.h | 14 +- drivers/scsi/lpfc/lpfc_crtn.h | 8 + drivers/scsi/lpfc/lpfc_debugfs.c | 59 ++---------- drivers/scsi/lpfc/lpfc_debugfs.h | 2 drivers/scsi/lpfc/lpfc_init.c | 83 ++++------------- drivers/scsi/lpfc/lpfc_mem.c | 9 + drivers/scsi/lpfc/lpfc_sli.c | 190 +++++++++++++++++++++++++++++++++++++-- 7 files changed, 240 insertions(+), 125 deletions(-) --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h @@ -1570,10 +1570,7 @@ struct lpfc_hba { u32 cgn_acqe_cnt; /* RX monitor handling for CMF */ - struct rxtable_entry *rxtable; /* RX_monitor information */ - atomic_t rxtable_idx_head; -#define LPFC_RXMONITOR_TABLE_IN_USE (LPFC_MAX_RXMONITOR_ENTRY + 73) - atomic_t rxtable_idx_tail; + struct lpfc_rx_info_monitor *rx_monitor; atomic_t rx_max_read_cnt; /* Maximum read bytes */ uint64_t rx_block_cnt; @@ -1622,7 +1619,7 @@ struct lpfc_hba { #define LPFC_MAX_RXMONITOR_ENTRY 800 #define LPFC_MAX_RXMONITOR_DUMP 32 -struct rxtable_entry { +struct rx_info_entry { uint64_t cmf_bytes; /* Total no of read bytes for CMF_SYNC_WQE */ uint64_t total_bytes; /* Total no of read bytes requested */ uint64_t rcv_bytes; /* Total no of read bytes completed */ @@ -1637,6 +1634,13 @@ struct rxtable_entry { uint32_t timer_interval; }; +struct lpfc_rx_info_monitor { + struct rx_info_entry *ring; /* info organized in a circular buffer */ + u32 head_idx, tail_idx; /* index to head/tail of ring */ + spinlock_t lock; /* spinlock for ring */ + u32 entries; /* storing number entries/size of ring */ +}; + static inline struct Scsi_Host * lpfc_shost_from_vport(struct lpfc_vport *vport) { --- a/drivers/scsi/lpfc/lpfc_crtn.h +++ b/drivers/scsi/lpfc/lpfc_crtn.h @@ -92,6 +92,14 @@ void lpfc_cgn_dump_rxmonitor(struct lpfc void lpfc_cgn_update_stat(struct lpfc_hba *phba, uint32_t dtag); void lpfc_unblock_requests(struct lpfc_hba *phba); void lpfc_block_requests(struct lpfc_hba *phba); +int lpfc_rx_monitor_create_ring(struct lpfc_rx_info_monitor *rx_monitor, + u32 entries); +void lpfc_rx_monitor_destroy_ring(struct lpfc_rx_info_monitor *rx_monitor); +void lpfc_rx_monitor_record(struct lpfc_rx_info_monitor *rx_monitor, + struct rx_info_entry *entry); +u32 lpfc_rx_monitor_report(struct lpfc_hba *phba, + struct lpfc_rx_info_monitor *rx_monitor, char *buf, + u32 buf_len, u32 max_read_entries); void lpfc_mbx_cmpl_local_config_link(struct lpfc_hba *, LPFC_MBOXQ_t *); void lpfc_mbx_cmpl_reg_login(struct lpfc_hba *, LPFC_MBOXQ_t *); --- a/drivers/scsi/lpfc/lpfc_debugfs.c +++ b/drivers/scsi/lpfc/lpfc_debugfs.c @@ -5531,7 +5531,7 @@ lpfc_rx_monitor_open(struct inode *inode if (!debug) goto out; - debug->buffer = vmalloc(MAX_DEBUGFS_RX_TABLE_SIZE); + debug->buffer = vmalloc(MAX_DEBUGFS_RX_INFO_SIZE); if (!debug->buffer) { kfree(debug); goto out; @@ -5552,57 +5552,18 @@ lpfc_rx_monitor_read(struct file *file, struct lpfc_rx_monitor_debug *debug = file->private_data; struct lpfc_hba *phba = (struct lpfc_hba *)debug->i_private; char *buffer = debug->buffer; - struct rxtable_entry *entry; - int i, len = 0, head, tail, last, start; - head = atomic_read(&phba->rxtable_idx_head); - while (head == LPFC_RXMONITOR_TABLE_IN_USE) { - /* Table is getting updated */ - msleep(20); - head = atomic_read(&phba->rxtable_idx_head); + if (!phba->rx_monitor) { + scnprintf(buffer, MAX_DEBUGFS_RX_INFO_SIZE, + "Rx Monitor Info is empty.\n"); + } else { + lpfc_rx_monitor_report(phba, phba->rx_monitor, buffer, + MAX_DEBUGFS_RX_INFO_SIZE, + LPFC_MAX_RXMONITOR_ENTRY); } - tail = atomic_xchg(&phba->rxtable_idx_tail, head); - if (!phba->rxtable || head == tail) { - len += scnprintf(buffer + len, MAX_DEBUGFS_RX_TABLE_SIZE - len, - "Rxtable is empty\n"); - goto out; - } - last = (head > tail) ? head : LPFC_MAX_RXMONITOR_ENTRY; - start = tail; - - len += scnprintf(buffer + len, MAX_DEBUGFS_RX_TABLE_SIZE - len, - " MaxBPI Tot_Data_CMF Tot_Data_Cmd " - "Tot_Data_Cmpl Lat(us) Avg_IO Max_IO " - "Bsy IO_cnt Info BWutil(ms)\n"); -get_table: - for (i = start; i < last; i++) { - entry = &phba->rxtable[i]; - len += scnprintf(buffer + len, MAX_DEBUGFS_RX_TABLE_SIZE - len, - "%3d:%12lld %12lld %12lld %12lld " - "%7lldus %8lld %7lld " - "%2d %4d %2d %2d(%2d)\n", - i, entry->max_bytes_per_interval, - entry->cmf_bytes, - entry->total_bytes, - entry->rcv_bytes, - entry->avg_io_latency, - entry->avg_io_size, - entry->max_read_cnt, - entry->cmf_busy, - entry->io_cnt, - entry->cmf_info, - entry->timer_utilization, - entry->timer_interval); - } - - if (head != last) { - start = 0; - last = head; - goto get_table; - } -out: - return simple_read_from_buffer(buf, nbytes, ppos, buffer, len); + return simple_read_from_buffer(buf, nbytes, ppos, buffer, + strlen(buffer)); } static int --- a/drivers/scsi/lpfc/lpfc_debugfs.h +++ b/drivers/scsi/lpfc/lpfc_debugfs.h @@ -282,7 +282,7 @@ struct lpfc_idiag { void *ptr_private; }; -#define MAX_DEBUGFS_RX_TABLE_SIZE (128 * LPFC_MAX_RXMONITOR_ENTRY) +#define MAX_DEBUGFS_RX_INFO_SIZE (128 * LPFC_MAX_RXMONITOR_ENTRY) struct lpfc_rx_monitor_debug { char *i_private; char *buffer; --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -5569,38 +5569,12 @@ lpfc_async_link_speed_to_read_top(struct void lpfc_cgn_dump_rxmonitor(struct lpfc_hba *phba) { - struct rxtable_entry *entry; - int cnt = 0, head, tail, last, start; - - head = atomic_read(&phba->rxtable_idx_head); - tail = atomic_read(&phba->rxtable_idx_tail); - if (!phba->rxtable || head == tail) { - lpfc_printf_log(phba, KERN_ERR, LOG_CGN_MGMT, - "4411 Rxtable is empty\n"); - return; - } - last = tail; - start = head; - - /* Display the last LPFC_MAX_RXMONITOR_DUMP entries from the rxtable */ - while (start != last) { - if (start) - start--; - else - start = LPFC_MAX_RXMONITOR_ENTRY - 1; - entry = &phba->rxtable[start]; + if (!phba->rx_monitor) { lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, - "4410 %02d: MBPI %lld Xmit %lld Cmpl %lld " - "Lat %lld ASz %lld Info %02d BWUtil %d " - "Int %d slot %d\n", - cnt, entry->max_bytes_per_interval, - entry->total_bytes, entry->rcv_bytes, - entry->avg_io_latency, entry->avg_io_size, - entry->cmf_info, entry->timer_utilization, - entry->timer_interval, start); - cnt++; - if (cnt >= LPFC_MAX_RXMONITOR_DUMP) - return; + "4411 Rx Monitor Info is empty.\n"); + } else { + lpfc_rx_monitor_report(phba, phba->rx_monitor, NULL, 0, + LPFC_MAX_RXMONITOR_DUMP); } } @@ -6007,9 +5981,8 @@ lpfc_cmf_timer(struct hrtimer *timer) { struct lpfc_hba *phba = container_of(timer, struct lpfc_hba, cmf_timer); - struct rxtable_entry *entry; + struct rx_info_entry entry; uint32_t io_cnt; - uint32_t head, tail; uint32_t busy, max_read; uint64_t total, rcv, lat, mbpi, extra, cnt; int timer_interval = LPFC_CMF_INTERVAL; @@ -6129,40 +6102,30 @@ lpfc_cmf_timer(struct hrtimer *timer) } /* Save rxmonitor information for debug */ - if (phba->rxtable) { - head = atomic_xchg(&phba->rxtable_idx_head, - LPFC_RXMONITOR_TABLE_IN_USE); - entry = &phba->rxtable[head]; - entry->total_bytes = total; - entry->cmf_bytes = total + extra; - entry->rcv_bytes = rcv; - entry->cmf_busy = busy; - entry->cmf_info = phba->cmf_active_info; + if (phba->rx_monitor) { + entry.total_bytes = total; + entry.cmf_bytes = total + extra; + entry.rcv_bytes = rcv; + entry.cmf_busy = busy; + entry.cmf_info = phba->cmf_active_info; if (io_cnt) { - entry->avg_io_latency = div_u64(lat, io_cnt); - entry->avg_io_size = div_u64(rcv, io_cnt); + entry.avg_io_latency = div_u64(lat, io_cnt); + entry.avg_io_size = div_u64(rcv, io_cnt); } else { - entry->avg_io_latency = 0; - entry->avg_io_size = 0; + entry.avg_io_latency = 0; + entry.avg_io_size = 0; } - entry->max_read_cnt = max_read; - entry->io_cnt = io_cnt; - entry->max_bytes_per_interval = mbpi; + entry.max_read_cnt = max_read; + entry.io_cnt = io_cnt; + entry.max_bytes_per_interval = mbpi; if (phba->cmf_active_mode == LPFC_CFG_MANAGED) - entry->timer_utilization = phba->cmf_last_ts; + entry.timer_utilization = phba->cmf_last_ts; else - entry->timer_utilization = ms; - entry->timer_interval = ms; + entry.timer_utilization = ms; + entry.timer_interval = ms; phba->cmf_last_ts = 0; - /* Increment rxtable index */ - head = (head + 1) % LPFC_MAX_RXMONITOR_ENTRY; - tail = atomic_read(&phba->rxtable_idx_tail); - if (head == tail) { - tail = (tail + 1) % LPFC_MAX_RXMONITOR_ENTRY; - atomic_set(&phba->rxtable_idx_tail, tail); - } - atomic_set(&phba->rxtable_idx_head, head); + lpfc_rx_monitor_record(phba->rx_monitor, &entry); } if (phba->cmf_active_mode == LPFC_CFG_MONITOR) { --- a/drivers/scsi/lpfc/lpfc_mem.c +++ b/drivers/scsi/lpfc/lpfc_mem.c @@ -344,9 +344,12 @@ lpfc_mem_free_all(struct lpfc_hba *phba) phba->cgn_i = NULL; } - /* Free RX table */ - kfree(phba->rxtable); - phba->rxtable = NULL; + /* Free RX Monitor */ + if (phba->rx_monitor) { + lpfc_rx_monitor_destroy_ring(phba->rx_monitor); + kfree(phba->rx_monitor); + phba->rx_monitor = NULL; + } /* Free the iocb lookup array */ kfree(psli->iocbq_lookup); --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -7960,6 +7960,172 @@ static void lpfc_sli4_dip(struct lpfc_hb } /** + * lpfc_rx_monitor_create_ring - Initialize ring buffer for rx_monitor + * @rx_monitor: Pointer to lpfc_rx_info_monitor object + * @entries: Number of rx_info_entry objects to allocate in ring + * + * Return: + * 0 - Success + * ENOMEM - Failure to kmalloc + **/ +int lpfc_rx_monitor_create_ring(struct lpfc_rx_info_monitor *rx_monitor, + u32 entries) +{ + rx_monitor->ring = kmalloc_array(entries, sizeof(struct rx_info_entry), + GFP_KERNEL); + if (!rx_monitor->ring) + return -ENOMEM; + + rx_monitor->head_idx = 0; + rx_monitor->tail_idx = 0; + spin_lock_init(&rx_monitor->lock); + rx_monitor->entries = entries; + + return 0; +} + +/** + * lpfc_rx_monitor_destroy_ring - Free ring buffer for rx_monitor + * @rx_monitor: Pointer to lpfc_rx_info_monitor object + **/ +void lpfc_rx_monitor_destroy_ring(struct lpfc_rx_info_monitor *rx_monitor) +{ + spin_lock(&rx_monitor->lock); + kfree(rx_monitor->ring); + rx_monitor->ring = NULL; + rx_monitor->entries = 0; + rx_monitor->head_idx = 0; + rx_monitor->tail_idx = 0; + spin_unlock(&rx_monitor->lock); +} + +/** + * lpfc_rx_monitor_record - Insert an entry into rx_monitor's ring + * @rx_monitor: Pointer to lpfc_rx_info_monitor object + * @entry: Pointer to rx_info_entry + * + * Used to insert an rx_info_entry into rx_monitor's ring. Note that this is a + * deep copy of rx_info_entry not a shallow copy of the rx_info_entry ptr. + * + * This is called from lpfc_cmf_timer, which is in timer/softirq context. + * + * In cases of old data overflow, we do a best effort of FIFO order. + **/ +void lpfc_rx_monitor_record(struct lpfc_rx_info_monitor *rx_monitor, + struct rx_info_entry *entry) +{ + struct rx_info_entry *ring = rx_monitor->ring; + u32 *head_idx = &rx_monitor->head_idx; + u32 *tail_idx = &rx_monitor->tail_idx; + spinlock_t *ring_lock = &rx_monitor->lock; + u32 ring_size = rx_monitor->entries; + + spin_lock(ring_lock); + memcpy(&ring[*tail_idx], entry, sizeof(*entry)); + *tail_idx = (*tail_idx + 1) % ring_size; + + /* Best effort of FIFO saved data */ + if (*tail_idx == *head_idx) + *head_idx = (*head_idx + 1) % ring_size; + + spin_unlock(ring_lock); +} + +/** + * lpfc_rx_monitor_report - Read out rx_monitor's ring + * @phba: Pointer to lpfc_hba object + * @rx_monitor: Pointer to lpfc_rx_info_monitor object + * @buf: Pointer to char buffer that will contain rx monitor info data + * @buf_len: Length buf including null char + * @max_read_entries: Maximum number of entries to read out of ring + * + * Used to dump/read what's in rx_monitor's ring buffer. + * + * If buf is NULL || buf_len == 0, then it is implied that we want to log the + * information to kmsg instead of filling out buf. + * + * Return: + * Number of entries read out of the ring + **/ +u32 lpfc_rx_monitor_report(struct lpfc_hba *phba, + struct lpfc_rx_info_monitor *rx_monitor, char *buf, + u32 buf_len, u32 max_read_entries) +{ + struct rx_info_entry *ring = rx_monitor->ring; + struct rx_info_entry *entry; + u32 *head_idx = &rx_monitor->head_idx; + u32 *tail_idx = &rx_monitor->tail_idx; + spinlock_t *ring_lock = &rx_monitor->lock; + u32 ring_size = rx_monitor->entries; + u32 cnt = 0; + char tmp[DBG_LOG_STR_SZ] = {0}; + bool log_to_kmsg = (!buf || !buf_len) ? true : false; + + if (!log_to_kmsg) { + /* clear the buffer to be sure */ + memset(buf, 0, buf_len); + + scnprintf(buf, buf_len, "\t%-16s%-16s%-16s%-16s%-8s%-8s%-8s" + "%-8s%-8s%-8s%-16s\n", + "MaxBPI", "Tot_Data_CMF", + "Tot_Data_Cmd", "Tot_Data_Cmpl", + "Lat(us)", "Avg_IO", "Max_IO", "Bsy", + "IO_cnt", "Info", "BWutil(ms)"); + } + + /* Needs to be _bh because record is called from timer interrupt + * context + */ + spin_lock_bh(ring_lock); + while (*head_idx != *tail_idx) { + entry = &ring[*head_idx]; + + /* Read out this entry's data. */ + if (!log_to_kmsg) { + /* If !log_to_kmsg, then store to buf. */ + scnprintf(tmp, sizeof(tmp), + "%03d:\t%-16llu%-16llu%-16llu%-16llu%-8llu" + "%-8llu%-8llu%-8u%-8u%-8u%u(%u)\n", + *head_idx, entry->max_bytes_per_interval, + entry->cmf_bytes, entry->total_bytes, + entry->rcv_bytes, entry->avg_io_latency, + entry->avg_io_size, entry->max_read_cnt, + entry->cmf_busy, entry->io_cnt, + entry->cmf_info, entry->timer_utilization, + entry->timer_interval); + + /* Check for buffer overflow */ + if ((strlen(buf) + strlen(tmp)) >= buf_len) + break; + + /* Append entry's data to buffer */ + strlcat(buf, tmp, buf_len); + } else { + lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, + "4410 %02u: MBPI %llu Xmit %llu " + "Cmpl %llu Lat %llu ASz %llu Info %02u " + "BWUtil %u Int %u slot %u\n", + cnt, entry->max_bytes_per_interval, + entry->total_bytes, entry->rcv_bytes, + entry->avg_io_latency, + entry->avg_io_size, entry->cmf_info, + entry->timer_utilization, + entry->timer_interval, *head_idx); + } + + *head_idx = (*head_idx + 1) % ring_size; + + /* Don't feed more than max_read_entries */ + cnt++; + if (cnt >= max_read_entries) + break; + } + spin_unlock_bh(ring_lock); + + return cnt; +} + +/** * lpfc_cmf_setup - Initialize idle_stat tracking * @phba: Pointer to HBA context object. * @@ -8133,19 +8299,29 @@ no_cmf: phba->cmf_interval_rate = LPFC_CMF_INTERVAL; /* Allocate RX Monitor Buffer */ - if (!phba->rxtable) { - phba->rxtable = kmalloc_array(LPFC_MAX_RXMONITOR_ENTRY, - sizeof(struct rxtable_entry), - GFP_KERNEL); - if (!phba->rxtable) { + if (!phba->rx_monitor) { + phba->rx_monitor = kzalloc(sizeof(*phba->rx_monitor), + GFP_KERNEL); + + if (!phba->rx_monitor) { lpfc_printf_log(phba, KERN_ERR, LOG_INIT, "2644 Failed to alloc memory " "for RX Monitor Buffer\n"); return -ENOMEM; } + + /* Instruct the rx_monitor object to instantiate its ring */ + if (lpfc_rx_monitor_create_ring(phba->rx_monitor, + LPFC_MAX_RXMONITOR_ENTRY)) { + kfree(phba->rx_monitor); + phba->rx_monitor = NULL; + lpfc_printf_log(phba, KERN_ERR, LOG_INIT, + "2645 Failed to alloc memory " + "for RX Monitor's Ring\n"); + return -ENOMEM; + } } - atomic_set(&phba->rxtable_idx_head, 0); - atomic_set(&phba->rxtable_idx_tail, 0); + return 0; } From patchwork Wed Oct 19 08:23: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: 4649 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212394wrs; Wed, 19 Oct 2022 02:07:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6E0e2HO5ymE31uzCXBcVdCdKqrBxEpdo0s/0ePS8E1KK53vF1m5Y6D2lXGJYIAX27Jyvag X-Received: by 2002:a50:fc0a:0:b0:458:73c0:7e04 with SMTP id i10-20020a50fc0a000000b0045873c07e04mr6270013edr.270.1666170445345; Wed, 19 Oct 2022 02:07:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170445; cv=none; d=google.com; s=arc-20160816; b=jM0ABseYj2+wHfNkD7pLmvco2q0xDH2aXe/Na5ldO3VhDXIYEDpRWFlQ3751c6dhXm 9GxHxItULp2dSuEXQwUJTtkoLcd24h6ox3/lCeMj8uxex+n8+w8eNxTm3WosQxkZcKgO lBSClAoa/15SDuuPa9oAkThTP1QHgmxRjI56XU+lZGvlQ7Sp8koeLxN5qkVW7BHOYZVm 5PHYHGJ6HEV8vYRHjhS6SSkMtIgUR93ncN0lR5hp0aIjFDjljAewg1O6HXCLMoEcKcur 5a5mqnm6wRAFVx04UEj2bAJTZRjVki5AIIUP5LHhN7f7WzurhBgfDMBKPQAzpVGo0iZj D3Ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1unh5gNOM//0lURzWdG+dqOhsOfQoCT5wRTk73W49Es=; b=xbWFnVdfcRb1cJD3rnOVH8DRP9Br9FivapKRK+dudZyi5g5GrxP2X0lEAUsImb0tNg bMyn3kPdVY93EdjgmW0wIFXDdi1TxQuakF7yeItcyJcWcXEDaQMIqZVBC6SxW9OCzewa 4nnPatetMDtzz8g8ZvlbaJmSq57hT1pJKCKRfzVNOzO3HU9uUMDxZw7Gms4RBxhjf4eW pdbrpRF7YHadsdVk2KwkEE2cC5wWKz2YcVOkddY88/7aeLi3DyruI/BfUkaPE7fj3UFY QJH4dp2wO2wsRZafHLSTIxi5K8YVIdKgeLMsAn3XqUNO9KRL/vB1+Bb7dDskogz/Lic9 HUmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dBSAjtXw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id tb8-20020a1709078b8800b00781df71dbc1si12538913ejc.174.2022.10.19.02.06.53; Wed, 19 Oct 2022 02:07: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=dBSAjtXw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231967AbiJSJAL (ORCPT + 99 others); Wed, 19 Oct 2022 05:00:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231995AbiJSI6d (ORCPT ); Wed, 19 Oct 2022 04:58:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F69EA0268; Wed, 19 Oct 2022 01:53:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DD966617EC; Wed, 19 Oct 2022 08:42:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0D43C433B5; Wed, 19 Oct 2022 08:42:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168953; bh=5dmX0BxH8ERt9C6w6xHEfRy2uRICDLXXIjsgURNzIo4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dBSAjtXwCfUsqoM+ozvppfcJb6m2lQpHKC0UDJx0SDdn1wQ7YHlsVswUEOEHm8h7r Otd7Sp5Wnj9s/qlt8k1HRJFjVXhItSA1uyLE9rqLgERmQJn/ey/bKc4Ooux4UTrC7o H5RwW7SknEb0Skw/auhWYl19MKMGpr2X6HjPQvq4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guangwu Zhang , John Meneghini , Saurav Kashyap , Nilesh Javali , "Martin K. Petersen" Subject: [PATCH 6.0 107/862] scsi: qedf: Populate sysfs attributes for vport Date: Wed, 19 Oct 2022 10:23:14 +0200 Message-Id: <20221019083254.650883140@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106341372080744?= X-GMAIL-MSGID: =?utf-8?q?1747106341372080744?= From: Saurav Kashyap commit 592642e6b11e620e4b43189f8072752429fc8dc3 upstream. Few vport parameters were displayed by systool as 'Unknown' or 'NULL'. Copy speed, supported_speed, frame_size and update port_type for NPIV port. Link: https://lore.kernel.org/r/20220919134434.3513-1-njavali@marvell.com Cc: stable@vger.kernel.org Tested-by: Guangwu Zhang Reviewed-by: John Meneghini Signed-off-by: Saurav Kashyap Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/qedf/qedf_main.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) --- a/drivers/scsi/qedf/qedf_main.c +++ b/drivers/scsi/qedf/qedf_main.c @@ -1921,6 +1921,27 @@ static int qedf_vport_create(struct fc_v fc_vport_setlink(vn_port); } + /* Set symbolic node name */ + if (base_qedf->pdev->device == QL45xxx) + snprintf(fc_host_symbolic_name(vn_port->host), 256, + "Marvell FastLinQ 45xxx FCoE v%s", QEDF_VERSION); + + if (base_qedf->pdev->device == QL41xxx) + snprintf(fc_host_symbolic_name(vn_port->host), 256, + "Marvell FastLinQ 41xxx FCoE v%s", QEDF_VERSION); + + /* Set supported speed */ + fc_host_supported_speeds(vn_port->host) = n_port->link_supported_speeds; + + /* Set speed */ + vn_port->link_speed = n_port->link_speed; + + /* Set port type */ + fc_host_port_type(vn_port->host) = FC_PORTTYPE_NPIV; + + /* Set maxframe size */ + fc_host_maxframe_size(vn_port->host) = n_port->mfs; + QEDF_INFO(&(base_qedf->dbg_ctx), QEDF_LOG_NPIV, "vn_port=%p.\n", vn_port); From patchwork Wed Oct 19 08:23: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: 4672 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212812wrs; Wed, 19 Oct 2022 02:08:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5r0wY00czVZUUt8xtFxU6k6VYh+ySqwn6Bn/EDAxVnF0PqO4LFktQntCrsPWXXl0yr0rRV X-Received: by 2002:aa7:df04:0:b0:45b:cb0d:856a with SMTP id c4-20020aa7df04000000b0045bcb0d856amr6653694edy.180.1666170500642; Wed, 19 Oct 2022 02:08:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170500; cv=none; d=google.com; s=arc-20160816; b=yAccgQ0GJnIUFokHJPVry+2jFBM8reqGffq3uZBjtgeYFBn30HXjk6tueLcxaOI+Ne VdCaWlm96t09YGMU33XMgQeM3D2XsqWU9uasS8aybH98t3ASCKhZVi/3ibxwApXOWbKK fYNzd594VevN4hJZ4txDripNrVxyMH9QlTjG9LedffD54JZe7FvlOgq2SHUoPahy4zOb 4hBi8iNuBAtTTic5PwLlXa6j/tTmjkEL8L1T5NzsNlQ4X9jBiW5a91g4ORQdgXUVjGGM +mP5N2jd/1NMTNYqxlwhOvSEouEBMqz/MeKlsGVirPko3vUenG9MmnNYIB+erBUE5WQ1 s34g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=AYpNnn5YpX1UIzOCZqEs9GJm9ikB424iPFX09FNomL8=; b=RMnepCZk5jMob9WhaKE10rlSAhqYAQCRvqKr7X9VDlIuHzHOdUnsWaaHVZw25jnWmV fZ/CB6NMMZGVWsCi14YeLaL629GU8sKL0X2/BzY3BBJaP2sSvRyjvoyGx7X6tSNw+FGA TqNQjkr0djVgVZOkTuo/UA7kfXue+Jo1TRLQ3GzkZBI+THyj7VqobK+4U9811HmzrYdq NXBo74plHoT35s85MiqCAmEwUbrIfVVGlsdEjxepVWt1BTaNhmd4ELJz/9U4u6Nr0NDx QzbSFgl/LAmgw4+j1MfIKpc8WELcIfSSp34U+zn3CDa+qNgG0+MCWa95CkEpG4BIDacH 8XLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qVxwYKkW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dn17-20020a17090794d100b00781d793f524si13229812ejc.132.2022.10.19.02.07.46; Wed, 19 Oct 2022 02:08: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=qVxwYKkW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232185AbiJSJAr (ORCPT + 99 others); Wed, 19 Oct 2022 05:00:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232078AbiJSI6w (ORCPT ); Wed, 19 Oct 2022 04: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 09EFE33848; Wed, 19 Oct 2022 01:54:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5304C617F4; Wed, 19 Oct 2022 08:42:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45C97C433C1; Wed, 19 Oct 2022 08:42:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168958; bh=zKppyKIbE0qX7a5aCXROzEzRZ7q0XdFQU/ezCKPeOqk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qVxwYKkWAmdhbX581XWxi7LN1YKfn4bKksuNeeT0fU0C0Z8wVA9F4wdvrTdOS6Ibq eocDDFXyU3lS/flUDPLEOkt9RkFap4HrOv5uUfyCajleU/hniYjmHU7V4XRd1z3QkI /M3xzQHtkFpyoSXbZDDQSGWMmqDpfiCTOrphjbjQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Heiko Stuebner , Quentin Schulz , Linus Walleij Subject: [PATCH 6.0 108/862] gpio: rockchip: request GPIO mux to pinctrl when setting direction Date: Wed, 19 Oct 2022 10:23:15 +0200 Message-Id: <20221019083254.691102670@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106399378026687?= X-GMAIL-MSGID: =?utf-8?q?1747106399378026687?= From: Quentin Schulz commit 8ea8af6c8469156ac2042d83d73f6b74eb4b4b45 upstream. Before the split of gpio and pinctrl sections in their own driver, rockchip_set_mux was called in pinmux_ops.gpio_set_direction for configuring a pin in its GPIO function. This is essential for cases where pinctrl is "bypassed" by gpio consumers otherwise the GPIO function is not configured for the pin and it does not work. Such was the case for the sysfs/libgpiod userspace GPIO handling. Let's call pinctrl_gpio_direction_input/output when setting the direction of a GPIO so that the pinctrl core requests from the rockchip pinctrl driver to put the pin in its GPIO function. Fixes: 9ce9a02039de ("pinctrl/rockchip: drop the gpio related codes") Fixes: 936ee2675eee ("gpio/rockchip: add driver for rockchip gpio") Cc: stable@vger.kernel.org Reviewed-by: Heiko Stuebner Signed-off-by: Quentin Schulz Link: https://lore.kernel.org/r/20220930132033.4003377-3-foss+kernel@0leil.net Signed-off-by: Linus Walleij Signed-off-by: Greg Kroah-Hartman --- drivers/gpio/gpio-rockchip.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/drivers/gpio/gpio-rockchip.c +++ b/drivers/gpio/gpio-rockchip.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -156,6 +157,12 @@ static int rockchip_gpio_set_direction(s unsigned long flags; u32 data = input ? 0 : 1; + + if (input) + pinctrl_gpio_direction_input(bank->pin_base + offset); + else + pinctrl_gpio_direction_output(bank->pin_base + offset); + raw_spin_lock_irqsave(&bank->slock, flags); rockchip_gpio_writel_bit(bank, offset, data, bank->gpio_regs->port_ddr); raw_spin_unlock_irqrestore(&bank->slock, flags); From patchwork Wed Oct 19 08:23: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: 4650 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212429wrs; Wed, 19 Oct 2022 02:07:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6LDLSGTdK+iDPWr8ijFstcbCZVyznJAiSpeXRBWfjLJbDUwZGc7dpQC8RTCGLeTNj+Fux9 X-Received: by 2002:a17:906:8a55:b0:78d:b6db:a2d4 with SMTP id gx21-20020a1709068a5500b0078db6dba2d4mr5892853ejc.82.1666170439243; Wed, 19 Oct 2022 02:07:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170439; cv=none; d=google.com; s=arc-20160816; b=pXow9EWI8D15oFjzx62bVqHRc7CWH7PY9xRss3BK/OIjoYSruRlYUav44vC8lbB5/z uL0+JwAuqRkWy2Aduk1OLvoVA46TGcCn2pLr1Xm/d5b7BZ36kGLU9N70X2EZNd0EjwIW VAMLI0PAhG0VFv694s7ElY5KizCI6tM0hdnuRkyTsVVxtxkpsMwf969v5ZEoQYXUnl+o 7or3rVV6gvVFCw9Seeh9g8URNRdMzr4MWE+v4+EE3I3pZycvpK2Mvok4FXHZCMQR+TKm 7I79INv8Vc7ntDLZZY+dTetXMzDnTtlmXA4pIE2uMBw84lIoxesXXkN5gspvjjs1E1qT ootg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8h+KKfeYENO2/kWguJvSk42DXK3gyeApSnH0SCTLTCY=; b=C91jrVu2ruV7PBnvEuzpVsbZ7tv9DppYitMV8uNl4cJ1qeYfGXFMZBRdJmBp44WlL2 bIN+Ll7jUpsjPu/J9+w4WSWszWb/bX1ndcI5B8A4R6kLTid2Y0mPsK/ikQbcbvDtcWf+ /4bxmMmYblZeQxuwnP+TKR5BrY41X9WACTxeTlB5FcEyd70NfjXB5mSlKhn/gOlwSv6Q 9dJ4yA+dt1AgXk9LeVgPGU92UZYP1+fHP96BDtuMhbwQQrCOXXl83CpwMYuNtrPIBE52 aK8YDcy23IeZ1rjD3FnGxl/GKRqgwG3fmRCRgpYtTERgXKuZ7IqBaZOxQrRDcL04NVxn xURg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Str6dWB7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sg15-20020a170907a40f00b007897abd2d17si7958002ejc.468.2022.10.19.02.06.49; Wed, 19 Oct 2022 02:07: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=Str6dWB7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231926AbiJSI4x (ORCPT + 99 others); Wed, 19 Oct 2022 04:56:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231942AbiJSI4U (ORCPT ); Wed, 19 Oct 2022 04:56:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6540E9C7F7; Wed, 19 Oct 2022 01: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 dfw.source.kernel.org (Postfix) with ESMTPS id A452F6181B; Wed, 19 Oct 2022 08:44:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9687EC433D6; Wed, 19 Oct 2022 08:44:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169097; bh=2W+EnrEqw1ZdduKBQk6+8YZEHNmfS8U/NiyiLPhgklc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Str6dWB7KpFM3v9hL6f1POrzr5hpZluShKWFKsxEO7f4YjM8NEc1LBjWd3/JPMAkc SuhuDCf0TKBy1rPPKptcW/khWhwRxvcpbTp5Ihm8cw3HMOti/LYCHNimmYZMPAbJy1 elccVrkV5TcGo0dHztOmFj/+KNfuRbzAb1fAuop8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Heiko Stuebner , Quentin Schulz , Linus Walleij Subject: [PATCH 6.0 109/862] pinctrl: rockchip: add pinmux_ops.gpio_set_direction callback Date: Wed, 19 Oct 2022 10:23:16 +0200 Message-Id: <20221019083254.739632849@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106334461515257?= X-GMAIL-MSGID: =?utf-8?q?1747106334461515257?= From: Quentin Schulz commit 4635c0e2a7f7f3568cbfccae70121f9835efa62c upstream. Before the split of gpio and pinctrl sections in their own driver, rockchip_set_mux was called in pinmux_ops.gpio_set_direction for configuring a pin in its GPIO function. This is essential for cases where pinctrl is "bypassed" by gpio consumers otherwise the GPIO function is not configured for the pin and it does not work. Such was the case for the sysfs/libgpiod userspace GPIO handling. Let's re-implement the pinmux_ops.gpio_set_direction callback so that the gpio subsystem can request from the pinctrl driver to put the pin in its GPIO function. Fixes: 9ce9a02039de ("pinctrl/rockchip: drop the gpio related codes") Cc: stable@vger.kernel.org Reviewed-by: Heiko Stuebner Signed-off-by: Quentin Schulz Link: https://lore.kernel.org/r/20220930132033.4003377-2-foss+kernel@0leil.net Signed-off-by: Linus Walleij Signed-off-by: Greg Kroah-Hartman --- drivers/pinctrl/pinctrl-rockchip.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) --- a/drivers/pinctrl/pinctrl-rockchip.c +++ b/drivers/pinctrl/pinctrl-rockchip.c @@ -2393,11 +2393,24 @@ static int rockchip_pmx_set(struct pinct return 0; } +static int rockchip_pmx_gpio_set_direction(struct pinctrl_dev *pctldev, + struct pinctrl_gpio_range *range, + unsigned offset, + bool input) +{ + struct rockchip_pinctrl *info = pinctrl_dev_get_drvdata(pctldev); + struct rockchip_pin_bank *bank; + + bank = pin_to_bank(info, offset); + return rockchip_set_mux(bank, offset - bank->pin_base, RK_FUNC_GPIO); +} + static const struct pinmux_ops rockchip_pmx_ops = { .get_functions_count = rockchip_pmx_get_funcs_count, .get_function_name = rockchip_pmx_get_func_name, .get_function_groups = rockchip_pmx_get_groups, .set_mux = rockchip_pmx_set, + .gpio_set_direction = rockchip_pmx_gpio_set_direction, }; /* From patchwork Wed Oct 19 08:23: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: 4603 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp206527wrs; Wed, 19 Oct 2022 01:52:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5l7sLoocF1/civudqiQp2xliDrjrwpztrYGi2W4mLEU5bGxO7O4gWc4Mrvig9uxGoFK2SE X-Received: by 2002:a17:90b:3912:b0:20d:4151:1b65 with SMTP id ob18-20020a17090b391200b0020d41511b65mr44791928pjb.233.1666169557998; Wed, 19 Oct 2022 01:52:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169557; cv=none; d=google.com; s=arc-20160816; b=AGKTsdwtQchU2hJSgEEKKKgQ455LfqgUt9uJP+GCKSyPMXX2qGRIVaq3YWBi8dRrmo 8DgF6XLFNskKixRd97pgdyf9jUFMaz8qVfi90tXdshHtNYqlA9yBzrqsmbH2AZikaS5y MRYReABlX42qfgEgKUjmKtyMDBd2EVeaA/YNiVMCD5/MVIxaiUi+X8YyrtqLcCd3b/sa /Z2/QmzqWco/gJRITk9leCaxxgsJLEHwREIXOKkRYpq/+T1+llefJTeLZlO/3Q0gVA6B JNHlX5uJ2i0xZbKf4NX0lQQxTgJ41+7FBmf8p7jczP34GmhGqCOKYv4QNARNpNwvOIa5 aHSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PV4g9GkHPMStXQq4RaBQAvlc8UkY57kOOWttNC1fAgo=; b=KxbnHF6G4MViuX7mp2kZvxwZHzB8Za5fuy7sS1KhsYxpc9AnEpC6VG5rm5nkkjYx6d FWAW/kUka0OtU4/4XePLnSKmth8+cK866eoLsj0WAwIMYOJc+NlPxPdyc26MHiA7wvHp eQUOTfFB4rpC6s6lfwxckb4BMEr8GE+0T4FzD4S1EaskmkxIBNzTk3JrU/QjEMg+naXH mSh6Wyezt1arh86qddcIb4S4pm4+90ABv5jY2ETk8Ppd0uKIoJi1epnU5DxZdowCOFXP e2Y7jowiDz6LLTv1iMalrX4b7uHguACXKAi21MJKVhyWXQrkUvcUAvKDx5if4ZlKuQl1 axpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mJd1s1nO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a68-20020a636647000000b0045ce0eba520si16927516pgc.751.2022.10.19.01.52.25; Wed, 19 Oct 2022 01:52: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=mJd1s1nO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231766AbiJSIwK (ORCPT + 99 others); Wed, 19 Oct 2022 04:52:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231598AbiJSIsk (ORCPT ); Wed, 19 Oct 2022 04:48:40 -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 AE82B8FD60; Wed, 19 Oct 2022 01:46: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 5A674B822E6; Wed, 19 Oct 2022 08:43:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5CB0C433D6; Wed, 19 Oct 2022 08:42:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168979; bh=dGaokMN2ZM66MraQW54O4r/eFRtqHnwl58/YQQQdXYg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mJd1s1nOR7mL9TY8jt/Gwtp1uAwUFT9JvSt0dMDb5M91kYsLlLt2LCqwNalmXTe2m VotIMj3yGP7lJjj3HgxgpdXQnC8nAAej4/byA61BZoqTrJIvDAvQRMYWitdTXwje5r qFlQ7F97d1GneTtS9U6a39AS0+kq8rkeU3MJ39kU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hyunwoo Kim , Helge Deller Subject: [PATCH 6.0 110/862] fbdev: smscufx: Fix use-after-free in ufx_ops_open() Date: Wed, 19 Oct 2022 10:23:17 +0200 Message-Id: <20221019083254.787822786@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105410322214903?= X-GMAIL-MSGID: =?utf-8?q?1747105410322214903?= 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 @@ -137,6 +137,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) { @@ -1071,9 +1073,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++; @@ -1097,6 +1103,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; } @@ -1741,6 +1749,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"); @@ -1761,6 +1771,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 Wed Oct 19 08:23: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: 4592 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp206221wrs; Wed, 19 Oct 2022 01:51:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6zDf5COZsHcTyguwxqGuaBfGXpupdT+GCyAF3dwMLDifjn+8JhDkL1w3tiz2H4mDCcRr2K X-Received: by 2002:a05:6a00:26f4:b0:563:3fdc:8af0 with SMTP id p52-20020a056a0026f400b005633fdc8af0mr7605103pfw.63.1666169512532; Wed, 19 Oct 2022 01:51:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169512; cv=none; d=google.com; s=arc-20160816; b=sAkUEnJnvgEP+iJvYwNha7hP44dnIKnPLhIOMpejig32mwcFs954gQhqctHTs4f2o1 aPFcLlgHfGP8eGrbGTBsKHpytoNHtL092uN0EGMawWc0X4ra3y+kR26bG0ZrpLbIBRw0 3i2pfLpc3sIZ5CHLCymN1pAP+vWjHMYw5RMpmYdVMHL/lV8r3JXVrllMxCcQppG9jLMe FnpuX/V8od/w36ClMdmk2mFRckhrPQ6YcNco1JJT0jA0KkEkmJBXsmC5gG79Cqix+XiA VLOlYftxpljB5kpZt0O+1feMDKPpP+QkbCxRoROD9uT+Ot20rsRWhkn7vERNgAscfd7X WDRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HZ1yGNmM3xS43jMUJuwhPNIZAHm2NKh2jSBlwXuWbPw=; b=zLwx2mXERN+2SkdZuvEjG29gyWNzJWukX1ZIxx2osLt3vanW5CQ8HjllrJFPa3vsLM nrVIaXQS/e1yYmcUw6FyZQH5fWkw+rM8VpJEAoHPyCdqZF3aYoCuoUuVsanS/KK++AcZ EVjwoQ9meeuWEOmYOarTtxfJv4x2q0nbZ5NsAOnUytRB6c2lPdFBC6wlC95NBzCJWn/l MAAyWjP54+i87CLprpVGYrFQdWklM1XSsgU7AOX0ghC5KCMSkEWpV9jxaRmc+6QZ8QWm wy8BQgyf5RqCCFJP7R0evbM4PN6gbgJK6HVnMvfg5q7jIsjTw9Qfx08ENW5n+OCS8Qbu 8GcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=v2GuYzra; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a14-20020a63704e000000b0045fb345cfedsi18370469pgn.640.2022.10.19.01.51.39; Wed, 19 Oct 2022 01: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=v2GuYzra; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231673AbiJSIvV (ORCPT + 99 others); Wed, 19 Oct 2022 04:51:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231686AbiJSItE (ORCPT ); Wed, 19 Oct 2022 04:49: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 656AF91853; Wed, 19 Oct 2022 01:47: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 B4924B822FF; Wed, 19 Oct 2022 08:43:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A257C433D6; Wed, 19 Oct 2022 08:43:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169011; bh=5WqAnoSjVTSoddkab9lp14xiGFfx7MVSszDGRO/v0Ss=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v2GuYzraoAIVX/utpa6O3f7nQBhJ+dpSlQD/i/KtLiKs74ty02VQSCfulgN3JeJ02 xV3JVhPIF4sMubqy/h8xM7AHwOEcgWXQfRT9fjhgpt4PeJSJGSE3kAYRwgKwILU/Hl HS9hKIeok7tQeiMgs96E2tiW+ntqzAC0kybTP/bE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gregory Erwin , "Jason A. Donenfeld" , Herbert Xu , =?utf-8?q?Toke_H=C3=B8iland-J?= =?utf-8?q?=C3=B8rgensen?= , Kalle Valo Subject: [PATCH 6.0 111/862] hwrng: core - let sleep be interrupted when unregistering hwrng Date: Wed, 19 Oct 2022 10:23:18 +0200 Message-Id: <20221019083254.837224927@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105362702987693?= X-GMAIL-MSGID: =?utf-8?q?1747105362702987693?= From: Jason A. Donenfeld commit 36cb6494429bd64b27b7ff8b4af56f8e526da2b4 upstream. There are two deadlock scenarios that need addressing, which cause problems when the computer goes to sleep, the interface is set down, and hwrng_unregister() is called. When the deadlock is hit, sleep is delayed for tens of seconds, causing it to fail. These scenarios are: 1) The hwrng kthread can't be stopped while it's sleeping, because it uses msleep_interruptible() which does not react to kthread_stop. 2) A normal user thread can't be interrupted by hwrng_unregister() while it's sleeping, because hwrng_unregister() is called from elsewhere. We solve both issues by add a completion object called dying that fulfils waiters once we have started the process in hwrng_unregister. At the same time, we should cleanup a common and useless dmesg splat in the same area. Cc: Reported-by: Gregory Erwin Fixes: fcd09c90c3c5 ("ath9k: use hw_random API instead of directly dumping into random.c") Link: https://lore.kernel.org/all/CAO+Okf6ZJC5-nTE_EJUGQtd8JiCkiEHytGgDsFGTEjs0c00giw@mail.gmail.com/ Link: https://lore.kernel.org/lkml/CAO+Okf5k+C+SE6pMVfPf-d8MfVPVq4PO7EY8Hys_DVXtent3HA@mail.gmail.com/ Link: https://bugs.archlinux.org/task/75138 Signed-off-by: Jason A. Donenfeld Signed-off-by: Herbert Xu Acked-by: Toke Høiland-Jørgensen Acked-by: Kalle Valo Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman --- drivers/char/hw_random/core.c | 19 +++++++++++++++---- drivers/net/wireless/ath/ath9k/rng.c | 3 ++- include/linux/hw_random.h | 3 +++ 3 files changed, 20 insertions(+), 5 deletions(-) --- a/drivers/char/hw_random/core.c +++ b/drivers/char/hw_random/core.c @@ -507,16 +507,17 @@ static int hwrng_fillfn(void *unused) rng->quality = current_quality; /* obsolete */ quality = rng->quality; mutex_unlock(&reading_mutex); + + if (rc <= 0) + hwrng_msleep(rng, 10000); + put_rng(rng); if (!quality) break; - if (rc <= 0) { - pr_warn("hwrng: no data available\n"); - msleep_interruptible(10000); + if (rc <= 0) continue; - } /* If we cannot credit at least one bit of entropy, * keep track of the remainder for the next iteration @@ -570,6 +571,7 @@ int hwrng_register(struct hwrng *rng) init_completion(&rng->cleanup_done); complete(&rng->cleanup_done); + init_completion(&rng->dying); if (!current_rng || (!cur_rng_set_by_user && rng->quality > current_rng->quality)) { @@ -617,6 +619,7 @@ void hwrng_unregister(struct hwrng *rng) old_rng = current_rng; list_del(&rng->list); + complete_all(&rng->dying); if (current_rng == rng) { err = enable_best_rng(); if (err) { @@ -685,6 +688,14 @@ void devm_hwrng_unregister(struct device } EXPORT_SYMBOL_GPL(devm_hwrng_unregister); +long hwrng_msleep(struct hwrng *rng, unsigned int msecs) +{ + unsigned long timeout = msecs_to_jiffies(msecs) + 1; + + return wait_for_completion_interruptible_timeout(&rng->dying, timeout); +} +EXPORT_SYMBOL_GPL(hwrng_msleep); + static int __init hwrng_modinit(void) { int ret; --- a/drivers/net/wireless/ath/ath9k/rng.c +++ b/drivers/net/wireless/ath/ath9k/rng.c @@ -83,7 +83,8 @@ static int ath9k_rng_read(struct hwrng * if (!wait || !max || likely(bytes_read) || fail_stats > 110) break; - msleep_interruptible(ath9k_rng_delay_get(++fail_stats)); + if (hwrng_msleep(rng, ath9k_rng_delay_get(++fail_stats))) + break; } if (wait && !bytes_read && max) --- a/include/linux/hw_random.h +++ b/include/linux/hw_random.h @@ -50,6 +50,7 @@ struct hwrng { struct list_head list; struct kref ref; struct completion cleanup_done; + struct completion dying; }; struct device; @@ -61,4 +62,6 @@ extern int devm_hwrng_register(struct de extern void hwrng_unregister(struct hwrng *rng); extern void devm_hwrng_unregister(struct device *dve, struct hwrng *rng); +extern long hwrng_msleep(struct hwrng *rng, unsigned int msecs); + #endif /* LINUX_HWRANDOM_H_ */ From patchwork Wed Oct 19 08:23: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: 5377 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp301759wrs; Wed, 19 Oct 2022 05:37:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6QIhoAvMrAWiQFiPGhTIbIJz54/aF+jLcnlu1qrsrTAUf4eLGzKdJivzLnZE/Ev0Am6X6s X-Received: by 2002:a63:4b4c:0:b0:45a:5f8:b49d with SMTP id k12-20020a634b4c000000b0045a05f8b49dmr7043904pgl.490.1666183023619; Wed, 19 Oct 2022 05:37:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666183023; cv=none; d=google.com; s=arc-20160816; b=QxnSsqWuqlWXCwc1aqx1qayU+UOlp4Wc3ziQGWDUi4R1AKMaf9KSMsytWEf4VbILPw FptpFBTYnXC7C+rXgfimibTXsNL0H5FZHNbgcuWij7kbDxyW2davHHPi9uqvS1SMEyKT OqwdwApaUD7T+BSxo7NegH7iua4VPJpgi23fpDCbZi+K4YvfIC8aZSqmW1dquDE/wLFr jo3o0U6GBPAjEJzqvBdGid4LLmFOnIlijcoL0ej1kWg/lgVMlxpBo/nbRJVzl9wDW4Ke ph+X+iUMwVJ9x+zV3oc5z1Xzt4JXG6CtxZyWRt3AfNUUVpF9BvROEPFg/zh9/yNXpnw8 DIkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/m+bPkYFDhxTAVoVZH15g7IeRfWWQEE7DW0mzVWzYxI=; b=MDnBYRiqnv42chIuhcxp7W6x2flmd+KOBwpXMj1xKWcbWQZ/bZJBDP+lhVKcCmihMm q1nT+77stR5Yh++sfd5OBcZhlSxMOAI7lvGCECEBAnqfTcSnG+MdR5p3AI7XgHx/LbCM TjS+mWyuW7RWCCMJaq0iMn/6Kmd0SMsaExr7cuP0yNBHQoJWeKYSU/lx2DcpP7WAZb3L 6M69yjcykSNgRSyCii39Ztg/1CBdtXuUKRjFJ/zgEBzFVevGClh6eAr3fIUnDkD9vf7i 3vVzS3F6rWlyIal3ugxuYf4vaWWYK8YyApcLgb3za7gD/IOJ4ArtAq2xTfihdG5FC4mC OT1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="OJ/CgzVz"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q22-20020aa79616000000b0052f0fa0c853si17018861pfg.241.2022.10.19.05.36.50; Wed, 19 Oct 2022 05:37: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="OJ/CgzVz"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232312AbiJSMZe (ORCPT + 99 others); Wed, 19 Oct 2022 08:25:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231844AbiJSMXq (ORCPT ); Wed, 19 Oct 2022 08:23:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2080BCEE; Wed, 19 Oct 2022 04:59:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id F1EA3B822BE; Wed, 19 Oct 2022 08:44:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26FB4C433D6; Wed, 19 Oct 2022 08:44:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169043; bh=nXTuNXaZwwPkGR8X7HBy7kT4bpr0qsxJ+m6iQRJt0Jc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OJ/CgzVzmTuUGcSUJR+21W3S9vTFQ5YczvFAh3z+3KoaE7UZYSU/4X1cWsvErxNiF NFi8fxJeelXW+mhR81K7OnW9wuPo1RbJr4jGKUm1o9jCMv7nDu1ihJic9wc+FEAaw6 LCFDROB4fddIN5p/dy0ohj0ocxixHl5eWsoBjB2g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Paulo Alcantara (SUSE)" , Steve French Subject: [PATCH 6.0 112/862] smb3: do not log confusing message when server returns no network interfaces Date: Wed, 19 Oct 2022 10:23:19 +0200 Message-Id: <20221019083254.876455274@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747119529881094813?= X-GMAIL-MSGID: =?utf-8?q?1747119529881094813?= From: Steve French commit 4659f01e3cd94f64d9bd06764ace2ef8fe1b6227 upstream. Some servers can return an empty network interface list so, unless multichannel is requested, no need to log an error for this, and when multichannel is requested on mount but no interfaces, log something less confusing. For this case change parse_server_interfaces: malformed interface info to empty network interface list returned by server localhost Also do not relog this error every ten minutes (only log on mount, once) Cc: Reviewed-by: Paulo Alcantara (SUSE) Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- fs/cifs/cifsproto.h | 2 +- fs/cifs/connect.c | 2 +- fs/cifs/smb2ops.c | 23 ++++++++++++++++++----- 3 files changed, 20 insertions(+), 7 deletions(-) --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h @@ -639,7 +639,7 @@ cifs_chan_is_iface_active(struct cifs_se int cifs_chan_update_iface(struct cifs_ses *ses, struct TCP_Server_Info *server); int -SMB3_request_interfaces(const unsigned int xid, struct cifs_tcon *tcon); +SMB3_request_interfaces(const unsigned int xid, struct cifs_tcon *tcon, bool in_mount); void extract_unc_hostname(const char *unc, const char **h, size_t *len); int copy_path_name(char *dst, const char *src); --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -155,7 +155,7 @@ static void smb2_query_server_interfaces /* * query server network interfaces, in case they change */ - rc = SMB3_request_interfaces(0, tcon); + rc = SMB3_request_interfaces(0, tcon, false); if (rc) { cifs_dbg(FYI, "%s: failed to query server interfaces: %d\n", __func__, rc); --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c @@ -512,8 +512,7 @@ smb3_negotiate_rsize(struct cifs_tcon *t static int parse_server_interfaces(struct network_interface_info_ioctl_rsp *buf, - size_t buf_len, - struct cifs_ses *ses) + size_t buf_len, struct cifs_ses *ses, bool in_mount) { struct network_interface_info_ioctl_rsp *p; struct sockaddr_in *addr4; @@ -543,6 +542,20 @@ parse_server_interfaces(struct network_i } spin_unlock(&ses->iface_lock); + /* + * Samba server e.g. can return an empty interface list in some cases, + * which would only be a problem if we were requesting multichannel + */ + if (bytes_left == 0) { + /* avoid spamming logs every 10 minutes, so log only in mount */ + if ((ses->chan_max > 1) && in_mount) + cifs_dbg(VFS, + "empty network interface list returned by server %s\n", + ses->server->hostname); + rc = -EINVAL; + goto out; + } + while (bytes_left >= sizeof(*p)) { memset(&tmp_iface, 0, sizeof(tmp_iface)); tmp_iface.speed = le64_to_cpu(p->LinkSpeed); @@ -673,7 +686,7 @@ out: } int -SMB3_request_interfaces(const unsigned int xid, struct cifs_tcon *tcon) +SMB3_request_interfaces(const unsigned int xid, struct cifs_tcon *tcon, bool in_mount) { int rc; unsigned int ret_data_len = 0; @@ -693,7 +706,7 @@ SMB3_request_interfaces(const unsigned i goto out; } - rc = parse_server_interfaces(out_buf, ret_data_len, ses); + rc = parse_server_interfaces(out_buf, ret_data_len, ses, in_mount); if (rc) goto out; @@ -729,7 +742,7 @@ smb3_qfs_tcon(const unsigned int xid, st if (rc) return; - SMB3_request_interfaces(xid, tcon); + SMB3_request_interfaces(xid, tcon, true /* called during mount */); SMB2_QFS_attr(xid, tcon, fid.persistent_fid, fid.volatile_fid, FS_ATTRIBUTE_INFORMATION); From patchwork Wed Oct 19 08:23: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: 5354 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp297207wrs; Wed, 19 Oct 2022 05:28:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM498NIG0JdTlClph8IaynjW5kXrtitj0UbUOxTlCvhgezrb59ijPk6hr49RV1U05fjxtTp+ X-Received: by 2002:a17:902:9b82:b0:183:fffb:1bfe with SMTP id y2-20020a1709029b8200b00183fffb1bfemr8262054plp.173.1666182516798; Wed, 19 Oct 2022 05:28:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666182516; cv=none; d=google.com; s=arc-20160816; b=Y0A8dNNWicuIzqKrDBg682geE3B6RQG24djOOpKVbu0XxLBUsdbs+wUrzbl5AyVybg aQnxcGneLY8BfzpQwGSLnqyLUtLtmJUFQFuOm8yFWVQBJXm7iZYPtlsdiLjlGBf5dvjc VoyppQl1uxIYPyj9rP2opX8co+KhzL86kDNkal5KPP7q78/mqzfKvCDGQrvuF0W7WJ2u 20G6ruxRQIYNEXwbNtfyTekI5TMWBEOoXhmsai8nm1HQvzA/u8N5v9Va9qTAw8MHfedt FeckrVeoLE2xGIfqWcC4utkT4q4Co2OTW43vKtb+0q/Tq/agxR+nUpbbrYFY4Slk6bgx gAbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=S5xSSGh7EJ6oAJETeInC6CrJLz3f2vN3RwUFl3HvtN4=; b=eKSEJc3BAbcukcX4TlqAqeP/I7etyteACA5IsYxK5ORKe8KJ/06KdlS+Tf2j8rp4bp //YFMvuffNa/A3uU98JJ+SSI91r4RKnT5z0Mvl1yaACqGNDEguU5T8XYOt1Dhxxjea8p Qyd/n4PZkDJev2XAucLilHx5KKgmyPQofxiTQBAp2PPDCJEwYj6DT+6x0Aeh0w89bx2v 0jMCS/r8e+6oKTCCnckvTC68tC2yd3btKK8jWZT3N43x9cGjYmidtsCj9mjp+WwmuGbb gyKwIzljKOXn9YDuG4cvgAv8e7fUprn58Io7rq7VLFoyOT2ySO1RoKbiCtxEi0/lZrBw HG0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1w0wdQP1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q14-20020a17090311ce00b001789fa8f90esi20935314plh.408.2022.10.19.05.28.22; Wed, 19 Oct 2022 05:28: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=1w0wdQP1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229993AbiJSMTN (ORCPT + 99 others); Wed, 19 Oct 2022 08:19:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232902AbiJSMST (ORCPT ); Wed, 19 Oct 2022 08:18:19 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E00AFFF223; Wed, 19 Oct 2022 04:53: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 EF687B822CE; Wed, 19 Oct 2022 08:44:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5408FC433D6; Wed, 19 Oct 2022 08:44:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169075; bh=rCyFVxv5D3nRejcezEL/j3R7yTl+gDdfILEu0MAjraw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1w0wdQP1vfGdVGhprDeEd14L0lB5Cv//SNYkZWTX6uyA6sOLQ8TEm5EonU2N36Qmf J6jMFObN+6Liy/L+GzN3POwGMGlvqi1BGhi/2RrbswEOpTdPtUq3U8X1x5W6GmK2uN 6a9ttUgsd7wyElex7kHOngXqTZFy5JnPvjpD1cxo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hyunchul Lee , Namjae Jeon , Steve French Subject: [PATCH 6.0 113/862] ksmbd: fix incorrect handling of iterate_dir Date: Wed, 19 Oct 2022 10:23:20 +0200 Message-Id: <20221019083254.912900126@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747118998859875043?= X-GMAIL-MSGID: =?utf-8?q?1747118998859875043?= From: Namjae Jeon commit 88541cb414b7a2450c45fc9c131b37b5753b7679 upstream. if iterate_dir() returns non-negative value, caller has to treat it as normal and check there is any error while populating dentry information. ksmbd doesn't have to do anything because ksmbd already checks too small OutputBufferLength to store one file information. And because ctx->pos is set to file->f_pos when iterative_dir is called, remove restart_ctx(). And if iterate_dir() return -EIO, which mean directory entry is corrupted, return STATUS_FILE_CORRUPT_ERROR error response. This patch fixes some failure of SMB2_QUERY_DIRECTORY, which happens when ntfs3 is local filesystem. Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3") Cc: stable@vger.kernel.org Signed-off-by: Hyunchul Lee Signed-off-by: Namjae Jeon Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- fs/ksmbd/smb2pdu.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) --- a/fs/ksmbd/smb2pdu.c +++ b/fs/ksmbd/smb2pdu.c @@ -3808,11 +3808,6 @@ static int __query_dir(struct dir_contex return 0; } -static void restart_ctx(struct dir_context *ctx) -{ - ctx->pos = 0; -} - static int verify_info_level(int info_level) { switch (info_level) { @@ -3921,7 +3916,6 @@ int smb2_query_dir(struct ksmbd_work *wo if (srch_flag & SMB2_REOPEN || srch_flag & SMB2_RESTART_SCANS) { ksmbd_debug(SMB, "Restart directory scan\n"); generic_file_llseek(dir_fp->filp, 0, SEEK_SET); - restart_ctx(&dir_fp->readdir_data.ctx); } memset(&d_info, 0, sizeof(struct ksmbd_dir_info)); @@ -3968,11 +3962,9 @@ int smb2_query_dir(struct ksmbd_work *wo */ if (!d_info.out_buf_len && !d_info.num_entry) goto no_buf_len; - if (rc == 0) - restart_ctx(&dir_fp->readdir_data.ctx); - if (rc == -ENOSPC) + if (rc > 0 || rc == -ENOSPC) rc = 0; - if (rc) + else if (rc) goto err_out; d_info.wptr = d_info.rptr; @@ -4029,6 +4021,8 @@ err_out2: rsp->hdr.Status = STATUS_NO_MEMORY; else if (rc == -EFAULT) rsp->hdr.Status = STATUS_INVALID_INFO_CLASS; + else if (rc == -EIO) + rsp->hdr.Status = STATUS_FILE_CORRUPT_ERROR; if (!rsp->hdr.Status) rsp->hdr.Status = STATUS_UNEXPECTED_IO_ERROR; From patchwork Wed Oct 19 08:23: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: 5370 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp300182wrs; Wed, 19 Oct 2022 05:33:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM70GPz2vhdEhYVRCpmVJ/icVEsTOm8Rfe3onjNqAzR6oTVU17xpcrCcOxHzLoFUykPwSXA6 X-Received: by 2002:a17:90a:65c7:b0:20f:8385:cc18 with SMTP id i7-20020a17090a65c700b0020f8385cc18mr9259249pjs.235.1666182829066; Wed, 19 Oct 2022 05:33:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666182829; cv=none; d=google.com; s=arc-20160816; b=qBTZITJve6MH+dqNTY/nfmzjMJlySK0zhYQhqlBAxEUEa535glDqEw2UkgMIQ9mK1r UQRyMWPaHXf/0FqtP3bVJ4jzHHaU1onetcvIejKT4QHIldyrZBKbh+ArHC+gPYxWSmGu dWdMgJfoOYyjnKBljaUIz3EAFXJWNtIOy43fCIC0BSi82LGDSfjehUHfzkYugxWsufKC t0x6iVLKzm7IAxlT3w/VaeBxiXfSlHSvWkbQsSUfvO163cNCOWhoR/ioHCkHIfLyqQTX bv/Z3OIzE7VUfJ9Hck6jfwpkWrAGOONIQilPXDJk96qpfk4yZN1bfXelfp8xNpNsPUtE KSYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=iJS7MwxQ9hIcrf6M5uMCoLuKq8Zs+DwMksVPZEeRhzQ=; b=glXiiPjqUWOzFUkRPfEDJqE6ASYxwcDlJ+uIOFdclLBt/2XS2fOjLdHtnl1ehHLiA5 /HKQPssBO/k3fmEIwfQN6UpDXvpT40fap4Hne5nADQItD+sGYuOBHpWduvZvF4BzJJAT HLiwUZpzrjc8oKk8PHDv9JaOX5TlCT+pNnyY0FI0sbostM+uDdblsPMEX1k6IIi/Y/qo /LXCXGhdulm2c2cQegzbeMaJ9iqy/RsSop+XCfGRxl6ZTyZmztL1Hk9nfcNRmk+u6VPT msCEBxrvuqJlPr3584z/Bn5AOkaeOT2HYKO9Uv6eUj0Yc17DmpJ1P8miBiFz0UJZvUeC 7bLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nY1BTvoM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s5-20020a656445000000b0043a256f5b17si20313257pgv.555.2022.10.19.05.33.32; Wed, 19 Oct 2022 05:33: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=nY1BTvoM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229751AbiJSMUD (ORCPT + 99 others); Wed, 19 Oct 2022 08:20:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233149AbiJSMTG (ORCPT ); Wed, 19 Oct 2022 08:19:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECCCC17652D; Wed, 19 Oct 2022 04:54:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 036DEB822F5; Wed, 19 Oct 2022 08:44:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4CE04C433C1; Wed, 19 Oct 2022 08:44:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169081; bh=wQtvt0pQYSjjl8y2IQ9Sln7QvAgF+4ZI5oQv0B0dNBc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nY1BTvoMq3KBe5g7ohGAcEyDy56lD/TtLtrkvhqDraN0SrObSjf1M1qn/pGQ7LZPf UH75JLXSBCjtKA4gdDg+Jz6Y7uV5cZ+7nh2edThrrzrSMyDHxblpX/tIUNpgzDZCSM BtPElBDo3SUGnALIeX4wIQ7ogxTP1tQbDbFJkcpA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Namjae Jeon , Steve French Subject: [PATCH 6.0 114/862] ksmbd: fix endless loop when encryption for response fails Date: Wed, 19 Oct 2022 10:23:21 +0200 Message-Id: <20221019083254.960703263@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747119326464669705?= X-GMAIL-MSGID: =?utf-8?q?1747119326464669705?= From: Namjae Jeon commit 360c8ee6fefdb496fffd2c18bb9a96a376a1a804 upstream. If ->encrypt_resp return error, goto statement cause endless loop. It send an error response immediately after removing it. Fixes: 0626e6641f6b ("cifsd: add server handler for central processing and tranport layers") Cc: stable@vger.kernel.org Signed-off-by: Namjae Jeon Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- fs/ksmbd/server.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) --- a/fs/ksmbd/server.c +++ b/fs/ksmbd/server.c @@ -235,10 +235,8 @@ send: if (work->sess && work->sess->enc && work->encrypted && conn->ops->encrypt_resp) { rc = conn->ops->encrypt_resp(work); - if (rc < 0) { + if (rc < 0) conn->ops->set_rsp_status(work, STATUS_DATA_ERROR); - goto send; - } } ksmbd_conn_write(work); From patchwork Wed Oct 19 08:23: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: 4666 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212732wrs; Wed, 19 Oct 2022 02:08:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM77hMUhXvIOgpKw73HlQTDD0OW55f5Y5MuO/aUWy3LQdCc7Y1hrq2iTwW+l/bOYn2eOypDu X-Received: by 2002:a05:6402:191:b0:45c:83e8:d74a with SMTP id r17-20020a056402019100b0045c83e8d74amr6184401edv.329.1666170490116; Wed, 19 Oct 2022 02:08:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170490; cv=none; d=google.com; s=arc-20160816; b=X1gCa+6YpL4wfW+rk89d+eviuxf24yLU/autT9G9iLfyW1omXwkwITRbifXFSDPz+h BK+vQfynYZGwmaWeL1xHVT7UhEPIOoSai8M6cdtyAdBySt7J0i2/eHMa96eAGW6B8vIG 3t7hudFID6gFwy70ynsYKhGNsLHmgFGcbKjjaBUPp/FDvQ/TGSgmHWECdoZmhJKxeczi NXUZmpdQopJ/iuJ5Z2t3CvJJm56VUb5o9lotv8SOBzf2j77VNpySaD4uPASSZvQXXsP0 ngOdhjg/arcdW802soZOZCfo3vpPLdjNCQvMPVFzADkWzfFwQAUoTdUNlyuqZFS0xlgW ByNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kE+X+6FQZ75dxph1EdCGoQ7Qv4C7WdvNn2FYbYq+uU0=; b=a0EJNRR4UcQu7Fmius3E40rGltIASqhwVHvmZOoeP99AGfc1zm+mMAgx5Q8io+KlCl 60PJPTGUTn3/eB/IDutlb1nYg814tU9j63RlMIiSXsmaSRjkU6EOpzApldbIvfgj4Pya VPMm+ngZQTWdbNuEpkPF23e51Gssph8shE1huhY7pG85IDazhWgxhCgJwuFVGltfHG7y sRLQwUnZtLGZ0cmcpFY8Wv8GP6tOnGHO9Nw8nvwYJcwYgbGyEV85K+cgFXI34fEK2RLB 5XoWEZFuZjDMa4m7AcH3k5U2r7FE5vtqyIYXrHVPxchtAImaK3m9h5GE/Vxm1g9CURas qDZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Xl8RRCII; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a17090797ca00b0078e20d9c473si9754334ejc.764.2022.10.19.02.07.39; Wed, 19 Oct 2022 02:08: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=Xl8RRCII; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232107AbiJSJA2 (ORCPT + 99 others); Wed, 19 Oct 2022 05:00:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231906AbiJSI6t (ORCPT ); Wed, 19 Oct 2022 04:58: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 59EB843E43; Wed, 19 Oct 2022 01:54: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 58624617E8; Wed, 19 Oct 2022 08:44:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4ED72C433C1; Wed, 19 Oct 2022 08:44:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169084; bh=OBlb9A85he6sARMUUbOjdvnk9qFh1qtp/xfhmiEDpJY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xl8RRCIIvIYid5yF/2s4Scj3dxwawRb3B1s1D1UWqhLgnsv8sOuNa2Lf3zAbjKwAp O8XKzTiiw+p1tPu0cXpPM4c8wF/VSEHIisotsAC6zGTUGYnF7dzWAfmRvF2A9poJDo qgI6Low9pN8aXDVX8rJqDF9Owz2wwCDq/SlyYUDs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Xiaoxu , Namjae Jeon , Steve French Subject: [PATCH 6.0 115/862] ksmbd: Fix wrong return value and message length check in smb2_ioctl() Date: Wed, 19 Oct 2022 10:23:22 +0200 Message-Id: <20221019083255.008168069@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106387994976350?= X-GMAIL-MSGID: =?utf-8?q?1747106387994976350?= From: Zhang Xiaoxu commit b1763d265af62800ec96eeb79803c4c537dcef3a upstream. Commit c7803b05f74b ("smb3: fix ksmbd bigendian bug in oplock break, and move its struct to smbfs_common") use the defination of 'struct validate_negotiate_info_req' in smbfs_common, the array length of 'Dialects' changed from 1 to 4, but the protocol does not require the client to send all 4. This lead the request which satisfied with protocol and server to fail. So just ensure the request payload has the 'DialectCount' in smb2_ioctl(), then fsctl_validate_negotiate_info() will use it to validate the payload length and each dialect. Also when the {in, out}_buf_len is less than the required, should goto out to initialize the status in the response header. Fixes: f7db8fd03a4b ("ksmbd: add validation in smb2_ioctl") Cc: stable@vger.kernel.org Signed-off-by: Zhang Xiaoxu Acked-by: Namjae Jeon Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- fs/ksmbd/smb2pdu.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) --- a/fs/ksmbd/smb2pdu.c +++ b/fs/ksmbd/smb2pdu.c @@ -7637,11 +7637,16 @@ int smb2_ioctl(struct ksmbd_work *work) goto out; } - if (in_buf_len < sizeof(struct validate_negotiate_info_req)) - return -EINVAL; + if (in_buf_len < offsetof(struct validate_negotiate_info_req, + Dialects)) { + ret = -EINVAL; + goto out; + } - if (out_buf_len < sizeof(struct validate_negotiate_info_rsp)) - return -EINVAL; + if (out_buf_len < sizeof(struct validate_negotiate_info_rsp)) { + ret = -EINVAL; + goto out; + } ret = fsctl_validate_negotiate_info(conn, (struct validate_negotiate_info_req *)&req->Buffer[0], From patchwork Wed Oct 19 08:23: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: 5541 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp348459wrs; Wed, 19 Oct 2022 07:10:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6wuaN1jRrHGR6+Fup/ARERGmU6sKuXu2reuNlqqkp0CMB0np44PdRohOCVk5KgSNM/cI28 X-Received: by 2002:a17:90b:2705:b0:20a:b25d:5d93 with SMTP id px5-20020a17090b270500b0020ab25d5d93mr45703087pjb.218.1666188609222; Wed, 19 Oct 2022 07:10:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666188609; cv=none; d=google.com; s=arc-20160816; b=yrtERNEIByosYVxHiJ6iYe934EqpD6JbcrmXLSnyAtphW17UKg1XANUJ9N54lhkvw/ 9pLFLRd0g5qAkb55OrYLkgGz5TExJA5YvHE1OrI/XjB1zbj9NFI5WymAggo6pxAO9UWi UhmesT1gY9Ki5YdEQt5jYGKxL8yKadyXzuKqEtuxC+SNCcvkNCtoxW4+ueB0J1zFXSmB icltR02JTUMxEVVvHsvlXXU7hF9DESaCR6PrO/SuHQQgALxXBMk7hY3vu7KWcx4wYhLx ltAW+G6aZQW596NR2ur2JtLslTVCgFJsQ+gehL5vBYsivor0eXxuotIhQQ63PNaXz41y zNCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YQY9nhnTBw4kViPNm7NRI6QgE4+DWnEhqy0h21WYqik=; b=RIRAPL/bJztun3+OJ/Ex/sRwoAqSeNPvrrqJKJ92Y8XxfS+QSwHeVK15RWBwFhIMQH xEPKllD5yyBIa+/zUlEzDH/3MejW+Z+Q2KhLlSR1OcPAaqtcbmWS3aRe7OHWzpmyvRBC E0+AkbLpHCXzFUpCb5YdhZieE7dTbg8FMsJ2+oEIvAPEddSho6OO6BJEfqADowLj+Zlh 3NomUnxJNmpXiw4qOS6WeVfNsIUEIv/Z1sU7v6dE8g2M/fU4EUDBCjyZTCfqifUS6Cjg U64R2J9jBtgMSjRKCTIG3sUT+5OQ1qqQYvDqJRPtZNTvntTC0JDTyD/3W6yB99lYldnP qZhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nQhVd5fn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g8-20020a1709026b4800b001784c98bfddsi17159767plt.24.2022.10.19.07.09.44; Wed, 19 Oct 2022 07:10: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=nQhVd5fn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231559AbiJSNwk (ORCPT + 99 others); Wed, 19 Oct 2022 09:52:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233180AbiJSNwG (ORCPT ); Wed, 19 Oct 2022 09:52:06 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1D10106A75; Wed, 19 Oct 2022 06:35: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 523E1CE20EF; Wed, 19 Oct 2022 08:44:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 499DEC433D7; Wed, 19 Oct 2022 08:44:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169087; bh=zRbI9r4T8ATwG60e0stmIJjCAwfIsLK3ZdgJqhNquO4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nQhVd5fnzuNumD7Ikg/PmTRpQkUqsLbwreGVl03cA/CScDGMcysinwkcD4bimUZWE A1J370Y0HH0HTQDyFThxC5piP9arJDvmiwW08BPVQZf16nDMN0xTBdvfXtUQUlcAlv FkAFLDQBS/K3f0ErGqWBx5ji6PFxhJMGbKkrkQs0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hyunchul Lee , Steve French , =?utf-8?q?Micka=C3=ABl_Sala=C3=BCn?= , "Christian Brauner (Microsoft)" , Namjae Jeon , Steve French Subject: [PATCH 6.0 116/862] ksmbd: Fix user namespace mapping Date: Wed, 19 Oct 2022 10:23:23 +0200 Message-Id: <20221019083255.053626341@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747125387306227257?= X-GMAIL-MSGID: =?utf-8?q?1747125387306227257?= From: Mickaël Salaün commit 7c88c1e0ab1704bacb751341ee6431c3be34b834 upstream. A kernel daemon should not rely on the current thread, which is unknown and might be malicious. Before this security fix, ksmbd_override_fsids() didn't correctly override FS UID/GID which means that arbitrary user space threads could trick the kernel to impersonate arbitrary users or groups for file system access checks, leading to file system access bypass. This was found while investigating truncate support for Landlock: https://lore.kernel.org/r/CAKYAXd8fpMJ7guizOjHgxEyyjoUwPsx3jLOPZP=wPYcbhkVXqA@mail.gmail.com Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3") Cc: Hyunchul Lee Cc: Steve French Cc: stable@vger.kernel.org Signed-off-by: Mickaël Salaün Link: https://lore.kernel.org/r/20220929100447.108468-1-mic@digikod.net Acked-by: Christian Brauner (Microsoft) Acked-by: Namjae Jeon Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- fs/ksmbd/smb_common.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/fs/ksmbd/smb_common.c +++ b/fs/ksmbd/smb_common.c @@ -4,6 +4,8 @@ * Copyright (C) 2018 Namjae Jeon */ +#include + #include "smb_common.h" #include "server.h" #include "misc.h" @@ -625,8 +627,8 @@ int ksmbd_override_fsids(struct ksmbd_wo if (!cred) return -ENOMEM; - cred->fsuid = make_kuid(current_user_ns(), uid); - cred->fsgid = make_kgid(current_user_ns(), gid); + cred->fsuid = make_kuid(&init_user_ns, uid); + cred->fsgid = make_kgid(&init_user_ns, gid); gi = groups_alloc(0); if (!gi) { From patchwork Wed Oct 19 08:23: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: 4646 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212302wrs; Wed, 19 Oct 2022 02:07:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4uFd4V1xwqUd1nvyvjrxPEb+DHy/LVm8bFUNy7KAEXZCN06zNvxWuY8vG9KEo3KHGQOB4u X-Received: by 2002:a05:6402:35d6:b0:45d:a52f:2d30 with SMTP id z22-20020a05640235d600b0045da52f2d30mr6297226edc.4.1666170431741; Wed, 19 Oct 2022 02:07:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170431; cv=none; d=google.com; s=arc-20160816; b=dNz3o4MLctjoSMXgpfL/oYj81sm0YarRUFDMeWBI0j6pKtVXgodTsxwXnHRGeFeDmM RftWsSowHU7lJhcASHqIG7Ws1bjg8icyT8/PwEIvut9rqp6ektLhigi/CX9QBwpBm5AA eD+59zJxHu7aDFfETSiX8psWBddXxvtJV2UITzenTzXcSfxl46VSnTvC7jHns0iqyLu5 UvjwcEo/LmrWT7JdpmuanDQUCbnn6v6qDovRir7fSXwOwdqRhTTVL+kWqOupimLuD1tJ TIzcGKgf1BE8t5XJt2q+Doaq7OwvXC4jAOQhKtpH/6sIo6zVXUMRuUmQxnnb8bPcxgnx hy6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FUUr0Qlt7hYTqgTKfOJuut4YLETR5WS7/dha8mCvnLE=; b=gDNu9gkimVvUoBFl0+iOGbMCmlWl/2vKDgtC7fnnxX7QFQUSn2//lhCaiKLgMkTl3P uB2mNdn0gG345WPdMeUyZaN+oRMHLp5kyidIX1lj+TFMQP1m+ymDA3tI0ewDsrotIGhd DZrCcbpZLkAdiYLKQiFBaUCWa3KpkWmVPXnEKHwHUOEoRbK2XZTDg+IuQgHulDMR43X9 CtARLXr5mXb84JJpNOQAQJtILpN4ItyaJFahzQzbNM5qJHmiirDEAQTxEWEdBnnEOP7v YCz6+YN5sYNuJc+vZ1Hj+5TtxRg9tf1qlJUJIZ1JtQyiM8+MOUbNLvUxJtLFp+/zrUA+ 3adw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XBpbiehe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170906794f00b0078333d9f17bsi15280825ejo.819.2022.10.19.02.06.36; Wed, 19 Oct 2022 02:07: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=XBpbiehe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232070AbiJSI6w (ORCPT + 99 others); Wed, 19 Oct 2022 04:58:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231938AbiJSI6B (ORCPT ); Wed, 19 Oct 2022 04:58: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 199D680BE7; Wed, 19 Oct 2022 01: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 2F7BF61800; Wed, 19 Oct 2022 08:44:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28BEFC433D6; Wed, 19 Oct 2022 08:44:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169090; bh=kyWJbLX5IZoPor/V37NkIqdnA8I8o9U7fHnsxdgV1w0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XBpbiehebo4hY+a58htAWSaDChH6u5TvVMLzKJ7FT782ZhvCDcdd/3aYZwX7d/14f lRCd541+RtLPuqOcOCYkl/MTQ4H9GvPsCkzfYhKcn5lmoiPA5EX1BVKeHfvjspUyM4 YtmWS542xKLsT/8t+y8e2igzKa494FghECC8fl6o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Chinner , Christoph Hellwig , stable@kernel.org, Lukas Czerner , Jan Kara , Theodore Tso Subject: [PATCH 6.0 117/862] fs: record I_DIRTY_TIME even if inode already has I_DIRTY_INODE Date: Wed, 19 Oct 2022 10:23:24 +0200 Message-Id: <20221019083255.107766512@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106326745118772?= X-GMAIL-MSGID: =?utf-8?q?1747106326745118772?= From: Lukas Czerner commit cbfecb927f429a6fa613d74b998496bd71e4438a upstream. Currently the I_DIRTY_TIME will never get set if the inode already has I_DIRTY_INODE with assumption that it supersedes I_DIRTY_TIME. That's true, however ext4 will only update the on-disk inode in ->dirty_inode(), not on actual writeback. As a result if the inode already has I_DIRTY_INODE state by the time we get to __mark_inode_dirty() only with I_DIRTY_TIME, the time was already filled into on-disk inode and will not get updated until the next I_DIRTY_INODE update, which might never come if we crash or get a power failure. The problem can be reproduced on ext4 by running xfstest generic/622 with -o iversion mount option. Fix it by allowing I_DIRTY_TIME to be set even if the inode already has I_DIRTY_INODE. Also make sure that the case is properly handled in writeback_single_inode() as well. Additionally changes in xfs_fs_dirty_inode() was made to accommodate for I_DIRTY_TIME in flag. Thanks Jan Kara for suggestions on how to make this work properly. Cc: Dave Chinner Cc: Christoph Hellwig Cc: stable@kernel.org Signed-off-by: Lukas Czerner Suggested-by: Jan Kara Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220825100657.44217-1-lczerner@redhat.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- Documentation/filesystems/vfs.rst | 3 +++ fs/fs-writeback.c | 37 +++++++++++++++++++++++++------------ fs/xfs/xfs_super.c | 10 ++++++++-- include/linux/fs.h | 9 +++++---- 4 files changed, 41 insertions(+), 18 deletions(-) --- a/Documentation/filesystems/vfs.rst +++ b/Documentation/filesystems/vfs.rst @@ -274,6 +274,9 @@ or bottom half). This is specifically for the inode itself being marked dirty, not its data. If the update needs to be persisted by fdatasync(), then I_DIRTY_DATASYNC will be set in the flags argument. + I_DIRTY_TIME will be set in the flags in case lazytime is enabled + and struct inode has times updated since the last ->dirty_inode + call. ``write_inode`` this method is called when the VFS needs to write an inode to --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -1718,9 +1718,14 @@ static int writeback_single_inode(struct */ if (!(inode->i_state & I_DIRTY_ALL)) inode_cgwb_move_to_attached(inode, wb); - else if (!(inode->i_state & I_SYNC_QUEUED) && - (inode->i_state & I_DIRTY)) - redirty_tail_locked(inode, wb); + else if (!(inode->i_state & I_SYNC_QUEUED)) { + if ((inode->i_state & I_DIRTY)) + redirty_tail_locked(inode, wb); + else if (inode->i_state & I_DIRTY_TIME) { + inode->dirtied_when = jiffies; + inode_io_list_move_locked(inode, wb, &wb->b_dirty_time); + } + } spin_unlock(&wb->list_lock); inode_sync_complete(inode); @@ -2370,6 +2375,20 @@ void __mark_inode_dirty(struct inode *in if (flags & I_DIRTY_INODE) { /* + * Inode timestamp update will piggback on this dirtying. + * We tell ->dirty_inode callback that timestamps need to + * be updated by setting I_DIRTY_TIME in flags. + */ + if (inode->i_state & I_DIRTY_TIME) { + spin_lock(&inode->i_lock); + if (inode->i_state & I_DIRTY_TIME) { + inode->i_state &= ~I_DIRTY_TIME; + flags |= I_DIRTY_TIME; + } + spin_unlock(&inode->i_lock); + } + + /* * Notify the filesystem about the inode being dirtied, so that * (if needed) it can update on-disk fields and journal the * inode. This is only needed when the inode itself is being @@ -2378,7 +2397,8 @@ void __mark_inode_dirty(struct inode *in */ trace_writeback_dirty_inode_start(inode, flags); if (sb->s_op->dirty_inode) - sb->s_op->dirty_inode(inode, flags & I_DIRTY_INODE); + sb->s_op->dirty_inode(inode, + flags & (I_DIRTY_INODE | I_DIRTY_TIME)); trace_writeback_dirty_inode(inode, flags); /* I_DIRTY_INODE supersedes I_DIRTY_TIME. */ @@ -2399,21 +2419,15 @@ void __mark_inode_dirty(struct inode *in */ smp_mb(); - if (((inode->i_state & flags) == flags) || - (dirtytime && (inode->i_state & I_DIRTY_INODE))) + if ((inode->i_state & flags) == flags) return; spin_lock(&inode->i_lock); - if (dirtytime && (inode->i_state & I_DIRTY_INODE)) - goto out_unlock_inode; if ((inode->i_state & flags) != flags) { const int was_dirty = inode->i_state & I_DIRTY; inode_attach_wb(inode, NULL); - /* I_DIRTY_INODE supersedes I_DIRTY_TIME. */ - if (flags & I_DIRTY_INODE) - inode->i_state &= ~I_DIRTY_TIME; inode->i_state |= flags; /* @@ -2486,7 +2500,6 @@ void __mark_inode_dirty(struct inode *in out_unlock: if (wb) spin_unlock(&wb->list_lock); -out_unlock_inode: spin_unlock(&inode->i_lock); } EXPORT_SYMBOL(__mark_inode_dirty); --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -653,7 +653,7 @@ xfs_fs_destroy_inode( static void xfs_fs_dirty_inode( struct inode *inode, - int flag) + int flags) { struct xfs_inode *ip = XFS_I(inode); struct xfs_mount *mp = ip->i_mount; @@ -661,7 +661,13 @@ xfs_fs_dirty_inode( if (!(inode->i_sb->s_flags & SB_LAZYTIME)) return; - if (flag != I_DIRTY_SYNC || !(inode->i_state & I_DIRTY_TIME)) + + /* + * Only do the timestamp update if the inode is dirty (I_DIRTY_SYNC) + * and has dirty timestamp (I_DIRTY_TIME). I_DIRTY_TIME can be passed + * in flags possibly together with I_DIRTY_SYNC. + */ + if ((flags & ~I_DIRTY_TIME) != I_DIRTY_SYNC || !(flags & I_DIRTY_TIME)) return; if (xfs_trans_alloc(mp, &M_RES(mp)->tr_fsyncts, 0, 0, 0, &tp)) --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -2371,13 +2371,14 @@ static inline void kiocb_clone(struct ki * don't have to write inode on fdatasync() when only * e.g. the timestamps have changed. * I_DIRTY_PAGES Inode has dirty pages. Inode itself may be clean. - * I_DIRTY_TIME The inode itself only has dirty timestamps, and the + * I_DIRTY_TIME The inode itself has dirty timestamps, and the * lazytime mount option is enabled. We keep track of this * separately from I_DIRTY_SYNC in order to implement * lazytime. This gets cleared if I_DIRTY_INODE - * (I_DIRTY_SYNC and/or I_DIRTY_DATASYNC) gets set. I.e. - * either I_DIRTY_TIME *or* I_DIRTY_INODE can be set in - * i_state, but not both. I_DIRTY_PAGES may still be set. + * (I_DIRTY_SYNC and/or I_DIRTY_DATASYNC) gets set. But + * I_DIRTY_TIME can still be set if I_DIRTY_SYNC is already + * in place because writeback might already be in progress + * and we don't want to lose the time update * I_NEW Serves as both a mutex and completion notification. * New inodes set I_NEW. If two processes both create * the same inode, one of them will release its inode and From patchwork Wed Oct 19 08:23: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: 4655 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212549wrs; Wed, 19 Oct 2022 02:07:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5WyL8+SRtp9kP1iJsXrPZ9kb4SHidfqKC79+KWsopo3MuKx+AXpJgY+rEZNvov/vZpYCid X-Received: by 2002:a50:c31b:0:b0:458:cc93:8000 with SMTP id a27-20020a50c31b000000b00458cc938000mr6705171edb.264.1666170467029; Wed, 19 Oct 2022 02:07:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170467; cv=none; d=google.com; s=arc-20160816; b=fE3fjrdxl4303Il+vA281qKw/k7QEaoqdNNdHNZgVmsJyUFUAJhF3lCIc5/nV+dnP9 m0vqe0ZaT96PwZODELXLSoLAegHYg0BUddXcvXHmNTGtqGa6gXj8AgjP888IlbVHXaBU 0UTXf4WQb7mT2hr/uiye4mRw6gG0sNhElzmk8wIYb29JVdjRin0a2bHpXueKHkVsrlod FBU41kNVbZp1oz8fgNxTiLik3nPq6BcBTOVcfbLDUQwaoms88maXvVuwYlOSELxW19XG UDCoHWxIbqJS3D4VVvgWUftvUF6lf8QN1frx51rDMiVefOZMBoN6JsUojip0EL9VzcuL M7pQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=frgwFpIDgEaM5X2uYKASDtybz70RHmWF37vOfPa3M+I=; b=jZOj19Sgo+HV8Ndv0YRp5qzusLbd6GvHLBvVCJBPAoU2xcI/PNiREIeNHVUj7PTk0R tD1AAniq3STw8W+AWsuqvw/Qi4o1Jcmtze4+0aGA/HChAtME2wW3evurtwGqR6BQGurx Jfe6YJnfRtvoUK6sapBBLLZHj5ktlPTA75G7iwg0q8oA8rnURqMh8y6ZEbokMzkPxN3P M25DIpICK/XIBxoJaNyS8ynLnETNVmoJ8Gxd+NQT0VKKaHfkyvsiEwoZXEKpgQzJiWc1 5GpkOltUWNZxxMoYbOR/9dUOmqOvSFpHKbA4yZkT1xyFNTVZt1e8o2nLBWcsLqx9xoXO 7Beg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1TJghh2V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t8-20020a1709066bc800b0073d61f9a7b6si10841777ejs.263.2022.10.19.02.07.16; Wed, 19 Oct 2022 02:07: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=1TJghh2V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229905AbiJSJAo (ORCPT + 99 others); Wed, 19 Oct 2022 05:00:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232026AbiJSI6v (ORCPT ); Wed, 19 Oct 2022 04:58:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C610A02DD; Wed, 19 Oct 2022 01:54: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 A8C0E6181A; Wed, 19 Oct 2022 08:44:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B573CC433C1; Wed, 19 Oct 2022 08:44:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169094; bh=qWfX17P49L5XKqrAgUu3S2Ea5UyneqMUz4iGsJL8gUM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1TJghh2Vx5WeyLduLM76UPNNn4zEZlNTdFJrV3JnPdY/K4etx2oo+HxNHB4q9dW31 SrLojg5gsfqKDBkjVFPqZ2ynRGl5WeDDxfo2UYBYyGLLBUN5Dr3i3/HviQMkUuha4w MxTD5ndi62YNEbOOg7KuBTnvaYJrknUBEBlx6fPI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Zhu , David Sterba Subject: [PATCH 6.0 118/862] btrfs: fix alignment of VMA for memory mapped files on THP Date: Wed, 19 Oct 2022 10:23:25 +0200 Message-Id: <20221019083255.156973302@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106363907704038?= X-GMAIL-MSGID: =?utf-8?q?1747106363907704038?= From: Alexander Zhu commit b0c582233a8563f3c4228df838cdc67a8807ec78 upstream. With CONFIG_READ_ONLY_THP_FOR_FS, the Linux kernel supports using THPs for read-only mmapped files, such as shared libraries. However, the kernel makes no attempt to actually align those mappings on 2MB boundaries, which makes it impossible to use those THPs most of the time. This issue applies to general file mapping THP as well as existing setups using CONFIG_READ_ONLY_THP_FOR_FS. This is easily fixed by using thp_get_unmapped_area for the unmapped_area function in btrfs, which is what ext2, ext4, fuse, and xfs all use. Initially btrfs had been left out in commit 8c07fc452ac0 ("btrfs: fix alignment of VMA for memory mapped files on THP") as btrfs does not support DAX. However, commit 1854bc6e2420 ("mm/readahead: Align file mappings for non-DAX") removed the DAX requirement. We should now be able to call thp_get_unmapped_area() for btrfs. The problem can be seen in /proc/PID/smaps where THPeligible is set to 0 on mappings to eligible shared object files as shown below. Before this patch: 7fc6a7e18000-7fc6a80cc000 r-xp 00000000 00:1e 199856 /usr/lib64/libcrypto.so.1.1.1k Size: 2768 kB THPeligible: 0 VmFlags: rd ex mr mw me With this patch the library is mapped at a 2MB aligned address: fbdfe200000-7fbdfe4b4000 r-xp 00000000 00:1e 199856 /usr/lib64/libcrypto.so.1.1.1k Size: 2768 kB THPeligible: 1 VmFlags: rd ex mr mw me This fixes the alignment of VMAs for any mmap of a file that has the rd and ex permissions and size >= 2MB. The VMA alignment and THPeligible field for anonymous memory is handled separately and is thus not effected by this change. CC: stable@vger.kernel.org # 5.18+ Signed-off-by: Alexander Zhu Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman --- fs/btrfs/file.c | 1 + 1 file changed, 1 insertion(+) --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -3810,6 +3810,7 @@ const struct file_operations btrfs_file_ .mmap = btrfs_file_mmap, .open = btrfs_file_open, .release = btrfs_release_file, + .get_unmapped_area = thp_get_unmapped_area, .fsync = btrfs_sync_file, .fallocate = btrfs_fallocate, .unlocked_ioctl = btrfs_ioctl, From patchwork Wed Oct 19 08:23: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: 5461 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp331499wrs; Wed, 19 Oct 2022 06:36:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5qVrQUF9OzB/msN27Qc2uGNAghSo+VtUxbjznLzHsEGb+vkExoIfLx3xsaOAPrfcRr1YNB X-Received: by 2002:a63:5559:0:b0:464:a987:8365 with SMTP id f25-20020a635559000000b00464a9878365mr7363194pgm.479.1666186615198; Wed, 19 Oct 2022 06:36:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666186615; cv=none; d=google.com; s=arc-20160816; b=PUfgvFO7buoKFjz6F8fq2bPThKj/UUN2IgHaKsvUVIsIl2rlMy4ZQ2PUBDBuihYgUd KcMkWfCjUJcCrePZjuQj4zCAam1Lp+YSrhV1JDG/fnah6wWFDGjONPjN6RtaWjRdcMUc PLbKj7M9ncxKT/TZt5XWgBylr2I/N7JFxzCMZUhfsMeaf1GIAXFgdFdO6QuuF9/QLnoQ SSKGB0so+NGSdpZiUxyY1cIXIfQWKFYEEXdK1Z+ci+/KrHK8ZayrQvmt5Nap8kCLVuUt aswLpQPZ+iHJECweDQSGQgA8DweQSP6QBZx6VHuD9OvjGCzEUBOLQ+Wb8o6Rcoeerhbb VHyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PCEdJAFm1Dnr500SDsIn8JlXgVVr4fAqhHx+ugTW9Rg=; b=SO9X9Xf45kIfa2QbnuNfT9ePIqDiDefnikedC0WMFR2WdnolGKQJI7l4Vj+x9hevsC 3YAlyuYloeESJwpYijzdC/pmDXae6tBw+1DFVsqrxgrHGhUYwQhhnhBzPN9fnIUDHDve bfu38t7U7IxZmemGi9pG+3VLCUHqNj4A86Akvqsa27ejYrvbfWQqVuyYiHHcsmBxmFxr Zv1xRMlUDANKOA+70pS6SQ2l1wa8Tdm6+e2CFzhkUMZ1CWn6VL304JUbKA1pCGmpY0S3 KIJO7RMEtLPNzUFvE/U8yhVMgvN3vJJTRm8lTZVyQ7MT3Zd6aLDtuIIenU9lCCxApcy5 safw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZS6DktjQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lp15-20020a17090b4a8f00b00202a34035bfsi18821987pjb.78.2022.10.19.06.36.42; Wed, 19 Oct 2022 06:36: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=ZS6DktjQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231174AbiJSN0Z (ORCPT + 99 others); Wed, 19 Oct 2022 09:26:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231824AbiJSN0A (ORCPT ); Wed, 19 Oct 2022 09:26:00 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 306BC1CC74F; Wed, 19 Oct 2022 06:12: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 08DAEB822DF; Wed, 19 Oct 2022 08:43:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6638CC433D7; Wed, 19 Oct 2022 08:43:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168981; bh=+kzFWhmia5w1mBkbgYOwAljW+SBIesxD8Be950Xz91U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZS6DktjQckPJQyaeNGtVhs7oIbxEhkAc3htuYcOij7KBx0QnyVXOmpeLxTlKYMIX0 oVcsLXRtsANu42CeTiidPS5bPgd6FCFm1pmSfPqg5tBqxxDi/vt+naQhWIJg0EFQpx cdKt5xtAXCUU3POSFVj9yYiYTuHRA9g5EV5ArlbQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nikolay Borisov , Qu Wenruo , David Sterba Subject: [PATCH 6.0 119/862] btrfs: enhance unsupported compat RO flags handling Date: Wed, 19 Oct 2022 10:23:26 +0200 Message-Id: <20221019083255.205949482@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123296075938860?= X-GMAIL-MSGID: =?utf-8?q?1747123296075938860?= From: Qu Wenruo commit 81d5d61454c365718655cfc87d8200c84e25d596 upstream. Currently there are two corner cases not handling compat RO flags correctly: - Remount We can still mount the fs RO with compat RO flags, then remount it RW. We should not allow any write into a fs with unsupported RO flags. - Still try to search block group items In fact, behavior/on-disk format change to extent tree should not need a full incompat flag. And since we can ensure fs with unsupported RO flags never got any writes (with above case fixed), then we can even skip block group items search at mount time. This patch will enhance the unsupported RO compat flags by: - Reject read-write remount if there are unsupported RO compat flags - Go dummy block group items directly for unsupported RO compat flags In fact, only changes to chunk/subvolume/root/csum trees should go incompat flags. The latter part should allow future change to extent tree to be compat RO flags. Thus this patch also needs to be backported to all stable trees. CC: stable@vger.kernel.org # 4.9+ Reviewed-by: Nikolay Borisov Signed-off-by: Qu Wenruo Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman --- fs/btrfs/block-group.c | 11 ++++++++++- fs/btrfs/super.c | 9 +++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) --- a/fs/btrfs/block-group.c +++ b/fs/btrfs/block-group.c @@ -2190,7 +2190,16 @@ int btrfs_read_block_groups(struct btrfs int need_clear = 0; u64 cache_gen; - if (!root) + /* + * Either no extent root (with ibadroots rescue option) or we have + * unsupported RO options. The fs can never be mounted read-write, so no + * need to waste time searching block group items. + * + * This also allows new extent tree related changes to be RO compat, + * no need for a full incompat flag. + */ + if (!root || (btrfs_super_compat_ro_flags(info->super_copy) & + ~BTRFS_FEATURE_COMPAT_RO_SUPP)) return fill_dummy_bgs(info); key.objectid = 0; --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -2112,6 +2112,15 @@ static int btrfs_remount(struct super_bl ret = -EINVAL; goto restore; } + if (btrfs_super_compat_ro_flags(fs_info->super_copy) & + ~BTRFS_FEATURE_COMPAT_RO_SUPP) { + btrfs_err(fs_info, + "can not remount read-write due to unsupported optional flags 0x%llx", + btrfs_super_compat_ro_flags(fs_info->super_copy) & + ~BTRFS_FEATURE_COMPAT_RO_SUPP); + ret = -EINVAL; + goto restore; + } if (fs_info->fs_devices->rw_devices == 0) { ret = -EACCES; goto restore; From patchwork Wed Oct 19 08:23: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: 4586 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp206000wrs; Wed, 19 Oct 2022 01:51:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4vMC70v+fCDAZCE6FfbfRGFJZ7IlpnJo6vuK9Y1mKDy0677HVae30SjomvB9S6TW6tqjgT X-Received: by 2002:a05:6a00:cce:b0:565:cbe0:16c6 with SMTP id b14-20020a056a000cce00b00565cbe016c6mr7545159pfv.56.1666169472739; Wed, 19 Oct 2022 01:51:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169472; cv=none; d=google.com; s=arc-20160816; b=ioPYwWqQMy50Gu4JJoBYI2lLtwso38Cvw7ZSAqpSue92FxeDbvgDijN0NKMs8MaFPk r6Pgv0Uwch/Xf68HSYKQqWDFLg6R0DRvoybU7lz3Dc02DtYgXuAg1bKHsDne9ZIEID5k 5YOIZ5ELiL5DfN3bZzRByCISDAaojidaA5WJko0Fq7RGz9R4n78uSPxsnPShe9or8k2G /otUoCSxQxSpb7YVJ5onBES91k8lEBPD0usQ32TnByIr26mevzWXHDt837tFLHzw8rvi k8vMiwIfXzLiIUchRky+sKnwQYsEAOpYblqoXhknFLNdWTDdSM91pfQKa/5YeI6kOnh9 J7kQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bo/eZhqN7ddbxQAWAgRCEo+12zdQ1aGVpJ+QWM5IQu0=; b=o9W6h6HTNTqDUPY/GMqYiwlNiaqvU/KwkqyfIcDS+9Ov3B4RqurU7CMeaiE064IWwr ry1FFnofAqnQOJAnNUSqW0TtjBAoM7nLL5JgE1ap6QYQtxWz08+KP/UhUqndlOyJ0/rR RLVDzMYea6vcyQW3Hckk8tFMjW+z0vfSEcg5L51ta9bcghOTLka8qPyuVqJ8Q9K5XIlz 9iDXcVYr3SeG7+gJ0xtI6YPjIMkQ7sOxyb53IP14Zo4Y7iq+sPeRHLDgpmHQVTVlquzL 2KR0V6redwo7moUczacILheNSJsOEPP+EiAhhmmLJxWwAj502rsUXY/WUzkDXa/yqPqC GK0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=E02MFpIt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 4-20020a630304000000b0045466b00436si17036939pgd.702.2022.10.19.01.51.00; Wed, 19 Oct 2022 01:51: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=E02MFpIt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231433AbiJSIup (ORCPT + 99 others); Wed, 19 Oct 2022 04:50:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231190AbiJSIsn (ORCPT ); Wed, 19 Oct 2022 04:48:43 -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 8B6858A7CC; Wed, 19 Oct 2022 01:46: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 D9F88B822E8; Wed, 19 Oct 2022 08:43:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5160EC433D6; Wed, 19 Oct 2022 08:43:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168984; bh=J3hY5Ke9dVOuH+qLSGit5n24qZH/9BcKbPIcxeJC+gA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E02MFpItxfWQV/ySY/R0dnXBKrftwD8opc2f+5/PPlLJomyyV0v/SVHCP+ZvNTgTv 3oD4CjygG3Zye6dzqqZhsHK3mLu8zzHse+GDs3TgY4PIZlzMKgrGKSWvjxlSnF6F+y P/I/L4BCrsSrpwOwDssvmIAdFrDbZkH+Ga/Kn8QE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ye Bin , Qu Wenruo , Filipe Manana , David Sterba Subject: [PATCH 6.0 120/862] btrfs: fix race between quota enable and quota rescan ioctl Date: Wed, 19 Oct 2022 10:23:27 +0200 Message-Id: <20221019083255.255485433@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105321170942360?= X-GMAIL-MSGID: =?utf-8?q?1747105321170942360?= From: Filipe Manana commit 331cd9461412e103d07595a10289de90004ac890 upstream. When enabling quotas, at btrfs_quota_enable(), after committing the transaction, we change fs_info->quota_root to point to the quota root we created and set BTRFS_FS_QUOTA_ENABLED at fs_info->flags. Then we try to start the qgroup rescan worker, first by initializing it with a call to qgroup_rescan_init() - however if that fails we end up freeing the quota root but we leave fs_info->quota_root still pointing to it, this can later result in a use-after-free somewhere else. We have previously set the flags BTRFS_FS_QUOTA_ENABLED and BTRFS_QGROUP_STATUS_FLAG_ON, so we can only fail with -EINPROGRESS at btrfs_quota_enable(), which is possible if someone already called the quota rescan ioctl, and therefore started the rescan worker. So fix this by ignoring an -EINPROGRESS and asserting we can't get any other error. Reported-by: Ye Bin Link: https://lore.kernel.org/linux-btrfs/20220823015931.421355-1-yebin10@huawei.com/ CC: stable@vger.kernel.org # 4.19+ Reviewed-by: Qu Wenruo Signed-off-by: Filipe Manana Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman --- fs/btrfs/qgroup.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c @@ -1174,6 +1174,21 @@ out_add_root: fs_info->qgroup_rescan_running = true; btrfs_queue_work(fs_info->qgroup_rescan_workers, &fs_info->qgroup_rescan_work); + } else { + /* + * We have set both BTRFS_FS_QUOTA_ENABLED and + * BTRFS_QGROUP_STATUS_FLAG_ON, so we can only fail with + * -EINPROGRESS. That can happen because someone started the + * rescan worker by calling quota rescan ioctl before we + * attempted to initialize the rescan worker. Failure due to + * quotas disabled in the meanwhile is not possible, because + * we are holding a write lock on fs_info->subvol_sem, which + * is also acquired when disabling quotas. + * Ignore such error, and any other error would need to undo + * everything we did in the transaction we just committed. + */ + ASSERT(ret == -EINPROGRESS); + ret = 0; } out_free_path: From patchwork Wed Oct 19 08:23: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: 4559 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp204677wrs; Wed, 19 Oct 2022 01:46:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4ut94Sx1kKNnTGEKT3NJMGn8z7xsocwWaEDomz3QQltNfCoQFhaBFQ9oSgPzQUOGB8ZKB9 X-Received: by 2002:a17:90b:14e:b0:20b:6a12:cdb1 with SMTP id em14-20020a17090b014e00b0020b6a12cdb1mr44749854pjb.53.1666169212009; Wed, 19 Oct 2022 01:46:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169212; cv=none; d=google.com; s=arc-20160816; b=kIR6Kecu6awY8BHUmhHnNYifZcj/m4fMdj3EfN8nR4DKvvAFP1jcTPaFZo8RRrxCQh UD4Bnu9hFNC3k4UTbEKnqBI7AbRnz5SaHtquHXDEh8c1LocIVU97wjiy5ZMZmEPoBiUC cnBMBwgDZ0vUktlKnCenKXjCOlNdLvWWaADorJUkm3qxNg8W/EHEzwAAKIS1iF2tMBX+ MT7+dF2iyViMSTwrQafiGoYnqwtm3fvfU/ucUt9/OUHu+JIzoyTzgG6KcUp7Q5iEMDVD t7LAQWnrd0hG0VSvpOnW+FRxiv+Ipmp5ssgx5OHXKqpAMUBiVyGYt+Jkny7dVZojIWWE oPYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=d3WF06VkRn3AmcahLLTc8V7O7tPQVGvrudVaUKE8CKo=; b=Rsugytr6VepOjYdhAg/MMvSX6BIZzj6DzMinm9xeKWbNB9EyDZkQTSKGqC1WGJbfWK qbd7rMs747uTycffUz2GdKLWlz1zR74D/S2pmn6p5DGtUTGSoD5fC8jkTuM27MQmMNhh IIywbFk+AbdCz5QmNCeKKakQrm1UCt+rQjHpZtgRfqJyNf5+jWk6EDd2VYw7rCz+67Op VBjuM5OsjEt813hltFbQvYBtyXpbeL35ptLoYVHef9iC1tevbJQceYfLenUE3odwLmWn 5d+wQCkQhImpi8P4du5B8rklX8XQ0XFmjw7dPFa7xtvSiMonxO/fQLzZJRwDI87AWHpB 4cgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="pI/g0Vtf"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p4-20020a637f44000000b0046b3ba2c806si9277807pgn.145.2022.10.19.01.46.38; Wed, 19 Oct 2022 01:46: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="pI/g0Vtf"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231491AbiJSIqT (ORCPT + 99 others); Wed, 19 Oct 2022 04:46:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231178AbiJSIoZ (ORCPT ); Wed, 19 Oct 2022 04:44:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D0542BCD; Wed, 19 Oct 2022 01:43: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 0154C617F0; Wed, 19 Oct 2022 08:43:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 088ECC433D6; Wed, 19 Oct 2022 08:43:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168987; bh=XMA0GU895mLMkwRdk12WuI4e16PkkFq44Znk1AtMYSw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pI/g0VtfHdMZfMQJ4Gf+grn0vMYq+wCbbl7Sq9frXgWXxobwn4nxs8dGyDhWDShNE rQqyh3wRAfZ7IY34WdO6xK3JiFzQJUgUgaYVhT4/Ha5rxxpisL5bfc4r6+nVcjLDpw i5M94CaY0qzGIsGLl4JbTIv//8iAQLjiOgxOkwUU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anand Jain , Filipe Manana , David Sterba Subject: [PATCH 6.0 121/862] btrfs: fix missed extent on fsync after dropping extent maps Date: Wed, 19 Oct 2022 10:23:28 +0200 Message-Id: <20221019083255.299944762@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105047621355217?= X-GMAIL-MSGID: =?utf-8?q?1747105047621355217?= From: Filipe Manana commit cef7820d6abf8d61f8e1db411eae3c712f6d72a2 upstream. When dropping extent maps for a range, through btrfs_drop_extent_cache(), if we find an extent map that starts before our target range and/or ends before the target range, and we are not able to allocate extent maps for splitting that extent map, then we don't fail and simply remove the entire extent map from the inode's extent map tree. This is generally fine, because in case anyone needs to access the extent map, it can just load it again later from the respective file extent item(s) in the subvolume btree. However, if that extent map is new and is in the list of modified extents, then a fast fsync will miss the parts of the extent that were outside our range (that needed to be split), therefore not logging them. Fix that by marking the inode for a full fsync. This issue was introduced after removing BUG_ON()s triggered when the split extent map allocations failed, done by commit 7014cdb49305ed ("Btrfs: btrfs_drop_extent_cache should never fail"), back in 2012, and the fast fsync path already existed but was very recent. Also, in the case where we could allocate extent maps for the split operations but then fail to add a split extent map to the tree, mark the inode for a full fsync as well. This is not supposed to ever fail, and we assert that, but in case assertions are disabled (CONFIG_BTRFS_ASSERT is not set), it's the correct thing to do to make sure a fast fsync will not miss a new extent. CC: stable@vger.kernel.org # 5.15+ Reviewed-by: Anand Jain Signed-off-by: Filipe Manana Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman --- fs/btrfs/file.c | 58 ++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 46 insertions(+), 12 deletions(-) --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -523,6 +523,7 @@ void btrfs_drop_extent_cache(struct btrf testend = 0; } while (1) { + bool ends_after_range = false; int no_splits = 0; modified = false; @@ -539,10 +540,12 @@ void btrfs_drop_extent_cache(struct btrf write_unlock(&em_tree->lock); break; } + if (testend && em->start + em->len > start + len) + ends_after_range = true; flags = em->flags; gen = em->generation; if (skip_pinned && test_bit(EXTENT_FLAG_PINNED, &em->flags)) { - if (testend && em->start + em->len >= start + len) { + if (ends_after_range) { free_extent_map(em); write_unlock(&em_tree->lock); break; @@ -592,7 +595,7 @@ void btrfs_drop_extent_cache(struct btrf split = split2; split2 = NULL; } - if (testend && em->start + em->len > start + len) { + if (ends_after_range) { u64 diff = start + len - em->start; split->start = start + len; @@ -630,14 +633,42 @@ void btrfs_drop_extent_cache(struct btrf } else { ret = add_extent_mapping(em_tree, split, modified); - ASSERT(ret == 0); /* Logic error */ + /* Logic error, shouldn't happen. */ + ASSERT(ret == 0); + if (WARN_ON(ret != 0) && modified) + btrfs_set_inode_full_sync(inode); } free_extent_map(split); split = NULL; } next: - if (extent_map_in_tree(em)) + if (extent_map_in_tree(em)) { + /* + * If the extent map is still in the tree it means that + * either of the following is true: + * + * 1) It fits entirely in our range (doesn't end beyond + * it or starts before it); + * + * 2) It starts before our range and/or ends after our + * range, and we were not able to allocate the extent + * maps for split operations, @split and @split2. + * + * If we are at case 2) then we just remove the entire + * extent map - this is fine since if anyone needs it to + * access the subranges outside our range, will just + * load it again from the subvolume tree's file extent + * item. However if the extent map was in the list of + * modified extents, then we must mark the inode for a + * full fsync, otherwise a fast fsync will miss this + * extent if it's new and needs to be logged. + */ + if ((em->start < start || ends_after_range) && modified) { + ASSERT(no_splits); + btrfs_set_inode_full_sync(inode); + } remove_extent_mapping(em_tree, em); + } write_unlock(&em_tree->lock); /* once for us */ @@ -2201,14 +2232,6 @@ int btrfs_sync_file(struct file *file, l atomic_inc(&root->log_batch); /* - * Always check for the full sync flag while holding the inode's lock, - * to avoid races with other tasks. The flag must be either set all the - * time during logging or always off all the time while logging. - */ - full_sync = test_bit(BTRFS_INODE_NEEDS_FULL_SYNC, - &BTRFS_I(inode)->runtime_flags); - - /* * Before we acquired the inode's lock and the mmap lock, someone may * have dirtied more pages in the target range. We need to make sure * that writeback for any such pages does not start while we are logging @@ -2233,6 +2256,17 @@ int btrfs_sync_file(struct file *file, l } /* + * Always check for the full sync flag while holding the inode's lock, + * to avoid races with other tasks. The flag must be either set all the + * time during logging or always off all the time while logging. + * We check the flag here after starting delalloc above, because when + * running delalloc the full sync flag may be set if we need to drop + * extra extent map ranges due to temporary memory allocation failures. + */ + full_sync = test_bit(BTRFS_INODE_NEEDS_FULL_SYNC, + &BTRFS_I(inode)->runtime_flags); + + /* * We have to do this here to avoid the priority inversion of waiting on * IO of a lower priority task while holding a transaction open. * From patchwork Wed Oct 19 08:23: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: 4587 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp206005wrs; Wed, 19 Oct 2022 01:51:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Vyv5WM1rZsrswjJErMYczB4wRskfq12axyimYwKw68UrCDTKyHLOZDVUQxBb7/XdyAR9B X-Received: by 2002:a17:90b:1b51:b0:20d:8594:bd5f with SMTP id nv17-20020a17090b1b5100b0020d8594bd5fmr43273749pjb.125.1666169473678; Wed, 19 Oct 2022 01:51:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169473; cv=none; d=google.com; s=arc-20160816; b=dvSMaSsKNne5G+SgUbaoEIdtCFolJym6y45J9ImHoVv1PNtTqb0jBzQ/B5Xhjqhs4x O7pruVw+zZBgYQBCE19ViEUGBhaiKEegcNZewk6z7YZ1+JmSvLBAKx1FAIEDQ1nEvGP/ 2eX5GTdJJzM9uW1FiIk+8ifgQ8eAC5JT88jBB0KDpiwXe6CbNSTY1m1rZws9WxiEd7t+ rsaBtS76kLA2ffIeQWrrcaHKI8V3WmVYlAVP87omNiDfnyEIf42KNPrtG1qoXPq3HrtD FQhbZ/gXR2ngEvHeNWYdZ92cX8Dp2dlO6KAEg+4tpWurg9ow0JjSpo3KnCR5CQp4WI/I 61CA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7/ZrJfrYDOzMLpvxbP//NZ843+/0tZH0bNPHEYE8mLI=; b=upryy47pSB4ZTbWj3h+Y6jkYlwgoHOKKd7OR+XaA1PSJKEaQwyBKUafUSlbXb19De0 iDNI42exQRjY2JeFywiMH5Vb+t879+98tPpPJG9ZNRxlmzi4TSmM0fgRT9ZsllzNqO5L Spc0tmWT1CFGkzHE7bbZXpRdLTH23+ThyJPjMlUgsX6PwO3gxMlftzzYBil4F01OIw39 YfcDS3LFj4HpsbdDS6I52dGjQCKXRD4feT6dYGFjXxK7hRPJFccVJ3eltywWtreT7RKg 8U8pO6+23Zh72ObmxgeTUUWPU+3VpQ87K0yDCtIhpd8JFMAv0AltRDFhRiJHlSp+2oWu ynZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kzKM3bfk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a056a000b9400b00541505b05dbsi19054751pfj.31.2022.10.19.01.51.00; Wed, 19 Oct 2022 01:51:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kzKM3bfk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231481AbiJSIus (ORCPT + 99 others); Wed, 19 Oct 2022 04:50:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231477AbiJSIsq (ORCPT ); Wed, 19 Oct 2022 04:48:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F1EC83F0E; Wed, 19 Oct 2022 01:46: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 812E7B822F0; Wed, 19 Oct 2022 08:43:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC762C433D6; Wed, 19 Oct 2022 08:43:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168990; bh=sWV6aA1ibKl9WZX924pVaH+AyI1RL2R7xKvocaqtYYk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kzKM3bfkdYBZOOrFH9BeTCUj7WbRpm+IEe1L39Awpqaat8muZCmcnO1ilKUJcpvNn PWXtPKH1kCYU9wudPvMly9jqKVHvR1qBl7kMkIg6mAmjVLWhyTe7DhB55CxuInxWon 6KiEPnl7cMGWA8KOlVEJUQ9V4xWmCfFSSYCbhxig= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot , Tetsuo Handa , David Sterba Subject: [PATCH 6.0 122/862] btrfs: set generation before calling btrfs_clean_tree_block in btrfs_init_new_buffer Date: Wed, 19 Oct 2022 10:23:29 +0200 Message-Id: <20221019083255.348705972@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105321887532562?= X-GMAIL-MSGID: =?utf-8?q?1747105321887532562?= From: Tetsuo Handa commit cbddcc4fa3443fe8cfb2ff8e210deb1f6a0eea38 upstream. syzbot is reporting uninit-value in btrfs_clean_tree_block() [1], for commit bc877d285ca3dba2 ("btrfs: Deduplicate extent_buffer init code") missed that btrfs_set_header_generation() in btrfs_init_new_buffer() must not be moved to after clean_tree_block() because clean_tree_block() is calling btrfs_header_generation() since commit 55c69072d6bd5be1 ("Btrfs: Fix extent_buffer usage when nodesize != leafsize"). Since memzero_extent_buffer() will reset "struct btrfs_header" part, we can't move btrfs_set_header_generation() to before memzero_extent_buffer(). Just re-add btrfs_set_header_generation() before btrfs_clean_tree_block(). Link: https://syzkaller.appspot.com/bug?extid=fba8e2116a12609b6c59 [1] Reported-by: syzbot Fixes: bc877d285ca3dba2 ("btrfs: Deduplicate extent_buffer init code") CC: stable@vger.kernel.org # 4.19+ Signed-off-by: Tetsuo Handa Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman --- fs/btrfs/extent-tree.c | 3 +++ 1 file changed, 3 insertions(+) --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -4888,6 +4888,9 @@ btrfs_init_new_buffer(struct btrfs_trans !test_bit(BTRFS_ROOT_RESET_LOCKDEP_CLASS, &root->state)) lockdep_owner = BTRFS_FS_TREE_OBJECTID; + /* btrfs_clean_tree_block() accesses generation field. */ + btrfs_set_header_generation(buf, trans->transid); + /* * This needs to stay, because we could allocate a freed block from an * old tree into a new tree, so we need to make sure this new block is From patchwork Wed Oct 19 08:23: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: 4616 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp211872wrs; Wed, 19 Oct 2022 02:06:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7/EuHStdC8TbP2KoVw5LV/1GYx5A5OUtDyosWeo+wXp5dskrIrjFXR/jQ7oZ2kZbfGXeHV X-Received: by 2002:a17:906:5dac:b0:791:93de:c61d with SMTP id n12-20020a1709065dac00b0079193dec61dmr5712069ejv.751.1666170366824; Wed, 19 Oct 2022 02:06:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170366; cv=none; d=google.com; s=arc-20160816; b=KV+k9E5ZDBFSLn8ER/3nzkOAo7DJj40dBbxkG+dOghZHeRqZeE7RXO8SLcxTPOcb+x uU5ic2FHeG5Mb+Ef6t/yTXC8JaLHGDFD9iod0DQqgx5omerZnmyuoJY0Aa2S4hRCjzQY Tgg6D6/R0Pr8rsjoM+7TNflq6+Q+zSllEhSRH8eJelPtxNjm42q5GXx88Uwcc9DR7/gQ rf077TlrtAtA3J/7T3MJWeRL5yWLEFdY5hXqhITqgLADHnanXjkU2c83RsIZV4dZZ6kQ Vpr/13bM3css8Dyx5smxufbApuGsrk9kTMdUHFQcvfOAB9kZtHWT69QUuo0tWn49Qp0w Ee0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DX3U+c259M7FwvA56ZM842lsr9RQWobeOcEvJ6E9bFc=; b=Jbku4QVfZnAMZiewrXzFysshxPTZa9aFOL/zUlqwiTHPSeKHdBT+eZPY4aPL0ZStDx pYBE4ctEwPVRTdtfJg91q+jc9dpFK/+MDSKQrFIrXxle7VQsFd/SYx371ae18802A/Dh dPoJ4niWf6vL9IkJIe0wvE9lHMxGvcPjrXJAyXuFYcWbb2mpVSU4iNWv+mmLpnxtf3zd OcPWF4mSqEHsBrPnr5vvwtJURY08dD2SVsvb0icFYN85JYzpOe4OG0Z0CtWyqtrIZTmc KU540nxF3ng4RfRy/Ba06Zk/240w93MYOT/vke/XVC2a2FmPhn2VMVGAc9TFu+z5oGCZ wdhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tPqm4QmF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s16-20020a50d490000000b0045cd50b7c65si12187301edi.266.2022.10.19.02.05.32; Wed, 19 Oct 2022 02:06: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=tPqm4QmF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231747AbiJSIzU (ORCPT + 99 others); Wed, 19 Oct 2022 04:55:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231785AbiJSIxl (ORCPT ); Wed, 19 Oct 2022 04:53:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0D168F964; Wed, 19 Oct 2022 01:50: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 35552B822F2; Wed, 19 Oct 2022 08:43:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 872ADC433D7; Wed, 19 Oct 2022 08:43:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168992; bh=KzHqx2mfIHoyi1WiueYBo5GyvE9Q9Y8B+TZngBTNrwY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tPqm4QmFgftSlHRszVVDxZa+UNgOdHWCzzTSwXuZWecOEJtLN4Jdr1oVlCo6Ba9r5 mj02VB5cKBTX43uO6k2CYg7U3emUQVIrVpSUzTimoarcEtfQVA7+nyI0VRrX8rADxJ hOqFYI/o/HCsnd0PdEI+pC7orp4YcEhuOFcUFTEk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chao Yu , Jaegeuk Kim Subject: [PATCH 6.0 123/862] f2fs: fix wrong continue condition in GC Date: Wed, 19 Oct 2022 10:23:30 +0200 Message-Id: <20221019083255.387516069@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106258222974996?= X-GMAIL-MSGID: =?utf-8?q?1747106258222974996?= From: Jaegeuk Kim commit 605b0a778aa2599aa902ae639b8e9937c74b869b upstream. We should decrease the frozen counter. Cc: stable@vger.kernel.org Fixes: 325163e9892b ("f2fs: add gc_urgent_high_remaining sysfs node") Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Greg Kroah-Hartman --- fs/f2fs/gc.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -97,14 +97,10 @@ static int gc_thread_func(void *data) */ if (sbi->gc_mode == GC_URGENT_HIGH) { spin_lock(&sbi->gc_urgent_high_lock); - if (sbi->gc_urgent_high_limited) { - if (!sbi->gc_urgent_high_remaining) { - sbi->gc_urgent_high_limited = false; - spin_unlock(&sbi->gc_urgent_high_lock); - sbi->gc_mode = GC_NORMAL; - continue; - } - sbi->gc_urgent_high_remaining--; + if (sbi->gc_urgent_high_limited && + !sbi->gc_urgent_high_remaining--) { + sbi->gc_urgent_high_limited = false; + sbi->gc_mode = GC_NORMAL; } spin_unlock(&sbi->gc_urgent_high_lock); } From patchwork Wed Oct 19 08:23: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: 4560 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp204689wrs; Wed, 19 Oct 2022 01:46:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4EJcAsWmOGY69MyMRjFour7YOLcFClWmAjGKxjkHA5iHEZwOKN4RY6AYyE7/hPm7zTMNL5 X-Received: by 2002:a05:6a00:1d05:b0:563:5715:7f3d with SMTP id a5-20020a056a001d0500b0056357157f3dmr7521359pfx.48.1666169216185; Wed, 19 Oct 2022 01:46:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169216; cv=none; d=google.com; s=arc-20160816; b=S51+l0kXikAJypjXqD57Ar0ld7qWMf6OVkJ/Xv2RzLj2sxfkU2uH0c1luFXEY9HZqy JdudSLPoCZ/bHRjN28GMc5T2T7thsavI/MZh7OdUKy0TZOVh1LoqxuyLDfHsZZgejQ9A oGYNIdCVucHtJTpRuiQHzeZCtwEjsZMLHpHAiyk1SkMlDLirWHw0gi0HY/qtOvw5hVhU +z7xTEFCjnfYWLut6CP9z2VJrIkvQXvFTgjOxLzm1CAIEOBhKAXAfpf1v9OVAj23OuOA aks0May5NoXarxktLVI6BTAYp4kMCegJlYLlkPC4gU78ZEifagGj9msXYxpvlrYZa942 6fgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=c9BCpcPHdLLBytjc2vLppdZKwIk8YwGxDE2ONFh0M+I=; b=SjfLece/mxuuQedp22xFQnr2nWkVqIMb+qyJER/N1vwwdLRd9npt66HQKevULsO+1N ze923WhGBikMjV2B//WtU+eocu722mFOvqBTcrQD31dU9uVeJPnMdPeVEPaW+foJXruH G9xS658136U2SA8JjMsY6J8Pzkr0Py+s8m8n2nryvR+qU/iagG5XGGHfnucnq8FQuO1c 5HTEriZeNOvRWmHhZ+QjEYJKZAJHYS+DUNADrkriHBsBzlsWy8YZbozNPzr0jPeffS6g BfGrollJ7FSpBDsBgcP3RusHImkuI0oIX28AY+OcofHwPBD5Nv4nj/LSWHMCDkyxhrsg xOqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=l1M9uUKf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 7-20020aa79207000000b00563653bc151si14778733pfo.110.2022.10.19.01.46.41; Wed, 19 Oct 2022 01:46: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=l1M9uUKf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231497AbiJSIqY (ORCPT + 99 others); Wed, 19 Oct 2022 04:46:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230357AbiJSIo1 (ORCPT ); Wed, 19 Oct 2022 04:44:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B92E780E80; Wed, 19 Oct 2022 01: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 54449617D1; Wed, 19 Oct 2022 08:43:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F78BC433D7; Wed, 19 Oct 2022 08:43:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168995; bh=s8nINoBvWRQroC9lS3xWx28VsebvV8KcGjYv6eZNjCw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l1M9uUKf+lNAZFPizV7YRzibVOybzWrGa/AXGTtGAPCk6FtpPsyPHIdxFaMcuWpnp CGHETbuv5B6+KYYCyrMk6JSh9+9wJn2DTZVQsb3KW8Ip4L7R8LBDa9PWOJPVT27Fdf NkeY1YBndksIZ7cQIQfICdlWQJ6p9QG13g3X6HUs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chao Yu , Jaegeuk Kim Subject: [PATCH 6.0 124/862] f2fs: complete checkpoints during remount Date: Wed, 19 Oct 2022 10:23:31 +0200 Message-Id: <20221019083255.424202400@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105052341521536?= X-GMAIL-MSGID: =?utf-8?q?1747105052341521536?= From: Jaegeuk Kim commit 4f99484d27961cb194cebcd917176fa038a5025f upstream. Otherwise, pending checkpoints can contribute a race condition to give a quota warning. - Thread - checkpoint thread add checkpoints to the list do_remount() down_write(&sb->s_umount); f2fs_remount() block_operations() down_read_trylock(&sb->s_umount) = 0 up_write(&sb->s_umount); f2fs_quota_sync() dquot_writeback_dquots() WARN_ON_ONCE(!rwsem_is_locked(&sb->s_umount)); Or, do_remount() down_write(&sb->s_umount); f2fs_remount() create a ckpt thread f2fs_enable_checkpoint() adds checkpoints wait for f2fs_sync_fs() trigger another pending checkpoint block_operations() down_read_trylock(&sb->s_umount) = 0 up_write(&sb->s_umount); f2fs_quota_sync() dquot_writeback_dquots() WARN_ON_ONCE(!rwsem_is_locked(&sb->s_umount)); Cc: stable@vger.kernel.org Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Greg Kroah-Hartman --- fs/f2fs/super.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -2181,6 +2181,9 @@ static void f2fs_enable_checkpoint(struc f2fs_up_write(&sbi->gc_lock); f2fs_sync_fs(sbi->sb, 1); + + /* Let's ensure there's no pending checkpoint anymore */ + f2fs_flush_ckpt_thread(sbi); } static int f2fs_remount(struct super_block *sb, int *flags, char *data) @@ -2346,6 +2349,9 @@ static int f2fs_remount(struct super_blo f2fs_stop_ckpt_thread(sbi); need_restart_ckpt = true; } else { + /* Flush if the prevous checkpoint, if exists. */ + f2fs_flush_ckpt_thread(sbi); + err = f2fs_start_ckpt_thread(sbi); if (err) { f2fs_err(sbi, From patchwork Wed Oct 19 08:23: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: 4565 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp204842wrs; Wed, 19 Oct 2022 01:47:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4cX3FzzulnTHW+fhSDVC4RyM3Xl7Vpcczij80zbspuurnB95HLs2az7IT+bIFJ1oSTqU81 X-Received: by 2002:a17:902:7e8e:b0:182:25d6:e65b with SMTP id z14-20020a1709027e8e00b0018225d6e65bmr7345585pla.9.1666169250707; Wed, 19 Oct 2022 01:47:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169250; cv=none; d=google.com; s=arc-20160816; b=0munYKcStMVpkRxEAJ+K7bdbJFRCspQ+gaD9GvWeRuPXPU4LtyDaot65oihRpnpfbJ /9EfNaZelQ4aP9JH0Utz1a03nePSdQB2Fzjb3B0UuSXs7qlk0L6jrFJHVsijKsMc/cBb 9SYOlrzeXsyM7AfgSJqsROjlU+LnbeX8Nk/GqdmbHQ879+k/VzzhPcVFU5I6Lav5g131 KDVPF7QionHneSA0HP6P4+0ooWOlfLVobyTLsobERKq0OPWObHtz/FGI0M6HHgSbbNmA K52oOQ8+ij10nc3x1da8WVgZVuU5GBu+se8rGUWCMhe3F1UUqL4MiU7xkG/e4ZKwjcwO BsVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zUUqeyHNDwOCrgKag1bs2RxIL2XYHwPTXchAuXUNuLA=; b=SK5CtcTHR4ITE8v1QbGXZC+UlDiXDr67GQtltdtyWGmPmbK2jqdxpSGFK0SGOZ+40/ aORBXWNgUfnPEhGHqUpqFjhkU3Xyuii9zOcgm1QZbfkpkSvWB2s/nDwo7rvCkkWAgMhJ zD/6FgaCKLOeyDyH+0TIsu2QNatTj8H+dxS3XWxIxPTDDRraHFUja4KNlQ6bm0IL9xSq o9DYh2mQ4Fmt2QFaZ8RDXlEGHP56gDM5lDkYtjReoDYNcX1ZaEtSzBM8lFQpQX1kqEPB uwtbH2jXyRnyGaA7BQQydqgKywjr741jSHNQ+sVpDsbm41wcxH3rGzKzy5yJm2e14szw mgwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NlBXEw9Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d2-20020a63f242000000b004639c772888si17963518pgk.225.2022.10.19.01.47.17; Wed, 19 Oct 2022 01:47: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=NlBXEw9Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231436AbiJSIqr (ORCPT + 99 others); Wed, 19 Oct 2022 04:46:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231357AbiJSIpA (ORCPT ); Wed, 19 Oct 2022 04:45:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6DE1415828; Wed, 19 Oct 2022 01:43: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 170826181D; Wed, 19 Oct 2022 08:43:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 274DAC433D6; Wed, 19 Oct 2022 08:43:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168998; bh=ocT89eyYuIuOto2JTfMrtff4SJkzbMfHnpgn7rdRkk4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NlBXEw9ZkpGJRg+V8MMDXTqDsyHd77ZyIP+M2TqBw4VvnnpRVf97UAwqDjZGls/m3 tlsxFVt4T/FNSmx5fvucHR5SrizAI241lKzg8azayj+FMoOJWhSFtko4X0BenypPCi dzdWNmMW6MuSvhY+WG6JuxBS001tJFKvfyU6OrMg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chao Yu , Jaegeuk Kim Subject: [PATCH 6.0 125/862] f2fs: flush pending checkpoints when freezing super Date: Wed, 19 Oct 2022 10:23:32 +0200 Message-Id: <20221019083255.475244105@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105087965966312?= X-GMAIL-MSGID: =?utf-8?q?1747105087965966312?= From: Jaegeuk Kim commit c7b58576370147833999fd4cc874d0f918bdf9ca upstream. This avoids -EINVAL when trying to freeze f2fs. Cc: stable@vger.kernel.org Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Greg Kroah-Hartman --- fs/f2fs/checkpoint.c | 24 ++++++++++++++++++------ fs/f2fs/f2fs.h | 1 + fs/f2fs/super.c | 5 ++--- 3 files changed, 21 insertions(+), 9 deletions(-) --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c @@ -1892,15 +1892,27 @@ int f2fs_start_ckpt_thread(struct f2fs_s void f2fs_stop_ckpt_thread(struct f2fs_sb_info *sbi) { struct ckpt_req_control *cprc = &sbi->cprc_info; + struct task_struct *ckpt_task; - if (cprc->f2fs_issue_ckpt) { - struct task_struct *ckpt_task = cprc->f2fs_issue_ckpt; + if (!cprc->f2fs_issue_ckpt) + return; - cprc->f2fs_issue_ckpt = NULL; - kthread_stop(ckpt_task); + ckpt_task = cprc->f2fs_issue_ckpt; + cprc->f2fs_issue_ckpt = NULL; + kthread_stop(ckpt_task); - flush_remained_ckpt_reqs(sbi, NULL); - } + f2fs_flush_ckpt_thread(sbi); +} + +void f2fs_flush_ckpt_thread(struct f2fs_sb_info *sbi) +{ + struct ckpt_req_control *cprc = &sbi->cprc_info; + + flush_remained_ckpt_reqs(sbi, NULL); + + /* Let's wait for the previous dispatched checkpoint. */ + while (atomic_read(&cprc->queued_ckpt)) + io_schedule_timeout(DEFAULT_IO_TIMEOUT); } void f2fs_init_ckpt_req_control(struct f2fs_sb_info *sbi) --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -3707,6 +3707,7 @@ static inline bool f2fs_need_rand_seg(st * checkpoint.c */ void f2fs_stop_checkpoint(struct f2fs_sb_info *sbi, bool end_io); +void f2fs_flush_ckpt_thread(struct f2fs_sb_info *sbi); struct page *f2fs_grab_meta_page(struct f2fs_sb_info *sbi, pgoff_t index); struct page *f2fs_get_meta_page(struct f2fs_sb_info *sbi, pgoff_t index); struct page *f2fs_get_meta_page_retry(struct f2fs_sb_info *sbi, pgoff_t index); --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -1666,9 +1666,8 @@ static int f2fs_freeze(struct super_bloc if (is_sbi_flag_set(F2FS_SB(sb), SBI_IS_DIRTY)) return -EINVAL; - /* ensure no checkpoint required */ - if (!llist_empty(&F2FS_SB(sb)->cprc_info.issue_list)) - return -EINVAL; + /* Let's flush checkpoints and stop the thread. */ + f2fs_flush_ckpt_thread(F2FS_SB(sb)); /* to avoid deadlock on f2fs_evict_inode->SB_FREEZE_FS */ set_sbi_flag(F2FS_SB(sb), SBI_IS_FREEZING); From patchwork Wed Oct 19 08:23: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: 5349 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp296171wrs; Wed, 19 Oct 2022 05:27:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM57LSQefuSz393s85ZKWFjUl3fncTLbZtpZ+h4SvqKB13bE8zwsiHkpJaeo9lgwe4nW7Ok7 X-Received: by 2002:a05:6402:d58:b0:458:5eca:a2c9 with SMTP id ec24-20020a0564020d5800b004585ecaa2c9mr7352147edb.306.1666182425502; Wed, 19 Oct 2022 05:27:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666182425; cv=none; d=google.com; s=arc-20160816; b=nOUL2QUtngWKL0vo3OnVxzDDsnURpexv9+0fdXxAUAZEBoGRGGx72375XBFQXGE3AG BlxKdyWQmhU5LXD2taKv19w2RLfPCVvFNOmIk/AUPlgi7lVqlKREu95y29uYE4VaNsHI tBSMDf5EmXi6se2p8pdP/WVTlSLazcUIl+r5LBkYpv9qJSx1fd2SVTCzTJHAclZpQ7H1 z8VGkgFXZi5jTO4JHF5ijvaBOwSCFJClqLtWg7UqOPX4Bpt3JySOkrGxcVysQYrkRYlU OC8WTqzG37OpG59g9uMPkkbRpqYxyIh7Ksn7Fk78Nv1hNBMS1aGas4YOcuQYH09O68mj byNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=p7kAaSM5Mdw9etajGhkk6pdijn2aBe5h+ej22Triwe8=; b=oanCp5YW9X+LbPjPEKLGyjVNivdSdlOX1Love2qcAlMeAyIjg+gJUljS1rCou0GtzJ HDPFaRk9M3NBXP9qzrplNfEX8wtOVnHFSY7mj058XzsHhUkixSOZZEQLmy324FiCPmik D9+j1stKOh6RUblZkuu77EELKOlouzH0GX0w/tp8kOgJIpDgLVI1tQsjyAkTwrAw4Vt8 lcnVVKeTU4A3PyNo7Y2DhXMfNtUScFR6h4sB3C9E7UcIUD1SRv+HJ8X0x7Pc83EBqi1g B2U0Vr+bk8RCLcaw8p1PnL/pxisdVeHMPx/ctpA7eqYCDdsaPgd4kzV8G/QPkzsI/3J1 rFmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HOEu3WtB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kf25-20020a17090776d900b00782035a06b4si12834155ejc.200.2022.10.19.05.26.39; Wed, 19 Oct 2022 05:27: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=HOEu3WtB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232879AbiJSMRT (ORCPT + 99 others); Wed, 19 Oct 2022 08:17:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232859AbiJSMQ5 (ORCPT ); Wed, 19 Oct 2022 08:16:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A5BF192D94; Wed, 19 Oct 2022 04:52:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 867FDB822EE; Wed, 19 Oct 2022 08:43:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB737C433D6; Wed, 19 Oct 2022 08:43:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169001; bh=ENqjI30oM3X1HTevosEQ8wfvgkE/7JDm0ZpMwQO+m1g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HOEu3WtBj0F6qrTwxAcQQnGb3MpUwoobjeM0TjPHuaGhPcLYbuV7DnSlPQkqPKFq5 3ArQMclZ7kvMBViBzr9KKuTXNrp0838mA5250FRgJr+NbEuNWfvPQ0C0VZlYmOSkd+ 8JpGyzHvoCSVDOsY0VrRnynM7c9sNXJlGeHfNhS8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aran Dalton , Chao Yu , Jaegeuk Kim Subject: [PATCH 6.0 126/862] f2fs: increase the limit for reserve_root Date: Wed, 19 Oct 2022 10:23:33 +0200 Message-Id: <20221019083255.521198948@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747118902889042505?= X-GMAIL-MSGID: =?utf-8?q?1747118902889042505?= From: Jaegeuk Kim commit da35fe96d12d15779f3cb74929b7ed03941cf983 upstream. This patch increases the threshold that limits the reserved root space from 0.2% to 12.5% by using simple shift operation. Typically Android sets 128MB, but if the storage capacity is 32GB, 0.2% which is around 64MB becomes too small. Let's relax it. Cc: stable@vger.kernel.org Reported-by: Aran Dalton Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Greg Kroah-Hartman --- fs/f2fs/super.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -301,10 +301,10 @@ static void f2fs_destroy_casefold_cache( static inline void limit_reserve_root(struct f2fs_sb_info *sbi) { - block_t limit = min((sbi->user_block_count << 1) / 1000, + block_t limit = min((sbi->user_block_count >> 3), sbi->user_block_count - sbi->reserved_blocks); - /* limit is 0.2% */ + /* limit is 12.5% */ if (test_opt(sbi, RESERVE_ROOT) && F2FS_OPTION(sbi).root_reserved_blocks > limit) { F2FS_OPTION(sbi).root_reserved_blocks = limit; From patchwork Wed Oct 19 08:23: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: 4719 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp213929wrs; Wed, 19 Oct 2022 02:11:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM76HSanV72FW0DXOT49q3WALBsQMWTJfLGBcAQUNUqrT6t4ArPcUzIW7vfdHPwR59ncizF0 X-Received: by 2002:a05:6402:278c:b0:45c:da8e:837d with SMTP id b12-20020a056402278c00b0045cda8e837dmr6592100ede.18.1666170687967; Wed, 19 Oct 2022 02:11:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170687; cv=none; d=google.com; s=arc-20160816; b=bb1saXLMOYbxPOEZaJWjimRk8Q+3Z8/qJb2Fj3rZq1ig4e9fa6RGoJnyyJ0xr7tOJj q3pymSy667RdCdYQrZt8ryUrbSuCFnfRS4Ap3x4aJMuqS3VfRQQM62/aO9tzO7+6KpzZ 5dgsgUBRfJf0N/zyehAykWQR8Po5a/uajpwZmvRpV9LYlDAwn0jeCd4eTaOar2fn9cft VeMcGP5qHrOvySV8HAgAI4W1BDkH6NBoHkvhbwxMH7hKmIGDjp5uzCFg2rq/FaRSRlGz 1fBe4lf9y6Sc6FLXrOIBB11z2UN+0Zc5aVA9SIb2ojfW4cFdze9J79Ln8Ejk7jZpCRNx XX/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=Z1LUxC1GxUaLN1WsJpGAHofNiM0KrFEAwdXfQsI0wS0=; b=xfIHDk5GYfn/DX1RZ83eCBxL55ZldqgorbVcNYAeMiPUM5gJZK7l8RSLUW30sFEA8+ 4MHNyZBOJ+JTtsdn0I9SlGdvOj7ZBT0RL6gSgpqUsQQPhe9l5Jnlqad2uI2qIjKwctki yFoXxIHOZPGk4bQLtXPN8h/1vGpwo4SCfmywvY+sUtc/WC1HIsx+maWrAVWEHH7Ds1q6 YvRPq2RQWCsi8D61zGGaYjzsfOWbyX7VaT81B1Ejxdb+ChV3+10cc+w02dNcH0QMQ9uy jxNySeYsVHC7mFAFas38Xs4MZNfMkuqk22GQaDP4L2UdkyCbAEuP0ANA6iGpZl3TgD8i Zs8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zqra7GFO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cr2-20020a170906d54200b0078cc4a8a956si15119182ejc.881.2022.10.19.02.11.02; Wed, 19 Oct 2022 02:11: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=zqra7GFO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232433AbiJSJHo (ORCPT + 99 others); Wed, 19 Oct 2022 05:07:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232798AbiJSJFJ (ORCPT ); Wed, 19 Oct 2022 05:05:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 759747E80D; Wed, 19 Oct 2022 01:59:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2F17261807; Wed, 19 Oct 2022 08:43:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2BBF6C433D7; Wed, 19 Oct 2022 08:43:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169005; bh=DGwsmplE8Vkby6OIoLLT0zxoXaCbmjiNeby20xr9kEg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zqra7GFO8BR35tA9rN15AZOepq7Ae25+ty/TQNFF+ax1spnPBCsAp7qWT0dgfqxQN 1ZwtCvVbNS9LZ9cjyzdgnntJOoOR0s+8d/Q2ngE0wlH64brzfMBsKB8f8TaB0jbSkY XRYVOVOF7R50mwH+IkA2dOk1VKcYfJnUeWRMFbuU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wenqing Liu , Chao Yu , Jaegeuk Kim Subject: [PATCH 6.0 127/862] f2fs: fix to do sanity check on destination blkaddr during recovery Date: Wed, 19 Oct 2022 10:23:34 +0200 Message-Id: <20221019083255.569589886@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106595257833919?= X-GMAIL-MSGID: =?utf-8?q?1747106595257833919?= From: Chao Yu commit 0ef4ca04a3f9223ff8bc440041c524b2123e09a3 upstream. As Wenqing Liu reported in bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=216456 loop5: detected capacity change from 0 to 131072 F2FS-fs (loop5): recover_inode: ino = 6, name = hln, inline = 1 F2FS-fs (loop5): recover_data: ino = 6 (i_size: recover) err = 0 F2FS-fs (loop5): recover_inode: ino = 6, name = hln, inline = 1 F2FS-fs (loop5): recover_data: ino = 6 (i_size: recover) err = 0 F2FS-fs (loop5): recover_inode: ino = 6, name = hln, inline = 1 F2FS-fs (loop5): recover_data: ino = 6 (i_size: recover) err = 0 F2FS-fs (loop5): Bitmap was wrongly set, blk:5634 ------------[ cut here ]------------ WARNING: CPU: 3 PID: 1013 at fs/f2fs/segment.c:2198 RIP: 0010:update_sit_entry+0xa55/0x10b0 [f2fs] Call Trace: f2fs_do_replace_block+0xa98/0x1890 [f2fs] f2fs_replace_block+0xeb/0x180 [f2fs] recover_data+0x1a69/0x6ae0 [f2fs] f2fs_recover_fsync_data+0x120d/0x1fc0 [f2fs] f2fs_fill_super+0x4665/0x61e0 [f2fs] mount_bdev+0x2cf/0x3b0 legacy_get_tree+0xed/0x1d0 vfs_get_tree+0x81/0x2b0 path_mount+0x47e/0x19d0 do_mount+0xce/0xf0 __x64_sys_mount+0x12c/0x1a0 do_syscall_64+0x38/0x90 entry_SYSCALL_64_after_hwframe+0x63/0xcd If we enable CONFIG_F2FS_CHECK_FS config, it will trigger a kernel panic instead of warning. The root cause is: in fuzzed image, SIT table is inconsistent with inode mapping table, result in triggering such warning during SIT table update. This patch introduces a new flag DATA_GENERIC_ENHANCE_UPDATE, w/ this flag, data block recovery flow can check destination blkaddr's validation in SIT table, and skip f2fs_replace_block() to avoid inconsistent status. Cc: stable@vger.kernel.org Reported-by: Wenqing Liu Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Greg Kroah-Hartman --- fs/f2fs/checkpoint.c | 10 +++++++++- fs/f2fs/f2fs.h | 4 ++++ fs/f2fs/recovery.c | 8 ++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c @@ -140,7 +140,7 @@ static bool __is_bitmap_valid(struct f2f unsigned int segno, offset; bool exist; - if (type != DATA_GENERIC_ENHANCE && type != DATA_GENERIC_ENHANCE_READ) + if (type == DATA_GENERIC) return true; segno = GET_SEGNO(sbi, blkaddr); @@ -148,6 +148,13 @@ static bool __is_bitmap_valid(struct f2f se = get_seg_entry(sbi, segno); exist = f2fs_test_bit(offset, se->cur_valid_map); + if (exist && type == DATA_GENERIC_ENHANCE_UPDATE) { + f2fs_err(sbi, "Inconsistent error blkaddr:%u, sit bitmap:%d", + blkaddr, exist); + set_sbi_flag(sbi, SBI_NEED_FSCK); + return exist; + } + if (!exist && type == DATA_GENERIC_ENHANCE) { f2fs_err(sbi, "Inconsistent error blkaddr:%u, sit bitmap:%d", blkaddr, exist); @@ -185,6 +192,7 @@ bool f2fs_is_valid_blkaddr(struct f2fs_s case DATA_GENERIC: case DATA_GENERIC_ENHANCE: case DATA_GENERIC_ENHANCE_READ: + case DATA_GENERIC_ENHANCE_UPDATE: if (unlikely(blkaddr >= MAX_BLKADDR(sbi) || blkaddr < MAIN_BLKADDR(sbi))) { f2fs_warn(sbi, "access invalid blkaddr:%u", --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -266,6 +266,10 @@ enum { * condition of read on truncated area * by extent_cache */ + DATA_GENERIC_ENHANCE_UPDATE, /* + * strong check on range and segment + * bitmap for update case + */ META_GENERIC, }; --- a/fs/f2fs/recovery.c +++ b/fs/f2fs/recovery.c @@ -698,6 +698,14 @@ retry_prev: goto err; } + if (f2fs_is_valid_blkaddr(sbi, dest, + DATA_GENERIC_ENHANCE_UPDATE)) { + f2fs_err(sbi, "Inconsistent dest blkaddr:%u, ino:%lu, ofs:%u", + dest, inode->i_ino, dn.ofs_in_node); + err = -EFSCORRUPTED; + goto err; + } + /* write dummy data page */ f2fs_replace_block(sbi, &dn, src, dest, ni.version, false, false); From patchwork Wed Oct 19 08:23: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: 4594 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp206302wrs; Wed, 19 Oct 2022 01:52:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6AzZJ7ELnf1rXZTJuoTAlgeV5DSqymzL44Win61TbQ1YiPGen8R+osv8UKM5wgp3GxQPd3 X-Received: by 2002:a17:902:8491:b0:183:c3d2:2112 with SMTP id c17-20020a170902849100b00183c3d22112mr7453172plo.133.1666169524377; Wed, 19 Oct 2022 01:52:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169524; cv=none; d=google.com; s=arc-20160816; b=Rarruxn3SRNk40Qp8C+MEQtzlg/IW6YhChj4MsdaFrd/os6q1RQmF0itoi/3od86kU c60tX4J3tRBIbIaY9mhfs964J3q10DnHQRymIzxdxcl9U6CH8jLNsQSCWNjmq5WUbnzh BXlsghpzk6Br2XQA91LfJdjw5S3Xf500ovBQDQzehPlkuMfuXI1GHY70H2Zgap2OTS+8 6jXuMYCpvd/ftgPCfBEQ5cEX8hkbMp4obNKvUHllBP3EupB/DyyzdML04XbPivPMXy/V 5bPONHlQY0rsIb9VdATyiJg2H/UvQ3QDRCF8PzskCKGKy1MiAMzdCT31e9WZmPRcz1S/ 57Ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=u3B7XDkZcISGChI/dg/BDyHJyUOKSAzXdl0aP/9b5Os=; b=XFYuYeiIxSZb+65ZDYln1La7LGudXlSZHlXbqoypS1jiswRTwSsap7jEbS8CusuXci MC1xxEoRcrFjac5OdRRLdouW0O9v8O1A+Qq8WIJq031V0C0izk6ceNZnVsOx7VfXUtjT sOT/U8K5iNGCECt5r4s5b24wnBJZ3JopaEyNCSAcj4Kf9vHeyTic8Yfd0JFwnnz7Ps/U iAN/LuSTszcEMmmyNrLztMkM7GzThG12F6Ad7uxfz4z+766/FO77xTfs2vwlfMh2QydF oUTJULvbSTqhnwUWuNi5nhOzyYuENjqzAZmPtYNYGQhsLblARQQZP//f25dhLJnTQxll iAgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WvVTfesF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d2-20020a170902cec200b00172696f35e1si19632690plg.482.2022.10.19.01.51.51; Wed, 19 Oct 2022 01:52: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=WvVTfesF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231336AbiJSIvQ (ORCPT + 99 others); Wed, 19 Oct 2022 04:51:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231640AbiJSIs7 (ORCPT ); Wed, 19 Oct 2022 04:48: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 9260D8E44D; Wed, 19 Oct 2022 01:46:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A862EB822C8; Wed, 19 Oct 2022 08:43:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 224EEC433D7; Wed, 19 Oct 2022 08:43:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169008; bh=903bXRW2DUhCFpE6bokCuojIyas9mnVuFuyZZh7jW5g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WvVTfesFuEsgO902A18d4x4qUpAUZfyVsLN+DUJbx+tPHrF5vazLON1ouUK3RcoVa /kPrdIZ3wJ78TGami25zkOviIMpBnHl5DoLxg1IeDOcMJYue5SbsJv86ZkCwai1bMe lknE7JxeJKfRyWGBoJ9Q/BELwekkEQo9mZOgaWp0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wenqing Liu , Chao Yu , Jaegeuk Kim Subject: [PATCH 6.0 128/862] f2fs: fix to do sanity check on summary info Date: Wed, 19 Oct 2022 10:23:35 +0200 Message-Id: <20221019083255.621306502@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105375327723368?= X-GMAIL-MSGID: =?utf-8?q?1747105375327723368?= From: Chao Yu commit c6ad7fd16657ebd34a87a97d9588195aae87597d upstream. As Wenqing Liu reported in bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=216456 BUG: KASAN: use-after-free in recover_data+0x63ae/0x6ae0 [f2fs] Read of size 4 at addr ffff8881464dcd80 by task mount/1013 CPU: 3 PID: 1013 Comm: mount Tainted: G W 6.0.0-rc4 #1 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.15.0-1 04/01/2014 Call Trace: dump_stack_lvl+0x45/0x5e print_report.cold+0xf3/0x68d kasan_report+0xa8/0x130 recover_data+0x63ae/0x6ae0 [f2fs] f2fs_recover_fsync_data+0x120d/0x1fc0 [f2fs] f2fs_fill_super+0x4665/0x61e0 [f2fs] mount_bdev+0x2cf/0x3b0 legacy_get_tree+0xed/0x1d0 vfs_get_tree+0x81/0x2b0 path_mount+0x47e/0x19d0 do_mount+0xce/0xf0 __x64_sys_mount+0x12c/0x1a0 do_syscall_64+0x38/0x90 entry_SYSCALL_64_after_hwframe+0x63/0xcd The root cause is: in fuzzed image, SSA table is corrupted: ofs_in_node is larger than ADDRS_PER_PAGE(), result in out-of-range access on 4k-size page. - recover_data - do_recover_data - check_index_in_prev_nodes - f2fs_data_blkaddr This patch adds sanity check on summary info in recovery and GC flow in where the flows rely on them. After patch: [ 29.310883] F2FS-fs (loop0): Inconsistent ofs_in_node:65286 in summary, ino:0, nid:6, max:1018 Cc: stable@vger.kernel.org Reported-by: Wenqing Liu Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Greg Kroah-Hartman --- fs/f2fs/gc.c | 10 +++++++++- fs/f2fs/recovery.c | 15 ++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -1078,7 +1078,7 @@ static bool is_alive(struct f2fs_sb_info { struct page *node_page; nid_t nid; - unsigned int ofs_in_node; + unsigned int ofs_in_node, max_addrs; block_t source_blkaddr; nid = le32_to_cpu(sum->nid); @@ -1104,6 +1104,14 @@ static bool is_alive(struct f2fs_sb_info return false; } + max_addrs = IS_INODE(node_page) ? DEF_ADDRS_PER_INODE : + DEF_ADDRS_PER_BLOCK; + if (ofs_in_node >= max_addrs) { + f2fs_err(sbi, "Inconsistent ofs_in_node:%u in summary, ino:%u, nid:%u, max:%u", + ofs_in_node, dni->ino, dni->nid, max_addrs); + return false; + } + *nofs = ofs_of_node(node_page); source_blkaddr = data_blkaddr(NULL, node_page, ofs_in_node); f2fs_put_page(node_page, 1); --- a/fs/f2fs/recovery.c +++ b/fs/f2fs/recovery.c @@ -474,7 +474,7 @@ static int check_index_in_prev_nodes(str struct dnode_of_data tdn = *dn; nid_t ino, nid; struct inode *inode; - unsigned int offset; + unsigned int offset, ofs_in_node, max_addrs; block_t bidx; int i; @@ -501,15 +501,24 @@ static int check_index_in_prev_nodes(str got_it: /* Use the locked dnode page and inode */ nid = le32_to_cpu(sum.nid); + ofs_in_node = le16_to_cpu(sum.ofs_in_node); + + max_addrs = ADDRS_PER_PAGE(dn->node_page, dn->inode); + if (ofs_in_node >= max_addrs) { + f2fs_err(sbi, "Inconsistent ofs_in_node:%u in summary, ino:%lu, nid:%u, max:%u", + ofs_in_node, dn->inode->i_ino, nid, max_addrs); + return -EFSCORRUPTED; + } + if (dn->inode->i_ino == nid) { tdn.nid = nid; if (!dn->inode_page_locked) lock_page(dn->inode_page); tdn.node_page = dn->inode_page; - tdn.ofs_in_node = le16_to_cpu(sum.ofs_in_node); + tdn.ofs_in_node = ofs_in_node; goto truncate_out; } else if (dn->nid == nid) { - tdn.ofs_in_node = le16_to_cpu(sum.ofs_in_node); + tdn.ofs_in_node = ofs_in_node; goto truncate_out; } From patchwork Wed Oct 19 08:23: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: 4660 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212636wrs; Wed, 19 Oct 2022 02:07:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7cE4QMndo6gCccGU9whQKBI44DJXWN1hKkITee2y8SLJnYBF8ae7zt/fNESAp2HqEOV5xO X-Received: by 2002:a17:907:c03:b0:781:fd5a:c093 with SMTP id ga3-20020a1709070c0300b00781fd5ac093mr5876021ejc.89.1666170477724; Wed, 19 Oct 2022 02:07:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170477; cv=none; d=google.com; s=arc-20160816; b=OSLm2As4ym6DqXEIvvAzKPKwGPq7HSs17men/+KA7ypXV+zGi4zrJOxj6SKtTbV5P/ FIW9/poiUmKR18epXEIdVDCbRe+oVwJSye0cQ3FHOqUz7/X6qTIgBRQD9U1ZwYkY6Xcd JdruBXYYK3s4EPvvjR00oAhRxK2AB8YtQlMH2zSqt5Ul+xFS1xOtwueg1410TpSG0eJp ihBWfD6uCVddS9IT4Z7uEyvDFsiIzQkV8EKl9Q7d5k0d8KCQizX529vYvZO7meFYUpD5 H7YweYg7olZUlrt9hWrAnDQS01NyvQDWlg0iEQpcooWX/B+x1WFqtWhNG+dQkaawvCCS og1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+Ca/JK1ES9XxIARCe7m69jxOtMtlGDlkjsaKrT2kj3A=; b=xlPhkLAcPKJlvSChb6P50kOKVjNc3Pk7ZzXUU9I4oExcNfRf7DrPyS6+AYqYTiizhZ acmNNTt4MAYooFmNC0ZGv3+xULpwKLRQ0I9BDCRugLQpHXK7iEv488GoNu2ZjbsbYYjw 3Tg1CJQHdEh+v5qiGo511S/X/QS2jGfKmaclIdtAyORajNQ9nlp+6GeCmVCGCkr99umf L+2BDqAerX7lJkrwG49+5PwSEok2CPJR7oX+o7gjMCpYCeJTZLHGyEVdx4+J8ZhwodhX WtDE567zO7vZKx3GA9rjCrjWqGvZ0BYSeevrRoocNcKF9FEfv5LIBi4NtmcMRy2jKf4H Y5Pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rZry+AhE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a19-20020a50e713000000b00458d23f9fd5si12963310edn.242.2022.10.19.02.07.24; Wed, 19 Oct 2022 02:07: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=rZry+AhE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232216AbiJSJBK (ORCPT + 99 others); Wed, 19 Oct 2022 05:01:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232147AbiJSI7B (ORCPT ); Wed, 19 Oct 2022 04:59: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 3601C915E8; Wed, 19 Oct 2022 01:54: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 C555561812; Wed, 19 Oct 2022 08:43:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB02DC433B5; Wed, 19 Oct 2022 08:43:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169014; bh=tI+zdfLWq2WDPFJtTUntPD5m6A/o/lCJZwMbVoHVPPE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rZry+AhEsa/edDmHgT5wKfTTr+XNoZsoYADt9sG8o7mj7Re2Y8VGsKj8O/otqKLL1 32iCKA4sfwyUmMgYm6Lih6IxFiPGPjJwoE3Td79wLVnsFkytSmvt8qWuRMgu4TV49H 3sqNHvqXapiy9/1e6kEzHX4dZsnMPX36DSN/49hg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eunhee Rho , Chao Yu , Jaegeuk Kim Subject: [PATCH 6.0 129/862] f2fs: allow direct read for zoned device Date: Wed, 19 Oct 2022 10:23:36 +0200 Message-Id: <20221019083255.670387512@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106374704015357?= X-GMAIL-MSGID: =?utf-8?q?1747106374704015357?= From: Jaegeuk Kim commit 689fe57e7ecefd2eeba76c32aa569bb3e1e790d9 upstream. This reverts dbf8e63f48af ("f2fs: remove device type check for direct IO"), and apply the below first version, since it contributed out-of-order DIO writes. For zoned devices, f2fs forbids direct IO and forces buffered IO to serialize write IOs. However, the constraint does not apply to read IOs. Cc: stable@vger.kernel.org Fixes: dbf8e63f48af ("f2fs: remove device type check for direct IO") Signed-off-by: Eunhee Rho Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Greg Kroah-Hartman --- fs/f2fs/f2fs.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -4513,7 +4513,12 @@ static inline bool f2fs_force_buffered_i /* disallow direct IO if any of devices has unaligned blksize */ if (f2fs_is_multi_device(sbi) && !sbi->aligned_blksize) return true; - + /* + * for blkzoned device, fallback direct IO to buffered IO, so + * all IOs can be serialized by log-structured write. + */ + if (f2fs_sb_has_blkzoned(sbi) && (rw == WRITE)) + return true; if (f2fs_lfs_mode(sbi) && (rw == WRITE)) { if (block_unaligned_IO(inode, iocb, iter)) return true; From patchwork Wed Oct 19 08:23: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: 4596 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp206327wrs; Wed, 19 Oct 2022 01:52:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM44fXw5De5f+GtwdK0UmRX/qBWbwzvZjrXDa+NjCOtDDYz2fsoQ3L/2r2g/DqQ2IrWonMPq X-Received: by 2002:a17:90b:4a49:b0:20d:5099:f5cc with SMTP id lb9-20020a17090b4a4900b0020d5099f5ccmr8302807pjb.137.1666169518153; Wed, 19 Oct 2022 01:51:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169518; cv=none; d=google.com; s=arc-20160816; b=VzNfekFtqiJ2oNkiQmvXi28mB4RirLOAKFxsWBsVN1cac/LhVCO7g3aowfTA4Tl7Qd 06+yx8D3Y8QTTKnRLMTuHLdzjL3vC5cCR0Ho9AeY5p13Q//lTGnUJgGwKpfRgEDnXGE8 Z1tkiKRxso/XTIb83Riy9mOsPclfhtR2kDE++r/k/eq2Tz/d6EvB4zVmD02iHgTQMNsj 0co65XV3Vq8HZS1rbQW+GQHCCt++ZLmbghwihQYiKZC2mXd28v3AdpVO8ar4ejZPhOaF JVZDoOpPejkEI//Z+/+vXVm0Jxo7LfXjvOQdJqPNk1gWbzDBOKr5+ioq+3mAqqGtvqgS y2jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=SSCFoykw6FOO9SCXCfgU9pfFvNMe+Z5LomXoHQnUAnM=; b=muGrseIOqi3quCvYh3JE2BL0FwjCHp3kJHzE4ulIoDLWqu7P3ys+PWuSTQWC67eQR7 0ieKFwFTBsGogpMXvMXipYxZHC2B1J41f6NzXORG6+530MAudhxMg02bp7zPzN33h0S/ 0Y3BY64cTl5UE/5UBFeTsnqijWJmofQz9QetL6MWm67+Ff9abwvAHXzOyUGodHebSq9L iIxqLU1R0YHGyskq4hGzNAmbNrFHlg444YAT4BbpJd0zj4w6WdkG0KCQMoYj/g2q8DcM OoZIQjs1Sh1nmOy99Lx0msS1qXnnAr6XUQ2Rf6xYTUHPitRxSB5EdlOG/YQ3QUFhoXu9 ngMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lXd62CKw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f6-20020a056a001ac600b00537b1bc9683si19713238pfv.36.2022.10.19.01.51.45; Wed, 19 Oct 2022 01:51: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=lXd62CKw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231678AbiJSIvX (ORCPT + 99 others); Wed, 19 Oct 2022 04:51:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231728AbiJSItJ (ORCPT ); Wed, 19 Oct 2022 04:49: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 4B6DF7F246; Wed, 19 Oct 2022 01:47: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 47510B822EB; Wed, 19 Oct 2022 08:43:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4BBBC433D6; Wed, 19 Oct 2022 08:43:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169017; bh=GfjJ62WabbxNGfZrN6l/TGRZ5OdTIj100vFWISrqwBw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lXd62CKwgm5/6od99iaKj32dynNQsZoFkyyBALD9EW73MggUtuyuBwk/ayBNWsj00 CHdtWQam3D847S1/DLVdF/utOUztYdo5bo6wdUJUD9tMxtHPtAAEE/OmT/wCySWoAL lDNtdrlxir9llVVW4qSsKKggaoMNY55+gMwWjCbw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Alexey Lyashkov , "Ritesh Harjani (IBM)" , Theodore Tso Subject: [PATCH 6.0 130/862] jbd2: wake up journal waiters in FIFO order, not LIFO Date: Wed, 19 Oct 2022 10:23:37 +0200 Message-Id: <20221019083255.723410171@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105369011228197?= X-GMAIL-MSGID: =?utf-8?q?1747105369011228197?= From: Andrew Perepechko commit 34fc8768ec6089565d6d73bad26724083cecf7bd upstream. LIFO wakeup order is unfair and sometimes leads to a journal user not being able to get a journal handle for hundreds of transactions in a row. FIFO wakeup can make things more fair. Cc: stable@kernel.org Signed-off-by: Alexey Lyashkov Reviewed-by: Ritesh Harjani (IBM) Link: https://lore.kernel.org/r/20220907165959.1137482-1-alexey.lyashkov@gmail.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/jbd2/commit.c | 2 +- fs/jbd2/transaction.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) --- a/fs/jbd2/commit.c +++ b/fs/jbd2/commit.c @@ -570,7 +570,7 @@ void jbd2_journal_commit_transaction(jou journal->j_running_transaction = NULL; start_time = ktime_get(); commit_transaction->t_log_start = journal->j_head; - wake_up(&journal->j_wait_transaction_locked); + wake_up_all(&journal->j_wait_transaction_locked); write_unlock(&journal->j_state_lock); jbd2_debug(3, "JBD2: commit phase 2a\n"); --- a/fs/jbd2/transaction.c +++ b/fs/jbd2/transaction.c @@ -168,7 +168,7 @@ static void wait_transaction_locked(jour int need_to_start; tid_t tid = journal->j_running_transaction->t_tid; - prepare_to_wait(&journal->j_wait_transaction_locked, &wait, + prepare_to_wait_exclusive(&journal->j_wait_transaction_locked, &wait, TASK_UNINTERRUPTIBLE); need_to_start = !tid_geq(journal->j_commit_request, tid); read_unlock(&journal->j_state_lock); @@ -194,7 +194,7 @@ static void wait_transaction_switching(j read_unlock(&journal->j_state_lock); return; } - prepare_to_wait(&journal->j_wait_transaction_locked, &wait, + prepare_to_wait_exclusive(&journal->j_wait_transaction_locked, &wait, TASK_UNINTERRUPTIBLE); read_unlock(&journal->j_state_lock); /* @@ -920,7 +920,7 @@ void jbd2_journal_unlock_updates (journa write_lock(&journal->j_state_lock); --journal->j_barrier_count; write_unlock(&journal->j_state_lock); - wake_up(&journal->j_wait_transaction_locked); + wake_up_all(&journal->j_wait_transaction_locked); } static void warn_dirty_buffer(struct buffer_head *bh) From patchwork Wed Oct 19 08:23:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4562 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp204738wrs; Wed, 19 Oct 2022 01:47:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7VvR48RudNw+EOKK2sf5W/NpSNIFY8Sn/VjXtHBKyQ3zGNXy9AVx48BMzF5XZYY+b9Cr5W X-Received: by 2002:a17:902:ab06:b0:180:556e:1b5e with SMTP id ik6-20020a170902ab0600b00180556e1b5emr7381433plb.93.1666169229019; Wed, 19 Oct 2022 01:47:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169229; cv=none; d=google.com; s=arc-20160816; b=klcXQYlJphqgSp3lTD9RlZ+J3JiEG5UOBtryBalKbcddpM4bE1ob0JBlZ24noaIMqQ fttCy/UG7IJtHoZ5CDWnb7cpa4ULtdLEhlQ0sqyEs6sX6rDXaxWPlWZkRAV18+v/mTKr HEeAB0mNWIZBiqwH4sIVqtOLYGrsAKsR1tu0s8YCLpF/U43ALAxutV0vOquHMF7n9XDT 2z/ygIzVZ9yRx08lqy/THENtzfcmYNZ14Y+1U8nH9OYBEe0x9VJAZaZ1qIZ7dv2fDt4L uzr/jwbfDMRz/piJmPDP+v+k3oMALRKp9gGJG0uSWpe0j38ZeiD2ZNKwFj3gzc7gJtzd U7nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PpMoXHykFRnqMYpjBBc4HYeQQ2aavHS29tDW0qP1RoE=; b=ATuwMYeLzzEGWj0moKEzjlxBzJuC6VMUu/PzkoC1TGL/nCaYM/Ak7y633jAYdUTJy/ IJgXoEWeTZ+n+CJ6ZtFj3RiAXIG/VaCGtGX96yf0ucj6SeGhqes7E5Fd1VyOrcJBt8Ad Sx9XS49cVe41o7J9v+sKMBjIaG9+ttUlBbLVQmkAVijw5J1ekBIfAyvedMZX5ggFnR2N NPF5ZhVGfjwxi8/kNcURuv8rpXieXhf6xix1TgdNK1xE/jmJAsFQyKf+JIGZ9pbz2tnC 42aQ9FJmzG7HY0KKd/2E6LRK7t8WyF3CwO/CLDixsaA1niDlc6uw5ngSkJRVTw/504aw ccCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qDNeQbmK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p2-20020a170902f08200b0017e733a15b6si15607191pla.286.2022.10.19.01.46.47; Wed, 19 Oct 2022 01: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=qDNeQbmK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231511AbiJSIqa (ORCPT + 99 others); Wed, 19 Oct 2022 04:46:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231310AbiJSIo5 (ORCPT ); Wed, 19 Oct 2022 04:44:57 -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 48D0B89831; Wed, 19 Oct 2022 01:43: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 D30AB61808; Wed, 19 Oct 2022 08:43:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC937C433D6; Wed, 19 Oct 2022 08:43:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169020; bh=UglnOpSZq1r0SanQA9k9gKkp/CJxtHsfjA+Q6Eod9qg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qDNeQbmKKIum8sHJRd0vxVEL6V836ZW8TNuFxFb9KUqbMJZQK/Aj+HpDEZ2Pl3h02 g4MMO5AJc9SF/trqJz0vf/DwjeNqDHYNlHdyahmnlasQ2SPGgf1y7g8MeOPmx/zSgX vdH//FlgVLxISsmQk1XFbIBpbwrqWS4kcDk+E3v0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Ye Bin , Jan Kara , Theodore Tso Subject: [PATCH 6.0 131/862] jbd2: fix potential buffer head reference count leak Date: Wed, 19 Oct 2022 10:23:38 +0200 Message-Id: <20221019083255.772010170@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105065579530227?= X-GMAIL-MSGID: =?utf-8?q?1747105065579530227?= From: Ye Bin commit e0d5fc7a6d80ac2406c7dfc6bb625201d0250a8a upstream. As in 'jbd2_fc_wait_bufs' if buffer isn't uptodate, will return -EIO without update 'journal->j_fc_off'. But 'jbd2_fc_release_bufs' will release buffer head from ‘j_fc_off - 1’ if 'bh' is NULL will terminal release which will lead to buffer head buffer head reference count leak. To solve above issue, update 'journal->j_fc_off' before return -EIO. Cc: stable@kernel.org Signed-off-by: Ye Bin Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220914100812.1414768-2-yebin10@huawei.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/jbd2/journal.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -925,8 +925,14 @@ int jbd2_fc_wait_bufs(journal_t *journal wait_on_buffer(bh); put_bh(bh); journal->j_fc_wbuf[i] = NULL; - if (unlikely(!buffer_uptodate(bh))) + /* + * Update j_fc_off so jbd2_fc_release_bufs can release remain + * buffer head. + */ + if (unlikely(!buffer_uptodate(bh))) { + journal->j_fc_off = i; return -EIO; + } } return 0; From patchwork Wed Oct 19 08:23: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: 5373 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp300804wrs; Wed, 19 Oct 2022 05:35:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7zaz/lGareI+0fd0JQsS29oidRKRj8uIFQdguiR+4l1nhvzChVBZYm2TU1Jo4hWxFnWdQo X-Received: by 2002:a17:907:6d0d:b0:78d:f5a9:fe81 with SMTP id sa13-20020a1709076d0d00b0078df5a9fe81mr6551542ejc.628.1666182907033; Wed, 19 Oct 2022 05:35:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666182907; cv=none; d=google.com; s=arc-20160816; b=UnSipBoNYx8675nyMWXaHyUyjaaYxzKaG4T1DqN/Ak/VIwMB4pL/IDvliP33qOtMeJ iGRm+knXmeieR0rhVtcM1JJGNXyOQpHYZzL9/TbD45K0WsJx2WlZOyuTupmJB6ugmmzd 0BEec+uyu1vno3eGKVBPSbTtoJvxPssV1tN6qy7J1/3ve2ukeegliuftRGth6ZmBW+YU JfGvnhr6pPNC2h2jUzqe/Yo9HACOuAs+RCiNkLs5qacKDxGAzYKXqrXfrlh4J8h/wP/7 bYZWF3NWKfCz8BRjmlbAEtMRtT3OU2VA6PCh139ldunVsD2sjxT0V+gYmLbxgFCU+AeP krbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YLt3YcoiNK1k+Qh0bxEW2wzhN0zgJoG3OUWXiiLqoAQ=; b=J7wSpJdMgU/Xsy4Qr9QLKnmu7PsrwxUb+bFP/pmAqMRkj0Fkn8D1Vmm95McpYXZ+bT knzjeCEsnQCkEJ+qVJ3WwYwjhrWGawmaFqI+ZJMIXRb1wJ4BEFHVWZBwIJdkuN6U51HM //vpxNnKWi0eEPkxPSUL9MNUu2xQs4XQUSUme1cfBl3r3oHEnQBjnLkQHWdS47ag/RJL b/prt4wrKvjcc/VK0WP+ApRTPSiBOtBbIjmCfjuGJKBylCdXlJwLYJkhK5U5imcH1V1h sDkzMpbSlt0lI9Bovg2ctcr0YaAwwTfbX2kAniQOFGAv0JPeqFGWut7u2h3FzD8Hir6i kFvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=abzndfw2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r17-20020a170906a21100b0077547abf08fsi14329435ejy.169.2022.10.19.05.34.37; Wed, 19 Oct 2022 05:35: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=abzndfw2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231361AbiJSMV2 (ORCPT + 99 others); Wed, 19 Oct 2022 08:21:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232933AbiJSMUU (ORCPT ); Wed, 19 Oct 2022 08:20: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 1DCBA17D85B; Wed, 19 Oct 2022 04:55: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 683C3B822F1; Wed, 19 Oct 2022 08:43:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD6B8C433D6; Wed, 19 Oct 2022 08:43:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169023; bh=pcrYp1tEOB1siR5JTPtu4gKz+NhgtlicHrG+H9C3vQU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=abzndfw2GbhjON9K5ONmisf2nU3fG87HywNVvQPSmfUtfR+8Mdf3UFBSlONELUIs+ 2spg9qIosSrhhFVrC8xd8agzHoYny/yKbkinK/aTOPYKBVtnCvwEsKSzNUxbQg8mBa LqWpkJtN32qtAzp52e2C053M0Zq+O8o4sJQkXUPI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Ye Bin , Jan Kara , Theodore Tso Subject: [PATCH 6.0 132/862] jbd2: fix potential use-after-free in jbd2_fc_wait_bufs Date: Wed, 19 Oct 2022 10:23:39 +0200 Message-Id: <20221019083255.811132767@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747119407918307861?= X-GMAIL-MSGID: =?utf-8?q?1747119407918307861?= From: Ye Bin commit 243d1a5d505d0b0460c9af0ad56ed4a56ef0bebd upstream. In 'jbd2_fc_wait_bufs' use 'bh' after put buffer head reference count which may lead to use-after-free. So judge buffer if uptodate before put buffer head reference count. Cc: stable@kernel.org Signed-off-by: Ye Bin Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220914100812.1414768-3-yebin10@huawei.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/jbd2/journal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -923,16 +923,16 @@ int jbd2_fc_wait_bufs(journal_t *journal for (i = j_fc_off - 1; i >= j_fc_off - num_blks; i--) { bh = journal->j_fc_wbuf[i]; wait_on_buffer(bh); - put_bh(bh); - journal->j_fc_wbuf[i] = NULL; /* * Update j_fc_off so jbd2_fc_release_bufs can release remain * buffer head. */ if (unlikely(!buffer_uptodate(bh))) { - journal->j_fc_off = i; + journal->j_fc_off = i + 1; return -EIO; } + put_bh(bh); + journal->j_fc_wbuf[i] = NULL; } return 0; From patchwork Wed Oct 19 08:23: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: 4564 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp204783wrs; Wed, 19 Oct 2022 01:47:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4mngDbgdBYpsTOw5FUICaQRVDIgj7AYJJ39hmHFOOX1njn3WBlbmIBC3YVXS73SUIC2Jdz X-Received: by 2002:a62:5a86:0:b0:563:553d:878e with SMTP id o128-20020a625a86000000b00563553d878emr7491231pfb.73.1666169238919; Wed, 19 Oct 2022 01:47:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169238; cv=none; d=google.com; s=arc-20160816; b=P9aJQH5lhl1t13zhJz2xCmvSEfK9q2d8WX5hv6kBSGki0BPyySm57DrxeFjYvM0YK4 OLVHqS9EZqOap5AzRskZy0Isxfo6kCEjTuWGEEX0oRyUeelJHusqlLeKOjMFtPAnzdHc SXXOZnfxswteBKZQLSK9N9QnZ+gPcxuoMJRB/VbWzGbSvBVRA8Fhk4ByKJt2wcn9p9ZG GNWrHkQpiF4FD1PXG/H2H9vV3zCTreaEzA52hTnZM8OUGvUdXhxDT0+v+cDoOJ1piIxx XNNls1ncpt1vlJsAIv1oQd29e8RbvMdSsBId8u568sFlrRGb2NRAFWmsJMKvsOFS1nkb xXfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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+VM+zBZxb3Vn8CGSa1yNCzIUpKgdkvXVHvjiENLezo=; b=pkxVrs/35vHyYcD1xYVRHwkzyb3L7wnjwIKmJi2O1zhLgcrgCgLkAGEC3ph0qtZXar df8UVyvKyA6Kp+S3TQdjGGHyVGdQFSwOABk9FkhykOaU1Z+sftdq7NYJD5puCFfcJrfZ 1my0MMQwgOP6xpAvb/JwZrKywfHckoxtkUE/F6A01n/XYIcNQBs1rYg2FjlFW8Y3HOsO acODfKVNn/HwhWEz0P4nghXrEFCvpOliAWJfbLy+PPkIOgiMOst2L+FNtJt4ZzsXkbJI YpH49nU23EG/BwDOeNw2XVec8QBg+xXJoceJsKkgz4S3w6SGfaB5lVQdLhgvfycHgrT0 2nAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CuaI1m5K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a63f053000000b0044b412c1a77si16568263pgj.362.2022.10.19.01.47.04; Wed, 19 Oct 2022 01: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=CuaI1m5K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231375AbiJSIqu (ORCPT + 99 others); Wed, 19 Oct 2022 04:46:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231376AbiJSIpI (ORCPT ); Wed, 19 Oct 2022 04:45:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1CBA89AE6; Wed, 19 Oct 2022 01:43: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 AAB69617F7; Wed, 19 Oct 2022 08:43:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6A6EC433D6; Wed, 19 Oct 2022 08:43:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169026; bh=uVz+BDY/wMcdakK3a2zAGCIAkzkiJQgDSwU4vNQtw5o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CuaI1m5K5mi5qHFqqbHxxKEcs1J3/4NkVbR/rAFUZMCnAkQeBfyQSv9avLbL5hwuj IEWxJ+CT7xalWDTlP2uv6mMDBvoKgjj7MFFGVA1UOOzjjOFB4CO2qICAZPpFwBd+Dq gCALFiWHrHq+4liPub/V6L4U+7P9dzwBSVBkYjDg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Ye Bin , Jan Kara , Theodore Tso Subject: [PATCH 6.0 133/862] jbd2: add miss release buffer head in fc_do_one_pass() Date: Wed, 19 Oct 2022 10:23:40 +0200 Message-Id: <20221019083255.854394135@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105075669010539?= X-GMAIL-MSGID: =?utf-8?q?1747105075669010539?= From: Ye Bin commit dfff66f30f66b9524b661f311bbed8ff3d2ca49f upstream. In fc_do_one_pass() miss release buffer head after use which will lead to reference count leak. Cc: stable@kernel.org Signed-off-by: Ye Bin Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220917093805.1782845-1-yebin10@huawei.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/jbd2/recovery.c | 1 + 1 file changed, 1 insertion(+) --- a/fs/jbd2/recovery.c +++ b/fs/jbd2/recovery.c @@ -256,6 +256,7 @@ static int fc_do_one_pass(journal_t *jou err = journal->j_fc_replay_callback(journal, bh, pass, next_fc_block - journal->j_fc_first, expected_commit_id); + brelse(bh); next_fc_block++; if (err < 0 || err == JBD2_FC_REPLAY_STOP) break; From patchwork Wed Oct 19 08:23: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: 4597 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp206345wrs; Wed, 19 Oct 2022 01:52:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM70uSlKf6zYnidS2L0D69rMR1EoWz2AGqyfz/+ZsO4R0ZQYVK9lGx60YZZ3+7l/iLBCXByP X-Received: by 2002:a17:90b:4a09:b0:20c:316d:e58b with SMTP id kk9-20020a17090b4a0900b0020c316de58bmr44416796pjb.217.1666169531732; Wed, 19 Oct 2022 01:52:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169531; cv=none; d=google.com; s=arc-20160816; b=pNLjqpW4bp7X5lfga1Dkkuw3dNjFr52fnuYfq3PmJQ191gnacDdynVStUetp/WGcAD L+1U1koK3MmCbjbgsKue+os+Luy31mlqAh+V3UG4S+KOifM43EXLilzTVQR7a51PHORk iMBzHygX5NhUEsAMjjOL8Vu0FIrYHfMCwulEhnGhvpmmajscqB6aEJmYPZnHBErzsLLN oGjbkAibB01i2kiw45bfeLj4kR82fcAR7rxuuGd3vfNTRWnNEQ/JeKUaxCrc9mXF46qb pP7aofo9/dVQgU5HQTrhond3CDeGSN9Tgb0y6GklOqkiQDKz+W81hKYbPaw9SlDjD+2t isbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=EMPq0BaR5/lCInmpm45kPQFoSyWLsnFqt0LsOOBtKBQ=; b=SW8ym7FFTf0tz8bxGVOqkcrUtwew9fblwPVebe8JjaWbSj2LHXoIyoo2C2nlrBkvGc u0XiXMgGUYCJR2TzjMrZqVFOXvDsKeNM7AHLTIoSJ4g1iNifyLOEc8XxyO1cgkBnMNvF NmOBuEgqpwdWISFhwGkv2+HWJ1L41u0UVtRLHGTPaE+QKAI2+9SMS6YCGBJ/0spJ49cB BaumXMCWR+fvBGYdcYVKAjviPAhrmGgwJgv/WVrlDtxjHV7S+XN+Mb1bHun5bHUDTAco M//+BtGt5ImA70SuFVgJnjvRLOjOvRkXq5Q33nTZPEJrx7xh9v57gcVEYc+zBrYIh7N2 RdDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aM6Zfm5T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a63520d000000b004609faa2dbesi17280883pgb.285.2022.10.19.01.51.58; Wed, 19 Oct 2022 01:52: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=aM6Zfm5T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231698AbiJSIvc (ORCPT + 99 others); Wed, 19 Oct 2022 04:51:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231781AbiJSItP (ORCPT ); Wed, 19 Oct 2022 04:49: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 2CD402937B; Wed, 19 Oct 2022 01:47:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 33920B822E7; Wed, 19 Oct 2022 08:43:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C722C433C1; Wed, 19 Oct 2022 08:43:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169028; bh=I5YDn81jI/EDADv6zzlsMUgkxvYfnlhwaafu72TSR3A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aM6Zfm5TB/Xz7xPYsbQ7V81QFI417R1YTk49FjwJCrX+PtHHkZt4DfsvhcMdQ6Lbx ze70/a/osJXSJ7885yyQDYk65ppcexUpnGbw5HjCTqE4I/FmHTsVSrTbGHfawV/g1c cU57PxeB0d3ke+iecvcx8SJs12oDrAxnQUKPfJY8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+0f2f7e65a3007d39539f@syzkaller.appspotmail.com, Jan Kara , kernel test robot Subject: [PATCH 6.0 134/862] ext2: Add sanity checks for group and filesystem size Date: Wed, 19 Oct 2022 10:23:41 +0200 Message-Id: <20221019083255.893841253@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105382727548036?= X-GMAIL-MSGID: =?utf-8?q?1747105382727548036?= From: Jan Kara commit d766f2d1e3e3bd44024a7f971ffcf8b8fbb7c5d2 upstream. Add sanity check that filesystem size does not exceed the underlying device size and that group size is big enough so that metadata can fit into it. This avoid trying to mount some crafted filesystems with extremely large group counts. Reported-by: syzbot+0f2f7e65a3007d39539f@syzkaller.appspotmail.com Reported-by: kernel test robot # Test fixup CC: stable@vger.kernel.org Signed-off-by: Jan Kara Signed-off-by: Greg Kroah-Hartman --- fs/ext2/super.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) --- a/fs/ext2/super.c +++ b/fs/ext2/super.c @@ -1052,6 +1052,13 @@ static int ext2_fill_super(struct super_ sbi->s_blocks_per_group); goto failed_mount; } + /* At least inode table, bitmaps, and sb have to fit in one group */ + if (sbi->s_blocks_per_group <= sbi->s_itb_per_group + 3) { + ext2_msg(sb, KERN_ERR, + "error: #blocks per group smaller than metadata size: %lu <= %lu", + sbi->s_blocks_per_group, sbi->s_inodes_per_group + 3); + goto failed_mount; + } if (sbi->s_frags_per_group > sb->s_blocksize * 8) { ext2_msg(sb, KERN_ERR, "error: #fragments per group too big: %lu", @@ -1065,9 +1072,14 @@ static int ext2_fill_super(struct super_ sbi->s_inodes_per_group); goto failed_mount; } + if (sb_bdev_nr_blocks(sb) < le32_to_cpu(es->s_blocks_count)) { + ext2_msg(sb, KERN_ERR, + "bad geometry: block count %u exceeds size of device (%u blocks)", + le32_to_cpu(es->s_blocks_count), + (unsigned)sb_bdev_nr_blocks(sb)); + goto failed_mount; + } - if (EXT2_BLOCKS_PER_GROUP(sb) == 0) - goto cantfind_ext2; sbi->s_groups_count = ((le32_to_cpu(es->s_blocks_count) - le32_to_cpu(es->s_first_data_block) - 1) / EXT2_BLOCKS_PER_GROUP(sb)) + 1; From patchwork Wed Oct 19 08:23: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: 4598 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp206381wrs; Wed, 19 Oct 2022 01:52:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6d+lCNdlR94a17xLDCn77XEPsSesrnu1zfBK4uKDDAEf4wCFPjkkEmv9Fz8DV1rKadnSpu X-Received: by 2002:a17:90b:1b4c:b0:20d:70d8:1491 with SMTP id nv12-20020a17090b1b4c00b0020d70d81491mr43902982pjb.3.1666169537888; Wed, 19 Oct 2022 01:52:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169537; cv=none; d=google.com; s=arc-20160816; b=p7MmIpQh74F5F6sRY6tCc9AzjymIcDbzJAbuWrQn9Y0BuY9F5cznGuaxaTLOcHsyJY 9EHdoFGd0E4hAgCmL9O33EXAm8R/8nROK11NBlWFUgqIePSnKD2ppcnDAer9s1Tjx4rz SIrHTCY+W7CL+9PkjnDNCj9PZTUE+Q1EYWst1p7UF/P1A53mISL/zVsjheuDckQ4y2+Q txt+T+OkVfYM1GktOIv84UkLkwpU3NQ6heVcAkC4ELdQXdJVYT1WzGkIIzyB2DILWDpg oLgGMiWrWLDcPhFDNUDJsqFzmC54fJYgmiqA5TnclR7oH9ndHdnILN40PpKtUDIQwy0z QVxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=m49jpakqcS+pMsfs+2HIGT8CfiFY26dem++jhC8McOw=; b=qd5v5h/fn7HxZimo/lXhFpbZohlUfZVs1LMIlZis5TO58QleF7IwRgHb9QW8X1vCd4 vNGiJlfxIf80qfNnbPhgECz5LwmU0Ai6ifH8Imdh1IHxynEd89foyo7fYE6tzbLaCZDC KNWJMWlfwmnNKkZ4uN69p3bDdGcHjhz3Erhc5L0t8L4dF+RWTFK7DR0ygoBXkxGtlHBK ZeaKilDEfv1fCLALRvHtqK+pD6NvtiymlDFqPsJusyFAhc4JLWskYp2U1H2QBHbxHyfM hIYaLgTPDKEzcJK+PYFlYrrthRzZIZQN2scCURyZdX5siHq2qr10glHywGoqvHxYh7JC 4Ytg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cgOIAn55; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d9-20020a634f09000000b0045f8c545d04si17050498pgb.516.2022.10.19.01.52.04; Wed, 19 Oct 2022 01:52: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=cgOIAn55; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231637AbiJSIvi (ORCPT + 99 others); Wed, 19 Oct 2022 04:51:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231844AbiJSIto (ORCPT ); Wed, 19 Oct 2022 04:49:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6C048683C; Wed, 19 Oct 2022 01: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 ams.source.kernel.org (Postfix) with ESMTPS id 1F506B822E9; Wed, 19 Oct 2022 08:43:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7EB5DC433C1; Wed, 19 Oct 2022 08:43:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169031; bh=VuYyMPGk/XiYhf3Eu9DcvuFVQbCk7pNap3RucA1IkF0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cgOIAn55qVL0SXZfY29Q2KRs9buuSv1M9IZZEa90qxSBMz9F8yvofz6o5dTUfi+r5 V1CvmvfVtSgqVhrMX9FPkIEbgxkYongY2Rx6KsL5fE48cX3q/ei1EK23H/JIh67hbe rZ2yNo0Q+Gk4IIlm+cwyiysjYuozrqXh3cunSHnQ= 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 6.0 135/862] ext4: avoid crash when inline data creation follows DIO write Date: Wed, 19 Oct 2022 10:23:42 +0200 Message-Id: <20221019083255.943389214@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105389402182634?= X-GMAIL-MSGID: =?utf-8?q?1747105389402182634?= 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 @@ -528,6 +528,12 @@ static ssize_t ext4_dio_write_iter(struc ret = -EAGAIN; goto out; } + /* + * 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); offset = iocb->ki_pos; count = ret; From patchwork Wed Oct 19 08:23: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: 4668 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212799wrs; Wed, 19 Oct 2022 02:08:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4uftftr4rXlbEeDDgpwqZ5t/5wgumVh5hCBpNWqbL6eFGVHmx7//X9u3eqTXVomh49CgdB X-Received: by 2002:a17:906:5dce:b0:78d:e71a:6e0 with SMTP id p14-20020a1709065dce00b0078de71a06e0mr5889453ejv.360.1666170498643; Wed, 19 Oct 2022 02:08:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170498; cv=none; d=google.com; s=arc-20160816; b=sydtf9CSay23D+eLcd1BglPY2rLH5OyV6eGwuTNNcEaYrMzwgWtuv5fAQzDtAY8KBs eX87VEpcZ1rgBobkPzw9hRjvbHgkFO163nE0d1fGzd+VAXK1cUrXYjJK7Ikml0Xy8nCM 3SSDsCU7FRd6v6Hw9uKqMO+DlB6mNGbcwIh21ud7AczCkHznApT/lJ7ygWJJTOMR6ROm oUgrnwlCkFZPO/u2gC9PhDWF0kVCny2QKtjRAjrCl14ZAJFoGLpO+s4+34hrGbohhK88 CD2z6+PgXh43Pwrk2WA0T9YFSXNpsnZ+hYTLP3perYEuJTSeEDHYdAj1Bh27GM9V50om auEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3RBOMA4KSOs7ciltZZ4vn7q9XF7MlRafMfQc4czrQv8=; b=eMlV9cwxTVsHQd4X+jQN7kL44J13fVZcVkdyaBoQQ0A8/ZTbZIrleiXxgvQgIIHXZ7 6rW0hFvk3J8bKSZ4VpoojUU+S+gElsD+hXw/Xs4Ch1pjMI0QwcHSqFuPoi6vJT2zvfaV 7zTVq4WFPbWCsVJBp1cn0mT+pCNhyDlP69V4TrOF3ExJ4w5oMZJVNdVh6+j+WhXugbq/ VBtkWoV1TTRcrG9m03DK29Fq8AXQFlaaPXpvRlKrvCKxxIzvsaCoNJr+p1sAvaUp1PWP K+xqaCNPgKT+TWTzb65NUib3uts9U1HdqJdmy6en1DHaoc95BKz1w17MR14PqtfJdiM8 vTZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SUxBeqoM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bq3-20020a056402214300b0044f2eb2de9asi12029807edb.444.2022.10.19.02.07.41; Wed, 19 Oct 2022 02:08: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=SUxBeqoM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232160AbiJSJAi (ORCPT + 99 others); Wed, 19 Oct 2022 05:00:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231987AbiJSI6v (ORCPT ); Wed, 19 Oct 2022 04:58:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A45849DD89; Wed, 19 Oct 2022 01:53:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 45AD2617D1; Wed, 19 Oct 2022 08:43:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54E03C433C1; Wed, 19 Oct 2022 08:43:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169034; bh=F/hirolBpGxpu/uc2JCMoWzXNNZUj+88U+p3ETdyMeE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SUxBeqoMiO8KYKEh7JW+bUgMx+i017e2rlsG8RaEHgXN6mDVJpFhRjodFRyihoHmz PHrYs8r31pEKFqBvkghMRmd8c1MgVJkomIK6cFBGmYnzpdRFj+tJX2CRYCBWtbc3P9 j6hhiJaTg/VysFouI17+3pB1FAZhPD90WkkirtRQ= 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 6.0 136/862] ext4: fix null-ptr-deref in ext4_write_info Date: Wed, 19 Oct 2022 10:23:43 +0200 Message-Id: <20221019083255.990667040@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106396884928688?= X-GMAIL-MSGID: =?utf-8?q?1747106396884928688?= 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 @@ -6653,7 +6653,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 Wed Oct 19 08:23: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: 4600 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp206450wrs; Wed, 19 Oct 2022 01:52:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6e3wbfXs/vz2sAoMqk/AJNeFtEyfaF21dTc3E+IeGQ9L38UMbJW608ThN0lrO/v6CnkZfo X-Received: by 2002:a17:902:e944:b0:179:dee4:f115 with SMTP id b4-20020a170902e94400b00179dee4f115mr7594460pll.141.1666169546126; Wed, 19 Oct 2022 01:52:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169546; cv=none; d=google.com; s=arc-20160816; b=iuFnaLwgKHgeBMv12eDLjZQTAjZ5KDRWr/Qh01FK9Q1c5WmOrE2UrQ4kW/A9f5OKA6 euctMJEn/AYEu8uxPk4dG85ir+PmCEDSJMGNyT4w1633LCWO9//QHacGobO7ltgTcoSC ekvN+L6JqPWYb9PfcTYxB9PAWMJZYlepeSHnXLUiZmFsjg7Hkb0E2PQQTzkbGD5C8Prn x5DBUB3weiXclN+Dl3gT5s2WzkNAD+ekBbySKiJp06RWM4vp23QLY5u8jGsxTBxprEti FLEn5icHcwGsTaqw2L9kJYw8SbWogajHOD7i7upLzbXMotTR0v4e66eiC2kA+v+w0IWL AZYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5fIRVHRlS7m5hqTvd3wrouET1X0sjBb3WWO2vzGsxMA=; b=ZiGmvjAkkH1MzXKFYWiD/Q+LCNaKoJMxJWn4y8VBJ0/aTfxFxpydUR0ggdpNZFBpPR lcmPwHhNArbTsv4e34D/3u8y/y3xXi7KTnlbtPg2HcatgxRf9ow7Fo2j4PrhN/pSfsrj GS/IN0cZUOgF7upH32OYczToDPn5554B8153w1nPlUWCY9kXKYqNz23ICiKkG0z5PS1/ 20r8Dmpl97AHJFXmGdARZE/7E7Se/ul3fnZ6jFtVYJqZYnU0EICksu6oMqMHT3d9ppXT WQWRkS/63weGohBZvXpnqG3nU65Wezokzlx5xelueW49jSh/6l4QEWyRKHSd8KyE1oA1 GSuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=P+UhsUx+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g12-20020a056a0023cc00b00565e95c6dcdsi19191818pfc.356.2022.10.19.01.52.12; Wed, 19 Oct 2022 01: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=P+UhsUx+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231722AbiJSIvw (ORCPT + 99 others); Wed, 19 Oct 2022 04:51:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231974AbiJSIuC (ORCPT ); Wed, 19 Oct 2022 04:50: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 93CFE57E2B; Wed, 19 Oct 2022 01:48:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id F3D3BB822EC; Wed, 19 Oct 2022 08:43:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E2F0C433C1; Wed, 19 Oct 2022 08:43:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169037; bh=0O+iB5m/QXAnOYs1Dmvzn9u6uFowokWOpnnjHiYsCuI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P+UhsUx+mXyQrmSySzxi9jUVqloFWhon0o4QDDXA5lm9s1R6nQxyD90W/LIWMtHQ8 54emroRZMrrSbPg/YWQpJDPtuHhiXOft76v7mXSQwzRR3+ljNJEgiEw4/6egiLY/LT Swy4nf/NDXqoch/U6O5RMPjc8hl63A0HxnsCQCIQ= 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 6.0 137/862] ext4: make ext4_lazyinit_thread freezable Date: Wed, 19 Oct 2022 10:23:44 +0200 Message-Id: <20221019083256.037470765@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105397855097814?= X-GMAIL-MSGID: =?utf-8?q?1747105397855097814?= 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 @@ -3767,6 +3767,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 Wed Oct 19 08:23: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: 5352 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp296596wrs; Wed, 19 Oct 2022 05:27:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7S4KBjb6TqGbahQoShpvYxcgVGdM9MdXgF3V8yC75cJsyIH4I9jOpgNxOcWW8dSw7673HW X-Received: by 2002:a17:902:e88d:b0:185:3ac3:e1fd with SMTP id w13-20020a170902e88d00b001853ac3e1fdmr8288030plg.114.1666182469261; Wed, 19 Oct 2022 05:27:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666182469; cv=none; d=google.com; s=arc-20160816; b=gcWADy/l7pdCfhohz388BD+LlJi832D74Y3yD0lyL89qQ8807fxoEYWSYMGX9aFHq2 KmcOVJG2KhTcu7TBrknHzrQRFuVdldj0z5dTGuViKhZzlqlcyvwAubWCYU6PDvWHIL5c M7rng4e1svBL8Xf8pSgmN/YySjzZwhXteYI3qe63bzMGFa5hoFLxP/iV1YdinoD3cwur bIJZmKNtXOS4SwssmLxn7uvS03BTV2+1GoCzUV54ZPIFBAj0qOIjWr4HxJnL4fXx9Rop tR1w9EP+ncVafoGPwIeVYm+Cj6ktJRbaEBVTKR3L/P662sXrjt7u2OAE0q6f+D0/oSA+ S0hA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=do6Y+uq814wMAU3HzzFU+uzCSKN5Pu7AXEOOKnWguvw=; b=JHKeWLEeAt7ae5dbfUXs3Uu5cTf26DcvG43Ld5X17unWhvhBlCOx/9l1Tvp0yyQjY8 E8XfXqzjM7oQ+PMfn05yFdfjV1yofMOTB1P+S4A1e2sYq558yhSFm7QMs3xZlVb6sBP+ efLkYNuXY3uB0YucJFmu1qcm0KBI5r3YSV2MYva5ttxoi1hBRc0t/n0QgiC1ZIeENoUt 8p2rzz8m9qFM1Bk7mojadgpIrkXAFiOcDjvYsgrd8rIbcx6vvrkMo0nww+x6yzeUTgbE uwvr/1QIBPc8eCtLVXifyMee40Xj9Le5JnWfumVSDLRq82/u+KX3Ja0P+Ch68AKgTGoU 5Kmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=we71KixH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j2-20020a056a00174200b00554245aac47si19056718pfc.283.2022.10.19.05.27.24; Wed, 19 Oct 2022 05:27: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=we71KixH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230247AbiJSMR6 (ORCPT + 99 others); Wed, 19 Oct 2022 08:17:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232944AbiJSMRW (ORCPT ); Wed, 19 Oct 2022 08:17: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 A1DBA6051D; Wed, 19 Oct 2022 04:53: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 B09EFB822EF; Wed, 19 Oct 2022 08:44:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D992C433D6; Wed, 19 Oct 2022 08:43:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169040; bh=mGqmo0S/cZ1DZJ0WQ/Bt9WjSLdXTjqMxohIkX6GdePo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=we71KixHcSMFLmA9PPV8btBkfZoVPANvwJW/jYFOqdtblhfmO9qQQnaZ2UHMzYwR/ NLFLI+prnBCVY+DtmXuoAVCkQYa3gQKmj9HSVQQBBrXfAXx0+RoQAqb6eLagj5sI1f FRIrBmn7MOrX27jbTWCyJsFlc/NI06SJvrZkr8X4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jan Kara , Lukas Czerner , Theodore Tso Subject: [PATCH 6.0 138/862] ext4: fix check for block being out of directory size Date: Wed, 19 Oct 2022 10:23:45 +0200 Message-Id: <20221019083256.084935161@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747118949015625379?= X-GMAIL-MSGID: =?utf-8?q?1747118949015625379?= From: Jan Kara commit 61a1d87a324ad5e3ed27c6699dfc93218fcf3201 upstream. The check in __ext4_read_dirblock() for block being outside of directory size was wrong because it compared block number against directory size in bytes. Fix it. Fixes: 65f8ea4cd57d ("ext4: check if directory block is within i_size") CVE: CVE-2022-1184 CC: stable@vger.kernel.org Signed-off-by: Jan Kara Reviewed-by: Lukas Czerner Link: https://lore.kernel.org/r/20220822114832.1482-1-jack@suse.cz Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/namei.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c @@ -126,7 +126,7 @@ static struct buffer_head *__ext4_read_d struct ext4_dir_entry *dirent; int is_dx_block = 0; - if (block >= inode->i_size) { + if (block >= inode->i_size >> inode->i_blkbits) { ext4_error_inode(inode, func, line, block, "Attempting to read directory block (%u) that is past i_size (%llu)", block, inode->i_size); From patchwork Wed Oct 19 08:23: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: 4584 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp205912wrs; Wed, 19 Oct 2022 01:51:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4qxwFAdjOrO97Kt3CdSo5t+KOQwLXFmosph+WZj1NsqZRXQQMxC0D+Mh0Vjgxj6IbYuGKu X-Received: by 2002:a63:220a:0:b0:463:7c92:ef9d with SMTP id i10-20020a63220a000000b004637c92ef9dmr6306374pgi.42.1666169460081; Wed, 19 Oct 2022 01:51:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169460; cv=none; d=google.com; s=arc-20160816; b=TQUAIzau+un9RqC4G/FTD/tpOW238kp7MLs/8DhO4XK1P1B540WjMsiTqoXeAE42Cw i6ZmsO/jKYn54MW5PjL7SnxNBGpIFejuEteNk7G/fTD5JdISihTcPVhpJ/1tvpOweVSo q+Q34SWXZ5ozW7AfXWbZ2Rujwaa8X3TUN9IfJQHdZeSAiX0Z7H+VDbhp/XiwekogdZi3 QDa624qMMjqey38nZJMopJuPl769y4M4QYeScjFHJUhHliKuYlVn3O0LHxQlRQIg73WU qONCmjq7LHmeKOAs4PsNi6cdWwpa6bkolXLTpxYEqQrVGrXtZm1zLbCb/ls8y2VaAYse spAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=R6uHFraa2OSjPf2EcUleJpx/5BXtLzWBU5RXifaJ0Gg=; b=GGRXNEgmgK2X8Ach046jd2Q3cEAsM5HL+DCLxRPTEJsvdLCb7n57yWlsgY4kwc7R53 UrHeDSCiWdbqEsa+/We+sLm53bVghPVb+0XfAaKCxDuZuMpFlC73E71TpEQbaMlM8e1x LblULTmzJGMFMGQgUYmtXfotqoSwPSM9l5z4qBVzDMxIS3mut68Fx6S95jRHEZ1wXYvc 8JilZmcpMUB9MEfM0B4Ac1LgO7xcr9pAeFqDC6zjzls0/fJdkj8t6eY9zDynkpDjkN97 9FJRM4IKxDIvXH4WYyjiSox+24VIjQt+rqD8PnhmgP60kVGrSEL4o7+BGmZ3WUtUfHIn dg5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DVn8V0s2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x11-20020aa78f0b000000b00560f0fe840asi16687300pfr.157.2022.10.19.01.50.46; Wed, 19 Oct 2022 01:51:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DVn8V0s2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230130AbiJSIuc (ORCPT + 99 others); Wed, 19 Oct 2022 04:50:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230127AbiJSIsd (ORCPT ); Wed, 19 Oct 2022 04:48:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D34F5900D9; Wed, 19 Oct 2022 01:46: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 3C84F617E9; Wed, 19 Oct 2022 08:44:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A690C433C1; Wed, 19 Oct 2022 08:44:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169046; bh=6BEkaoCyr1a3B8J21YBWZZrVNR7enMef3nl7AAJ8oEM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DVn8V0s2fN39fd0SbmScL7NpbXWg9uySJf5WOQXWFrFTQYR3AXIfgCnzyKP071DaG 9t+PfJbLN6XfnpvcV6elGhR7pZDo+JTz870EcNbvkR+rL+Y5wEU4xYZKIYxQCpNJAf fPH+FzeEJAHEMBr5EOJPhXUa434QEXozZ1bqCWrU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Lukas Czerner , Jan Kara , Jeff Layton , "Christian Brauner (Microsoft)" , Theodore Tso Subject: [PATCH 6.0 139/862] ext4: dont increase iversion counter for ea_inodes Date: Wed, 19 Oct 2022 10:23:46 +0200 Message-Id: <20221019083256.132228957@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105307673502748?= X-GMAIL-MSGID: =?utf-8?q?1747105307673502748?= From: Lukas Czerner commit 50f094a5580e6297bf10a807d16f0ee23fa576cf upstream. ea_inodes are using i_version for storing part of the reference count so we really need to leave it alone. The problem can be reproduced by xfstest ext4/026 when iversion is enabled. Fix it by not calling inode_inc_iversion() for EXT4_EA_INODE_FL inodes in ext4_mark_iloc_dirty(). Cc: stable@kernel.org Signed-off-by: Lukas Czerner Reviewed-by: Jan Kara Reviewed-by: Jeff Layton Reviewed-by: Christian Brauner (Microsoft) Link: https://lore.kernel.org/r/20220824160349.39664-1-lczerner@redhat.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/inode.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -5731,7 +5731,12 @@ int ext4_mark_iloc_dirty(handle_t *handl } ext4_fc_track_inode(handle, inode); - if (IS_I_VERSION(inode)) + /* + * ea_inodes are using i_version for storing reference count, don't + * mess with it + */ + if (IS_I_VERSION(inode) && + !(EXT4_I(inode)->i_flags & EXT4_EA_INODE_FL)) inode_inc_iversion(inode); /* the do_update_inode consumes one bh->b_count */ From patchwork Wed Oct 19 08:23: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: 4690 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp213078wrs; Wed, 19 Oct 2022 02:09:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5nKbzkoSugUIE7HtJzA+Kl1I+p6BNOXk82rNLpQol59wjF+ue/ZGj8Y2RInjIs72qidndf X-Received: by 2002:aa7:db07:0:b0:458:f6e5:ab71 with SMTP id t7-20020aa7db07000000b00458f6e5ab71mr6604727eds.330.1666170546934; Wed, 19 Oct 2022 02:09:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170546; cv=none; d=google.com; s=arc-20160816; b=VKh2tNS4pH34v2/geXnuZ3pW+uZ+f5hotpZL6Po5vSOgRTYN5qrDyR4UUL+SVj1QGF KupzlP+ruJjszvf0exzqQHFB/dGJ+q34Zmvth1w01J9onoIvnMWCb15dTn94BJPYnRQ5 I+jWuw9r9T8gdFlnX3J60M3wfU9iqhoWOCNX7+dy0UtpeNqgpLFeYJ7gzHWMXtowODQ9 H5O1s6kF5Rs/oYGoHo7H/CG0I1+FBXPqtB2ilDIaA/8GaEAlE4exroyAt7/jVWNZX/pe Zfga8a8J0+yx7+iQLRouudeX+YgGcztWTJEhNRlB1GbG4WDGYknrD5/S3UwAiJKcPERX fdmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0/0RJKBE4u5q02Gm+yu9poIfkhdwmKUbJiTAbCEpYtQ=; b=WZJWWcZupL7FT0V1uzRiFBQUFmshKMIOCuG+R5kPLO/XpZKPaktH6UAL4ocsOXxc+I mW05EjrEecwjwi58LaogarflLSYzmnYxe311nUmojzLwCba47nwsmvSyQ0lGAdKEQ8fz TKZDUkUGYx2rejTSgWydKS3gfk5sGEAfvJGH8q/ts8UIGyTKtKBLgJqhx5oT/dA6woqd 5lNeh6QsYohOH+Z9YH2Y7GQbyoeNMz3MJzlB0f9SoJtckPacyjfvPfylW66SdzqtCM3X 9EZ2EXAIpZm+WpRSvUcMhrAZyQJicWAZeDtefcF7MltWffg/HIxc1Tu1lkP+1Qwct7c0 KAgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VNKAdhIV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lb25-20020a170907785900b00741d9a1e2dbsi13010312ejc.1004.2022.10.19.02.08.42; Wed, 19 Oct 2022 02:09: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=VNKAdhIV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232191AbiJSJAy (ORCPT + 99 others); Wed, 19 Oct 2022 05:00:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232130AbiJSI67 (ORCPT ); Wed, 19 Oct 2022 04:58:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4CB389AE6; Wed, 19 Oct 2022 01:54: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 09E63617ED; Wed, 19 Oct 2022 08:44:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D16C1C433D6; Wed, 19 Oct 2022 08:44:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169049; bh=L6bCui+LWfZcqs4FoaY6lvRSWnyksq2zNJEPHZlL5D8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VNKAdhIVkjk2Fmlx8agDDrLHhBDcJ669Cy46c9yhtVqpQvoQnCXCVtDqi6ass6kWT gy7XOc9ULTrJAc/uT/3zrpHZCINzPu8GDunEQUdpL9IisdiT+V22SVrAcRMFM+c+fz xJ18Z0lX83pjLLg6o6wwnHx6FFgm1VMmOXmtIG84= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Dave Chinner , Benjamin Coddington , Christoph Hellwig , "Darrick J. Wong" , Jeff Layton , Lukas Czerner , "Christian Brauner (Microsoft)" , Jan Kara , Theodore Tso Subject: [PATCH 6.0 140/862] ext4: unconditionally enable the i_version counter Date: Wed, 19 Oct 2022 10:23:47 +0200 Message-Id: <20221019083256.173609700@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106447377814733?= X-GMAIL-MSGID: =?utf-8?q?1747106447377814733?= From: Jeff Layton commit 1ff20307393e17dc57fde62226df625a3a3c36e9 upstream. The original i_version implementation was pretty expensive, requiring a log flush on every change. Because of this, it was gated behind a mount option (implemented via the MS_I_VERSION mountoption flag). Commit ae5e165d855d (fs: new API for handling inode->i_version) made the i_version flag much less expensive, so there is no longer a performance penalty from enabling it. xfs and btrfs already enable it unconditionally when the on-disk format can support it. Have ext4 ignore the SB_I_VERSION flag, and just enable it unconditionally. While we're in here, mark the i_version mount option Opt_removed. [ Removed leftover bits of i_version from ext4_apply_options() since it now can't ever be set in ctx->mask_s_flags -- lczerner ] Cc: stable@kernel.org Cc: Dave Chinner Cc: Benjamin Coddington Cc: Christoph Hellwig Cc: Darrick J. Wong Signed-off-by: Jeff Layton Signed-off-by: Lukas Czerner Reviewed-by: Christian Brauner (Microsoft) Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220824160349.39664-3-lczerner@redhat.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/inode.c | 5 ++--- fs/ext4/super.c | 22 +++++----------------- 2 files changed, 7 insertions(+), 20 deletions(-) --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -5425,7 +5425,7 @@ int ext4_setattr(struct user_namespace * return -EINVAL; } - if (IS_I_VERSION(inode) && attr->ia_size != inode->i_size) + if (attr->ia_size != inode->i_size) inode_inc_iversion(inode); if (shrink) { @@ -5735,8 +5735,7 @@ int ext4_mark_iloc_dirty(handle_t *handl * ea_inodes are using i_version for storing reference count, don't * mess with it */ - if (IS_I_VERSION(inode) && - !(EXT4_I(inode)->i_flags & EXT4_EA_INODE_FL)) + if (!(EXT4_I(inode)->i_flags & EXT4_EA_INODE_FL)) inode_inc_iversion(inode); /* the do_update_inode consumes one bh->b_count */ --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -1585,7 +1585,7 @@ enum { Opt_inlinecrypt, Opt_usrjquota, Opt_grpjquota, Opt_quota, Opt_noquota, Opt_barrier, Opt_nobarrier, Opt_err, - Opt_usrquota, Opt_grpquota, Opt_prjquota, Opt_i_version, + Opt_usrquota, Opt_grpquota, Opt_prjquota, Opt_dax, Opt_dax_always, Opt_dax_inode, Opt_dax_never, Opt_stripe, Opt_delalloc, Opt_nodelalloc, Opt_warn_on_error, Opt_nowarn_on_error, Opt_mblk_io_submit, Opt_debug_want_extra_isize, @@ -1694,7 +1694,7 @@ static const struct fs_parameter_spec ex fsparam_flag ("barrier", Opt_barrier), fsparam_u32 ("barrier", Opt_barrier), fsparam_flag ("nobarrier", Opt_nobarrier), - fsparam_flag ("i_version", Opt_i_version), + fsparam_flag ("i_version", Opt_removed), fsparam_flag ("dax", Opt_dax), fsparam_enum ("dax", Opt_dax_type, ext4_param_dax), fsparam_u32 ("stripe", Opt_stripe), @@ -2140,11 +2140,6 @@ static int ext4_parse_param(struct fs_co case Opt_abort: ctx_set_mount_flag(ctx, EXT4_MF_FS_ABORTED); return 0; - case Opt_i_version: - ext4_msg(NULL, KERN_WARNING, deprecated_msg, param->key, "5.20"); - ext4_msg(NULL, KERN_WARNING, "Use iversion instead\n"); - ctx_set_flags(ctx, SB_I_VERSION); - return 0; case Opt_inlinecrypt: #ifdef CONFIG_FS_ENCRYPTION_INLINE_CRYPT ctx_set_flags(ctx, SB_INLINECRYPT); @@ -2814,14 +2809,6 @@ static void ext4_apply_options(struct fs sb->s_flags &= ~ctx->mask_s_flags; sb->s_flags |= ctx->vals_s_flags; - /* - * i_version differs from common mount option iversion so we have - * to let vfs know that it was set, otherwise it would get cleared - * on remount - */ - if (ctx->mask_s_flags & SB_I_VERSION) - fc->sb_flags |= SB_I_VERSION; - #define APPLY(X) ({ if (ctx->spec & EXT4_SPEC_##X) sbi->X = ctx->X; }) APPLY(s_commit_interval); APPLY(s_stripe); @@ -2970,8 +2957,6 @@ static int _ext4_show_options(struct seq SEQ_OPTS_PRINT("min_batch_time=%u", sbi->s_min_batch_time); if (nodefs || sbi->s_max_batch_time != EXT4_DEF_MAX_BATCH_TIME) SEQ_OPTS_PRINT("max_batch_time=%u", sbi->s_max_batch_time); - if (sb->s_flags & SB_I_VERSION) - SEQ_OPTS_PUTS("i_version"); if (nodefs || sbi->s_stripe) SEQ_OPTS_PRINT("stripe=%lu", sbi->s_stripe); if (nodefs || EXT4_MOUNT_DATA_FLAGS & @@ -4641,6 +4626,9 @@ static int __ext4_fill_super(struct fs_c sb->s_flags = (sb->s_flags & ~SB_POSIXACL) | (test_opt(sb, POSIX_ACL) ? SB_POSIXACL : 0); + /* i_version is always enabled now */ + sb->s_flags |= SB_I_VERSION; + if (le32_to_cpu(es->s_rev_level) == EXT4_GOOD_OLD_REV && (ext4_has_compat_features(sb) || ext4_has_ro_compat_features(sb) || From patchwork Wed Oct 19 08:23: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: 5360 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp298965wrs; Wed, 19 Oct 2022 05:31:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM51PyDy/vFA8L+pRo53iDzb2D48TnijdMgeJkmHYlrc77jqWABrjhL302+iVs8WvNkkVrVP X-Received: by 2002:a05:6402:c45:b0:442:c549:8e6b with SMTP id cs5-20020a0564020c4500b00442c5498e6bmr7290491edb.123.1666182679103; Wed, 19 Oct 2022 05:31:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666182679; cv=none; d=google.com; s=arc-20160816; b=eoPICY137gkjewaDY0d7KQphSNp8zQurTNGTjGf+BL8cCLdIx5vXETjCm8yG51zo1A 5AI+mDEtAK0SbrWeC4Lidrb8IkyEvJDbwHKQ5jvfyH9/uaoZW0qRHLSi7B0okJCn44Tn 0hr6n4/2G/HOz48/S/074L2gSZpNyNxDFjd5VwsVZCd5cZyYdc443hSLur8QFwXXVTUd GNLT6vjP1OiTp0eS1tqbA9XtsdrW5X7OzfjgnQqELq27bAMmOw4a21Buf/MXG0H0zPFl W3KXmK3jzt8dVZfI7hTrXMiFp8jL+SOYwzhEL+zQv3O2eoYyjRG23yRIgRIpB1Bu5X7c W+9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=m1Cr7vcu731OL4wOHQ4O7l3nifR6B1yafldWCW63Njs=; b=LB0KlOT1d+dp/fKUQ8eaX5qnSBGdawGKVCevdDxvs6QoWnrsQYX2lWCYIjCUz/axAV xOfGAk1OHEv1GTkfJsuZ/4olsVy6IrD5+D58ZdAKZnW1fZsFKMce+xeSwyADmCgQgzoR K0QZzuif4aX0NZScXfzzbDR+yUq4Ryj6IEi8z1D8uAcD1/Txwm7loh7/yA+R5+6rxGck zleAuqQG1Nu4QIqLrIn+eSwO1ygWMJH/qdIjDeLi2+AG6lVocPlXMzARQ/onNcbKjHGp 3+BJED71xcENGEUtLKKqJoStqdvmzPjGXyEs+sd4z+RqhVehveAcszdKayCVg1CYnFNk KdSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qqcwACNf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sb11-20020a1709076d8b00b0078d450cbb02si14431532ejc.452.2022.10.19.05.30.49; Wed, 19 Oct 2022 05:31: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=qqcwACNf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231436AbiJSMTr (ORCPT + 99 others); Wed, 19 Oct 2022 08:19:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233061AbiJSMS7 (ORCPT ); Wed, 19 Oct 2022 08:18:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 233AFB56; Wed, 19 Oct 2022 04:54: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 B055CB822F3; Wed, 19 Oct 2022 08:44:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA801C433C1; Wed, 19 Oct 2022 08:44:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169052; bh=nUERqgW9u3L3Gmp0YEDns3/KS90y3rmvkG6wOm5wYsM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qqcwACNfdv8ioKlc1kJncRwfqZHaT/6UjbqDYSWFzE1vMpbnKtAzlM87LgSVC6iet zI3jHgn3idqvyTeUyk1eugXExXJbxQ96V8dDEUdLVCBTRPCnMu2BnVZCTACdmPbpKw vTensmLcj+iIyGlnsMUMWwJ5HRC82t0ZpzzOvpfg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Zhang Yi , Jan Kara , Theodore Tso Subject: [PATCH 6.0 141/862] ext4: ext4_read_bh_lock() should submit IO if the buffer isnt uptodate Date: Wed, 19 Oct 2022 10:23:48 +0200 Message-Id: <20221019083256.225377856@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747119169367474700?= X-GMAIL-MSGID: =?utf-8?q?1747119169367474700?= From: Zhang Yi commit 0b73284c564d3ae4feef4bc920292f004acf4980 upstream. Recently we notice that ext4 filesystem would occasionally fail to read metadata from disk and report error message, but the disk and block layer looks fine. After analyse, we lockon commit 88dbcbb3a484 ("blkdev: avoid migration stalls for blkdev pages"). It provide a migration method for the bdev, we could move page that has buffers without extra users now, but it lock the buffers on the page, which breaks the fragile metadata read operation on ext4 filesystem, ext4_read_bh_lock() was copied from ll_rw_block(), it depends on the assumption of that locked buffer means it is under IO. So it just trylock the buffer and skip submit IO if it lock failed, after wait_on_buffer() we conclude IO error because the buffer is not uptodate. This issue could be easily reproduced by add some delay just after buffer_migrate_lock_buffers() in __buffer_migrate_folio() and do fsstress on ext4 filesystem. EXT4-fs error (device pmem1): __ext4_find_entry:1658: inode #73193: comm fsstress: reading directory lblock 0 EXT4-fs error (device pmem1): __ext4_find_entry:1658: inode #75334: comm fsstress: reading directory lblock 0 Fix it by removing the trylock logic in ext4_read_bh_lock(), just lock the buffer and submit IO if it's not uptodate, and also leave over readahead helper. Cc: stable@kernel.org Signed-off-by: Zhang Yi Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220831074629.3755110-1-yi.zhang@huawei.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/super.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -205,19 +205,12 @@ int ext4_read_bh(struct buffer_head *bh, int ext4_read_bh_lock(struct buffer_head *bh, blk_opf_t op_flags, bool wait) { - if (trylock_buffer(bh)) { - if (wait) - return ext4_read_bh(bh, op_flags, NULL); + lock_buffer(bh); + if (!wait) { ext4_read_bh_nowait(bh, op_flags, NULL); return 0; } - if (wait) { - wait_on_buffer(bh); - if (buffer_uptodate(bh)) - return 0; - return -EIO; - } - return 0; + return ext4_read_bh(bh, op_flags, NULL); } /* @@ -264,7 +257,8 @@ void ext4_sb_breadahead_unmovable(struct struct buffer_head *bh = sb_getblk_gfp(sb, block, 0); if (likely(bh)) { - ext4_read_bh_lock(bh, REQ_RAHEAD, false); + if (trylock_buffer(bh)) + ext4_read_bh_nowait(bh, REQ_RAHEAD, NULL); brelse(bh); } } From patchwork Wed Oct 19 08:23: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: 4570 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp204926wrs; Wed, 19 Oct 2022 01:47:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4R6pQE9gZZvdyETLfJSL3qmjXAGad2ko1Wo3DGX+y+++N30jkbQC20l2pLLW/g93Q8GSgI X-Received: by 2002:a17:902:a502:b0:184:f2e2:a5ce with SMTP id s2-20020a170902a50200b00184f2e2a5cemr7152786plq.56.1666169271611; Wed, 19 Oct 2022 01:47:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169271; cv=none; d=google.com; s=arc-20160816; b=DtXIgjTpz7MKcm8SbT+spXsLgtPN8hF0u0pH5BO94ctnehrWgIzg/4r+y9/O93CYKs mrRcD5tDOLPSdv1c6NbIMcyDWizd5P83QexbIGthXPjDzLenUrQQH6u1WSQjx/n5Ok9R aFuHNyT80X1VllmLEOVeMwTUSJeEs54RqATHnZ/ZNPxfXMxMAl5UkUBk1ba84TaKh2M5 dWa2vpgatEOjLeX29Cj2FAht4i86wUmak4y5ASmGhYPJ3voUctrc2j0E+fSorKYPXjeu LZxVWz54QtiMDEK8m7OP5XmG3RupgV9EyzGvE94Nyru/uYCGw8al1B7eHT1t2Q/3Q5qc m17w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zg+v+Gl5dyw2REddJ1ixjdeL+pks3AHEObS0bRzHaPU=; b=e/MyYCzaJwYLLI5OatsnK4a3NNOS5FB4qdGjAjU1RGEOcJs1/ZuSebmM/sHQuIRqXR aing1HOdAvdaN+RqOZ3ztoCvbYs2Gn/v/G93sNq8+fW7ecrs5jLE6QblJTURZs/WQnbi suJrFcXfNyeDj/D7DZXUjxjQkLzdOAnSG67K0rFLMHHlS09Du0zJWL3NWdWnuSEMTEPg DEExegxJyXSWwuTkekaRBRcNXd8ZNRlTBqXqcTfKd1gNaS9OGcxoBN5PjOAmnTp/zVLk SMB2kln/94vjJ4my8R5H4Vt9t2lBybn658hvZJRT2J+SZQPxc8zI3x+XKwNyq37OU4Sh rLFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=d36zqZGD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ip4-20020a17090b314400b00202dbe5fc51si22414100pjb.103.2022.10.19.01.47.39; Wed, 19 Oct 2022 01:47: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=d36zqZGD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231557AbiJSIrD (ORCPT + 99 others); Wed, 19 Oct 2022 04:47:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231397AbiJSIpw (ORCPT ); Wed, 19 Oct 2022 04:45:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2B0E868B9; Wed, 19 Oct 2022 01:44:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A3690617AC; Wed, 19 Oct 2022 08:44:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1F63C433D6; Wed, 19 Oct 2022 08:44:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169055; bh=VtFKGsLaErRVzOB9Z09DPYXE6t91wddQ7M2ZiRFgHpo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d36zqZGDmODF1s5zSqRCAvH+CPB9crylxW+0etX7rV1eDtIBejDmZg4mJvbSDLMJ8 oDEAM+jvwMNGRX6Fo5BHr4LUR3z0RhFAgBQTWRgvvsqh03/94QZr7VwaVuc9SZdydv JSihO+j11E3Af5wWTIiGhm4vL5KSFCG5pIsKwFM0= 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 6.0 142/862] ext4: place buffer head allocation before handle start Date: Wed, 19 Oct 2022 10:23:49 +0200 Message-Id: <20221019083256.258802162@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105109905931504?= X-GMAIL-MSGID: =?utf-8?q?1747105109905931504?= 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 @@ -1188,6 +1188,13 @@ retry_grab: page = grab_cache_page_write_begin(mapping, index); 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 Wed Oct 19 08:23: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: 4593 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp206247wrs; Wed, 19 Oct 2022 01:51:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7t+WdH5PukYtH9QvOp0wNQ1cvoX+luK7hzYlsjaBIoVmQ0rTHCMYrQTsSLPFDqFyVLyJ/P X-Received: by 2002:a17:90b:1808:b0:20c:8409:2007 with SMTP id lw8-20020a17090b180800b0020c84092007mr8647465pjb.226.1666169506167; Wed, 19 Oct 2022 01:51:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169506; cv=none; d=google.com; s=arc-20160816; b=m7nGr9QOmmBF0P/ftnjVPr6Dabyc0+YIyBfZKLdYEmdoDlleUg1k1vOmt7ZaWN0dS6 kzNaz+LKhW4iKGCXlzvhmVXaB+YVxamUtyyT7gESLq3rVtxT7fSkehjIeQaHZRU5wu9O Fmw92no8IjaMOChWfkyN0+Nett9k6S5eUm4VSLvVew/pe8o77XT0bATcWJXHqur7BuGf CrJ8lidDMcBLLCQR8VQEwcuRuSmKWo/s1uLeGeGXsczexzFFoGJLj9Nxo2918x8/6/sY g1UY/ubSWyDcPLsKKxVxMSH0y1arO9IBfhieUQC90JwNfyDGmdrrShWsbLtVKPiwDXHL +LXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8Vm8G7yAPoSmvi3kN3hXmaoC0RnVV0ue0jWRIaWI9lk=; b=NDdefzsC091IE2Lq5wBz/pnU4Xmi/uhTf0iRKiWhYnkU//q+O1rl5z6bHGju2QduQx 5U3Tk08mHI2CcP0xs67iP3BH/dnAB+fB+AK9XK3CkJ3Kp5gE+WGs45tjYiULdXFJBBRt napcQ9szrZ5MiT5lOS1XLJrviLdzi5Uc/P+cbveU8VrlNdrj1yw6ONz/47KNyf39ePzs H2geeyoCxhW1+1gyO1UnFoPNBawMB8g2fKowOkdfco0jzyOOP3IcFCwIzu69S7ajWLoo ALwgBeAzw0FJ9glzBd6aGqaA+rRdCIQqKIgBKwUXEZiPUKdwz0/cKZIMVTMRECgE8gad Jbow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UZ5g9RbN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k30-20020a63ff1e000000b004600ab82237si17685821pgi.293.2022.10.19.01.51.33; Wed, 19 Oct 2022 01:51: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=UZ5g9RbN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231661AbiJSIvL (ORCPT + 99 others); Wed, 19 Oct 2022 04:51:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231649AbiJSItA (ORCPT ); Wed, 19 Oct 2022 04:49: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 1C1708E9BF; Wed, 19 Oct 2022 01: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 A25F8617F7; Wed, 19 Oct 2022 08:44:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A71E3C433C1; Wed, 19 Oct 2022 08:44:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169058; bh=hG4656HVgNHfCYkV2W0FvXrC1cK0TQX9tjDFOzCTUWk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UZ5g9RbN/see9F1rwHV473LDw9E8lz1DdloE7g/F6S2mydHJ1UiflrvCn3D2+RCsM Ikiq2rWumKcvKmnV2J40Tww6NYaZBPE44yY/Gwmt+Px8UqH2TVnMEY2Ld52mH7Q1LK GlfoRZLXo0SVPDXSiq4LTi8OOrUI7fhRq/gpJbXk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Lukas Czerner , Jan Kara , "Christian Brauner (Microsoft)" , Jeff Layton , Theodore Tso Subject: [PATCH 6.0 143/862] ext4: fix i_version handling in ext4 Date: Wed, 19 Oct 2022 10:23:50 +0200 Message-Id: <20221019083256.307949361@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105356062246399?= X-GMAIL-MSGID: =?utf-8?q?1747105356062246399?= From: Jeff Layton commit a642c2c0827f5604a93f9fa1e5701eecdce4ae22 upstream. ext4 currently updates the i_version counter when the atime is updated during a read. This is less than ideal as it can cause unnecessary cache invalidations with NFSv4 and unnecessary remeasurements for IMA. The increment in ext4_mark_iloc_dirty is also problematic since it can corrupt the i_version counter for ea_inodes. We aren't bumping the file times in ext4_mark_iloc_dirty, so changing the i_version there seems wrong, and is the cause of both problems. Remove that callsite and add increments to the setattr, setxattr and ioctl codepaths, at the same times that we update the ctime. The i_version bump that already happens during timestamp updates should take care of the rest. In ext4_move_extents, increment the i_version on both inodes, and also add in missing ctime updates. [ Some minor updates since we've already enabled the i_version counter unconditionally already via another patch series. -- TYT ] Cc: stable@kernel.org Cc: Lukas Czerner Reviewed-by: Jan Kara Reviewed-by: Christian Brauner (Microsoft) Signed-off-by: Jeff Layton Link: https://lore.kernel.org/r/20220908172448.208585-3-jlayton@kernel.org Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/inode.c | 14 +++++--------- fs/ext4/ioctl.c | 4 ++++ fs/ext4/xattr.c | 1 + 3 files changed, 10 insertions(+), 9 deletions(-) --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -5349,6 +5349,7 @@ int ext4_setattr(struct user_namespace * int error, rc = 0; int orphan = 0; const unsigned int ia_valid = attr->ia_valid; + bool inc_ivers = true; if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb)))) return -EIO; @@ -5432,8 +5433,8 @@ int ext4_setattr(struct user_namespace * return -EINVAL; } - if (attr->ia_size != inode->i_size) - inode_inc_iversion(inode); + if (attr->ia_size == inode->i_size) + inc_ivers = false; if (shrink) { if (ext4_should_order_data(inode)) { @@ -5535,6 +5536,8 @@ out_mmap_sem: } if (!error) { + if (inc_ivers) + inode_inc_iversion(inode); setattr_copy(mnt_userns, inode, attr); mark_inode_dirty(inode); } @@ -5738,13 +5741,6 @@ int ext4_mark_iloc_dirty(handle_t *handl } ext4_fc_track_inode(handle, inode); - /* - * ea_inodes are using i_version for storing reference count, don't - * mess with it - */ - if (!(EXT4_I(inode)->i_flags & EXT4_EA_INODE_FL)) - inode_inc_iversion(inode); - /* the do_update_inode consumes one bh->b_count */ get_bh(iloc->bh); --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c @@ -452,6 +452,7 @@ static long swap_inode_boot_loader(struc swap_inode_data(inode, inode_bl); inode->i_ctime = inode_bl->i_ctime = current_time(inode); + inode_inc_iversion(inode); inode->i_generation = prandom_u32(); inode_bl->i_generation = prandom_u32(); @@ -665,6 +666,7 @@ static int ext4_ioctl_setflags(struct in ext4_set_inode_flags(inode, false); inode->i_ctime = current_time(inode); + inode_inc_iversion(inode); err = ext4_mark_iloc_dirty(handle, inode, &iloc); flags_err: @@ -775,6 +777,7 @@ static int ext4_ioctl_setproject(struct EXT4_I(inode)->i_projid = kprojid; inode->i_ctime = current_time(inode); + inode_inc_iversion(inode); out_dirty: rc = ext4_mark_iloc_dirty(handle, inode, &iloc); if (!err) @@ -1257,6 +1260,7 @@ static long __ext4_ioctl(struct file *fi err = ext4_reserve_inode_write(handle, inode, &iloc); if (err == 0) { inode->i_ctime = current_time(inode); + inode_inc_iversion(inode); inode->i_generation = generation; err = ext4_mark_iloc_dirty(handle, inode, &iloc); } --- a/fs/ext4/xattr.c +++ b/fs/ext4/xattr.c @@ -2412,6 +2412,7 @@ retry_inode: if (!error) { ext4_xattr_update_super_block(handle, inode->i_sb); inode->i_ctime = current_time(inode); + inode_inc_iversion(inode); if (!value) no_expand = 0; error = ext4_mark_iloc_dirty(handle, inode, &is.iloc); From patchwork Wed Oct 19 08:23: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: 5365 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp299550wrs; Wed, 19 Oct 2022 05:32:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5m6KRGftApw/G0iUBgyey+aJpfyJdwwcz0MQNoMJ0uSONxD9KiBZ+RFTFe5a8F8yWW9JgW X-Received: by 2002:a17:907:97d0:b0:787:c0e9:ed0e with SMTP id js16-20020a17090797d000b00787c0e9ed0emr6733458ejc.274.1666182748412; Wed, 19 Oct 2022 05:32:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666182748; cv=none; d=google.com; s=arc-20160816; b=ITomxGUiNZbuffOQXXvtHbzlBPwqizqUGIdAdpTeQzdLlbWxrwX2B+ObxntMEOmv2V gEFfsCO17IEpYDtvLRXEW5Z+RRt+Cztxlyg2GBEEnq5y2fJxpLIMVFJBQ+mrZtW+euQ/ d0ErS+tQ6FZexmiw4erKZzzbp+SCjeKQAwPqp3flm5ovWDZ0kJ9jMkJB0uF8S7l8eyos SBIueKj0TVHhWWBNrU5QZ8piessH/f3cWsl57VYrCeo8RNdUxChGpRWMdVsjpqjdPXVM WaTDQqyEpujHsrbA63b3NXJwMfnOmZ0lqm7zE8v/kIdgHndenKYmXjRjfpESZ9BHCqzc DaYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=01QJ14LeMpd1FNFss190nAQVI4dAt+8gXh5aDxGKpRk=; b=FwCCnX6gcbiiNiPK5L8rvYsv4Nv+lLE4kerb+1WwzecSgZOGGOSdEs7Ii3Q9eXLvuM vdLxYzHh2LR4d0XPElXvx0Qa6tdaZbskp89mWCWaFYLqPz249E5SX6E+L/vue+dIFcFl k8XjJIRJtCdErGfnl4THTrjoGMzfXDRCIrIK6+dzf3deg8iM74wdVYx0vvbcnA45uQRG AnheX7PM9zjkdYb3xYfaowc2/JUh8xtPmTm7N8X2YW4eL4t+sLPR3gastP2irIMk+tGz kh2cpOIrxvNOWuX+MkvPza1VIZS7wYQCDeGDM7F9dChC8pU7vK2GVqKZMQDV+PjjsZm0 pk/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mnm8IAAl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qf38-20020a1709077f2600b00787f13c332esi14654039ejc.799.2022.10.19.05.32.01; Wed, 19 Oct 2022 05:32: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=mnm8IAAl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232938AbiJSMUU (ORCPT + 99 others); Wed, 19 Oct 2022 08:20:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233207AbiJSMTK (ORCPT ); Wed, 19 Oct 2022 08:19:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E19831004E; Wed, 19 Oct 2022 04:54: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 3A10CB82256; Wed, 19 Oct 2022 08:44:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89A83C433C1; Wed, 19 Oct 2022 08:44:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169061; bh=HJEF7endQpM+60VPzFKP7f1JvxvvavZo44m56jkX12A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mnm8IAAlqigkFfsDultPzOp76Z/LIe+sVS0GySWGQMLPBFxss3h6GdDiJCdE/UD7V oQcFHxRu9Slnb1vLqa11Zo6cSXGH54K0lty9FzB0tOW0L2aPVa08VSQENiGw8l6eKk uxgx3YC4ZBeMmjuoNVsYtVFM1IT+TILUjwsm7SQ8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhihao Cheng , Jan Kara , Theodore Tso Subject: [PATCH 6.0 144/862] ext4: fix dir corruption when ext4_dx_add_entry() fails Date: Wed, 19 Oct 2022 10:23:51 +0200 Message-Id: <20221019083256.348223732@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747119241817572321?= X-GMAIL-MSGID: =?utf-8?q?1747119241817572321?= From: Zhihao Cheng commit 7177dd009c7c04290891e9a534cd47d1b620bd04 upstream. Following process may lead to fs corruption: 1. ext4_create(dir/foo) ext4_add_nondir ext4_add_entry ext4_dx_add_entry a. add_dirent_to_buf ext4_mark_inode_dirty ext4_handle_dirty_metadata // dir inode bh is recorded into journal b. ext4_append // dx_get_count(entries) == dx_get_limit(entries) ext4_bread(EXT4_GET_BLOCKS_CREATE) ext4_getblk ext4_map_blocks ext4_ext_map_blocks ext4_mb_new_blocks dquot_alloc_block dquot_alloc_space_nodirty inode_add_bytes // update dir's i_blocks ext4_ext_insert_extent ext4_ext_dirty // record extent bh into journal ext4_handle_dirty_metadata(bh) // record new block into journal inode->i_size += inode->i_sb->s_blocksize // new size(in mem) c. ext4_handle_dirty_dx_node(bh2) // record dir's new block(dx_node) into journal d. ext4_handle_dirty_dx_node((frame - 1)->bh) e. ext4_handle_dirty_dx_node(frame->bh) f. do_split // ret err! g. add_dirent_to_buf ext4_mark_inode_dirty(dir) // update raw_inode on disk(skipped) 2. fsck -a /dev/sdb drop last block(dx_node) which beyonds dir's i_size. /dev/sdb: recovering journal /dev/sdb contains a file system with errors, check forced. /dev/sdb: Inode 12, end of extent exceeds allowed value (logical block 128, physical block 3938, len 1) 3. fsck -fn /dev/sdb dx_node->entry[i].blk > dir->i_size Pass 2: Checking directory structure Problem in HTREE directory inode 12 (/dir): bad block number 128. Clear HTree index? no Problem in HTREE directory inode 12: block #3 has invalid depth (2) Problem in HTREE directory inode 12: block #3 has bad max hash Problem in HTREE directory inode 12: block #3 not referenced Fix it by marking inode dirty directly inside ext4_append(). Fetch a reproducer in [Link]. Link: https://bugzilla.kernel.org/show_bug.cgi?id=216466 Cc: stable@vger.kernel.org Signed-off-by: Zhihao Cheng Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220911045204.516460-1-chengzhihao1@huawei.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/namei.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c @@ -85,15 +85,20 @@ static struct buffer_head *ext4_append(h return bh; inode->i_size += inode->i_sb->s_blocksize; EXT4_I(inode)->i_disksize = inode->i_size; + err = ext4_mark_inode_dirty(handle, inode); + if (err) + goto out; BUFFER_TRACE(bh, "get_write_access"); err = ext4_journal_get_write_access(handle, inode->i_sb, bh, EXT4_JTR_NONE); - if (err) { - brelse(bh); - ext4_std_error(inode->i_sb, err); - return ERR_PTR(err); - } + if (err) + goto out; return bh; + +out: + brelse(bh); + ext4_std_error(inode->i_sb, err); + return ERR_PTR(err); } static int ext4_dx_csum_verify(struct inode *inode, From patchwork Wed Oct 19 08:23: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: 4854 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223869wrs; Wed, 19 Oct 2022 02:38:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6y2BU07MXU02h8LiOEEQ95IeP2oMLdul3jmD31Hs7Mi2DLHnPOpHI0Q9tJq8jYP2t0nSaN X-Received: by 2002:a17:907:3d8f:b0:78d:b46e:eadd with SMTP id he15-20020a1709073d8f00b0078db46eeaddmr6070109ejc.277.1666172324230; Wed, 19 Oct 2022 02:38:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172324; cv=none; d=google.com; s=arc-20160816; b=bbq4rb9zAKa3oprAq0VCjR91SHZHBseyLtRrex6aDNrHgiLAwEi0HCww8c3JojvnGG mOhIHPLZy0eWJ4x2lzbO7FHpbjWFGOVjZ4EOs6TmVBqiAlNKPQyEtuV52PEbgVT6QrqV ZDTVCr5PE8ai0YjlVW3pk8T4CElBPWkVeoRdAaHtcikEQHoYqUBqtKDdt7/Tt4mpPCA1 1yTSZoMxrvo5VHklp0W6M/h4Sqnaj0U9SbkHUzpkjd7LejHKem97dkHGZrreCPe7Wwl4 gZUmAz9UfoA7mxWtaLC0n1oCb+13WA5BLctiOaia24zxQLHCX5jfxPuHRQl16esGQ0hi Gddg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=U9rzKormMlT8leH8LAAQxWwGQPYSDsvBAJ4mHm9d0TE=; b=PfMhVL/dgtlWoigC94gXIAf73/VODj7J+ftOSOTMQrCJoGYjWuSkrtQQTmD/V/P6uN Mkbtzmq0Tc8oVlnsa2chFpY+4Kd+spS22+D+oVPlSgA+LA4k8QMcz1hs1W+pG5nKHWeB 3OkPe4ha6a/yrjS3GSWb7VCubI7JROPSasaRwSQBEVmFi3ICQqZFadH5NabvVzZpzUWp UyOYOSRBMGQM5R/6xw/pGSn20FIAsijaOPVA5NNQl2Peod+SJo8h0iU6aaT/BKW5wNgx w/v2iLvEQovLfSuXWlZDdZ9yLRg2H3Ct+zRFha3RG+2F+Nus+ALnXSOQBtaCY5ACI1Jn oP2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qHIuVl85; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gs42-20020a1709072d2a00b0078dad42f75dsi14870011ejc.475.2022.10.19.02.38.19; Wed, 19 Oct 2022 02:38: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=qHIuVl85; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233625AbiJSJ2B (ORCPT + 99 others); Wed, 19 Oct 2022 05:28:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233172AbiJSJ0d (ORCPT ); Wed, 19 Oct 2022 05:26:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1C2AE4C20; Wed, 19 Oct 2022 02:11:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 738BE617D7; Wed, 19 Oct 2022 08:44:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82F2FC433C1; Wed, 19 Oct 2022 08:44:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169063; bh=C620LoJ1iYClQH8UWros1PqqPG0tOj5qGlc2syb/41g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qHIuVl85tP3VWCd4c1MuBl7GmOIOtcu05okyAiC913082K+ZVwT0Zi6/385PYAD43 lgJMqLdVaPfqIxZJ0tWpe3vFu1jbsqOCU8Pn0nEnD20k0GEyZjnXN/RB7WyLqKrx5J VDwNQi+eHIGMkg9jzKsH3Lt0YCx78UXZGyCH2Zjw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Ye Bin , Jan Kara , Theodore Tso Subject: [PATCH 6.0 145/862] ext4: fix miss release buffer head in ext4_fc_write_inode Date: Wed, 19 Oct 2022 10:23:52 +0200 Message-Id: <20221019083256.394645446@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108310644659315?= X-GMAIL-MSGID: =?utf-8?q?1747108310644659315?= From: Ye Bin commit ccbf8eeb39f2ff00b54726a2b20b35d788c4ecb5 upstream. In 'ext4_fc_write_inode' function first call 'ext4_get_inode_loc' get 'iloc', after use it miss release 'iloc.bh'. So just release 'iloc.bh' before 'ext4_fc_write_inode' return. Cc: stable@kernel.org Signed-off-by: Ye Bin Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220914100859.1415196-1-yebin10@huawei.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/fast_commit.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) --- a/fs/ext4/fast_commit.c +++ b/fs/ext4/fast_commit.c @@ -874,22 +874,25 @@ static int ext4_fc_write_inode(struct in tl.fc_tag = cpu_to_le16(EXT4_FC_TAG_INODE); tl.fc_len = cpu_to_le16(inode_len + sizeof(fc_inode.fc_ino)); + ret = -ECANCELED; dst = ext4_fc_reserve_space(inode->i_sb, sizeof(tl) + inode_len + sizeof(fc_inode.fc_ino), crc); if (!dst) - return -ECANCELED; + goto err; if (!ext4_fc_memcpy(inode->i_sb, dst, &tl, sizeof(tl), crc)) - return -ECANCELED; + goto err; dst += sizeof(tl); if (!ext4_fc_memcpy(inode->i_sb, dst, &fc_inode, sizeof(fc_inode), crc)) - return -ECANCELED; + goto err; dst += sizeof(fc_inode); if (!ext4_fc_memcpy(inode->i_sb, dst, (u8 *)ext4_raw_inode(&iloc), inode_len, crc)) - return -ECANCELED; - - return 0; + goto err; + ret = 0; +err: + brelse(iloc.bh); + return ret; } /* From patchwork Wed Oct 19 08:23: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: 5539 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp348466wrs; Wed, 19 Oct 2022 07:10:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6VlB2Go8dBBcnLO+XHh4iujFXpGUyMfdZP0t7+uIs0JG4x0LMhB06tQy0Fyb0eH2bX+aQN X-Received: by 2002:a05:6402:148a:b0:459:2eab:9b0a with SMTP id e10-20020a056402148a00b004592eab9b0amr7593059edv.139.1666188609839; Wed, 19 Oct 2022 07:10:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666188609; cv=none; d=google.com; s=arc-20160816; b=jrDXDoTtrx3ljNtTci4xSxWClLV4JPdUqxOaHTXHxpiw8/WgYRY2nzS6DOnhHAVsik 1d2zUi4+KSG4SXAlU+A1ZudDn/8YyBZ1QLcP38eNUmbkv7NupHBBONsQDQGeVs1by9xZ tu0IFY/fRlgOOS3n/kgZBPTOGTBVtOSH4qAPiPM8VIZl/6dXYHmV5045GUhVU2EFG4IC m/f67VtahJqlb1MgelGnnyf3xnVmUzLZtgtbkRs3Woa95Q1ZTJhA/t3mKCm6rtZkG7BR HlI8MeB05Loyh5T9Lf/XLfID6zPkg60jLnjxI447z6aDQk/TCGTUeUUuE+iOPrwzVeYy hAwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MtZArkGlv5buEWRZ/YUpKagsJinPtiWhFfZbrZL4mb8=; b=i5WY00VTrn0mOqyMTWPRiJeLP4A70r16216p2xLHaNtbKtHL3Ah4RuQ5HFuOEknFOA XG0eq096Qy4h2yoxpvSOTji9EYLzY0iWbt9V0HwBmgar4N6hwLEcVpzFML7Z1tVjIJqQ AA7EW4UsY729CQgWCefWTrLjbys7j6XnE1EM1SaqAwv7g1a+JutRTJuhVvJ1WFwBRi1Q 5SyJ3kUFKS7JX2w4hSasYKNkM4JP5c6G6WhuSaFDg3pW0qIOxU8/NKPy8xQsxBiBV5Oi TneyGnbj1cB0qR70/RA0R9M5xq2hvaPHgpKKUDs4Y7WQ7yfaADtiwB4u2oDTa+rE7uA+ r7Rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lmFJOuNb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g14-20020a1709065d0e00b0078219af8361si13662319ejt.883.2022.10.19.07.09.38; Wed, 19 Oct 2022 07:10: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=lmFJOuNb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233752AbiJSNwh (ORCPT + 99 others); Wed, 19 Oct 2022 09:52:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233723AbiJSNwD (ORCPT ); Wed, 19 Oct 2022 09:52:03 -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 73526189C34; Wed, 19 Oct 2022 06:35: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 5E322CE20F4; Wed, 19 Oct 2022 08:44:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 616C5C433C1; Wed, 19 Oct 2022 08:44:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169066; bh=A/EfSodavLN3vkOq7yofx8nSRK5ew/SrXZ7YRPbEBvs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lmFJOuNbjmgXpeVt8U9PFNh2MBqNlpjqhi1twmiCrsgYmDg5WucjA4KM4tFzIx3HU JA4TjmklN0usltLI5enZ3s5FNQe5LSIwBKmaAmUSJW1UozjsOqRGHq7Ud20W4Vxc4I embrhulrCr6FYBPvOusUdNqw9XqfwpzMSr3ft82M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Ye Bin , Jan Kara , Theodore Tso Subject: [PATCH 6.0 146/862] ext4: fix potential memory leak in ext4_fc_record_modified_inode() Date: Wed, 19 Oct 2022 10:23:53 +0200 Message-Id: <20221019083256.438343884@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747125387915087205?= X-GMAIL-MSGID: =?utf-8?q?1747125387915087205?= From: Ye Bin commit 9305721a309fa1bd7c194e0d4a2335bf3b29dca4 upstream. As krealloc may return NULL, in this case 'state->fc_modified_inodes' may not be freed by krealloc, but 'state->fc_modified_inodes' already set NULL. Then will lead to 'state->fc_modified_inodes' memory leak. Cc: stable@kernel.org Signed-off-by: Ye Bin Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220921064040.3693255-2-yebin10@huawei.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/fast_commit.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) --- a/fs/ext4/fast_commit.c +++ b/fs/ext4/fast_commit.c @@ -1494,13 +1494,15 @@ static int ext4_fc_record_modified_inode if (state->fc_modified_inodes[i] == ino) return 0; if (state->fc_modified_inodes_used == state->fc_modified_inodes_size) { - state->fc_modified_inodes = krealloc( - state->fc_modified_inodes, + int *fc_modified_inodes; + + fc_modified_inodes = krealloc(state->fc_modified_inodes, sizeof(int) * (state->fc_modified_inodes_size + EXT4_FC_REPLAY_REALLOC_INCREMENT), GFP_KERNEL); - if (!state->fc_modified_inodes) + if (!fc_modified_inodes) return -ENOMEM; + state->fc_modified_inodes = fc_modified_inodes; state->fc_modified_inodes_size += EXT4_FC_REPLAY_REALLOC_INCREMENT; } From patchwork Wed Oct 19 08:23: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: 4599 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp206406wrs; Wed, 19 Oct 2022 01:52:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5f0HHqL8lTMFXq/mtJYzYuKlyDYoH096VyYWunH0tOQU0vI5KsOfEB+xYAcq0k5EcEOU+N X-Received: by 2002:a05:6a00:124d:b0:566:8645:dad2 with SMTP id u13-20020a056a00124d00b005668645dad2mr7703436pfi.5.1666169542337; Wed, 19 Oct 2022 01:52:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169542; cv=none; d=google.com; s=arc-20160816; b=q6hd9+Xn5/F2si0lLKEUsNPxRHhkn/PzmorfYXQOoCn9S63ruxVhh1zo6Xka/gx92p AG1ZvYhzpBisjJwlTkeTaxvC6gUZn1ATOenibwfYqObfk6ACOHq3eMS9kBaLSa1lRPhG P6XteHE9t9ebOwN6Ev8n0K8YuCRi8rzfXND8keq26kwu5DXcPzxLk5tc4EoWNeHkVSFR yHmsISZIAn4SgOy+eXKjNKsCoCEVFXoR1kgab7IbHC6QNz6FcIqHoMKAYPRZlSsgC1j8 1kjhyd+RPmII5XJMB8SN9TOh+b0+HMpIw/XSAR2MJUZvZJCDVmc0d2Zf6O2ilR59/8BA rJdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=r+Q/URr8hJeUs+c7Md1YfY+258tj0MaGOnHuf0dUwdY=; b=xViorNA1In9h73vMDM+KXt4j/dEgjo6SzadjNeBlAAz4fq37pFWsEIjP9C47fKIDvz ALThfHttUdXjDh3DzAmk4QmRJTATcg5fnvCtz629z8sY+WTQI/ZXl8XzBnCOUmQb+zpd 5IGryL71q4NRH31xuw0DWRQluJa1fzLSnM+QnXookD72NXcPFDMwBWl3w9664deeKx0d 1wY5wxVbLdr3yhyiLdL8REUldfdp5k689myq3ai1V3wv8bfJX9zmufwJI7PKr2/Tnd8t TvXJ1zjUk3LWfctgfryY22KB81OQUz9cffEP5pzD+/ebxXqivgIBnU0cBMnyHGkWP764 hzpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="kc/ZFTGT"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a056a00174700b005660f2c4b27si18633043pfc.274.2022.10.19.01.52.10; Wed, 19 Oct 2022 01:52: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="kc/ZFTGT"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231715AbiJSIvn (ORCPT + 99 others); Wed, 19 Oct 2022 04:51:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231888AbiJSItt (ORCPT ); Wed, 19 Oct 2022 04: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 D1CBC89CFB; Wed, 19 Oct 2022 01: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 73C2C61805; Wed, 19 Oct 2022 08:44:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73C99C433D6; Wed, 19 Oct 2022 08:44:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169069; bh=H2f0utUE260eE+Vd88zICS6WI0lF7gGGbPGRjwWNoew=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kc/ZFTGTfghIZgblZew14UZ6RyuxX/LvsPhRg2U7V0BbV8qcVSIVYc2VvkG2GjMhk +5D9DmGsgwNLxpeneZaTW1pxMLgWiZbHFK1E6br2eQk1TnN9brgkUVts4lbFlM9YD3 ykqfldsQUAD6Y99yYFekQDPEhHpO8kKTM4dCpJZ4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Ye Bin , Jan Kara , Theodore Tso Subject: [PATCH 6.0 147/862] ext4: fix potential memory leak in ext4_fc_record_regions() Date: Wed, 19 Oct 2022 10:23:54 +0200 Message-Id: <20221019083256.486598993@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105394328005829?= X-GMAIL-MSGID: =?utf-8?q?1747105394328005829?= From: Ye Bin commit 7069d105c1f15c442b68af43f7fde784f3126739 upstream. As krealloc may return NULL, in this case 'state->fc_regions' may not be freed by krealloc, but 'state->fc_regions' already set NULL. Then will lead to 'state->fc_regions' memory leak. Cc: stable@kernel.org Signed-off-by: Ye Bin Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220921064040.3693255-3-yebin10@huawei.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/fast_commit.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) --- a/fs/ext4/fast_commit.c +++ b/fs/ext4/fast_commit.c @@ -1687,15 +1687,17 @@ int ext4_fc_record_regions(struct super_ if (replay && state->fc_regions_used != state->fc_regions_valid) state->fc_regions_used = state->fc_regions_valid; if (state->fc_regions_used == state->fc_regions_size) { + struct ext4_fc_alloc_region *fc_regions; + state->fc_regions_size += EXT4_FC_REPLAY_REALLOC_INCREMENT; - state->fc_regions = krealloc( - state->fc_regions, - state->fc_regions_size * - sizeof(struct ext4_fc_alloc_region), - GFP_KERNEL); - if (!state->fc_regions) + fc_regions = krealloc(state->fc_regions, + state->fc_regions_size * + sizeof(struct ext4_fc_alloc_region), + GFP_KERNEL); + if (!fc_regions) return -ENOMEM; + state->fc_regions = fc_regions; } region = &state->fc_regions[state->fc_regions_used++]; region->ino = ino; From patchwork Wed Oct 19 08:23: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: 5375 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp300939wrs; Wed, 19 Oct 2022 05:35:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4iLjeU/2ljTNGA9aH9GutOqevPnwa4Xf+1ViqP/GQzREridViKc0Yhs46bhAC8zv2vcUoJ X-Received: by 2002:a17:902:f54f:b0:185:4ff6:fef4 with SMTP id h15-20020a170902f54f00b001854ff6fef4mr8444122plf.116.1666182922467; Wed, 19 Oct 2022 05:35:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666182922; cv=none; d=google.com; s=arc-20160816; b=s5YuPZCfjjdPrzjcQWfYEpuj18TZb01mIZ5vpnw0ccMBarsZ34Mm3Fkwa5wH6ToJoG F/IoL27G2UzoJVELH21A81R+npLJhdOhiXRpps00u0TkAtgP6Az68S0COO+87usprA7e cZAUe1OtiLtFMrX6w7trNvPkU9akFSdg5Bs1CE/Jl9hqAKir+HaCmPvyc/Cb3zrCssZM tbtbd+3Rfjgx1pOi7ywk9thJd2UsiCTOw0S+9nxc+BZHhkWns4mxUSchEHIYh3ZWVvVJ 8LVc/Hc3B0gPeczbAZl7PgdGRBJTOomhHe0d/2VYtjZu2HDwXo3DKnewdol5TW73/EWh 5mRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gE1FL/73tnX4zr3Q83H8ZP7oSujxVaiQXOeqwFyp5OU=; b=gai1HHJXmjdJcci6BN/oFmHBnUjMKtq7i/uRpVTa55kz74KWvfyXYAJvzWRP1RX7db s8KYwAeDTdRFMCevyLFRARPdXO0uFMjlTB0AYgfGzpXsBm/JA0DsBy1GNxxgsDl7eiP+ xgZZvh+q5h5DfIRCFlbn94Kvacw555m/mu71POOgVht/YbQS0JtCJZP863dR0bwHKYX7 BdTUGd3Hx814s0MRFtIvzlGGGKdfslJx1dgTqO3D6TngSid4JtXff4w2cpqw30KOMl3w GwGRWNQMn9V4vnj/9i9qYcvLE+GTJMj55sH3h8IBVRM3qe3GiJUn0CwajqgIg2lOiOki zhoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=awbIWSWQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w14-20020a170902e88e00b00176e85e5ceasi20918375plg.405.2022.10.19.05.35.07; Wed, 19 Oct 2022 05:35: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=awbIWSWQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232214AbiJSMVd (ORCPT + 99 others); Wed, 19 Oct 2022 08:21:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232739AbiJSMUw (ORCPT ); Wed, 19 Oct 2022 08:20: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 0FC40110B0C; Wed, 19 Oct 2022 04:55: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 EC2A0B822BC; Wed, 19 Oct 2022 08:44:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B00AC43470; Wed, 19 Oct 2022 08:44:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169072; bh=pEMmLSxLkhJ7Q0G0EGdPJvux2Lqx48XdeRTTspi2RpU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=awbIWSWQYJSLNnIQo8teebr7cr4ap+cTbPNuBbzs4OjhGQ0rpbaDGAbY0UwOavgjw H9PS8YoRK0U+KHaDnF5fEMmoajgmv27WZW96yxQVRuHqdkYRJBy40UQleQCDZuliOZ iSh/wnz7vHvJcY70IJyuQsf9ztT5VkJfwW5bqWQ4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Ye Bin , Jan Kara , Theodore Tso Subject: [PATCH 6.0 148/862] ext4: update state->fc_regions_size after successful memory allocation Date: Wed, 19 Oct 2022 10:23:55 +0200 Message-Id: <20221019083256.535541872@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747119424231464753?= X-GMAIL-MSGID: =?utf-8?q?1747119424231464753?= From: Ye Bin commit 27cd49780381c6ccbf248798e5e8fd076200ffba upstream. To avoid to 'state->fc_regions_size' mismatch with 'state->fc_regions' when fail to reallocate 'fc_reqions',only update 'state->fc_regions_size' after 'state->fc_regions' is allocated successfully. Cc: stable@kernel.org Signed-off-by: Ye Bin Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220921064040.3693255-4-yebin10@huawei.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/fast_commit.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) --- a/fs/ext4/fast_commit.c +++ b/fs/ext4/fast_commit.c @@ -1689,14 +1689,15 @@ int ext4_fc_record_regions(struct super_ if (state->fc_regions_used == state->fc_regions_size) { struct ext4_fc_alloc_region *fc_regions; - state->fc_regions_size += - EXT4_FC_REPLAY_REALLOC_INCREMENT; fc_regions = krealloc(state->fc_regions, - state->fc_regions_size * - sizeof(struct ext4_fc_alloc_region), + sizeof(struct ext4_fc_alloc_region) * + (state->fc_regions_size + + EXT4_FC_REPLAY_REALLOC_INCREMENT), GFP_KERNEL); if (!fc_regions) return -ENOMEM; + state->fc_regions_size += + EXT4_FC_REPLAY_REALLOC_INCREMENT; state->fc_regions = fc_regions; } region = &state->fc_regions[state->fc_regions_used++]; From patchwork Wed Oct 19 08:23: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: 4858 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223890wrs; Wed, 19 Oct 2022 02:38:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7db/ZDrASxZxt3QQb/pereIF0p8PrCYHGpz6zw44RrxVRERdiChERPdTzRTgX3wz9M4/WJ X-Received: by 2002:a63:211a:0:b0:451:f444:3b55 with SMTP id h26-20020a63211a000000b00451f4443b55mr6256150pgh.60.1666172325737; Wed, 19 Oct 2022 02:38:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172325; cv=none; d=google.com; s=arc-20160816; b=IN66pkT1xTQOVllYZJWbInVcGwN150bCEQTxvvPP7ElOFGzRrN/vEttA1wybZMkB4q X9bY2XF264ltibkxWrv9xbPBZ5hVlk5EOm4XJ+D/KAUID+oLr1hgtaBrWhz5D4YpcdBm dihefSRtIJOPc5+Y+OPx+d/ohhb6haPa/C5s6Xvm/x+d4hb2Ayk/aiOtc9seU8wOQ/Ok ajNHWs9BdEmvOq2U7akr2fVYErThAAT/AcNU1Kwt3rpZbLIN5RydUab2lxhYI/yYoTdA EnaX2s20PZT67EyCT/82grLY/yqzOmVZ1RjNtJBi0/xCK5j/kQggdG1khpTid1DoSXgF DswQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NdJFjoiW/atX5bteV+PLDwjBGvX9amQkkYKPtpVOFqE=; b=tItaImQqHdw79kaem4NKxuGiaK3LHgLZvH2QnMReBASjrEXBKuw5CjIt7jP5psbPcc +n/F3AEAkKuPNMfh6i+uguH4eg+X6dx4N1uXg+DBsqQp0nAOr4xyfx5FLcYI8T7EwnOD BwswDfutDVeVRHpALd42quTUbP9+ntafQqldkhbfiTzHg2UfImRsFnccPNzqzCeQuRmA oT7nJjXc1hKJn1p2/nXkPKKNnRmir31kx1Wt3JjSff2DLuYn4uzYvNch4CAUA2UEX8yI 9jeaQlwNjrCG4iKrydgCIXROTLru00tMBHsag6VFRXvowK2SRkw7ZWA7SmztI7EfXa6q GJBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pX1e9vLY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a63f543000000b00434dd6f6e21si19566792pgk.125.2022.10.19.02.38.33; Wed, 19 Oct 2022 02:38: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=pX1e9vLY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233498AbiJSJWK (ORCPT + 99 others); Wed, 19 Oct 2022 05:22:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233230AbiJSJUT (ORCPT ); Wed, 19 Oct 2022 05:20:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C4F51B9C8; Wed, 19 Oct 2022 02:09: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 54C6B61803; Wed, 19 Oct 2022 08:44:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43EE1C433D6; Wed, 19 Oct 2022 08:44:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169078; bh=muXk5+zb//UYPKqFzeIirwUDgkQcWmRmo0xZyDuWdZY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pX1e9vLYAhCTExT6L00cCq5cXAtIRmrHzoi/Mj2m85Ames4X23+gGcmaamvCJ+L/w YHIPSAffp4ExNj7gwvag8Z6snyYSCkhFfs4RAm44mtqz6mTvWwPfz8x7/qYZfTHWYP CHvgaaLYdhbMCpto/R0Mmn02ct2WPOt4Ik4Ptfgg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rik van Riel , Breno Leitao , Petr Mladek , Josh Poimboeuf , stable@kernel.org Subject: [PATCH 6.0 149/862] livepatch: fix race between fork and KLP transition Date: Wed, 19 Oct 2022 10:23:56 +0200 Message-Id: <20221019083256.575534522@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108312768430445?= X-GMAIL-MSGID: =?utf-8?q?1747108312768430445?= From: Rik van Riel commit 747f7a2901174c9afa805dddfb7b24db6f65e985 upstream. The KLP transition code depends on the TIF_PATCH_PENDING and the task->patch_state to stay in sync. On a normal (forward) transition, TIF_PATCH_PENDING will be set on every task in the system, while on a reverse transition (after a failed forward one) first TIF_PATCH_PENDING will be cleared from every task, followed by it being set on tasks that need to be transitioned back to the original code. However, the fork code copies over the TIF_PATCH_PENDING flag from the parent to the child early on, in dup_task_struct and setup_thread_stack. Much later, klp_copy_process will set child->patch_state to match that of the parent. However, the parent's patch_state may have been changed by KLP loading or unloading since it was initially copied over into the child. This results in the KLP code occasionally hitting this warning in klp_complete_transition: for_each_process_thread(g, task) { WARN_ON_ONCE(test_tsk_thread_flag(task, TIF_PATCH_PENDING)); task->patch_state = KLP_UNDEFINED; } Set, or clear, the TIF_PATCH_PENDING flag in the child task depending on whether or not it is needed at the time klp_copy_process is called, at a point in copy_process where the tasklist_lock is held exclusively, preventing races with the KLP code. The KLP code does have a few places where the state is changed without the tasklist_lock held, but those should not cause problems because klp_update_patch_state(current) cannot be called while the current task is in the middle of fork, klp_check_and_switch_task() which is called under the pi_lock, which prevents rescheduling, and manipulation of the patch state of idle tasks, which do not fork. This should prevent this warning from triggering again in the future, and close the race for both normal and reverse transitions. Signed-off-by: Rik van Riel Reported-by: Breno Leitao Reviewed-by: Petr Mladek Acked-by: Josh Poimboeuf Fixes: d83a7cb375ee ("livepatch: change to a per-task consistency model") Cc: stable@kernel.org Signed-off-by: Petr Mladek Link: https://lore.kernel.org/r/20220808150019.03d6a67b@imladris.surriel.com Signed-off-by: Greg Kroah-Hartman --- kernel/livepatch/transition.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) --- a/kernel/livepatch/transition.c +++ b/kernel/livepatch/transition.c @@ -610,9 +610,23 @@ void klp_reverse_transition(void) /* Called from copy_process() during fork */ void klp_copy_process(struct task_struct *child) { - child->patch_state = current->patch_state; - /* TIF_PATCH_PENDING gets copied in setup_thread_stack() */ + /* + * The parent process may have gone through a KLP transition since + * the thread flag was copied in setup_thread_stack earlier. Bring + * the task flag up to date with the parent here. + * + * The operation is serialized against all klp_*_transition() + * operations by the tasklist_lock. The only exception is + * klp_update_patch_state(current), but we cannot race with + * that because we are current. + */ + if (test_tsk_thread_flag(current, TIF_PATCH_PENDING)) + set_tsk_thread_flag(child, TIF_PATCH_PENDING); + else + clear_tsk_thread_flag(child, TIF_PATCH_PENDING); + + child->patch_state = current->patch_state; } /* From patchwork Wed Oct 19 08:23: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: 5507 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp336526wrs; Wed, 19 Oct 2022 06:47:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4FGLt6pRCrQnYybdunMOKgUujBEfXIsi0CjzOm8Iy0ZTPYFudUA0RwXSZMxKmOfod/oWCC X-Received: by 2002:a63:e806:0:b0:44b:d45b:b8a2 with SMTP id s6-20020a63e806000000b0044bd45bb8a2mr7223478pgh.14.1666187232066; Wed, 19 Oct 2022 06:47:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666187232; cv=none; d=google.com; s=arc-20160816; b=TUOc5UsZN9XG4GODzXCREEzPnZ5axZHbRJS6NcG3FVW6rSEt9zO6oqnxhmvHSrbWIN OfZEezCTByz/el8TPa2hq1HGB24ja9VVdismiep/PP9aUoHi79/xEDBRBAgNAqC97LDB g4rN5s3iqbWhE/ryJkmAeHMmOfjzcz+04FmTvrWLupJYbrfjDkWiAkSwnbNHFnu0J6Qh zQYJpGOpED3TQqzsGEf6cipav4+AmODots1cNJi7lBR+DKSaNu4aNsP+NkVOdlMZ92FP rq0ziNrmo68NFHW/S1cibqJtpLzEe/4RhY3QTlPwgDWJKwkHKWQoX6K9GtZ17srZFCNU 0e5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+d6T6VgacFxGfySBqO6C1MgabZN6vRYdTB8dQF/c83s=; b=QLySa5TmCohIcYQRFdxx7wQ7sP244uT71I8OMLAoLqGOE6CQJPVtXc7tgoRLIOr9/U i5OCKnHx6eWjPS1Y2LdIC0/KebZih9L1YI/UBPrX6l1ukmmztyURaygUzCbzAoHsQRSD BghCH34YHR3F7MrexCAsYmoYmKD1p6pxeaQZK4cxXsKAHBeWVh8uoU6QvL18qaDsH/AA XL0Q2lrGgfi4DDerQbwJiBzgbodglyZa0oUnaATYddJHl77R0/M2Z4o6ZK8w/MfQALGX f+0NubCuPX520XshpzY1eRUjnZCjdndrlTbvdVaCiWVTvysPGfkQ9wfS2EmeMIzuGuJs lEKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=s305VvN5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c195-20020a6335cc000000b00462da7a1de0si18515392pga.301.2022.10.19.06.46.58; Wed, 19 Oct 2022 06:47: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=s305VvN5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230399AbiJSNq2 (ORCPT + 99 others); Wed, 19 Oct 2022 09:46:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233033AbiJSNp3 (ORCPT ); Wed, 19 Oct 2022 09:45:29 -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 8F137104532; Wed, 19 Oct 2022 06:31:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id BA1F2CE20F5; Wed, 19 Oct 2022 08:46:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87646C433B5; Wed, 19 Oct 2022 08:46:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169216; bh=d/SGE19nr370Fuxre5//z2/HMCF2Sb8iPSnavHuAhUU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s305VvN5ojmqORP9tLKoaVnx7IPfvvwAHmUBsvOD3HT9421eIFMWy/JWZqxHSoW4r E0dBTCgkGgcwyCSCnt/+dwXoCyeitzoglrp0d1wC9mwpLE19312DZoQD3Q7hZPETbN GxgyLtWHd7JFzbLNaFOaxLfpy8i4ekX5uz13VbnQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, mingo@redhat.com, Zheng Yejian , "Steven Rostedt (Google)" Subject: [PATCH 6.0 150/862] ftrace: Properly unset FTRACE_HASH_FL_MOD Date: Wed, 19 Oct 2022 10:23:57 +0200 Message-Id: <20221019083256.616233624@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123942856577225?= X-GMAIL-MSGID: =?utf-8?q?1747123942856577225?= From: Zheng Yejian commit 0ce0638edf5ec83343302b884fa208179580700a upstream. When executing following commands like what document said, but the log "#### all functions enabled ####" was not shown as expect: 1. Set a 'mod' filter: $ echo 'write*:mod:ext3' > /sys/kernel/tracing/set_ftrace_filter 2. Invert above filter: $ echo '!write*:mod:ext3' >> /sys/kernel/tracing/set_ftrace_filter 3. Read the file: $ cat /sys/kernel/tracing/set_ftrace_filter By some debugging, I found that flag FTRACE_HASH_FL_MOD was not unset after inversion like above step 2 and then result of ftrace_hash_empty() is incorrect. Link: https://lkml.kernel.org/r/20220926152008.2239274-1-zhengyejian1@huawei.com Cc: Cc: stable@vger.kernel.org Fixes: 8c08f0d5c6fb ("ftrace: Have cached module filters be an active filter") Signed-off-by: Zheng Yejian Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman --- kernel/trace/ftrace.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -6081,8 +6081,12 @@ int ftrace_regex_release(struct inode *i if (filter_hash) { orig_hash = &iter->ops->func_hash->filter_hash; - if (iter->tr && !list_empty(&iter->tr->mod_trace)) - iter->hash->flags |= FTRACE_HASH_FL_MOD; + if (iter->tr) { + if (list_empty(&iter->tr->mod_trace)) + iter->hash->flags &= ~FTRACE_HASH_FL_MOD; + else + iter->hash->flags |= FTRACE_HASH_FL_MOD; + } } else orig_hash = &iter->ops->func_hash->notrace_hash; From patchwork Wed Oct 19 08:23: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: 5369 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp300178wrs; Wed, 19 Oct 2022 05:33:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Mn9+icPs6eR/daloMH6d4vLbKI10MMskxx3JjSmbRqn/KaTCKKLM7eb+DsbSnPAFdz/dF X-Received: by 2002:a17:902:eecc:b0:17f:624e:8af2 with SMTP id h12-20020a170902eecc00b0017f624e8af2mr8386669plb.152.1666182828052; Wed, 19 Oct 2022 05:33:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666182828; cv=none; d=google.com; s=arc-20160816; b=AjLEQPKd5/IsrKPXLvGNsz350LZD906y4wocHyX7oGeHGzau0nt4Q4MEsbA2utHX24 Vq9tkAapiO4l4O4cOPxERU5haq6P+A5DM7HSfbdE5hj5dwpz+sSM7gTGWzlGMpUaMDd+ SWIPILodHKgA/ds/Ox3WV3Xov+jl6puOq6f2/wnOLhIXKNmJ4+CnIFPNkDx9B5uhNiRb rWTD3mInYtL+8A9A0uVbODotTkUP72XaWyJ4WdmiY8oQHop2UHFDen7cslflxgBfoLNw DNpO7cGi/ETijPrZVHDkFdlzYkJ1Av6JqLFRZu2YtA9atKVNQgLXYgfEvjyY1dkVIH69 li2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0b9pI4mfr6IgPisSWcQHNT+roSjAl4h9Xkwnp9V5EbI=; b=o6QVtzdgsLt2JiaUp3Y8qkjiiZscAXj/HB9QKYmeoQxNpmkbO13Lqq+G2zimNkdDqF kvYXFAI8OmfxVv0GvcVM8DssVcbn2WrRPmWM19Ymgq6Gu1yhIekS3FkD44AsvZZsqg5i 8FemLNuz3QeEVs3YSA+QENAglfyv83sn1oGe2mQHMzOdM50Sc5lqehvv/STkmBrIIXV1 hSX8V5fndw3+dnBd6UrGodbJnT4kpltutw/z+Ff6Gn6eK1Hm/oJIb/HaBadb0FGiG80+ Vvekkl8TgBgPJodmyKjnL9yF0+N+Wimol6e0Od23kzifYyaC2nm5Zp1XUvGQa3huCYuV J8bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TdPg5KRa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o22-20020a63e356000000b00460c55062f0si19975256pgj.434.2022.10.19.05.33.33; Wed, 19 Oct 2022 05:33: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=TdPg5KRa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231894AbiJSMVI (ORCPT + 99 others); Wed, 19 Oct 2022 08:21:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233203AbiJSMTj (ORCPT ); Wed, 19 Oct 2022 08:19: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 7A27D2F385; Wed, 19 Oct 2022 04:54:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3DAE3B82300; Wed, 19 Oct 2022 08:45:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51FDAC433D7; Wed, 19 Oct 2022 08:44:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169101; bh=NugK2xmj4o35+zhTDpcBZCLwYbG8ZWgzp29Lg7nuEwM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TdPg5KRaHQtnAuDbtL9jKIwULVf1uA/5PLqb17eMKcnpUmn4WVXa0MKpGcOFqDmtP ml+Bg634veHiZv9kmOFhSPsDMM7xAGu8vzOGZcaeF+fOnHU7YUv5ldIcQDrqdLVkRZ Z5xnh9mvP7THpP1fpRT2Mbr96j8i6FT/0V0anYvI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Masami Hiramatsu , Andrew Morton , "Steven Rostedt (Google)" Subject: [PATCH 6.0 151/862] ftrace: Still disable enabled records marked as disabled Date: Wed, 19 Oct 2022 10:23:58 +0200 Message-Id: <20221019083256.655377841@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747119325300914096?= X-GMAIL-MSGID: =?utf-8?q?1747119325300914096?= From: Steven Rostedt (Google) commit cf04f2d5df0037741207382ac8fe289e8bf84ced upstream. Weak functions started causing havoc as they showed up in the "available_filter_functions" and this confused people as to why some functions marked as "notrace" were listed, but when enabled they did nothing. This was because weak functions can still have fentry calls, and these addresses get added to the "available_filter_functions" file. kallsyms is what converts those addresses to names, and since the weak functions are not listed in kallsyms, it would just pick the function before that. To solve this, there was a trick to detect weak functions listed, and these records would be marked as DISABLED so that they do not get enabled and are mostly ignored. As the processing of the list of all functions to figure out what is weak or not can take a long time, this process is put off into a kernel thread and run in parallel with the rest of start up. Now the issue happens whet function tracing is enabled via the kernel command line. As it starts very early in boot up, it can be enabled before the records that are weak are marked to be disabled. This causes an issue in the accounting, as the weak records are enabled by the command line function tracing, but after boot up, they are not disabled. The ftrace records have several accounting flags and a ref count. The DISABLED flag is just one. If the record is enabled before it is marked DISABLED it will get an ENABLED flag and also have its ref counter incremented. After it is marked for DISABLED, neither the ENABLED flag nor the ref counter is cleared. There's sanity checks on the records that are performed after an ftrace function is registered or unregistered, and this detected that there were records marked as ENABLED with ref counter that should not have been. Note, the module loading code uses the DISABLED flag as well to keep its functions from being modified while its being loaded and some of these flags may get set in this process. So changing the verification code to ignore DISABLED records is a no go, as it still needs to verify that the module records are working too. Also, the weak functions still are calling a trampoline. Even though they should never be called, it is dangerous to leave these weak functions calling a trampoline that is freed, so they should still be set back to nops. There's two places that need to not skip records that have the ENABLED and the DISABLED flags set. That is where the ftrace_ops is processed and sets the records ref counts, and then later when the function itself is to be updated, and the ENABLED flag gets removed. Add a helper function "skip_record()" that returns true if the record has the DISABLED flag set but not the ENABLED flag. Link: https://lkml.kernel.org/r/20221005003809.27d2b97b@gandalf.local.home Cc: Masami Hiramatsu Cc: Andrew Morton Cc: stable@vger.kernel.org Fixes: b39181f7c6907 ("ftrace: Add FTRACE_MCOUNT_MAX_OFFSET to avoid adding weak function") Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman --- kernel/trace/ftrace.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -1644,6 +1644,18 @@ ftrace_find_tramp_ops_any_other(struct d static struct ftrace_ops * ftrace_find_tramp_ops_next(struct dyn_ftrace *rec, struct ftrace_ops *ops); +static bool skip_record(struct dyn_ftrace *rec) +{ + /* + * At boot up, weak functions are set to disable. Function tracing + * can be enabled before they are, and they still need to be disabled now. + * If the record is disabled, still continue if it is marked as already + * enabled (this is needed to keep the accounting working). + */ + return rec->flags & FTRACE_FL_DISABLED && + !(rec->flags & FTRACE_FL_ENABLED); +} + static bool __ftrace_hash_rec_update(struct ftrace_ops *ops, int filter_hash, bool inc) @@ -1693,7 +1705,7 @@ static bool __ftrace_hash_rec_update(str int in_hash = 0; int match = 0; - if (rec->flags & FTRACE_FL_DISABLED) + if (skip_record(rec)) continue; if (all) { @@ -2126,7 +2138,7 @@ static int ftrace_check_record(struct dy ftrace_bug_type = FTRACE_BUG_UNKNOWN; - if (rec->flags & FTRACE_FL_DISABLED) + if (skip_record(rec)) return FTRACE_UPDATE_IGNORE; /* @@ -2241,7 +2253,7 @@ static int ftrace_check_record(struct dy if (update) { /* If there's no more users, clear all flags */ if (!ftrace_rec_count(rec)) - rec->flags = 0; + rec->flags &= FTRACE_FL_DISABLED; else /* * Just disable the record, but keep the ops TRAMP @@ -2634,7 +2646,7 @@ void __weak ftrace_replace_code(int mod_ do_for_each_ftrace_rec(pg, rec) { - if (rec->flags & FTRACE_FL_DISABLED) + if (skip_record(rec)) continue; failed = __ftrace_replace_code(rec, enable); From patchwork Wed Oct 19 08:23: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: 5372 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp300689wrs; Wed, 19 Oct 2022 05:34:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5teuOEa6B17lQ1yWqdStw9NMZEKmtdTrER3OcMp81dgHdbxZ0dUXOAS0WUNdFrWmaXbmIQ X-Received: by 2002:a05:6a00:301c:b0:567:6e2c:4c10 with SMTP id ay28-20020a056a00301c00b005676e2c4c10mr4585977pfb.83.1666182891848; Wed, 19 Oct 2022 05:34:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666182891; cv=none; d=google.com; s=arc-20160816; b=n3UoTgkS1NYSyAHhLYkYU30D23OFv3zV/CHHwGqCTlpIGMpQJN7U796yhx9pHLJj4U Y4Vrnj6ire6/HKPkGP62jd39//vojN++bIwohY2xmfeOAVSqB1a3DfXaJN1H7jHmoh0H RV630wpUEzsW66bz0CHh++TlhEhxhoaKzYZmehyYDzrUJQwnHR2loYK1/jra9ss99nCu CDr858Lu3EPjVSE2l5tHg2oLJe5UWgyVGX27upvsYqKNkghbQK1czXkEtFOOWxCy46O7 ivwWFat4yMauxmbg/Es+GJYEDE/66LCqHE6JR2KuWIXC+cDavXEHbfMeTPsMrEA7dIRw 6Uxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=iAcpwmqtvMsWnBA1wKY6nqifE/qZlcrQLqQuTj1uuPc=; b=Qz4JHj2W3xExPQxV6fGXTJ9EvPMGm0y3tJgKQiOB/qXmy1/RAA3Frw+jEIlrMO9oni culWNaiH3khyg7RQNslTcP6s4GHb8umm0HZK4Y9obAx1xWpK/UPDGtslyKOMlOQT++/1 YlhEqqg1r+Bzd3UhhHdFMG5KD1ULBdKSCV1Zr+L1jgUxY3HyZC2vP5rwx6HbE2OTQXok M+pNYGS7m8bWrCY6CXW1OEk4KTatvzkLZwSnanuuGHfzlCkLFEwLJDGKSsT1ZyZ4r5Yk QmLtjO2Q6tdE0lPYAczzCwP9JM4cZzIAPcpY2FuPv9iqpKoCuP05K0lNhxzvPOgMGWU+ eTNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dCgx+XQ4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l4-20020a62be04000000b0053e8981932esi16122785pff.330.2022.10.19.05.34.36; Wed, 19 Oct 2022 05:34: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=dCgx+XQ4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229515AbiJSMVZ (ORCPT + 99 others); Wed, 19 Oct 2022 08:21:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232746AbiJSMUM (ORCPT ); Wed, 19 Oct 2022 08:20:12 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A883114DDE; Wed, 19 Oct 2022 04:55: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 64A86B82311; Wed, 19 Oct 2022 08:45:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5979C433D6; Wed, 19 Oct 2022 08:45:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169134; bh=FBSqfGdqenbLRx3kzmze2zovm+J2vRZ3J4A4qSTPPVo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dCgx+XQ4f+puNdbCmP8pMYJyq4PcYWJXIazRd9rKV86FGu/HA6VhwQ/XFD1JTq87R g33VChmYH5SM8BQkRV4v1ixp46IeUhkj/vMTnFsveZhHSR771UawaqUdd/Wwnn0Nzh mtsQ7Qe/aifSrhBUmgQmmlqaekIduEW9bf5AyN8c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Steven Rostedt (Google)" Subject: [PATCH 6.0 152/862] ring-buffer: Allow splice to read previous partially read pages Date: Wed, 19 Oct 2022 10:23:59 +0200 Message-Id: <20221019083256.705618045@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747119391736200067?= X-GMAIL-MSGID: =?utf-8?q?1747119391736200067?= 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 @@ -5616,7 +5616,15 @@ int ring_buffer_read_page(struct trace_b 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 Wed Oct 19 08:24: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: 4585 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp205953wrs; Wed, 19 Oct 2022 01:51:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Ll1JRFO7oMAWFc2jSpZaMVQjIfp+2VAh4T5DPSU9tA8O98hY2KXqhm+c4YAGyjQ8nA+aN X-Received: by 2002:a63:ff1b:0:b0:43c:e4ee:e5e0 with SMTP id k27-20020a63ff1b000000b0043ce4eee5e0mr6059446pgi.540.1666169467157; Wed, 19 Oct 2022 01:51:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169467; cv=none; d=google.com; s=arc-20160816; b=JS6ZWF+cfBRxqR7evW4YgB24XCIISQFB6tNH75n8zcIjwokKBebHK5flmg9+lPuyl+ 52SondSz54YXKjuVDGfai6r7QPr8iBLxDIqxqfNf0awAaGpqq8TTmGm1G0juO1JtBGXS hlaHcPkpER60/N29eim9Hg7bu1skhnOV8yjyqkij6kfpJtjJAWMeEAxwdOJihgUHcMlu sdMfolHBGHHa5Ysx2G8h+glnLsHRLOmehsuhJ4CITqYquC0DH7v9uZTNbPSGhyceEmEY x1aqFGqHVpk8AfBEqMXOeQeILDfmEog/MXeo9fTb3JTGy3KJG9QbHDmi5JZKgAgnGb9t rrsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PNiAGidTY8HZy9wJ3VBB7riwl6/X15zvaN92xDtqPZg=; b=alPpLm45X7NQGtmCkJoAc4TpvGmGRQja2ukdTrLzsPyC/NhE0UpzJNHyeueRclGjQi OUGywLt58oIQgUU1CgnvjUqVvj3YXLFinB25scafgwwmXmCmSTpvMqLHdpCNSuDXlgbu V2uL7lKFsIBT0dZVojEurbzdEzj9bCI9xafPrTEZneJxyxBUUBGu8Yev8Rypod1/uZKg PlsgPaTXXW9sXMCxn8m7869WfO9heupgAUwdPy8EgFhhb8gRRlJB4FL9oY5bQCOA3Z50 CRJF2ypriD5JtVU/x0SKTBvuDJuoo99Fr/ODykS/kIFgtIeffwzV5kwC57CTM+MReVfg 6zCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ny3Pigbp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a10-20020a63d20a000000b00461bf5f86fdsi17741758pgg.403.2022.10.19.01.50.54; Wed, 19 Oct 2022 01:51: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=Ny3Pigbp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231329AbiJSIul (ORCPT + 99 others); Wed, 19 Oct 2022 04:50:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231470AbiJSIsk (ORCPT ); Wed, 19 Oct 2022 04:48: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 8BE808E98A; Wed, 19 Oct 2022 01:46:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7922861825; Wed, 19 Oct 2022 08:46:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80CF7C433D6; Wed, 19 Oct 2022 08:46:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169165; bh=TPb/yB1MCUdUFLId2liiAjLSSp0M8QMyY8PRDvoLSwg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ny3PigbpdViTmHgu4ImEvdw6hCn6osHvgi9y8fVcCf77fov6OJLFAcfYij+2kHHej d7U6l/uU1tCAv5GjMDSbJA+W4iL2u8YOdalNsNeRShE1WlRRmmb3tFZLRgZ39aVJjH YkiOBrFW8k0dl6IDDRNmOTmDZUu3a8vUGebmdAuI= 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 6.0 153/862] ring-buffer: Have the shortest_full queue be the shortest not longest Date: Wed, 19 Oct 2022 10:24:00 +0200 Message-Id: <20221019083256.746206975@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105315245706397?= X-GMAIL-MSGID: =?utf-8?q?1747105315245706397?= From: Steven Rostedt (Google) commit 3b19d614b61b93a131f463817e08219c9ce1fee3 upstream. The logic to know when the shortest waiters on the ring buffer should be woken up or not has uses a less than instead of a greater than compare, which causes the shortest_full to actually be the longest. Link: https://lkml.kernel.org/r/20220927231823.718039222@goodmis.org Cc: stable@vger.kernel.org Cc: Ingo Molnar Cc: Andrew Morton Fixes: 2c2b0a78b3739 ("ring-buffer: Add percentage of ring buffer full to wake up reader") Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman --- kernel/trace/ring_buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c @@ -1011,7 +1011,7 @@ int ring_buffer_wait(struct trace_buffer nr_pages = cpu_buffer->nr_pages; dirty = ring_buffer_nr_dirty_pages(buffer, cpu); if (!cpu_buffer->shortest_full || - cpu_buffer->shortest_full < full) + cpu_buffer->shortest_full > full) cpu_buffer->shortest_full = full; raw_spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags); if (!pagebusy && From patchwork Wed Oct 19 08:24: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: 5092 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp249767wrs; Wed, 19 Oct 2022 03:47:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6iV7ZptbGjaJqkAbROzv/VLYgCvNkg+Rr5V4JQFtmdl9dJlH9UYi9NoQK5u7LdBs/6w5dk X-Received: by 2002:a17:903:2591:b0:17f:8b74:f3c0 with SMTP id jb17-20020a170903259100b0017f8b74f3c0mr8020801plb.36.1666176425319; Wed, 19 Oct 2022 03:47:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176425; cv=none; d=google.com; s=arc-20160816; b=na5p1ZCRjAIovY35DBwpiVZDjPgtKBG5Mz0RMm3UHwsW5jkwWlp1zRxLKcVHemXu/k gde/gdgesizuktAz3UqVMMXtOEL6tDnSiqDPYjLTUfZEGkYv2Q2jnRkJfUx7p1vmQA4X Lxlbt3T3LiTmAsRIBc7PO7ierkTnLsNG0Pv0LBcewihUvk1/jHMuy6Zcos2k570U8u8z apteGw80ysoQJjrtZ3m6z20ELszMm58j2u7GwMMYlskN6XPx1OWkhjue7oXYO8/tzvdA bf3dd8sYt868Y7pW8jWePIcZTMTjEFkxZyK5hMxMgvXMsT5StdxTY41G+u606/Dn3H6t Ri+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=tg3zZCik7o/KSYcmfzFiaDMuKBEp8A7+YAOkoZleivE=; b=Vf9BkbkkA/nRtmf7PJlueug9NydwBfh3p3OL3TFktJGAAZEKU5Fh/UZPtfDYUjm66O XienCtJd+kBK7rPUNTZP1PutB3TH9SZ6wvkyrublfrC8h+4eyRn6WDGvvT55P2Y51kGj VNS915PCDXkXPUYVd9LaS3otRTJYXIrWmcb/jIKaJidFJbv82J1pyLKDf4bXtbTGMGx5 dfOJMtG4AbcpiZwsO/xiHeNKbGF+tngdkvBiL91823ck08KeDci7FbPqM86YJqnw+V37 gINGD5HCNHeLOqA0F2+m36AuTrGaxuaWtDfzxmVAm8zc2Yh7ouh70osH6bGnSD4kDR+F q0IQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="H/OKGGB6"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c23-20020a170902849700b00182140f0836si16617021plo.459.2022.10.19.03.46.51; Wed, 19 Oct 2022 03:47: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="H/OKGGB6"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233306AbiJSKqh (ORCPT + 99 others); Wed, 19 Oct 2022 06:46:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233305AbiJSKoe (ORCPT ); Wed, 19 Oct 2022 06:44:34 -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 D5DD310EA22; Wed, 19 Oct 2022 03:20: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 8445FB82305; Wed, 19 Oct 2022 08:46:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7EBFC433D7; Wed, 19 Oct 2022 08:46:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169198; bh=lqz+c27qLgPZikG/yh+pME2iMkbgYwjlbdPKAFUv/fY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H/OKGGB6o3aBzA1XHF0TW5TW7KdaHZ1OttbuibblRcwM5bpHlHv/kxQrKd2LYAQxX sf+RjgosCfeywueHyV7/bJAkxx5NlSZUFM82eRIF7e3yHy3yBxanijIkHQgDqIMCDL 7iI2d97qB3u9Y/mRo/t187ZFGlmsYjADjJxJD3v8= 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 6.0 154/862] ring-buffer: Check pending waiters when doing wake ups as well Date: Wed, 19 Oct 2022 10:24:01 +0200 Message-Id: <20221019083256.794910184@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112611143845105?= X-GMAIL-MSGID: =?utf-8?q?1747112611143845105?= 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 @@ -917,8 +917,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 Wed Oct 19 08:24: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: 4590 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp206109wrs; Wed, 19 Oct 2022 01:51:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5MF/dgaUTHxFLen7ArxTNEckZ9cNjw6UAAWvg6ZZnY3+Rydz5zmhS7psi+P2+fDkGxR2bu X-Received: by 2002:a17:902:8698:b0:181:f060:7133 with SMTP id g24-20020a170902869800b00181f0607133mr7503452plo.1.1666169495858; Wed, 19 Oct 2022 01:51:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169495; cv=none; d=google.com; s=arc-20160816; b=T2ME53gnhttOVm/bFjIjfWseRfe2U4RYTX6eCdUc7WPiGscv/iHEMmeI/DAGIdX8Ra axSt8sLSVWye8T8qe1V2RqW+Q3pYMLD9mVfPN+QlL5fC7J6orpet0S5HyeOKeI5d14D8 yzn7B53NH0sgr6rA6o92pdydM9oTbgc0y819BhNuXjGQ1zCB6gE9wqwwI7UDQO+dEAGp TlrB41KCnNVX4viDN2SJnnidfS7qSY0OmAVQWaEMn0AYm84idrelPeXt0c9HG64G2RYG aN/HBKp8Q/I4vJrvEiSw/1qpzPnsCAjRDHy03j4pIyDDqAi+X6ob4HYi8gSBnUwp99TM K5XA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=y9yzAIWNNuhVv5FuC4VJWtp6Cz4kMPKpUnXBWUB+jP0=; b=XTAOEFlE4IIZO7UOxeyQjytLSAkOOygJwsWsjGfGXu73hsB0PlY4I6lE0ObHV1oQ+J r0t5OB82SXC7Kt1ZqEmk/VbUECAgn3+s2ApRYYILwWnSIv11txS9qoaR6LqLDxn9CboW WWHFk7oHFObcvf7U7aWVqWcl+zppUD5WROJ0SsAZlOh9qMEP33eQkLhtr0pbXt6mEKPW FMAWjXM8WasaY8Atn7P8JsyGq5qOTsaUXtLRtF+XYzIdJPa+r53gzGbv5t8yb8OSI71f dorTYUGOZ20zX/kSVicA1y6MtY5hr+UeaNiOSiZ04dD41VUdu1RmYREpA4/RpzwRvSVY Lr/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TdEO1GpD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kb6-20020a17090ae7c600b001fe1c9436b1si21055903pjb.86.2022.10.19.01.51.22; Wed, 19 Oct 2022 01:51: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=TdEO1GpD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231615AbiJSIvA (ORCPT + 99 others); Wed, 19 Oct 2022 04:51:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231657AbiJSItA (ORCPT ); Wed, 19 Oct 2022 04:49: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 5D061814C0; Wed, 19 Oct 2022 01:46: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 17E5B6183D; Wed, 19 Oct 2022 08:46:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D08EBC433D7; Wed, 19 Oct 2022 08:46:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169201; bh=b8MlR2uiSgcn2sfEO2O+eztyP0E+QW2yZ9/nitKtF8o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TdEO1GpDwPg7DlGi5O4JVH3GJpvjeLcb5Z742a1W8BVjwUUn66/EPknkecp/0Fcmg r3B3ReEM401ifl9g2jCcksacK+O+n1Mg4UfOyvTACSiPtwYdNCbMHQhZUatx0NFvXJ 82DDpqiHy6wNZxmq5DExJWxR+y2BOZb9cQ2N23Lw= 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 6.0 155/862] ring-buffer: Add ring_buffer_wake_waiters() Date: Wed, 19 Oct 2022 10:24:02 +0200 Message-Id: <20221019083256.828194839@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105345500900060?= X-GMAIL-MSGID: =?utf-8?q?1747105345500900060?= From: Steven Rostedt (Google) commit 7e9fbbb1b776d8d7969551565bc246f74ec53b27 upstream. On closing of a file that represents a ring buffer or flushing the file, there may be waiters on the ring buffer that needs to be woken up and exit the ring_buffer_wait() function. Add ring_buffer_wake_waiters() to wake up the waiters on the ring buffer and allow them to exit the wait loop. Link: https://lkml.kernel.org/r/20220928133938.28dc2c27@gandalf.local.home 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 --- include/linux/ring_buffer.h | 2 +- kernel/trace/ring_buffer.c | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) --- a/include/linux/ring_buffer.h +++ b/include/linux/ring_buffer.h @@ -101,7 +101,7 @@ __ring_buffer_alloc(unsigned long size, int ring_buffer_wait(struct trace_buffer *buffer, int cpu, int full); __poll_t ring_buffer_poll_wait(struct trace_buffer *buffer, int cpu, struct file *filp, poll_table *poll_table); - +void ring_buffer_wake_waiters(struct trace_buffer *buffer, int cpu); #define RING_BUFFER_ALL_CPUS -1 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c @@ -413,6 +413,7 @@ struct rb_irq_work { struct irq_work work; wait_queue_head_t waiters; wait_queue_head_t full_waiters; + long wait_index; bool waiters_pending; bool full_waiters_pending; bool wakeup_full; @@ -925,6 +926,37 @@ static void rb_wake_up_waiters(struct ir } /** + * ring_buffer_wake_waiters - wake up any waiters on this ring buffer + * @buffer: The ring buffer to wake waiters on + * + * In the case of a file that represents a ring buffer is closing, + * it is prudent to wake up any waiters that are on this. + */ +void ring_buffer_wake_waiters(struct trace_buffer *buffer, int cpu) +{ + struct ring_buffer_per_cpu *cpu_buffer; + struct rb_irq_work *rbwork; + + if (cpu == RING_BUFFER_ALL_CPUS) { + + /* Wake up individual ones too. One level recursion */ + for_each_buffer_cpu(buffer, cpu) + ring_buffer_wake_waiters(buffer, cpu); + + rbwork = &buffer->irq_work; + } else { + cpu_buffer = buffer->buffers[cpu]; + rbwork = &cpu_buffer->irq_work; + } + + rbwork->wait_index++; + /* make sure the waiters see the new index */ + smp_wmb(); + + rb_wake_up_waiters(&rbwork->work); +} + +/** * ring_buffer_wait - wait for input to the ring buffer * @buffer: buffer to wait on * @cpu: the cpu buffer to wait on @@ -939,6 +971,7 @@ int ring_buffer_wait(struct trace_buffer struct ring_buffer_per_cpu *cpu_buffer; DEFINE_WAIT(wait); struct rb_irq_work *work; + long wait_index; int ret = 0; /* @@ -957,6 +990,7 @@ int ring_buffer_wait(struct trace_buffer work = &cpu_buffer->irq_work; } + wait_index = READ_ONCE(work->wait_index); while (true) { if (full) @@ -1021,6 +1055,11 @@ int ring_buffer_wait(struct trace_buffer } schedule(); + + /* Make sure to see the new wait index */ + smp_rmb(); + if (wait_index != work->wait_index) + break; } if (full) From patchwork Wed Oct 19 08:24: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: 4591 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp206121wrs; Wed, 19 Oct 2022 01:51:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Py5Z8XImHAzRdS3kONceix2APiT8jrMzLFOGYOiSIsSniDah9tB/jwOHXZVYJkzZeGdE+ X-Received: by 2002:a05:6a02:10a:b0:461:26b8:1c95 with SMTP id bg10-20020a056a02010a00b0046126b81c95mr5995752pgb.503.1666169499572; Wed, 19 Oct 2022 01:51:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169499; cv=none; d=google.com; s=arc-20160816; b=rqeyHRuickSX+PXlLmsUbmU5zbdbTjE8rhDgvdtgW895hKyqeHmYTM1uHsuwsJ1197 QqxuLgjHnUMP/s2cPkiUi1/yJHtuRTMv05RGni9rdnYykraX5s53N592PNNR6B4eMokm fLaznAPS3+PJYz6sU3OuPFcXxLJD0X6rRgCtcQhrbVqNyN0Av6HgbmzO9I5Zoaa/bvbW M4T0YKW5Yj85QZOp1EScGgYBBRx4qBCn9r3dGdnBAbeMRCANETd/07EVfRyJodke5yil ckSWp5v30hXFCOlXhAiX5nUO0wFOsEdIylUlfvelLW9pFlia7XINBqnu38S4bWxNYpUo p0EQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UOt1WGDQxSQW2xTtDRjuisOPSSSCAy5xQFVvh0cBWS4=; b=VWXaPt9cPRI7BGLUcx1Y335pqhwC+joowg3u8H3yfIfGS8475zkguzf6WdCqq+46tP rTHvZUDHmrV5SEkdYKz47NP7wsqd7ejIovbd0OqMrOAjObUYZm4yXD2ZXqhSl/ZzCWeT rsxwrAbxRIXCkBVj5z1zWhqeLweIAGWWElxbc94VxIPPKXuQI6HtStdL3/reNH3Sb2oN i7S9Y5fchoWi2f3me4aIthmyq4Ye2wkgG6x9YECXCvVptdsiFSTkRWTkNNOlNDI4XD7k tflIPCAbAPt6BBkr0zHhKDtCQP/bXXlwrX1QLzkbpsakIap+WAW3eA9oDn9BlVPpWHem XCeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=P3XiM7xy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 69-20020a630448000000b0046af6471adasi19045113pge.282.2022.10.19.01.51.26; Wed, 19 Oct 2022 01:51: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=P3XiM7xy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231642AbiJSIvH (ORCPT + 99 others); Wed, 19 Oct 2022 04:51:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231653AbiJSItA (ORCPT ); Wed, 19 Oct 2022 04:49: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 CF0BC23BF2; Wed, 19 Oct 2022 01:46:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 149E661804; Wed, 19 Oct 2022 08:46:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 126F2C433C1; Wed, 19 Oct 2022 08:46:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169204; bh=tWoOO/LZBB6eOZofEyhGg+yRNm/CjZobcH/Luks7w2M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P3XiM7xyQ+IeWZhkkzGTGcKUjfXuPHVY+w7QHE16upt9LkClmBIIAIEqOtbAbSLYw OgKXuXuaWkg+5Dkt4BI3O2tsth8kBrkVjNXy6mfzh/48tZXITAYckLNX3yYW0VqPhc /wCnQHDrpdj/tPx6184ybKR87Yp9nVpNNnPci5lM= 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 6.0 156/862] ring-buffer: Fix race between reset page and reading page Date: Wed, 19 Oct 2022 10:24:03 +0200 Message-Id: <20221019083256.868185709@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105348998779231?= X-GMAIL-MSGID: =?utf-8?q?1747105348998779231?= 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 @@ -2648,6 +2648,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; @@ -2659,6 +2662,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); @@ -4627,6 +4633,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 Wed Oct 19 08:24: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: 5281 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp280656wrs; Wed, 19 Oct 2022 05:01:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7vBS0hI09xzuvBtQCe70K0YPjYSTpHfBfYzkPjvxmqUVTT63xeLPzHL0BJoXysOn7CNZ2P X-Received: by 2002:a05:6402:3988:b0:44e:6f08:ddfb with SMTP id fk8-20020a056402398800b0044e6f08ddfbmr7031370edb.89.1666180864282; Wed, 19 Oct 2022 05:01:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666180864; cv=none; d=google.com; s=arc-20160816; b=t78WG3gbsn4Wr+4IaPz5yWduW9bw4Zs2/SUyYLpZlJHgAp7MkLDh3aizdXz95eyoY+ ii9COtDsc+byq8jyv38SBoDlzOlNPiZKzxaxnmwoKiIi8zLuhlvPS2fWja/sHadLSWQ2 1b5jN0nQeSj6TLnxw3aRNEQb0f76c/LuH5SGfZ6NBGLhlv6ktm1AVKQvBQM4h7rXEa9U Y96qMHSTOBG2zKtYlqcpQl2Q5A9tlhrgi+nVmVYH1HDbobc3zgpr/GD+4GVm3gckK3kC 7EweRcQgVLFAfswPXD++yZw8vNszlp+gC7+o2cwECvsh983vEuNjNt/fOTBUwZYDKYfB cyGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xVE8kQqQtuO28KXUog8xwzeHNINe1Pj7pNVJqOjmbpQ=; b=Ii69Sge7+x4A/XWWYnS8gYre3gM+ObRydj13T+1Rs/o5dKi21uKuW1QFPV23XA2RR2 ti6CSnknkHmI8fz69+Ysl81LiCQ4r56XXzVKYeC11qzcy60d+tRJBDb2SS8BIPhu1NZ2 aDdnofKwAYdQ7VZCB+nIcNVkTO624fUXzlSs0ug+cAivtrR/3AuGwVRmtUNfQyG7mJjm l1rT2GZbyDlIMgCXKsKFDh1d28n+ZbhMpD6ERnHzmNOZHnC5UR0d+4IkDIURw3Sp1RKT 488K3NEgNGzX+72yqKaEYwX85dlDGIRfAShV2hPpthO1BTwV9hB08BdNoraQLAZ7SWk4 5aGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AK+C1YqZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m15-20020a056402050f00b00457fc1bcf12si12534626edv.183.2022.10.19.05.00.38; Wed, 19 Oct 2022 05:01: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=AK+C1YqZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231657AbiJSLyZ (ORCPT + 99 others); Wed, 19 Oct 2022 07:54:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231867AbiJSLxu (ORCPT ); Wed, 19 Oct 2022 07:53: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 6474624BD3; Wed, 19 Oct 2022 04:32:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8EC79B822F0; Wed, 19 Oct 2022 08:46:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F33E0C433B5; Wed, 19 Oct 2022 08:46:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169207; bh=w7qwQBLy+nCzJ16X8E1IqSPvcC1H6D9kimjmDJhC2Hc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AK+C1YqZgnMT2/+V84zyk+A3OSVEYfzdCwoaP3CJewYRrODcVSdKmOPZG4xlvsivd 49xbPxIGMkdzBIvCdhIiJkB5bi7mmro/DqsKAaigsVP6M4WoesT8W4lRbY13Q4HpQG N6gh13cotZO4NrCy34b25Nj8NsLQ07GPea9EONCg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ingo Molnar , Tom Zanussi , Linyu Yuan , "Masami Hiramatsu (Google)" , Tao Chen , "Steven Rostedt (Google)" Subject: [PATCH 6.0 157/862] tracing/eprobe: Fix alloc event dir failed when event name no set Date: Wed, 19 Oct 2022 10:24:04 +0200 Message-Id: <20221019083256.907955488@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747117265710888019?= X-GMAIL-MSGID: =?utf-8?q?1747117265710888019?= From: Tao Chen commit dc399adecd4e2826868e5d116a58e33071b18346 upstream. The event dir will alloc failed when event name no set, using the command: "echo "e:esys/ syscalls/sys_enter_openat file=\$filename:string" >> dynamic_events" It seems that dir name="syscalls/sys_enter_openat" is not allowed in debugfs. So just use the "sys_enter_openat" as the event name. Link: https://lkml.kernel.org/r/1664028814-45923-1-git-send-email-chentao.kernel@linux.alibaba.com Cc: Ingo Molnar Cc: Tom Zanussi Cc: Linyu Yuan Cc: Tao Chen Signed-off-by: Tao Chen Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman --- kernel/trace/trace_eprobe.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/kernel/trace/trace_eprobe.c +++ b/kernel/trace/trace_eprobe.c @@ -968,8 +968,7 @@ static int __trace_eprobe_create(int arg } if (!event) { - strscpy(buf1, argv[1], MAX_EVENT_NAME_LEN); - sanitize_event_name(buf1); + strscpy(buf1, sys_event, MAX_EVENT_NAME_LEN); event = buf1; } From patchwork Wed Oct 19 08:24: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: 4731 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214160wrs; Wed, 19 Oct 2022 02:12:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7M4tZRBNXZywrpUoxPJmbShGLB6uPr434wwt0onFD+jIFQjjj4ELDjjdBGSbCZVd8/+SXB X-Received: by 2002:a05:6402:28ca:b0:43b:5235:f325 with SMTP id ef10-20020a05640228ca00b0043b5235f325mr6420190edb.320.1666170722933; Wed, 19 Oct 2022 02:12:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170722; cv=none; d=google.com; s=arc-20160816; b=IsZyl+KsTb4uoOgB3zreUzS0zlIQn9WZCtMJCPMCtedH37dEUFYtFWOGykl0xcEm/u iJfdWP7BwflDSmhLfATWAJkn0MeCI6GNrZrO5DP68lbR2A/9UPlXCeJ+XsqljJ861yI7 a3pcFYWyyVIUW+Rc0JjyoBis0lzeZ/ds0n8+4/fuc5dYRBIMDAVa8N3V/DRpxbgFj/3N BKbF2bu1VaIWQPosw7ExDQy6wWWrlcXR8GMbTJuiTUKDuaoXwCQ16I+h9NHTKCJBY1BR 6ySHKzvxlHdy4aIznfxk6p5x4/EAA+CJ1AIgXATWlX3eyGUdhSTrvNd57b79VDoB9rp0 U95A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=p/npWSUVRZlLb9Df+tuvItHwazs/tdMHZLW5QO4s0qE=; b=jTJoRHdFeF/YM7tc3s6K3R45dyLkE9+9FK0LifiGMmEWnP6XUgg26pL+mVTM8MnK3w fgNpkcEJcGrU3Yu6IVKOfrFe4YDn7hKi1SPL2yA425NJ5WuBhoO4iLaDU8f9WwGxWoaR FsyndZAWQIyM2SxkmIU2sH5odWe3xpcUcH0tOK/D40faY7KyCoP+POFeQJTgcKdJfYzI JbKUSJC8AYd4hSHZWDDgGCjeTuLkl5Hm0dIjTEpVEWevl3YkFK7bUFBQkLVFvego6cBG Sh2D5r5x3bWt08Q+5XbfQrVKvabcnW5xMBFnwgilxG5JE8oG6F2gZMHgbDisonROyFoC G2hA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iqu++Smo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sh20-20020a1709076e9400b0078ddffd9106si15231949ejc.932.2022.10.19.02.11.38; Wed, 19 Oct 2022 02:12: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=iqu++Smo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232421AbiJSJIp (ORCPT + 99 others); Wed, 19 Oct 2022 05:08:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232447AbiJSJGR (ORCPT ); Wed, 19 Oct 2022 05:06: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 B873C17061; Wed, 19 Oct 2022 01:59:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C80006183C; Wed, 19 Oct 2022 08:46:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9E4CC433C1; Wed, 19 Oct 2022 08:46:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169210; bh=esuUoapq9T1x4Pi6HRqvIWsZGok3j+U9rcfDo7+hQDw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iqu++SmoOF93qofrvE8tOHe567ZOX0lSAe5x+f9gCy96MwQqd7jYH5zHlmXCrcNaF IErcH+yhL2WnvU1b35Tdg9kcT+UgNU4TvMCsYuSaQYRgWbpZQ2rfScXRAhuY6rbm/d 5QBCe0nyVJt3zxsqNjrHcJOxi09LGsIkYXLlejtQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Zijlstra , Ingo Molnar , Will Deacon , Boqun Feng , Steven Rostedt , Waiman Long Subject: [PATCH 6.0 158/862] tracing: Disable interrupt or preemption before acquiring arch_spinlock_t Date: Wed, 19 Oct 2022 10:24:05 +0200 Message-Id: <20221019083256.957306379@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106632027823646?= X-GMAIL-MSGID: =?utf-8?q?1747106632027823646?= From: Waiman Long commit c0a581d7126c0bbc96163276f585fd7b4e4d8d0e upstream. It was found that some tracing functions in kernel/trace/trace.c acquire an arch_spinlock_t with preemption and irqs enabled. An example is the tracing_saved_cmdlines_size_read() function which intermittently causes a "BUG: using smp_processor_id() in preemptible" warning when the LTP read_all_proc test is run. That can be problematic in case preemption happens after acquiring the lock. Add the necessary preemption or interrupt disabling code in the appropriate places before acquiring an arch_spinlock_t. The convention here is to disable preemption for trace_cmdline_lock and interupt for max_lock. Link: https://lkml.kernel.org/r/20220922145622.1744826-1-longman@redhat.com Cc: Peter Zijlstra Cc: Ingo Molnar Cc: Will Deacon Cc: Boqun Feng Cc: stable@vger.kernel.org Fixes: a35873a0993b ("tracing: Add conditional snapshot") Fixes: 939c7a4f04fc ("tracing: Introduce saved_cmdlines_size file") Suggested-by: Steven Rostedt Signed-off-by: Waiman Long Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman --- kernel/trace/trace.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -1193,12 +1193,14 @@ void *tracing_cond_snapshot_data(struct { void *cond_data = NULL; + local_irq_disable(); arch_spin_lock(&tr->max_lock); if (tr->cond_snapshot) cond_data = tr->cond_snapshot->cond_data; arch_spin_unlock(&tr->max_lock); + local_irq_enable(); return cond_data; } @@ -1334,9 +1336,11 @@ int tracing_snapshot_cond_enable(struct goto fail_unlock; } + local_irq_disable(); arch_spin_lock(&tr->max_lock); tr->cond_snapshot = cond_snapshot; arch_spin_unlock(&tr->max_lock); + local_irq_enable(); mutex_unlock(&trace_types_lock); @@ -1363,6 +1367,7 @@ int tracing_snapshot_cond_disable(struct { int ret = 0; + local_irq_disable(); arch_spin_lock(&tr->max_lock); if (!tr->cond_snapshot) @@ -1373,6 +1378,7 @@ int tracing_snapshot_cond_disable(struct } arch_spin_unlock(&tr->max_lock); + local_irq_enable(); return ret; } @@ -2200,6 +2206,11 @@ static size_t tgid_map_max; #define SAVED_CMDLINES_DEFAULT 128 #define NO_CMDLINE_MAP UINT_MAX +/* + * Preemption must be disabled before acquiring trace_cmdline_lock. + * The various trace_arrays' max_lock must be acquired in a context + * where interrupt is disabled. + */ static arch_spinlock_t trace_cmdline_lock = __ARCH_SPIN_LOCK_UNLOCKED; struct saved_cmdlines_buffer { unsigned map_pid_to_cmdline[PID_MAX_DEFAULT+1]; @@ -2412,7 +2423,11 @@ static int trace_save_cmdline(struct tas * the lock, but we also don't want to spin * nor do we want to disable interrupts, * so if we miss here, then better luck next time. + * + * This is called within the scheduler and wake up, so interrupts + * had better been disabled and run queue lock been held. */ + lockdep_assert_preemption_disabled(); if (!arch_spin_trylock(&trace_cmdline_lock)) return 0; @@ -5890,9 +5905,11 @@ tracing_saved_cmdlines_size_read(struct char buf[64]; int r; + preempt_disable(); arch_spin_lock(&trace_cmdline_lock); r = scnprintf(buf, sizeof(buf), "%u\n", savedcmd->cmdline_num); arch_spin_unlock(&trace_cmdline_lock); + preempt_enable(); return simple_read_from_buffer(ubuf, cnt, ppos, buf, r); } @@ -5917,10 +5934,12 @@ static int tracing_resize_saved_cmdlines return -ENOMEM; } + preempt_disable(); arch_spin_lock(&trace_cmdline_lock); savedcmd_temp = savedcmd; savedcmd = s; arch_spin_unlock(&trace_cmdline_lock); + preempt_enable(); free_saved_cmdlines_buffer(savedcmd_temp); return 0; @@ -6373,10 +6392,12 @@ int tracing_set_tracer(struct trace_arra #ifdef CONFIG_TRACER_SNAPSHOT if (t->use_max_tr) { + local_irq_disable(); arch_spin_lock(&tr->max_lock); if (tr->cond_snapshot) ret = -EBUSY; arch_spin_unlock(&tr->max_lock); + local_irq_enable(); if (ret) goto out; } @@ -7436,10 +7457,12 @@ tracing_snapshot_write(struct file *filp goto out; } + local_irq_disable(); arch_spin_lock(&tr->max_lock); if (tr->cond_snapshot) ret = -EBUSY; arch_spin_unlock(&tr->max_lock); + local_irq_enable(); if (ret) goto out; From patchwork Wed Oct 19 08:24: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: 4595 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp206305wrs; Wed, 19 Oct 2022 01:52:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4y5s+uFDQ3jnDKUod+cadhfN6Jgbou8vc1LGFfN/Qun8FwvRoWNUwdbjLscTg/utXEYmsN X-Received: by 2002:a63:354e:0:b0:439:837:692f with SMTP id c75-20020a63354e000000b004390837692fmr6441324pga.74.1666169524605; Wed, 19 Oct 2022 01:52:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169524; cv=none; d=google.com; s=arc-20160816; b=PHMRGWZBSndjYsbBYxrcLEajJULdycESB4DLHiixfEyMVlxkiCqJeC2eWz4nyb5Rel xhTSsbYdG1aF+9o1Zmkh7VKuT/1jhtg7OHh/atkD7AFpuG02Ho2PuvInYFcAICoq/LJw VBXxhOBstJ77c4VMhiXH8tMu3ghU4lKFY/QmSCXol1WrnlO6Vp3Uz52c+7QmsAHTyG/L kJGGu1+d8L1Ag9lyLMueKhHN7TRbdlKbXT4M7AMdRwcGQPUoc5Jl58p9WmZmKgvaD46Q 8KiC4+MoUAnehqYmNAepXH4a5BpTr6oTD74EZVeYldhMv/VRTvE+alUaqSbsDWusDTnH 6ELA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=EEjdHCiy3VT3zNZ9qREpPsxlzbLPsv/9VD9RXYm5H2w=; b=TkvMYKz8eAy03odsiHNg7eo9Mr1rNUM7ObXaB+Himjqc0uOr4c09ow3SO+w2vXeYSZ Cnql2U3DjupH8Rzv3K0NBhTC8esvvocp6JguRoabfLXr/o7FGMtfp/qHa6bBUkKmPANz sFezUkSzb9gXCtARDeGtRjlOzeUrQnaGLhUC5JSI7FpK8w3zjwQ1kI8opgnRohN0/g+0 LUajqp5k+xyBtQXH18owNDZH7DCguvE6ZSu62UlZdESMptmWevPSO5P3FsMHZ3InAhU4 0jXuKp8GWkSR8p8yV/qbmyr8FdSNDRIiwVswIfn5AR1Jhyxx8pqyV8/bUzj8Yf1k/A0j /DsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OIk9Lb39; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r30-20020a63fc5e000000b004600f27528fsi18000508pgk.175.2022.10.19.01.51.52; Wed, 19 Oct 2022 01:52: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=OIk9Lb39; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231689AbiJSIv2 (ORCPT + 99 others); Wed, 19 Oct 2022 04:51:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231727AbiJSItJ (ORCPT ); Wed, 19 Oct 2022 04:49:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA37E900DA; Wed, 19 Oct 2022 01:47:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AA276617E1; Wed, 19 Oct 2022 08:46:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C0C3CC433C1; Wed, 19 Oct 2022 08:46:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169213; bh=mnc13TlevMeVJzlX+brpL19d8f7IuIS8B6nuN0+yHxE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OIk9Lb39UTrjBUCt5lmb4moWUQklM9x/QXWdOxpPdI2KOfFMg7IVi5VLBAYbQXx+v R1CWBWGEUyt8G9fe7FK025U0GDZgi9wXH3pXiYync+Sy4wOAOYMvJXyxnpuZAb3jJW LMMkRkTXBcOOv3h5x14ibz1Uw+omwUGqXUP/pKDc= 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 6.0 159/862] tracing: Wake up ring buffer waiters on closing of the file Date: Wed, 19 Oct 2022 10:24:06 +0200 Message-Id: <20221019083256.997469669@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105375108334630?= X-GMAIL-MSGID: =?utf-8?q?1747105375108334630?= From: Steven Rostedt (Google) commit f3ddb74ad0790030c9592229fb14d8c451f4e9a8 upstream. When the file that represents the ring buffer is closed, there may be waiters waiting on more input from the ring buffer. Call ring_buffer_wake_waiters() to wake up any waiters when the file is closed. Link: https://lkml.kernel.org/r/20220927231825.182416969@goodmis.org Cc: stable@vger.kernel.org Cc: Ingo Molnar Cc: Andrew Morton Fixes: e30f53aad2202 ("tracing: Do not busy wait in buffer splice") Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman --- include/linux/trace_events.h | 1 + kernel/trace/trace.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+) --- a/include/linux/trace_events.h +++ b/include/linux/trace_events.h @@ -92,6 +92,7 @@ struct trace_iterator { unsigned int temp_size; char *fmt; /* modified format holder */ unsigned int fmt_size; + long wait_index; /* trace_seq for __print_flags() and __print_symbolic() etc. */ struct trace_seq tmp_seq; --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -8160,6 +8160,12 @@ static int tracing_buffers_release(struc __trace_array_put(iter->tr); + iter->wait_index++; + /* Make sure the waiters see the new wait_index */ + smp_wmb(); + + ring_buffer_wake_waiters(iter->array_buffer->buffer, iter->cpu_file); + if (info->spare) ring_buffer_free_read_page(iter->array_buffer->buffer, info->spare_cpu, info->spare); @@ -8313,6 +8319,8 @@ tracing_buffers_splice_read(struct file /* did we read anything? */ if (!spd.nr_pages) { + long wait_index; + if (ret) goto out; @@ -8320,10 +8328,17 @@ tracing_buffers_splice_read(struct file if ((file->f_flags & O_NONBLOCK) || (flags & SPLICE_F_NONBLOCK)) goto out; + wait_index = READ_ONCE(iter->wait_index); + ret = wait_on_pipe(iter, iter->tr->buffer_percent); if (ret) goto out; + /* Make sure we see the new wait_index */ + smp_rmb(); + if (wait_index != iter->wait_index) + goto out; + goto again; } From patchwork Wed Oct 19 08:24: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: 4644 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212294wrs; Wed, 19 Oct 2022 02:07:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5u9XnnMcEafpGLAz1w0Z+ZrzT1BNYw8s5xTNlQ/uUGqhi9xlwjv1QuKKZG1H6gYjGD4l3j X-Received: by 2002:a17:906:5dce:b0:78d:e71a:6e0 with SMTP id p14-20020a1709065dce00b0078de71a06e0mr5886095ejv.360.1666170430325; Wed, 19 Oct 2022 02:07:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170430; cv=none; d=google.com; s=arc-20160816; b=p6lSpmbhcBwMftPGx3BmBYPHlaTx2G4mtxbttaRieGZM/Rk1c+UFS3bc/QUaDnZrpb gnDPNQtGF3SmE7YJ9avbI1+OiKViIswmcllIhY8aZYjQ2tlNkig5wW4t3SFZPY91nd+U 6Ja/4wbiOrIy2Np4vp7L9LYx0J0l5I325acuglebtIukOPIoSfkBBojJhkig1H+zPFHd U9KFOr43/oT+iaDDUC4PDode01DnYrUenYdoiMIQuAvTed+PZBfSOI+AbqZlULnFicbD j5Xb0ri0gMJMR3rLdup0lmaQJX69nFLXr1kfI/ZDtKeyjSDIQnoh30TEOCvJvZ12fe6i icRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6Sm4xBGn13BnTHb/GXr5N9tQIwthy5VIZ/YGbjFkvSQ=; b=eQtfav5zAUyqElLHxic8DsvIL0qtbITPxpmo0bLI89xwCJhczy10dJkcsghJhk6hEu pdnV1foeXJigDuvFXljPGfJBkmEAe0mGMRX7+2NJRP4fAYcJaQZXUabBy7o4HswowApb g6fxajfCNBS/HnShXLmotvYkfZdvDAr9FGwZTcy4IYpueuB/GejeIVGjxWGzjFTbNLFO Hs0i/N1eK8CM6gii3uZHFNJjd9hLW2o/RHz/Qn9EKLDNYfC4Wcn0HRSvQ9lF+Kd9CpRI UMWSSZsBSZMkbkUBHzjwmwF/5x7gk3v+CvxnrKhBZ86acXlYn5oHfonnmAYTdLVRfB1j tw4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nKDk0BrC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b19-20020a056402279300b0044e9ca6880bsi16532767ede.364.2022.10.19.02.06.35; Wed, 19 Oct 2022 02:07: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=nKDk0BrC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232069AbiJSI6m (ORCPT + 99 others); Wed, 19 Oct 2022 04:58:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231860AbiJSI5e (ORCPT ); Wed, 19 Oct 2022 04:57:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A3B89DDBB; Wed, 19 Oct 2022 01:53: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 665BB617F0; Wed, 19 Oct 2022 08:45:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78F33C433D6; Wed, 19 Oct 2022 08:45:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169103; bh=Sv+gMvx7ElIgs69dRSsTjaWSf4VxBR1l6ktaoWCiT5I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nKDk0BrCb4NwtowzCxG9XnpsYw8lXUXoWBa6Rbsp2gHRTGJ1PUNVXC2DhGsaoB1ju pjZGsjqonEI7wU26IDsXbdiNn9nM9xlcgpqBE6a70+VCv7jt4GMiXMAbhptFy3o1QO 4p9I182vXe12NJ5F5W/pKAOHPJ1m7xyC/HaEBu3k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Steven Rostedt (Google)" Subject: [PATCH 6.0 160/862] tracing: Wake up waiters when tracing is disabled Date: Wed, 19 Oct 2022 10:24:07 +0200 Message-Id: <20221019083257.041014477@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106325051830518?= X-GMAIL-MSGID: =?utf-8?q?1747106325051830518?= From: Steven Rostedt (Google) commit 2b0fd9a59b7990c161fa1cb7b79edb22847c87c2 upstream. When tracing is disabled, there's no reason that waiters should stay waiting, wake them up, otherwise tasks get stuck when they should be flushing the buffers. Cc: stable@vger.kernel.org Fixes: e30f53aad2202 ("tracing: Do not busy wait in buffer splice") Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman --- kernel/trace/trace.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -8334,6 +8334,10 @@ tracing_buffers_splice_read(struct file if (ret) goto out; + /* No need to wait after waking up when tracing is off */ + if (!tracer_tracing_is_on(iter->tr)) + goto out; + /* Make sure we see the new wait_index */ smp_rmb(); if (wait_index != iter->wait_index) @@ -9043,6 +9047,8 @@ rb_simple_write(struct file *filp, const tracer_tracing_off(tr); if (tr->current_trace->stop) tr->current_trace->stop(tr); + /* Wake up any waiters */ + ring_buffer_wake_waiters(buffer, RING_BUFFER_ALL_CPUS); } mutex_unlock(&trace_types_lock); } From patchwork Wed Oct 19 08:24: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: 4574 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp205131wrs; Wed, 19 Oct 2022 01:48:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4tML4llgAj+mWbsWSsknybpwEiwMMlWvZVOV//bSJHHYU6033VR+wGBYPg0httgg5v0FNT X-Received: by 2002:aa7:8893:0:b0:563:89e0:2d43 with SMTP id z19-20020aa78893000000b0056389e02d43mr7146273pfe.25.1666169306993; Wed, 19 Oct 2022 01:48:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169306; cv=none; d=google.com; s=arc-20160816; b=TqeH4hX/fBTuuTS8c1MWbhPfMTP83dqE7cHqnTXx/2uB4ktcoV2RrQk/VBKWASEgHu /O+VFtlQa7UkOP2ZYopQXkgPiEKLwEMeTh1+kq2W7kW+4XqSS79xZ0lcJI6OF1JjzDJH 1UY4lhJp56x/09rBjVcISoTbGp6dY115vwefUrz1wvpkBhApDCzV3qUoz+NMJrVLko63 b5UV8Arki98FaxZ03R3oWcGQGbKqhFImpqFgXWqftKrVYac3k3EaSwNCFtuLB6weKhNW KKepQ7BVJdPH3Hdk9zmXujAbYFXHhfjKYkBq87V7lDu3Hf5hoSBDy31MdDYTqoLMBcDp 5JfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3LNgrQpDWQc9P23FLs/W3M4C7K+AnTH8yKu7xsG1MDA=; b=lPacW18NcGE5eza1UOxyR96Vx2F28+KcmsQrwmLpblqTzFa0aLhYoxiTa3Nh1Ugf63 Ztxh4QkD1sQks6XluIIdE1yp0sZ6xNdE/CAo2vLS8+IX5BfvvT+tmQTd4KqQH1gv676j EFRshPxZJJS34VNNlZHb4Goi4kbPuoMddKTnxcdzOyiNQZD0+t/lbmtt3H2/covZTQ75 Ys2H6POBUpU9qXz8VZJrd2PHrd50CfI8ynLSvwQvjBp77mUxqdPS3/g9uAyrQ9+HY7iQ odA4QzchUZFOekpB0gxwDm/PtItkXg72dJ/1JYiV6CnE8Yf+fVmjg7u3DaLuueBqR/8/ pqrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UwzxLmf1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z5-20020a056a00240500b0053708adb535si18539975pfh.257.2022.10.19.01.48.14; Wed, 19 Oct 2022 01:48: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=UwzxLmf1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231397AbiJSIrx (ORCPT + 99 others); Wed, 19 Oct 2022 04:47:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230127AbiJSIrb (ORCPT ); Wed, 19 Oct 2022 04:47:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC0ED66113; Wed, 19 Oct 2022 01:45:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3DCC8617E2; Wed, 19 Oct 2022 08:45:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4FEC3C433C1; Wed, 19 Oct 2022 08:45:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169106; bh=4wnaODor8D624RR9nMhH13dQqwy3N+A65TEwwd7SL/M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UwzxLmf1utxBqcClmmIlxFiAq3qtxWwfkgmHZi6qUtJIRFjXN04FObbSaCAjHk5DE x7GKXaxcGO5gEjfZwsaZiCQ7Jbc0xSqzC9VAzyo65ftOQdJrdHnVUXSzlgP7RKYzLz ZVA+9qkiZV1ZfCJKDtjXJlrLyWKn5IpbuKq7szFE= 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 6.0 161/862] tracing: Add ioctl() to force ring buffer waiters to wake up Date: Wed, 19 Oct 2022 10:24:08 +0200 Message-Id: <20221019083257.077986950@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105147279093258?= X-GMAIL-MSGID: =?utf-8?q?1747105147279093258?= From: Steven Rostedt (Google) commit 01b2a52171735c6eea80ee2f355f32bea6c41418 upstream. If a process is waiting on the ring buffer for data, there currently isn't a clean way to force it to wake up. Add an ioctl call that will force any tasks that are waiting on the trace_pipe_raw file to wake up. Link: https://lkml.kernel.org/r/20220929095029.117f913f@gandalf.local.home Cc: stable@vger.kernel.org Cc: Ingo Molnar Cc: Andrew Morton Fixes: e30f53aad2202 ("tracing: Do not busy wait in buffer splice") Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman --- kernel/trace/trace.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -8353,12 +8353,34 @@ out: return ret; } +/* An ioctl call with cmd 0 to the ring buffer file will wake up all waiters */ +static long tracing_buffers_ioctl(struct file *file, unsigned int cmd, unsigned long arg) +{ + struct ftrace_buffer_info *info = file->private_data; + struct trace_iterator *iter = &info->iter; + + if (cmd) + return -ENOIOCTLCMD; + + mutex_lock(&trace_types_lock); + + iter->wait_index++; + /* Make sure the waiters see the new wait_index */ + smp_wmb(); + + ring_buffer_wake_waiters(iter->array_buffer->buffer, iter->cpu_file); + + mutex_unlock(&trace_types_lock); + return 0; +} + static const struct file_operations tracing_buffers_fops = { .open = tracing_buffers_open, .read = tracing_buffers_read, .poll = tracing_buffers_poll, .release = tracing_buffers_release, .splice_read = tracing_buffers_splice_read, + .unlocked_ioctl = tracing_buffers_ioctl, .llseek = no_llseek, }; From patchwork Wed Oct 19 08:24: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: 4608 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp211150wrs; Wed, 19 Oct 2022 02:04:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6ywXlZlCrySZnEtl04Ip/lupPb4hBmR0I6f6XY/2zNS5s+UUk99g6Vd0opIFMIbi7qqAv4 X-Received: by 2002:a65:554b:0:b0:46a:f646:6374 with SMTP id t11-20020a65554b000000b0046af6466374mr6474030pgr.356.1666170252806; Wed, 19 Oct 2022 02:04:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170252; cv=none; d=google.com; s=arc-20160816; b=YAdtZu1JgiPk2jPE9H9jYGeIsDp+IA3PVIyPHNHKb3Ny5C1cYwan0Ji4un887zYfO2 I4O9SwezUFXddNZviXU0R679MD4n1TSl/7gaPHu4GtN/4AqDAREVLWgErVuA/Er2cjUP /TrCsOV824kQm+WLv8l6zbGVMbDCbpS1d2BIxs4x4VTxKN1XaEFEkM3tvIkdQWNB221x WzI1sbbvDru2Fz+u+QV5gSN7DwtCt5sQ/rRwixjvlsnhGH+sDDivQ9kzmx0CREq/jU8E 3AccgKpe9oAGgFincmLXw0rUWyKFi8XKJX9WUtSzk1XByC0Q6E4eVIfO4UnWfg56PMcQ 6NYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YhZfn5Z1PAb+XjaJBe5poyH99Jd6/5FRay5v1WwD3RY=; b=xNHvsnvzzFFda9e6shvSkOg3EVdeXXBgXmEyQAx6TDMJByKbwExDGcP6UmllzzISF3 JZO5wNYZlNXv5PH0y2xLjmbGjFSnDtQLt73SCPjLgyoec0A+oraKMeKEadXTBszaEopC HmFM4ttQmzdBM36r02Sfs3DUZkgJqsvhxxCH77llCIpDMo6hG9jNpkqMO4CmPAieS+TW HJpwJ3hzbtLyNn2YHkB61h61TxPaoNfAeAz0kJy3saSSXTrv8AWjj3z1K6QN6cdEEmLe 5UAI5k3u6Nuuqrksl4XpQgS7VdX4vsX2skp4xk9UzvKX5Me09CSsKAtte1UERInmOzEa 4RGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Fs7XpqUd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a630242000000b0046107c067c7si17529762pgc.822.2022.10.19.02.03.46; Wed, 19 Oct 2022 02:04: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=Fs7XpqUd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230124AbiJSIwQ (ORCPT + 99 others); Wed, 19 Oct 2022 04:52:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232105AbiJSIuW (ORCPT ); Wed, 19 Oct 2022 04:50: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 B6B4324BD9; Wed, 19 Oct 2022 01:49: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 CF4E26181D; Wed, 19 Oct 2022 08:45:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D2846C433D6; Wed, 19 Oct 2022 08:45:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169110; bh=c9ygUptf6V7bC9GOUoGrIQJL+pvol/TW/5HDxSDa1cA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fs7XpqUdbwe+Wb0k+Ar+08aNfsZQ7RSQfK26XXO0L02kqlQCMSqP5kStpJiA7rGId E0AayaDBgpChb+4eVdJL5IodaDww0jWswU/kJLCAovBPD4PAeMrlNdBOEhE52G+qqJ v9nq72HCYoahMs3+SJDd3yXF6EVHbSAEiYbctOYc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Masami Hiramatsu , Andrew Morton , Ross Zwisler , "Steven Rostedt (Google)" Subject: [PATCH 6.0 162/862] tracing: Do not free snapshot if tracer is on cmdline Date: Wed, 19 Oct 2022 10:24:09 +0200 Message-Id: <20221019083257.127954013@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106138828918797?= X-GMAIL-MSGID: =?utf-8?q?1747106138828918797?= From: Steven Rostedt (Google) commit a541a9559bb0a8ecc434de01d3e4826c32e8bb53 upstream. The ftrace_boot_snapshot and alloc_snapshot cmdline options allocate the snapshot buffer at boot up for use later. The ftrace_boot_snapshot in particular requires the snapshot to be allocated because it will take a snapshot at the end of boot up allowing to see the traces that happened during boot so that it's not lost when user space takes over. When a tracer is registered (started) there's a path that checks if it requires the snapshot buffer or not, and if it does not and it was allocated it will do a synchronization and free the snapshot buffer. This is only required if the previous tracer was using it for "max latency" snapshots, as it needs to make sure all max snapshots are complete before freeing. But this is only needed if the previous tracer was using the snapshot buffer for latency (like irqoff tracer and friends). But it does not make sense to free it, if the previous tracer was not using it, and the snapshot was allocated by the cmdline parameters. This basically takes away the point of allocating it in the first place! Note, the allocated snapshot worked fine for just trace events, but fails when a tracer is enabled on the cmdline. Further investigation, this goes back even further and it does not require a tracer on the cmdline to fail. Simply enable snapshots and then enable a tracer, and it will remove the snapshot. Link: https://lkml.kernel.org/r/20221005113757.041df7fe@gandalf.local.home Cc: Masami Hiramatsu Cc: Andrew Morton Cc: stable@vger.kernel.org Fixes: 45ad21ca5530 ("tracing: Have trace_array keep track if snapshot buffer is allocated") Reported-by: Ross Zwisler Tested-by: Ross Zwisler Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman --- kernel/trace/trace.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -6428,12 +6428,12 @@ int tracing_set_tracer(struct trace_arra if (tr->current_trace->reset) tr->current_trace->reset(tr); +#ifdef CONFIG_TRACER_MAX_TRACE + had_max_tr = tr->current_trace->use_max_tr; + /* Current trace needs to be nop_trace before synchronize_rcu */ tr->current_trace = &nop_trace; -#ifdef CONFIG_TRACER_MAX_TRACE - had_max_tr = tr->allocated_snapshot; - if (had_max_tr && !t->use_max_tr) { /* * We need to make sure that the update_max_tr sees that @@ -6446,11 +6446,13 @@ int tracing_set_tracer(struct trace_arra free_snapshot(tr); } - if (t->use_max_tr && !had_max_tr) { + if (t->use_max_tr && !tr->allocated_snapshot) { ret = tracing_alloc_snapshot_instance(tr); if (ret < 0) goto out; } +#else + tr->current_trace = &nop_trace; #endif if (t->init) { From patchwork Wed Oct 19 08:24: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: 5538 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp348369wrs; Wed, 19 Oct 2022 07:10:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4sXTzks6GJJcQtSo5HGjl7yVovOu9VIaSEvZ+vQATtUx52St2KHH/us53ZEagWvHfjueUo X-Received: by 2002:a17:906:fd85:b0:77b:b538:6472 with SMTP id xa5-20020a170906fd8500b0077bb5386472mr6949781ejb.48.1666188601517; Wed, 19 Oct 2022 07:10:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666188601; cv=none; d=google.com; s=arc-20160816; b=y1mwsgTDtJfsU4mZuChiHrAwgmSsKPJRx8YbZ6Da9X3SPXm0kSvrwdXRte6L3Nr+qH D8Tjwggn/ja53jgqGZhUmrA8YtroaJpxkF6hr+W+0KO+2F0LllIAcJ9UxDKay3UuK4iV K8r2ipoTOzK1hWf8nYA6VjE8pLCQu7bbtZPs4RlGLCXJhBbCFc8YQvo+R8avk/KHFijU GQR8hvar1st21Yf3nrqwuDbYXxGyUakh37TEFfQCo8x0F26tqD5cEeaxT+0mJBNHA9Bt 19ImPb7VGm8XMxETbFfS8OJDxjvTKNBBQ84pkSej8GXQZUEPXfnLzM8YaaYhKCWs7P/F MCJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pK9bpvzavb/IigJNnYvzC4Nf2AbFDpJdddR7luRHjmI=; b=cQnMRkCXWGKzelSHmK7j+yIJvlnAUriJQD+7gp3Ls9j5q/DNksvGBN4kFsYUB90RQ9 zF22TRg0abNi2F0l5YNTJZI+dz3LrLYcSGMBGYNtxwqgOL9LulFWSwOx3D6d1U1ujXeJ jTMl/hWLGFBDH4T3JHVfbI/0+BrTjUaTKOc77jkd2eJn3nKbjWJtzC4SmPAi+mso46AF 8WS1ubPI64UvjGZqjdXslyj1UaUEyHcodi+iPy3+RAmDxhlvfEbwM919SqXUVumTCa0V UrWgZMOYxij4yjfeZCCRznfTEkXu0Z2A3Ewc+fOs+LaSNB07xRzxRUiQR5pP939crn7/ 69SQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UOKwMBG3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id md5-20020a170906ae8500b00783c42d2da2si11862504ejb.415.2022.10.19.07.09.15; Wed, 19 Oct 2022 07:10: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=UOKwMBG3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232344AbiJSNw2 (ORCPT + 99 others); Wed, 19 Oct 2022 09:52:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233702AbiJSNv6 (ORCPT ); Wed, 19 Oct 2022 09:51:58 -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 4EDA2189C2C; Wed, 19 Oct 2022 06:35: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 sin.source.kernel.org (Postfix) with ESMTPS id 5EB30CE20EC; Wed, 19 Oct 2022 08:45:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2498EC43150; Wed, 19 Oct 2022 08:45:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169113; bh=XDjOCPtyJ+ylfAPNVAyr7LIRSuqzjxkX5201IvT0urI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UOKwMBG3c/zSN1lr8jWluF53MKxAD/WgxxSftan4Uu/O2EBygdwj4Lidjq5XlJ1y6 TFOhSmreEG7i+m2MUc45KcM7MccF4TQ6BIloUfkGuq2qepAwMoAuuqlwJHOQT24dM2 th5Xrd/254tF2ssowFTNVD/0QHMnl9nwer94f4zM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrew Morton , Tom Zanussi , "Masami Hiramatsu (Google)" , "Steven Rostedt (Google)" Subject: [PATCH 6.0 163/862] tracing: Move duplicate code of trace_kprobe/eprobe.c into header Date: Wed, 19 Oct 2022 10:24:10 +0200 Message-Id: <20221019083257.177182803@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747125379077514400?= X-GMAIL-MSGID: =?utf-8?q?1747125379077514400?= From: Steven Rostedt (Google) commit f1d3cbfaafc10464550c6d3a125f4fc802bbaed5 upstream. The functions: fetch_store_strlen_user() fetch_store_strlen() fetch_store_string_user() fetch_store_string() are identical in both trace_kprobe.c and trace_eprobe.c. Move them into a new header file trace_probe_kernel.h to share it. This code will later be used by the synthetic events as well. Marked for stable as a fix for a crash in synthetic events requires it. Link: https://lkml.kernel.org/r/20221012104534.467668078@goodmis.org Cc: stable@vger.kernel.org Cc: Andrew Morton Cc: Tom Zanussi Acked-by: Masami Hiramatsu (Google) Reviewed-by: Tom Zanussi Fixes: bd82631d7ccdc ("tracing: Add support for dynamic strings to synthetic events") Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman --- kernel/trace/trace_eprobe.c | 60 +---------------------- kernel/trace/trace_kprobe.c | 60 +---------------------- kernel/trace/trace_probe_kernel.h | 96 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 106 insertions(+), 110 deletions(-) create mode 100644 kernel/trace/trace_probe_kernel.h --- a/kernel/trace/trace_eprobe.c +++ b/kernel/trace/trace_eprobe.c @@ -16,6 +16,7 @@ #include "trace_dynevent.h" #include "trace_probe.h" #include "trace_probe_tmpl.h" +#include "trace_probe_kernel.h" #define EPROBE_EVENT_SYSTEM "eprobes" @@ -453,29 +454,14 @@ NOKPROBE_SYMBOL(process_fetch_insn) static nokprobe_inline int fetch_store_strlen_user(unsigned long addr) { - const void __user *uaddr = (__force const void __user *)addr; - - return strnlen_user_nofault(uaddr, MAX_STRING_SIZE); + return kern_fetch_store_strlen_user(addr); } /* Return the length of string -- including null terminal byte */ static nokprobe_inline int fetch_store_strlen(unsigned long addr) { - int ret, len = 0; - u8 c; - -#ifdef CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE - if (addr < TASK_SIZE) - return fetch_store_strlen_user(addr); -#endif - - do { - ret = copy_from_kernel_nofault(&c, (u8 *)addr + len, 1); - len++; - } while (c && ret == 0 && len < MAX_STRING_SIZE); - - return (ret < 0) ? ret : len; + return kern_fetch_store_strlen(addr); } /* @@ -485,21 +471,7 @@ fetch_store_strlen(unsigned long addr) static nokprobe_inline int fetch_store_string_user(unsigned long addr, void *dest, void *base) { - const void __user *uaddr = (__force const void __user *)addr; - int maxlen = get_loc_len(*(u32 *)dest); - void *__dest; - long ret; - - if (unlikely(!maxlen)) - return -ENOMEM; - - __dest = get_loc_data(dest, base); - - ret = strncpy_from_user_nofault(__dest, uaddr, maxlen); - if (ret >= 0) - *(u32 *)dest = make_data_loc(ret, __dest - base); - - return ret; + return kern_fetch_store_string_user(addr, dest, base); } /* @@ -509,29 +481,7 @@ fetch_store_string_user(unsigned long ad static nokprobe_inline int fetch_store_string(unsigned long addr, void *dest, void *base) { - int maxlen = get_loc_len(*(u32 *)dest); - void *__dest; - long ret; - -#ifdef CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE - if ((unsigned long)addr < TASK_SIZE) - return fetch_store_string_user(addr, dest, base); -#endif - - if (unlikely(!maxlen)) - return -ENOMEM; - - __dest = get_loc_data(dest, base); - - /* - * Try to get string again, since the string can be changed while - * probing. - */ - ret = strncpy_from_kernel_nofault(__dest, (void *)addr, maxlen); - if (ret >= 0) - *(u32 *)dest = make_data_loc(ret, __dest - base); - - return ret; + return kern_fetch_store_string(addr, dest, base); } static nokprobe_inline int --- a/kernel/trace/trace_kprobe.c +++ b/kernel/trace/trace_kprobe.c @@ -20,6 +20,7 @@ #include "trace_kprobe_selftest.h" #include "trace_probe.h" #include "trace_probe_tmpl.h" +#include "trace_probe_kernel.h" #define KPROBE_EVENT_SYSTEM "kprobes" #define KRETPROBE_MAXACTIVE_MAX 4096 @@ -1223,29 +1224,14 @@ static const struct file_operations kpro static nokprobe_inline int fetch_store_strlen_user(unsigned long addr) { - const void __user *uaddr = (__force const void __user *)addr; - - return strnlen_user_nofault(uaddr, MAX_STRING_SIZE); + return kern_fetch_store_strlen_user(addr); } /* Return the length of string -- including null terminal byte */ static nokprobe_inline int fetch_store_strlen(unsigned long addr) { - int ret, len = 0; - u8 c; - -#ifdef CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE - if (addr < TASK_SIZE) - return fetch_store_strlen_user(addr); -#endif - - do { - ret = copy_from_kernel_nofault(&c, (u8 *)addr + len, 1); - len++; - } while (c && ret == 0 && len < MAX_STRING_SIZE); - - return (ret < 0) ? ret : len; + return kern_fetch_store_strlen(addr); } /* @@ -1255,21 +1241,7 @@ fetch_store_strlen(unsigned long addr) static nokprobe_inline int fetch_store_string_user(unsigned long addr, void *dest, void *base) { - const void __user *uaddr = (__force const void __user *)addr; - int maxlen = get_loc_len(*(u32 *)dest); - void *__dest; - long ret; - - if (unlikely(!maxlen)) - return -ENOMEM; - - __dest = get_loc_data(dest, base); - - ret = strncpy_from_user_nofault(__dest, uaddr, maxlen); - if (ret >= 0) - *(u32 *)dest = make_data_loc(ret, __dest - base); - - return ret; + return kern_fetch_store_string_user(addr, dest, base); } /* @@ -1279,29 +1251,7 @@ fetch_store_string_user(unsigned long ad static nokprobe_inline int fetch_store_string(unsigned long addr, void *dest, void *base) { - int maxlen = get_loc_len(*(u32 *)dest); - void *__dest; - long ret; - -#ifdef CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE - if ((unsigned long)addr < TASK_SIZE) - return fetch_store_string_user(addr, dest, base); -#endif - - if (unlikely(!maxlen)) - return -ENOMEM; - - __dest = get_loc_data(dest, base); - - /* - * Try to get string again, since the string can be changed while - * probing. - */ - ret = strncpy_from_kernel_nofault(__dest, (void *)addr, maxlen); - if (ret >= 0) - *(u32 *)dest = make_data_loc(ret, __dest - base); - - return ret; + return kern_fetch_store_string(addr, dest, base); } static nokprobe_inline int --- /dev/null +++ b/kernel/trace/trace_probe_kernel.h @@ -0,0 +1,96 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __TRACE_PROBE_KERNEL_H_ +#define __TRACE_PROBE_KERNEL_H_ + +/* + * This depends on trace_probe.h, but can not include it due to + * the way trace_probe_tmpl.h is used by trace_kprobe.c and trace_eprobe.c. + * Which means that any other user must include trace_probe.h before including + * this file. + */ +/* Return the length of string -- including null terminal byte */ +static nokprobe_inline int +kern_fetch_store_strlen_user(unsigned long addr) +{ + const void __user *uaddr = (__force const void __user *)addr; + + return strnlen_user_nofault(uaddr, MAX_STRING_SIZE); +} + +/* Return the length of string -- including null terminal byte */ +static nokprobe_inline int +kern_fetch_store_strlen(unsigned long addr) +{ + int ret, len = 0; + u8 c; + +#ifdef CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE + if (addr < TASK_SIZE) + return kern_fetch_store_strlen_user(addr); +#endif + + do { + ret = copy_from_kernel_nofault(&c, (u8 *)addr + len, 1); + len++; + } while (c && ret == 0 && len < MAX_STRING_SIZE); + + return (ret < 0) ? ret : len; +} + +/* + * Fetch a null-terminated string from user. Caller MUST set *(u32 *)buf + * with max length and relative data location. + */ +static nokprobe_inline int +kern_fetch_store_string_user(unsigned long addr, void *dest, void *base) +{ + const void __user *uaddr = (__force const void __user *)addr; + int maxlen = get_loc_len(*(u32 *)dest); + void *__dest; + long ret; + + if (unlikely(!maxlen)) + return -ENOMEM; + + __dest = get_loc_data(dest, base); + + ret = strncpy_from_user_nofault(__dest, uaddr, maxlen); + if (ret >= 0) + *(u32 *)dest = make_data_loc(ret, __dest - base); + + return ret; +} + +/* + * Fetch a null-terminated string. Caller MUST set *(u32 *)buf with max + * length and relative data location. + */ +static nokprobe_inline int +kern_fetch_store_string(unsigned long addr, void *dest, void *base) +{ + int maxlen = get_loc_len(*(u32 *)dest); + void *__dest; + long ret; + +#ifdef CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE + if ((unsigned long)addr < TASK_SIZE) + return kern_fetch_store_string_user(addr, dest, base); +#endif + + if (unlikely(!maxlen)) + return -ENOMEM; + + __dest = get_loc_data(dest, base); + + /* + * Try to get string again, since the string can be changed while + * probing. + */ + ret = strncpy_from_kernel_nofault(__dest, (void *)addr, maxlen); + if (ret >= 0) + *(u32 *)dest = make_data_loc(ret, __dest - base); + + return ret; +} + +#endif /* __TRACE_PROBE_KERNEL_H_ */ From patchwork Wed Oct 19 08:24: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: 4575 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp205250wrs; Wed, 19 Oct 2022 01:48:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7CkwJ6stliVXWxW68t/TFi3BGT37lsAw9yY6Z5G/wsuVZBHHhHTjez37HQfo6qxCnWVeRI X-Received: by 2002:a17:903:283:b0:17f:7596:e328 with SMTP id j3-20020a170903028300b0017f7596e328mr7187519plr.56.1666169328347; Wed, 19 Oct 2022 01:48:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169328; cv=none; d=google.com; s=arc-20160816; b=txtoGBj4hYH5z6usIYVUdpb/M7tXVoNPTDBNl18U6PV2h7jAq13lBtIE9h/EGb+hqX P+INlcppayeEMbspNLQ7NTCG2qbHi5ac0sdPzML1zCAsaH0yMq1YRoREboKIdTlJ26Vg /PAeLUUhEf4WWyVrJDWnnuAgksbrw5SOW7JkFy56ye+0nnFt9nTec/r9Ff6/TtgAuH/b cgeOBTfCYpwLRpidEh/soFKBciuHov5X7va8z1DNHT4j7vzPXTOOCXWhfI8iDwhWeyNl pua1JoE6j4twFgETIAEerUPCCrnxWY0FeMUX6KJ9cWGvkVA35Pm8HXbu/yO9MT6KBrdT dEmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ih/K2NUmVLF3iW/uqIxyeNeXFamF3KjqXdHGTKCImpE=; b=YaYexLELIFSiaUzxjAGFdW6mwIzZlAPvPjfs/0kE7D0lm43NGC9uZ4m/hzZa4RZ38I KlRn1EG3PEWheUKsx9x4M2KKR/iPUWbHpSphWDK8b460fYc6c+e/uX7WyaFdcH0awiOl mRt4qVOZd2tbq67VcP0z9F0mDJkuhEt/Lj1uDPE/X/uL7GU3IcnKLL5M3vTRwJGabb7O QZkuiZXUDj9toCi7ceBCzzmqnEOuF8P7wLbgLBiNfTWgrEdwAqyerdVbFIAQrVhTqKTd zEu/IXC36x+YU295MOKRYpqvRAU1zTA4ywIrEEanTbiVz64gSua9ffinyeZhh3Qwr1hg z1Og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bIN9wvWP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s4-20020a170902ea0400b00182631bdf78si9423946plg.222.2022.10.19.01.48.35; Wed, 19 Oct 2022 01: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=bIN9wvWP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231547AbiJSIsG (ORCPT + 99 others); Wed, 19 Oct 2022 04:48:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231513AbiJSIrj (ORCPT ); Wed, 19 Oct 2022 04:47:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A0E087692; Wed, 19 Oct 2022 01: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 dfw.source.kernel.org (Postfix) with ESMTPS id 043E261806; Wed, 19 Oct 2022 08:45:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F7A4C433D6; Wed, 19 Oct 2022 08:45:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169116; bh=a6b1NSqvH/b6gAlJZYFh0Q5qf/RCTEE7cuX29pmcyhM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bIN9wvWP3+7+snNcRWMUYsXUXU6tYakCF6UVe+YUcEvJwaHWA98GJLZNWqSyLMGvG TziSD+qsZItV3p0vd8cEygBkndL6I3uyCAb3sE11z1YZy9oQ7Rr4jntMZ37SqXuW1u NsSjqzYE6hlltAiHQQwo60fgGMjFlvGsMk9CAca4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrew Morton , Tom Zanussi , "Masami Hiramatsu (Google)" , "Steven Rostedt (Google)" Subject: [PATCH 6.0 164/862] tracing: Add "(fault)" name injection to kernel probes Date: Wed, 19 Oct 2022 10:24:11 +0200 Message-Id: <20221019083257.216516812@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105169548804459?= X-GMAIL-MSGID: =?utf-8?q?1747105169548804459?= From: Steven Rostedt (Google) commit 2e9906f84fc7c99388bb7123ade167250d50f1c0 upstream. Have the specific functions for kernel probes that read strings to inject the "(fault)" name directly. trace_probes.c does this too (for uprobes) but as the code to read strings are going to be used by synthetic events (and perhaps other utilities), it simplifies the code by making sure those other uses do not need to implement the "(fault)" name injection as well. Link: https://lkml.kernel.org/r/20221012104534.644803645@goodmis.org Cc: stable@vger.kernel.org Cc: Andrew Morton Cc: Tom Zanussi Acked-by: Masami Hiramatsu (Google) Reviewed-by: Tom Zanussi Fixes: bd82631d7ccdc ("tracing: Add support for dynamic strings to synthetic events") Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman --- kernel/trace/trace_probe_kernel.h | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) --- a/kernel/trace/trace_probe_kernel.h +++ b/kernel/trace/trace_probe_kernel.h @@ -2,6 +2,8 @@ #ifndef __TRACE_PROBE_KERNEL_H_ #define __TRACE_PROBE_KERNEL_H_ +#define FAULT_STRING "(fault)" + /* * This depends on trace_probe.h, but can not include it due to * the way trace_probe_tmpl.h is used by trace_kprobe.c and trace_eprobe.c. @@ -13,8 +15,16 @@ static nokprobe_inline int kern_fetch_store_strlen_user(unsigned long addr) { const void __user *uaddr = (__force const void __user *)addr; + int ret; - return strnlen_user_nofault(uaddr, MAX_STRING_SIZE); + ret = strnlen_user_nofault(uaddr, MAX_STRING_SIZE); + /* + * strnlen_user_nofault returns zero on fault, insert the + * FAULT_STRING when that occurs. + */ + if (ret <= 0) + return strlen(FAULT_STRING) + 1; + return ret; } /* Return the length of string -- including null terminal byte */ @@ -34,7 +44,18 @@ kern_fetch_store_strlen(unsigned long ad len++; } while (c && ret == 0 && len < MAX_STRING_SIZE); - return (ret < 0) ? ret : len; + /* For faults, return enough to hold the FAULT_STRING */ + return (ret < 0) ? strlen(FAULT_STRING) + 1 : len; +} + +static nokprobe_inline void set_data_loc(int ret, void *dest, void *__dest, void *base, int len) +{ + if (ret >= 0) { + *(u32 *)dest = make_data_loc(ret, __dest - base); + } else { + strscpy(__dest, FAULT_STRING, len); + ret = strlen(__dest) + 1; + } } /* @@ -55,8 +76,7 @@ kern_fetch_store_string_user(unsigned lo __dest = get_loc_data(dest, base); ret = strncpy_from_user_nofault(__dest, uaddr, maxlen); - if (ret >= 0) - *(u32 *)dest = make_data_loc(ret, __dest - base); + set_data_loc(ret, dest, __dest, base, maxlen); return ret; } @@ -87,8 +107,7 @@ kern_fetch_store_string(unsigned long ad * probing. */ ret = strncpy_from_kernel_nofault(__dest, (void *)addr, maxlen); - if (ret >= 0) - *(u32 *)dest = make_data_loc(ret, __dest - base); + set_data_loc(ret, dest, __dest, base, maxlen); return ret; } From patchwork Wed Oct 19 08:24: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: 5446 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp327932wrs; Wed, 19 Oct 2022 06:30:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7mxnBXxFy2n+eMPYW1Ao8TlZF5Xp32JqSI5+lrsi8cV+ScXJ1SkGbBXF2cvLSIR/JwmvaZ X-Received: by 2002:a05:6a00:1491:b0:563:8844:3f31 with SMTP id v17-20020a056a00149100b0056388443f31mr8440030pfu.31.1666186201972; Wed, 19 Oct 2022 06:30:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666186201; cv=none; d=google.com; s=arc-20160816; b=wevgno8yf4G/v+TTzhcGfDvI5HkExyJonD3fMHgTSwlD59Spp2fgBs/Hb28q2cuADm iof9JSSil071A/QBZy2qhBgxujrA43dUCsZg2wEJDBZemcoDnyfsb+u2X5oEzYiZSKcH a7H8b8MLeP6AD4O69ZRWSAsfc9xTQaF10hFzBprGv+/KJmNCdq9grmyhNX6A3VsAOlZ1 7GSwVDnqOaw6wirUmzHWSysexMp+PhBlgQsG7PTDJO92RsoMlOsnXeGN42Xl3x/zE+S8 lLjcjXFzAhyJ8yvMCjW2kEbhJmaIWS8V/Q2eH4/mJjbZabwhgtsgjU7J8RhCbgwEFoFr HC2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=r8jefCc5omYODzIdGSyaJkR+hbn0RbXEHSNFppjjWcE=; b=DpzUaPkVKXUgALkGpiwEVLISvb6hpz0bR9B07fIzyLkjE3sPo4mKlZvYDz/jj3SerW xoFOxPWNp9UH7b8Ta8b9kgCzFDsIropk6hBInJeSFGM5tE0vXp+VGYD0aSVRBVlxKk5C oLIqiH8QxY8yiq/fCiBjT9oPWpQkIwzw0diRNM46i2i5M8GE3SF3GdnfxPsFuCYUQhYl G7NUiR4mE7jtkV1XpLxjMJewBFp68ntSa+ADPQF9pO+5vgb/rbI5sxfwmbaQqZyM+Rwh ld9IuK1OIqgKJgi1EP02rhuynx2BWOONH+xw0ME2Fi3Z1f0L4+voctRUsqbnJmcErFz6 146w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="q3zdOc/o"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 136-20020a63028e000000b00438762a8c81si18885154pgc.780.2022.10.19.06.29.49; Wed, 19 Oct 2022 06:30: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="q3zdOc/o"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230248AbiJSNQe (ORCPT + 99 others); Wed, 19 Oct 2022 09:16:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232558AbiJSNPt (ORCPT ); Wed, 19 Oct 2022 09:15:49 -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 D1E7F1DC814; Wed, 19 Oct 2022 06:01:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9C7E4B82303; Wed, 19 Oct 2022 08:45:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC648C433D6; Wed, 19 Oct 2022 08:45:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169119; bh=YDvdxWfV1FcnbZUuL8IYRGcSN1JzkaRyWuTjHwTihzY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q3zdOc/oeAMkiNXNuBRt8wu0nIentd5Y+EjLd7sjODSVaMWSHlydyr+WVcIZvc8Ft P9dHQFqDwGmE35++L9RJbVdG6+SnzdyTBv2fdpWprMdSU7UDNkwos4JAN6KTSC8e3t F5M20smpUfSof4cZWmaByfq+5xP27VZD7Csbgvcg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrew Morton , Tom Zanussi , "Masami Hiramatsu (Google)" , "Steven Rostedt (Google)" Subject: [PATCH 6.0 165/862] tracing: Fix reading strings from synthetic events Date: Wed, 19 Oct 2022 10:24:12 +0200 Message-Id: <20221019083257.263418277@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747122862782113829?= X-GMAIL-MSGID: =?utf-8?q?1747122862782113829?= From: Steven Rostedt (Google) commit 0934ae9977c27133449b6dd8c6213970e7eece38 upstream. The follow commands caused a crash: # cd /sys/kernel/tracing # echo 's:open char file[]' > dynamic_events # echo 'hist:keys=common_pid:file=filename:onchange($file).trace(open,$file)' > events/syscalls/sys_enter_openat/trigger' # echo 1 > events/synthetic/open/enable BOOM! The problem is that the synthetic event field "char file[]" will read the value given to it as a string without any memory checks to make sure the address is valid. The above example will pass in the user space address and the sythetic event code will happily call strlen() on it and then strscpy() where either one will cause an oops when accessing user space addresses. Use the helper functions from trace_kprobe and trace_eprobe that can read strings safely (and actually succeed when the address is from user space and the memory is mapped in). Now the above can show: packagekitd-1721 [000] ...2. 104.597170: open: file=/usr/lib/rpm/fileattrs/cmake.attr in:imjournal-978 [006] ...2. 104.599642: open: file=/var/lib/rsyslog/imjournal.state.tmp packagekitd-1721 [000] ...2. 104.626308: open: file=/usr/lib/rpm/fileattrs/debuginfo.attr Link: https://lkml.kernel.org/r/20221012104534.826549315@goodmis.org Cc: stable@vger.kernel.org Cc: Andrew Morton Cc: Tom Zanussi Acked-by: Masami Hiramatsu (Google) Reviewed-by: Tom Zanussi Fixes: bd82631d7ccdc ("tracing: Add support for dynamic strings to synthetic events") Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman --- kernel/trace/trace_events_synth.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) --- a/kernel/trace/trace_events_synth.c +++ b/kernel/trace/trace_events_synth.c @@ -17,6 +17,8 @@ /* for gfp flag names */ #include #include +#include "trace_probe.h" +#include "trace_probe_kernel.h" #include "trace_synth.h" @@ -409,6 +411,7 @@ static unsigned int trace_string(struct { unsigned int len = 0; char *str_field; + int ret; if (is_dynamic) { u32 data_offset; @@ -417,19 +420,27 @@ static unsigned int trace_string(struct data_offset += event->n_u64 * sizeof(u64); data_offset += data_size; - str_field = (char *)entry + data_offset; - - len = strlen(str_val) + 1; - strscpy(str_field, str_val, len); + len = kern_fetch_store_strlen((unsigned long)str_val); data_offset |= len << 16; *(u32 *)&entry->fields[*n_u64] = data_offset; + ret = kern_fetch_store_string((unsigned long)str_val, &entry->fields[*n_u64], entry); + (*n_u64)++; } else { str_field = (char *)&entry->fields[*n_u64]; - strscpy(str_field, str_val, STR_VAR_LEN_MAX); +#ifdef CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE + if ((unsigned long)str_val < TASK_SIZE) + ret = strncpy_from_user_nofault(str_field, str_val, STR_VAR_LEN_MAX); + else +#endif + ret = strncpy_from_kernel_nofault(str_field, str_val, STR_VAR_LEN_MAX); + + if (ret < 0) + strcpy(str_field, FAULT_STRING); + (*n_u64) += STR_VAR_LEN_MAX / sizeof(u64); } @@ -462,7 +473,7 @@ static notrace void trace_event_raw_even val_idx = var_ref_idx[field_pos]; str_val = (char *)(long)var_ref_vals[val_idx]; - len = strlen(str_val) + 1; + len = kern_fetch_store_strlen((unsigned long)str_val); fields_size += len; } From patchwork Wed Oct 19 08:24: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: 5348 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp295989wrs; Wed, 19 Oct 2022 05:26:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4OpgW9Wt27r4DrH7KJXprekEeuvHRxkrJIw9OLbR0+T+WRymfI1UhAvGHx2ooFGtmaWNLk X-Received: by 2002:a05:6402:1052:b0:459:2c49:1aed with SMTP id e18-20020a056402105200b004592c491aedmr7181079edu.212.1666182402332; Wed, 19 Oct 2022 05:26:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666182402; cv=none; d=google.com; s=arc-20160816; b=uZh6V8UO1g1F/g3LwZYa6P2SKo5QPCjuNgkr4jUjo0vxn9OtgwLehoi9TXvK4ChUIi /uVKoLbOqoVmb/ulBjUpOQeHdIJCgyHc23k62mUN/9OHKt8s04hz3c/JS5Kn2Ecw0Wju YnRkQRug53K8k5PiBEun+r/M/qxkvX2ZfUnOahdXS1tHwU80maMxfqCqe917MI7VMA1Q 0NFyLO6CYJO7LJQ04hR5uqTi4+2sFbCktdwh+3P14Q2FcF9ddpSRODs8ke0DFQV7GyYc 3q+zYPBNUvKJfxSnEkCspIHHGcj8FN6EhfOb/m39SZ80JtjohmzUUdD0l7ZrHYjMlHiV 1sMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QZKNLBwoFHC2sEhBNc6rWUygaOHlhYxYFQiN1k42kHw=; b=nFsu5FV8m6N+3OKJuHCbMBVP6my+9BXKTr7NZGTEhvC6A9XrY977h5kTzmuo4Tq156 Vh6PmoP3V9SVnd0fo/YEKYjwBEXj2drMl99u7RwGH7vfEUi993FQyxwklPLZU4csdehI 2/bhJYHbMWMjMdPFVtHonwAhsA0oz0VJ3pwYQ4JV3vv+0I0TZ4CfoFfsxP5f48aLoy5s WiShq4SWig2ydgiuxVCu9aw3QzpdObZ5bLSY/VhtnQX7KFku/Ya0Zy9V/mtvoJVl2gDB q9oEMe2sn5mKpK19owrPptG7fMPmAorF3n3PUChIenYZiu04DT8sdhlYy2D9j156s6dz sdug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=egz38TU6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dn16-20020a17090794d000b00730870cb4b6si11116347ejc.621.2022.10.19.05.26.09; Wed, 19 Oct 2022 05:26:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=egz38TU6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231796AbiJSMRN (ORCPT + 99 others); Wed, 19 Oct 2022 08:17:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231132AbiJSMQ5 (ORCPT ); Wed, 19 Oct 2022 08:16:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B9B4192BAB; Wed, 19 Oct 2022 04:52:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7B967B82301; Wed, 19 Oct 2022 08:45:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE4A1C433D6; Wed, 19 Oct 2022 08:45:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169122; bh=v/ymPpgTxvo03kcno91Ec+SWdJWekcA1Tf7hofUOme4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=egz38TU6EI7ktpxMkD9+/9ilebu5b1D/K6uAmNTk0eodL01smbSuWhykSiigcdFIj MIU7OUFyzV6EMMlW6OodF2sFWoT5ZfvjF3g5Jw4mTjHJ8Cd9nds9d5tOnBliYgQ+R9 xF7EH5xqNNjio12dN8WENFPW//SCwoBliD34g8iM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shengjiu Wang , Arnaud Pouliquen , Peng Fan , Mathieu Poirier Subject: [PATCH 6.0 166/862] rpmsg: char: Avoid double destroy of default endpoint Date: Wed, 19 Oct 2022 10:24:13 +0200 Message-Id: <20221019083257.311883827@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747118878825874621?= X-GMAIL-MSGID: =?utf-8?q?1747118878825874621?= From: Shengjiu Wang commit 467233a4ac29b215d492843d067a9f091e6bf0c5 upstream. The rpmsg_dev_remove() in rpmsg_core is the place for releasing this default endpoint. So need to avoid destroying the default endpoint in rpmsg_chrdev_eptdev_destroy(), this should be the same as rpmsg_eptdev_release(). Otherwise there will be double destroy issue that ept->refcount report warning: refcount_t: underflow; use-after-free. Call trace: refcount_warn_saturate+0xf8/0x150 virtio_rpmsg_destroy_ept+0xd4/0xec rpmsg_dev_remove+0x60/0x70 The issue can be reproduced by stopping remoteproc before closing the /dev/rpmsgX. Fixes: bea9b79c2d10 ("rpmsg: char: Add possibility to use default endpoint of the rpmsg device") Signed-off-by: Shengjiu Wang Reviewed-by: Arnaud Pouliquen Reviewed-by: Peng Fan Cc: stable Link: https://lore.kernel.org/r/1663725523-6514-1-git-send-email-shengjiu.wang@nxp.com Signed-off-by: Mathieu Poirier Signed-off-by: Greg Kroah-Hartman --- drivers/rpmsg/rpmsg_char.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/rpmsg/rpmsg_char.c +++ b/drivers/rpmsg/rpmsg_char.c @@ -76,7 +76,9 @@ int rpmsg_chrdev_eptdev_destroy(struct d mutex_lock(&eptdev->ept_lock); if (eptdev->ept) { - rpmsg_destroy_ept(eptdev->ept); + /* The default endpoint is released by the rpmsg core */ + if (!eptdev->default_ept) + rpmsg_destroy_ept(eptdev->ept); eptdev->ept = NULL; } mutex_unlock(&eptdev->ept_lock); From patchwork Wed Oct 19 08:24: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: 5496 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp335836wrs; Wed, 19 Oct 2022 06:45:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4dkvyufilQlkrLP8RP31Aak3qzK9d8E4eEQc8bufbQgbDTyvn5ETUtCD6z/+qo2nAsOfCe X-Received: by 2002:a17:90a:5996:b0:203:1640:2dbf with SMTP id l22-20020a17090a599600b0020316402dbfmr10145225pji.150.1666187152085; Wed, 19 Oct 2022 06:45:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666187152; cv=none; d=google.com; s=arc-20160816; b=iN/b6D8kXAnrgubL5mzobzBxHIDOLCQXHH46Pamgikdzw68P6YBNKCo6sCULbed0yT ntDsSmwCqR9Uv/vnIOTXPG7/7tXyiPuhrewu6zw6TTuQozgBRbjSoM1rzjcetY3upoa6 c37z14x6eTCyqvhsY3eCokpPDjAevaqdzZOX7oJM/19zx3QRfwx8gSyaXxzEH3oWTKwU CAOwjtrpWOoWzL/etd9farZr+IdmDLWSlqvV+1ulMuP4Guc0aeOHXPuKGnafjPpIpYRL UIcH9NlUa2YMWWSJ5pLjbwLHj9gJrmmxbtJgXTeEJyGmQcVeTEEIoGK8b+Ey5WLeXqMe 4s6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=v8BZDgM5Dda/4fKZbdmzfc5HidKRCAvgHoZLAyD7jO8=; b=oCSAOsNRJq8ROD7TmruSt7tOw4P+U2X6hK0hpoozEKDaOyrVOHfXM5vAtqMiqdftb9 bl7rio8Bm0RvinJbhd6WVZIDb2wNlSnfQUmgxpaJ1G3hQ6Vca29S/2ESJ/2+JDRA+ZQC ziSnxHbr7Q1MmZ0cLTIcwyCkynMdBCZ3XQ8WZJ+6MGUHyuopTuOw4XJSOcRkyCVcP6PI QQ5N0sKNbPqBMhGJKTtqgMwx/3NvgyTz6D/k+2SjR0bpqPNT01ATalmFWmWaR0mUSl2c QQA4qftiNnl1WYPjQFjaecRnDJIZ+axBTY3GjLlV8qq3psmqJkNuPDjH+C6VVj5/px/F M8ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zVrRwAcO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cm9-20020a056a00338900b0056771c032f4si2390920pfb.28.2022.10.19.06.45.38; Wed, 19 Oct 2022 06:45: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=zVrRwAcO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232774AbiJSNou (ORCPT + 99 others); Wed, 19 Oct 2022 09:44:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233357AbiJSNoH (ORCPT ); Wed, 19 Oct 2022 09:44: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 E68DE190E4B; Wed, 19 Oct 2022 06:31: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 sin.source.kernel.org (Postfix) with ESMTPS id 0575DCE20F3; Wed, 19 Oct 2022 08:45:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D59E8C433C1; Wed, 19 Oct 2022 08:45:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169125; bh=VsHfEoKbv7JG9yIQgzXgn8pAdXnQ/kuR9cBjswx8aXY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zVrRwAcOmI2UWTgg2JqQRCI1h6mH5jaRiG5IW3ZOwYExq6pstzaFW5oGdWlHMg2/q YtewrWIhdiFo7yh770wJCYgOBWiAOJJnmZPWU+obpiaO8RIHeHsjkVudRujF+1NTEZ hKctpHBn7Rlto5W65riqYg0QKXcVc3gl3HnKBowM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mario Limonciello , Mika Westerberg Subject: [PATCH 6.0 167/862] thunderbolt: Explicitly enable lane adapter hotplug events at startup Date: Wed, 19 Oct 2022 10:24:14 +0200 Message-Id: <20221019083257.351031624@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123859316232604?= X-GMAIL-MSGID: =?utf-8?q?1747123859316232604?= From: Mario Limonciello commit 5d2569cb4a65c373896ec0217febdf88739ed295 upstream. Software that has run before the USB4 CM in Linux runs may have disabled hotplug events for a given lane adapter. Other CMs such as that one distributed with Windows 11 will enable hotplug events. Do the same thing in the Linux CM which fixes hotplug events on "AMD Pink Sardine". Cc: stable@vger.kernel.org Signed-off-by: Mario Limonciello Signed-off-by: Mika Westerberg Signed-off-by: Greg Kroah-Hartman --- drivers/thunderbolt/switch.c | 24 ++++++++++++++++++++++++ drivers/thunderbolt/tb.h | 1 + drivers/thunderbolt/tb_regs.h | 1 + drivers/thunderbolt/usb4.c | 20 ++++++++++++++++++++ 4 files changed, 46 insertions(+) --- a/drivers/thunderbolt/switch.c +++ b/drivers/thunderbolt/switch.c @@ -2822,6 +2822,26 @@ static void tb_switch_credits_init(struc tb_sw_info(sw, "failed to determine preferred buffer allocation, using defaults\n"); } +static int tb_switch_port_hotplug_enable(struct tb_switch *sw) +{ + struct tb_port *port; + + if (tb_switch_is_icm(sw)) + return 0; + + tb_switch_for_each_port(sw, port) { + int res; + + if (!port->cap_usb4) + continue; + + res = usb4_port_hotplug_enable(port); + if (res) + return res; + } + return 0; +} + /** * tb_switch_add() - Add a switch to the domain * @sw: Switch to add @@ -2891,6 +2911,10 @@ int tb_switch_add(struct tb_switch *sw) return ret; } + ret = tb_switch_port_hotplug_enable(sw); + if (ret) + return ret; + ret = device_add(&sw->dev); if (ret) { dev_err(&sw->dev, "failed to add device: %d\n", ret); --- a/drivers/thunderbolt/tb.h +++ b/drivers/thunderbolt/tb.h @@ -1174,6 +1174,7 @@ int usb4_switch_add_ports(struct tb_swit void usb4_switch_remove_ports(struct tb_switch *sw); int usb4_port_unlock(struct tb_port *port); +int usb4_port_hotplug_enable(struct tb_port *port); int usb4_port_configure(struct tb_port *port); void usb4_port_unconfigure(struct tb_port *port); int usb4_port_configure_xdomain(struct tb_port *port); --- a/drivers/thunderbolt/tb_regs.h +++ b/drivers/thunderbolt/tb_regs.h @@ -308,6 +308,7 @@ struct tb_regs_port_header { #define ADP_CS_5 0x05 #define ADP_CS_5_LCA_MASK GENMASK(28, 22) #define ADP_CS_5_LCA_SHIFT 22 +#define ADP_CS_5_DHP BIT(31) /* TMU adapter registers */ #define TMU_ADP_CS_3 0x03 --- a/drivers/thunderbolt/usb4.c +++ b/drivers/thunderbolt/usb4.c @@ -1046,6 +1046,26 @@ int usb4_port_unlock(struct tb_port *por return tb_port_write(port, &val, TB_CFG_PORT, ADP_CS_4, 1); } +/** + * usb4_port_hotplug_enable() - Enables hotplug for a port + * @port: USB4 port to operate on + * + * Enables hot plug events on a given port. This is only intended + * to be used on lane, DP-IN, and DP-OUT adapters. + */ +int usb4_port_hotplug_enable(struct tb_port *port) +{ + int ret; + u32 val; + + ret = tb_port_read(port, &val, TB_CFG_PORT, ADP_CS_5, 1); + if (ret) + return ret; + + val &= ~ADP_CS_5_DHP; + return tb_port_write(port, &val, TB_CFG_PORT, ADP_CS_5, 1); +} + static int usb4_port_set_configured(struct tb_port *port, bool configured) { int ret; From patchwork Wed Oct 19 08:24: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: 4653 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212507wrs; Wed, 19 Oct 2022 02:07:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Ko4kQkebhEmoPNz3QlHEkjhqWwguk4XEx+NwOSLDNuTWf/KIdWlOBaNrCGGlEuqZReraS X-Received: by 2002:aa7:d848:0:b0:458:9ccc:f605 with SMTP id f8-20020aa7d848000000b004589cccf605mr6520704eds.68.1666170460494; Wed, 19 Oct 2022 02:07:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170460; cv=none; d=google.com; s=arc-20160816; b=dajR0uSqbGyBozNiUdTRACY8HgVG66wht1MJJwCgBsZ620EUjL638un1bLAH4YgXSX U7XIDec3Up9vkdUnh4M4Dle04cVsgNDOYv6L5dsA41G4wsjN5qCaxY+HKezv7PHi/CjM rRoVSTP80ayLOeD2vywiE8pqW3q0QDiUlRNaaMKflAM3ZLe6M6QnDONYKXk7lAxkQQlP RmhJqd5ZVr57xUYX5TmT7hhItKZyqQdhWdy7woXbsFi/hiZFY2z54BKIMbPmPZjHGtbR V5tJR18LRCV2pwF4oarO8NzeCWy35O2uebLVwo+BJ37Q2nuC39odAAsBQek448VJqpai 2EZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=s2gKcQ/IDsP1dabzlcd7EszbvivbP0MKCvj4h22jt40=; b=VJk54tEgkhBO8EKdA8fwgwbRvtYzSGYqn9mzZfoi0fdSIEtXdKr3nBfLpjhziFDm9z 3d5Q/7Z2yB+hSeLY1uR1LQqw0RVwejOZHKlpOdbJQB9S0emYL8eluylVdcWw4YXCUOFt E5/H4wSwn2YvX/aEXTTBw/pw4PkAKtLfqk2nf+BqnqD7g6J+W6RX2gei2C3E4PyCx+HZ s9LKf2YjWSSlohJYRiKGZNlwBoKPfI1KPnIpWIYYjFzVjXXfydcSc7HHqR2PYzJ1G1GY D7C2JU708CsBklp29X7ydrd/C25C53WFbFvY8jRLB2DHZMhPtrlJuVmKkgCjeiaKa5DO V5Ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=07tpGFe2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a1709066a0500b00780a240cfd7si14019416ejc.493.2022.10.19.02.07.10; Wed, 19 Oct 2022 02:07: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=07tpGFe2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232067AbiJSJAY (ORCPT + 99 others); Wed, 19 Oct 2022 05:00:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232021AbiJSI6k (ORCPT ); Wed, 19 Oct 2022 04:58: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 153659F74F; Wed, 19 Oct 2022 01:53: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 DA1CB61802; Wed, 19 Oct 2022 08:45:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6A2DC433C1; Wed, 19 Oct 2022 08:45:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169128; bh=nFCeWBlb71nzHFatGST1sfWN1nDJByc2HnNY5OXQHfM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=07tpGFe20hPORzdq9D+fBgsK5aaEVYefOAz6m6nVwAPurmYp0rupY4sykNimn4OLG elB4nC9oX+hH6nMbbrC8Qyco6Vu/qr9uNriVmjSHU5dP3NbXRW5XMOPzJMNJmCpMuS nVgQEpu0SksbTBcJDnPSq8b8OC+MK6DCXZeCajao= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ard Biesheuvel Subject: [PATCH 6.0 168/862] efi: libstub: drop pointless get_memory_map() call Date: Wed, 19 Oct 2022 10:24:15 +0200 Message-Id: <20221019083257.389965292@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106356723479059?= X-GMAIL-MSGID: =?utf-8?q?1747106356723479059?= From: Ard Biesheuvel commit d80ca810f096ff66f451e7a3ed2f0cd9ef1ff519 upstream. Currently, the non-x86 stub code calls get_memory_map() redundantly, given that the data it returns is never used anywhere. So drop the call. Cc: # v4.14+ Fixes: 24d7c494ce46 ("efi/arm-stub: Round up FDT allocation to mapping size") Signed-off-by: Ard Biesheuvel Signed-off-by: Greg Kroah-Hartman --- drivers/firmware/efi/libstub/fdt.c | 8 -------- 1 file changed, 8 deletions(-) --- a/drivers/firmware/efi/libstub/fdt.c +++ b/drivers/firmware/efi/libstub/fdt.c @@ -280,14 +280,6 @@ efi_status_t allocate_new_fdt_and_exit_b goto fail; } - /* - * Now that we have done our final memory allocation (and free) - * we can get the memory map key needed for exit_boot_services(). - */ - status = efi_get_memory_map(&map); - if (status != EFI_SUCCESS) - goto fail_free_new_fdt; - status = update_fdt((void *)fdt_addr, fdt_size, (void *)*new_fdt_addr, MAX_FDT_SIZE, cmdline_ptr, initrd_addr, initrd_size); From patchwork Wed Oct 19 08:24: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: 4578 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp205332wrs; Wed, 19 Oct 2022 01:49:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5baaytUGpCPZv3iAryTESfTZhfSUFRWgipAB7+kZd+ZAmY82fkIPwjn3Fmaksd74HGJ5JN X-Received: by 2002:a17:90b:254e:b0:20b:7e26:f0a0 with SMTP id nw14-20020a17090b254e00b0020b7e26f0a0mr42635561pjb.203.1666169335068; Wed, 19 Oct 2022 01:48:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169335; cv=none; d=google.com; s=arc-20160816; b=rLpDXMPDFu/7SUQdqLHRus233o2QuTQN7l1/HvBvc/DW5MJfSZtwvQ6xskcjaq3f94 LpUc3ql6x6Nws+8wRbLNWF/iYweQmoeSp5i3vR7XPM+Ad/if6FhuMkh/4/cdWHOsSrav CM+ZSDy6Gv+XDGNtRewqMjvjeRFsRRX9hQwfZg49vjcssz8y43ahWeeUn/WMS2NGWKhL WT2b/NBEi7OU0HdpQPfGk7fJNfxy9vDr6OApKfxqHaL1i420MRGYSIgFQHj/IgygOD+q HZU80l9DO2wiogT0RSITtBbBWuTJjbZJqCAqUUbMQEGbx7NVmcKUEhVji6DcRdqHy8LW f/QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5HJ9K8RFmhj0Ub/H6DfbEpPoiXc7amWvruTFHoNltB4=; b=AIUr8S86MFiqCTTZGRJaLuIepv7eRDd42jJDECSJctpIWgQoKrOwvbWxv3aGRRbCM+ zn3As8fZZFGg7UsBiQQtJbIxIzcBzjWSnZ+QHR31VY+HraD4SDrsw0oNHpt9c9nNxYHF HO28NpdmE12JnIW+CltQCG0A4p2ahZqD0iEEG4QmFjONXVJSwxW8PsMYKiyxyWQETRYE RUL/M3AB9lZd2ol90kd9d5dFceaZo4JUr0QCUJAadd/MvyShLN9DsXfYWgXGWA+ljQe+ zRtZuI3q+y68QwT3xB/1YvQml+5QmZmMc0p7roXIlkEthGBG2jRC/vq/noeH7RGP/ES3 oMpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ablIAMPg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v10-20020a1709028d8a00b00183e8a29776si16919198plo.36.2022.10.19.01.48.42; Wed, 19 Oct 2022 01:48: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=ablIAMPg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231603AbiJSIsN (ORCPT + 99 others); Wed, 19 Oct 2022 04:48:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231574AbiJSIrm (ORCPT ); Wed, 19 Oct 2022 04:47: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 0112850076; Wed, 19 Oct 2022 01: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 dfw.source.kernel.org (Postfix) with ESMTPS id B5609617FF; Wed, 19 Oct 2022 08:45:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5D00C433C1; Wed, 19 Oct 2022 08:45:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169131; bh=UdFH1/iFHJDIGa6c18khrKEDVJy6r7SQUPt5r5yMBp8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ablIAMPgWGg2k0RHRUCDJ0OevthxyWuzir4gJyvFxrtDVOKdTlYs39ebfZWKyKZhR DwUzTLec6TMbRWpEShQXvCT1JcBY5s3hQ5Qfx/5bc1m05M47I+yuP09SM3/GBFwg+D JYap1TuRvfGILVveYJhhIf6l4YAp68xi7EwbiPoc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicolas Dufresne , Paul Kocialkowski , Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 6.0 169/862] media: cedrus: Fix watchdog race condition Date: Wed, 19 Oct 2022 10:24:16 +0200 Message-Id: <20221019083257.420769331@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105176469959950?= X-GMAIL-MSGID: =?utf-8?q?1747105176469959950?= From: Nicolas Dufresne commit fe8b81fde69acfcbb5af9e85328e5b9549999fdb upstream. The watchdog needs to be scheduled before we trigger the decode operation, otherwise there is a risk that the decoder IRQ will be called before we have schedule the watchdog. As a side effect, the watchdog would never be cancelled and its function would be called at an inappropriate time. This was observed while running Fluster with GStreamer as a backend. Some programming error would cause the decoder IRQ to be call very quickly after the trigger. Later calls into the driver would deadlock due to the unbalanced state. Cc: stable@vger.kernel.org Fixes: 7c38a551bda1 ("media: cedrus: Add watchdog for job completion") Signed-off-by: Nicolas Dufresne Reviewed-by: Paul Kocialkowski Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/staging/media/sunxi/cedrus/cedrus_dec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/staging/media/sunxi/cedrus/cedrus_dec.c +++ b/drivers/staging/media/sunxi/cedrus/cedrus_dec.c @@ -106,11 +106,11 @@ void cedrus_device_run(void *priv) /* Trigger decoding if setup went well, bail out otherwise. */ if (!error) { - dev->dec_ops[ctx->current_codec]->trigger(ctx); - /* Start the watchdog timer. */ schedule_delayed_work(&dev->watchdog_work, msecs_to_jiffies(2000)); + + dev->dec_ops[ctx->current_codec]->trigger(ctx); } else { v4l2_m2m_buf_done_and_job_finish(ctx->dev->m2m_dev, ctx->fh.m2m_ctx, From patchwork Wed Oct 19 08:24: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: 5361 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp299341wrs; Wed, 19 Oct 2022 05:32:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM49KSn78Kg4/R8nTJ2h2eILMqa+esm8AtDFSbvjG136DF1mzgYmmL/+dsA0rhU9qV4j2RSr X-Received: by 2002:a17:906:591:b0:73d:c3ef:84ae with SMTP id 17-20020a170906059100b0073dc3ef84aemr6564178ejn.155.1666182724319; Wed, 19 Oct 2022 05:32:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666182724; cv=none; d=google.com; s=arc-20160816; b=eR+SwkT4JWYAuVc31rQ3x4ZFVNWFEao+pqN5P9uUh761owV0GG1ZP+LHrgAvKXeBko xmAnDUijPrbu82W/jCgNctbydj+H6EPIQOki0REyrAWeWdgOu515+eHTVgT/asI16E+H o8OSyQSB+HfF0ceH3NmCh+7o4AQSCaUoebZOCXM/jBoWYpuMCah4DcolZnaagc/wpqvp NnBfhvkIkTxBwcoVZyFABijL0neZrvdDMr276O3gDYXsnepCGpx86jPI64WFjHFEXX+a h90K7IbZicumkKuzi0hksKDx0SyxhIFZNvzeznfzq7KW1odQKU9YKsSpi6/LCzFlUSeC ABSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=325R1WyLc+2+qwvhPvkdzq9eWRT25C6jz+lGv98ZAHk=; b=o5Xp0WeV2zGTq4KHfGOb5WgNp7QLak1ejyroV8ghVYBuJzMQhaOcSzkFZaQE5oJxyO UiTsi1zJUeGtXtabGFvF9GqG7wVmhJQY9xpo4aShYtLtj4OQmsD2lmQfiTOVrurf55lS U+Z8Z9gMYn2ZPf+nksR0u8tHE4SZwx5NspPlDPBtE4IIOyKrbUQgZryE2Sdz+gNvjTZX n4EG8qjk/N0Pk14qyTnV/qFDgI+8vGf27dJbL2S8/TMru4xoEBC2hjrnmtJc48yPeZAH 34FGidcpWFmwXJfx5C1fAY4KgzTNHVvqAEl8dcz6MB26gvupvIhLOPHEyCdOw3i7WVNN ZO4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PijNbsh6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l11-20020a056402254b00b0045d4b7ad162si11873562edb.546.2022.10.19.05.31.38; Wed, 19 Oct 2022 05:32: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=PijNbsh6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232068AbiJSMTz (ORCPT + 99 others); Wed, 19 Oct 2022 08:19:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233121AbiJSMTE (ORCPT ); Wed, 19 Oct 2022 08:19:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B60BE1D67C; Wed, 19 Oct 2022 04:54: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 3A516B82312; Wed, 19 Oct 2022 08:45:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8CBEDC433D6; Wed, 19 Oct 2022 08:45:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169136; bh=jg4ohn3/1jVyZ03iJkHbsTt2BOLdGqdLWdeUndyq9E0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PijNbsh6PjC6zD3jcv433tEkVqMZfLab3Fs2Azw8esvOkVJIvwZb82ByyIvVvxn+I TD87vMS0Y1JItZzxq4VkCXP2V5xelM0j3bIi0q9/KNLrlVSsrVUx8pdMC0waxLz7OU iFdoNeeSxeE/Dc9TDm3pLs2hpRZyDmsS6j03+IJY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Osipenko , Nicolas Dufresne , Samuel Holland , Paul Kocialkowski , Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 6.0 170/862] media: cedrus: Set the platform driver data earlier Date: Wed, 19 Oct 2022 10:24:17 +0200 Message-Id: <20221019083257.464093108@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747119216327018749?= X-GMAIL-MSGID: =?utf-8?q?1747119216327018749?= From: Dmitry Osipenko commit 708938f8495147fe2e77a9a3e1015d8e6899323e upstream. The cedrus_hw_resume() crashes with NULL deference on driver probe if runtime PM is disabled because it uses platform data that hasn't been set up yet. Fix this by setting the platform data earlier during probe. Cc: stable@vger.kernel.org Fixes: 50e761516f2b (media: platform: Add Cedrus VPU decoder driver) Signed-off-by: Dmitry Osipenko Signed-off-by: Nicolas Dufresne Reviewed-by: Samuel Holland Acked-by: Paul Kocialkowski Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/staging/media/sunxi/cedrus/cedrus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/staging/media/sunxi/cedrus/cedrus.c +++ b/drivers/staging/media/sunxi/cedrus/cedrus.c @@ -448,6 +448,8 @@ static int cedrus_probe(struct platform_ if (!dev) return -ENOMEM; + platform_set_drvdata(pdev, dev); + dev->vfd = cedrus_video_device; dev->dev = &pdev->dev; dev->pdev = pdev; @@ -521,8 +523,6 @@ static int cedrus_probe(struct platform_ goto err_m2m_mc; } - platform_set_drvdata(pdev, dev); - return 0; err_m2m_mc: From patchwork Wed Oct 19 08:24: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: 5364 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp299469wrs; Wed, 19 Oct 2022 05:32:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4d/EtXSkhoSWa7MgETIRTUTdKj2uIH0zxsMVsydDBdZh+/8aJsdZa5pTRsc/B05RIvkDoy X-Received: by 2002:a17:907:2d1e:b0:78e:2c3b:559f with SMTP id gs30-20020a1709072d1e00b0078e2c3b559fmr6484796ejc.435.1666182736788; Wed, 19 Oct 2022 05:32:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666182736; cv=none; d=google.com; s=arc-20160816; b=bA8mwJHSodSfBaYNbSTiHqzbuEn+yK8LvR0EOUUERk+htTocgpmjDyfbtEok38C8gD KZknWDRb4+df0ISrhtd04DBHvVuA1GfV3wPz1j/Fl86OvO8Bt6SlsHy4neytZEWUMp3B 3qkzvxJ8uQhJ8zjlChUg9+GhbC1frw0GfYCK7XrQWV82pP0HqallaIKMcB0wdDGcVTcD de97m9+bIQJN0ZNP9O43I7GAUwiYGt4c7BhCxeENRxYhyTtft5EosRo3dcqkvDXKaBch fWAlq+/W+m/ArrY8qFZXOdx9hcZClmSwvIPPwVR79HQI6hEt1BwjsTcaqKDP/MJntj72 xNCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9NV/ihc0Uh1gmyJpr61Y3yKDSmVXX5AfKL+sPrj3NMw=; b=tvEHuQWPIuW9Nq3vsXE1b4aw0kY5846+jpzHcDP1amkxlfUHKaZQ/8MDsEqFz+1HL1 X/ZL5TMzBkwdm2OoDwprE8JY14PJ1eND0ARLDL8l216o8/UDmrQ87iam8ACAlVCU8+QJ Z+MAS1BJMD2SgJRmBgZKrz2Y6hraIeGX82gBwP30sAY0zFHMah2ir5iRbc1dhYLx5l0C b7cTraT6K6CUiwmgDTn5EE5XqBCrpWml5JF73l5Bl7238ydTAzH705JnERGknhQEF83h HXgvkJMUoj7ozAbhT1k/geLFEfPZs3pV19klSSvCBkIMIjHuU3Liusd1QTNAWJQuZD0x Aegg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=o2fbsTdA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sh37-20020a1709076ea500b0078d9d69ae0dsi14639485ejc.877.2022.10.19.05.31.51; Wed, 19 Oct 2022 05:32: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=o2fbsTdA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232936AbiJSMTT (ORCPT + 99 others); Wed, 19 Oct 2022 08:19:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230212AbiJSMSJ (ORCPT ); Wed, 19 Oct 2022 08:18: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 BC0241C39FD; Wed, 19 Oct 2022 04:53: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 1426DB82302; Wed, 19 Oct 2022 08:45:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 644D2C433D6; Wed, 19 Oct 2022 08:45:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169139; bh=BMhRM4nqWbjmRpKYBjSHNb+WOA6zO/H96SN3tqK7YGs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o2fbsTdAZk++D9xaC03zryvlU8OXNJq8uB04IWie8HT/hLHhwXonxmVYmkr7WjC0R GRy31cxABzwqu1XpBfA9y9NAqb0FHRv1/0H6FpvDxAJJia2Zn8CBoWs546pxOFIkSU 4Kfh2zJ8ZrQ8So3w0b/tMzNnUoUsU/FD1eFlx2Zg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicolas Dufresne , Dmitry Osipenko , Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 6.0 171/862] media: cedrus: Fix endless loop in cedrus_h265_skip_bits() Date: Wed, 19 Oct 2022 10:24:18 +0200 Message-Id: <20221019083257.513939871@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747119229183059636?= X-GMAIL-MSGID: =?utf-8?q?1747119229183059636?= From: Dmitry Osipenko commit 91db7a3fc7fe670cf1770a398a43bb4a1f776bf1 upstream. The busy status bit may never de-assert if number of programmed skip bits is incorrect, resulting in a kernel hang because the bit is polled endlessly in the code. Fix it by adding timeout for the bit-polling. This problem is reproducible by setting the data_bit_offset field of the HEVC slice params to a wrong value by userspace. Cc: stable@vger.kernel.org Fixes: 7678c5462680 (media: cedrus: Fix decoding for some HEVC videos) Reported-by: Nicolas Dufresne Signed-off-by: Dmitry Osipenko Signed-off-by: Nicolas Dufresne Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/staging/media/sunxi/cedrus/cedrus_h265.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/drivers/staging/media/sunxi/cedrus/cedrus_h265.c +++ b/drivers/staging/media/sunxi/cedrus/cedrus_h265.c @@ -234,8 +234,9 @@ static void cedrus_h265_skip_bits(struct cedrus_write(dev, VE_DEC_H265_TRIGGER, VE_DEC_H265_TRIGGER_FLUSH_BITS | VE_DEC_H265_TRIGGER_TYPE_N_BITS(tmp)); - while (cedrus_read(dev, VE_DEC_H265_STATUS) & VE_DEC_H265_STATUS_VLD_BUSY) - udelay(1); + + if (cedrus_wait_for(dev, VE_DEC_H265_STATUS, VE_DEC_H265_STATUS_VLD_BUSY)) + dev_err_ratelimited(dev->dev, "timed out waiting to skip bits\n"); count += tmp; } From patchwork Wed Oct 19 08:24: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: 4610 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp211722wrs; Wed, 19 Oct 2022 02:05:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM443XU0tTLlwBpY9qOGBQFvuVUSTJoGvPv0ckLVPb9qyQnXEqrramEVVhbbqQHHPg8XfjEr X-Received: by 2002:a05:6402:50d4:b0:45d:fe2:45 with SMTP id h20-20020a05640250d400b0045d0fe20045mr6598645edb.221.1666170342433; Wed, 19 Oct 2022 02:05:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170342; cv=none; d=google.com; s=arc-20160816; b=KNRu8qEKlvahohIPOyqVtQ+KnGRB38FXlZ2sA5q4dxJdfQW8hJ8M7Ac9SvEh1aCHW+ CbnQlEOf9XUFKEjjIaNqCVs+n5NQam9ohEXyuEQQV26T7gbhPNKZiN3wwEgugL0PifeO 43wEE+LWzmgJa7f8ScbH6RdS+GiVz0bhh8kTmYJtcj28QxTE+uYYXAKdA5Poulbjop1Q ejZSsC4E9zP9Ncx7qgiZyrpR7JnlJTTge420doHdDzBAzeVqlodarJwqFpxjT/+SfETN U9Ws6t9+gw3yXHA6bCBLrwVO3pTL6gvYh8x3U9ieBFdk3krxrXLvCjMOjyF2//QRq/4s goQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=47SfqCYvJepViU/jDHnWOZFg9np35PrU5jhh2ncxje8=; b=OV6Q57cw6zm3rvql2cxXpXJFCqMPEUKx9UJmpp70YkcLZGewetKch086M+dGsvQq3W ukJjcvMpmwsNmhoxcwdWoQRXcd05SRczhZvFlY/YPstJcVNxrZQ24oIVCLHkyl+goWpm IR0msO9ovznUW7euDZtlUet9vEIbzS2luJ/FNctmqIgDS5Fo5pcOSU1FHx//6xK1XxJm SZxtpIDXAO1i0o5mHsXoggw4XoJqyMIsaizC/P2/3lAilAMk8olilDYrvQB/GGX1GDlu /fEvQA3Bh5etW5uj/bipFkei3fMrUMtHxM+07R+xqFzqwJ+vzLYiDuTC7MOe+OQ7aKls iDGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vsbocnfZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sh40-20020a1709076ea800b0078d288c1047si14275780ejc.841.2022.10.19.02.05.10; Wed, 19 Oct 2022 02:05: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=vsbocnfZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231802AbiJSIwp (ORCPT + 99 others); Wed, 19 Oct 2022 04:52:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231732AbiJSIv4 (ORCPT ); Wed, 19 Oct 2022 04:51:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FC4A356F0; Wed, 19 Oct 2022 01:49:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 354F1617AC; Wed, 19 Oct 2022 08:45:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 481E1C4314B; Wed, 19 Oct 2022 08:45:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169142; bh=eTm2tQYudnP33eOiybmEdxUCHw0GwdKEd4AwcgpiHt0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vsbocnfZZMGRB76WRKfqGIoxUcep8VO0yOFTNdlJzqXF5fxj4q6VFueOAmmSJaTL7 EyKPjRGvgifqLwQUAXgRthnAXBtTWR4eGYg/vCeLKoSBDpDgd4NQm4UnxUSOR1ynff esuwT2ZQTLdOkuMB5t2SquM8qh3sMIG+xoyiVTO4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yu Kuai , Tejun Heo , Jens Axboe Subject: [PATCH 6.0 172/862] blk-throttle: fix that io throttle can only work for single bio Date: Wed, 19 Oct 2022 10:24:19 +0200 Message-Id: <20221019083257.555670944@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106233378176639?= X-GMAIL-MSGID: =?utf-8?q?1747106233378176639?= From: Yu Kuai commit 320fb0f91e55ba248d4bad106b408e59099cfa89 upstream. Test scripts: cd /sys/fs/cgroup/blkio/ echo "8:0 1024" > blkio.throttle.write_bps_device echo $$ > cgroup.procs dd if=/dev/zero of=/dev/sda bs=10k count=1 oflag=direct & dd if=/dev/zero of=/dev/sda bs=10k count=1 oflag=direct & Test result: 10240 bytes (10 kB, 10 KiB) copied, 10.0134 s, 1.0 kB/s 10240 bytes (10 kB, 10 KiB) copied, 10.0135 s, 1.0 kB/s The problem is that the second bio is finished after 10s instead of 20s. Root cause: 1) second bio will be flagged: __blk_throtl_bio while (true) { ... if (sq->nr_queued[rw]) -> some bio is throttled already break }; bio_set_flag(bio, BIO_THROTTLED); -> flag the bio 2) flagged bio will be dispatched without waiting: throtl_dispatch_tg tg_may_dispatch tg_with_in_bps_limit if (bps_limit == U64_MAX || bio_flagged(bio, BIO_THROTTLED)) *wait = 0; -> wait time is zero return true; commit 9f5ede3c01f9 ("block: throttle split bio in case of iops limit") support to count split bios for iops limit, thus it adds flagged bio checking in tg_with_in_bps_limit() so that split bios will only count once for bps limit, however, it introduce a new problem that io throttle won't work if multiple bios are throttled. In order to fix the problem, handle iops/bps limit in different ways: 1) for iops limit, there is no flag to record if the bio is throttled, and iops is always applied. 2) for bps limit, original bio will be flagged with BIO_BPS_THROTTLED, and io throttle will ignore bio with the flag. Noted this patch also remove the code to set flag in __bio_clone(), it's introduced in commit 111be8839817 ("block-throttle: avoid double charge"), and author thinks split bio can be resubmited and throttled again, which is wrong because split bio will continue to dispatch from caller. Fixes: 9f5ede3c01f9 ("block: throttle split bio in case of iops limit") Cc: Signed-off-by: Yu Kuai Acked-by: Tejun Heo Link: https://lore.kernel.org/r/20220829022240.3348319-2-yukuai1@huaweicloud.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- block/bio.c | 2 -- block/blk-throttle.c | 20 ++++++-------------- block/blk-throttle.h | 2 +- include/linux/bio.h | 2 +- include/linux/blk_types.h | 2 +- 5 files changed, 9 insertions(+), 19 deletions(-) --- a/block/bio.c +++ b/block/bio.c @@ -760,8 +760,6 @@ EXPORT_SYMBOL(bio_put); static int __bio_clone(struct bio *bio, struct bio *bio_src, gfp_t gfp) { bio_set_flag(bio, BIO_CLONED); - if (bio_flagged(bio_src, BIO_THROTTLED)) - bio_set_flag(bio, BIO_THROTTLED); bio->bi_ioprio = bio_src->bi_ioprio; bio->bi_iter = bio_src->bi_iter; --- a/block/blk-throttle.c +++ b/block/blk-throttle.c @@ -811,7 +811,7 @@ static bool tg_with_in_bps_limit(struct unsigned int bio_size = throtl_bio_data_size(bio); /* no need to throttle if this bio's bytes have been accounted */ - if (bps_limit == U64_MAX || bio_flagged(bio, BIO_THROTTLED)) { + if (bps_limit == U64_MAX || bio_flagged(bio, BIO_BPS_THROTTLED)) { if (wait) *wait = 0; return true; @@ -921,22 +921,13 @@ static void throtl_charge_bio(struct thr unsigned int bio_size = throtl_bio_data_size(bio); /* Charge the bio to the group */ - if (!bio_flagged(bio, BIO_THROTTLED)) { + if (!bio_flagged(bio, BIO_BPS_THROTTLED)) { tg->bytes_disp[rw] += bio_size; tg->last_bytes_disp[rw] += bio_size; } tg->io_disp[rw]++; tg->last_io_disp[rw]++; - - /* - * BIO_THROTTLED is used to prevent the same bio to be throttled - * more than once as a throttled bio will go through blk-throtl the - * second time when it eventually gets issued. Set it when a bio - * is being charged to a tg. - */ - if (!bio_flagged(bio, BIO_THROTTLED)) - bio_set_flag(bio, BIO_THROTTLED); } /** @@ -1026,6 +1017,7 @@ static void tg_dispatch_one_bio(struct t sq->nr_queued[rw]--; throtl_charge_bio(tg, bio); + bio_set_flag(bio, BIO_BPS_THROTTLED); /* * If our parent is another tg, we just need to transfer @bio to @@ -2159,8 +2151,10 @@ again: qn = &tg->qnode_on_parent[rw]; sq = sq->parent_sq; tg = sq_to_tg(sq); - if (!tg) + if (!tg) { + bio_set_flag(bio, BIO_BPS_THROTTLED); goto out_unlock; + } } /* out-of-limit, queue to @tg */ @@ -2189,8 +2183,6 @@ again: } out_unlock: - bio_set_flag(bio, BIO_THROTTLED); - #ifdef CONFIG_BLK_DEV_THROTTLING_LOW if (throttled || !td->track_bio_latency) bio->bi_issue.value |= BIO_ISSUE_THROTL_SKIP_LATENCY; --- a/block/blk-throttle.h +++ b/block/blk-throttle.h @@ -175,7 +175,7 @@ static inline bool blk_throtl_bio(struct struct throtl_grp *tg = blkg_to_tg(bio->bi_blkg); /* no need to throttle bps any more if the bio has been throttled */ - if (bio_flagged(bio, BIO_THROTTLED) && + if (bio_flagged(bio, BIO_BPS_THROTTLED) && !(tg->flags & THROTL_TG_HAS_IOPS_LIMIT)) return false; --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -509,7 +509,7 @@ static inline void bio_set_dev(struct bi { bio_clear_flag(bio, BIO_REMAPPED); if (bio->bi_bdev != bdev) - bio_clear_flag(bio, BIO_THROTTLED); + bio_clear_flag(bio, BIO_BPS_THROTTLED); bio->bi_bdev = bdev; bio_associate_blkg(bio); } --- a/include/linux/blk_types.h +++ b/include/linux/blk_types.h @@ -325,7 +325,7 @@ enum { BIO_QUIET, /* Make BIO Quiet */ BIO_CHAIN, /* chained bio, ->bi_remaining in effect */ BIO_REFFED, /* bio has elevated ->bi_cnt */ - BIO_THROTTLED, /* This bio has already been subjected to + BIO_BPS_THROTTLED, /* This bio has already been subjected to * throttling rules. Don't do it again. */ BIO_TRACE_COMPLETION, /* bio_endio() should trace the final completion * of this bio. */ From patchwork Wed Oct 19 08:24:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5353 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp296971wrs; Wed, 19 Oct 2022 05:28:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6bnpIGyYDVMufkCiiiONINlHm+s6Ip3kPa/zfVgDtqMFvQwaCgyYJ4kIaziHy6xFLhfYT5 X-Received: by 2002:a65:6041:0:b0:449:8b9c:8d29 with SMTP id a1-20020a656041000000b004498b9c8d29mr6847848pgp.335.1666182499026; Wed, 19 Oct 2022 05:28:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666182499; cv=none; d=google.com; s=arc-20160816; b=y379DHcdt/6Z+edZ1MLy2sKhnYwSMAqC9FZy59SDLhszHzHU+x4YUssDvbVbGbfWh6 TB4B/gdCFZoozDw7awfb1j2sb/pkr89PbosY9BMRxXIF26ZeVOlHEDryJnAaPmZqQpFp vlem8HzjpAsopr8hT+LshfS6+MYMNYLPgh0VNSrGBvukoW3rji3BfE/mvWmXt0tQKkr3 i7d9q8KvzaTC4Q3WW/bFkPxNuEl0JS+G4wKazgDU+l48dpL1lxo4LWGz01UJxwHJVxuq JoVgeAqtdNTkdnVE0tuE908w5nDoq3CwATnUHFe5E3pnTiyCxcadcZccRYJtovQjywQU zVyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TIfJNZGQBLnfMFOQY80t4LIwutfA4bvGJOnU3XFk4fs=; b=Q+KwH+u66Mr4VBJ6suqLpOIZghFV7rGFROyDlHXdMCusUWM3JaiLwxXUaCcOS4HLs7 5AugXJ/DQAAU/jvROS7jrZa+eGM8tEnJ/QuOk8GTZoWjAJmI8j61m0RGQanblTqPW+PD nr6DAHnBpZ0nqq7p3iqiZZyQPcDakwzjGF80df+ouhMQYF0o9R16crP+bLNi+wa1okxM oG3lN+cfMGnxqDa7y/72azyzYBAcdlT4M+c7v5b0bbqLQL6UqmGx1Xt42mJJqwrOTb2U ftkCA1/VCZ2uq42ufMFsU6ucMkkSRfyQhTfFGsZYW0+AB0GA3GBP1eHD/vSsyje3muR6 o8rA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qTzh2qs5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p2-20020a170902b08200b00180556e1b6bsi17294520plr.609.2022.10.19.05.28.05; Wed, 19 Oct 2022 05:28: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=qTzh2qs5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232976AbiJSMSO (ORCPT + 99 others); Wed, 19 Oct 2022 08:18:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232957AbiJSMRm (ORCPT ); Wed, 19 Oct 2022 08:17: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 CD179FF235; Wed, 19 Oct 2022 04:53: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 C2432B822F6; Wed, 19 Oct 2022 08:45:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3680FC433D6; Wed, 19 Oct 2022 08:45:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169145; bh=cNt7T6RmL3y/9iiO0cyR9PT7nxKXSZDGJ+iSkvgxvIQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qTzh2qs5jq7cpuGiQ6MH8/M+ErxjaGR6i5k4LHR3Ksey7GkcFyGgZsXST9L9fFAfB 9O8yXlMg98j5Grw+IqWLBisbxSwBRJqM3BFayfbG73H2AvuPh50riMl9YsUTxT8mb8 GJ1G1jp24n7A5dJnBLD60NxPZTo6NZrqoO1GNobY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yu Kuai , Jens Axboe Subject: [PATCH 6.0 173/862] blk-wbt: call rq_qos_add() after wb_normal is initialized Date: Wed, 19 Oct 2022 10:24:20 +0200 Message-Id: <20221019083257.596074416@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747118980254053414?= X-GMAIL-MSGID: =?utf-8?q?1747118980254053414?= From: Yu Kuai commit 8c5035dfbb9475b67c82b3fdb7351236525bf52b upstream. Our test found a problem that wbt inflight counter is negative, which will cause io hang(noted that this problem doesn't exist in mainline): t1: device create t2: issue io add_disk blk_register_queue wbt_enable_default wbt_init rq_qos_add // wb_normal is still 0 /* * in mainline, disk can't be opened before * bdev_add(), however, in old kernels, disk * can be opened before blk_register_queue(). */ blkdev_issue_flush // disk size is 0, however, it's not checked submit_bio_wait submit_bio blk_mq_submit_bio rq_qos_throttle wbt_wait bio_to_wbt_flags rwb_enabled // wb_normal is 0, inflight is not increased wbt_queue_depth_changed(&rwb->rqos); wbt_update_limits // wb_normal is initialized rq_qos_track wbt_track rq->wbt_flags |= bio_to_wbt_flags(rwb, bio); // wb_normal is not 0,wbt_flags will be set t3: io completion blk_mq_free_request rq_qos_done wbt_done wbt_is_tracked // return true __wbt_done wbt_rqw_done atomic_dec_return(&rqw->inflight); // inflight is decreased commit 8235b5c1e8c1 ("block: call bdev_add later in device_add_disk") can avoid this problem, however it's better to fix this problem in wbt: 1) Lower kernel can't backport this patch due to lots of refactor. 2) Root cause is that wbt call rq_qos_add() before wb_normal is initialized. Fixes: e34cbd307477 ("blk-wbt: add general throttling mechanism") Cc: Signed-off-by: Yu Kuai Link: https://lore.kernel.org/r/20220913105749.3086243-1-yukuai1@huaweicloud.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- block/blk-wbt.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) --- a/block/blk-wbt.c +++ b/block/blk-wbt.c @@ -843,6 +843,10 @@ int wbt_init(struct request_queue *q) rwb->enable_state = WBT_STATE_ON_DEFAULT; rwb->wc = 1; rwb->rq_depth.default_depth = RWB_DEF_DEPTH; + rwb->min_lat_nsec = wbt_default_latency_nsec(q); + + wbt_queue_depth_changed(&rwb->rqos); + wbt_set_write_cache(q, test_bit(QUEUE_FLAG_WC, &q->queue_flags)); /* * Assign rwb and add the stats callback. @@ -853,11 +857,6 @@ int wbt_init(struct request_queue *q) blk_stat_add_callback(q, rwb->cb); - rwb->min_lat_nsec = wbt_default_latency_nsec(q); - - wbt_queue_depth_changed(&rwb->rqos); - wbt_set_write_cache(q, test_bit(QUEUE_FLAG_WC, &q->queue_flags)); - return 0; err_free: From patchwork Wed Oct 19 08:24: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: 5473 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp332769wrs; Wed, 19 Oct 2022 06:39:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Jrho57Dh/3dWBfyx7rEyHh7OcZJRaezxnGEIZXFMpU8fb2tOQ7ssNU160zipwbf/IVxuh X-Received: by 2002:a63:5422:0:b0:466:41b5:77d4 with SMTP id i34-20020a635422000000b0046641b577d4mr7063196pgb.547.1666186773361; Wed, 19 Oct 2022 06:39:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666186773; cv=none; d=google.com; s=arc-20160816; b=pydH7fDbzHPLPIMV6bi2daJO3pT75LvndV1qkZwXsWtBsLfHvpc0vnUnL8mHsQrnhC 8piZs5rw3cdAadUdGzhwDc6fdWIW+7xxexVRpPM0DZYhzXxkl/U6tx1L4U4KGfIznr1Q HOB5mG/rlNpE3GEGcd2KHgwjB8+F8EoEfre/BpNO/xHHz0cdEVI/3EeBp+cVkLConu1I ZOuxWBSC6LqHtJf8aur0ng1vjmuSWlld9V1jBOpEhhvZ6mLY/tp4ehMgz9FiMPqCvjmp 9jyrB9CxTgG4qcZr33AYPz+pWMzEFTPVcy0t1rtk9kLGuofHD48o/w58gG6vVxucOMhZ cQLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MqyRt43fNIjRKJDtWXEGoaKCkypQH2fwb6rgZcmDxU4=; b=HV379tSR8emEhv1LzrXu2xuSC+z2YqsJBttq+nWeB0Ckp1QmO2HkjYulTDyCIIlK53 y5CMIK3WZL6DbSAJP6T9Git0uM6ojsZ5SMGCbL9KfVWERU3bozEMUHEkNapXOmkiQb3f +D+W3WHn4KIpu9ryf9FZoFwJ/oSykE6/GmyXRejD91lrkQejyrIu2cUaPYA9re4IEo7A 8P+81bBwLK3uejpVgVCYsKFYatmF92PH7KDLI0iX/WatE1oThAy0jtKxQp3wlfOyAXaM u6ko/E+aCCh7TBWeN5FqFxsTLfI8BOtKnNiZLOjRg2ZSP7vMrMA9fr08VHK6R4CdeeVd 5Ecw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=b5bOoN65; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170902f34d00b0017df3f07519si15298292ple.302.2022.10.19.06.39.20; Wed, 19 Oct 2022 06:39: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=b5bOoN65; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231908AbiJSNgB (ORCPT + 99 others); Wed, 19 Oct 2022 09:36:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232113AbiJSNfq (ORCPT ); Wed, 19 Oct 2022 09:35:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADA041F619; Wed, 19 Oct 2022 06:24: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 2AF7D61808; Wed, 19 Oct 2022 08:45:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2BFF4C433C1; Wed, 19 Oct 2022 08:45:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169148; bh=kShm1VKzyV4zkO60J6TzmRyIkoL3AYaMOqe7iH9vzlk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b5bOoN65EXOMlAnsmoOs4hGHaNj7qw/M3BywnjYICA0bHyWjVZu7lIgvvuf6iP7ea rbBfsr1PI4GilvInxqJCXpGb4Eng09LUAaBwC2H5e4qOLEwfiD9siRIpQwoJdYt535 6QwU7KSGqAhEb8obk8bUdjeWpitlJeluvyZYlvdU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michal Luczaj , Sean Christopherson Subject: [PATCH 6.0 174/862] KVM: x86/emulator: Fix handing of POP SS to correctly set interruptibility Date: Wed, 19 Oct 2022 10:24:21 +0200 Message-Id: <20221019083257.641225387@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123461887166743?= X-GMAIL-MSGID: =?utf-8?q?1747123461887166743?= 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 @@ -1953,7 +1953,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 Wed Oct 19 08:24: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: 5606 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp370091wrs; Wed, 19 Oct 2022 07:53:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Yi9FXdQC5030nvg1kPquxRhbRoi1TLs4VoE3/iVLGHUnrS1v57AdomgTxOsl9/TZIOEVz X-Received: by 2002:a65:5504:0:b0:41c:66a6:4125 with SMTP id f4-20020a655504000000b0041c66a64125mr7738543pgr.598.1666191211523; Wed, 19 Oct 2022 07:53:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666191211; cv=none; d=google.com; s=arc-20160816; b=hFEeaXbmeqM6Ik25FL+XBrl916J3QArlW2isJ8JClvHDoUrJRFyQiNQUQysfp8+3+j rdrcHY7JPKJPbSyDfKUyTBxvnvX2X25M5J+d/9rsMMpgLD5BExFIgvHFqzvZFurIROa8 N1M1VlZDoaK29wYFl+aPEmwYR82jEyTfnFfvrIAtezKDvP9rEXulzkQdPNeprMIsaRwp gQ0/lfhrngrzBXF/GqjsyamJxzljT47U701WXbbfhywLazkTKvUHTyoly9WjjLKTCzGk t+v2LP85KMNkGDoj4LF5tl0/fXhNztKvA/BcFJqQ1AVomX4RCWj2c8MmDGU6hSQFI2ta MEJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jAVMqIwSurztpBK4Fx97mGee+g/EVnS1UjIBw0KUuKE=; b=G9lIDr/ggKNk5ivpYYGyqK2KWzht8HUY7lYYEt0g1g8pqxbwjM+O1J8aJqxFaUi8GL dkS3J1Ofvp9iD0I4l4vXNbKxUxEPzfz2Pc1KuAc3rBynrVwjkMWMOHd5cOdJtBuNqG9w 3QtKg3HsBfEBvclIKTKnjePzcDPoM7pe2erG0VstJYh+XziQQo8MT41l9r1C2TtKQL+f oHm4Qx7aZ89LKNaRk7GF3Rbcait9gMH9f5TKsu7DZD9TZRB5cBWDxNKQaCZPGGpDq583 Se5J7T/dU8fawzD4H9CT2P2q+ZnOGeg52Vtbz9qpWheNXWH3PgbQEoCMwQhhcOSFTDXr ZSKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Tu1v46gI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q17-20020a170902f35100b00174ea015ee8si15342001ple.592.2022.10.19.07.52.57; Wed, 19 Oct 2022 07:53: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=Tu1v46gI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229635AbiJSOuM (ORCPT + 99 others); Wed, 19 Oct 2022 10:50:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231357AbiJSOtm (ORCPT ); Wed, 19 Oct 2022 10:49: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 25E57AE6B; Wed, 19 Oct 2022 07:37:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E1352617FF; Wed, 19 Oct 2022 08:45:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E511DC433D7; Wed, 19 Oct 2022 08:45:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169151; bh=QDgl6VLYGMI6vRVHpkwYOT7zODods6LRMMu+wpec8zM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Tu1v46gINz1hQcV3xbqG2V+JDI8iYOfO4AGNfyeA+NCPZIAlKJgDE4CpjjHiTAL/C JR+/elk8b5sqTZtIk5dBv+9iiqWfAWvv26tRjYulOXPehFuLJphxVGmZmkMfZMWzck 9UEdolfRoLMnyhLL+ZzIm+Hg+N1G51eVZYloaN5s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , Jim Mattson , Maxim Levitsky , Paolo Bonzini Subject: [PATCH 6.0 175/862] KVM: nVMX: Unconditionally purge queued/injected events on nested "exit" Date: Wed, 19 Oct 2022 10:24:22 +0200 Message-Id: <20221019083257.683809042@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747128115374434909?= X-GMAIL-MSGID: =?utf-8?q?1747128115374434909?= From: Sean Christopherson commit d953540430c5af57f5de97ea9e36253908204027 upstream. Drop pending exceptions and events queued for re-injection when leaving nested guest mode, even if the "exit" is due to VM-Fail, SMI, or forced by host userspace. Failure to purge events could result in an event belonging to L2 being injected into L1. This _should_ never happen for VM-Fail as all events should be blocked by nested_run_pending, but it's possible if KVM, not the L1 hypervisor, is the source of VM-Fail when running vmcs02. SMI is a nop (barring unknown bugs) as recognition of SMI and thus entry to SMM is blocked by pending exceptions and re-injected events. Forced exit is definitely buggy, but has likely gone unnoticed because userspace probably follows the forced exit with KVM_SET_VCPU_EVENTS (or some other ioctl() that purges the queue). Fixes: 4f350c6dbcb9 ("kvm: nVMX: Handle deferred early VMLAUNCH/VMRESUME failure properly") Cc: stable@vger.kernel.org Signed-off-by: Sean Christopherson Reviewed-by: Jim Mattson Reviewed-by: Maxim Levitsky Link: https://lore.kernel.org/r/20220830231614.3580124-2-seanjc@google.com Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman --- arch/x86/kvm/vmx/nested.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -4255,14 +4255,6 @@ static void prepare_vmcs12(struct kvm_vc nested_vmx_abort(vcpu, VMX_ABORT_SAVE_GUEST_MSR_FAIL); } - - /* - * Drop what we picked up for L2 via vmx_complete_interrupts. It is - * preserved above and would only end up incorrectly in L1. - */ - vcpu->arch.nmi_injected = false; - kvm_clear_exception_queue(vcpu); - kvm_clear_interrupt_queue(vcpu); } /* @@ -4602,6 +4594,17 @@ void nested_vmx_vmexit(struct kvm_vcpu * WARN_ON_ONCE(nested_early_check); } + /* + * Drop events/exceptions that were queued for re-injection to L2 + * (picked up via vmx_complete_interrupts()), as well as exceptions + * that were pending for L2. Note, this must NOT be hoisted above + * prepare_vmcs12(), events/exceptions queued for re-injection need to + * be captured in vmcs12 (see vmcs12_save_pending_event()). + */ + vcpu->arch.nmi_injected = false; + kvm_clear_exception_queue(vcpu); + kvm_clear_interrupt_queue(vcpu); + vmx_switch_vmcs(vcpu, &vmx->vmcs01); /* Update any VMCS fields that might have changed while L2 ran */ From patchwork Wed Oct 19 08:24: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: 4579 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp205816wrs; Wed, 19 Oct 2022 01:50:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5KMRbCz+0gdNjPVPFVA3/oJ4NQ53yV6LzhNp6bxiuQaLsFWnj6k3Vyn7mKb9zUIgvvPV8c X-Received: by 2002:a17:90b:1808:b0:20d:4e7f:5f53 with SMTP id lw8-20020a17090b180800b0020d4e7f5f53mr43267525pjb.170.1666169443720; Wed, 19 Oct 2022 01:50:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169443; cv=none; d=google.com; s=arc-20160816; b=Ok7jvfkZDdvF7xCn9MyXHFYrViUcYvW2t3h2nvyCXXOUlxVK/YW5J/1ARZJBUnflKR pltmOHJ1Hid7A14tzWpDFX6+kmHkyEOF1J8qyV/I1S+ufDZsMgklr5MtAewwb6yMSC6q dBrieLMFkb9TOU0nDdbuMHPlAMb4Y0koeM9+YtioTvrRxv6ECCZWS6HtUGBip0CBbh/l 3gwdTea+vVw8VdqlXE8O/yERbSe/fJSRUchc1YMbzmhLWpI7r2J/tnEOqgmDcl0idaba KbI4wFT/CLMH34rmlVO5bC+uCS8yhqPZiY6U6zlFm3wjNRAs70KVekohguNOS4ZfY2Hg 5sGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1jI6VR+rh5Gyq2VbzrG0Tj1bOQoslCIQ3xyOS8sVGpg=; b=SaUM1hQzurCsGLuhWblXWxqd/IzzBcEuQ6PgISTnfdbVzav1NMQQNf4P63CgL4IBmR h7vfheh4SJs4xNvaP2idf09bP5DplzJJMoGValmhC7pKlHk3ED0BGYagu2wpnZV+mWwK Yj03eNXtJUEIWKLbrT7++IPYOClYKoQ4lE/Ui4g5s0R7gQf7GyzAFLhIeOTpz5XfXOw1 hlgYLClNgcRaTlDjNCPtFQBCliZCp0Fs6VkRbUZwYC79OkImEODdc5aZaOOFosre5Vt2 8/+bKcepEJfpUZoj1cSQZPOQHVLfCz07f7auE7u+lWWueQ6YEb1Q4Owo5r60rjv/kw4Q ieAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cnj8zd4f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pi10-20020a17090b1e4a00b00202ae67f30asi20005707pjb.163.2022.10.19.01.50.30; Wed, 19 Oct 2022 01:50: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=cnj8zd4f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231633AbiJSIsv (ORCPT + 99 others); Wed, 19 Oct 2022 04:48:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231561AbiJSIsI (ORCPT ); Wed, 19 Oct 2022 04:48:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E15C48E729; Wed, 19 Oct 2022 01:45:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D8E9061806; Wed, 19 Oct 2022 08:45:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E8241C433C1; Wed, 19 Oct 2022 08:45:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169154; bh=OHv+KpWGBeMvBQ7lMYmjy5WHvn3BF9Zmb+vVx3Mx7hY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cnj8zd4fxYI8wbqaOFelsaFpU2VpT0M2eMn+abZ0uUHBaM5Eavlk4UWTmBTxiJChb DIcoo9YWTFnLKPXJvbHrmK9pRixvUuCxl50Jb7l/toAvOjseyadHbtruF6cNJMbmu1 XfZT8zP4UnebZPZ+HxC8vjIN3ruDIcwIBhOxlDNI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , Vitaly Kuznetsov , Paolo Bonzini Subject: [PATCH 6.0 176/862] KVM: nVMX: Dont propagate vmcs12s PERF_GLOBAL_CTRL settings to vmcs02 Date: Wed, 19 Oct 2022 10:24:23 +0200 Message-Id: <20221019083257.733482554@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105290600522847?= X-GMAIL-MSGID: =?utf-8?q?1747105290600522847?= From: Sean Christopherson commit def9d705c05eab3fdedeb10ad67907513b12038e upstream. Don't propagate vmcs12's VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL to vmcs02. KVM doesn't disallow L1 from using VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL even when KVM itself doesn't use the control, e.g. due to the various CPU errata that where the MSR can be corrupted on VM-Exit. Preserve KVM's (vmcs01) setting to hopefully avoid having to toggle the bit in vmcs02 at a later point. E.g. if KVM is loading PERF_GLOBAL_CTRL when running L1, then odds are good KVM will also load the MSR when running L2. Fixes: 8bf00a529967 ("KVM: VMX: add support for switching of PERF_GLOBAL_CTRL") Cc: stable@vger.kernel.org Signed-off-by: Sean Christopherson Signed-off-by: Vitaly Kuznetsov Link: https://lore.kernel.org/r/20220830133737.1539624-18-vkuznets@redhat.com Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman --- arch/x86/kvm/vmx/nested.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -2328,9 +2328,14 @@ static void prepare_vmcs02_early(struct * are emulated by vmx_set_efer() in prepare_vmcs02(), but speculate * on the related bits (if supported by the CPU) in the hope that * we can avoid VMWrites during vmx_set_efer(). + * + * Similarly, take vmcs01's PERF_GLOBAL_CTRL in the hope that if KVM is + * loading PERF_GLOBAL_CTRL via the VMCS for L1, then KVM will want to + * do the same for L2. */ exec_control = __vm_entry_controls_get(vmcs01); - exec_control |= vmcs12->vm_entry_controls; + exec_control |= (vmcs12->vm_entry_controls & + ~VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL); exec_control &= ~(VM_ENTRY_IA32E_MODE | VM_ENTRY_LOAD_IA32_EFER); if (cpu_has_load_ia32_efer()) { if (guest_efer & EFER_LMA) From patchwork Wed Oct 19 08:24: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: 5347 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp295981wrs; Wed, 19 Oct 2022 05:26:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6QubRwboaof28G7TevxLJEEYzH/dW0q6g333D6U4vg6jhCTsIPm9yfHif0JV2xjsTGYplU X-Received: by 2002:a05:6402:501b:b0:459:df91:983 with SMTP id p27-20020a056402501b00b00459df910983mr6946653eda.85.1666182401775; Wed, 19 Oct 2022 05:26:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666182401; cv=none; d=google.com; s=arc-20160816; b=XPevMbmkmhxo4KZD9AAhw+B8nWgckDWdH88itQDPYvrueGBod1aFlJcqDBfxD9uBoq b64Xc5wsEaXtZ4LmbVdnfveh2YJ3TlwSBoX0oYjuCpADEEnEeClKF9ShzaBEu2QPsyIr uT0u2Djrb1Xw4lKt5RaqYtMmcndLDjBbS36g4TtITzDs/Rqb6gHySur3oPE79NOL4JW3 bbSqo+hf9M0RLYNButZePijwOdFFTUr2cgkM1P7zrWAQfqRkRSl2T1bWA7eiiDNyM3Ne venZLNRh6uhJEAKvfuQl0h6qiXc/R5DLpXI9hkVQS1OuOw92AE/yzEYNweChCUuXO3xY 5CBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TTQLYrSg6+2/setW+s1hOuUiQJ1HN5fg/PvIZh8vLO8=; b=kpJj7fB0rx7d0YLvxHZugbYNZtTm0HiSSB+r2AhFglq/UnOyhZH8TV2Nfj+LyYj5VR g3siNp3AMf74iO0tC/1WdtVQc0JZVxfWY5o0rOe+ciohVNFFGEvBh9WR/dVbcnqVTSdr EHBnp7LAz9SgLBmD7uOibvhOw+A3GjRZmQbMS+Z3IMDlJ1jIRsJ3XPys3hlFhCy/ZK9E syetNV7Pu29WUN7EzZfQZK+bPVuZ6U/Zf0+r8GuE8xm2VBRd/o2Yh7M01cT+eJsvfU2R yYkQySx0w3p7gkmF+nboL/rxEVtmToy65jXcpz58DyDxBl1rTVhRd2Dp6fwuCeU23+CM uA2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZrIltA5g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ht17-20020a170907609100b00782f3e3bb71si14832899ejc.912.2022.10.19.05.26.07; Wed, 19 Oct 2022 05:26: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=ZrIltA5g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232873AbiJSMQe (ORCPT + 99 others); Wed, 19 Oct 2022 08:16:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229463AbiJSMQB (ORCPT ); Wed, 19 Oct 2022 08:16: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 9965620982; Wed, 19 Oct 2022 04:52: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 89DDEB82313; Wed, 19 Oct 2022 08:45:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5E90C4314F; Wed, 19 Oct 2022 08:45:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169157; bh=b5rhGy6HGSiQ2e/PIO9XZf9ax5EpqjitVWvYpPFEra4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZrIltA5guccu0hHy2yx/1x6Fh7tEpnqh3KAOMFQlxc82aEXrNYTqXLk0hs34RWgEH W3EOWq32oaWzLfgFDDhr9Q271/CLJ9gPPJKbknsPuXOs1DwvXy+c0Gdf55IL67R1jP RvrS8QGXcPAUxyhsrQ/XYO4smLwj/kV3ZcAMH/jI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , Maxim Levitsky , Paolo Bonzini Subject: [PATCH 6.0 177/862] KVM: x86: Treat #DBs from the emulator as fault-like (code and DR7.GD=1) Date: Wed, 19 Oct 2022 10:24:24 +0200 Message-Id: <20221019083257.781526962@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747118878261936329?= X-GMAIL-MSGID: =?utf-8?q?1747118878261936329?= From: Sean Christopherson commit 5623f751bd9c438ed12840e086f33c4646440d19 upstream. Add a dedicated "exception type" for #DBs, as #DBs can be fault-like or trap-like depending the sub-type of #DB, and effectively defer the decision of what to do with the #DB to the caller. For the emulator's two calls to exception_type(), treat the #DB as fault-like, as the emulator handles only code breakpoint and general detect #DBs, both of which are fault-like. For event injection, which uses exception_type() to determine whether to set EFLAGS.RF=1 on the stack, keep the current behavior of not setting RF=1 for #DBs. Intel and AMD explicitly state RF isn't set on code #DBs, so exempting by failing the "== EXCPT_FAULT" check is correct. The only other fault-like #DB is General Detect, and despite Intel and AMD both strongly implying (through omission) that General Detect #DBs should set RF=1, hardware (multiple generations of both Intel and AMD), in fact does not. Through insider knowledge, extreme foresight, sheer dumb luck, or some combination thereof, KVM correctly handled RF for General Detect #DBs. Fixes: 38827dbd3fb8 ("KVM: x86: Do not update EFLAGS on faulting emulation") Cc: stable@vger.kernel.org Signed-off-by: Sean Christopherson Reviewed-by: Maxim Levitsky Link: https://lore.kernel.org/r/20220830231614.3580124-9-seanjc@google.com Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman --- arch/x86/kvm/x86.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -528,6 +528,7 @@ static int exception_class(int vector) #define EXCPT_TRAP 1 #define EXCPT_ABORT 2 #define EXCPT_INTERRUPT 3 +#define EXCPT_DB 4 static int exception_type(int vector) { @@ -538,8 +539,14 @@ static int exception_type(int vector) mask = 1 << vector; - /* #DB is trap, as instruction watchpoints are handled elsewhere */ - if (mask & ((1 << DB_VECTOR) | (1 << BP_VECTOR) | (1 << OF_VECTOR))) + /* + * #DBs can be trap-like or fault-like, the caller must check other CPU + * state, e.g. DR6, to determine whether a #DB is a trap or fault. + */ + if (mask & (1 << DB_VECTOR)) + return EXCPT_DB; + + if (mask & ((1 << BP_VECTOR) | (1 << OF_VECTOR))) return EXCPT_TRAP; if (mask & ((1 << DF_VECTOR) | (1 << MC_VECTOR))) @@ -8801,6 +8808,12 @@ writeback: unsigned long rflags = static_call(kvm_x86_get_rflags)(vcpu); toggle_interruptibility(vcpu, ctxt->interruptibility); vcpu->arch.emulate_regs_need_sync_to_vcpu = false; + + /* + * Note, EXCPT_DB is assumed to be fault-like as the emulator + * only supports code breakpoints and general detect #DB, both + * of which are fault-like. + */ if (!ctxt->have_exception || exception_type(ctxt->exception.vector) == EXCPT_TRAP) { kvm_pmu_trigger_event(vcpu, PERF_COUNT_HW_INSTRUCTIONS); @@ -9724,6 +9737,16 @@ static int inject_pending_event(struct k /* try to inject new event if pending */ if (vcpu->arch.exception.pending) { + /* + * Fault-class exceptions, except #DBs, set RF=1 in the RFLAGS + * value pushed on the stack. Trap-like exception and all #DBs + * leave RF as-is (KVM follows Intel's behavior in this regard; + * AMD states that code breakpoint #DBs excplitly clear RF=0). + * + * Note, most versions of Intel's SDM and AMD's APM incorrectly + * describe the behavior of General Detect #DBs, which are + * fault-like. They do _not_ set RF, a la code breakpoints. + */ if (exception_type(vcpu->arch.exception.nr) == EXCPT_FAULT) __kvm_set_rflags(vcpu, kvm_get_rflags(vcpu) | X86_EFLAGS_RF); From patchwork Wed Oct 19 08:24: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: 4583 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp205876wrs; Wed, 19 Oct 2022 01:50:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7W1U831bnMd/Qd6Vxf+dJZg3Jqm7yBGoMlAAyhhy3hDRq5/opGDfazDr/39VKY58WtjqTD X-Received: by 2002:a17:902:b70c:b0:179:eb79:cf9a with SMTP id d12-20020a170902b70c00b00179eb79cf9amr7347851pls.130.1666169453717; Wed, 19 Oct 2022 01:50:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169453; cv=none; d=google.com; s=arc-20160816; b=SRAliT3KhAxDcQTFopx/kK/XGCdhtaRAqo/YA/61SECGPF6Wh9YqEnB6G0IC05JFQy YE6NHXi3teM806O1lOrk5TZ5JSfzfuuiCdc6JMYQBht1cNDR/XYa52cv8Oh8G+mrceCa gBUqyGvicG+KTjxokon+vBVE5xJIrvV+lQuTm9CkX1/i/Gs1rvUNNtQEWWgobv5i4H8c TATVy2934CYTl1Etv08gUdvl5PKzXhHTMFZL3ECpjtAc+HW95/zLyZ8fMdFylRq+SEFN wgKmaRJeeP+YCMZ+eYD7chMhCPBZ+k8tQO9gMMVZ+eRysynyMfbuYMHiXU2VlL2Zwp/b PT4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JRpCR5rG+1qR4olGxnoMihKhmN6RI7KC/2EluXG+l2Q=; b=cQchDB0xSYmeVQtjW37HKJBo0KohMDdziQIDGeEGtzasVfJwo+y9vtxOVVSVAbPLhP uCvZBMH5WTSL0w8fX46I/xvnq8Kkzo7J4hzVTC68EEeoq2o5AsrCgip+BdkGT3G5faPO xvLoN2oBe2F2WYAqWq3HAjugbVQeAsbeTvknc8kWbFJ3HQ0XFcrX55qjb2kZg6WEtV0G cd6Q8kTCgvOyugSVmAZbMGbGHhcbznJLC+vIONB0kbjZT2zKcTLh1o3m4JN1L4Qt/CbG BCX9O6G+9rIfVQuoRXW2styph6Da6aO4PaCH4mhoRWAD2mDt35YB56xM3903GX+TJ9rk /YcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zLW9kBAA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a632c11000000b0045ffa7279adsi17247578pgs.31.2022.10.19.01.50.40; Wed, 19 Oct 2022 01:50: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=zLW9kBAA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231644AbiJSItA (ORCPT + 99 others); Wed, 19 Oct 2022 04:49:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230425AbiJSIsQ (ORCPT ); Wed, 19 Oct 2022 04:48:16 -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 8F2628B2D5; Wed, 19 Oct 2022 01:46: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 92F7F61821; Wed, 19 Oct 2022 08:46:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB037C433B5; Wed, 19 Oct 2022 08:45:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169160; bh=QtnZ6K65aYoHOIJ/VgWVsYFcsTTB18FFcgDX9DHz+pk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zLW9kBAAu6fFfXDMoPtQzKV81omP94RZ5PkcPZPWhlAcEtcKZvQa4Z6NhkiSnHa+0 cr0XYNt42MYSupznZuRX+3hzeHpq91xKA6V92AFE395lFBDA4n996naBFDxlJjDifa Yvkyx8EYgPWIzjtqjIvEf/ZHvINZdZy1tH00spYE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , Jim Mattson , Maxim Levitsky , Paolo Bonzini Subject: [PATCH 6.0 178/862] KVM: VMX: Drop bits 31:16 when shoving exception error code into VMCS Date: Wed, 19 Oct 2022 10:24:25 +0200 Message-Id: <20221019083257.823613947@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105301064903846?= X-GMAIL-MSGID: =?utf-8?q?1747105301064903846?= From: Sean Christopherson commit eba9799b5a6efe2993cf92529608e4aa8163d73b upstream. Deliberately truncate the exception error code when shoving it into the VMCS (VM-Entry field for vmcs01 and vmcs02, VM-Exit field for vmcs12). Intel CPUs are incapable of handling 32-bit error codes and will never generate an error code with bits 31:16, but userspace can provide an arbitrary error code via KVM_SET_VCPU_EVENTS. Failure to drop the bits on exception injection results in failed VM-Entry, as VMX disallows setting bits 31:16. Setting the bits on VM-Exit would at best confuse L1, and at worse induce a nested VM-Entry failure, e.g. if L1 decided to reinject the exception back into L2. Cc: stable@vger.kernel.org Signed-off-by: Sean Christopherson Reviewed-by: Jim Mattson Reviewed-by: Maxim Levitsky Link: https://lore.kernel.org/r/20220830231614.3580124-3-seanjc@google.com Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman --- arch/x86/kvm/vmx/nested.c | 11 ++++++++++- arch/x86/kvm/vmx/vmx.c | 12 +++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -3832,7 +3832,16 @@ static void nested_vmx_inject_exception_ u32 intr_info = nr | INTR_INFO_VALID_MASK; if (vcpu->arch.exception.has_error_code) { - vmcs12->vm_exit_intr_error_code = vcpu->arch.exception.error_code; + /* + * Intel CPUs do not generate error codes with bits 31:16 set, + * and more importantly VMX disallows setting bits 31:16 in the + * injected error code for VM-Entry. Drop the bits to mimic + * hardware and avoid inducing failure on nested VM-Entry if L1 + * chooses to inject the exception back to L2. AMD CPUs _do_ + * generate "full" 32-bit error codes, so KVM allows userspace + * to inject exception error codes with bits 31:16 set. + */ + vmcs12->vm_exit_intr_error_code = (u16)vcpu->arch.exception.error_code; intr_info |= INTR_INFO_DELIVER_CODE_MASK; } --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -1695,7 +1695,17 @@ static void vmx_queue_exception(struct k kvm_deliver_exception_payload(vcpu); if (has_error_code) { - vmcs_write32(VM_ENTRY_EXCEPTION_ERROR_CODE, error_code); + /* + * Despite the error code being architecturally defined as 32 + * bits, and the VMCS field being 32 bits, Intel CPUs and thus + * VMX don't actually supporting setting bits 31:16. Hardware + * will (should) never provide a bogus error code, but AMD CPUs + * do generate error codes with bits 31:16 set, and so KVM's + * ABI lets userspace shove in arbitrary 32-bit values. Drop + * the upper bits to avoid VM-Fail, losing information that + * does't really exist is preferable to killing the VM. + */ + vmcs_write32(VM_ENTRY_EXCEPTION_ERROR_CODE, (u16)error_code); intr_info |= INTR_INFO_DELIVER_CODE_MASK; } From patchwork Wed Oct 19 08:24: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: 4665 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212710wrs; Wed, 19 Oct 2022 02:08:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6JrTndWqG3dhUqUfD/8PiMt5Nnq6p3SiVm2JzUTCK+7s2TCVeSp3k5mgFMva1PeBN4Gr5p X-Received: by 2002:a17:906:cc0b:b0:78e:1d51:36ea with SMTP id ml11-20020a170906cc0b00b0078e1d5136eamr5929717ejb.408.1666170487239; Wed, 19 Oct 2022 02:08:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170487; cv=none; d=google.com; s=arc-20160816; b=nZZJIh/th2ZVXRJp0Z3IupRQDDh8X3p/o9rNef8/A7MQpjShVyR4HT8ysPDbUk8rFK 7D0b/fkzA1mHo8YwbSzJtLNAZ+mqeOq4Dl32Vs87HO8kJ8P87H1NxjuD5/Cq84TPxDjc YCPH3CkEg5zVs1SPCs5JdBc1I++GEzaV27f7Tkd7waiRQZXA6vwbu3L/pMIIKG8KvUQU ZTkB3f9zakL30YNyNZOYA9Dvz+053ZnDUdTCzV4ZNlTOT5mF1iSeBbZFkxeQZ8jjtlJ9 tqQWgS7wqFPPi98LjoHj/2JWf5L9QHCEQKI+IpA7Jl8370QezxuvjimNegxDf3xF0i3p 0CZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yylzRrqmCCn4p1s9eaVI5uw1JDzJiB63l3R028l55FM=; b=ZDeBjZF+/TS1fIflp2kr6YhkIY9dEaO0blqkGUQRZSTUbpBBXHNQAAzzqaj/eu4b1I zmGIZoUbvqbgPwIg+4HSDul0R7kz+YpElSZaWkUCDGwCu3DM2X6iHiH3GL6bphI4b0c9 4tjsBSgfsWw1RV6+FPWsnnIuCmwjli933uNcrhUUL4544bVHhk16stSo+AjQvEUIV2ux EgIA+McxXOcnC79Q3yOZdIX2k5tJgRIhgCA9wc4thQcLeid1f02XOvIbeTu3WCm9wwV7 PozEA4aYzW643Zv1fR8h+9WCl2wpmFlgWUGwXuujOR7wddWIgttNrXSjYOq1bKgAXlOg lEJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ry50gBDx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q18-20020a056402519200b004597671e0ddsi13210416edd.338.2022.10.19.02.07.33; Wed, 19 Oct 2022 02:08: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=Ry50gBDx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232256AbiJSJBd (ORCPT + 99 others); Wed, 19 Oct 2022 05:01:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232211AbiJSI7Q (ORCPT ); Wed, 19 Oct 2022 04:59:16 -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 64DF5B1DB; Wed, 19 Oct 2022 01:54: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 88F7F61826; Wed, 19 Oct 2022 08:46:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 923C7C433D6; Wed, 19 Oct 2022 08:46:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169162; bh=qggspGbhOEEOUW1EbtqAEooo2tGTIcHxBbJIIDo0yxU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ry50gBDxajch4Qi/yys3d6u99hBIxkn/PWYehJmxTOSjW6A3fZHedaxDIMIww4Vzh jX2PvP4KqOcihShqpngxNNCsq253bFw2A1xUofW58SaQ4YyhXHs304OBsYIh+I2Pj7 YFEUwE9t5IQebfmXI0x6jrud4wV+fUDd20Y/dq8A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Alex Elder , stable Subject: [PATCH 6.0 179/862] staging: greybus: audio_helper: remove unused and wrong debugfs usage Date: Wed, 19 Oct 2022 10:24:26 +0200 Message-Id: <20221019083257.863955888@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106384627369477?= X-GMAIL-MSGID: =?utf-8?q?1747106384627369477?= From: Greg Kroah-Hartman commit d517cdeb904ddc0cbebcc959d43596426cac40b0 upstream. In the greybus audio_helper code, the debugfs file for the dapm has the potential to be removed and memory will be leaked. There is also the very real potential for this code to remove ALL debugfs entries from the system, and it seems like this is what will really happen if this code ever runs. This all is very wrong as the greybus audio driver did not create this debugfs file, the sound core did and controls the lifespan of it. So remove all of the debugfs logic from the audio_helper code as there's no way it could be correct. If this really is needed, it can come back with a fixup for the incorrect usage of the debugfs_lookup() call which is what caused this to be noticed at all. Cc: Johan Hovold Cc: Alex Elder Cc: Greg Kroah-Hartman Cc: stable Link: https://lore.kernel.org/r/20220902143715.320500-1-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/audio_helper.c | 11 ----------- 1 file changed, 11 deletions(-) --- a/drivers/staging/greybus/audio_helper.c +++ b/drivers/staging/greybus/audio_helper.c @@ -3,7 +3,6 @@ * Greybus Audio Sound SoC helper APIs */ -#include #include #include #include @@ -116,10 +115,6 @@ int gbaudio_dapm_free_controls(struct sn { int i; struct snd_soc_dapm_widget *w, *tmp_w; -#ifdef CONFIG_DEBUG_FS - struct dentry *parent = dapm->debugfs_dapm; - struct dentry *debugfs_w = NULL; -#endif mutex_lock(&dapm->card->dapm_mutex); for (i = 0; i < num; i++) { @@ -139,12 +134,6 @@ int gbaudio_dapm_free_controls(struct sn continue; } widget++; -#ifdef CONFIG_DEBUG_FS - if (!parent) - debugfs_w = debugfs_lookup(w->name, parent); - debugfs_remove(debugfs_w); - debugfs_w = NULL; -#endif gbaudio_dapm_free_widget(w); } mutex_unlock(&dapm->card->dapm_mutex); From patchwork Wed Oct 19 08:24: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: 4659 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212635wrs; Wed, 19 Oct 2022 02:07:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM70KCCJxtOFYJoaEjHxSfT5162k2H2aK/RDl+HJOJRnJhaagC/Bq+I2Ppn/qGv5maPeTX2y X-Received: by 2002:a17:907:72d2:b0:78d:4c16:a68d with SMTP id du18-20020a17090772d200b0078d4c16a68dmr5837747ejc.401.1666170477599; Wed, 19 Oct 2022 02:07:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170477; cv=none; d=google.com; s=arc-20160816; b=Viy33y2zqNEcplTpLnpj6HEkwfc2us+/DzWQrDu78NQ6j/mkCDiPyS1uX+sgghunpn bFn0NOkrubM7kGZJlyoCOsEH4SDeTVLneOs4g1C+A89ZJttRJfl2EmdvdYBBme82hHew J8eP45b8uu3i9rZSVbExdWbaT39pTRfjK3JWN4iUqnl70GHSLbfy2VPTMbcTcG1vC0pd uLKfwFol3/UqGyHgidpVgY37J/Yj0bXXr+fXfxdSqPEKP3/ReCDISCDvT9GUjRkYDByi 4tCpB59xB5NePhb2Z+3RtifP61fU3ke/3EmclBP7+JsfTmf/w5ATegb4UIMFOTP1UItm rBwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=P+7eoIk1sW/33+mzZgfUyl5xvDLsutKvWxFQcquGQyw=; b=0XPWsagtJb/Shhr9xlWNKwEZk+DGFrbuI2kHhv9o4AzjkpI65d1+Q7AbbqihiYnXkl knlmAS/3rn3G5epFjxYnfd+vUYOiBc6ntHWlypvFOlNlzxWcJQjIhqftw9766Gp7FAoA f1DNSkUSaiqbIEu4KAvHhp4jCxSu7Favo3rMJampsxaRClm8o7t28hQOTc/HnVG7TGzS jHZ5INEgE97NeDPtLajqELt4vb+o73+twC5fp2pqq0b6/5OJkxuef8NJqM+a5k7SONMF /q5U0Hr6b4l2oxFPm6UVlOmOr3L3eOelHNMdUuJ+LAOyjShChx+B8P7MkgN6QhbU8r4z zTnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uzkOxZYP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z11-20020a05640240cb00b0045807f73ad5si15283114edb.570.2022.10.19.02.07.23; Wed, 19 Oct 2022 02:07: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=uzkOxZYP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229554AbiJSJA7 (ORCPT + 99 others); Wed, 19 Oct 2022 05:00:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232138AbiJSI7A (ORCPT ); Wed, 19 Oct 2022 04:59:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E429D8768D; Wed, 19 Oct 2022 01:54: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 7D82F61806; Wed, 19 Oct 2022 08:46:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78188C433D6; Wed, 19 Oct 2022 08:46:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169168; bh=K0yeZ7/w3WHo2Xyl6Af/+8v2ksebm86re6HjFd/ClSI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uzkOxZYPdj8VTU5ClK4hzY7C8Wr7XZtTtXGo0KUYY7FvcOsG1UgonxfF5S/6oznrM eteF9y6wbtaZQReMoQyi9Lo/E7eFXErh7PTzAFaT7Asep4m9jnPKkroi8MjOE1EAJU nUR+wIp2xCBvakaAZ5QIu50LfpZx/40P7rGdpu2Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lyude Paul , Karol Herbst Subject: [PATCH 6.0 180/862] drm/nouveau/kms/nv140-: Disable interlacing Date: Wed, 19 Oct 2022 10:24:27 +0200 Message-Id: <20221019083257.911104683@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106374855003789?= X-GMAIL-MSGID: =?utf-8?q?1747106374855003789?= From: Lyude Paul commit 8ba9249396bef37cb68be9e8dee7847f1737db9d upstream. As it turns out: while Nvidia does actually have interlacing knobs on their GPU still pretty much no current GPUs since Volta actually support it. Trying interlacing on these GPUs will result in NVDisplay being quite unhappy like so: nouveau 0000:1f:00.0: disp: chid 0 stat 00004802 reason 4 [INVALID_ARG] mthd 2008 data 00000001 code 00080000 nouveau 0000:1f:00.0: disp: chid 0 stat 10005080 reason 5 [INVALID_STATE] mthd 0200 data 00000001 code 00000001 So let's fix this by following the same behavior Nvidia's driver does and disable interlacing entirely. Signed-off-by: Lyude Paul Cc: stable@vger.kernel.org Reviewed-by: Karol Herbst Link: https://patchwork.freedesktop.org/patch/msgid/20220816180436.156310-1-lyude@redhat.com Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/nouveau/nouveau_connector.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/nouveau/nouveau_connector.c +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c @@ -504,7 +504,8 @@ nouveau_connector_set_encoder(struct drm connector->interlace_allowed = nv_encoder->caps.dp_interlace; else - connector->interlace_allowed = true; + connector->interlace_allowed = + drm->client.device.info.family < NV_DEVICE_INFO_V0_VOLTA; connector->doublescan_allowed = true; } else if (nv_encoder->dcb->type == DCB_OUTPUT_LVDS || From patchwork Wed Oct 19 08:24: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: 4589 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp206076wrs; Wed, 19 Oct 2022 01:51:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7EwafD1gf9x1PV1ohY/Cm+d9oH7JQ8/wbsw6ii9jVr7q5aUCJhmiYK/OrUSqrqnJMaZW3q X-Received: by 2002:a65:63d1:0:b0:461:6c4a:bcd2 with SMTP id n17-20020a6563d1000000b004616c4abcd2mr6231193pgv.482.1666169489092; Wed, 19 Oct 2022 01:51:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169489; cv=none; d=google.com; s=arc-20160816; b=o/UzQHhqS2csMIRRHTNrl5AExTZTasdCn3dWBWIkoyqvDM64V5ijbY7NjeAU+iHH51 r9faLfjoRrawv+D24Kp3SGCOcpZGJOYpVkTSkhugFPCH8Anf7dVDln5HMyzngFN8DIrv 6XoqiQTfjjcrcKRVvGS93a6lgkwVRwPNeGHQ4hqVL6a9ItuaEmEY+eg5LHfOjNgKASa8 6HFxweR0Dq/EipzhBxklVfquaaZsitbmVro0BX9Awdf1hauenJyF9CROPDjJ3MaZkKnH gsQNixvLLhOmkjTv425R794CC4gNPAn8vBbKMCblSerBCX5JmoExFPZGGc6F7LmorspH cXhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ywnzyajHVH5P4coVgM62eanHHKFBJKO0DVFgQNg3oTM=; b=wxnQjAdtq2UqOM63qDWNl5hSjX/MGgFNFxui5Ai5zX/ZsAGw+Tmyz7rPg/ihpk7lzK OKA3jvy6Ll7grqx/0E5gFVR0DK1mGka9tbZ5Oxx/W4MvrFp4YwOD3ci/EzVKN2ch/Hpi Bb2tqyk4ulrS7e9lD7gCgIU3BXzvIioiJPPty5OirJlAK6T+ZH5Bsk/R9fEAws0IVmyP F/0mY5GudMRP+eT32BwAJ476KUdx0rroonKltrc8vdfrAiDECB+UpLVqF6MHS2lZAKB6 SuJ5z0xqvmDXqmE41ze132yIvfGTjDLGqKIDZAXfNel13KqZfxYD/yz+Ska49N8PsHzl ycTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CW39fem4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c11-20020a170902b68b00b0017f617a2fffsi17507148pls.250.2022.10.19.01.51.16; Wed, 19 Oct 2022 01: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=CW39fem4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231584AbiJSIu5 (ORCPT + 99 others); Wed, 19 Oct 2022 04:50:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231527AbiJSIsw (ORCPT ); Wed, 19 Oct 2022 04:48: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 0C0D08991A; Wed, 19 Oct 2022 01:46:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6270861828; Wed, 19 Oct 2022 08:46:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70BCAC433D6; Wed, 19 Oct 2022 08:46:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169171; bh=KqCEdkhPcHZPtHS5XUueyb73weNWSVVYIaiahVplhzQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CW39fem43/Fg3UnYqbn8fJ/LnBnVXfwkqEtkyB2X1jQPsDNGsC4eTYeZYmed8le7h Fx7IAPrK8QVBTfb/e17TwJ/Y5U/vXPwsH22+y981dEMYTGi/EIjisQLnJO5xIYye9F WoNJHoHRzZhLFHmeM3wDbvzt7ubMNUwVdwqhNPA0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jianglei Nie , Lyude Paul , Thierry Reding Subject: [PATCH 6.0 181/862] drm/nouveau: fix a use-after-free in nouveau_gem_prime_import_sg_table() Date: Wed, 19 Oct 2022 10:24:28 +0200 Message-Id: <20221019083257.955316963@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105338435022042?= X-GMAIL-MSGID: =?utf-8?q?1747105338435022042?= From: Jianglei Nie commit 540dfd188ea2940582841c1c220bd035a7db0e51 upstream. nouveau_bo_init() is backed by ttm_bo_init() and ferries its return code back to the caller. On failures, ttm will call nouveau_bo_del_ttm() and free the memory.Thus, when nouveau_bo_init() returns an error, the gem object has already been released. Then the call to nouveau_bo_ref() will use the freed "nvbo->bo" and lead to a use-after-free bug. We should delete the call to nouveau_bo_ref() to avoid the use-after-free. Signed-off-by: Jianglei Nie Reviewed-by: Lyude Paul Signed-off-by: Lyude Paul Fixes: 019cbd4a4feb ("drm/nouveau: Initialize GEM object before TTM object") Cc: Thierry Reding Cc: # v5.4+ Link: https://patchwork.freedesktop.org/patch/msgid/20220705132546.2247677-1-niejianglei2021@163.com Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/nouveau/nouveau_prime.c | 1 - 1 file changed, 1 deletion(-) --- a/drivers/gpu/drm/nouveau/nouveau_prime.c +++ b/drivers/gpu/drm/nouveau/nouveau_prime.c @@ -71,7 +71,6 @@ struct drm_gem_object *nouveau_gem_prime ret = nouveau_bo_init(nvbo, size, align, NOUVEAU_GEM_DOMAIN_GART, sg, robj); if (ret) { - nouveau_bo_ref(NULL, &nvbo); obj = ERR_PTR(ret); goto unlock; } From patchwork Wed Oct 19 08:24: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: 5094 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp249855wrs; Wed, 19 Oct 2022 03:47:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4eekVIlxm5Rxx5ckzshUBP+7DszEkf+lNnxAmNBRDuGGIFqqscWGRJ/UzbBHdvkcitYXWz X-Received: by 2002:a62:cfc2:0:b0:565:cbcd:b0a3 with SMTP id b185-20020a62cfc2000000b00565cbcdb0a3mr7696882pfg.73.1666176436256; Wed, 19 Oct 2022 03:47:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176436; cv=none; d=google.com; s=arc-20160816; b=rpGz5hmOXRLXHVq17KJE8gZnB3VmZSI17AU/eoNyTBq3O3SP8JlnS8uGZ5Hs4a0G44 JJyN/T4cRHndKK5Eer4DTITYL2UUPhf7HhHgje5b4Eiv5w8QpkUSCosuhBktWaOynUp8 7xHuUB6PQk1jbQjQPnszLliXoNDjaAqgbSzewiWPOMOVLNfZDxNFy+8W1saNp/eobQUC ZgjExfN8Z91ewutQxDptUJtdiCwhU5prY6dY8Wr7xgF9xLsw8rGp/WjzcolXWuFI5QFl fXnEDJLXz9hWMVN8dvmhLzagpCDwWfVOAUTbzZ1YyBr18dO8f7BmMKvBRBv1Ybe4j6NI NChA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YQU4/J89nvx8QNpX2gM38jVsZiNr5+cXX9/Xqo2Q49c=; b=noOJ6FoqmQYKz9kyHT5EULLE9mF1daGT5386xA6cLuln8flPhnemgszNhAD86A4bFd V87LZl31Z2xGh/CMZ6ZGS+KkJYtMw7ukmamcnmCFKw3tonkkimQwuUFO/4P6y/w5tmMY iyUAXJWgJcEM4dHCndo3if313EZVWGCeHbGvnn9809CYWBegEDsQH98MapTcB1GSbtJc W9+fHGfSddsnqgxraKLOqbgtRhewVF+U2yTwM7PDhd1YE/LUfk3MXIqG1+39mw5oohCg AajB217oX74syksPhTZMpXyZu+5Hk+YwxsThLFLGKxIfTLMLpmjLeY6Mb1sAtGfgrY7s VaTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xodJ1XKq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f10-20020a170902ce8a00b00176675b0cf2si21433232plg.381.2022.10.19.03.47.02; Wed, 19 Oct 2022 03:47: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=xodJ1XKq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233392AbiJSKqo (ORCPT + 99 others); Wed, 19 Oct 2022 06:46:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233332AbiJSKoj (ORCPT ); Wed, 19 Oct 2022 06:44: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 330DE112C; Wed, 19 Oct 2022 03:21:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DAA3FB822DE; Wed, 19 Oct 2022 08:46:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E903C433D6; Wed, 19 Oct 2022 08:46:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169174; bh=Z5u/4kskGVbcyMVpAm9IC/je4fIBuE6fauWq6ihOXDY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xodJ1XKq3rHQiKHpq6bpd7xh2/wN1yfVEhQ3vjoPohhznkQCB1Ill2+X/QII4wv4e mTbsfu1DR8j9uHvWVyrhJ7JQxmXkSZfciOVkOpuxcA+9Mudb/z5sBTxrI0QmSuLrnv uKH/XwP3rY+4QyiMzFL5m23WGxbO5XXWtMxE9NnM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chris Wilson , =?utf-8?q?Thomas_Hellstr=C3=B6m?= , Matthew Auld , Tvrtko Ursulin Subject: [PATCH 6.0 182/862] drm/i915/gt: Use i915_vm_put on ppgtt_create error paths Date: Wed, 19 Oct 2022 10:24:29 +0200 Message-Id: <20221019083257.998774171@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112623198288062?= X-GMAIL-MSGID: =?utf-8?q?1747112623198288062?= From: Chris Wilson commit 20e377e7b2e7c327039f10db80ba5bcc1f6c882d upstream. Now that the scratch page and page directories have a reference back to the i915_address_space, we cannot do an immediate free of the ppgtt upon error as those buffer objects will perform a later i915_vm_put in their deferred frees. The downside is that by replacing the onion unwind along the error paths, the ppgtt cleanup must handle a partially constructed vm. This includes ensuring that the vm->cleanup is set prior to the error path. Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/6900 Signed-off-by: Chris Wilson Fixes: 4d8151ae5329 ("drm/i915: Don't free shared locks while shared") Cc: Thomas Hellström Cc: Matthew Auld Cc: # v5.14+ Reviewed-by: Matthew Auld Signed-off-by: Matthew Auld Link: https://patchwork.freedesktop.org/patch/msgid/20220926153333.102195-1-matthew.auld@intel.com (cherry picked from commit c286558f58535cf97b717b946d6c96d774a09d17) Signed-off-by: Tvrtko Ursulin Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/i915/gt/gen6_ppgtt.c | 16 ++++----- drivers/gpu/drm/i915/gt/gen8_ppgtt.c | 58 ++++++++++++++++++----------------- drivers/gpu/drm/i915/gt/intel_gtt.c | 3 + 3 files changed, 41 insertions(+), 36 deletions(-) --- a/drivers/gpu/drm/i915/gt/gen6_ppgtt.c +++ b/drivers/gpu/drm/i915/gt/gen6_ppgtt.c @@ -247,6 +247,7 @@ err_scratch1: i915_gem_object_put(vm->scratch[1]); err_scratch0: i915_gem_object_put(vm->scratch[0]); + vm->scratch[0] = NULL; return ret; } @@ -268,9 +269,10 @@ static void gen6_ppgtt_cleanup(struct i9 gen6_ppgtt_free_pd(ppgtt); free_scratch(vm); - mutex_destroy(&ppgtt->flush); + if (ppgtt->base.pd) + free_pd(&ppgtt->base.vm, ppgtt->base.pd); - free_pd(&ppgtt->base.vm, ppgtt->base.pd); + mutex_destroy(&ppgtt->flush); } static void pd_vma_bind(struct i915_address_space *vm, @@ -449,19 +451,17 @@ struct i915_ppgtt *gen6_ppgtt_create(str err = gen6_ppgtt_init_scratch(ppgtt); if (err) - goto err_free; + goto err_put; ppgtt->base.pd = gen6_alloc_top_pd(ppgtt); if (IS_ERR(ppgtt->base.pd)) { err = PTR_ERR(ppgtt->base.pd); - goto err_scratch; + goto err_put; } return &ppgtt->base; -err_scratch: - free_scratch(&ppgtt->base.vm); -err_free: - kfree(ppgtt); +err_put: + i915_vm_put(&ppgtt->base.vm); return ERR_PTR(err); } --- a/drivers/gpu/drm/i915/gt/gen8_ppgtt.c +++ b/drivers/gpu/drm/i915/gt/gen8_ppgtt.c @@ -196,7 +196,10 @@ static void gen8_ppgtt_cleanup(struct i9 if (intel_vgpu_active(vm->i915)) gen8_ppgtt_notify_vgt(ppgtt, false); - __gen8_ppgtt_cleanup(vm, ppgtt->pd, gen8_pd_top_count(vm), vm->top); + if (ppgtt->pd) + __gen8_ppgtt_cleanup(vm, ppgtt->pd, + gen8_pd_top_count(vm), vm->top); + free_scratch(vm); } @@ -803,8 +806,10 @@ static int gen8_init_scratch(struct i915 struct drm_i915_gem_object *obj; obj = vm->alloc_pt_dma(vm, I915_GTT_PAGE_SIZE_4K); - if (IS_ERR(obj)) + if (IS_ERR(obj)) { + ret = PTR_ERR(obj); goto free_scratch; + } ret = map_pt_dma(vm, obj); if (ret) { @@ -823,7 +828,8 @@ static int gen8_init_scratch(struct i915 free_scratch: while (i--) i915_gem_object_put(vm->scratch[i]); - return -ENOMEM; + vm->scratch[0] = NULL; + return ret; } static int gen8_preallocate_top_level_pdp(struct i915_ppgtt *ppgtt) @@ -901,6 +907,7 @@ err_pd: struct i915_ppgtt *gen8_ppgtt_create(struct intel_gt *gt, unsigned long lmem_pt_obj_flags) { + struct i915_page_directory *pd; struct i915_ppgtt *ppgtt; int err; @@ -946,21 +953,7 @@ struct i915_ppgtt *gen8_ppgtt_create(str ppgtt->vm.alloc_scratch_dma = alloc_pt_dma; } - err = gen8_init_scratch(&ppgtt->vm); - if (err) - goto err_free; - - ppgtt->pd = gen8_alloc_top_pd(&ppgtt->vm); - if (IS_ERR(ppgtt->pd)) { - err = PTR_ERR(ppgtt->pd); - goto err_free_scratch; - } - - if (!i915_vm_is_4lvl(&ppgtt->vm)) { - err = gen8_preallocate_top_level_pdp(ppgtt); - if (err) - goto err_free_pd; - } + ppgtt->vm.pte_encode = gen8_pte_encode; ppgtt->vm.bind_async_flags = I915_VMA_LOCAL_BIND; ppgtt->vm.insert_entries = gen8_ppgtt_insert; @@ -971,22 +964,31 @@ struct i915_ppgtt *gen8_ppgtt_create(str ppgtt->vm.allocate_va_range = gen8_ppgtt_alloc; ppgtt->vm.clear_range = gen8_ppgtt_clear; ppgtt->vm.foreach = gen8_ppgtt_foreach; + ppgtt->vm.cleanup = gen8_ppgtt_cleanup; - ppgtt->vm.pte_encode = gen8_pte_encode; + err = gen8_init_scratch(&ppgtt->vm); + if (err) + goto err_put; + + pd = gen8_alloc_top_pd(&ppgtt->vm); + if (IS_ERR(pd)) { + err = PTR_ERR(pd); + goto err_put; + } + ppgtt->pd = pd; + + if (!i915_vm_is_4lvl(&ppgtt->vm)) { + err = gen8_preallocate_top_level_pdp(ppgtt); + if (err) + goto err_put; + } if (intel_vgpu_active(gt->i915)) gen8_ppgtt_notify_vgt(ppgtt, true); - ppgtt->vm.cleanup = gen8_ppgtt_cleanup; - return ppgtt; -err_free_pd: - __gen8_ppgtt_cleanup(&ppgtt->vm, ppgtt->pd, - gen8_pd_top_count(&ppgtt->vm), ppgtt->vm.top); -err_free_scratch: - free_scratch(&ppgtt->vm); -err_free: - kfree(ppgtt); +err_put: + i915_vm_put(&ppgtt->vm); return ERR_PTR(err); } --- a/drivers/gpu/drm/i915/gt/intel_gtt.c +++ b/drivers/gpu/drm/i915/gt/intel_gtt.c @@ -405,6 +405,9 @@ void free_scratch(struct i915_address_sp { int i; + if (!vm->scratch[0]) + return; + for (i = 0; i <= vm->top; i++) i915_gem_object_put(vm->scratch[i]); } From patchwork Wed Oct 19 08:24: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: 5087 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp249581wrs; Wed, 19 Oct 2022 03:46:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5mkwGE+Vj04ggaWZEzuc01F9Zsu5p6bTA313rJ5ObAiAh8HQW1+Q4Np869EyXjxXw+vk9C X-Received: by 2002:a17:903:2c9:b0:182:c500:d93d with SMTP id s9-20020a17090302c900b00182c500d93dmr7981333plk.44.1666176397250; Wed, 19 Oct 2022 03:46:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176397; cv=none; d=google.com; s=arc-20160816; b=MfbYGm9gMJSscuXcRUdRBp6J8FNlJ60BTWsWmiZV/RYAShZlQHbNvV3ynL4uKr1Qq/ 98pler2foDQQmha3Ov3u8BcJHGPAIuFni8/BAmsnfe1avOba9PmZbZFMwY2MQyQqh9oD 7/Cm7UOqrQi1YZ5bnXiwWZSU9lQjtQdoY9ZScKzcxRqvufVryyfqXoPZig36kcsZ4P8o uIk7iFQLfvP+sjmnppnLm8zl55Wr5OCJsOB1bvNpDehfLeFD6JtkTnbEbNOIH2IwPW8X DFjECoRLuZ07+020fmZwMKVTLJRbSVaj/G22RNxjtbf8XVcGAERGBCx5DB0kKSnPV083 /2Dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=LL6GbWTAQ009rrBFVZA4bzCjl8u9xg91HDcGI0UBEmg=; b=mezMLGLzGXjfooUuC0FJIyMbvkT4hONE864Gw/zlpBe2oxXux4hobAa76pJq0TWszg jek+woo82w8XyHADgwGWwg8GEcZMsOUB45aZRZ2HfvTQbgvedMvZI5paNAZKS3j+LXM8 djVHNvk6IVAQKgFzer5QPfAWo+XrbZVjzVddW/aXtZKExaHuQEus/2a7dgMYA3/XwMDl dZld92mGIbMp0wPtyfu9c33eCIew4hzJ+T2yEN2HjS/EV+dJuZifanBe2wAiWFgE9YUf x6pSrRWcftkECZUnIwoxfABUAvU1thOZZDkeVuTbhV07ABfsZlHt9Pfkc7CYbrue4rms 2+Qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eU03hgMA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a17090b4d0b00b0020d8764b9a4si20790576pjb.48.2022.10.19.03.46.23; Wed, 19 Oct 2022 03:46: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=eU03hgMA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233059AbiJSKqD (ORCPT + 99 others); Wed, 19 Oct 2022 06:46:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233050AbiJSKo2 (ORCPT ); Wed, 19 Oct 2022 06:44: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 70E79159D63; Wed, 19 Oct 2022 03:21:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D65E1B822E2; Wed, 19 Oct 2022 08:46:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36690C433C1; Wed, 19 Oct 2022 08:46:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169177; bh=Ax5KO/F8Qs3odERen+hCIo5ZvjrN+avr3X0K3Ob5bsw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eU03hgMAWKaHDxsq2kDroILH0QyMy8vrruvoyh3mjNZOiIy5ZSSfCYEI3Wb2c3Z0G 8FUJJPLuDRyfB3MiwEd7vCQl6tH57ZZVHnOLOzMG2BOQv1+BMVoumTWJXf1605JJ2R J2JTnoj598IsyD0m1+rRTqEhraU/rkubVXz191ME= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tvrtko Ursulin , Andrzej Hajda , John Harrison , Daniele Ceraolo Spurio Subject: [PATCH 6.0 183/862] drm/i915/guc: Fix revocation of non-persistent contexts Date: Wed, 19 Oct 2022 10:24:30 +0200 Message-Id: <20221019083258.048982114@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112581588471553?= X-GMAIL-MSGID: =?utf-8?q?1747112581588471553?= From: Tvrtko Ursulin commit 7023472834a39341460dae5c9b506c76c5940cad upstream. Patch which added graceful exit for non-persistent contexts missed the fact it is not enough to set the exiting flag on a context and let the backend handle it from there. GuC backend cannot handle it because it runs independently in the firmware and driver might not see the requests ever again. Patch also missed the fact some usages of intel_context_is_banned in the GuC backend needed replacing with newly introduced intel_context_is_schedulable. Fix the first issue by calling into backend revoke when we know this is the last chance to do it. Fix the second issue by replacing intel_context_is_banned with intel_context_is_schedulable, which should always be safe since latter is a superset of the former. v2: * Just call ce->ops->revoke unconditionally. (Andrzej) Signed-off-by: Tvrtko Ursulin Fixes: 45c64ecf97ee ("drm/i915: Improve user experience and driver robustness under SIGINT or similar") Cc: Andrzej Hajda Cc: John Harrison Cc: Daniele Ceraolo Spurio Cc: # v6.0+ Reviewed-by: Andrzej Hajda Acked-by: Daniele Ceraolo Spurio Link: https://patchwork.freedesktop.org/patch/msgid/20221003121630.694249-1-tvrtko.ursulin@linux.intel.com (cherry picked from commit 0add082cebac8555ee3972ba768ae5c01db7a498) Signed-off-by: Tvrtko Ursulin Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/i915/gem/i915_gem_context.c | 8 ------ drivers/gpu/drm/i915/gt/intel_context.c | 5 +--- drivers/gpu/drm/i915/gt/intel_context.h | 3 -- drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c | 26 +++++++++++----------- 4 files changed, 17 insertions(+), 25 deletions(-) --- a/drivers/gpu/drm/i915/gem/i915_gem_context.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_context.c @@ -1387,14 +1387,8 @@ kill_engines(struct i915_gem_engines *en */ for_each_gem_engine(ce, engines, it) { struct intel_engine_cs *engine; - bool skip = false; - if (exit) - skip = intel_context_set_exiting(ce); - else if (!persistent) - skip = intel_context_exit_nonpersistent(ce, NULL); - - if (skip) + if ((exit || !persistent) && intel_context_revoke(ce)) continue; /* Already marked. */ /* --- a/drivers/gpu/drm/i915/gt/intel_context.c +++ b/drivers/gpu/drm/i915/gt/intel_context.c @@ -614,13 +614,12 @@ bool intel_context_ban(struct intel_cont return ret; } -bool intel_context_exit_nonpersistent(struct intel_context *ce, - struct i915_request *rq) +bool intel_context_revoke(struct intel_context *ce) { bool ret = intel_context_set_exiting(ce); if (ce->ops->revoke) - ce->ops->revoke(ce, rq, ce->engine->props.preempt_timeout_ms); + ce->ops->revoke(ce, NULL, ce->engine->props.preempt_timeout_ms); return ret; } --- a/drivers/gpu/drm/i915/gt/intel_context.h +++ b/drivers/gpu/drm/i915/gt/intel_context.h @@ -329,8 +329,7 @@ static inline bool intel_context_set_exi return test_and_set_bit(CONTEXT_EXITING, &ce->flags); } -bool intel_context_exit_nonpersistent(struct intel_context *ce, - struct i915_request *rq); +bool intel_context_revoke(struct intel_context *ce); static inline bool intel_context_force_single_submission(const struct intel_context *ce) --- a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c @@ -684,7 +684,7 @@ static int __guc_add_request(struct inte * Corner case where requests were sitting in the priority list or a * request resubmitted after the context was banned. */ - if (unlikely(intel_context_is_banned(ce))) { + if (unlikely(!intel_context_is_schedulable(ce))) { i915_request_put(i915_request_mark_eio(rq)); intel_engine_signal_breadcrumbs(ce->engine); return 0; @@ -870,15 +870,15 @@ static int guc_wq_item_append(struct int struct i915_request *rq) { struct intel_context *ce = request_to_scheduling_context(rq); - int ret = 0; + int ret; - if (likely(!intel_context_is_banned(ce))) { - ret = __guc_wq_item_append(rq); + if (unlikely(!intel_context_is_schedulable(ce))) + return 0; - if (unlikely(ret == -EBUSY)) { - guc->stalled_request = rq; - guc->submission_stall_reason = STALL_MOVE_LRC_TAIL; - } + ret = __guc_wq_item_append(rq); + if (unlikely(ret == -EBUSY)) { + guc->stalled_request = rq; + guc->submission_stall_reason = STALL_MOVE_LRC_TAIL; } return ret; @@ -897,7 +897,7 @@ static bool multi_lrc_submit(struct i915 * submitting all the requests generated in parallel. */ return test_bit(I915_FENCE_FLAG_SUBMIT_PARALLEL, &rq->fence.flags) || - intel_context_is_banned(ce); + !intel_context_is_schedulable(ce); } static int guc_dequeue_one_context(struct intel_guc *guc) @@ -966,7 +966,7 @@ register_context: struct intel_context *ce = request_to_scheduling_context(last); if (unlikely(!ctx_id_mapped(guc, ce->guc_id.id) && - !intel_context_is_banned(ce))) { + intel_context_is_schedulable(ce))) { ret = try_context_registration(ce, false); if (unlikely(ret == -EPIPE)) { goto deadlk; @@ -1576,7 +1576,7 @@ static void guc_reset_state(struct intel { struct intel_engine_cs *engine = __context_to_physical_engine(ce); - if (intel_context_is_banned(ce)) + if (!intel_context_is_schedulable(ce)) return; GEM_BUG_ON(!intel_context_is_pinned(ce)); @@ -4434,12 +4434,12 @@ static void guc_handle_context_reset(str { trace_intel_context_reset(ce); - if (likely(!intel_context_is_banned(ce))) { + if (likely(intel_context_is_schedulable(ce))) { capture_error_state(guc, ce); guc_context_replay(ce); } else { drm_info(&guc_to_gt(guc)->i915->drm, - "Ignoring context reset notification of banned context 0x%04X on %s", + "Ignoring context reset notification of exiting context 0x%04X on %s", ce->guc_id.id, ce->engine->name); } } From patchwork Wed Oct 19 08:24:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5111 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp250896wrs; Wed, 19 Oct 2022 03:50:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4zSszH0BK77rOz/EZiwK1i0AXQ++rvCx9oQWKP7rbg6yG5cMcEFk5QSghNBQFs+UyzWTHa X-Received: by 2002:a17:907:a46:b0:782:1c1c:8141 with SMTP id be6-20020a1709070a4600b007821c1c8141mr6077739ejc.549.1666176618858; Wed, 19 Oct 2022 03:50:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176618; cv=none; d=google.com; s=arc-20160816; b=qF3lG9AHiAdMCqlMwxifHvrOT+iS4/9jaNpHR3S/mm2lU4whkrgiwcO3IMQ+rL9ws5 jzDAQXYrC+Twd+wLze/tZWQkKuXJwxVjNRsLQ6du0dBSrJwTW7kbfWNRKKaIwKkJ0sEV gh8ZGk+zeKJFxNs/j2zcBPhXz+l7UxGAmq0/C1tORysN2FvIhd3MJktXpo8Ymw/Hhd0s F/FPAYwjiJL2hQG7ZopWhyVWH6Qys8W2He4Jm0u6pxwq1BwkHFkJXsxtBEGkLOsMfWzd a/zUxEw1kEnpQ5DldLZLNUiL6k3mEw2mCmsZ+ZNe51jZuX2DJLV476Nl4SImHAjO/GRw qstw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=cQA17N2pvVjeYoPpZEPdWSpy9WeWydnNAZKfhbHDMug=; b=SbY8lai/0+uqpl8MSYenbNDhkZScX7cJRlVbe/sJsgSgOlwLj9kCO5VK5JkP8AIqtf lUzWgvT0x5N0y/KMDIa+eEHMFG5KmFHTBVjkUpGm9s7XIkr0enVJ6ARdmjzQdvTQwmcZ J0HbfdlaPDrOPlHtuQnVA9X/75heAFz18Tt0Ib04zqri2QEoC2cvYYbvtyUrhCH7PbKZ Lr+dCIKZj2Ksp7OoDOlAYGkG1kHVfum4ItWwsl5bmMQzPRwfwUIhs3b8SLmHvFl92eoW t76YjnKX9IsFGiViF13eyzwceKv6nvBnrYQp4ZOXsgGUQrp1h498/Z74INP/OjKkWMpc gJHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IynA3pYS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a1-20020a1709065f8100b0078d85777c4fsi11175263eju.700.2022.10.19.03.49.53; Wed, 19 Oct 2022 03: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=IynA3pYS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234144AbiJSKsN (ORCPT + 99 others); Wed, 19 Oct 2022 06:48:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233068AbiJSKqF (ORCPT ); Wed, 19 Oct 2022 06:46:05 -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 765DE159D70; Wed, 19 Oct 2022 03:21: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 B4C8DB8231C; Wed, 19 Oct 2022 08:46:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 107C2C433C1; Wed, 19 Oct 2022 08:46:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169180; bh=xwHQWNsYn3Or5OrXrKPv2yIcVls6JsV0g5IlJbwGUS8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IynA3pYSUbjqRuQxpAKKs4coJLLa3EiNUxKLQg003943wuje0ohX70KAwIur/64qm Hltj1HEdd2hlHDN75kjgEoqQOjrkX1AFrgeexqQLhRzpHmedWtwZP7tioKH6Ys8TSE +484mCldzuKm4kYUnGTEiThRJPsp0sJfw4eECH/Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Juha-Pekka Heikkila , =?utf-8?b?VmlsbGUgU3ly?= =?utf-8?b?asOkbMOk?= , Tvrtko Ursulin Subject: [PATCH 6.0 184/862] drm/i915: Fix watermark calculations for gen12+ RC CCS modifier Date: Wed, 19 Oct 2022 10:24:31 +0200 Message-Id: <20221019083258.084124043@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112814361702624?= X-GMAIL-MSGID: =?utf-8?q?1747112814361702624?= From: Ville Syrjälä commit c56453a00f19ccddee302f5f9fe96b80e0b47fd3 upstream. Take the gen12+ RC CCS modifier into account when calculating the watermarks. Othwerwise we'll calculate the watermarks thinking this Y-tiled modifier is linear. The rc_surface part is actually a nop since that is not used for any glk+ platform. v2: Split RC CCS vs. MC CCS to separate patches Cc: stable@vger.kernel.org Fixes: b3e57bccd68a ("drm/i915/tgl: Gen-12 render decompression") Reviewed-by: Juha-Pekka Heikkila Signed-off-by: Ville Syrjälä Link: https://patchwork.freedesktop.org/patch/msgid/20221003111544.8007-2-ville.syrjala@linux.intel.com (cherry picked from commit a89a96a586114f67598c6391c75678b4dba5c2da) Signed-off-by: Tvrtko Ursulin Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/i915/intel_pm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@ -5308,10 +5308,12 @@ skl_compute_wm_params(const struct intel modifier == I915_FORMAT_MOD_4_TILED || modifier == I915_FORMAT_MOD_Yf_TILED || modifier == I915_FORMAT_MOD_Y_TILED_CCS || - modifier == I915_FORMAT_MOD_Yf_TILED_CCS; + modifier == I915_FORMAT_MOD_Yf_TILED_CCS || + modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS; wp->x_tiled = modifier == I915_FORMAT_MOD_X_TILED; wp->rc_surface = modifier == I915_FORMAT_MOD_Y_TILED_CCS || - modifier == I915_FORMAT_MOD_Yf_TILED_CCS; + modifier == I915_FORMAT_MOD_Yf_TILED_CCS || + modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS; wp->is_planar = intel_format_info_is_yuv_semiplanar(format, modifier); wp->width = width; From patchwork Wed Oct 19 08:24: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: 5136 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp252005wrs; Wed, 19 Oct 2022 03:53:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7HK1wI2BlP4eVbA5b+W7lYRJwkYyQK/sTtXEglTjgZnVtOs9Aw3huL5yUWM+UqGWtLw7rD X-Received: by 2002:a05:6402:c45:b0:442:c549:8e6b with SMTP id cs5-20020a0564020c4500b00442c5498e6bmr6878136edb.123.1666176798701; Wed, 19 Oct 2022 03:53:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176798; cv=none; d=google.com; s=arc-20160816; b=n41lXpaCvG/j4MTiyDEgPERD7vQKyHlCJxuisZyq5y7ldqvHQSgM4pE/VLcahdqd/E ahHcYEJutBxAsq1bMsXJpPPreHAaGN8ye8y3+zLlJixjQHz2EINN677KvyOWGPDuDP4/ 5WC3odeJ2YhrsvM4TpNgrxGpB6nU9iDUQ21tWHMkk5GtveUKO1XVys4RGynUBfZHuRG7 swCVdN/WqgAJpGblf6TMHBZ6klJBKYG35H/y/E8ld/lXQ4JfXWTccidp48ESq4isvP/X IkEqc0dDWZL6dkxrAW7C4XoeaBTVA/vJVuJElqENfPgFpERQoOZaH7v6k8gEgKJn7oyl CiJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=p0J+yYnrCxm9EZhXT1g5tdmVD68IzTcQ1xxDMVpeUZM=; b=BXxNvY24Fljpi9rmQWuEEH7b2wUkiw9obailoLI7RgQdGACIEd7S7WkPUl16bDbCQv qGv0nDF6FfT2GO7jDURA0QI6QBgWlifxgUo93xEvlJ5OBu0QSXGkThwcsWnaskp7Bz1d 4txPqOnNdibC/okXbsn6ZHs8lBvppqJPbn3+plHXBGCMIMk5Oif9f9Zr3lhpIokjuzbn Tr4zOS0xT9Yu7G/Irj9ZeVxecxZk5qo1brzH7hPtxsqXl9qzyJeQzqBySf/EUWVM9Icv 9sOtCvlVUspfMqgom6CdFjr5l+jh2f1jyyKVgJK/FUS9H9FK4cCG7XSspgM1sQ+De2Iq KvWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Hb5NLcPH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id md8-20020a170906ae8800b007828388864dsi10889755ejb.692.2022.10.19.03.52.54; Wed, 19 Oct 2022 03:53: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=Hb5NLcPH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234201AbiJSKu3 (ORCPT + 99 others); Wed, 19 Oct 2022 06:50:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233331AbiJSKru (ORCPT ); Wed, 19 Oct 2022 06:47: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 E3B881162E3; Wed, 19 Oct 2022 03:21: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 6F291B82318; Wed, 19 Oct 2022 08:46:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD0B7C433D6; Wed, 19 Oct 2022 08:46:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169183; bh=PmWEDGHSBbioyrBpd3fr99GqAeaSC72l+k2qhhNiy2U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hb5NLcPHyV96D6I4zQksXya5SY7QanhzDhwDpD/Z/w7hitOj+PfsHRBnBZFZbPblB PK7MRv4oajKYwXjTUPAOCyL3U3/G9Qyg/Bw5hidoijMWuxL2HlLeWprVZ9oAy12OVr KoVxMoJntMZ8rr6kAQ7Ghn72f+TGOU4aiVzHV14E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Juha-Pekka Heikkila , =?utf-8?b?VmlsbGUgU3ly?= =?utf-8?b?asOkbMOk?= , Tvrtko Ursulin Subject: [PATCH 6.0 185/862] drm/i915: Fix watermark calculations for gen12+ MC CCS modifier Date: Wed, 19 Oct 2022 10:24:32 +0200 Message-Id: <20221019083258.128341743@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747113002766772884?= X-GMAIL-MSGID: =?utf-8?q?1747113002766772884?= From: Ville Syrjälä commit 484b2b9281000274ef7c5cb0a9ebc5da6f5c281c upstream. Take the gen12+ MC CCS modifier into account when calculating the watermarks. Othwerwise we'll calculate the watermarks thinking this Y-tiled modifier is linear. The rc_surface part is actually a nop since that is not used for any glk+ platform. v2: Split RC CCS vs. MC CCS to separate patches Cc: stable@vger.kernel.org Fixes: 2dfbf9d2873a ("drm/i915/tgl: Gen-12 display can decompress surfaces compressed by the media engine") Reviewed-by: Juha-Pekka Heikkila Signed-off-by: Ville Syrjälä Link: https://patchwork.freedesktop.org/patch/msgid/20221003111544.8007-3-ville.syrjala@linux.intel.com (cherry picked from commit 91c9651425fe955b1387f3637607dda005f3f710) Signed-off-by: Tvrtko Ursulin Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/i915/intel_pm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@ -5309,11 +5309,13 @@ skl_compute_wm_params(const struct intel modifier == I915_FORMAT_MOD_Yf_TILED || modifier == I915_FORMAT_MOD_Y_TILED_CCS || modifier == I915_FORMAT_MOD_Yf_TILED_CCS || - modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS; + modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS || + modifier == I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS; wp->x_tiled = modifier == I915_FORMAT_MOD_X_TILED; wp->rc_surface = modifier == I915_FORMAT_MOD_Y_TILED_CCS || modifier == I915_FORMAT_MOD_Yf_TILED_CCS || - modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS; + modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS || + modifier == I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS; wp->is_planar = intel_format_info_is_yuv_semiplanar(format, modifier); wp->width = width; From patchwork Wed Oct 19 08:24:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5192 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp263990wrs; Wed, 19 Oct 2022 04:19:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7MUi1ueLFRRaFYD8AeCVhKOM1ZjPeBhzY0TisxuV+YQL67w/6q3hfGaeD2PfcpBt26Al68 X-Received: by 2002:a63:d90c:0:b0:462:cfa2:285b with SMTP id r12-20020a63d90c000000b00462cfa2285bmr6808555pgg.202.1666178351434; Wed, 19 Oct 2022 04:19:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178351; cv=none; d=google.com; s=arc-20160816; b=Mi9J0j75557xE6xPI6KaXfNWGuoE8cLaoGJ86zrJD4f25D+klvxiiuF5hL3kKK0GNe cgjlPELQUyVLbkWrhlB/pJV9SRITqarVPObI2nly6xbUyH6CBH2b13TzUZg3/rDyfoU2 oVjsGP3M9M9POuWO8vAILg3Gc6gWhYfCc+xZ2NzcZm/xVBD54x6e6sZFmtvpQb3XGQzf THr+oiMRzW+7kDAnGNFwhH5ebZxwpVXd3dFxuOVRRpuO9Fn8CvaKFnoaUSp/hW0W+140 r1PY4ORGJWq+uO0CRn7geidyGH7L5Vb5z3Hn7faZxxf6jMJ1CYLqSy7CDKvaIeQyHErg M5eA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nu5ru0hLTE8o+symXqVPbhNCKCyvIah2eh7AgF3o5Ww=; b=FtC34Y4Zam/o9zxjCTW3Gs+usysw74PxMKSYc/xUeUhCgv09Y7kzt+aotWZexnkWpI ewV+wUmIe0udlSbxXlPbYWT7TvPXHBYaMUB10QCFbHq85ErFI//yOtkorqux8Ai6/MtJ vOQUQ4pFSUcJhNA+qrl8AxbFvrN88WkwmW2M0Ak6ibCUdtYQ2XX9CDrWLwabS1K7EeJ3 Mx3Yg5ND8TnQu2agHfwmRSYIxggZIqRKx3VoCJlS1yNOSzfyts2zK0L4CXn0zj3o1a6F XhUgwY9jIVvxLefMGxWFllR8GYISvqUdosrntt6JGaO5VsSFw7ZIbWsSTkJgTJ/UTjzz s6Sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VBY99xI6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w4-20020a656944000000b004370503d42dsi17900529pgq.554.2022.10.19.04.18.49; Wed, 19 Oct 2022 04:19: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=VBY99xI6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233438AbiJSLGQ (ORCPT + 99 others); Wed, 19 Oct 2022 07:06:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232018AbiJSLFY (ORCPT ); Wed, 19 Oct 2022 07:05:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D5E022BE3; Wed, 19 Oct 2022 03:34: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 9DB4D61835; Wed, 19 Oct 2022 08:46:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A9F86C433C1; Wed, 19 Oct 2022 08:46:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169186; bh=Wkw0QbIHnTEca00uSpzVXZ9ouI36rhpJUoG3jX/xkOU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VBY99xI6sYOe0GapNAM5Xh5otU5bzIC4UwchCaHheZ8GJiRxANAGfuHIOWdGgc4sO 4NQSYsYMtILwYR0nC4Tdt5LNJJzfYOlbA599nqeNTcv54I3MYq8K6O9vRcxp89wTuX jTz85fVbC26wZ5t263DG4czsZaW8D2XMIzgIJa88= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Juha-Pekka Heikkila , =?utf-8?b?VmlsbGUgU3ly?= =?utf-8?b?asOkbMOk?= , Tvrtko Ursulin Subject: [PATCH 6.0 186/862] drm/i915: Fix watermark calculations for gen12+ CCS+CC modifier Date: Wed, 19 Oct 2022 10:24:33 +0200 Message-Id: <20221019083258.177171662@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114631176640426?= X-GMAIL-MSGID: =?utf-8?q?1747114631176640426?= From: Ville Syrjälä commit 070a2855900de17b1e11a0dc35af9794e80f1a28 upstream. Take the gen12+ CCS+CC modifier into account when calculating the watermarks. Othwerwise we'll calculate the watermarks thinking this Y-tiled modifier is linear. The rc_surface part is actually a nop since that is not used for any glk+ platform. Cc: stable@vger.kernel.org Fixes: d1e2775e9b96 ("drm/i915/tgl: Add Clear Color support for TGL Render Decompression") Reviewed-by: Juha-Pekka Heikkila Signed-off-by: Ville Syrjälä Link: https://patchwork.freedesktop.org/patch/msgid/20221003111544.8007-4-ville.syrjala@linux.intel.com (cherry picked from commit a627455bbe50a111475d7a42beb58fa64bd96c83) Signed-off-by: Tvrtko Ursulin Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/i915/intel_pm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@ -5310,12 +5310,14 @@ skl_compute_wm_params(const struct intel modifier == I915_FORMAT_MOD_Y_TILED_CCS || modifier == I915_FORMAT_MOD_Yf_TILED_CCS || modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS || - modifier == I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS; + modifier == I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS || + modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC; wp->x_tiled = modifier == I915_FORMAT_MOD_X_TILED; wp->rc_surface = modifier == I915_FORMAT_MOD_Y_TILED_CCS || modifier == I915_FORMAT_MOD_Yf_TILED_CCS || modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS || - modifier == I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS; + modifier == I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS || + modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC; wp->is_planar = intel_format_info_is_yuv_semiplanar(format, modifier); wp->width = width; From patchwork Wed Oct 19 08:24:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5320 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp285338wrs; Wed, 19 Oct 2022 05:07:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6y2PQ9g+vENkHAdaUnXfYu6i/2ORwVNGcNa7Jpv/9bakoReP79pj9U0AC0gqpi0i/py7OB X-Received: by 2002:a17:906:fd84:b0:730:acee:d067 with SMTP id xa4-20020a170906fd8400b00730aceed067mr6558417ejb.206.1666181257715; Wed, 19 Oct 2022 05:07:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666181257; cv=none; d=google.com; s=arc-20160816; b=st9UxUUOPvgpXjvH84U6Qz2VxL8WQMhmhBodZm6zsoGZhnunLyIFBF/9zALsxXCNZ2 TlUy2DfxI+mIy4FnWCfzGaWaz88j5qRoC1NsCrahk0Il9f571iL+5llnXQqSNkzi07Wq PDTb7gof5rpI4v08yx7sSotRq9GY4yJLhcvZaey49D8fTklLg1o5lT9yF3h2rAVshvg/ XY7AK5EOTBmCVpPStW3hCvYualzGwj0MShaeac0QVXnMdUtLOC88OKBLMoAmbN5MfrO8 uQDfGXQZffqYS+e1Vx/Z0XiymnAnPVPjbR3yu2PnpLjAMKiFgkCZgWEdqYboKYxx4/+P bCvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=CWCFqbO1zwuP0eNKHLcZhMwSilKpIRAF1U0CTv0G83Q=; b=ryjELJgBeqXneyQ2c72ny2qHYnGh8ZxIYnRVimKgbHMr19N8r+kUogRr5cGUK0QbJv Ni/gpsGHIUP9JefpMQ17zwLK7oMXDt711/UznPuX3nmEhiS3YewxpG58x+gGuSA4EidT i4ObuW03pGvdFsexPDpn7ltKlw01Rq3tI12i08DJ58uSu693G1TknPdgZWnBVpe9XtT8 TQzl3YMUIpHY0GW8YxfenLLWK7Oxb2lDd7voQIt6QeIQhIWzlcjZk4kmHHS/CjrQICiq iORaQRCbAkq9mDIeD8WpbRyuuxaIEy7/6CiSHsN3t0M8NzeJQRCCe7Cv6uaZEEElpdsq VjsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uoP5dakS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qa43-20020a17090786ab00b00782b261ea1asi13510109ejc.67.2022.10.19.05.07.09; Wed, 19 Oct 2022 05:07: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=uoP5dakS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232185AbiJSMAe (ORCPT + 99 others); Wed, 19 Oct 2022 08:00:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230452AbiJSL7b (ORCPT ); Wed, 19 Oct 2022 07:59:31 -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 77B3315789B; Wed, 19 Oct 2022 04:37: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 34371B822F4; Wed, 19 Oct 2022 08:46:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3018C43144; Wed, 19 Oct 2022 08:46:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169189; bh=AiLPool97ac6QJnM7DRsza2LPtxoZixDl189oVIKvvA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uoP5dakS0MGphAo51a650t5GigaCXftZrDh0Vbpj1MdI/raWrxzsuZZHnpt+u9Ucv BWimSPYZCV17/CjfrAdna3bBRUjJD83PTKskTp/wl/ki3f5TFvNIiLglORpwoFFtl0 y+JGhXrdByMwH9Dlfuzi4v2U6rnGYJLNCmkQhbI0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Juha-Pekka Heikkila , =?utf-8?b?VmlsbGUgU3ly?= =?utf-8?b?asOkbMOk?= , Tvrtko Ursulin Subject: [PATCH 6.0 187/862] drm/i915: Fix watermark calculations for DG2 CCS modifiers Date: Wed, 19 Oct 2022 10:24:34 +0200 Message-Id: <20221019083258.226689974@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747117678423796662?= X-GMAIL-MSGID: =?utf-8?q?1747117678423796662?= From: Ville Syrjälä commit ccfa6d35f9233702c924316cdf40c05b6ce88113 upstream. Take the DG2 CCS modifiers into account when calculating the watermarks. Othwerwise we'll calculate the watermarks thinking these tile-4 modifiers are linear. The rc_surface part is actually a nop since that is not used for any glk+ platform. Cc: stable@vger.kernel.org Fixes: 4c3afa72138c ("drm/i915/dg2: Add support for DG2 render and media compression") Reviewed-by: Juha-Pekka Heikkila Signed-off-by: Ville Syrjälä Link: https://patchwork.freedesktop.org/patch/msgid/20221003111544.8007-5-ville.syrjala@linux.intel.com (cherry picked from commit f25d9f81a8e09ace4f04106995550bae1f522143) Signed-off-by: Tvrtko Ursulin Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/i915/intel_pm.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@ -5311,13 +5311,17 @@ skl_compute_wm_params(const struct intel modifier == I915_FORMAT_MOD_Yf_TILED_CCS || modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS || modifier == I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS || - modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC; + modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC || + modifier == I915_FORMAT_MOD_4_TILED_DG2_RC_CCS || + modifier == I915_FORMAT_MOD_4_TILED_DG2_MC_CCS; wp->x_tiled = modifier == I915_FORMAT_MOD_X_TILED; wp->rc_surface = modifier == I915_FORMAT_MOD_Y_TILED_CCS || modifier == I915_FORMAT_MOD_Yf_TILED_CCS || modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS || modifier == I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS || - modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC; + modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC || + modifier == I915_FORMAT_MOD_4_TILED_DG2_RC_CCS || + modifier == I915_FORMAT_MOD_4_TILED_DG2_MC_CCS; wp->is_planar = intel_format_info_is_yuv_semiplanar(format, modifier); wp->width = width; From patchwork Wed Oct 19 08:24:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4588 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp206047wrs; Wed, 19 Oct 2022 01:51:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM70Tt0lu2GE3g7h2uF04F1AztPhzKQStE8ymGW9TcWG0ge8ROCwbd7hfQONzeUSIwRSDs5r X-Received: by 2002:a17:903:2686:b0:17e:f177:3ec with SMTP id jf6-20020a170903268600b0017ef17703ecmr7456217plb.71.1666169481266; Wed, 19 Oct 2022 01:51:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169481; cv=none; d=google.com; s=arc-20160816; b=kcl55vJ8OeXKCoCkro3frsG+ovLAY84FoaGamij/OtxGxzI7ng6kmHst00yybVehMm Xb+oLxE/ClfgowIwe923VyJsfX5VJ1bTHePeJe6b4X0UDEqlI9Y4QIvniWiFdjqjpGnZ qxMTfnqgjLOG+yxg+FI/JtM8UylLNhcaK+qhcl99e9FrDVcJXx2aI8ns4aadvBs6jKfG 07b4HUkDYZEjfySrjzbtTHmEJCmzduYO9diFE8dETHQCh1JlAUenLAMKW4CqL9y81ggC w8Wo+4iupXLU7ZVpkKqL1CDTvHCN7QkXZxufv94xpERTq7MVj79PrDXQ7+LMUJrWz4UY PJmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9AXzW+bIodoPMhLJ/QZzfTRH4yrUS7iuzRjh7GuVvH0=; b=ze84xkkJxOQel7IpyT1awZY+dzWX4BRPNY9IIj1IBf1FuuWmf1e95Vqi6TxgnDNnq3 PZZt49mNVEdxTjXCah1+9uREZ3KAdJ3lCkzI2w9ukbmxZ+0BZenzgHAA7YLCUZXawCsu wJ5EGF7lLgMcmBpUCKSlsLIN3Hxvn8O4cIuXGNHBQIouVVkTd7fpqROKwpCNZuIxgx6F N93bALS38BQrHVAIUn4Jujc/CoAA1vMRWvnXJgDfMo9nLqN8dyf1BcofFYPgBI18+eGY izjLTKFmh3dQt9U6nEbX2AuPiZR5u5qjI5hoO/G3AXGQMpdvbP23BTtr7UJbONGJ8a3l Nd4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0RGhvzHB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b22-20020a63cf56000000b0046aff3cb64dsi17396930pgj.410.2022.10.19.01.51.08; Wed, 19 Oct 2022 01:51:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0RGhvzHB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231542AbiJSIuw (ORCPT + 99 others); Wed, 19 Oct 2022 04:50:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231604AbiJSIss (ORCPT ); Wed, 19 Oct 2022 04:48:48 -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 D0856900FE; Wed, 19 Oct 2022 01:46:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8317361830; Wed, 19 Oct 2022 08:46:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B759C433D6; Wed, 19 Oct 2022 08:46:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169192; bh=sNHKf57xcO6JHt0hLxrL3agbC2C9zRzCaCSiO+r2D84=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0RGhvzHBGJHO8LY4GvfO28dAo8Zb22uX4VpDMQ6tILdlQKdVegacUZ9gJEclZHW/n driAjJZS+iwV3/PIARjs4V3YSlt3fbN5PUUE+Tk/eT0TtTlwmnnxPQK1spYXEdqcjs gwJdcl2z6gozgNlKpulLJTeUgtuBfPssWjv8mEEs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Juha-Pekka Heikkila , =?utf-8?b?VmlsbGUgU3ly?= =?utf-8?b?asOkbMOk?= , Tvrtko Ursulin Subject: [PATCH 6.0 188/862] drm/i915: Fix watermark calculations for DG2 CCS+CC modifier Date: Wed, 19 Oct 2022 10:24:35 +0200 Message-Id: <20221019083258.276391136@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105330399499275?= X-GMAIL-MSGID: =?utf-8?q?1747105330399499275?= From: Ville Syrjälä commit b2e3a1af8cce4117de06ff1a4eab0749753ede27 upstream. Take the DG2 CCS+CC modifier into account when calculating the watermarks. Othwerwise we'll calculate the watermarks thinking this tile-4 modifier is linear. The rc_surface part is actually a nop since that is not used for any glk+ platform. Cc: stable@vger.kernel.org Fixes: 680025dcc400 ("drm/i915/dg2: Add support for DG2 clear color compression") Reviewed-by: Juha-Pekka Heikkila Signed-off-by: Ville Syrjälä Link: https://patchwork.freedesktop.org/patch/msgid/20221003111544.8007-6-ville.syrjala@linux.intel.com (cherry picked from commit 334810f82024815283a6e7febd3d2de1fed6c232) Signed-off-by: Tvrtko Ursulin Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/i915/intel_pm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@ -5313,7 +5313,8 @@ skl_compute_wm_params(const struct intel modifier == I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS || modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC || modifier == I915_FORMAT_MOD_4_TILED_DG2_RC_CCS || - modifier == I915_FORMAT_MOD_4_TILED_DG2_MC_CCS; + modifier == I915_FORMAT_MOD_4_TILED_DG2_MC_CCS || + modifier == I915_FORMAT_MOD_4_TILED_DG2_RC_CCS_CC; wp->x_tiled = modifier == I915_FORMAT_MOD_X_TILED; wp->rc_surface = modifier == I915_FORMAT_MOD_Y_TILED_CCS || modifier == I915_FORMAT_MOD_Yf_TILED_CCS || @@ -5321,7 +5322,8 @@ skl_compute_wm_params(const struct intel modifier == I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS || modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC || modifier == I915_FORMAT_MOD_4_TILED_DG2_RC_CCS || - modifier == I915_FORMAT_MOD_4_TILED_DG2_MC_CCS; + modifier == I915_FORMAT_MOD_4_TILED_DG2_MC_CCS || + modifier == I915_FORMAT_MOD_4_TILED_DG2_RC_CCS_CC; wp->is_planar = intel_format_info_is_yuv_semiplanar(format, modifier); wp->width = width; From patchwork Wed Oct 19 08:24:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5100 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp250180wrs; Wed, 19 Oct 2022 03:48:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4mjl5T8VaZiB7yilxQlDDrem+fZtgVugTiOXXeillcpwWXyFiEwtbqtSXaJwVWlGD7qgNo X-Received: by 2002:a17:907:7ea7:b0:78d:3638:9018 with SMTP id qb39-20020a1709077ea700b0078d36389018mr6254831ejc.236.1666176502461; Wed, 19 Oct 2022 03:48:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176502; cv=none; d=google.com; s=arc-20160816; b=czgjsYVMElS1toQXQO/46+XCqb6xciZ5UwkemCvpSUIMAgoTMkdaDdgRgXsVRoWR5C 7w+PpezpKmeA4qKgYbfELXfYoqfpi9VOGUU6DjXNTb7RE+rfEKRfuZKXlOVu3Y9kev98 f5qEnCIBT/SfE9zAVF6YCArxENzsFt3+osHUpAP3Yfj5N1gWPjCY7hnb8V7j+H3/DJcT cbaZow+l9mXxYeM4ql/p64Bu2Mnw4TiQR8UQGrN7zdp+tX0UmgE0pJlA6ZDKMHDCuXTZ Py5BJFwBhmv8yTTa9Lf7bAEBB/XF6N+wuQ3jOLH9RL/lh1O+zAJkfxjouCC+oIr6ZFcF Zf6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+FF6tR55L9skBGVg/rJD2lSKl2v9tnGDn1Luhfp2Hmo=; b=BDC4Xtf1B3bZL2W+hwj3SyvSHLB9y/6bhnoeD2ZmbySgFhZL8AArwNhh7nR42rXMsR e7Zbu+to39HK+LxylRsVKRIG83lwxo3SZnz+N194nHMnbyQ6ZZJrmqhPpsy0hsadXTMk P74rf1URY2X1MqHWsF2e0BGTJmDBZW4+aVdR1uJMFQSxKAN8wBZuSRX9sl1yv0CbnDLk hLNcHetk+V0NLhgGPYTu3Y8mG8hxoBL59hbonr1LlR2LX70Jl4CtubOxpdulBJlyxn44 pbGalYytwYZ0OodMHoFmmetMzQ6JbszeJCIzmg50zPaSmpmwbZf8kOuKhiqTubDuTWBj AKWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YAobm5eE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dd17-20020a1709069b9100b0077cfec3a52fsi15241121ejc.839.2022.10.19.03.47.54; Wed, 19 Oct 2022 03:48: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=YAobm5eE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233627AbiJSKrb (ORCPT + 99 others); Wed, 19 Oct 2022 06:47:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232715AbiJSKpU (ORCPT ); Wed, 19 Oct 2022 06:45: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 3CE6D118766; Wed, 19 Oct 2022 03:21: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 B44B5B82315; Wed, 19 Oct 2022 08:46:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ED665C433B5; Wed, 19 Oct 2022 08:46:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169195; bh=EvVp/KIs4ddef+5+zGPr/+WMP5WJiBafZuZGyLqw2bM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YAobm5eErV2G13MdTFgTS5Onx0F+4QXR32AEkBxgi2mri6UaeCgmphT0z+tTGajLg uNmi2YTDbC8CmNqZxO0MADpNPia1fxBbTw4JL/zwUnYDToqfgmkC3GH0NckIsoyZ4N r0HuDpoXEj+HUb2miN6C5ot+M42FeMG+zkYxSr5U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Thomas_Hellstr=C3=B6m?= , Matthew Auld , intel-gfx@lists.freedesktop.org, David de Sousa , Andrzej Hajda , Tvrtko Ursulin , Kevin Boulain Subject: [PATCH 6.0 189/862] drm/i915: Fix display problems after resume Date: Wed, 19 Oct 2022 10:24:36 +0200 Message-Id: <20221019083258.329800967@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112692412260724?= X-GMAIL-MSGID: =?utf-8?q?1747112692412260724?= From: Thomas Hellström commit 6c482c62a635aa4f534d2439fbf8afa37452b986 upstream. Commit 39a2bd34c933 ("drm/i915: Use the vma resource as argument for gtt binding / unbinding") introduced a regression that due to the vma resource tracking of the binding state, dpt ptes were not correctly repopulated. Fix this by clearing the vma resource state before repopulating. The state will subsequently be restored by the bind_vma operation. Fixes: 39a2bd34c933 ("drm/i915: Use the vma resource as argument for gtt binding / unbinding") Signed-off-by: Thomas Hellström Link: https://patchwork.freedesktop.org/patch/msgid/20220912121957.31310-1-thomas.hellstrom@linux.intel.com Cc: Matthew Auld Cc: intel-gfx@lists.freedesktop.org Cc: # v5.18+ Reported-and-tested-by: Kevin Boulain Tested-by: David de Sousa Reviewed-by: Matthew Auld Reviewed-by: Andrzej Hajda Signed-off-by: Matthew Auld Link: https://patchwork.freedesktop.org/patch/msgid/20221005121159.340245-1-thomas.hellstrom@linux.intel.com (cherry picked from commit bc2472538c0d1cce334ffc9e97df0614cd2b1469) Signed-off-by: Tvrtko Ursulin Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/i915/gt/intel_ggtt.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/i915/gt/intel_ggtt.c +++ b/drivers/gpu/drm/i915/gt/intel_ggtt.c @@ -1267,10 +1267,16 @@ bool i915_ggtt_resume_vm(struct i915_add atomic_read(&vma->flags) & I915_VMA_BIND_MASK; GEM_BUG_ON(!was_bound); - if (!retained_ptes) + if (!retained_ptes) { + /* + * Clear the bound flags of the vma resource to allow + * ptes to be repopulated. + */ + vma->resource->bound_flags = 0; vma->ops->bind_vma(vm, NULL, vma->resource, obj ? obj->cache_level : 0, was_bound); + } if (obj) { /* only used during resume => exclusive access */ write_domain_objs |= fetch_and_zero(&obj->write_domain); obj->read_domains |= I915_GEM_DOMAIN_GTT; From patchwork Wed Oct 19 08:24: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: 4725 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214031wrs; Wed, 19 Oct 2022 02:11:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM73wO4LIb4wDEzY7GUjRsPYthMsJ6frAXAXY1DMMhvru2Trom7Vq2yek5s3M0KSelNB/0vi X-Received: by 2002:a17:907:3f04:b0:741:4bf4:fe42 with SMTP id hq4-20020a1709073f0400b007414bf4fe42mr5996400ejc.664.1666170703776; Wed, 19 Oct 2022 02:11:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170703; cv=none; d=google.com; s=arc-20160816; b=Be++PVGWy4KE+D8QH+dyZM3Sr6hlp+xmrmaLN60jLbVChTzb/UwwpubDgde7L4HqWS DQLKIny0dlH+Ebdo+vPs/f5WTny9aB0N9duyX7MRyLj6VhlPX1D4ZJ2IKasmqqlFvTqr egkF/Jh0No6UDrvJXXoQn8MZxd3NdXcTWfSFC7/gB7bYAA5vitGYDNd4/1cnUOgHIzDQ G8WqTaoLNa7rkvF+stO4r6pJ2wv1KxXBkON+u8CXYbS783mm7A8eZxiP0C1sLW7Wf+y0 SmREZDKNP6mpJkyTNFGMiC5Uzd0Lbjtel/700tiTeSwGShJYkx/+3wFKe/sD3y0RfIIr ITWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gJt92IzzJw/mbg+QFWoNVbNkzpnVfgrIBdv/uEBmunE=; b=dgqYcX5o5HUCmSt13nNUlv7s3h21BdupjH2rYN9qn9XfWSsr9dwFEmmFLH3bN30Dyd lrosUTDsv2Zi/m28iJ9krfS944Z33LY/ELM+KfW1EA0fSOLx9brpQKWRKJq/X5VnYx23 qu2z/Iw/sJKAxXOV+AYNSloHJ5nRGOaHuiWBnFVuLTAKyc9oaUrACcVQzq2ilvC2vQ+m 1CtJesd3gqz4UTfZmaDFaf+6UIeyFyaF1eOiur7AtSIWhVwZKEFfviZh4v0ErFfVE/S0 yaKu9fQkeNudY7B/51f3DbHxrHHPV2rg4fDYfEN62iPu87bxHmEySVlLsB7+yx7PKGQS Cr2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xcJd+epD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j20-20020a05640211d400b0045d3ed38ae1si12457815edw.16.2022.10.19.02.11.18; Wed, 19 Oct 2022 02:11: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=xcJd+epD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232503AbiJSJIG (ORCPT + 99 others); Wed, 19 Oct 2022 05:08:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232304AbiJSJFa (ORCPT ); Wed, 19 Oct 2022 05:05: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 A9305B274B; Wed, 19 Oct 2022 01:59: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 E969661750; Wed, 19 Oct 2022 08:48:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F3AFC43143; Wed, 19 Oct 2022 08:48:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169331; bh=5gG5OYn6m9YYIFvq/8qqrUumeeDPEJAt9vcV/QsLf18=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xcJd+epDVYm2QGBxRMOO+JF2x05YHCCY7zGOLDKc6AqoqL4TR/+03WPgO5yH/kMTY vt6xDzmoJdLSJywj2SwfaA2lF/nF5uNIwWDKrXMuO6AjYzdyaOvQyB6g9QvFtvKWEJ U0hoTiVF/d3SONDTQ5m9NwjROryXa6LhcThJZFMM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Wheeler , Rodrigo Siqueira , Qingqing Zhuo , Alvin Lee , Alex Deucher Subject: [PATCH 6.0 190/862] drm/amd/display: Fix watermark calculation Date: Wed, 19 Oct 2022 10:24:37 +0200 Message-Id: <20221019083258.376837892@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106611532415642?= X-GMAIL-MSGID: =?utf-8?q?1747106611532415642?= From: Alvin Lee commit 9799702360d51a714e888fef4ab5fb9123dfb41f upstream. Watermark calculation was incorrect due to missing brackets. Fixes: 85f4bc0c333c ("drm/amd/display: Add SubVP required code") Tested-by: Daniel Wheeler Reviewed-by: Rodrigo Siqueira Acked-by: Qingqing Zhuo Signed-off-by: Alvin Lee Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org # 6.0 Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c +++ b/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c @@ -719,7 +719,7 @@ void dc_dmub_setup_subvp_dmub_command(st // Store the original watermark value for this SubVP config so we can lower it when the // MCLK switch starts wm_val_refclk = context->bw_ctx.bw.dcn.watermarks.a.cstate_pstate.pstate_change_ns * - dc->res_pool->ref_clocks.dchub_ref_clock_inKhz / 1000 / 1000; + (dc->res_pool->ref_clocks.dchub_ref_clock_inKhz / 1000) / 1000; cmd.fw_assisted_mclk_switch_v2.config_data.watermark_a_cache = wm_val_refclk < 0xFFFF ? wm_val_refclk : 0xFFFF; } From patchwork Wed Oct 19 08:24: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: 5425 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp318431wrs; Wed, 19 Oct 2022 06:11:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7bopDuYRO0r/PW0INbF7098w5tKPrHUxWci+PhujlycxzZCDHkiGjtx0ywDvqxuMw3qh3X X-Received: by 2002:aa7:db4d:0:b0:458:908f:a372 with SMTP id n13-20020aa7db4d000000b00458908fa372mr7430232edt.248.1666185077912; Wed, 19 Oct 2022 06:11:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666185077; cv=none; d=google.com; s=arc-20160816; b=0ypYbUGw+x27LEC85+uUmZf9w0bomISepBv3bjq8b0PvDALe7Ln2SxUXNW46M6oDsF rtPNCJBjOkd9EBzgOi0Z68Gl7fX2a24pk3fEhPTFQPv3s9+XeFywTYCSekTpN+rlHQin 819GAc0eUeaAAGvKjB9v93sXAhLb/os+hVOYwSsPyeljuqO2t9gF/yqlfDcuWsdENNrA owN7BEdZ7gA4V+hwb6kP+gqN58VVl55gjVvOkKu3RNzlBU845cd8dwH3G4KeS3Ui0gad PfWCwYbslkrm+jzda1aAZHMpgT6Gh7dlKMjJV/6dt9D+Jv0Szjs64sv6YVLMvHmq0MJ6 +7kA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Yn1kSpW5ePojD1aYDjlHpnuxJ9ubF8X723tmlqUtHaI=; b=vaxe0SyYSIAcfxBuaztCIskcskceiswE/jA5m4xsDqkeqP7iS4Ynr8zUNRpDUj6RiP E8qArJ5PW0zMrKIdhaXKAgCdjbhtr05lsRlGdO+HWpSU7XNAuwTkUgxenBkJnCwR9nPL QNEtSMBHkY6O7ib9qLT7oyGrkZ2BS9pTGyBUHTqGMwXHq9n/cbRiWsdjWXlO4cojHEeN Qo9jcZP2+BkKeF5Ap9aogWmQXm7ss1Ix8saCpzV1gOU3ssBDomrXs2XmePghtEYB7wq7 vsk9mzCLRnPnSMNpqLKDdp6Q+8lgLkoKCUxKilS4+FgFpnNZ6PeCoUnzSVJjGIlydsY7 unQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=I7YSyptQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020aa7c2d6000000b0044e9fd71b82si12245368edp.280.2022.10.19.06.10.47; Wed, 19 Oct 2022 06:11: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=I7YSyptQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231847AbiJSNIN (ORCPT + 99 others); Wed, 19 Oct 2022 09:08:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231430AbiJSNH4 (ORCPT ); Wed, 19 Oct 2022 09:07: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 B263E1FCF9; Wed, 19 Oct 2022 05:52: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 207D2B822E6; Wed, 19 Oct 2022 08:47:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7BB58C433B5; Wed, 19 Oct 2022 08:46:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169218; bh=1w++Q8iRRmqW0MQniOVcUitS0gFwZ1zF0XoxIC59Ds8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I7YSyptQLZu8VBse4TfQ85GTpSatms6480pcS10LRerVRDotvbht4OFydOLgz8+i1 9KInWMj4GJuaRf8dKcw8CanFBkbyZMxGNR9JWGSz2FFnV+Ueh5Pmc+6tSBLeLj2dnD Ef6N8wcGFmMCPpu3hfGLUQlrgBWuRRmSOMtzZzUw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Wheeler , Charlene Liu , Mario Limonciello , Qingqing Zhuo , Nicholas Kazlauskas , Alex Deucher Subject: [PATCH 6.0 191/862] drm/amd/display: Update PMFW z-state interface for DCN314 Date: Wed, 19 Oct 2022 10:24:38 +0200 Message-Id: <20221019083258.417875595@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747121684271957512?= X-GMAIL-MSGID: =?utf-8?q?1747121684271957512?= From: Nicholas Kazlauskas commit 4f5bdde386d3b8e9317df5562950e1b4fa177599 upstream. [Why] Request from PMFW to change the messaging format to specify whether we support z-state via individual bits. [How] Update the args we pass in the support message. Fixes: d5c6909e7460 ("drm/amd/display: Add DCN314 clock manager") Tested-by: Daniel Wheeler Reviewed-by: Charlene Liu Reviewed-by: Mario Limonciello Acked-by: Qingqing Zhuo Signed-off-by: Nicholas Kazlauskas Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org # 6.0 Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/display/dc/clk_mgr/dcn314/dcn314_smu.c | 11 +++-------- drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c | 3 ++- 2 files changed, 5 insertions(+), 9 deletions(-) --- a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn314/dcn314_smu.c +++ b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn314/dcn314_smu.c @@ -339,29 +339,24 @@ void dcn314_smu_set_zstate_support(struc if (!clk_mgr->smu_present) return; - if (!clk_mgr->base.ctx->dc->debug.enable_z9_disable_interface && - (support == DCN_ZSTATE_SUPPORT_ALLOW_Z10_ONLY)) - support = DCN_ZSTATE_SUPPORT_DISALLOW; - - // Arg[15:0] = 8/9/0 for Z8/Z9/disallow -> existing bits // Arg[16] = Disallow Z9 -> new bit switch (support) { case DCN_ZSTATE_SUPPORT_ALLOW: msg_id = VBIOSSMC_MSG_AllowZstatesEntry; - param = 9; + param = (1 << 10) | (1 << 9) | (1 << 8); break; case DCN_ZSTATE_SUPPORT_DISALLOW: msg_id = VBIOSSMC_MSG_AllowZstatesEntry; - param = 8; + param = 0; break; case DCN_ZSTATE_SUPPORT_ALLOW_Z10_ONLY: msg_id = VBIOSSMC_MSG_AllowZstatesEntry; - param = 0x00010008; + param = (1 << 10); break; default: //DCN_ZSTATE_SUPPORT_UNKNOWN --- a/drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c +++ b/drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c @@ -881,7 +881,8 @@ static const struct dc_plane_cap plane_c }; static const struct dc_debug_options debug_defaults_drv = { - .disable_z10 = true, /*hw not support it*/ + .disable_z10 = false, + .enable_z9_disable_interface = true, .disable_dmcu = true, .force_abm_enable = false, .timing_trace = false, From patchwork Wed Oct 19 08:24: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: 5102 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp250224wrs; Wed, 19 Oct 2022 03:48:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Bg8SCLD1ptc26TJYMXPD1phpnb9eBTiJHbOiJbN+XT6R2YDsg43zflMNgrgTsllIRZg0W X-Received: by 2002:a17:907:daa:b0:78d:9bc9:7d7a with SMTP id go42-20020a1709070daa00b0078d9bc97d7amr6098638ejc.567.1666176508304; Wed, 19 Oct 2022 03:48:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176508; cv=none; d=google.com; s=arc-20160816; b=v4gBF6ukqJEM4Wt/piGaHZaE93G6UN6EjNBa6eQfvFk55sLazMIiM869IuQYaar8Ua d6rgjEG6B9IPYrvZ5aOjcSKNKIik10LCBMxrZogoxKzkFFQLxNycmTXko52cinU9QtTP AZssrNk24OgIw235Nj9TrtiOQMHiOmmrjFCKgmbwScDYb3Lb8+ylUjsXK7GMJgpd1Hs7 gVa8MxvzkHs/Ty2CTobeY9dnUhUn+jCX1GJ34HcQf6TKEzJH3peqf3Kz2rK3QbmUsbDx PmwhgMKupQkUHFFV8/PB65z6lzwlcwBXr8zdBy9REOQwH5BNLrYcM8O5adqq5WNHjlka p3PA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jS0caWKJfk5SgjSZGH7G12xNdENkopcRxQRXUqnrhk8=; b=nE7vNl/IhVkxRTid3cvN3chpnMdnnNKYmpsanDYiBvjiy3FelnOLL7XeCo4l9k88uo JJXazuqDH4kZjlblcfqyzDjXZDuyKoyB1JW4tGJDr6bTBFtFIRc8f/FYs3nY9YRq3UVY 742kqI7WEjPbl05Pz1Z9o/WSJUQWSkXCpFrpTtntHgxOywjNGMF/vnJkMuZ2BoYofjRr jdSZJaGaN2Oxfg/rPFlha8O54xl8MtP0Di/OoAILIzzbrJrnYz79CASpa/zqLqFVfvRB Xhfh5kad0McfyvGYU1F+0NQdZdUdmzZmIdE70aMZBD0+fUDKgoG9RAKwP2j8mcE5rxRA 0jyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=srQ8BDaR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jz18-20020a17090775f200b0078d00203ab4si10834530ejc.691.2022.10.19.03.48.03; Wed, 19 Oct 2022 03:48: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=srQ8BDaR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233794AbiJSKrn (ORCPT + 99 others); Wed, 19 Oct 2022 06:47:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232878AbiJSKp3 (ORCPT ); Wed, 19 Oct 2022 06:45: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 6830F2252E; Wed, 19 Oct 2022 03:21: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 76969B822FF; Wed, 19 Oct 2022 08:47:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B8F30C433C1; Wed, 19 Oct 2022 08:47:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169251; bh=WH12ROwbiwt2ezolUVlTl+7d90xLlvBmBnJiLhmIgiI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=srQ8BDaRqESqM+XbKeCcGLoK7XFBNhk43GVDDJohXUOpjP5VRqRAeS6ZqRYNstpR9 kJqY01LFUv2Cn9egX6bGWnxN1krUru7kDoIste+d9BHlHVYTZp5t3qZDC+GKmkuiEV JVBd2I/aSsuFIDpvFaLMMrOSx4zYjmtibMpC3//I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Wheeler , Rodrigo Siqueira , Qingqing Zhuo , Martin Leung , Alex Deucher Subject: [PATCH 6.0 192/862] drm/amd/display: zeromem mypipe heap struct before using it Date: Wed, 19 Oct 2022 10:24:39 +0200 Message-Id: <20221019083258.467322526@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112698201104919?= X-GMAIL-MSGID: =?utf-8?q?1747112698201104919?= From: Martin Leung commit 5ff32b52995155f91de582124485d0f0f8881363 upstream. [Why & How] bug was caused when moving variable from stack to heap because it was reusable and garbage was left over, so we need to zero mem Fixes: 7acc487ab57e ("drm/amd/display: reduce stack size in dcn32 dml (v2)") Tested-by: Daniel Wheeler Reviewed-by: Rodrigo Siqueira Acked-by: Qingqing Zhuo Signed-off-by: Martin Leung Cc: Alex Deucher Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c +++ b/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c @@ -733,6 +733,8 @@ static void DISPCLKDPPCLKDCFCLKDeepSleep mode_lib->vba.FCLKChangeLatency, v->UrgentLatency, mode_lib->vba.SREnterPlusExitTime); + memset(&v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.myPipe, 0, sizeof(DmlPipe)); + v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.myPipe.Dppclk = mode_lib->vba.DPPCLK[k]; v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.myPipe.Dispclk = mode_lib->vba.DISPCLK; v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.myPipe.PixelClock = mode_lib->vba.PixelClock[k]; From patchwork Wed Oct 19 08:24: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: 5126 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp251430wrs; Wed, 19 Oct 2022 03:51:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6FO1rg795WXU/Si2bggzwwcHD5iEl3N7u7LF3ecyibP9cOajEH1u9qpFDsJVLscU3BRWvV X-Received: by 2002:a50:eb05:0:b0:457:c6f5:5f65 with SMTP id y5-20020a50eb05000000b00457c6f55f65mr6691139edp.311.1666176701341; Wed, 19 Oct 2022 03:51:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176701; cv=none; d=google.com; s=arc-20160816; b=uFKmob8tR9BP8WOmpKdLDO7447JiAyRcQ4S76k3Uw6XGBpZtehntW3NlENlHvMlx74 MWqTltTSx71ap50ZKVQ2LUGIvFBZ5wrl+SVi49RjKcyL+d10TOwmnf62Tf6b5Sx5elfh 6gdbhW+Dz1SYyM62PbMY38V0Hbp+WFCjh5v0pzz6pCpf0oRtq0k4TIgFhMHaikAMGDFe BYcuVxNqyv1UWUnD1de3QtEGJd798eAlHc4fYh8CrABUqpr4mMbbeJtyAlxz0ghKpFN2 QiOKrGQgvPRPeAA+d2DCqPNa3qxIPHwwr/fv8EP2liwb+guu7wK4nm7A6ORLY2+w3W/t Nw4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wVhrsd56Mn6VVfl1x/P2AhX6gE6OPLCYYAB4T7NUiQU=; b=h3R6nAj1cShXqA9trf6U2OzbJ3qfTqJkBLOPgy4BDf211dApGAWZgg4Wk4qc+uqK17 5rqx09p8g+3Ax6ztr4/N9WaRMqQZGwxjbOLyIZK8MdPV7CSloz5iaYd8Tnn0b8wOgOkV ZyWpEV/2NmzkCBb03sNcHeS6SPg3PIgcmBfrxFzNH0/oALaC30CtJNAolZ0gg3h2EBq8 MqHk0f8D6t3pDynzNnShX2t74cba7g/9s2+6NAu0KstsJVmQ+XIopYLlXKn66NFdNlLq ZgexSl5dMlWoqeGramhr2khLlxS6OCuJ/i7tnP2A1AF9wGhb21103mmws5+DY8vQdQcX 6SKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wsKPwc9T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u29-20020a50c05d000000b00448ce617058si12193895edd.463.2022.10.19.03.51.17; Wed, 19 Oct 2022 03: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=wsKPwc9T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234380AbiJSKui (ORCPT + 99 others); Wed, 19 Oct 2022 06:50:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234021AbiJSKrx (ORCPT ); Wed, 19 Oct 2022 06: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 1217B15B130; Wed, 19 Oct 2022 03:21:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E0DC3B822E9; Wed, 19 Oct 2022 08:48:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 411C9C433B5; Wed, 19 Oct 2022 08:48:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169283; bh=fTvT0ik4f6kDJvAqramL4MzipGYW+zF36KCJGMNC4nM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wsKPwc9T7iBvam+l4ol+dV3okT9chMEqDL4F0xhdU29U+Q4rvsf4U1Pruh6AwhRou h7P+Akde1nMwzYGdygBho9lYXsdGPpOALeyGrcwaaPMlDSq2Gz/41BrihJSSOL4sz8 d2FvAnC1eKAB68sRWCab1QeJy8LxVk+7byN24aeE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Wheeler , Roman Li , Qingqing Zhuo , Fangzhi Zuo , Mark Broadworth , Alex Deucher Subject: [PATCH 6.0 193/862] drm/amd/display: Validate DSC After Enable All New CRTCs Date: Wed, 19 Oct 2022 10:24:40 +0200 Message-Id: <20221019083258.514244822@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112900579653678?= X-GMAIL-MSGID: =?utf-8?q?1747112900579653678?= From: Fangzhi Zuo commit 876fcc4222e1d0e5b73343f4010a8b66be058f48 upstream. Before enabling new crtc, stream_count in dc_state does not sync with that in drm_atomic_state. Validating dsc in such case would leave newly added stream not jointly participating in dsc optimization with existing streams, but simply using default initialized vcpi all the time which gives wrong dsc determination decision. Consider the scenaio where one 4k60 connected to the dock under dp-alt mode. Since dp-alt mode is 2-lane setup, stream 1 consumes 63 slots with dsc needed. Then hook up a second 4k60 to the dock. stream 2 connected with 65 slot initialized by default without dsc. dsc pre validate will not jointly optimize stream 2 with stream 1 before crtc 2 added into the dc_state. That leads to stream 2 not getting dsc optimization, and trigger atomic_check failure all the time, as 65 > 63 limit. After getting all new crtcs added into the state, stream_count in dc_state correctly reflect that in drm_atomic_state which comes up with correct dsc decision. Fixes: 71be4b16d39a ("drm/amd/display: dsc validate fail not pass to atomic check") Tested-by: Daniel Wheeler Reviewed-by: Roman Li Acked-by: Qingqing Zhuo Signed-off-by: Fangzhi Zuo Tested-by: Mark Broadworth Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -9408,10 +9408,6 @@ static int amdgpu_dm_atomic_check(struct } } } - if (!pre_validate_dsc(state, &dm_state, vars)) { - ret = -EINVAL; - goto fail; - } } #endif for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { @@ -9545,6 +9541,15 @@ static int amdgpu_dm_atomic_check(struct } } +#if defined(CONFIG_DRM_AMD_DC_DCN) + if (dc_resource_is_dsc_encoding_supported(dc)) { + if (!pre_validate_dsc(state, &dm_state, vars)) { + ret = -EINVAL; + goto fail; + } + } +#endif + /* Run this here since we want to validate the streams we created */ ret = drm_atomic_helper_check_planes(dev, state); if (ret) { From patchwork Wed Oct 19 08:24: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: 4647 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212331wrs; Wed, 19 Oct 2022 02:07:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6PANFwUdR2clt7ekaTJ1LvOVvxNGGrx1OnunkguCIYSCzleE9fzhjIDs85C1IvzLz3z7sX X-Received: by 2002:a17:906:974f:b0:791:98b8:c7d1 with SMTP id o15-20020a170906974f00b0079198b8c7d1mr5826728ejy.559.1666170435820; Wed, 19 Oct 2022 02:07:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170435; cv=none; d=google.com; s=arc-20160816; b=q+yj/lPjsG3oIJsV9UlaeZaWJR9a8BhVVLiRuNjr15U8Aetx8slHQHZTviKVUSVUzB hcPO9/8QYq0/U/HJgNxT7ORMNUICXm48qHnfEjhhMOs7d7LLUUTmNUSpfaPBU4ki71lF 0QkxrczOg3ptk2xYtSsxdYYCdepzrJUjN6qb5zVPnZeHb6Mq0Rob9zJDhGxVyW7dRZ44 08xwa5AQSA++tIkaUvWxB4Rl1IaTWAlbO+hXYFiXi7W8e4zIga6UEEgTPK2J/ZkLB++4 3sgqegZQjWfYvDlvFFrnHAfsN8+foWRGzVUi776PEeC7yvcpmw2X6mN981ntD0de7ASE yv4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wXWVibkk8jQwwmR/J99CkkAEJ8ipZM3E8I9fbx3A9es=; b=l9FfZXYtdN21nZTn20IbEaKZOwaH+nmglE6CgOQcFzBDdX1Eepbnyo9I/SgEgapI2O sknOWdXcmoOTO8yTcipMOzmkCyG7WFmLpaf4UX3X4pJz1U35Diz/GSLeC+cdNUWnOCFx JRxGmPp9KC1AFiqd2AXqK6ZLcpTZrT81NLxCOpqk1zfsMoKzsIUDEYIvlM2dC6Ga2V0W onQIvHWlk6LoRT7aEmOdYyllPjoEDW7xHKoLySQQZ7jkTslggWpE/UgDX6Qowgig7ul0 jidBIEknzc9n2SDtKAY7Q8PlXk3wnJExfImbCVQPcSHZ/oInT5uHdrjel7vI3vRtbHmu Y90g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kEON4Qz2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e19-20020a056402191300b0045cbe40c314si15554358edz.384.2022.10.19.02.06.41; Wed, 19 Oct 2022 02:07: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=kEON4Qz2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229777AbiJSJAE (ORCPT + 99 others); Wed, 19 Oct 2022 05:00:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231992AbiJSI6Q (ORCPT ); Wed, 19 Oct 2022 04:58:16 -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 E30725FAED; Wed, 19 Oct 2022 01: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 0D5C261834; Wed, 19 Oct 2022 08:48:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F88AC433B5; Wed, 19 Oct 2022 08:48:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169310; bh=cDOXYXPCFgwK64MHs+P8Q2nfkLntiNLPYeF7r5+rXB0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kEON4Qz2tTPJmE12babjZSEv6QaWYGJdG8WzzzgVPps7rTuvoAvrPLcrvEh6u1EZd yqq7jVeI/BH92mEe/8tJXx3sdOWytFSeJsCwR1bPnrDlQngKoa+Pa+y5S/shQrSbTo LTnqieiV6aOQyUu+6+gKPztQ95+PaQRpukn+OUmU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Roman Li , Nicholas Kazlauskas , Mario Limonciello , Alex Deucher Subject: [PATCH 6.0 194/862] drm/amd/display: Enable dpia support for dcn314 Date: Wed, 19 Oct 2022 10:24:41 +0200 Message-Id: <20221019083258.555290105@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106330860041725?= X-GMAIL-MSGID: =?utf-8?q?1747106330860041725?= From: Roman Li commit f6aa84b83aee629fbbbc4ea16c2c142caf920d5a upstream. [Why] DCN 3.1.4 supports DPIA. [How] - Set dpia_supported flag for dcn314 in dmub_hw_init() - Remove comment that becomes irrelevant after this change. Signed-off-by: Roman Li Reviewed-by: Nicholas Kazlauskas Reviewed-by: Mario Limonciello Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org # 6.0.x Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -1109,7 +1109,8 @@ static int dm_dmub_hw_init(struct amdgpu hw_params.fb[i] = &fb_info->fb[i]; switch (adev->ip_versions[DCE_HWIP][0]) { - case IP_VERSION(3, 1, 3): /* Only for this asic hw internal rev B0 */ + case IP_VERSION(3, 1, 3): + case IP_VERSION(3, 1, 4): hw_params.dpia_supported = true; hw_params.disable_dpia = adev->dm.dc->debug.dpia_debug.bits.disable_dpia; break; From patchwork Wed Oct 19 08:24: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: 4905 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225471wrs; Wed, 19 Oct 2022 02:43:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4U+oYdBD7VIyDj6alBok/A6AlJxtgTPp5pMAjd9kibytTMx3ggJOTewDOS59Kf3KEo1i7b X-Received: by 2002:a17:906:9c83:b0:779:c14c:55e4 with SMTP id fj3-20020a1709069c8300b00779c14c55e4mr5783397ejc.619.1666172594499; Wed, 19 Oct 2022 02:43:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172594; cv=none; d=google.com; s=arc-20160816; b=GOZ8VCOQO1X8WCKZMe+woKOhNr9qYEcNVF2Kz1IFnZNLYmqImbDjsl4Uu00vBHSJd4 Wv8/7IM59OZeBuk35X+2Rc2NHYq+AvKT0dGiS2tbJEJLtTC0CHwVUiHR61W7/e0eNAIm jR+jWScOgAqXQdXUyo1voODMtGPzPLaut8oWn9631bI3/MXK2eewhZ93/vi8M8unALGP c76hpXV7wjurmIkYe5FmCia3xS81xMLeDuaHicNwl/unux1JT3eN+sYa/KsHkZ7uzJO6 TLoQLW7rNQZDQ46E/0mBPpEGnn7/Sr/GhWNEU3Wlu/slBmJA5Rw1VDEkFM1DSBvfAXYz njWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=SfDvvXMg5h/QVpqB7euuwvGnK28d/pIaEQo+5wShuAA=; b=RKoYopBXosN5gAeysY/LHt2kQhB7y+iulZ1Urnt2h/8BGLjjhlEUPoNcfx8FGnIMWj rGbNgfsdXQKGOeledsi1/RgVU9ACcPn4/wiFYseRhHNTYjEXtwkm6KCmQW6C+whoYUu5 7SiaZjk1Vp+m9/8cx2QKt5fu0Lqo2U4bxbQ43FDryUjvsoGnSGsP6i+HuolcxxVkqHgp Mkd62CJ8TTgji4u4L4z7gY7QQCUcpMIp/RJn56tr/WwFow9vbGyUU3q4Qqcak7J+rFC8 SxWTEDQNyICjvNSVv7YMC81oIcsYCKn4Pb5+SdM01P023mavT8+76NmGObS12fje/Pup Y3bQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=i18ghHer; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b18-20020a056402279200b00457137b2571si15664056ede.346.2022.10.19.02.42.49; Wed, 19 Oct 2022 02:43: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=i18ghHer; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233694AbiJSJde (ORCPT + 99 others); Wed, 19 Oct 2022 05:33:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233767AbiJSJ3W (ORCPT ); Wed, 19 Oct 2022 05:29:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC2CBEA34D; Wed, 19 Oct 2022 02:12: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 AA70861842; Wed, 19 Oct 2022 08:48:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C18F5C433C1; Wed, 19 Oct 2022 08:48:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169313; bh=rP8fi7/1mKRy5KGdXb8UDqgm0AaRj4fhC/uVF8esU+8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i18ghHerJt+PS/WRm7eypGDHyiRvJp2hOOfvgE+asn2FgcaAw4CyNoH5MrDgvSZto C0IQ4yKsjgUFO+k7kLvpLEqUoV3ByA4nS57kWE4E05hAzR+SpPzT9ZAqV94k8eATl+ ju9AM8YZK27PNBMRd3cwjbhvU5BdDjdfFE1klnYU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aurabindo Pillai , Rodrigo Siqueira , Alex Deucher Subject: [PATCH 6.0 195/862] drm/amd/display: Enable 2 to 1 ODM policy if supported Date: Wed, 19 Oct 2022 10:24:42 +0200 Message-Id: <20221019083258.604604276@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108594447569308?= X-GMAIL-MSGID: =?utf-8?q?1747108594447569308?= From: Rodrigo Siqueira commit 54fae65ff469a79fc0ca46f480c4e7fce50f3963 upstream. If the current configuration supports 2 to 1 ODM policy, let's also enable the windowed MPO feature. Reviewed-by: Aurabindo Pillai Signed-off-by: Rodrigo Siqueira Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org # 6.0.x Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c +++ b/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c @@ -1001,6 +1001,10 @@ void dcn32_init_hw(struct dc *dc) dc_dmub_srv_query_caps_cmd(dc->ctx->dmub_srv->dmub); dc->caps.dmub_caps.psr = dc->ctx->dmub_srv->dmub->feature_caps.psr; } + + /* Enable support for ODM and windowed MPO if policy flag is set */ + if (dc->debug.enable_single_display_2to1_odm_policy) + dc->config.enable_windowed_mpo_odm = true; } static int calc_mpc_flow_ctrl_cnt(const struct dc_stream_state *stream, From patchwork Wed Oct 19 08:24: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: 4611 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp211729wrs; Wed, 19 Oct 2022 02:05:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7/yRyIDuZZeA8GPzwqYbZeE7wFhE3lp5i9P4SgwAACxLdN5cC6WRSe85lqmSa3xR9Ldj5o X-Received: by 2002:a05:6402:34ce:b0:45d:14c9:c522 with SMTP id w14-20020a05640234ce00b0045d14c9c522mr6386934edc.160.1666170343381; Wed, 19 Oct 2022 02:05:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170343; cv=none; d=google.com; s=arc-20160816; b=ccmarEeje2pg/6CSOEt8UKJUAQzlA8zW1rAshg/h2DEp7s62o1kO1TXXZxIZqQgQ2n aHWKPfNIqYBPOMJwICmXJ1R1Bvb/uDxakvWPWsDw30bKWqjSqDdiOFDcg+VUl9vUSSbU DwZ9xkgF3HxFzk5awXjaDhUBOapTM01mPgN+Hvg83vE19UZ34Y4sHBbECbbGnp1ss9gJ JvESSIg4DmeWBkkLDlj5kgfqsbOaW5FfGvQLX0148sSgAuZ6wcBmF7KIHkBNqpL95R9Q x5hcu6igjxcZ8WVBxkFMhnLHvxjQnXh+KkwFZcW1UvxDOSqhPCyhqVZxRNFVaI2qYeYZ eudQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9ujj/z7rsugv7MOqeagIcrwNuM4DdbuQP0L1NPy2Gxw=; b=WVrfN2PLX9hhmYtUR6J1vDiUgH8a0hnrWkZrJEytgLeD+nNE3/E4hEV4ZQEXtU+k9I PmmzzBvYP/EvWHNrmafUtDOZzL5oRll1LZv7ljxhKlt2jmxeoO4P+U3aaYI1ZPteEkwW Yjir3gUb95mEq2uk9TksM3RZ6UzmyfhX13mUULRnEg7O3OI6N/sBxENbs8+CQtAucY6b 98dm6zssZuM7wdNc+vfoHCtRAOgPEPOXc9sa7o0UB2CFdLguhlxf7yaYTlAtiFbCE4J/ grqgNQgUz+wCh3t1+SZTXcV2VPbQ4fKkoTPmbNhox+sPkK51qXx/F28dkf42L/kN9BCl Rfew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FZZyZUmx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u26-20020aa7d99a000000b0045be16903d0si12488492eds.310.2022.10.19.02.05.10; Wed, 19 Oct 2022 02:05: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=FZZyZUmx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230087AbiJSIw7 (ORCPT + 99 others); Wed, 19 Oct 2022 04:52:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231799AbiJSIwY (ORCPT ); Wed, 19 Oct 2022 04:52:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D479C18E17; Wed, 19 Oct 2022 01:50:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6DB2C61851; Wed, 19 Oct 2022 08:48:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7661DC433D6; Wed, 19 Oct 2022 08:48:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169315; bh=9kUxVm/+RGVnm/lNy4kMSvCHfUrV1aFUDfreGlFolTY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FZZyZUmxL4ei3Q5dLwlx50TBa/B48syAd3dfqQb4pAXyRbIWdP3o8L3lBWH9EEClH AzGMYJsPT0czik3/DYsnkZFdqRmvN73brK8LH8/ja5YdWCkv1peE54fxf6IfabyMh+ +DjVzX0sk8WQLYwUPOgXGCft4GvJHcKV7NXp7Pdo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Wheeler , Rodrigo Siqueira , Yunxiang Li , Alex Deucher Subject: [PATCH 6.0 196/862] drm/amd/display: Fix vblank refcount in vrr transition Date: Wed, 19 Oct 2022 10:24:43 +0200 Message-Id: <20221019083258.644051135@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106233738135834?= X-GMAIL-MSGID: =?utf-8?q?1747106233738135834?= From: Yunxiang Li commit 8799c0be89ebb99a16098bdf618f49f817bef76a upstream. manage_dm_interrupts disable/enable vblank using drm_crtc_vblank_off/on which causes drm_crtc_vblank_get in vrr_transition to fail, and later when drm_crtc_vblank_put is called the refcount on vblank will be messed up. Therefore move the call to after manage_dm_interrupts. Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1247 Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1380 Tested-by: Daniel Wheeler Reviewed-by: Rodrigo Siqueira Signed-off-by: Yunxiang Li Signed-off-by: Rodrigo Siqueira Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 55 ++++++++++------------ 1 file changed, 26 insertions(+), 29 deletions(-) --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -7491,15 +7491,15 @@ static void amdgpu_dm_handle_vrr_transit * We also need vupdate irq for the actual core vblank handling * at end of vblank. */ - dm_set_vupdate_irq(new_state->base.crtc, true); - drm_crtc_vblank_get(new_state->base.crtc); + WARN_ON(dm_set_vupdate_irq(new_state->base.crtc, true) != 0); + WARN_ON(drm_crtc_vblank_get(new_state->base.crtc) != 0); DRM_DEBUG_DRIVER("%s: crtc=%u VRR off->on: Get vblank ref\n", __func__, new_state->base.crtc->base.id); } else if (old_vrr_active && !new_vrr_active) { /* Transition VRR active -> inactive: * Allow vblank irq disable again for fixed refresh rate. */ - dm_set_vupdate_irq(new_state->base.crtc, false); + WARN_ON(dm_set_vupdate_irq(new_state->base.crtc, false) != 0); drm_crtc_vblank_put(new_state->base.crtc); DRM_DEBUG_DRIVER("%s: crtc=%u VRR on->off: Drop vblank ref\n", __func__, new_state->base.crtc->base.id); @@ -8254,23 +8254,6 @@ static void amdgpu_dm_atomic_commit_tail mutex_unlock(&dm->dc_lock); } - /* Count number of newly disabled CRTCs for dropping PM refs later. */ - for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, - new_crtc_state, i) { - if (old_crtc_state->active && !new_crtc_state->active) - crtc_disable_count++; - - dm_new_crtc_state = to_dm_crtc_state(new_crtc_state); - dm_old_crtc_state = to_dm_crtc_state(old_crtc_state); - - /* For freesync config update on crtc state and params for irq */ - update_stream_irq_parameters(dm, dm_new_crtc_state); - - /* Handle vrr on->off / off->on transitions */ - amdgpu_dm_handle_vrr_transition(dm_old_crtc_state, - dm_new_crtc_state); - } - /** * Enable interrupts for CRTCs that are newly enabled or went through * a modeset. It was intentionally deferred until after the front end @@ -8280,16 +8263,29 @@ static void amdgpu_dm_atomic_commit_tail for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc); #ifdef CONFIG_DEBUG_FS - bool configure_crc = false; enum amdgpu_dm_pipe_crc_source cur_crc_src; #if defined(CONFIG_DRM_AMD_SECURE_DISPLAY) - struct crc_rd_work *crc_rd_wrk = dm->crc_rd_wrk; + struct crc_rd_work *crc_rd_wrk; +#endif +#endif + /* Count number of newly disabled CRTCs for dropping PM refs later. */ + if (old_crtc_state->active && !new_crtc_state->active) + crtc_disable_count++; + + dm_new_crtc_state = to_dm_crtc_state(new_crtc_state); + dm_old_crtc_state = to_dm_crtc_state(old_crtc_state); + + /* For freesync config update on crtc state and params for irq */ + update_stream_irq_parameters(dm, dm_new_crtc_state); + +#ifdef CONFIG_DEBUG_FS +#if defined(CONFIG_DRM_AMD_SECURE_DISPLAY) + crc_rd_wrk = dm->crc_rd_wrk; #endif spin_lock_irqsave(&adev_to_drm(adev)->event_lock, flags); cur_crc_src = acrtc->dm_irq_params.crc_src; spin_unlock_irqrestore(&adev_to_drm(adev)->event_lock, flags); #endif - dm_new_crtc_state = to_dm_crtc_state(new_crtc_state); if (new_crtc_state->active && (!old_crtc_state->active || @@ -8297,16 +8293,19 @@ static void amdgpu_dm_atomic_commit_tail dc_stream_retain(dm_new_crtc_state->stream); acrtc->dm_irq_params.stream = dm_new_crtc_state->stream; manage_dm_interrupts(adev, acrtc, true); + } + /* Handle vrr on->off / off->on transitions */ + amdgpu_dm_handle_vrr_transition(dm_old_crtc_state, dm_new_crtc_state); #ifdef CONFIG_DEBUG_FS + if (new_crtc_state->active && + (!old_crtc_state->active || + drm_atomic_crtc_needs_modeset(new_crtc_state))) { /** * Frontend may have changed so reapply the CRC capture * settings for the stream. */ - dm_new_crtc_state = to_dm_crtc_state(new_crtc_state); - if (amdgpu_dm_is_valid_crc_source(cur_crc_src)) { - configure_crc = true; #if defined(CONFIG_DRM_AMD_SECURE_DISPLAY) if (amdgpu_dm_crc_window_is_activated(crtc)) { spin_lock_irqsave(&adev_to_drm(adev)->event_lock, flags); @@ -8318,12 +8317,10 @@ static void amdgpu_dm_atomic_commit_tail spin_unlock_irqrestore(&adev_to_drm(adev)->event_lock, flags); } #endif - } - - if (configure_crc) if (amdgpu_dm_crtc_configure_crc_source( crtc, dm_new_crtc_state, cur_crc_src)) DRM_DEBUG_DRIVER("Failed to configure crc source"); + } #endif } } From patchwork Wed Oct 19 08:24: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: 4638 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212190wrs; Wed, 19 Oct 2022 02:06:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7XD+jJsj7sTlL0Q3DZbO7Pc241Fj8YqteJMYfzQwcxExuqS/+8s5rYYbvP1jOT/FQH9HKw X-Received: by 2002:a05:6402:524e:b0:45d:cc84:8b38 with SMTP id t14-20020a056402524e00b0045dcc848b38mr6526323edd.297.1666170416297; Wed, 19 Oct 2022 02:06:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170416; cv=none; d=google.com; s=arc-20160816; b=ip97X4+O7XBuaA87OHTZ6T9FE4St8EimtJgc2spTQegstbgOEGIXunIHQjFtcvxme+ DTzLQFIVtA6ITcVATuwO4ePnm3NGQ2DKg+YHakIe3ck3o85xZezXDYHt/Fi3CaaalRsV Aj483+bej2x/dms9q5KY8368f8pQtPsCkXJfELjekasuKW9I19LH8jqGdbkXuHpYX7uL CVW5ZUlKWIOJESDYel09Gaw/4PrZpMyC3e5xe2MZ5UYgPKiTrRZLFtTEjkESG8qSWltP obddcpXL0NL2AxDWn5QqGketbWzk58OvTBNE/iIcWWh3pM85AxmgbhqIIKvtIiYoObHQ 7bnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UjmE+Er6ApEqk3ahEgsA78OS7kl3wInP+/g0sS7Ua4g=; b=CqXTkFjMRC5i8uyhv7AW55bu4ok3LL2iX5ZDJuftS6YSP4DnpG+M7yDtHm4084lsSY ZH+PSBXxiLBoJG4XhmEa3w9WtYQCzDJCDiiCgYExp5FAJByCpBuiIgIeWVyuroqK3CDe JJ6MLglo0mdc/sKwuX69ui8BC7gdtqLuTnbHy2HbvfAC8My21kyYJD+MU5lBjAeVRfhQ k09zTc4Rl6U0mMfYXnnKnSjSHP5U5UCloQvgWfpnFX2B1Z2ziZgCbDTZiYCtJSitxa3o Wa0AdJBXTWpPxX3oAUIJXTH4pv94U2dsms6nebSSise4sJ334YBa2gaRs5d8313sO/1t FAYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yUG24glO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gt15-20020a1709072d8f00b0078d45293551si15013556ejc.487.2022.10.19.02.06.21; Wed, 19 Oct 2022 02:06: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=yUG24glO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232029AbiJSI55 (ORCPT + 99 others); Wed, 19 Oct 2022 04:57:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231913AbiJSI4t (ORCPT ); Wed, 19 Oct 2022 04:56: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 A45909DDAB; Wed, 19 Oct 2022 01:53: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 16D746174B; Wed, 19 Oct 2022 08:48:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 29125C433C1; Wed, 19 Oct 2022 08:48:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169323; bh=Fyg8fRwo1SLwxt6kAwmhh3Qe2G4Vzp20xGrJoqcg8JQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yUG24glOPAl3tbufrOOonqTUXt6OsRmn+pQKNNh6BIctnio821H6aTELHra8xJjzI jfhPncUxRGAPBxwbj9Pj7+4UlsirlHIVc1Vy0mtWQiL0CZiuFXXHVLUTT8o9GZ8Q1b Jo6M51euDL60MK7MOj3XjRmm7CNXufjRPaYkIdfw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alex Deucher , Rodrigo Siqueira , Aurabindo Pillai Subject: [PATCH 6.0 197/862] drm/amd/display: Add HUBP surface flip interrupt handler Date: Wed, 19 Oct 2022 10:24:44 +0200 Message-Id: <20221019083258.696473963@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106310692749412?= X-GMAIL-MSGID: =?utf-8?q?1747106310692749412?= From: Aurabindo Pillai commit 0811b9e4530d7c46542a8993ce6b725d042c6154 upstream. Add the hubp surface flip handler. This fixes some flip timeout issues. Acked-by: Alex Deucher Reviewed-by: Rodrigo Siqueira Signed-off-by: Aurabindo Pillai Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org # 6.0.x Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hubp.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hubp.c +++ b/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hubp.c @@ -179,6 +179,7 @@ static struct hubp_funcs dcn32_hubp_func .hubp_init = hubp3_init, .set_unbounded_requesting = hubp31_set_unbounded_requesting, .hubp_soft_reset = hubp31_soft_reset, + .hubp_set_flip_int = hubp1_set_flip_int, .hubp_in_blank = hubp1_in_blank, .hubp_update_force_pstate_disallow = hubp32_update_force_pstate_disallow, .phantom_hubp_post_enable = hubp32_phantom_hubp_post_enable, From patchwork Wed Oct 19 08:24: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: 4631 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212054wrs; Wed, 19 Oct 2022 02:06:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM68ssTh+pW5AF0VVGlpHzEMztdv54ax1aAuaaGC3uiJAYSaGgISm9Joi7kaMrUj1U7tCSX1 X-Received: by 2002:a65:56c4:0:b0:458:85e:9e65 with SMTP id w4-20020a6556c4000000b00458085e9e65mr6497041pgs.358.1666170396717; Wed, 19 Oct 2022 02:06:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170396; cv=none; d=google.com; s=arc-20160816; b=GYP1MSXXn7kjpDTBdMivIrutW1i5efGEIt1G3qaElnhBhSBLmJ1MBis93rIAHSvmUV 3L/MK6XybnUVIKQtuPR591WwQDTxZOkSCdNPsSWbzGsDqAtom5BRmVqLMd4y3HmIj5F6 MPZxmrD1eA0ZGnNmyUrt+6T63sjJNtzHflVmamkw1Pt508B96huaDF6bu8DsjKpS893B USbsodw4BRj3p8If94P2yngdS3qGSklXioXw7jHGq9rtxuQlWHyHIUOBM0Q2Psy9gr3p +AzLpImIn0fqKxHwiNMpC1hLFC/IzC6xBH+mVVcS/CA/1kAu0omwRdUq5QAetkXRKFCA fQlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=AJufPZK/Qe3ChuD6tChIt811wUzZfnUexvrLSLyNhjI=; b=Q6Q1KfkuxvU2NaqAAIijZqmNzVE/rFBtRcPM0Rf4Fzmhcp6/5AS9uJoa29skSaMqqe 04m0iUawz/FEprejQZ9zOmUXyKGRCx6ODHnANP/++lqY2MJUPNvcBEVXGirKfXiIilkX PRHfsjxyFnl4XlP9CrpcRA1EDS7IWlkDWSwORsw7RPoxFlXaJFWisFZegv0n3kJH6pGp da+tm/Tb/G2Bbao1W0o79YGcG9pYv2EqNZS/YB3Cz7Oa4ZStyj8k37p6BWlXhbkmLZuX qoS/EQMl3WTj42gywdFcrfXP6Duuygu3EK+ofDGCsVveCStnrYPC6dnT5UV2SEAjdMGL OVpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=flTulYrb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c21-20020a6566d5000000b0043077f2f57asi17735795pgw.213.2022.10.19.02.06.17; Wed, 19 Oct 2022 02:06: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=flTulYrb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231654AbiJSIxI (ORCPT + 99 others); Wed, 19 Oct 2022 04:53:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231631AbiJSIwf (ORCPT ); Wed, 19 Oct 2022 04:52:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF8D510DD; Wed, 19 Oct 2022 01:50: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 AE38C6174E; Wed, 19 Oct 2022 08:48:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C0EBBC433C1; Wed, 19 Oct 2022 08:48:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169326; bh=E8K2O0dMkobnDwehst82URM/QgRsMeOSGBHxTus3uzE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=flTulYrbVbounvjNRF/mCmx6vwaeF8XK334nPaB8J6gBhcRSYxxIU2TFj9FfRoyfu 06++ixfvDsReX0iGMMlH97/+bLS9QhoqcrrSC8BigzDqxeAStG9yD3q5FB7Tv6bR5G tOKsOaxcyXOwgr2P6Owd/o8Gk3PB+om5cAcQXfpA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shirish S , Leo Li , Mario Limonciello , Alex Deucher Subject: [PATCH 6.0 198/862] drm/amd/display: explicitly disable psr_feature_enable appropriately Date: Wed, 19 Oct 2022 10:24:45 +0200 Message-Id: <20221019083258.748901590@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106290044927457?= X-GMAIL-MSGID: =?utf-8?q?1747106290044927457?= From: Shirish S commit 6094b9136ca9038b61e9c4b5d25cd5512ce50b34 upstream. [Why] If psr_feature_enable is set to true by default, it continues to be enabled for non capable links. [How] explicitly disable the feature on links that are not capable of the same. Fixes: 8c322309e48e9 ("drm/amd/display: Enable PSR") Signed-off-by: Shirish S Reviewed-by: Leo Li Reviewed-by: Mario Limonciello Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org # 5.15+ Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c @@ -60,11 +60,15 @@ static bool link_supports_psrsu(struct d */ void amdgpu_dm_set_psr_caps(struct dc_link *link) { - if (!(link->connector_signal & SIGNAL_TYPE_EDP)) + if (!(link->connector_signal & SIGNAL_TYPE_EDP)) { + link->psr_settings.psr_feature_enabled = false; return; + } - if (link->type == dc_connection_none) + if (link->type == dc_connection_none) { + link->psr_settings.psr_feature_enabled = false; return; + } if (link->dpcd_caps.psr_info.psr_version == 0) { link->psr_settings.psr_version = DC_PSR_VERSION_UNSUPPORTED; From patchwork Wed Oct 19 08:24: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: 4612 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp211747wrs; Wed, 19 Oct 2022 02:05:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5+sufS0WXOAcjo1k+7eljTk9YtTjfZ+94usdRdQXR9nRY4CvIamnNhv6QhowdB04g5dEN9 X-Received: by 2002:a17:90a:9381:b0:20a:79b7:766a with SMTP id q1-20020a17090a938100b0020a79b7766amr45164409pjo.33.1666170334453; Wed, 19 Oct 2022 02:05:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170334; cv=none; d=google.com; s=arc-20160816; b=CRbqaJkty1Rg3WNhHDG/RnbX+FCPA5osMzXi1oZ1WpNetbUroSkz0K0ufIoJ/zvbRX 07ubcXs+lrHhY5F6uGmUU8JBn5Cx/fr4AlFaYH9gNXwBKbfTwIHrBHDxjpWe9RohQ7ba +oPlVTR2ht0QfNUqqUZ7bBUtIhqkbfxN5F3qg2e1kJIsIscO1uxTg9cdvlGA052Zrx9U gv6VV39TKcWIVtLIuftYXMkr0wVhUqVgnI+5t4Mcm/lIKSJFAfwB1mGULYIX57k3qQM/ 3/LVESS0aGzsw5cr6JI/8+GYqwZyjAMg3OtNlCEIMhLvbXyJZVRa4yPz3SPAHwt/aOny 79pg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pbGowfJbWLnednQmFrhmlkPkk6Wu5RnHzNzo+1VY3PA=; b=B3L6DZXBQTojQF1bvHv7U5ZRj4v0bOTuDc8ojjg6TnMK/7TLYz7dtB9ZM10fQ3Gl0l I6ZD9O2ATuaicyDgtW5fC7zToQremdgxuXReOLBC6YwNRJ+b55pi5yfNQRHNvRrXsJdb gwVp1yJmyguH3Crr+HkIFClCQhvJCpKVtfaDlZGGtCFaX7sMC3TCiwKxXMDTrhC/WLTC w1MhtJcB+UdGEQC4hYQI6pjBnRBCfmwZmpXD7LDZMOjcy8LGJMPISFSzissRrspkbR+K juYXakRM4O/3U2tKunE3TdMtgvzXJnAjQdr83CI8RYMgkD9vl3ZQZujOY+9rmiW9UpCc djlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="t/Eb0C1e"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b5-20020a170902e94500b0017c9ffbab0fsi16949427pll.152.2022.10.19.02.05.15; Wed, 19 Oct 2022 02:05:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="t/Eb0C1e"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231851AbiJSIxS (ORCPT + 99 others); Wed, 19 Oct 2022 04:53:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231668AbiJSIwi (ORCPT ); Wed, 19 Oct 2022 04:52:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17BA94DB1F; Wed, 19 Oct 2022 01:50:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5CF796174F; Wed, 19 Oct 2022 08:48:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6C771C433C1; Wed, 19 Oct 2022 08:48:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169328; bh=rJtz2IPxr4c4FRvm1ReK9DxHRJNRCF9AyV1lc/eWQv0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t/Eb0C1egJZ5d6ZY2Je7l4UBoxqqRrCR8QSHAIbFn94GQVOz3arWk3lEqmRGRptQq eEDv0ImfM6rMHt5wOijfYcKuN/QOB4WsnK7MJfjfIl3LOUwRODnQLbbc3u+c9/fJym NandTvYVjF3pZeaPj9/0EkPjwNFypPTKuG/SeLZc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sonny Jiang , James Zhu , Alex Deucher Subject: [PATCH 6.0 199/862] drm/amdgpu: Enable VCN PG on GC11_0_1 Date: Wed, 19 Oct 2022 10:24:46 +0200 Message-Id: <20221019083258.798479712@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106224571501338?= X-GMAIL-MSGID: =?utf-8?q?1747106224571501338?= From: Sonny Jiang commit e626d9b9c6e038a6918aad1b5affd38f6b9deaed upstream. Enable VCN PG on GC11_0_1 Signed-off-by: Sonny Jiang Reviewed-by: James Zhu Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org # 6.0.x Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/amdgpu/soc21.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/gpu/drm/amd/amdgpu/soc21.c +++ b/drivers/gpu/drm/amd/amdgpu/soc21.c @@ -625,6 +625,7 @@ static int soc21_common_early_init(void AMD_CG_SUPPORT_JPEG_MGCG; adev->pg_flags = AMD_PG_SUPPORT_GFX_PG | + AMD_PG_SUPPORT_VCN | AMD_PG_SUPPORT_VCN_DPG | AMD_PG_SUPPORT_JPEG; adev->external_rev_id = adev->rev_id + 0x1; From patchwork Wed Oct 19 08:24: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: 4606 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp210648wrs; Wed, 19 Oct 2022 02:03:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7J+WwShFatDQ/pi9ULEsBaBBve6NFqiBwyXa0b9MNYjC/UhTcZHxbs4SIAgKTWjTD99rRn X-Received: by 2002:a17:90b:1c8e:b0:205:783b:fe32 with SMTP id oo14-20020a17090b1c8e00b00205783bfe32mr45377453pjb.39.1666170183686; Wed, 19 Oct 2022 02:03:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170183; cv=none; d=google.com; s=arc-20160816; b=QHIuUR/kjRUzakJitkCbaFuN+ZEJibChWs6niSy07wujH372vTlv6M63UdZEehY7mU CJ6ZtKMuODlY7ZLtMJ6Ggf6SQzbv1l5nJ2lUihibSigSOg7csmOaT+vvMyShpdmCz6NM O4QVv20YsRKQy21Ld/GOv3s+nQG4s8L13GTJGva1gwY5fLgdjUIasyFSjsk6K8/rKrSQ uLlZZI9pRBGjFzpP+tIkp7C0TEi3aGHwhBZklAP038aDyH8EchFKTbwNjeB5sVfWFz65 CdKWFeXQXiC1qoJRj3iVRyPKBPMSWjbAelIqhGLM0QHh1/YA8e36rF3WOMus5FYP9kLi yt8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QDu02gvOvxxEn+OLtmIlcMSr1m12Bgyy0Pr6Tz3rExY=; b=hQAdKekAVBnVA4i2x8b0mIZN49lxrKEgDe641SbuvAjh2ztB1PihYw4v71XD+ChQTI yb+2QyCT0X3ewsWFmWkptasBRueyT76f8RWD/TlUyRDs/xeyFDximvWYpybA37WrkUSB Zhs7hb7YR4hjiy2p3siR5GxJCChl6Ye+3d8dWvHeo4oqw2AeSILuAqsmgi2HKjJx7mt2 QMG1WS0tRgpm+7y33w6ldgRaN4WfmtaM7a84jPpbEnWh/BCqs1eD1J1HpFQM9q8jXj2v viJIhdlvhQHMhiZD4gDMi0HJqdqRny5eNuqxJtKEeiD550s1WOgSlck6SpgD4/I7+QZJ ml4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=t1vo3Fbk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v24-20020aa78518000000b00565c1aaa304si15893279pfn.215.2022.10.19.02.02.23; Wed, 19 Oct 2022 02:03: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=t1vo3Fbk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231772AbiJSIwN (ORCPT + 99 others); Wed, 19 Oct 2022 04:52:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231723AbiJSItI (ORCPT ); Wed, 19 Oct 2022 04:49:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58FE79185F; Wed, 19 Oct 2022 01:47:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A9FD061831; Wed, 19 Oct 2022 08:47:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C911C433C1; Wed, 19 Oct 2022 08:47:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169222; bh=IfWrrYSMy5ZOVDZlf3ehBiPo9AMi1p4jSVtv16gPtBo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t1vo3Fbkc7RGb0PJYakkmzHPRtcqXFmiAqAeNIsJgJA3tBVSOsAps8Ox/tfkKyBx0 n+4bo59DcxYoImVUpRcxQ0WPp2K0qpKriw7bHYIWdeN38rgiT4dciQMNyUs8FbcPBg JqEr1TxoD+Lo72E31BT2b4enhQDPmPtg0ZF1jY6o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ruili Ji , Yifan Zhang , Alex Deucher Subject: [PATCH 6.0 200/862] drm/amdgpu: Enable F32_WPTR_POLL_ENABLE in mqd Date: Wed, 19 Oct 2022 10:24:47 +0200 Message-Id: <20221019083258.845787699@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106066033758984?= X-GMAIL-MSGID: =?utf-8?q?1747106066033758984?= From: Ruili Ji commit 21a550de5faf9f54013334c9a6a7643b8fd80b36 upstream. This patch is to fix the SDMA user queue doorbell missing issue on SDMA 6.0. F32_WPTR_POLL_ENABLE has to be set if doorbell mode is used. Otherwise ringing SDMA user queue doorbell can't wake up system from gfxoff. Signed-off-by: Ruili Ji Reviewed-by: Yifan Zhang Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org # 6.0.x Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c | 3 ++- drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v11.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c @@ -910,7 +910,8 @@ static int sdma_v6_0_mqd_init(struct amd m->sdmax_rlcx_rb_cntl = order_base_2(prop->queue_size / 4) << SDMA0_QUEUE0_RB_CNTL__RB_SIZE__SHIFT | 1 << SDMA0_QUEUE0_RB_CNTL__RPTR_WRITEBACK_ENABLE__SHIFT | - 4 << SDMA0_QUEUE0_RB_CNTL__RPTR_WRITEBACK_TIMER__SHIFT; + 4 << SDMA0_QUEUE0_RB_CNTL__RPTR_WRITEBACK_TIMER__SHIFT | + 1 << SDMA0_QUEUE0_RB_CNTL__F32_WPTR_POLL_ENABLE__SHIFT; m->sdmax_rlcx_rb_base = lower_32_bits(prop->hqd_base_gpu_addr >> 8); m->sdmax_rlcx_rb_base_hi = upper_32_bits(prop->hqd_base_gpu_addr >> 8); --- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v11.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v11.c @@ -375,7 +375,8 @@ static void update_mqd_sdma(struct mqd_m << SDMA0_QUEUE0_RB_CNTL__RB_SIZE__SHIFT | q->vmid << SDMA0_QUEUE0_RB_CNTL__RB_VMID__SHIFT | 1 << SDMA0_QUEUE0_RB_CNTL__RPTR_WRITEBACK_ENABLE__SHIFT | - 6 << SDMA0_QUEUE0_RB_CNTL__RPTR_WRITEBACK_TIMER__SHIFT; + 6 << SDMA0_QUEUE0_RB_CNTL__RPTR_WRITEBACK_TIMER__SHIFT | + 1 << SDMA0_QUEUE0_RB_CNTL__F32_WPTR_POLL_ENABLE__SHIFT; m->sdmax_rlcx_rb_base = lower_32_bits(q->queue_address >> 8); m->sdmax_rlcx_rb_base_hi = upper_32_bits(q->queue_address >> 8); From patchwork Wed Oct 19 08:24: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: 5110 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp250893wrs; Wed, 19 Oct 2022 03:50:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7oMyHjkBePjmUkvk7Lz/dN/VXI3vexGUnFzzCWHEhjJHjbi5aFcTveosmvhA9HLTqizkc9 X-Received: by 2002:a05:6402:154c:b0:459:b29:da88 with SMTP id p12-20020a056402154c00b004590b29da88mr6969856edx.296.1666176618772; Wed, 19 Oct 2022 03:50:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176618; cv=none; d=google.com; s=arc-20160816; b=UTxb9sFOigQXDik4zci440XQF0Aou1wh+EaXKZoHeDlgS1z0ku67sTeTsE0YDVLzqj +kVHBGoM0XAEWKtojsQS1Zu7iaOuWJCsMupkMaQ5+zEzmiq2zJ6kivfxx8bAKXdz3oAp oanY3V4iTOwuxSCHV91aLFdOXf6Pusp/WQCquKA5wBV9yeRkpBY7W/UevtlYw6SWCZeG l3oHHmADNa7B8BvP+INNXEdRcFcUbJehVs5XSSjRQIHChDAWo+zgi0ca1g6CDRPBUy+I S4f2XUp8+PPJj34RYpUsKtTapqqKIAAV8Bk/3CtjIlKDfmhHz6yrlivbNQGzoBza+tXb +4rQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kbKpMI0xfcDuAac3hFUgcFSRHLpa5m/7w1vcjv0hyKs=; b=El146oRXIA6toUpFbcFiFBnRK1BZHoDDFkBCtYPC60JPvE97O3DTmYhotpjjoTEpGT uCN8C6UjvxFxvW8xGo6Avt45azLCgx19xcci7kkuKWg7YESCbC6GtZLprW/86thiBHL1 V50zm58fYcdFtcy0PK/6opw+Gftg8zxpahgrC2duGZ5Cw6Jo3a1l+7Y4lOg95yLzV6Sh b+rJox99wAmmFnPFc0/bsXBJbWyxQL/VGRfFXQuNbfoIFfsvz8JAGh4EZPksezSvFyJf wGaPZTKEDkhqpHJSmZ4hlNbMDw2RvnTnMiGSCSCoQ4FdR710iwjrsjHVk4+ixpgKp+86 lUbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=x3EGwfbl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b15-20020a056402350f00b0044ee4ec8915si16182247edd.39.2022.10.19.03.49.54; Wed, 19 Oct 2022 03: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=x3EGwfbl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234122AbiJSKsI (ORCPT + 99 others); Wed, 19 Oct 2022 06:48:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233061AbiJSKqE (ORCPT ); Wed, 19 Oct 2022 06:46: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 C594B15A32B; Wed, 19 Oct 2022 03:21: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 4EA57B822C8; Wed, 19 Oct 2022 08:47:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F7AFC433C1; Wed, 19 Oct 2022 08:47:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169225; bh=puH1w9DmpDqITltvyjb9R5pU9ClMf1szAJHb55f+86w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x3EGwfbl7sTHvBzandBzImKUQpBDljkvSpA4ep+PSZrPE3E77zTqJqSBj29tBNllj nSE02UkXTSvIRIk2fvzpYaZ1HbwFfsUYgXfEJSejqgTqHXrgXuD1zTR8HTD67RA/Z7 JEvd1AIzsoOzYtO/pS0vC8c3IC9lYHZQ0k4gKGrI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Paulo Alcantara (SUSE)" , Steve French Subject: [PATCH 6.0 201/862] smb3: must initialize two ACL struct fields to zero Date: Wed, 19 Oct 2022 10:24:48 +0200 Message-Id: <20221019083258.886035119@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112814019335221?= X-GMAIL-MSGID: =?utf-8?q?1747112814019335221?= From: Steve French commit f09bd695af3b8ab46fc24e5d6954a24104c38387 upstream. Coverity spotted that we were not initalizing Stbz1 and Stbz2 to zero in create_sd_buf. Addresses-Coverity: 1513848 ("Uninitialized scalar variable") Cc: Reviewed-by: Paulo Alcantara (SUSE) Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- fs/cifs/smb2pdu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -2411,7 +2411,7 @@ create_sd_buf(umode_t mode, bool set_own unsigned int acelen, acl_size, ace_count; unsigned int owner_offset = 0; unsigned int group_offset = 0; - struct smb3_acl acl; + struct smb3_acl acl = {}; *len = roundup(sizeof(struct crt_sd_ctxt) + (sizeof(struct cifs_ace) * 4), 8); @@ -2484,6 +2484,7 @@ create_sd_buf(umode_t mode, bool set_own acl.AclRevision = ACL_REVISION; /* See 2.4.4.1 of MS-DTYP */ acl.AclSize = cpu_to_le16(acl_size); acl.AceCount = cpu_to_le16(ace_count); + /* acl.Sbz1 and Sbz2 MBZ so are not set here, but initialized above */ memcpy(aclptr, &acl, sizeof(struct smb3_acl)); buf->ccontext.DataLength = cpu_to_le32(ptr - (__u8 *)&buf->sd); From patchwork Wed Oct 19 08:24: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: 5117 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp251024wrs; Wed, 19 Oct 2022 03:50:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM64fh1RzWMkPw3YXIfeJ/JM1g5LjPd5pICpQPQb0U7gA0XszuvrFITfnPfe1g1vODnpEzL/ X-Received: by 2002:a05:6402:2552:b0:45d:ecf:b23 with SMTP id l18-20020a056402255200b0045d0ecf0b23mr6799241edb.255.1666176638313; Wed, 19 Oct 2022 03:50:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176638; cv=none; d=google.com; s=arc-20160816; b=P5qZQZXb3VmUusUYfb+RA205tiZzH+lIVpIJ+5DINOfOUapJvnJuZaIQPFRMCyEW8m AKNwrI6snQtIPWvflBjvyJ/ITjKt5UWPcWV7CQdNJBIHUg5rDdVYWcFML7JJiyIu2Twi w0snbCNmbRaEu5HAivwPVt0eUKI96m/XZ541mpXLVpeyBW9l/aPqAIoqo899vB5g0e0r 4wgwg2BQXTnRGZBgZc+O97nXHEDXrG8ObOL5T+82dN/POFuked6tsvX/Ru1Cvj3mbRHh Wwoz6+H8rQPyHddEitW+e2XkN9skrb7Q4Kw1CUHon2LsbiihMJxQ8F7MyGOH1w2MWJto RGVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YCRKJCfcbu79sBq4qIZn4FIjwAspe2hJvwsrrGU6Z2c=; b=GMMAD+HEara02fHegH3f5kNq/NslRKN5d3TpR7UQGRyULY3BNbOcCJEkXt9qKxNISw exB9Gi1Q92iFFp923mwi8rqFYk9A1SIcqmtzcdxAesuEHlQ9iiPOkrJJMk318O29S5k1 XL1FYNA87UNKmTUiqZBKGNsAGuaoEhFE/skkyyzy/nd8hSatZeLoifzqSRBg1fn95qZ5 Ym6ffPdfZh0AK3LAdO1xXAEzyv1nLLPWWoDWfaxlTWWpQpApHU8Z91N3sjgkz71z1+RH lYcWz68Loaw82ECe6WFx2qf+Rky5FHARlxP/AHYMwRYYY1kp3ShYWtepFQA9Y0MRAt/E HB0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VDJGp1yC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m23-20020a1709060d9700b0078bcc872a6esi12087021eji.360.2022.10.19.03.50.14; Wed, 19 Oct 2022 03:50: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=VDJGp1yC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234416AbiJSKtB (ORCPT + 99 others); Wed, 19 Oct 2022 06:49:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233482AbiJSKrA (ORCPT ); Wed, 19 Oct 2022 06:47:00 -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 7B3FA15B119; Wed, 19 Oct 2022 03:21: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 1038DB82319; Wed, 19 Oct 2022 08:47:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 694F9C43145; Wed, 19 Oct 2022 08:47:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169227; bh=QOgwnGXtJ5WnEebGLcaB/JmKLZooNWI4me6Yyig3MGY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VDJGp1yCB7sK4rYe4cy80fPUXTGGI1aLRPhbIx4mJ1KpEGrHMrNTmFuUVIqTNeJdT ZekDH3sC8zDcCt+GnHzsC7eRF2s6mGlU73w6Qd2n8mdOF781Q/pPueeYhiqyXncnCS ++8Wv4aQ/0HAkNgYN9IKx343cBi/B4AObG0sL+MM= 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 6.0 202/862] selinux: use "grep -E" instead of "egrep" Date: Wed, 19 Oct 2022 10:24:49 +0200 Message-Id: <20221019083258.934931280@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112834739844117?= X-GMAIL-MSGID: =?utf-8?q?1747112834739844117?= 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 @@ -78,7 +78,7 @@ cd /etc/selinux/dummy/contexts/files $SF -F file_contexts / mounts=`cat /proc/$$/mounts | \ - egrep "ext[234]|jfs|xfs|reiserfs|jffs2|gfs2|btrfs|f2fs|ocfs2" | \ + grep -E "ext[234]|jfs|xfs|reiserfs|jffs2|gfs2|btrfs|f2fs|ocfs2" | \ awk '{ print $2 '}` $SF -F file_contexts $mounts From patchwork Wed Oct 19 08:24: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: 5125 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp251425wrs; Wed, 19 Oct 2022 03:51:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7rZdESfkQ4BCVCTQqL+xYqHbd6/55JUsWAZLEIVkwkLlhgpob7hosHr848qeI9gQxMu432 X-Received: by 2002:a17:907:2710:b0:78d:9be4:492a with SMTP id w16-20020a170907271000b0078d9be4492amr6015335ejk.151.1666176700998; Wed, 19 Oct 2022 03:51:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176700; cv=none; d=google.com; s=arc-20160816; b=RuVXB5qbscTEjgDZhBvFF5MApHNddKIBwnuB6ie0bqL0uY3bYMeRVooJyLn4Pdiimm fT8uXyYr3K20pJs3Nq6zhF/FlpDLIbqhTZuCzmNxpa542EHEH+DF5o2eOB2e11Vo52iG 648gvO1PQimChpUB9a/kzZcAadoyAoAykRfR6prNFMzJz5tTAK8A/L6h0h8g1M10SLRj VA66nfxN6gvL0htshpu9rmyKlqp9t/6rVZUURU2H1eoUNCpi3INzGB01vRAy4hDMrcwv /38hzFMUHSCWHP9iBOFbmQSmQhc9be8qijn1YOJziNpmup2z6b2UdSs1RG2HviuvHAmc slbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+O/+gog64ttEPELBpFAxYHgbWKBe4ovNezxJhgAKnCU=; b=KK85ApFBCpM/C2rHr8ROARWaJXCtJnLvktDFtx2x9EIjWSNuv70/nzcoVrfXVcyNKt r3e2/W8FBGm4rsjGkshhag25UUzVp5V2MOFaIzadQqxOOAvy744S3Gi05pzSGtZ9Q0Pu +FE6y7PMBZ8odqRDeVv49Wz/7K47HOocYZ44TrBSCHaJNnLUimUYmyBs92ozwHfLZt9v hIXHVuyJwwFxAHh3uXwQ6LBCb7D1dACTYd0HMDh8wUjFX2GwMuGp99QlVLdgTYJ7l93x M8+k2K+L/gb/m5uQiqUfIwoXsRqXGwqhPUoxRjmRZWPDGmUFrP7xmk1ak/fmtm1qEn3k vttw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WEpHNCbr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bo12-20020a170906d04c00b007828ae31468si10874682ejb.698.2022.10.19.03.51.15; Wed, 19 Oct 2022 03:51: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=WEpHNCbr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233586AbiJSKuI (ORCPT + 99 others); Wed, 19 Oct 2022 06:50:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233848AbiJSKrq (ORCPT ); Wed, 19 Oct 2022 06:47:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E92B15B117; Wed, 19 Oct 2022 03:21: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 1D205B8231B; Wed, 19 Oct 2022 08:47:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71B85C433D7; Wed, 19 Oct 2022 08:47:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169230; bh=7Q6MPwhmrr5duWhaJn7LPUnD03iMIW/ggf8M3L2Dfm0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WEpHNCbrn8SRy9cOEnx0tMEWYXafRSgNlA0Q7obZqmiXk08i1G1EUTiqC49gNWwii pZ7oPzhP8VVQPf+DBJGs/Ri9c16c7CJnniNsqnPJpcIT5zIxBWzxfIzN83Y7Vbnuav 51ZtjzZETTi1OU6quNOyYhKi2B2v9GOkQLz49/mU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christian Brauner , Mimi Zohar , Sasha Levin Subject: [PATCH 6.0 203/862] ima: fix blocking of security.ima xattrs of unsupported algorithms Date: Wed, 19 Oct 2022 10:24:50 +0200 Message-Id: <20221019083258.973461857@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112900811508818?= X-GMAIL-MSGID: =?utf-8?q?1747112900811508818?= From: Mimi Zohar [ Upstream commit 5926586f291b53cb8a0c9631fc19489be1186e2d ] Limit validating the hash algorithm to just security.ima xattr, not the security.evm xattr or any of the protected EVM security xattrs, nor posix acls. Fixes: 50f742dd9147 ("IMA: block writes of the security.ima xattr with unsupported algorithms") Reported-by: Christian Brauner Acked-by: Christian Brauner (Microsoft) Signed-off-by: Mimi Zohar Signed-off-by: Sasha Levin --- security/integrity/ima/ima_appraise.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/security/integrity/ima/ima_appraise.c b/security/integrity/ima/ima_appraise.c index bde74fcecee3..3e0fbbd99534 100644 --- a/security/integrity/ima/ima_appraise.c +++ b/security/integrity/ima/ima_appraise.c @@ -750,22 +750,26 @@ int ima_inode_setxattr(struct dentry *dentry, const char *xattr_name, const struct evm_ima_xattr_data *xvalue = xattr_value; int digsig = 0; int result; + int err; result = ima_protect_xattr(dentry, xattr_name, xattr_value, xattr_value_len); if (result == 1) { if (!xattr_value_len || (xvalue->type >= IMA_XATTR_LAST)) return -EINVAL; + + err = validate_hash_algo(dentry, xvalue, xattr_value_len); + if (err) + return err; + digsig = (xvalue->type == EVM_IMA_XATTR_DIGSIG); } else if (!strcmp(xattr_name, XATTR_NAME_EVM) && xattr_value_len > 0) { digsig = (xvalue->type == EVM_XATTR_PORTABLE_DIGSIG); } if (result == 1 || evm_revalidate_status(xattr_name)) { - result = validate_hash_algo(dentry, xvalue, xattr_value_len); - if (result) - return result; - ima_reset_appraise_flags(d_backing_inode(dentry), digsig); + if (result == 1) + result = 0; } return result; } From patchwork Wed Oct 19 08:24: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: 5101 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp250213wrs; Wed, 19 Oct 2022 03:48:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6pG2KmohpljaswlhFuS49YSjHSsEIeD6GawtkGfmqpSHVkuoMnbE5rkFHSX2iJdFm/rVpT X-Received: by 2002:a17:906:7193:b0:78d:b87e:6aa5 with SMTP id h19-20020a170906719300b0078db87e6aa5mr6198082ejk.580.1666176507164; Wed, 19 Oct 2022 03:48:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176507; cv=none; d=google.com; s=arc-20160816; b=XowwsV00A8R7V3S7eD0Kz5709kA/ZBajf0WyaEgbavo0cmVhLhy3hf3JMrp97R4UeD AgtX+e7ZKbdYQwBLvVVmQeWXZ4JTj82KzM6JQg1b/0coNqYXQ9zvBa0jcjvPuNLfLWMh ne70Ba02Dgg17L+pIAQI1bZ2NaleeTCS4y5QMutrPszQFpndCIR+du1NXcE7KiIbT9Ty RpCB1oTTQm4TXYowrmIVbzkp/kk2hDKkcj4MCrZCg9KZ/yl4bEDSqx2LyEqE+h1Nqu2h leJwW01XxweEYDiPCLLepV/SY+Ws/iRggazLHvHXkPxdR5v/Q/jXy1hP0es1dMecZVwx QBag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UuynBRzC068PlSLg8YaI9IPzgPbUSV14I+dRrJecnJs=; b=SBS4fEHN1MExg9SsDwgXEUwqaAavS/gDP5tnwS2Jdj5AghXWyt9eto3ABFd5DL7ogk +BrE+6M2MO7br+TaW5V2g9n4P7vpWCJok8PnaTJuaYsdnPGAjglBztikT0k9HWw7yoUH a03iVhysMNG2MQ7geh9ewzIUoYTMZNxv2NlcgTL4ekjyJavbb9z5wZnXu1magZvfE2bd 0ouvBenBYFCTISAcRn2s55rODhWJkUWtfUluqXkSHn1ERad3OQhdok+IyFlGbJaauXVI 8WV2yJp29/YPKI8cdoBF77cS+4xpEYOvr366j3E1T4ikZYCUhm5SxX7Lq8WNtd08MJ66 Cxzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tqKdZp3u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p28-20020a50cd9c000000b00458ce1a20dfsi12408348edi.271.2022.10.19.03.48.02; Wed, 19 Oct 2022 03: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=tqKdZp3u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233213AbiJSKri (ORCPT + 99 others); Wed, 19 Oct 2022 06:47:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232801AbiJSKp1 (ORCPT ); Wed, 19 Oct 2022 06:45:27 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D38E26AF7; Wed, 19 Oct 2022 03:21:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id F3E36B82304; Wed, 19 Oct 2022 08:47:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4ED99C433C1; Wed, 19 Oct 2022 08:47:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169233; bh=NNlN43yRYP/GS1meNtY2/HGKhqpVXSar/Y/KnVaTkSA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tqKdZp3u/pujysaXeK19W8Y6rXPWUg8vUOpi4LM4JllX5UtheOR5vDqMVC0HGpaRn l4kvToE1sIMcSM8jACVHntCgqHBRth2Sk+si3gavR/BkgAvVFU4AsLk6B6j1YvNnvM f5hg69YqBKVVSo9LTcGIgLwi4pEzFv/XuvdUBfh0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert OCallahan , Ondrej Mosnacek , Peter Xu , "Christian Brauner (Microsoft)" , Paul Moore , Sasha Levin Subject: [PATCH 6.0 204/862] userfaultfd: open userfaultfds with O_RDONLY Date: Wed, 19 Oct 2022 10:24:51 +0200 Message-Id: <20221019083259.023119499@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112697200236951?= X-GMAIL-MSGID: =?utf-8?q?1747112697200236951?= From: Ondrej Mosnacek [ Upstream commit abec3d015fdfb7c63105c7e1c956188bf381aa55 ] Since userfaultfd doesn't implement a write operation, it is more appropriate to open it read-only. When userfaultfds are opened read-write like it is now, and such fd is passed from one process to another, SELinux will check both read and write permissions for the target process, even though it can't actually do any write operation on the fd later. Inspired by the following bug report, which has hit the SELinux scenario described above: https://bugzilla.redhat.com/show_bug.cgi?id=1974559 Reported-by: Robert O'Callahan Fixes: 86039bd3b4e6 ("userfaultfd: add new syscall to provide memory externalization") Signed-off-by: Ondrej Mosnacek Acked-by: Peter Xu Acked-by: Christian Brauner (Microsoft) Signed-off-by: Paul Moore Signed-off-by: Sasha Levin --- fs/userfaultfd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c index 175de70e3adf..0c1d33c4f74c 100644 --- a/fs/userfaultfd.c +++ b/fs/userfaultfd.c @@ -991,7 +991,7 @@ static int resolve_userfault_fork(struct userfaultfd_ctx *new, int fd; fd = anon_inode_getfd_secure("[userfaultfd]", &userfaultfd_fops, new, - O_RDWR | (new->flags & UFFD_SHARED_FCNTL_FLAGS), inode); + O_RDONLY | (new->flags & UFFD_SHARED_FCNTL_FLAGS), inode); if (fd < 0) return fd; @@ -2094,7 +2094,7 @@ SYSCALL_DEFINE1(userfaultfd, int, flags) mmgrab(ctx->mm); fd = anon_inode_getfd_secure("[userfaultfd]", &userfaultfd_fops, ctx, - O_RDWR | (flags & UFFD_SHARED_FCNTL_FLAGS), NULL); + O_RDONLY | (flags & UFFD_SHARED_FCNTL_FLAGS), NULL); if (fd < 0) { mmdrop(ctx->mm); kmem_cache_free(userfaultfd_ctx_cachep, ctx); From patchwork Wed Oct 19 08:24: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: 4715 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp213903wrs; Wed, 19 Oct 2022 02:11:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ftq1DpWAhJEleosGv5Pu+q2G6gxZd7DNUtt6F3VvHtF22pvxFZZ6I8fd+K8H/myiOrNWL X-Received: by 2002:a05:6402:1d4a:b0:45c:98a9:7ba3 with SMTP id dz10-20020a0564021d4a00b0045c98a97ba3mr6524530edb.418.1666170684407; Wed, 19 Oct 2022 02:11:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170684; cv=none; d=google.com; s=arc-20160816; b=uHZh6x1kVWqS+kwO1BET1Mvap4cBQDHNnHVARoru9NKpd0YDrsUA0J/t/ac9qIkpig JiKWws/3+B7c1YZaw/nyno9rC25U2KiOfsTPgqu7lyNe+uzGrnet3N1AeOMJ59V1qXDZ o0+ZqGF0K2kXFgbfZFrmNjlxnol6QhjolKy5sY/FyXrEoyjBEta2pkqK7DtxfW0+fBcR lwK1G27NTP4d1d5EKJcs7V0HME1KJdCxrG7WhJpdP2nu202dw6tlVjnzOR7mHCVj4Ox1 NNuRpOjfcgm1k8wEYw9JAvxuDh/ukSxuBg30H72hkbyfs//UNJtUHQyM+YhtaPgHWRv8 e6cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=86QKH4uoIGaN/WKXqRjXz3rhF3jvpBIslV4B2ZfE7k4=; b=VKIpBRAIhrq2UGdB4BLDAS8Eo0o9soFS5KCUNTNrVcC+Hj5JFDzXSF9CBrNkuWyKVH qvXxx3ZbS4PPTJ7U0By6lCtTWc/ltzaE8Fdhdge7P/MN6pZUWpMeCQ3W1F79oJ3AiTnh eiQbtbqzEuLkLJDj1xF2HTJ8QRb/QmyIRCEBCWuQc3RQNWrLo6CZrQkETCNy8E9qQXRx LqK0gW4pQtft4+kVOMLfEkk51s21pvQ4+6uHN5GqkAeGD1UUxfHuZmM4ZUnLKWBZ83Xv sO7QvVANz/YlcNbtsn6IfSvuCPZ1YmuVoBq6qJYB8BTXt7twu9ite8ZboippHPqGVDOe 9L7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Wpy5bTau; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l1-20020a1709067d4100b00782c1d273cbsi12385917ejp.392.2022.10.19.02.10.58; Wed, 19 Oct 2022 02:11: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=Wpy5bTau; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232426AbiJSJHX (ORCPT + 99 others); Wed, 19 Oct 2022 05:07:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232740AbiJSJFB (ORCPT ); Wed, 19 Oct 2022 05:05:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 891089F352; Wed, 19 Oct 2022 01:58: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 6CB0861825; Wed, 19 Oct 2022 08:47:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E71FC433C1; Wed, 19 Oct 2022 08:47:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169236; bh=6sfN6h7kHELTbQTCxfCPXDQwM4IwdhxqVVry8xqfrcI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wpy5bTauG/R5fAi7OekEvj/tHQStnCf3n8Ve28omq/j7xpFsHRwRo7LTv6CxydvJo rIz1HgHF0Z9ylUg5+Np89pIRFz2YeTqKutzP9LRakngoGtjJnGWKE7RB8xhkg/LIZ6 lneg/X2YpGLqASQp9dlw0Pmwaf8nSwJQqFvM4+Iw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Christian Brauner (Microsoft)" , Sasha Levin , Seth Forshee Subject: [PATCH 6.0 205/862] ntfs3: rework xattr handlers and switch to POSIX ACL VFS helpers Date: Wed, 19 Oct 2022 10:24:52 +0200 Message-Id: <20221019083259.069885064@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106591539822830?= X-GMAIL-MSGID: =?utf-8?q?1747106591539822830?= From: Christian Brauner [ Upstream commit a26aa12384158116c0d80d50e0bdc7b3323551e2 ] The xattr code in ntfs3 is currently a bit confused. For example, it defines a POSIX ACL i_op->set_acl() method but instead of relying on the generic POSIX ACL VFS helpers it defines its own set of xattr helpers with the consequence that i_op->set_acl() is currently dead code. Switch ntfs3 to rely on the VFS POSIX ACL xattr handlers. Also remove i_op->{g,s}et_acl() methods from symlink inode operations. Symlinks don't support xattrs. This is a preliminary change for the following patches which move handling idmapped mounts directly in posix_acl_xattr_set(). This survives POSIX ACL xfstests. Fixes: be71b5cba2e6 ("fs/ntfs3: Add attrib operations") Signed-off-by: Christian Brauner (Microsoft) Reviewed-by: Seth Forshee (DigitalOcean) > Signed-off-by: Sasha Levin --- fs/ntfs3/inode.c | 2 - fs/ntfs3/xattr.c | 102 +++-------------------------------------------- 2 files changed, 6 insertions(+), 98 deletions(-) diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c index 51363d4e8636..26a76ebfe58f 100644 --- a/fs/ntfs3/inode.c +++ b/fs/ntfs3/inode.c @@ -1927,8 +1927,6 @@ const struct inode_operations ntfs_link_inode_operations = { .setattr = ntfs3_setattr, .listxattr = ntfs_listxattr, .permission = ntfs_permission, - .get_acl = ntfs_get_acl, - .set_acl = ntfs_set_acl, }; const struct address_space_operations ntfs_aops = { diff --git a/fs/ntfs3/xattr.c b/fs/ntfs3/xattr.c index 6ae1f56b7358..7de8718c68a9 100644 --- a/fs/ntfs3/xattr.c +++ b/fs/ntfs3/xattr.c @@ -625,67 +625,6 @@ int ntfs_set_acl(struct user_namespace *mnt_userns, struct inode *inode, return ntfs_set_acl_ex(mnt_userns, inode, acl, type, false); } -static int ntfs_xattr_get_acl(struct user_namespace *mnt_userns, - struct inode *inode, int type, void *buffer, - size_t size) -{ - struct posix_acl *acl; - int err; - - if (!(inode->i_sb->s_flags & SB_POSIXACL)) { - ntfs_inode_warn(inode, "add mount option \"acl\" to use acl"); - return -EOPNOTSUPP; - } - - acl = ntfs_get_acl(inode, type, false); - if (IS_ERR(acl)) - return PTR_ERR(acl); - - if (!acl) - return -ENODATA; - - err = posix_acl_to_xattr(&init_user_ns, acl, buffer, size); - posix_acl_release(acl); - - return err; -} - -static int ntfs_xattr_set_acl(struct user_namespace *mnt_userns, - struct inode *inode, int type, const void *value, - size_t size) -{ - struct posix_acl *acl; - int err; - - if (!(inode->i_sb->s_flags & SB_POSIXACL)) { - ntfs_inode_warn(inode, "add mount option \"acl\" to use acl"); - return -EOPNOTSUPP; - } - - if (!inode_owner_or_capable(mnt_userns, inode)) - return -EPERM; - - if (!value) { - acl = NULL; - } else { - acl = posix_acl_from_xattr(&init_user_ns, value, size); - if (IS_ERR(acl)) - return PTR_ERR(acl); - - if (acl) { - err = posix_acl_valid(&init_user_ns, acl); - if (err) - goto release_and_out; - } - } - - err = ntfs_set_acl(mnt_userns, inode, acl, type); - -release_and_out: - posix_acl_release(acl); - return err; -} - /* * ntfs_init_acl - Initialize the ACLs of a new inode. * @@ -852,23 +791,6 @@ static int ntfs_getxattr(const struct xattr_handler *handler, struct dentry *de, goto out; } -#ifdef CONFIG_NTFS3_FS_POSIX_ACL - if ((name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1 && - !memcmp(name, XATTR_NAME_POSIX_ACL_ACCESS, - sizeof(XATTR_NAME_POSIX_ACL_ACCESS))) || - (name_len == sizeof(XATTR_NAME_POSIX_ACL_DEFAULT) - 1 && - !memcmp(name, XATTR_NAME_POSIX_ACL_DEFAULT, - sizeof(XATTR_NAME_POSIX_ACL_DEFAULT)))) { - /* TODO: init_user_ns? */ - err = ntfs_xattr_get_acl( - &init_user_ns, inode, - name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1 - ? ACL_TYPE_ACCESS - : ACL_TYPE_DEFAULT, - buffer, size); - goto out; - } -#endif /* Deal with NTFS extended attribute. */ err = ntfs_get_ea(inode, name, name_len, buffer, size, NULL); @@ -981,22 +903,6 @@ static noinline int ntfs_setxattr(const struct xattr_handler *handler, goto out; } -#ifdef CONFIG_NTFS3_FS_POSIX_ACL - if ((name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1 && - !memcmp(name, XATTR_NAME_POSIX_ACL_ACCESS, - sizeof(XATTR_NAME_POSIX_ACL_ACCESS))) || - (name_len == sizeof(XATTR_NAME_POSIX_ACL_DEFAULT) - 1 && - !memcmp(name, XATTR_NAME_POSIX_ACL_DEFAULT, - sizeof(XATTR_NAME_POSIX_ACL_DEFAULT)))) { - err = ntfs_xattr_set_acl( - mnt_userns, inode, - name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1 - ? ACL_TYPE_ACCESS - : ACL_TYPE_DEFAULT, - value, size); - goto out; - } -#endif /* Deal with NTFS extended attribute. */ err = ntfs_set_ea(inode, name, name_len, value, size, flags, 0); @@ -1086,7 +992,7 @@ static bool ntfs_xattr_user_list(struct dentry *dentry) } // clang-format off -static const struct xattr_handler ntfs_xattr_handler = { +static const struct xattr_handler ntfs_other_xattr_handler = { .prefix = "", .get = ntfs_getxattr, .set = ntfs_setxattr, @@ -1094,7 +1000,11 @@ static const struct xattr_handler ntfs_xattr_handler = { }; const struct xattr_handler *ntfs_xattr_handlers[] = { - &ntfs_xattr_handler, +#ifdef CONFIG_NTFS3_FS_POSIX_ACL + &posix_acl_access_xattr_handler, + &posix_acl_default_xattr_handler, +#endif + &ntfs_other_xattr_handler, NULL, }; // clang-format on From patchwork Wed Oct 19 08:24: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: 5097 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp249971wrs; Wed, 19 Oct 2022 03:47:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM49gEhVjDeeTzbF6PA/4bfuoc2C0wvUJYNhE2W+dmH19r84NpA4aNQ91ID+/Juz8cWLkK+S X-Received: by 2002:a05:6402:3806:b0:450:bad8:8cd5 with SMTP id es6-20020a056402380600b00450bad88cd5mr7017459edb.305.1666176462328; Wed, 19 Oct 2022 03:47:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176462; cv=none; d=google.com; s=arc-20160816; b=FljOw9u0U6xUnY8O0Db0s9mDNPEMsh2a6B3dZAOgTxcH5LroQCN7cqgwa8vXWgu6s+ ty3Dt+Cx+rMDMFwVfnzvHB5FxKIguJ+x18val8Zk3szy7wa7+j4ej+JUhCxS//qrmijV jZRLC9mLtMY4gdQorb+wln1eqsTUTIKagotMDXRe2aUP3qw2JrKePJvovTpjvSU9j3qQ /CZgFXLLzdlT2FnkmED58NLObPfT7Ihneo7P5l4ApvCzXTK98F0KCN6+ySNS30U6IHjP qb7YOcFpysveLi4NxiVr0FxuB3SbN5jayYIKR0r+7QhTiBmrDZKqJp3rCV46RYL9zXav F0jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ECdlPo2HcH5m/MhhAi1p9TSPoKOiFn/cC0ssIDVBA9k=; b=Q4UJp830cQup4CxoqmDRvjhQV6UxW5k19eDOd0lCHGdOtPBnJ6+ZqpTKj6RGBYbZ29 uVda6hCwAAU9TVMLOPV/QJPIdsmnFDPGZ2KiSuNAdTapfpIObGRve2sDlL+HX8+Aijyd Ddople0Z6Gcp/ry6ZtFG+AdPEaFR1oUE8C9gDB2OAkkWNgYWO1RqPQtQb0bcAtcYsqC2 o/gVGSo00k5gYpwcbzAkrsILsMnu6YpY1X+4H1OlaFy0PnCrP3hhQLp19sQU8hEzbcBL UFgUzFFjJ8hT1QUysI/diwtMz8ahICIkVAc4AqjvORMOyXQ2wsEFswqZoeZ2NRjVCIdJ /x1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZESqIxcZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v22-20020a056402349600b0045cea9cf231si15979056edc.566.2022.10.19.03.47.17; Wed, 19 Oct 2022 03:47: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=ZESqIxcZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232481AbiJSKrB (ORCPT + 99 others); Wed, 19 Oct 2022 06:47:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231977AbiJSKop (ORCPT ); Wed, 19 Oct 2022 06:44:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D75121F2CF; Wed, 19 Oct 2022 03:21:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DF565B8231A; Wed, 19 Oct 2022 08:47:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56839C433D7; Wed, 19 Oct 2022 08:47:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169239; bh=fh45nFe3rfXMwurcMd+R47taX1sPGPQRXV1ZR1n3M1Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZESqIxcZ3aXcNbkzvFGfnKqojtum0EV82/nlfKs4eABMLnEf9jfSPbn393p9pcLTy wuuRmfsVDIG96KiEvHN7EP0ioTUJkELHFAA+dkncML4ZnHgSFFb3bcsinFhHwnGkZE 5SeZTTnwSTuqhXcR+AfLDDlEsE7E5glc2XY+NhOI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Christian Brauner (Microsoft)" , Sasha Levin , Seth Forshee Subject: [PATCH 6.0 206/862] acl: return EOPNOTSUPP in posix_acl_fix_xattr_common() Date: Wed, 19 Oct 2022 10:24:53 +0200 Message-Id: <20221019083259.111043097@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112649903547809?= X-GMAIL-MSGID: =?utf-8?q?1747112649903547809?= From: Christian Brauner [ Upstream commit 985a6d0b3c800265a2d5312a52c549bf09254e55 ] Return EOPNOTSUPP when the POSIX ACL version doesn't match and zero if there are no entries. This will allow us to reuse the helper in posix_acl_from_xattr(). This change will have no user visible effects. Fixes: 0c5fd887d2bb ("acl: move idmapped mount fixup into vfs_{g,s}etxattr()") Signed-off-by: Christian Brauner (Microsoft) Reviewed-by: Seth Forshee (DigitalOcean) > Signed-off-by: Sasha Levin --- fs/posix_acl.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/fs/posix_acl.c b/fs/posix_acl.c index 5af33800743e..abe387700ba9 100644 --- a/fs/posix_acl.c +++ b/fs/posix_acl.c @@ -710,9 +710,9 @@ EXPORT_SYMBOL(posix_acl_update_mode); /* * Fix up the uids and gids in posix acl extended attributes in place. */ -static int posix_acl_fix_xattr_common(void *value, size_t size) +static int posix_acl_fix_xattr_common(const void *value, size_t size) { - struct posix_acl_xattr_header *header = value; + const struct posix_acl_xattr_header *header = value; int count; if (!header) @@ -720,13 +720,13 @@ static int posix_acl_fix_xattr_common(void *value, size_t size) if (size < sizeof(struct posix_acl_xattr_header)) return -EINVAL; if (header->a_version != cpu_to_le32(POSIX_ACL_XATTR_VERSION)) - return -EINVAL; + return -EOPNOTSUPP; count = posix_acl_xattr_count(size); if (count < 0) return -EINVAL; if (count == 0) - return -EINVAL; + return 0; return count; } @@ -748,7 +748,7 @@ void posix_acl_getxattr_idmapped_mnt(struct user_namespace *mnt_userns, return; count = posix_acl_fix_xattr_common(value, size); - if (count < 0) + if (count <= 0) return; for (end = entry + count; entry != end; entry++) { @@ -788,7 +788,7 @@ void posix_acl_setxattr_idmapped_mnt(struct user_namespace *mnt_userns, return; count = posix_acl_fix_xattr_common(value, size); - if (count < 0) + if (count <= 0) return; for (end = entry + count; entry != end; entry++) { @@ -822,7 +822,7 @@ static void posix_acl_fix_xattr_userns( kgid_t gid; count = posix_acl_fix_xattr_common(value, size); - if (count < 0) + if (count <= 0) return; for (end = entry + count; entry != end; entry++) { @@ -870,16 +870,9 @@ posix_acl_from_xattr(struct user_namespace *user_ns, struct posix_acl *acl; struct posix_acl_entry *acl_e; - if (!value) - return NULL; - if (size < sizeof(struct posix_acl_xattr_header)) - return ERR_PTR(-EINVAL); - if (header->a_version != cpu_to_le32(POSIX_ACL_XATTR_VERSION)) - return ERR_PTR(-EOPNOTSUPP); - - count = posix_acl_xattr_count(size); + count = posix_acl_fix_xattr_common(value, size); if (count < 0) - return ERR_PTR(-EINVAL); + return ERR_PTR(count); if (count == 0) return NULL; From patchwork Wed Oct 19 08:24: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: 4724 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp213996wrs; Wed, 19 Oct 2022 02:11:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM73PkUgjAbr2uXOEPQMAr6yf2vCy3QXIvVdoDBp/UVINRxKhdcy0khc8xlCQcjBL0AC1VV3 X-Received: by 2002:a17:907:94d6:b0:78d:f947:7cf5 with SMTP id dn22-20020a17090794d600b0078df9477cf5mr5926489ejc.446.1666170699220; Wed, 19 Oct 2022 02:11:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170699; cv=none; d=google.com; s=arc-20160816; b=PepC3s9f6EZhrgO1XgzoAJO3Lbx2oyS7BNuKJJC7xPl+CcOaIfvg4Ynyo4XbOJ/Mfj CxsFB7/pVuUGNVxm3nf1FWiBZEGfDftksgzckrzcyMVU4mOoGFzXqjfn+8VOuIdVUwfp qCzBggqxR/3znpFjFOQORqbJZtkf6WZCPGk/rZgh1KmBsNqvbudnNp84NAc0pQN7i1P2 a7281NNv6Nj/gd5fG/im4RClswsxTiYStWTPkOZV5uKd1cN/DrG6ONYDYKYPQCWDiokV I5ZoZFGRSkNG4opsOTdMnG2GmnyhJqfdfvT9/YxE9CVtvC5EM8BUOKuUxEixQo4naNg1 hmNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=moFSFN+3NJMC1JHo04xbo5gs+eGllD0E/R1sHL4iETA=; b=ljWaUBP3unxXVDcFRB9zxzJ6oJDmcGTUvffxTL5pgRfHnl4RZMCT23fIZ0U+252G6i 2DLq0GnbYxWs9NyXygHd/1ZwL9K2YcxqfzJ9CouAJKPWAwUJnkc/9Xf+u/4UVAf0FFNl hi6MBo/P4gnGWVr+9cRi+/qUGJGFOFEs/wxPSZHGlVUbEchasFYWnue/CRQo1JzRhRMm OJcumMaH5Yc2cQgs1iTOgbKTTzmVsMwbPJZdf9hzWglyYJTXYqpt8bVVjNRhU8A/wBep 02QzYeqTAPQjq74TbSPzj/ffZf2pvpYR6Djj95zC2vmyoPLEioI/Xc3zJjYJofZMhDUk WvSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=h4+76MFU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sz15-20020a1709078b0f00b0078ddc074afdsi10696973ejc.577.2022.10.19.02.11.13; Wed, 19 Oct 2022 02:11: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=h4+76MFU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232214AbiJSJIB (ORCPT + 99 others); Wed, 19 Oct 2022 05:08:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232286AbiJSJF0 (ORCPT ); Wed, 19 Oct 2022 05:05:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 161209F760; Wed, 19 Oct 2022 01:59:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2C4D661824; Wed, 19 Oct 2022 08:47:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 37F8FC433B5; Wed, 19 Oct 2022 08:47:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169242; bh=1uVmc6hJkhsVlg30rXcmh4sw1hCaTQ5SkWgcWSh8PLA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h4+76MFUHESST6hc2jYxiMwVGbUVAVDySqVEEIbCtuyzpMeU176PqfzyrFPp/5z14 0PFqKm/PVg2ENRpYApeAbHWGYdH+C74HpO903rf5sCiXUqlTr/gqNsfEB1Ytgy1LFw bwGtc2SLkFlMU3xWMipTQchpUP8VC8g645lv3bks= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xuewen Yan , Viresh Kumar , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 6.0 207/862] thermal: cpufreq_cooling: Check the policy first in cpufreq_cooling_register() Date: Wed, 19 Oct 2022 10:24:54 +0200 Message-Id: <20221019083259.160174548@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106607011958160?= X-GMAIL-MSGID: =?utf-8?q?1747106607011958160?= From: Xuewen Yan [ Upstream commit cff895277c8558221ba180aefe26799dcb4eec86 ] Since the policy needs to be accessed first when obtaining cpu devices, first check whether the policy is legal before this. Fixes: 5130802ddbb1 ("thermal: cpu_cooling: Switch to QoS requests for freq limits") Signed-off-by: Xuewen Yan Acked-by: Viresh Kumar Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/thermal/cpufreq_cooling.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/thermal/cpufreq_cooling.c b/drivers/thermal/cpufreq_cooling.c index b76293cc989c..7838b6e2dba5 100644 --- a/drivers/thermal/cpufreq_cooling.c +++ b/drivers/thermal/cpufreq_cooling.c @@ -501,17 +501,17 @@ __cpufreq_cooling_register(struct device_node *np, struct thermal_cooling_device_ops *cooling_ops; char *name; + if (IS_ERR_OR_NULL(policy)) { + pr_err("%s: cpufreq policy isn't valid: %p\n", __func__, policy); + return ERR_PTR(-EINVAL); + } + dev = get_cpu_device(policy->cpu); if (unlikely(!dev)) { pr_warn("No cpu device for cpu %d\n", policy->cpu); return ERR_PTR(-ENODEV); } - if (IS_ERR_OR_NULL(policy)) { - pr_err("%s: cpufreq policy isn't valid: %p\n", __func__, policy); - return ERR_PTR(-EINVAL); - } - i = cpufreq_table_count_valid_entries(policy); if (!i) { pr_debug("%s: CPUFreq table not found or has no valid entries\n", From patchwork Wed Oct 19 08:24: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: 5112 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp250895wrs; Wed, 19 Oct 2022 03:50:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7hR1Y3YwTcnhBZvlJKsrAi0UP30ovLZZodg7QsAU2yDRW8ywyL5+5tm0t+xEqzQ+2vIllY X-Received: by 2002:a17:907:3e14:b0:78d:b14b:6fa0 with SMTP id hp20-20020a1709073e1400b0078db14b6fa0mr6029996ejc.650.1666176618921; Wed, 19 Oct 2022 03:50:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176618; cv=none; d=google.com; s=arc-20160816; b=BVYeLMmTTX9DSBnHfPTguFvHh1G2OcTmaMQRky06DnTrqGzpO44s07/++JIZ7s7DrD ShcAXRAwRLbuAIM5EhuOK3nVvBSX5rh24ISlfILra9ssXIxnSvNWgIEeH2+i4oOTQ5S8 TQGRQ2Fu4yTYHv9XjhT3YmfZsegW03GwgjWo/RC3CNdsg+HOaq+81JXsTiydig7+TTvR kNNnceqCYEy3+H/IVDBlPRokB3LQjHza5f1DXNd1BimAAwpOf47PZ1+OuTWcXAbsLnad Gu+oH12d41ggRrw/XtGgcY07ud16+gi8L3nTTJVOUpxuStUwg+JxYq2sWvbTeOEE7vBX 4tjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3HMUYsBs4eeRUSKQEVmNLXfw6bQYHl6eAy4MdNuGz1U=; b=f39r6U9qO23kwZfkeazD+d/iZrGi7sJIb0kOG8tEm/4TCPS/5qKMvcSnWk19wWK+Ap irhzPjMHWhFMfN0PM95iF0jsVY146sEdlaiCObAwkp52vG0l+nv2QaDUmqNnCfHqHx0K dsZ2PXKoAvtnEW7gQDrbbw0hzWDu+O+/2VwAYWX7HwTQgXZyVg4NhOiekRB1NK9Dbcr/ aWZy2stC6o7YhaILa+expLJCze/HtSWXjczUYLwYq4nAkVK7A6A7WlfGucyR5Oun73pF KAJ9PmooI3Y2CtN7VppQeuRFZjINhcWdabDoqr0heTTSTpu+EHDyxoSDQgdQSOatgVL1 FJ0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mIfRvTTz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sa2-20020a1709076d0200b00780a882d337si14076950ejc.480.2022.10.19.03.49.54; Wed, 19 Oct 2022 03: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=mIfRvTTz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234265AbiJSKs0 (ORCPT + 99 others); Wed, 19 Oct 2022 06:48:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233341AbiJSKqj (ORCPT ); Wed, 19 Oct 2022 06:46: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 43A9511541D; Wed, 19 Oct 2022 03:21: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 9E5EEB821A3; Wed, 19 Oct 2022 08:47:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17C36C433C1; Wed, 19 Oct 2022 08:47:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169245; bh=yXakOncocmAMdyM9Kp+4spb4pV7+704OueZkYTIj4p4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mIfRvTTzFSQy2dMutRqgGAM3u2zaJsSQI3p6vLgEVzwYhJl82FTpHOYYVicECo748 6PVzMKcPHda+2Fyd5FDHz/3RXvLwd3x4l3v3cXq1h5qJjYTQy0WJg3qKpB9yTfR1dF KME4gSpMaQnMIQBCX1bv+IszxzXbxJDyba7TwoVo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Huang Rui , Perry Yuan , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 6.0 208/862] cpufreq: amd-pstate: Fix initial highest_perf value Date: Wed, 19 Oct 2022 10:24:55 +0200 Message-Id: <20221019083259.199144536@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112814181373506?= X-GMAIL-MSGID: =?utf-8?q?1747112814181373506?= From: Perry Yuan [ Upstream commit bedadcfb011fef55273bd686e8893fdd8911dcdb ] To avoid some new AMD processors use wrong highest perf when amd pstate driver loaded, this fix will query the highest perf from MSR register MSR_AMD_CPPC_CAP1 and cppc_acpi interface firstly, then compare with the highest perf value got by calling amd_get_highest_perf() function. The lower value will be the correct highest perf we need to use. Otherwise the CPU max MHz will be incorrect if the amd_get_highest_perf() did not cover the new process family and model ID. Like this lscpu info, the max frequency is incorrect. Vendor ID: AuthenticAMD Socket(s): 1 Stepping: 2 CPU max MHz: 5410.0000 CPU min MHz: 400.0000 BogoMIPS: 5600.54 Fixes: 3743d55b289c2 (x86, sched: Fix the AMD CPPC maximum performance value on certain AMD Ryzen generations) Acked-by: Huang Rui Signed-off-by: Perry Yuan Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/cpufreq/amd-pstate.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 9ac75c1cde9c..365f3ad166a7 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -152,6 +152,7 @@ static inline int amd_pstate_enable(bool enable) static int pstate_init_perf(struct amd_cpudata *cpudata) { u64 cap1; + u32 highest_perf; int ret = rdmsrl_safe_on_cpu(cpudata->cpu, MSR_AMD_CPPC_CAP1, &cap1); @@ -163,7 +164,11 @@ static int pstate_init_perf(struct amd_cpudata *cpudata) * * CPPC entry doesn't indicate the highest performance in some ASICs. */ - WRITE_ONCE(cpudata->highest_perf, amd_get_highest_perf()); + highest_perf = amd_get_highest_perf(); + if (highest_perf > AMD_CPPC_HIGHEST_PERF(cap1)) + highest_perf = AMD_CPPC_HIGHEST_PERF(cap1); + + WRITE_ONCE(cpudata->highest_perf, highest_perf); WRITE_ONCE(cpudata->nominal_perf, AMD_CPPC_NOMINAL_PERF(cap1)); WRITE_ONCE(cpudata->lowest_nonlinear_perf, AMD_CPPC_LOWNONLIN_PERF(cap1)); @@ -175,12 +180,17 @@ static int pstate_init_perf(struct amd_cpudata *cpudata) static int cppc_init_perf(struct amd_cpudata *cpudata) { struct cppc_perf_caps cppc_perf; + u32 highest_perf; int ret = cppc_get_perf_caps(cpudata->cpu, &cppc_perf); if (ret) return ret; - WRITE_ONCE(cpudata->highest_perf, amd_get_highest_perf()); + highest_perf = amd_get_highest_perf(); + if (highest_perf > cppc_perf.highest_perf) + highest_perf = cppc_perf.highest_perf; + + WRITE_ONCE(cpudata->highest_perf, highest_perf); WRITE_ONCE(cpudata->nominal_perf, cppc_perf.nominal_perf); WRITE_ONCE(cpudata->lowest_nonlinear_perf, From patchwork Wed Oct 19 08:24: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: 5495 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp335807wrs; Wed, 19 Oct 2022 06:45:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5oxQFxXulyScSuBcT+Srimps6BgLLMHzyZY++Rj3vwHkebIBjGUSNd83lGp5JZCTQ/psDm X-Received: by 2002:a05:6a00:228f:b0:566:6ecd:29d9 with SMTP id f15-20020a056a00228f00b005666ecd29d9mr8873598pfe.62.1666187148743; Wed, 19 Oct 2022 06:45:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666187148; cv=none; d=google.com; s=arc-20160816; b=oDJY5U/dpz8zEc57+M8A/K1BiwuaeVTDrfbsvqdEqt5IiT3fq7rjp8ri9R3Pif3hmy F7jmMXmaIsSCHDSJzWBDySm/LyP4JMhzSkffyxb1ZPJL08OcVazKzFx2IKNtNWZm1w3h 3Nyg7yLKipBx1aFxLCSl0N4MFsLiV25dn3X82AWojYL8cZHeMz0bXuZDpkgkF4Uhkhme j0v3wUAVTi8SXmiQ485sucKX9v2yx8zp/4hCQUXJdgKfCmj9rJuFVX03pByTYCcifDAt DVAycraxrpK8VbIvI3us5Kcyj7PvB4s5FMyP2mwLdsXh8b7hTS7jhkbPcgXGJMAE+dDn 04AA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/FSFo6mf7eMkL0wMWQgBAXbqaoy3pwSZaxsNpeXAa4g=; b=YL+GbmL8iO2UiGVFBwTHHkuLKQMp7oIwcXsgjOA/3szUlFX3WA0vryTZHtwpFQEavE v8xu1yfz+cnrVWqD+M/QJTM7FUwIJGXb7HctNiwIxxBkV4SDRSCIiBwBf2xgBi9KyjB0 CkVCq48YKpD9jGm3NBOUFIv3fwwPNZWUArBz3UPA/O0g2AqN3yg4GijAAU0kTq/nRwso CDJKGK/jSJoYm6ERB1PabGntam7044hMt8OdbxvY6k4YAKzJ42ybDSveTlsRvh6p7F3B U2xxmKvnab/PNVB6uO8F3IcWrmq0/6pyMCRLx4tOusO9KfRif4FvpO6YzcQSUYsvgjF8 BQyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sqUHxYuC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nu8-20020a17090b1b0800b0020a613f8c79si27799310pjb.129.2022.10.19.06.45.33; Wed, 19 Oct 2022 06:45: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=sqUHxYuC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231783AbiJSNog (ORCPT + 99 others); Wed, 19 Oct 2022 09:44:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233358AbiJSNoH (ORCPT ); Wed, 19 Oct 2022 09:44: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 E7C0219B649; Wed, 19 Oct 2022 06:31:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 01F36CE20F9; Wed, 19 Oct 2022 08:47:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E8C3DC433C1; Wed, 19 Oct 2022 08:47:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169248; bh=tsYIEnNeNXBKuktBDiK6adMOHZqbmAxFQCb+rNO0Bnc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sqUHxYuC/lfoKUPE460L094NAnvLaJWNetFblinmo6vZGmlBBF00qNDoENCq6b2BD If876I4hrWCVc8akhCp2hjniTN1Y9HKHuzl9pJ8I5kufjncCodVQ0TdUmxJzqeXoZD sZCTqaR1rYxdFZ3RXD3gPaeYyoDTLZBE/tnIhTBM= 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 6.0 209/862] sh: machvec: Use char[] for section boundaries Date: Wed, 19 Oct 2022 10:24:56 +0200 Message-Id: <20221019083259.250168421@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123855506235469?= X-GMAIL-MSGID: =?utf-8?q?1747123855506235469?= From: Kees Cook [ Upstream commit c5783af354688b24abd359f7086c282ec74de993 ] As done for other sections, define the extern as a character array, which relaxes many of the compiler-time object size checks, which would otherwise assume it's a single long. Solves the following build error: arch/sh/kernel/machvec.c: error: array subscript 'struct sh_machine_vector[0]' is partly outside array bounds of 'long int[1]' [-Werror=array-bounds]: => 105:33 Cc: Yoshinori Sato Cc: Rich Felker Cc: linux-sh@vger.kernel.org Reported-by: Geert Uytterhoeven Link: https://lore.kernel.org/lkml/alpine.DEB.2.22.394.2209050944290.964530@ramsan.of.borg/ Fixes: 9655ad03af2d ("sh: Fixup machvec support.") Reviewed-by: Geert Uytterhoeven Reviewed-by: Gustavo A. R. Silva Acked-by: Rich Felker Signed-off-by: Kees Cook Signed-off-by: Sasha Levin --- arch/sh/include/asm/sections.h | 2 +- arch/sh/kernel/machvec.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/sh/include/asm/sections.h b/arch/sh/include/asm/sections.h index 8edb824049b9..0cb0ca149ac3 100644 --- a/arch/sh/include/asm/sections.h +++ b/arch/sh/include/asm/sections.h @@ -4,7 +4,7 @@ #include -extern long __machvec_start, __machvec_end; +extern char __machvec_start[], __machvec_end[]; extern char __uncached_start, __uncached_end; extern char __start_eh_frame[], __stop_eh_frame[]; diff --git a/arch/sh/kernel/machvec.c b/arch/sh/kernel/machvec.c index d606679a211e..57efaf5b82ae 100644 --- a/arch/sh/kernel/machvec.c +++ b/arch/sh/kernel/machvec.c @@ -20,8 +20,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) @@ -87,8 +87,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 @@ -102,7 +102,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; } pr_notice("Booting machvec: %s\n", get_system_type()); From patchwork Wed Oct 19 08:24: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: 4627 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212025wrs; Wed, 19 Oct 2022 02:06:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6insx0hJUS/ZX7j5VwBJhuLP6SbSMd3m4uaLHl7h0k08kUcICkn5TR9EpUZ3bvI1X3ue22 X-Received: by 2002:a17:907:2c67:b0:78d:49d2:6297 with SMTP id ib7-20020a1709072c6700b0078d49d26297mr5989433ejc.21.1666170393402; Wed, 19 Oct 2022 02:06:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170393; cv=none; d=google.com; s=arc-20160816; b=YZvIQp9/HxuGYgrCWIacQPUgpZwyVO15kD1NaRiRMWmqdLyjQmRWYekcItTpxmlOF3 Ua4vXcCUq1RwYtre08Z5BsYQFiiVLfrjNyKJqLULZaa6mN0FiHEdDXGPAPk+r/9Z+uwY 2QHdubycz95oM438WSG6zI+EWGWBT5RHlLz2mYGgrhwoFElYEm6tXMGx8DSF6NCplUbi tujbAYW+9fHUH73BX+4mgLxR0DJVYhu1RtN+o8q06p36A3zMyzx/9rIlCpdzXT5RxPDp mGiN296vABehWNWLRQkDG7FY3N/zcxW4QnCc7g0XdlwBrEIO0zxZdBelNPidWNRG68vg SL7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uz9v+GT12yXoTLaYmxTr871hc9O3PnUdM7KV7ZcaSpI=; b=WgzjiVAeG60xfcSmU+llNPJtlWkQ18RKIXG+NO9ynDe7oMyj+OMPGcKkmGkQQyLAgX RvC9ZuAsA+Hb6Cki8b1iElB3sfcE2R/+5ulUPE9dmB+oiAzBmjsrxWIydrzXPGLU/sga fZvyYEMHPl8mRkP5rZqlRiAwju3SZb+IyPpKtIoa/LBFvztcfkomyFjOLbrg9KOzl2y+ W2jlCy47T4iw00R9aWxifLI7CEhlN2HAa28Cqww5yY/kAj/i6RNt4GcKedv/d/jmvKQ3 TrmMxx+1XLqttuicWFAHj77q5Lx/rk9CWP2dMzonWF/a6xcxHc7ENObUJy7p27xnFrnq Up0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yugxtAkX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mp34-20020a1709071b2200b0078c6abf19bfsi10033663ejc.948.2022.10.19.02.06.02; Wed, 19 Oct 2022 02:06: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=yugxtAkX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231836AbiJSIzd (ORCPT + 99 others); Wed, 19 Oct 2022 04:55:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231901AbiJSIyG (ORCPT ); Wed, 19 Oct 2022 04:54:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E675C84E5D; Wed, 19 Oct 2022 01:51:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B99D961820; Wed, 19 Oct 2022 08:47:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA4D5C433C1; Wed, 19 Oct 2022 08:47:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169254; bh=kNhHrO3zOwOCwUFqeWaMpjDE+M8BL55uYkKdhNtLPMY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yugxtAkXfkrA63j1ZxDumbghendjCBZVGtScWk/Ekdlhrc/4RFYqughHMyEtQVCvu 8WS1QivcsNBuO2VXDN3hkOOQdnnZoMx1r1t46FRIA9GAz0cqnAJKSDwzYhWcC3JPkj P+pOvKZKIr4Yl2++PjdeQSSfr5WVDo5UqRDr5Mss= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lin Yujun , Thomas Bogendoerfer , Sasha Levin Subject: [PATCH 6.0 210/862] MIPS: SGI-IP30: Fix platform-device leak in bridge_platform_create() Date: Wed, 19 Oct 2022 10:24:57 +0200 Message-Id: <20221019083259.297704109@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106286440457384?= X-GMAIL-MSGID: =?utf-8?q?1747106286440457384?= From: Lin Yujun [ Upstream commit 1e6d11fe72e311c1989991ee318d239f650fa318 ] In error case in bridge_platform_create after calling platform_device_add()/platform_device_add_data()/ platform_device_add_resources(), release the failed 'pdev' or it will be leak, call platform_device_put() to fix this problem. Besides, 'pdev' is divided into 'pdev_wd' and 'pdev_bd', use platform_device_unregister() to release sgi_w1 resources when xtalk-bridge registration fails. Fixes: fd27234f24ae ("MIPS: add support for SGI Octane (IP30)") Signed-off-by: Lin Yujun Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin --- arch/mips/sgi-ip30/ip30-xtalk.c | 70 +++++++++++++++++++++++---------- 1 file changed, 50 insertions(+), 20 deletions(-) diff --git a/arch/mips/sgi-ip30/ip30-xtalk.c b/arch/mips/sgi-ip30/ip30-xtalk.c index 8129524421cb..7ceb2b23ea1c 100644 --- a/arch/mips/sgi-ip30/ip30-xtalk.c +++ b/arch/mips/sgi-ip30/ip30-xtalk.c @@ -40,12 +40,15 @@ static void bridge_platform_create(int widget, int masterwid) { struct xtalk_bridge_platform_data *bd; struct sgi_w1_platform_data *wd; - struct platform_device *pdev; + struct platform_device *pdev_wd; + struct platform_device *pdev_bd; struct resource w1_res; wd = kzalloc(sizeof(*wd), GFP_KERNEL); - if (!wd) - goto no_mem; + if (!wd) { + pr_warn("xtalk:%x bridge create out of memory\n", widget); + return; + } snprintf(wd->dev_id, sizeof(wd->dev_id), "bridge-%012lx", IP30_SWIN_BASE(widget)); @@ -56,24 +59,35 @@ static void bridge_platform_create(int widget, int masterwid) w1_res.end = w1_res.start + 3; w1_res.flags = IORESOURCE_MEM; - pdev = platform_device_alloc("sgi_w1", PLATFORM_DEVID_AUTO); - if (!pdev) { - kfree(wd); - goto no_mem; + pdev_wd = platform_device_alloc("sgi_w1", PLATFORM_DEVID_AUTO); + if (!pdev_wd) { + pr_warn("xtalk:%x bridge create out of memory\n", widget); + goto err_kfree_wd; + } + if (platform_device_add_resources(pdev_wd, &w1_res, 1)) { + pr_warn("xtalk:%x bridge failed to add platform resources.\n", widget); + goto err_put_pdev_wd; + } + if (platform_device_add_data(pdev_wd, wd, sizeof(*wd))) { + pr_warn("xtalk:%x bridge failed to add platform data.\n", widget); + goto err_put_pdev_wd; + } + if (platform_device_add(pdev_wd)) { + pr_warn("xtalk:%x bridge failed to add platform device.\n", widget); + goto err_put_pdev_wd; } - platform_device_add_resources(pdev, &w1_res, 1); - platform_device_add_data(pdev, wd, sizeof(*wd)); /* platform_device_add_data() duplicates the data */ kfree(wd); - platform_device_add(pdev); bd = kzalloc(sizeof(*bd), GFP_KERNEL); - if (!bd) - goto no_mem; - pdev = platform_device_alloc("xtalk-bridge", PLATFORM_DEVID_AUTO); - if (!pdev) { - kfree(bd); - goto no_mem; + if (!bd) { + pr_warn("xtalk:%x bridge create out of memory\n", widget); + goto err_unregister_pdev_wd; + } + pdev_bd = platform_device_alloc("xtalk-bridge", PLATFORM_DEVID_AUTO); + if (!pdev_bd) { + pr_warn("xtalk:%x bridge create out of memory\n", widget); + goto err_kfree_bd; } bd->bridge_addr = IP30_RAW_SWIN_BASE(widget); @@ -93,15 +107,31 @@ static void bridge_platform_create(int widget, int masterwid) bd->io.flags = IORESOURCE_IO; bd->io_offset = IP30_SWIN_BASE(widget); - platform_device_add_data(pdev, bd, sizeof(*bd)); + if (platform_device_add_data(pdev_bd, bd, sizeof(*bd))) { + pr_warn("xtalk:%x bridge failed to add platform data.\n", widget); + goto err_put_pdev_bd; + } + if (platform_device_add(pdev_bd)) { + pr_warn("xtalk:%x bridge failed to add platform device.\n", widget); + goto err_put_pdev_bd; + } /* platform_device_add_data() duplicates the data */ kfree(bd); - platform_device_add(pdev); pr_info("xtalk:%x bridge widget\n", widget); return; -no_mem: - pr_warn("xtalk:%x bridge create out of memory\n", widget); +err_put_pdev_bd: + platform_device_put(pdev_bd); +err_kfree_bd: + kfree(bd); +err_unregister_pdev_wd: + platform_device_unregister(pdev_wd); + return; +err_put_pdev_wd: + platform_device_put(pdev_wd); +err_kfree_wd: + kfree(wd); + return; } static unsigned int __init xbow_widget_active(s8 wid) From patchwork Wed Oct 19 08:24: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: 4730 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214136wrs; Wed, 19 Oct 2022 02:11:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM43tr8U/zwVlTcNSn8JGnXqhHYYmgUuNj4X7Br9u5kkdk6vBptUTTW4RWi3wpquPJzek/EM X-Received: by 2002:a17:907:746:b0:741:4a1b:cb1f with SMTP id xc6-20020a170907074600b007414a1bcb1fmr5624389ejb.370.1666170718114; Wed, 19 Oct 2022 02:11:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170718; cv=none; d=google.com; s=arc-20160816; b=KsQnV2eexeVZ2HFVvaSxqGvnG+e7ofFQX6J6addvwBXoiX1STSOZCdOC2uO76WlroS XTh9GCWQGHIKONfEMouAedykqdEZgA/SczPCVmDQvP1TmAUh3vc3tM+pbaEquxTrQIIC 4mFKrnUBirGVvt8y0mZvmuVXHnWZlZRPU+EJ9PBbxIkKazYmT8e3lAWMHXBcNfiKrWjj tFk+kC7CGi7R28pk+1mEmdGW372aBLd4qqFzq06CLvE0hp/jeX2XEiiAL23aCIuXJXFv 7uTJ1cQtde9y466dTZXPVdPFsZfyneHy4uhHsERW4fngg76aLIXZbSYkzvsGpm7mzvZd bIWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=x9m6WPALQFDIMGjgpepRIbnUnUVRQtbQeXkhEKFbXv8=; b=jFzbRMowspCpf2plOruQFZIF/OAeSb0eZY9Oc4dVZkeWt0ztDFq/0kLVGThAv2l7Fd 0/ox/W31FiyAIKhFi0Xox7Hej/rNgQVlPKkAPx2WFSOaRC0VWPPzOOmw4zYDxLG07h7J QfC8todYMXudog+ZGiBSzSshrR1PDZnV0x4EfIqiEEzTIJlzGbqep09tYbJ5ylLQszbw eXMRLO9yi+MKgfwRDDBYb4FTpFm4i+G2YH7AobapW0AQ8b9axjYVcK2t2YgYxRlyY0JX 8fmitH5cj+CjEGILJzIduKin/qi7RHTMx2stUVi6pLnB7kHLQxWevDNK/Y3i0xQ5DTYt eECw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Wvd+6VYn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hw8-20020a170907a0c800b00780e89aecd1si13367713ejc.849.2022.10.19.02.11.32; Wed, 19 Oct 2022 02:11: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=Wvd+6VYn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232549AbiJSJIf (ORCPT + 99 others); Wed, 19 Oct 2022 05:08:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232374AbiJSJFt (ORCPT ); Wed, 19 Oct 2022 05:05:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5804617435; Wed, 19 Oct 2022 01:59: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 C58E461738; Wed, 19 Oct 2022 08:47:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BAC00C433D6; Wed, 19 Oct 2022 08:47:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169257; bh=HOZhK5nwydeR/Bd8FjHVUeZa+EqAKfMdTpBZvPcFDdk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wvd+6VYnDkoB3Vg026+K5vSsMsQ+RcqxH38k6wxAHAFtCWogMC0QRlyL4dlOz/YUM IACWcmpJVJNp8dmyyxTtD9ziJWEadtIiX7hCf1zkdAZ0dZoqmNlz3hejv/3W76H7rO +Tr9OLATzAEvBxh5QsoIyM+19mkTNn1A3WTXol6M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lin Yujun , Thomas Bogendoerfer , Sasha Levin Subject: [PATCH 6.0 211/862] MIPS: SGI-IP27: Fix platform-device leak in bridge_platform_create() Date: Wed, 19 Oct 2022 10:24:58 +0200 Message-Id: <20221019083259.348244532@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106626959549168?= X-GMAIL-MSGID: =?utf-8?q?1747106626959549168?= From: Lin Yujun [ Upstream commit 11bec9cba4de06b3c0e9e4041453c2caaa1cbec1 ] In error case in bridge_platform_create after calling platform_device_add()/platform_device_add_data()/ platform_device_add_resources(), release the failed 'pdev' or it will be leak, call platform_device_put() to fix this problem. Besides, 'pdev' is divided into 'pdev_wd' and 'pdev_bd', use platform_device_unregister() to release sgi_w1 resources when xtalk-bridge registration fails. Fixes: 5dc76a96e95a ("MIPS: PCI: use information from 1-wire PROM for IOC3 detection") Signed-off-by: Lin Yujun Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin --- arch/mips/sgi-ip27/ip27-xtalk.c | 70 +++++++++++++++++++++++---------- 1 file changed, 50 insertions(+), 20 deletions(-) diff --git a/arch/mips/sgi-ip27/ip27-xtalk.c b/arch/mips/sgi-ip27/ip27-xtalk.c index e762886d1dda..5143d1cf8984 100644 --- a/arch/mips/sgi-ip27/ip27-xtalk.c +++ b/arch/mips/sgi-ip27/ip27-xtalk.c @@ -27,15 +27,18 @@ static void bridge_platform_create(nasid_t nasid, int widget, int masterwid) { struct xtalk_bridge_platform_data *bd; struct sgi_w1_platform_data *wd; - struct platform_device *pdev; + struct platform_device *pdev_wd; + struct platform_device *pdev_bd; struct resource w1_res; unsigned long offset; offset = NODE_OFFSET(nasid); wd = kzalloc(sizeof(*wd), GFP_KERNEL); - if (!wd) - goto no_mem; + if (!wd) { + pr_warn("xtalk:n%d/%x bridge create out of memory\n", nasid, widget); + return; + } snprintf(wd->dev_id, sizeof(wd->dev_id), "bridge-%012lx", offset + (widget << SWIN_SIZE_BITS)); @@ -46,24 +49,35 @@ static void bridge_platform_create(nasid_t nasid, int widget, int masterwid) w1_res.end = w1_res.start + 3; w1_res.flags = IORESOURCE_MEM; - pdev = platform_device_alloc("sgi_w1", PLATFORM_DEVID_AUTO); - if (!pdev) { - kfree(wd); - goto no_mem; + pdev_wd = platform_device_alloc("sgi_w1", PLATFORM_DEVID_AUTO); + if (!pdev_wd) { + pr_warn("xtalk:n%d/%x bridge create out of memory\n", nasid, widget); + goto err_kfree_wd; + } + if (platform_device_add_resources(pdev_wd, &w1_res, 1)) { + pr_warn("xtalk:n%d/%x bridge failed to add platform resources.\n", nasid, widget); + goto err_put_pdev_wd; + } + if (platform_device_add_data(pdev_wd, wd, sizeof(*wd))) { + pr_warn("xtalk:n%d/%x bridge failed to add platform data.\n", nasid, widget); + goto err_put_pdev_wd; + } + if (platform_device_add(pdev_wd)) { + pr_warn("xtalk:n%d/%x bridge failed to add platform device.\n", nasid, widget); + goto err_put_pdev_wd; } - platform_device_add_resources(pdev, &w1_res, 1); - platform_device_add_data(pdev, wd, sizeof(*wd)); /* platform_device_add_data() duplicates the data */ kfree(wd); - platform_device_add(pdev); bd = kzalloc(sizeof(*bd), GFP_KERNEL); - if (!bd) - goto no_mem; - pdev = platform_device_alloc("xtalk-bridge", PLATFORM_DEVID_AUTO); - if (!pdev) { - kfree(bd); - goto no_mem; + if (!bd) { + pr_warn("xtalk:n%d/%x bridge create out of memory\n", nasid, widget); + goto err_unregister_pdev_wd; + } + pdev_bd = platform_device_alloc("xtalk-bridge", PLATFORM_DEVID_AUTO); + if (!pdev_bd) { + pr_warn("xtalk:n%d/%x bridge create out of memory\n", nasid, widget); + goto err_kfree_bd; } @@ -84,15 +98,31 @@ static void bridge_platform_create(nasid_t nasid, int widget, int masterwid) bd->io.flags = IORESOURCE_IO; bd->io_offset = offset; - platform_device_add_data(pdev, bd, sizeof(*bd)); + if (platform_device_add_data(pdev_bd, bd, sizeof(*bd))) { + pr_warn("xtalk:n%d/%x bridge failed to add platform data.\n", nasid, widget); + goto err_put_pdev_bd; + } + if (platform_device_add(pdev_bd)) { + pr_warn("xtalk:n%d/%x bridge failed to add platform device.\n", nasid, widget); + goto err_put_pdev_bd; + } /* platform_device_add_data() duplicates the data */ kfree(bd); - platform_device_add(pdev); pr_info("xtalk:n%d/%x bridge widget\n", nasid, widget); return; -no_mem: - pr_warn("xtalk:n%d/%x bridge create out of memory\n", nasid, widget); +err_put_pdev_bd: + platform_device_put(pdev_bd); +err_kfree_bd: + kfree(bd); +err_unregister_pdev_wd: + platform_device_unregister(pdev_wd); + return; +err_put_pdev_wd: + platform_device_put(pdev_wd); +err_kfree_wd: + kfree(wd); + return; } static int probe_one_port(nasid_t nasid, int widget, int masterwid) From patchwork Wed Oct 19 08:24: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: 5096 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp249954wrs; Wed, 19 Oct 2022 03:47:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM57o3MVRgpDehtYXNsKN7Qp01Cb5ma1UHozM3piVjucnt+0eVhMUPD9y0OcSWDNRD++R2i7 X-Received: by 2002:a17:907:6da3:b0:78e:2a5f:5aaf with SMTP id sb35-20020a1709076da300b0078e2a5f5aafmr6096998ejc.554.1666176459160; Wed, 19 Oct 2022 03:47:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176459; cv=none; d=google.com; s=arc-20160816; b=zny8r48WzSI3H3o4UMibyrtQ5u49FayEcf7LWUAe4ArmWSgJr22RTe0M0T2sYeSjRk F91f9cjykzbQ2SlKzF5+BkQa5zXr9IS2ZJAQFGpoerSIXAo5as7QvToTQnZVU8/El1Do 1t8VMw3xR1HPdpdX8IZUkJef2D7NAigNNRBURZruzonypIZuUZT2zOGJYhr83OSoiykF ngTHchuDFJCR6oHS9iobR1RPfZgObH2hiMijl66jCPkN0yo9BwcDqvkW9Me+H6NuG0oU zJKDmZEOxZkkoyTULhpgbBfuAVkNPKCATV7tSjlVEJDUT2H62jPZZf8fdv9+96H/Ll3P GB/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=160xUj7FoYlNJDDaH0QkShc2p2Wp6ZmDJbKBrEcSaEQ=; b=ydngQra1hSdmoALH2JRnb0f3d2x1/RnffTpdq3NwYJYCOA0OmxA2pJsOkAcZYh3EYg 33J0Von7dncqR4WsuL8yGK00y8zPNksEGQGHsmdZAGrPqqil7dEcXpFgf7HZxNPCsL/L Ki217db7l0i5BlzC1FoK9bCFq4ByVqZ9jXyhVgFGLL8KLVWs3cBPbxki5UST2XbyyPMe D/YVvQz7ci4Rjrp8D+bqPyumg9EEq8QhPtm6s8ramiv9375sUjDLwOVW74UczNk9w946 NGbW4GjRdktsYO3ZKO2X11Wxeo/njtBYqxEbSI1Q2ds1HoD5S/E3hAePVan+gNeXrJUx IWCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bKNzwgB9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cx18-20020a05640222b200b0045ca9f57186si12184059edb.288.2022.10.19.03.47.13; Wed, 19 Oct 2022 03:47: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=bKNzwgB9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233451AbiJSKq5 (ORCPT + 99 others); Wed, 19 Oct 2022 06:46:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230507AbiJSKom (ORCPT ); Wed, 19 Oct 2022 06:44: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 3C9ADA2879; Wed, 19 Oct 2022 03:21:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8D470B8231F; Wed, 19 Oct 2022 08:47:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CBE97C433D6; Wed, 19 Oct 2022 08:47:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169260; bh=93Mwl/CNPEa8olUJJ5MXG4cAm7nEoQMxsfLzscJcT+g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bKNzwgB9bCRUdOtwTy96tCLtjBX3LXNlYdrQQZbyjmphOQAXyOhL5csTS7SjiruQJ MAfB0WTZdKFVbFYNke/FL4UW7nQ/voOt9Vu6rh4Y4FkJAzwxJQtPgtGZi2kT0jxjuO uFlJaECiKSeVW5BN1QS1EK+ca3yQYi/Srhrseuqs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+f966c13b1b4fc0403b19@syzkaller.appspotmail.com, Yue Hu , Gao Xiang , Sasha Levin Subject: [PATCH 6.0 212/862] erofs: fix order >= MAX_ORDER warning due to crafted negative i_size Date: Wed, 19 Oct 2022 10:24:59 +0200 Message-Id: <20221019083259.396157131@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112646712159672?= X-GMAIL-MSGID: =?utf-8?q?1747112646712159672?= From: Gao Xiang [ Upstream commit 1dd73601a1cba37a0ed5f89a8662c90191df5873 ] As syzbot reported [1], the root cause is that i_size field is a signed type, and negative i_size is also less than EROFS_BLKSIZ. As a consequence, it's handled as fast symlink unexpectedly. Let's fall back to the generic path to deal with such unusual i_size. [1] https://lore.kernel.org/r/000000000000ac8efa05e7feaa1f@google.com Reported-by: syzbot+f966c13b1b4fc0403b19@syzkaller.appspotmail.com Fixes: 431339ba9042 ("staging: erofs: add inode operations") Reviewed-by: Yue Hu Link: https://lore.kernel.org/r/20220909023948.28925-1-hsiangkao@linux.alibaba.com Signed-off-by: Gao Xiang Signed-off-by: Sasha Levin --- fs/erofs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/erofs/inode.c b/fs/erofs/inode.c index 95a403720e8c..16cf9a283557 100644 --- a/fs/erofs/inode.c +++ b/fs/erofs/inode.c @@ -214,7 +214,7 @@ static int erofs_fill_symlink(struct inode *inode, void *kaddr, /* if it cannot be handled with fast symlink scheme */ if (vi->datalayout != EROFS_INODE_FLAT_INLINE || - inode->i_size >= EROFS_BLKSIZ) { + inode->i_size >= EROFS_BLKSIZ || inode->i_size < 0) { inode->i_op = &erofs_symlink_iops; return 0; } From patchwork Wed Oct 19 08:25: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: 4602 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp206510wrs; Wed, 19 Oct 2022 01:52:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7/uq1vIF9qRmYOmc6Gr9oU9vDvpYUiGA3boTl7m0Hf28jta0ChE9Jwwsz1+I2apXjCY60d X-Received: by 2002:a17:90b:4b88:b0:20a:cbb0:3c86 with SMTP id lr8-20020a17090b4b8800b0020acbb03c86mr42724254pjb.207.1666169554064; Wed, 19 Oct 2022 01:52:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169554; cv=none; d=google.com; s=arc-20160816; b=Hf7NDTk1hO7FnwslqBXovIiePPvAScVafuJytLUgaL/IOs7kUXumlwjbW/D/kdhkCW IPXcJHHY6fHU3mG46Nwdpag53aYraLDjfXp1I6Td2hDKK3PX+jx9ei3mUd3SQEQ6d3aY /yaGm37gJGrLKIEIqD5kS3A1Gas2bojLRSBOWqjIPMM+k7WZ608W3KomfN4BHnuF/O3T QdDTL1cTZ4RRdbsDR8kxvD6qR7lToQY3r9XaoTHWCdtei0k93TZXzx0iTaFUi6k3hz7y Bq+YgsWrHc1gwUVsMPZSFXlP6N8c/RIPvc4DHi6P2Vv/sX21oSgNMR7JEsn64e/xyZnS TnbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jz1y3z6XSp1Wdq+AXnce8t18wiiBYVlUzDixtiE7SZs=; b=U7KXVGVGt4e4f0wpNj0h4N2ocBU2XviLm6dlooIIqnl+qLglxQdKH5Zpfh37tZGIDG 9pws6vV2CZ5kLrBXamQ3g4acvP76I3oOfE16629ze4lr2nh1UUaZ6QSNAs20URKi1Cai Kf24V0Q7wADlfUev6Ud6pXi18WvWh/B7FBArDa7qFXSfWs4mRustqfU2B6+WzEuBfWCj g+2TXtVvO7ajkayIryUjmW7NCId3iu3mq+0lyfJ2zvzFPf33AHWKfSNCmY5nztH5ZDTp WDcENr0c8vwL7fxP+mB8aPDahjLFLpFNJ5xQnPXPdRoeAJZX1R1If+ptPAjS80Bj+MtM yPpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=z5I1Rdoi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l16-20020a170903245000b0017340861a6bsi19305079pls.611.2022.10.19.01.52.20; Wed, 19 Oct 2022 01:52:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=z5I1Rdoi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231752AbiJSIwB (ORCPT + 99 others); Wed, 19 Oct 2022 04:52:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231986AbiJSIuE (ORCPT ); Wed, 19 Oct 2022 04:50: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 D15AF2CCBF; Wed, 19 Oct 2022 01:48: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 C47F2617F7; Wed, 19 Oct 2022 08:47:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD1CBC433D6; Wed, 19 Oct 2022 08:47:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169263; bh=cUStqzs1sm90x91UAWNz1rhejrC3JpfXLKWtUpHmuFQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=z5I1Rdoi7xk4jubm3idsEAuvsr8PmZxirfqOenfiktckF0EK6EJxdVVD/uh0UMaSd jlECqsrYQKDKrobBHObzQ2JG5mpoznU9y+Zqw/OgmZkqRm2YEw39w0ns6TiLxd/fNM kledWCmbWQl3PZz6lJrh6GqdIs/D/NLc1XR1EpPU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jingbo Xu , Jia Zhu , Gao Xiang , Sasha Levin Subject: [PATCH 6.0 213/862] erofs: use kill_anon_super() to kill super in fscache mode Date: Wed, 19 Oct 2022 10:25:00 +0200 Message-Id: <20221019083259.435616379@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105406565591901?= X-GMAIL-MSGID: =?utf-8?q?1747105406565591901?= From: Jia Zhu [ Upstream commit 1015c1016c231b26d4e2c9b3da65b6c043eb97a3 ] Use kill_anon_super() instead of generic_shutdown_super() since the mount() in erofs fscache mode uses get_tree_nodev() and associated anon bdev needs to be freed. Fixes: 9c0cc9c729657 ("erofs: add 'fsid' mount option") Suggested-by: Jingbo Xu Signed-off-by: Jia Zhu Reviewed-by: Jingbo Xu Link: https://lore.kernel.org/r/20220918043456.147-2-zhujia.zj@bytedance.com Signed-off-by: Gao Xiang Signed-off-by: Sasha Levin --- fs/erofs/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/erofs/super.c b/fs/erofs/super.c index 3173debeaa5a..9716d355a63e 100644 --- a/fs/erofs/super.c +++ b/fs/erofs/super.c @@ -879,7 +879,7 @@ static void erofs_kill_sb(struct super_block *sb) WARN_ON(sb->s_magic != EROFS_SUPER_MAGIC); if (erofs_is_fscache_mode(sb)) - generic_shutdown_super(sb); + kill_anon_super(sb); else kill_block_super(sb); From patchwork Wed Oct 19 08:25:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4607 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp211136wrs; Wed, 19 Oct 2022 02:04:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7HZUzcwcw1+c5I/mk/5Nk7r8iRREB1EHOqPVmyYGkKDSBPFqBQNlq48M0g8zIxTObI1nt3 X-Received: by 2002:a17:90b:2812:b0:20d:7a3b:df3e with SMTP id qb18-20020a17090b281200b0020d7a3bdf3emr44403021pjb.169.1666170250291; Wed, 19 Oct 2022 02:04:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170250; cv=none; d=google.com; s=arc-20160816; b=lD6ynsoCyIDM65fmllmtKaXzqi2/QB/20nndt26e/9XG7LYKLJuAawjdcnvPFP3eFE ZdZFSkWibcSdFe9Ersdynh1XTKxFW2crc7Bd071eMs/szekI0adle9CMrSBZey8TpqXC xl6czaOhJTEd5a+Uj/4N1pkrtlx50IScvyO4WGSctjV/B+5/cOVnbsXIFpikUxKvugUe 3qYFkh7W1FAz7NnjC7dYBPy09nEd8abVyHyILYidK+sw9JpvJxFDk3sdhhsk2AJ0awBx cTB2f0ALdW4PmO5eqzIyQNiFsMv+rtJSmjnIRal3JjUnXj2JmbJw3/EC2GZ0wClTsLAP KQCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4xMZv8ViEE3E0v4W3WxEk+hihv0YDpHtzrZ7rUZ5tTM=; b=ef13ke6TF/dj+7xh7t89N9UPwF+iHqAU2aiKWIirbK/PILuG/x2AG/ZP2tnnMDkskX CDBKbguXPv7/MxxWMVsPRTPgIpaO5DGTV452z/Qscvs+VgXv/QxsQai62Q/qmCME24Oi rKVujwagKu0sZTFq75J+AVF3oBnWD/dwnDHb+Qai8QcNsZ6AcsYOdq1zzqMsbNcOdVJz lQDdzfDwRYaoge++VRua0PQhxYPdEne9g5dddAap7ndNpb+MlilsYbj6eDMpFQMn4ied 0fK15VanoHBafLic4xE/MIm/Ba+n2U9NVLajLuEu95Gj8tVfVny1P7m/sq5R/QynMMlI Sj/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mmnCTUDE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k19-20020a056a00169300b0052f80d1a588si17664628pfc.44.2022.10.19.02.03.17; Wed, 19 Oct 2022 02:04:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mmnCTUDE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230138AbiJSIwT (ORCPT + 99 others); Wed, 19 Oct 2022 04:52:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232106AbiJSIuW (ORCPT ); Wed, 19 Oct 2022 04:50: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 642848E704; Wed, 19 Oct 2022 01:48: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 ABC4461804; Wed, 19 Oct 2022 08:47:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0254C433C1; Wed, 19 Oct 2022 08:47:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169266; bh=zg+p61KItxBrk4fp24Kbh1QhrpK1b7WGZ7RcxpNQlec=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mmnCTUDEdGvdkmM3go/QS+HV2hecDfmXuOImaeLlEJ8eny38JJ1b73459PUblKdN+ 7r6uFftTha0J+szs87nd3F8eSNrcAXPQ/rjaM/KWylpGv50+BJB/zsP4ebExPYxd1i bBoixQQ9eQVVgkrw3O4o8CANaRe9xXpZA964CXLU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, Russell King Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , linux-arm-kernel@lists.infradead.org, Bart Van Assche , "Russell King (Oracle)" , Sasha Levin Subject: [PATCH 6.0 214/862] ARM: 9243/1: riscpc: Unbreak the build Date: Wed, 19 Oct 2022 10:25:01 +0200 Message-Id: <20221019083259.482159525@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106136667895586?= X-GMAIL-MSGID: =?utf-8?q?1747106136667895586?= From: Bart Van Assche [ Upstream commit 32844a8eecaa4a3e65841c53e43e04a9087d1ef6 ] This patch fixes the following build error: In file included from ./include/linux/io.h:13, from ./arch/arm/mach-rpc/include/mach/uncompress.h:9, from arch/arm/boot/compressed/misc.c:31: ./arch/arm/include/asm/io.h:85:22: error: conflicting types for ‘__raw_writeb’ 85 | #define __raw_writeb __raw_writeb | ^~~~~~~~~~~~ ./arch/arm/include/asm/io.h:86:20: note: in expansion of macro ‘__raw_writeb’ 86 | static inline void __raw_writeb(u8 val, volatile void __iomem *addr) | ^~~~~~~~~~~~ In file included from arch/arm/boot/compressed/misc.c:26: arch/arm/boot/compressed/misc-ep93xx.h:13:20: note: previous definition of ‘__raw_writeb’ was here 13 | static inline void __raw_writeb(unsigned char value, unsigned int ptr) | ^~~~~~~~~~~~ To: Russell King Cc: Arnd Bergmann Cc: linux-arm-kernel@lists.infradead.org Fixes: 0361c7e504b1 ("ARM: ep93xx: multiplatform support") Signed-off-by: Bart Van Assche Signed-off-by: Russell King (Oracle) Signed-off-by: Sasha Levin --- arch/arm/boot/compressed/misc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/boot/compressed/misc.c b/arch/arm/boot/compressed/misc.c index cb2e069dc73f..abfed1aa2baa 100644 --- a/arch/arm/boot/compressed/misc.c +++ b/arch/arm/boot/compressed/misc.c @@ -23,7 +23,9 @@ unsigned int __machine_arch_type; #include #include #include "misc.h" +#ifdef CONFIG_ARCH_EP93XX #include "misc-ep93xx.h" +#endif static void putstr(const char *ptr); From patchwork Wed Oct 19 08:25: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: 4738 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214288wrs; Wed, 19 Oct 2022 02:12:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM59vWaG+OfrNhPQkORQDc9WdPGmKE/e7Ort82hl3FH7PblJVFeNtpxMdbCfNvCB5ILwoD/C X-Received: by 2002:a17:906:2699:b0:781:a473:9791 with SMTP id t25-20020a170906269900b00781a4739791mr5969019ejc.644.1666170744987; Wed, 19 Oct 2022 02:12:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170744; cv=none; d=google.com; s=arc-20160816; b=S6D6Nh+37YtS6pbIiiQqGh0WC/E96fxx1uShGkkrKJcMCPl7vXKgd3odEpZRl9tuNQ pQdCb4UM/4F3NEqLHVs3NqD5cam4pz20mmBefE4woOm06OZGF5qcONO4JNfL0iFFuD4E KGSlb5YsDxXrEljVk4ZTA61x/rWj+XV75X6zsw+9ZsQLFRx9DUkI0g094PladQuEOLNO QZfbIDAqD8VPP9adLJcs/rJOwHtjgW+urJZ4AhZlz6XrIcc2UMZSXxkBhvMjBQqFkfa5 oESwXteoUlmMTT6GyHZoKUHZexfVcw5PiPzgehLIuwN3Kru2xIbU5BnujB98Bb9k8hbg fsDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lMLoWhGTwHN7J+blcoryw54qGgCC26wn8jpBjLiv2n8=; b=TjyYZEcFnTpYgqzgWiIyg38cT6pFK80WSXg1xw1z54u4r6zP92+7uuHUAM4er0Z652 DSDCKkO6hzS0huMxZcnG8vdRxPNvSQwxI1nwKxYlcZdfTSaMMaG9Xcd/+9xIAP7v36rW 8CA92g+o7RNOhRWNv8vnI50JvCo+sklKoQg1447qSCEtnvxUZgspf/HGf8wQ2mHCHpo+ MH6O/mjullz1pj65NzxyP/4FYCAx9nisYNpHF8GainV22BuQZqURVgDTLl29VTyFofln it1Ha0b6vkB6XAWMXN919X8KnO8e9GMXW7JBWABuremSb6ef3Lei52CUfXibbDn0cype mEig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mRxO+wgO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hv19-20020a17090760d300b0078d83fb6672si14657653ejc.118.2022.10.19.02.11.59; Wed, 19 Oct 2022 02:12: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=mRxO+wgO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232680AbiJSJIk (ORCPT + 99 others); Wed, 19 Oct 2022 05:08:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232424AbiJSJGG (ORCPT ); Wed, 19 Oct 2022 05:06: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 BF8BF9FD2; Wed, 19 Oct 2022 01:59: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 A780A61828; Wed, 19 Oct 2022 08:47:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AFDC3C433D6; Wed, 19 Oct 2022 08:47:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169269; bh=KLXaFQT2JlFqTccYwn76fcGTCiyc8m5psLPMQV9qgJ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mRxO+wgO8+aD9YJZKw8xdhbCuQsSYckIDCRBAU5oxHo+u78RoUERUHttqB2nFLwCk VJRXwjMrpv7CR0UUVz+9sL/B5pL3eHhTL3IV7FK/jWBZnQqAeCbfzuwIEKE+QV5bxC ri1/OYXVZkTEzwZCk3yXAIXCmdGJ2LP81LE97DQY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kefeng Wang , "Russell King (Oracle)" , Sasha Levin Subject: [PATCH 6.0 215/862] ARM: 9244/1: dump: Fix wrong pg_level in walk_pmd() Date: Wed, 19 Oct 2022 10:25:02 +0200 Message-Id: <20221019083259.530895015@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106655323004520?= X-GMAIL-MSGID: =?utf-8?q?1747106655323004520?= From: Wang Kefeng [ Upstream commit 2ccd19b3ffac07cc7e75a2bd1ed779728bb67197 ] After ARM supports p4d page tables, the pg_level for note_page() in walk_pmd() should be 4, not 3, fix it. Fixes: 84e6ffb2c49c ("arm: add support for folded p4d page tables") Signed-off-by: Kefeng Wang Signed-off-by: Russell King (Oracle) Signed-off-by: Sasha Levin --- arch/arm/mm/dump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mm/dump.c b/arch/arm/mm/dump.c index fb688003d156..712da6a81b23 100644 --- a/arch/arm/mm/dump.c +++ b/arch/arm/mm/dump.c @@ -346,7 +346,7 @@ static void walk_pmd(struct pg_state *st, pud_t *pud, unsigned long start) addr = start + i * PMD_SIZE; domain = get_domain_name(pmd); if (pmd_none(*pmd) || pmd_large(*pmd) || !pmd_present(*pmd)) - note_page(st, addr, 3, pmd_val(*pmd), domain); + note_page(st, addr, 4, pmd_val(*pmd), domain); else walk_pte(st, pmd, addr, domain); From patchwork Wed Oct 19 08:25: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: 4621 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp211918wrs; Wed, 19 Oct 2022 02:06:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5PKe6FjfH2aa/xLrHk9XStnW8bBAfNKspDYM3NapQ4xGS2dqLFKRM6Nl8MkDfkMvneI83J X-Received: by 2002:a17:903:24f:b0:178:bf4f:fc7c with SMTP id j15-20020a170903024f00b00178bf4ffc7cmr7640627plh.124.1666170374370; Wed, 19 Oct 2022 02:06:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170374; cv=none; d=google.com; s=arc-20160816; b=qZrGGSV5wqW4QzkIL/1K68scIOoQ1t4idq41thpmEfBbASTtKPEPLv7CSZutwoJTdP UJ1psp2AuCbrD4yWN/ghKKtqAGiypt5VO9ku6mzeRB961kWKQWTlpWFCU72f38HFIolC xpNwk1zzvBHQjhvZbYmmRwc0xGVVR3X0gr6Vx5r41I3Mi7miGrVj+PEA8Vz+UlFz7B5X jzZadbQNt9aFfjnfdWiW2thrRPr6Z90iWVdF2s3BycPT6uSyb7HN635yhmq9+pdBwp5W kzPP+ZgaKeGIaM+61XBoPes1jnGz/R0E9oyuB5OuHM3v4VveKXylAUl4fG0ssyt9FhHw i9mA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5hv6suXH6kBbpjF3/qQzm+vVLJI3OCglxi8kakzGYJ0=; b=BSjUvQqeGOxMhWgOn5FpJ6U2Tj12Rf2WMDbA7KTBt1APJbm3h7m1MdogRZi/35OBT1 HgbxGZGaPBUrIKQZ32aUqAhMIQPfTmpX3ks0T5LXUQP78LMTH1ia8WIhFYzmXVUT2Mw6 ojZSQM3ksVP0FIGUuldoDldBQL5MzSuMQcb6iE8FZ/prVOpA/eG0mo/nEigDpIKSsw0Q z/vvv2xPxvctfY1yA4Ymz3ursIwRkgBME1VsAItl0/uRpu0Arbd5iawba0VoxL4Rfk13 HJK8t8tItlGZkzK662eJM1YxIZ3xn2vuvii9aPZe55RmxcYdDzU1kwGTdDP+gXlCdsxt mT9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PixV2v6e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170902ea8600b001853ad3944dsi16649969plb.480.2022.10.19.02.05.52; Wed, 19 Oct 2022 02:06: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=PixV2v6e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229982AbiJSIws (ORCPT + 99 others); Wed, 19 Oct 2022 04:52:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231744AbiJSIv6 (ORCPT ); Wed, 19 Oct 2022 04:51:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BDDB6472; Wed, 19 Oct 2022 01:49: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 66854617E9; Wed, 19 Oct 2022 08:47:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E989C433D6; Wed, 19 Oct 2022 08:47:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169271; bh=mPyvoOxtu2z1TDELo2nST18RRq1LpFrHYrqoyOU5/Cg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PixV2v6e7kg4xrQ4lxktqT0nWjfn6WT+hCtqFXDbl1rKE+Gkah9UmYMn3d7eb9QfP E/udk5lxUWRMxXpZjjU1QzFN0abEnsZtW+/nOwKRUDrK0Gk2yyRwUugBiULI3/v/CT BS2ZN6AfK+rvBJrtPy//ltwM9dz5JQ+gCjAPS7q8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kefeng Wang , "Russell King (Oracle)" , Sasha Levin Subject: [PATCH 6.0 216/862] ARM: 9247/1: mm: set readonly for MT_MEMORY_RO with ARM_LPAE Date: Wed, 19 Oct 2022 10:25:03 +0200 Message-Id: <20221019083259.575544616@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106266299213388?= X-GMAIL-MSGID: =?utf-8?q?1747106266299213388?= From: Wang Kefeng [ Upstream commit 14ca1a4690750bb54e1049e49f3140ef48958a6e ] MT_MEMORY_RO is introduced by commit 598f0a99fa8a ("ARM: 9210/1: Mark the FDT_FIXED sections as shareable"), which is a readonly memory type for FDT area, but there are some different between ARM_LPAE and non-ARM_LPAE, we need to setup PMD_SECT_AP2 and L_PMD_SECT_RDONLY for MT_MEMORY_RO when ARM_LAPE enabled. non-ARM_LPAE 0xff800000-0xffa00000 2M PGD KERNEL ro NX SHD ARM_LPAE 0xff800000-0xffc00000 4M PMD RW NX SHD ARM_LPAE+fix 0xff800000-0xffc00000 4M PMD ro NX SHD Fixes: 598f0a99fa8a ("ARM: 9210/1: Mark the FDT_FIXED sections as shareable") Signed-off-by: Kefeng Wang Signed-off-by: Russell King (Oracle) Signed-off-by: Sasha Levin --- arch/arm/mm/mmu.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index a49f0b9c0f75..463fc2a8448f 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c @@ -300,7 +300,11 @@ static struct mem_type mem_types[] __ro_after_init = { .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY | L_PTE_XN | L_PTE_RDONLY, .prot_l1 = PMD_TYPE_TABLE, +#ifdef CONFIG_ARM_LPAE + .prot_sect = PMD_TYPE_SECT | L_PMD_SECT_RDONLY | PMD_SECT_AP2, +#else .prot_sect = PMD_TYPE_SECT, +#endif .domain = DOMAIN_KERNEL, }, [MT_ROM] = { From patchwork Wed Oct 19 08:25: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: 4604 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp208010wrs; Wed, 19 Oct 2022 01:56:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4e3A/AoQ62qvR2F4Kw/8bM4v0GAsgyLPugME+CYXu2g5agyyw0SZ+s101iukIccT0r9Mao X-Received: by 2002:a05:6402:5162:b0:457:6ef2:df3 with SMTP id d2-20020a056402516200b004576ef20df3mr6379090ede.128.1666169771181; Wed, 19 Oct 2022 01:56:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169771; cv=none; d=google.com; s=arc-20160816; b=x5Ojy4K5GDLe5fyyH/iw7zd2UH8N2VoPFzZV/PUWybaRTHmnrbTnHv/AMcWX9Q6sLN mDR0GQee7OsGpOrgVpO+GH4UYYelGk18/Bury6X0gVgYu3d1k60ijjVADH6XMOURkeCu xeejmTN640jWfgQ+2B/p9SHPGqYCwTmw1eMuKUI85NG+6AIgcXzCfHiiqUd+xne7u5/b SIcbTtJWxN5+uSeSnd1RHKhCc6uoyChQDATKKNs3Xpzgc0uY3fGXad7jp9kRc3dav6GA Jp91TlKZ3UpXaZM5Tq6bNxBZ3IItburLlugAyiPdaOwKVQtlQUjTnPAsejodKtzHm6XP 4FOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nXlo97dBJgGJFNZgYXrHpgQdVUb2GgL8IZN6haLyEeE=; b=dIBVCNnZeRZSNphW4MC21isB7pjubjATRuANkcU4NOUp2tfZKZ4ILQTwUA6g59Ra70 V7/tshwNbaA1na0bIYkmgbQJe0YAKlx4xlMPLiO7CqwEUprnkf8oNIK9gDNcEBp/FQ9F AGoL9SeCWi9dCBbuoSYN8qklQlynmvDnVl4SkIdY9ZCtboPV7/EWRm5vHzuPQBpXAx+B JnnKgr6fDspStNVBU4jfG01HZaLZodULiJr9dCyOVfYjXviTMUKa6pFN9jxdxmX6fjKI k86eNCuotFKxI1UzYYdcO3xWhMMIUktnrv48hF09V1Nb/gjE1LSbJVsDW2PZEjargZNq V9Wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sbqncfVI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bo17-20020a0564020b3100b0045c234508e2si11521815edb.627.2022.10.19.01.55.45; Wed, 19 Oct 2022 01:56: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=sbqncfVI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231794AbiJSIwX (ORCPT + 99 others); Wed, 19 Oct 2022 04:52:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232176AbiJSIua (ORCPT ); Wed, 19 Oct 2022 04:50: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 27CACB488; Wed, 19 Oct 2022 01:49: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 0720C6182F; Wed, 19 Oct 2022 08:47:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F106C433D7; Wed, 19 Oct 2022 08:47:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169274; bh=njhw0LwRXIffYEP5C+Wa5eEtx0qNIV98IVTRB8jz/4A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sbqncfVIFbAi+LRSvqTDi/eC6dfAfK/fspn+hiEH54uRov+ymzxM3Pf/SlPCd3Awk z9nd9WqiQZ/NSfJrgwUhcoqUleNFKD/F8lcQYfX8eLZ0yfj2myH6Gv+olKmZEkltqc ZjW3dPCOoHJqyQ4OYIuI0DitdlXtD8fJgys3lF48= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rafael Mendonca , Sudeep Holla , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 6.0 217/862] ACPI: PCC: Release resources on address space setup failure path Date: Wed, 19 Oct 2022 10:25:04 +0200 Message-Id: <20221019083259.624066766@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747105633805081421?= X-GMAIL-MSGID: =?utf-8?q?1747105633805081421?= From: Rafael Mendonca [ Upstream commit f890157e61b85ce8ae01a41ffa375e3b99853698 ] The allocated memory for the pcc_data struct doesn't get freed under an error path in pcc_mbox_request_channel() or acpi_os_ioremap(). Also, the PCC mailbox channel doesn't get freed under an error path in acpi_os_ioremap(). Fixes: 77e2a04745ff8 ("ACPI: PCC: Implement OperationRegion handler for the PCC Type 3 subtype") Signed-off-by: Rafael Mendonca Reviewed-by: Sudeep Holla Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/acpi/acpi_pcc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/acpi/acpi_pcc.c b/drivers/acpi/acpi_pcc.c index a12b55d81209..84f1ac416b57 100644 --- a/drivers/acpi/acpi_pcc.c +++ b/drivers/acpi/acpi_pcc.c @@ -63,6 +63,7 @@ acpi_pcc_address_space_setup(acpi_handle region_handle, u32 function, if (IS_ERR(data->pcc_chan)) { pr_err("Failed to find PCC channel for subspace %d\n", ctx->subspace_id); + kfree(data); return AE_NOT_FOUND; } @@ -72,6 +73,8 @@ acpi_pcc_address_space_setup(acpi_handle region_handle, u32 function, if (!data->pcc_comm_addr) { pr_err("Failed to ioremap PCC comm region mem for %d\n", ctx->subspace_id); + pcc_mbox_free_channel(data->pcc_chan); + kfree(data); return AE_NO_MEMORY; } From patchwork Wed Oct 19 08:25: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: 5088 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp249605wrs; Wed, 19 Oct 2022 03:46:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4m4FMZAeZRxjCw6xvN72aHTmQG6Sp+dHs1lWvjW9ctxtLi1L/QWNgIkESC1q/CyLNlluHF X-Received: by 2002:a05:6a00:705:b0:562:b9e1:d0e8 with SMTP id 5-20020a056a00070500b00562b9e1d0e8mr8074571pfl.0.1666176400493; Wed, 19 Oct 2022 03:46:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176400; cv=none; d=google.com; s=arc-20160816; b=emdSnYdoIu5uJdhJLT0PLUBogcj51ta5xae9N58VOJHspIjEeQxCrWxPldfKk27/Th V45GK/q0+qUPQ966CBVmX3XkvQ8gbggDxaF+ZO1wjaWmDBUIKqsBUmM0q2JqxiGXB+gZ frP7Ebu4bS/QV6CA0xc2xNXFpKtSEFJ0fvdbbnTuo9HqRpVLPBXpOW1pjQmwjdoJhhzI JoJRsH2Hem2n57WmqAIYkqSAO+JfGa2ODC8q15GXSz/HbEFk9dzMPKIMUzbH9OXL5XVV +PNdlQ+zwCoT14RembmwiJPFzLYPo1Pr65uKWkH9cTRvu3VyZBiVs7pyglLogPgd9vOD 4iZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=G0xMA3E5pvJoByC07Ve/JswS6SYCKYAdI0wOjruq/9U=; b=oYWeY4j/TSDC8jS3MQtt0DeONtSVhZjgx8PYjgP64DROU5OHDVe6AA8itz8jKHK+hC Jc1uR402twe+Dx1J70n+YD91a9F5bND107hGq34tGa27uuJeAGIgTeGGy/zCkSw9bE3b HdiwQdZwJpGjGItjny09O3kHPVKZ4oP+Hc6V98MhC/iasH0BD3J69G8jgoDCPMWwhvgD eVxM2u+EtJjvYnCFjcn1ZqQcLF3GNiXEr+VmpdjEzHFxUxcx9U0m8m+k9SJRRn8PQOiS 49RcDVHzJbY6xan370WeOYbmZGaGkzdoL847MP2qWDLWSkNM7TPfGoNRokntNWnuqg70 rvag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LWQdV0vQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q18-20020a170902b11200b0017139f381c9si16622209plr.569.2022.10.19.03.46.27; Wed, 19 Oct 2022 03:46: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=LWQdV0vQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233084AbiJSKqK (ORCPT + 99 others); Wed, 19 Oct 2022 06:46:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233057AbiJSKo2 (ORCPT ); Wed, 19 Oct 2022 06:44: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 99BBA159D64; Wed, 19 Oct 2022 03:21:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DC1E8B822EB; Wed, 19 Oct 2022 08:47:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 227EAC433D6; Wed, 19 Oct 2022 08:47:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169277; bh=2PDkRAInx+5qdYpVRI+2RTNMv7awcytT6P1oXVUQ3zc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LWQdV0vQpFG3XAkv0QxOt9c1Dugao3QjL56h3opNiVSddzRYMxqK4q/WmYOgZ8fIt SQBfA0EAfXLaPZhNuQEi7lpBZ6GdxJSIjqPC8mmk7m3Ewz9I3U+ahdmi04HFQpfQzK GvAfPOxVe08jN3tCiUkXUyJsnXAdWMlV/m9r2lxI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Huisong Li , Sudeep Holla , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 6.0 218/862] ACPI: PCC: replace wait_for_completion() Date: Wed, 19 Oct 2022 10:25:05 +0200 Message-Id: <20221019083259.665546329@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112585355662039?= X-GMAIL-MSGID: =?utf-8?q?1747112585355662039?= From: Huisong Li [ Upstream commit 91cefefb699120efd0a5ba345d12626b688f86ce ] Currently, the function waiting for completion of mailbox operation is 'wait_for_completion()'. The PCC method will be permanently blocked if this mailbox message fails to execute. So this patch replaces it with 'wait_for_completion_timeout()'. And set the timeout interval to an arbitrary retries on top of nominal to prevent the remote processor is slow to respond to PCC commands. Fixes: 77e2a04745ff ("ACPI: PCC: Implement OperationRegion handler for the PCC Type 3 subtype") Signed-off-by: Huisong Li Reviewed-by: Sudeep Holla Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/acpi/acpi_pcc.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/acpi_pcc.c b/drivers/acpi/acpi_pcc.c index 84f1ac416b57..16ba875e3293 100644 --- a/drivers/acpi/acpi_pcc.c +++ b/drivers/acpi/acpi_pcc.c @@ -23,6 +23,12 @@ #include +/* + * Arbitrary retries in case the remote processor is slow to respond + * to PCC commands + */ +#define PCC_CMD_WAIT_RETRIES_NUM 500 + struct pcc_data { struct pcc_mbox_chan *pcc_chan; void __iomem *pcc_comm_addr; @@ -89,6 +95,7 @@ acpi_pcc_address_space_handler(u32 function, acpi_physical_address addr, { int ret; struct pcc_data *data = region_context; + u64 usecs_lat; reinit_completion(&data->done); @@ -99,8 +106,20 @@ acpi_pcc_address_space_handler(u32 function, acpi_physical_address addr, if (ret < 0) return AE_ERROR; - if (data->pcc_chan->mchan->mbox->txdone_irq) - wait_for_completion(&data->done); + if (data->pcc_chan->mchan->mbox->txdone_irq) { + /* + * pcc_chan->latency is just a Nominal value. In reality the remote + * processor could be much slower to reply. So add an arbitrary + * amount of wait on top of Nominal. + */ + usecs_lat = PCC_CMD_WAIT_RETRIES_NUM * data->pcc_chan->latency; + ret = wait_for_completion_timeout(&data->done, + usecs_to_jiffies(usecs_lat)); + if (ret == 0) { + pr_err("PCC command executed timeout!\n"); + return AE_TIME; + } + } mbox_client_txdone(data->pcc_chan->mchan, ret); From patchwork Wed Oct 19 08:25: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: 5108 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp250892wrs; Wed, 19 Oct 2022 03:50:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4qirAhSumS1kQLGpkglmnzidxLxreEc39rUoL+Wx/3byHWaUeBxXlWuSKwMUCiDV0wWdpT X-Received: by 2002:a50:fe85:0:b0:458:5562:bf1e with SMTP id d5-20020a50fe85000000b004585562bf1emr6747823edt.167.1666176618777; Wed, 19 Oct 2022 03:50:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176618; cv=none; d=google.com; s=arc-20160816; b=k+3sZfQs6Bsqekhjv5V4yPX1h0mnB0IhWeUSOjzE+vACl1ut8bBXhPNaiKIRSw65vE OWJkGyi7VL5MByrs4T3tfyo8Hb5qUrab6HtwhK+KYcQCR6nELdpdXgGg2AoReqpDJI00 fnP+aaYdv4sGUPaREtxZksMs9XhRWnqzPa4B8Ny59vNrcVU1JQz9yGyWJnJ+CZ64FH4b QNxMzWHLQsRP2RyaIjTn53YqJ2kd02zQoV9VETFoE0HAEz7ZEYETa318HTRQxtYRPOPn xhsIkCVsGoY40JiL/iRIa/Tf+SvVxV4NOJbaXVaZr2ZrQGOo0FpyKx5xvjtubZkRtpw2 wlZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=SPXz+2SK7iEGe/kOieE0OASf5orUj4AsgH4uWoCc/5U=; b=wDjuQPtIiq31JRNk5izHK2LtVrRDP9XWQCcz9PQMT6Kl6wv4BeYio68CjRHWeL08mq kGTx7qxnTM5lWivJ/QqrkHJKNE1uVxDqQXnog6ksfOykrYUBMNcl7L7kI9N9JS35ihDX EtZtsmrROeZFwDZ+shGf1wyfZGFX2jHFYCUMU8uNkviCUSsHUkojRNX2TAJWUmOr/oez IAcd9Ehaux1Xb+D34F54FLQFx6ifV4gmtJ/ojee3fs5igsH7LZh5YpK6ZXjcvtgv2yNo VnfLl5ynlgTqNmAP4WELucc6YCb3g3yTgZFol2WgH7Tt7ZAKQFxM1YrXMMTM+9qxK0Ke VKjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iF42qtVC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h11-20020a170906260b00b0078d2a99972fsi11444259ejc.316.2022.10.19.03.49.54; Wed, 19 Oct 2022 03: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=iF42qtVC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232626AbiJSKsf (ORCPT + 99 others); Wed, 19 Oct 2022 06:48:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233350AbiJSKqk (ORCPT ); Wed, 19 Oct 2022 06:46:40 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C08311A94B; Wed, 19 Oct 2022 03:21:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C1C25B822E7; Wed, 19 Oct 2022 08:48:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2DFB9C433C1; Wed, 19 Oct 2022 08:48:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169280; bh=e+Vd7JvFc0fcUes11UDUpyQCNraPicOwdsaoFGchMI0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iF42qtVC6DvH4BKvQfmRFFrA8te46MQxqmBe0VXi4l8guCHruQGa5/gkU3yn1vqkb AhK63lvEOC6x14198wvQq415Y3xpKLbZ/WmKgZtAC74EQ0I18A8CHKWm7gIivIm0Ns PYF+AeSElwXyg3LNij+MEERasKE3S8k/Pkt4CnRg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Huisong Li , Sudeep Holla , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 6.0 219/862] ACPI: PCC: Fix Tx acknowledge in the PCC address space handler Date: Wed, 19 Oct 2022 10:25:06 +0200 Message-Id: <20221019083259.705947570@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112814322133177?= X-GMAIL-MSGID: =?utf-8?q?1747112814322133177?= From: Huisong Li [ Upstream commit 18729106c26fb97d4c9ae63ba7aba9889a058dc4 ] Currently, mbox_client_txdone() is called from the PCC address space handler and that expects the user the Tx state machine to be controlled by the client which is not the case and the below warning is thrown: | PCCT: Client can't run the TX ticker Let the controller run the state machine and the end of Tx can be acknowledge by calling mbox_chan_txdone() instead. Fixes: 77e2a04745ff ("ACPI: PCC: Implement OperationRegion handler for the PCC Type 3 subtype") Signed-off-by: Huisong Li Reviewed-by: Sudeep Holla Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/acpi/acpi_pcc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/acpi/acpi_pcc.c b/drivers/acpi/acpi_pcc.c index 16ba875e3293..ee4ce5ba1fb2 100644 --- a/drivers/acpi/acpi_pcc.c +++ b/drivers/acpi/acpi_pcc.c @@ -121,7 +121,7 @@ acpi_pcc_address_space_handler(u32 function, acpi_physical_address addr, } } - mbox_client_txdone(data->pcc_chan->mchan, ret); + mbox_chan_txdone(data->pcc_chan->mchan, ret); memcpy_fromio(value, data->pcc_comm_addr, data->ctx.length); From patchwork Wed Oct 19 08:25: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: 5098 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp250006wrs; Wed, 19 Oct 2022 03:47:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4kquvIgIF8SKP5jIYgIAcoziDk0idge2Q4Y7L2c7O8amQnEVGtcmjoFcxJ0/LfUIiCL1N6 X-Received: by 2002:a17:907:7da6:b0:791:997e:58fc with SMTP id oz38-20020a1709077da600b00791997e58fcmr6353977ejc.385.1666176470495; Wed, 19 Oct 2022 03:47:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176470; cv=none; d=google.com; s=arc-20160816; b=yd/8xNh0F/O0FOMXtaliV/kzDUHIqVh231LF/DnIDbvtvS6gqMc7ixEqwzCgc7U4Il 0jTuoV5vxz1Q0NrWzCvWOMbXSL4BsjLrtOIZ7gEQU1KgYJpLUsu57Y6k6+Xb04/rMMfB HGFF6XeHdudiULsWByI4AQmvfgBc0VOySWZ7CCW+Dxs9aB5PcOlDiY8XGj1xKiJmEmUn GfWowaL09reCRO3ZhFPCXAu/Lf5C3vI/7gkfawzg7ydhfZszfqo++BVs+5jxk4R+Ma0K qzTuL92TkeB0drZyLxIdB9nP8rKE/HEr4Ys1DQoEFDiR5dN/lNu8AA7/7dtf5XRBMyk8 23+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=t05utgu4jM38zfag2flAiy1ZS5Rw35Cv58UVMurbTvw=; b=pEFD99VJmPKC5MNTTyN3bXS0Gzh0g8cjnX+d0n8qdRAmhUo5YzjmlIyrsvmS4SlmjU 8gCGmGoJS3MvV3SDXeuQrBRtacTSB28eOPUzK/FEvjilwwL0ngRguh0Qkp5Vyp91/Tta qaFyEip+JtKjDxevbpPLhtE9rV6N+2gVvzUStqKdhYTlZVlR6fBnTC98q3KceyCpOE3Y O5NX9pCY/z1ZkuVoXSGDHPba/NAlZdGopFR71zDZMn/umN4SKwkQNcg+mroVu+ZsqGqc 4VoczMTw8mlXqa1aRyQXNNFqEDvPQHGTchKIOfdaHhfHI+cWObDLnlWTxsw+1lSmwbZl 78Fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JCPo4k60; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bf26-20020a0564021a5a00b0045c83fb19d4si12960257edb.578.2022.10.19.03.47.25; Wed, 19 Oct 2022 03:47: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=JCPo4k60; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232789AbiJSKrF (ORCPT + 99 others); Wed, 19 Oct 2022 06:47:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232062AbiJSKor (ORCPT ); Wed, 19 Oct 2022 06:44:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5908311877D; Wed, 19 Oct 2022 03:21: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 D853AB8231D; Wed, 19 Oct 2022 08:48:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4DE6CC433D6; Wed, 19 Oct 2022 08:48:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169286; bh=HFFF37R3oYOiJnZ/OBH3lRHLRux8zKszRban/GNbQAA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JCPo4k60POx/tyzu3+Rv3Nu0yk/lr8pbD6ewan6Dd+88Z8hALC1LuBMCvkD40e1xk 79Rmh49pVJfaaetVIKPLzubBmC/l83RsXFG46/p/dI0/Mei408k6uVqLMBmZnSD7Ea LjeSoSURGtTq1ApiA75Wv927BWwGqaU9vyp5yKts= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sami Tolvanen , "Peter Zijlstra (Intel)" , Kees Cook , Sasha Levin Subject: [PATCH 6.0 220/862] objtool: Preserve special st_shndx indexes in elf_update_symbol Date: Wed, 19 Oct 2022 10:25:07 +0200 Message-Id: <20221019083259.753894368@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112658663671012?= X-GMAIL-MSGID: =?utf-8?q?1747112658663671012?= From: Sami Tolvanen [ Upstream commit 5141d3a06b2da1731ac82091298b766a1f95d3d8 ] elf_update_symbol fails to preserve the special st_shndx values between [SHN_LORESERVE, SHN_HIRESERVE], which results in it converting SHN_ABS entries into SHN_UNDEF, for example. Explicitly check for the special indexes and ensure these symbols are not marked undefined. Fixes: ead165fa1042 ("objtool: Fix symbol creation") Signed-off-by: Sami Tolvanen Acked-by: Peter Zijlstra (Intel) Tested-by: Peter Zijlstra (Intel) Signed-off-by: Kees Cook Link: https://lore.kernel.org/r/20220908215504.3686827-17-samitolvanen@google.com Signed-off-by: Sasha Levin --- tools/objtool/elf.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c index c25e957c1e52..7e24b09b1163 100644 --- a/tools/objtool/elf.c +++ b/tools/objtool/elf.c @@ -619,6 +619,11 @@ static int elf_update_symbol(struct elf *elf, struct section *symtab, Elf64_Xword entsize = symtab->sh.sh_entsize; int max_idx, idx = sym->idx; Elf_Scn *s, *t = NULL; + bool is_special_shndx = sym->sym.st_shndx >= SHN_LORESERVE && + sym->sym.st_shndx != SHN_XINDEX; + + if (is_special_shndx) + shndx = sym->sym.st_shndx; s = elf_getscn(elf->elf, symtab->idx); if (!s) { @@ -704,7 +709,7 @@ static int elf_update_symbol(struct elf *elf, struct section *symtab, } /* setup extended section index magic and write the symbol */ - if (shndx >= SHN_UNDEF && shndx < SHN_LORESERVE) { + if ((shndx >= SHN_UNDEF && shndx < SHN_LORESERVE) || is_special_shndx) { sym->sym.st_shndx = shndx; if (!shndx_data) shndx = 0; From patchwork Wed Oct 19 08:25: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: 4718 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp213913wrs; Wed, 19 Oct 2022 02:11:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7irKawVk+VhwQHrYYkEhIZqou4+DCwRB1+RLH0uFXWWEvnLpuHV8MS124ZALVDHMkGGKm0 X-Received: by 2002:a17:907:94d1:b0:790:65a:3a18 with SMTP id dn17-20020a17090794d100b00790065a3a18mr5714576ejc.428.1666170685642; Wed, 19 Oct 2022 02:11:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170685; cv=none; d=google.com; s=arc-20160816; b=LB5PllV6vI8jQ+Fcjmatu5Li0fiCpHLPGaFSP9P4h2ApjJ8g4tK3VXQr8nVmcpP44X q3pHb1Cr6JIzg+r0id8kH8m9Rf16iHX2FDTZaocnVLLmX1tN3/57wSJCw9z0Cua7PxEY MUs7tQ+jhUDAmdKvbeawWGWm9KlSEZ0nTVy4MYN1lGdrkhrVo6vs1NMPH5sfy+XFAjbB c5QXMdjTv7YxPLgxz83IpM9hqaFggi6VEVmB3KGoZ3lMhmw7k2iIBRf1nTZTQRYQ5vpH HjKirtgTpBS1Dpog9UhHtlMjc5tMMxW2tcnRFa2x/TAazsKLLUTP31/dKcWDjpufoaz0 Pxkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=cZofKYENmurOZTvSXKMo94k2spzaldeBtbxYDPdasCE=; b=aQ7V6lzXaeFdYY91nLLyCy5/YWXL7QmpRHXQbfc0vVfyImq/9yNc4KrOH0LqRTExAV eOKPeco9r5kvW8xa9nHqKWdveFJ4zo2f7KSXyLJBBH1QLtmZ/JtcqqWe0jvZuaNqkym8 fjYbh8GCm/7tQqXmZ9YtcSMoeGLrwCVZKZdtNwRz8eyQY9wjntZYlI1DnkbrtitCS8OB /Im2qYfJdUXysYANilq2CIyWT3AAmkB0kHMeqx0O9J+9lHjYm+gxX2J8RJdqTthep86l 4KTEQaZlqM+8JEhfdNDoY3A4rdDAAyfON1bRt2QuKdM92vuWQkx0P+pDA1Yx4DYTVWqS MFtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lXrtZHnK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a05640242d300b0045bd55b122fsi17578293edc.57.2022.10.19.02.11.01; Wed, 19 Oct 2022 02:11: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=lXrtZHnK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232587AbiJSJHg (ORCPT + 99 others); Wed, 19 Oct 2022 05:07:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232786AbiJSJFH (ORCPT ); Wed, 19 Oct 2022 05:05: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 3B16C9DFAF; Wed, 19 Oct 2022 01:59: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 D234861838; Wed, 19 Oct 2022 08:48:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DAFA1C433D6; Wed, 19 Oct 2022 08:48:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169289; bh=cEznBf9bvTB/4ENmafZ5o4nl4xs2vm5vB0HoS9fBxMM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lXrtZHnKwr05CjGJekuTytWwLLBIATLhTBvtn/mrJsRVhDQJuxyV96j2ygn1f/eIf 12m7mil4796h4ZBCe3tjG+Ac3FWYmmwqZqiheMcNFVgbs7PUcM20gNUEVpBwyTIYQf IPfdTTJNYYI24rQMBeYASDMLtDdKiU93gCXxV2G8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Jeff Layton , Chuck Lever , Sasha Levin Subject: [PATCH 6.0 221/862] nfsd: Fix a memory leak in an error handling path Date: Wed, 19 Oct 2022 10:25:08 +0200 Message-Id: <20221019083259.801867037@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106592910846430?= X-GMAIL-MSGID: =?utf-8?q?1747106592910846430?= From: Christophe JAILLET [ Upstream commit fd1ef88049de09bc70d60b549992524cfc0e66ff ] If this memdup_user() call fails, the memory allocated in a previous call a few lines above should be freed. Otherwise it leaks. Fixes: 6ee95d1c8991 ("nfsd: add support for upcall version 2") Signed-off-by: Christophe JAILLET Reviewed-by: Jeff Layton Signed-off-by: Chuck Lever Signed-off-by: Sasha Levin --- fs/nfsd/nfs4recover.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c index c634483d85d2..8f24485e0f04 100644 --- a/fs/nfsd/nfs4recover.c +++ b/fs/nfsd/nfs4recover.c @@ -815,8 +815,10 @@ __cld_pipe_inprogress_downcall(const struct cld_msg_v2 __user *cmsg, princhash.data = memdup_user( &ci->cc_princhash.cp_data, princhashlen); - if (IS_ERR_OR_NULL(princhash.data)) + if (IS_ERR_OR_NULL(princhash.data)) { + kfree(name.data); return -EFAULT; + } princhash.len = princhashlen; } else princhash.len = 0; From patchwork Wed Oct 19 08:25: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: 4625 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp211959wrs; Wed, 19 Oct 2022 02:06:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6XVy0TNBIaHyvqcFaCjHwwg/bNQqM09tb92yoAzjCvVkXOLbuAO+2CZwL8G2OM+dr4oY0Y X-Received: by 2002:a17:907:74e:b0:74f:83d4:cf58 with SMTP id xc14-20020a170907074e00b0074f83d4cf58mr5978024ejb.178.1666170380837; Wed, 19 Oct 2022 02:06:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170380; cv=none; d=google.com; s=arc-20160816; b=QjGZh1NNPYXH3g1qG+gjI9iJNkLE4ZNXyCR/e6kHOLEkePH2pvt3e15bIDbCefuiTF qZAAaIeNjavE+8fZpOMvz1OHhPN2XBQSY5flFboyXaiYgRwtTBlIAidr4AasQPgkGZhr nRa6OEv2RNL195aldkkG9OjxCcp/OfGGG+DQGKnHsbE4oYAgokEjmJ3vqowjWOzK6Hce dlW3KGkZ3qWhV8ndOPrYlRIaNSllzIrf9FQJnU5KHBpobHlqvRBJfgmm20hcSoUvLjJS 2Z+TUKiqUCEikKTUh+kTHO65EJXjR7gQWFIezQBDokwNG/KPlswFCbRRM+EYvjmQvulJ 5fyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=22oRgqIlYo9nQXF/ZTBVDDa7qujvpB2JdPONsPwpRso=; b=D/1S33FKCDYqWYVegoQ83FfQhUqIfVcxquck+yDidyuvSvdcLpUhNr8xU/yQ1Dh0+v /MOjyKA7GEBmawVLxRsa/f4/6WHY/YCWj65mgvmnuHFz7cTsPWxy0PwcXpVnxECmtvK9 KWZf70GtWnGnc21PnT1ygFUL6T7dS9fmdEAg4igB+J1CvSwcQn+uoHNqK/x+R0KVrnJD kabpQLLXxwnqriLOzHB6+7n/T25Ufrmozd0NO5WEEuWREmVTbept4sMtrqhinUhm+/Fp wQxO343uC5dIdlL67uOufwUSSPwykSuQfhWDHL8SPplnBcFUQ9mRU20HbUfz6PoHqVKF 7wxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0bC7j9+X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ce11-20020a170906b24b00b007940226fd21si276236ejb.903.2022.10.19.02.05.49; Wed, 19 Oct 2022 02:06: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=0bC7j9+X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231982AbiJSI4p (ORCPT + 99 others); Wed, 19 Oct 2022 04:56:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231907AbiJSI4Q (ORCPT ); Wed, 19 Oct 2022 04:56:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C475E9C2E0; Wed, 19 Oct 2022 01:52: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 51F6D61840; Wed, 19 Oct 2022 08:48:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B3C0C433C1; Wed, 19 Oct 2022 08:48:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169291; bh=UCOXvJhWORPwHaVSbJcOe6oEVxI7zAC7T2lMUEbvagY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0bC7j9+XpRTM6b58F0QrhaFRqTYVozzReqca64QCH8pPs0GESVC2gxFgTIwBuRlXt Mpukn0JLDraf5ZE0OHB0xJm3I3Y1Knx4UwTQMfmZlJOFknIzWmKs0vIqSgIEAa2PJ5 jXpM9ciIu+Nt6VE7/bhSMNqsnWZMjDE90fAiuQnA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeff Layton , Chuck Lever , Sasha Levin Subject: [PATCH 6.0 222/862] SUNRPC: Fix svcxdr_init_decodes end-of-buffer calculation Date: Wed, 19 Oct 2022 10:25:09 +0200 Message-Id: <20221019083259.849441093@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106273540143388?= X-GMAIL-MSGID: =?utf-8?q?1747106273540143388?= From: Chuck Lever [ Upstream commit 90bfc37b5ab91c1a6165e3e5cfc49bf04571b762 ] Ensure that stream-based argument decoding can't go past the actual end of the receive buffer. xdr_init_decode's calculation of the value of xdr->end over-estimates the end of the buffer because the Linux kernel RPC server code does not remove the size of the RPC header from rqstp->rq_arg before calling the upper layer's dispatcher. The server-side still uses the svc_getnl() macros to decode the RPC call header. These macros reduce the length of the head iov but do not update the total length of the message in the buffer (buf->len). A proper fix for this would be to replace the use of svc_getnl() and friends in the RPC header decoder, but that would be a large and invasive change that would be difficult to backport. Fixes: 5191955d6fc6 ("SUNRPC: Prepare for xdr_stream-style decoding on the server-side") Reviewed-by: Jeff Layton Signed-off-by: Chuck Lever Signed-off-by: Sasha Levin --- include/linux/sunrpc/svc.h | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index daecb009c05b..5a830b66f059 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h @@ -544,16 +544,27 @@ static inline void svc_reserve_auth(struct svc_rqst *rqstp, int space) } /** - * svcxdr_init_decode - Prepare an xdr_stream for svc Call decoding + * svcxdr_init_decode - Prepare an xdr_stream for Call decoding * @rqstp: controlling server RPC transaction context * + * This function currently assumes the RPC header in rq_arg has + * already been decoded. Upon return, xdr->p points to the + * location of the upper layer header. */ static inline void svcxdr_init_decode(struct svc_rqst *rqstp) { struct xdr_stream *xdr = &rqstp->rq_arg_stream; - struct kvec *argv = rqstp->rq_arg.head; + struct xdr_buf *buf = &rqstp->rq_arg; + struct kvec *argv = buf->head; - xdr_init_decode(xdr, &rqstp->rq_arg, argv->iov_base, NULL); + /* + * svc_getnl() and friends do not keep the xdr_buf's ::len + * field up to date. Refresh that field before initializing + * the argument decoding stream. + */ + buf->len = buf->head->iov_len + buf->page_len + buf->tail->iov_len; + + xdr_init_decode(xdr, buf, argv->iov_base, NULL); xdr_set_scratch_page(xdr, rqstp->rq_scratch_page); } From patchwork Wed Oct 19 08:25: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: 4736 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214269wrs; Wed, 19 Oct 2022 02:12:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6bKdehW2xtNMQPc/SfUFuQnW3P1QAT6NzKoa6ozNdAn+3xQ5P+9dIwJ+bAy9qZ5IV5bL5Y X-Received: by 2002:a05:6402:14ce:b0:45c:2c81:e144 with SMTP id f14-20020a05640214ce00b0045c2c81e144mr6399076edx.90.1666170741224; Wed, 19 Oct 2022 02:12:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170741; cv=none; d=google.com; s=arc-20160816; b=00ZJUKvG0Emin+7rzIYInZsdAcGQ8nu+XcTiN51fTewWxLIXUVgHWTsSW8R09LyG8H euYyWRa9fPuIT5YBf2SGWDHWZI71x9YA2L4aPEYuIPKFYzN9nKwSqtoE2rcdv/wWb0lT Y/8agE6Lj7JyUx70rWkjpT/HXZW2Me30WF5I62tpI2KWZfTGH99svAOARENlxOL8A84I QlrONigxZEzZuUXRNAe8ggFB/y8rVixpQB1MC1N39OTI3bNNypGcL/TUVG8sF5TbvxND ooFPqdQJ874GFwEOEEn/HlybQ3PMSxJd8W2XmBsLRlXwm47dT2CsUd90IeG9yNdsNlmx 5HEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=980rDNROEUjrgeyQd3XrtA9QDEC+IRMBBoyMetLnbVY=; b=L2bxhRGzYmXwuZrjocpAZkAKizQ04PhJzM0l24IHJpe/caVoTI9ORS885tpHEcKRhc wF+dm8d8PW172MBxz1qJOFrDgqWP2F3FgT5mtrbZryJ2pRuCS0aw6Tcw61ChdOJ8ZcsX g9VX1hPvwSh35hZxwcNSQPTWEEAJ6TzF9yp0mQQyz6BPAY8Uu19MPExvrC+dL/0lM2JX nWwQwQd7XHXdR9UOiGkQ5A2MqmEL0jld/owIuIjUQBBQDWcTLSBHQ5bArYdTjOYUggE9 lhVw5EQFKoAvVpkD9qcyKqsCIewCHAY6r8ZAh2Y5FuxCVybF9YaXwb2anoHLuLJZ1E4d ePYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HHx2YRrh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v10-20020a056402348a00b0045901aa2468si16282118edc.333.2022.10.19.02.11.56; Wed, 19 Oct 2022 02:12:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HHx2YRrh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232670AbiJSJIb (ORCPT + 99 others); Wed, 19 Oct 2022 05:08:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232367AbiJSJFt (ORCPT ); Wed, 19 Oct 2022 05:05: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 8CD56559D; Wed, 19 Oct 2022 01:59: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 F3ACF61830; Wed, 19 Oct 2022 08:48:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1338BC433D7; Wed, 19 Oct 2022 08:48:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169294; bh=qVYDYelSXhkHfR0AgcNhAsoBtqPipV6eiUkZlAcvI5g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HHx2YRrhaJ0sA/pz5Myz4yV257qDFjZ8K23rnDucjk6zIogdyouVF1406vFfJzh9L 8nJVdwMskHQ682ymeAj+luTBXmoUi0tH0YRk2T5C7YkRmATrCD54JhjIhdaZ8/nGAs UOj33h7gZ/ZbdS+j7++MwOLF+UK1rvK9T3JQ2ypo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeff Layton , Chuck Lever , Sasha Levin Subject: [PATCH 6.0 223/862] SUNRPC: Fix svcxdr_init_encodes buflen calculation Date: Wed, 19 Oct 2022 10:25:10 +0200 Message-Id: <20221019083259.890877538@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106650769036124?= X-GMAIL-MSGID: =?utf-8?q?1747106650769036124?= From: Chuck Lever [ Upstream commit 1242a87da0d8cd2a428e96ca68e7ea899b0f4624 ] Commit 2825a7f90753 ("nfsd4: allow encoding across page boundaries") added an explicit computation of the remaining length in the rq_res XDR buffer. The computation appears to suffer from an "off-by-one" bug. Because buflen is too large by one page, XDR encoding can run off the end of the send buffer by eventually trying to use the struct page address in rq_page_end, which always contains NULL. Fixes: bddfdbcddbe2 ("NFSD: Extract the svcxdr_init_encode() helper") Reviewed-by: Jeff Layton Signed-off-by: Chuck Lever Signed-off-by: Sasha Levin --- include/linux/sunrpc/svc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index 5a830b66f059..0ca8a8ffb47e 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h @@ -587,7 +587,7 @@ static inline void svcxdr_init_encode(struct svc_rqst *rqstp) xdr->end = resv->iov_base + PAGE_SIZE - rqstp->rq_auth_slack; buf->len = resv->iov_len; xdr->page_ptr = buf->pages - 1; - buf->buflen = PAGE_SIZE * (1 + rqstp->rq_page_end - buf->pages); + buf->buflen = PAGE_SIZE * (rqstp->rq_page_end - buf->pages); buf->buflen -= rqstp->rq_auth_slack; xdr->rqst = NULL; } From patchwork Wed Oct 19 08:25: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: 4609 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp211646wrs; Wed, 19 Oct 2022 02:05:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4GtNy8H0hyUSj5dryQWelXoKrOqppGAOOt2tlSfWaBjyyvtS+aa4EWgsox0v+5XUJnAFbB X-Received: by 2002:a63:fd57:0:b0:43c:9a42:74fb with SMTP id m23-20020a63fd57000000b0043c9a4274fbmr6359323pgj.174.1666170329718; Wed, 19 Oct 2022 02:05:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170329; cv=none; d=google.com; s=arc-20160816; b=uaeLIHDLuDFQ5yECROJ7P7W9FqvqGGNp4YT12xCXXLq2RL9sly/7TYEIOsq4N2979r dMNk31uEpV/TdQbv6Z9eVPK/0xxnXcwLYHLDCMkV7saBoYNAfTRBCKrgLzT0iZeqFg4D aFWwqJ7gtaYuG/zKwUWK42k/9AN+PpxvHF/jKneSD+DhPYpCCOVQZnaQAhB2DVj0Akep NF8Eg7Ne3kBI4WjNkHe8kSa+06kcipATK/rOxS4rTgV0Bex+Eo+egYUtak+yYmCHWs6A TqQBkhNXOVoNW09h72l/plbVrmAX3Z1IsSRkwnWNvBoE/3BtZCYqIhZcVjV3FfoelVFk mZGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/OnIr3GjfgI4eIL1mK3Isags7p1hkrqZwGUoy62ZuyM=; b=hNumEtnMTC0MFiulJk4uOvt4fwyDsoCGfzq31WktppR4KAd07Tqyo5eZRIjSmf1rQc 16nc1/wsfqlZIkXoMpgMWi4OjYkRXXeqSXHCXklxXxmdJGYvHrQSzF9B3cDfczj3To9n FDzfnnJRgcl+4DmPwv7CMtuOHfkosoDvjlyWBOAilI8BS4lBsC1eVNqPb/UFRu1YBCXH QcfK6JHBgQNl4PnmQHqjhBgX6gt8ddA0mE1UPCJJU8V035GpgdtLDM12EUY513OOiayo mjsgTlZxXc2Bso1GMucHy0otBUE7WEZihb7p6DQqdjL4qM1dSp4Dw7FiLO21AC+gTydl qWbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FcPhd3Df; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jc19-20020a17090325d300b001811c58029asi16004794plb.434.2022.10.19.02.05.09; Wed, 19 Oct 2022 02:05: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=FcPhd3Df; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231744AbiJSIwv (ORCPT + 99 others); Wed, 19 Oct 2022 04:52:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231782AbiJSIwO (ORCPT ); Wed, 19 Oct 2022 04:52:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F1455926B; Wed, 19 Oct 2022 01:50:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 95F2E61831; Wed, 19 Oct 2022 08:48:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A91D2C433D6; Wed, 19 Oct 2022 08:48:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169297; bh=gxtBNvdGmC3q4uYGpTMNCsXLCpfFaT+/XRIRyBojW4w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FcPhd3Df0+h627L1mFlGr0TJv+lz12asEPSOUR9srBuzvKh+2nGGNBeWFqy6DVES4 bPpv84gxnWpGTGvutURdte2DziZ9qB3Li11OpfZpeE1OvAZDUlg7jEaBe/G18Ow9lo OpRQaVU+adlbGTtIA7S44mdtFGfccHbwbkOHxGR0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chuck Lever , Jeff Layton , Sasha Levin Subject: [PATCH 6.0 224/862] NFSD: Protect against send buffer overflow in NFSv2 READDIR Date: Wed, 19 Oct 2022 10:25:11 +0200 Message-Id: <20221019083259.940007979@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106219949088603?= X-GMAIL-MSGID: =?utf-8?q?1747106219949088603?= From: Chuck Lever [ Upstream commit 00b4492686e0497fdb924a9d4c8f6f99377e176c ] Restore the previous limit on the @count argument to prevent a buffer overflow attack. Fixes: 53b1119a6e50 ("NFSD: Fix READDIR buffer overflow") Signed-off-by: Chuck Lever Reviewed-by: Jeff Layton Signed-off-by: Chuck Lever Signed-off-by: Sasha Levin --- fs/nfsd/nfsproc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c index fcbf7e4083af..4b19cc727ea5 100644 --- a/fs/nfsd/nfsproc.c +++ b/fs/nfsd/nfsproc.c @@ -568,12 +568,11 @@ static void nfsd_init_dirlist_pages(struct svc_rqst *rqstp, struct xdr_buf *buf = &resp->dirlist; struct xdr_stream *xdr = &resp->xdr; - count = clamp(count, (u32)(XDR_UNIT * 2), svc_max_payload(rqstp)); - memset(buf, 0, sizeof(*buf)); /* Reserve room for the NULL ptr & eof flag (-2 words) */ - buf->buflen = count - XDR_UNIT * 2; + buf->buflen = clamp(count, (u32)(XDR_UNIT * 2), (u32)PAGE_SIZE); + buf->buflen -= XDR_UNIT * 2; buf->pages = rqstp->rq_next_page; rqstp->rq_next_page++; From patchwork Wed Oct 19 08:25: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: 4613 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp211751wrs; Wed, 19 Oct 2022 02:05:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7qXEDDCcj/x5dYphf4JX250EDEQ6ABu7CiTGDcDlrD5Eo1zEo2B6n48x3O7Ubx1TGOd057 X-Received: by 2002:aa7:d458:0:b0:45b:ddbf:39fa with SMTP id q24-20020aa7d458000000b0045bddbf39famr6536518edr.335.1666170345708; Wed, 19 Oct 2022 02:05:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170345; cv=none; d=google.com; s=arc-20160816; b=l4/9mvLXqTXE5mErMK5mxj/+WtaLc1kjYbay5C6/3XAgUJy0ckNPtHdeWUR3SLn2wS RiPrmUFlniD94DYeI7wKZk3xaLEiPK8PcXaWn5ccMR80f8/Gt1SHgmEwmqEQa6wy71HC Dr0EsGx9MDWhLRNprdZaXk4XN0yc8rP/FhzGE1YmwmVTe3qFGDWnXBWZEvKqA+NiYo2x EJnOYXJPJjprGmaGotXWPqydi2hKA70vipcb+o1fAkCfcyxMyXyIrDDRv/2Js5BXMfCR Y2xRNAEF0dlcj/Pja1bKBsjCHDSvBLWc91XMfXxXfshYwai2JZexSnil5q0RJw53WR6G hmzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=h3p5pzPHFml85xwOGFYUfizNMzux5+cc3tGinVJpW9k=; b=dJXIIpdabFBVYwVBW0YrvQEAhVWGIYZSTAcwkIqZKtf6SGPhIXSYft+t1BUZ0yWna1 BnUWnpA99NrGH++1ag7dw+kXv0vm8wKtYl2jDdq9LIHltiqiJazHUMZrfCpj8f08is0B VDL0UxG/eL4lO1WVoqQLtmAd+fGqtDRugAqElGaLLfl+B2W3Y/ON0AmrCP3vyq3hvE70 hH+vh6+OaV0e7dYz+tSMTaSt1ejLxFkas49LL431UWrL/z3zTpcF8iC5Ganrwp4T7XHW XiFbhvBJVhJ3C1xkggJWpu+yALtGlr9ZBonaoBZr6lFdvm6dpmAmDmuR+JCRy4Zjfc3E XDtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DTLcXNzA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ae8-20020a17090725c800b0078dce38525asi14576315ejc.896.2022.10.19.02.05.13; Wed, 19 Oct 2022 02:05: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=DTLcXNzA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229635AbiJSIxM (ORCPT + 99 others); Wed, 19 Oct 2022 04:53:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231666AbiJSIwi (ORCPT ); Wed, 19 Oct 2022 04: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 C19C1AE7E; Wed, 19 Oct 2022 01:50: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 3547B6183D; Wed, 19 Oct 2022 08:48:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 495A3C433C1; Wed, 19 Oct 2022 08:48:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169299; bh=dwIXOdJuAOxWz/PyHB5qv9pOyyCPiOmAk1+VNTWtVYM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DTLcXNzAASNw+OX2HSB1GetBFfvz831WG52b2HIDlKYsJExEb5fKwCpJBd36l7Cuc nsgvNXSZHFErcH3jlGl1rq0B6PiiFkzIznsP2nXKm77+k7/gKGmnuplVA3ybMDoA62 nCMEjsBI8mBZU1C1sWioo7Jmz62Zr0R+lMN+YfxM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bruce Fields , Chuck Lever , Sasha Levin Subject: [PATCH 6.0 225/862] NFSD: Fix handling of oversized NFSv4 COMPOUND requests Date: Wed, 19 Oct 2022 10:25:12 +0200 Message-Id: <20221019083259.992110907@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106236311070240?= X-GMAIL-MSGID: =?utf-8?q?1747106236311070240?= From: Chuck Lever [ Upstream commit 7518a3dc5ea249d4112156ce71b8b184eb786151 ] If an NFS server returns NFS4ERR_RESOURCE on the first operation in an NFSv4 COMPOUND, there's no way for a client to know where the problem is and then simplify the compound to make forward progress. So instead, make NFSD process as many operations in an oversized COMPOUND as it can and then return NFS4ERR_RESOURCE on the first operation it did not process. pynfs NFSv4.0 COMP6 exercises this case, but checks only for the COMPOUND status code, not whether the server has processed any of the operations. pynfs NFSv4.1 SEQ6 and SEQ7 exercise the NFSv4.1 case, which detects too many operations per COMPOUND by checking against the limits negotiated when the session was created. Suggested-by: Bruce Fields Fixes: 0078117c6d91 ("nfsd: return RESOURCE not GARBAGE_ARGS on too many ops") Signed-off-by: Chuck Lever Signed-off-by: Sasha Levin --- fs/nfsd/nfs4proc.c | 19 +++++++++++++------ fs/nfsd/nfs4xdr.c | 12 +++--------- fs/nfsd/xdr4.h | 3 ++- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 0437210b9898..22de5e0249ea 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -2633,9 +2633,6 @@ nfsd4_proc_compound(struct svc_rqst *rqstp) status = nfserr_minor_vers_mismatch; if (nfsd_minorversion(nn, args->minorversion, NFSD_TEST) <= 0) goto out; - status = nfserr_resource; - if (args->opcnt > NFSD_MAX_OPS_PER_COMPOUND) - goto out; status = nfs41_check_op_ordering(args); if (status) { @@ -2648,10 +2645,20 @@ nfsd4_proc_compound(struct svc_rqst *rqstp) rqstp->rq_lease_breaker = (void **)&cstate->clp; - trace_nfsd_compound(rqstp, args->opcnt); + trace_nfsd_compound(rqstp, args->client_opcnt); while (!status && resp->opcnt < args->opcnt) { op = &args->ops[resp->opcnt++]; + if (unlikely(resp->opcnt == NFSD_MAX_OPS_PER_COMPOUND)) { + /* If there are still more operations to process, + * stop here and report NFS4ERR_RESOURCE. */ + if (cstate->minorversion == 0 && + args->client_opcnt > resp->opcnt) { + op->status = nfserr_resource; + goto encode_op; + } + } + /* * The XDR decode routines may have pre-set op->status; * for example, if there is a miscellaneous XDR error @@ -2727,8 +2734,8 @@ nfsd4_proc_compound(struct svc_rqst *rqstp) status = op->status; } - trace_nfsd_compound_status(args->opcnt, resp->opcnt, status, - nfsd4_op_name(op->opnum)); + trace_nfsd_compound_status(args->client_opcnt, resp->opcnt, + status, nfsd4_op_name(op->opnum)); nfsd4_cstate_clear_replay(cstate); nfsd4_increment_op_stats(op->opnum); diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 1e9690a061ec..ac1b03cf05a5 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c @@ -2357,16 +2357,10 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp) if (xdr_stream_decode_u32(argp->xdr, &argp->minorversion) < 0) return false; - if (xdr_stream_decode_u32(argp->xdr, &argp->opcnt) < 0) + if (xdr_stream_decode_u32(argp->xdr, &argp->client_opcnt) < 0) return false; - - /* - * NFS4ERR_RESOURCE is a more helpful error than GARBAGE_ARGS - * here, so we return success at the xdr level so that - * nfsd4_proc can handle this is an NFS-level error. - */ - if (argp->opcnt > NFSD_MAX_OPS_PER_COMPOUND) - return true; + argp->opcnt = min_t(u32, argp->client_opcnt, + NFSD_MAX_OPS_PER_COMPOUND); if (argp->opcnt > ARRAY_SIZE(argp->iops)) { argp->ops = kzalloc(argp->opcnt * sizeof(*argp->ops), GFP_KERNEL); diff --git a/fs/nfsd/xdr4.h b/fs/nfsd/xdr4.h index 96267258e629..466e2786fc97 100644 --- a/fs/nfsd/xdr4.h +++ b/fs/nfsd/xdr4.h @@ -717,9 +717,10 @@ struct nfsd4_compoundargs { struct svcxdr_tmpbuf *to_free; struct svc_rqst *rqstp; - u32 taglen; char * tag; + u32 taglen; u32 minorversion; + u32 client_opcnt; u32 opcnt; struct nfsd4_op *ops; struct nfsd4_op iops[8]; From patchwork Wed Oct 19 08:25: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: 5104 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp250317wrs; Wed, 19 Oct 2022 03:48:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4eb/Thuq14LQlIJGYbffSWPhR/OE1QzhlWGOJNazEPhLvmdgV7tUy25/V63BH++LbCvxwg X-Received: by 2002:a17:907:75ed:b0:78d:97ed:2894 with SMTP id jz13-20020a17090775ed00b0078d97ed2894mr5972021ejc.739.1666176524858; Wed, 19 Oct 2022 03:48:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176524; cv=none; d=google.com; s=arc-20160816; b=O0HmJmPeuPLMtbTy0e5tGD7L1R1WCDlmn+IQLFLH3//sIAmJqPA/pfZ1aCTRPRgXUm mYjcYY5cPUd8utCx/0heqMKt3OvwhCPRC4mL3xnQQ9YzSg4DjGX0nga+BzGh8yu4xRga imAs1ztULBsBSNT6jcHgE0O8z7pazYpl3iR43mrMdELo0LiHH1EfCKJaqPq4t8iHowZe M7xuRcP31iBqeZLM6GdQZ4/606C6Q+IV3rseAuqnmLhyKX/ogcxyFrxH/boHGiV+hiXu DJKQ0bU6LchtLyReh72o+gYkZ8gavCUT9SheHEZlwwLfEEWCly1H09fa3JkCfI+yLnr2 oYvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=IjR25XfV5KRSyAKhUBWqq1cHW1d+VRQw41yHn52s0AQ=; b=ALjoV0ir/IVqa4Az5D0iRShFxBngOVtcx/yFeymcaZVLToYvWwTNBkHJP9tEBqlKAD 6SdHWHwinxlbZPD76mnvuf6iWxTMvZbdn9hKYBmsjZYSnMbVRRuwLazawPi2lbLjPH6L 8OacAGxTyV4pI3G4a5tS4iU/h/n5d3CJBCjr9+ev5hxDFiqcmvhvcjEPVUbYsvxWSYHu 9nc1jwGLaJ60FcreimatpBR+EBovvzYtF18qT3fQTSuP42mgQlTkB5RgsCAxEGeHjhLZ wcvgaSec4oVTyL3+PK4LFo5jdAfYRLoabv5sJLYQ4nSgHYs8talbwoJA0aq+9QXm8i0r umnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YmS35Zbm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o25-20020a170906289900b0078d4dcceb5dsi11961922ejd.717.2022.10.19.03.48.19; Wed, 19 Oct 2022 03:48: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=YmS35Zbm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233391AbiJSKr4 (ORCPT + 99 others); Wed, 19 Oct 2022 06:47:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232968AbiJSKpc (ORCPT ); Wed, 19 Oct 2022 06:45:32 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4DF211D99E; Wed, 19 Oct 2022 03:21: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 7E376B82324; Wed, 19 Oct 2022 08:48:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E713FC4314E; Wed, 19 Oct 2022 08:48:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169302; bh=2eafooLCWzYB3jrawTGKwYMxHojxlE96ckfg/2CLZiY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YmS35ZbmV9I0KbiFZU06/eh+K1Jk+YSccScUaqgJ9coNpuYhycQheLvnAzbCDjqvf 1RMmUWyDM7h52ZqIlnHiw4Tsnl0STUAOKSMuP28tKyY9TdIteBNxsooqp+yuKD8tYw XAvA92NDM06P7UXItWZL+ti79rIDGTkCvwGcyMow= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bill Wendling , Juergen Gross , Kees Cook , Sasha Levin , Nathan Chancellor Subject: [PATCH 6.0 226/862] x86/paravirt: add extra clobbers with ZERO_CALL_USED_REGS enabled Date: Wed, 19 Oct 2022 10:25:13 +0200 Message-Id: <20221019083300.040763886@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112715759380002?= X-GMAIL-MSGID: =?utf-8?q?1747112715759380002?= From: Bill Wendling [ Upstream commit 8c86f29bfb18465d15b05cfd26a6454ec787b793 ] The ZERO_CALL_USED_REGS feature may zero out caller-saved registers before returning. In spurious_kernel_fault(), the "pte_offset_kernel()" call results in this assembly code: .Ltmp151: #APP # ALT: oldnstr .Ltmp152: .Ltmp153: .Ltmp154: .section .discard.retpoline_safe,"",@progbits .quad .Ltmp154 .text callq *pv_ops+536(%rip) .Ltmp155: .section .parainstructions,"a",@progbits .p2align 3, 0x0 .quad .Ltmp153 .byte 67 .byte .Ltmp155-.Ltmp153 .short 1 .text .Ltmp156: # ALT: padding .zero (-(((.Ltmp157-.Ltmp158)-(.Ltmp156-.Ltmp152))>0))*((.Ltmp157-.Ltmp158)-(.Ltmp156-.Ltmp152)),144 .Ltmp159: .section .altinstructions,"a",@progbits .Ltmp160: .long .Ltmp152-.Ltmp160 .Ltmp161: .long .Ltmp158-.Ltmp161 .short 33040 .byte .Ltmp159-.Ltmp152 .byte .Ltmp157-.Ltmp158 .text .section .altinstr_replacement,"ax",@progbits # ALT: replacement 1 .Ltmp158: movq %rdi, %rax .Ltmp157: .text #NO_APP .Ltmp162: testb $-128, %dil The "testb" here is using %dil, but the %rdi register was cleared before returning from "callq *pv_ops+536(%rip)". Adding the proper constraints results in the use of a different register: movq %r11, %rdi # Similar to above. testb $-128, %r11b Link: https://github.com/KSPP/linux/issues/192 Signed-off-by: Bill Wendling Reported-and-tested-by: Nathan Chancellor Fixes: 035f7f87b729 ("randstruct: Enable Clang support") Reviewed-by: Juergen Gross Link: https://lore.kernel.org/lkml/fa6df43b-8a1a-8ad1-0236-94d2a0b588fa@suse.com/ Signed-off-by: Kees Cook Link: https://lore.kernel.org/r/20220902213750.1124421-3-morbo@google.com Signed-off-by: Sasha Levin --- arch/x86/include/asm/paravirt_types.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/paravirt_types.h b/arch/x86/include/asm/paravirt_types.h index 89df6c6617f5..bc2e1b67319d 100644 --- a/arch/x86/include/asm/paravirt_types.h +++ b/arch/x86/include/asm/paravirt_types.h @@ -414,8 +414,17 @@ int paravirt_disable_iospace(void); "=c" (__ecx) #define PVOP_CALL_CLOBBERS PVOP_VCALL_CLOBBERS, "=a" (__eax) -/* void functions are still allowed [re]ax for scratch */ +/* + * void functions are still allowed [re]ax for scratch. + * + * The ZERO_CALL_USED REGS feature may end up zeroing out callee-saved + * registers. Make sure we model this with the appropriate clobbers. + */ +#ifdef CONFIG_ZERO_CALL_USED_REGS +#define PVOP_VCALLEE_CLOBBERS "=a" (__eax), PVOP_VCALL_CLOBBERS +#else #define PVOP_VCALLEE_CLOBBERS "=a" (__eax) +#endif #define PVOP_CALLEE_CLOBBERS PVOP_VCALLEE_CLOBBERS #define EXTRA_CLOBBERS , "r8", "r9", "r10", "r11" From patchwork Wed Oct 19 08:25: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: 5560 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp350028wrs; Wed, 19 Oct 2022 07:12:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6R3QpjTBsDtkwhKFZZqHTP5RakLi7NKzeOH6cldkqkrXRiP6RGG5uGaBAWw5ajsqjfP9b8 X-Received: by 2002:a17:90a:d990:b0:20d:9c20:90c with SMTP id d16-20020a17090ad99000b0020d9c20090cmr10322195pjv.203.1666188772784; Wed, 19 Oct 2022 07:12:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666188772; cv=none; d=google.com; s=arc-20160816; b=YjCV56vl8C4WMtPE4BudXRqxS6yi9NJA5ZkHZo5OGpZxL+MGaSKpf/Mqlb5349YWkZ 7HAaBcCHtKJjxx4hHNDWVOuoj3oZWXzYWHUDUMEWU+Bb6KQ3Di5R8LTLu0muvGVxaje/ DWbsA+7fLEt7vyrBbcc486OP42BD/C+7V2HZ7TxBvFcMy2F2lmkG3j1ZsnFb7mkWJYn2 bklADpIKidLKN4TcRqLRAEJSwu86bFYlTTtDvO4ixaSdeyT6HkvQd9Z7P/dCDfOn3vBO xq7wqSNvkWi63ckdhLBSc3NzkPE0WoiGS1oX7jQsg+lLTyazOmlxLknPp3Hyo7ubYNqq ksOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gj5GSn/MoZ/VUk3+Ya5cGa6ssWwLWgNSDc/2zAeHGm8=; b=COrhxd2mheG0OpmCXY+ZMo2sMVgRzdvRRpbBBZX0dT1Lz72Kikv3TwJ9bU/H0GtyGt SRIR434dJ6EINpMEajozH7DOGm36g6/P5XMF53UWAw5yZe/FdVVifmXjOyPaCJp3HezV R8p4Am4/ZS/qR0Jbih9SAULOSROpdqUePHjxdSb+sOL+30M6UsuymTY9AjM8gzCUBul+ 68krLBjSVrU3di2q6nG/dof+vNyl8qfm7fYEEGP7jWkb2/FwDQWcndCYH+5P/I3mv+8F u19VQoSvVGkAqgj9yBxJLVceKRy6DE7pQJPn7t3BLL4uATHCm3LpfD8wwYHfGRVYaD6v +kPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="d38KlR/M"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k189-20020a6384c6000000b00462b85376ecsi18080143pgd.668.2022.10.19.07.12.21; Wed, 19 Oct 2022 07:12: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="d38KlR/M"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233829AbiJSN51 (ORCPT + 99 others); Wed, 19 Oct 2022 09:57:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233446AbiJSNxU (ORCPT ); Wed, 19 Oct 2022 09:53: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 B7BEB1DB271; Wed, 19 Oct 2022 06:36: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 3A235B82323; Wed, 19 Oct 2022 08:48:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99325C433C1; Wed, 19 Oct 2022 08:48:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169305; bh=092M7OPnrt1mOCb9Id4pJ6ZjTgDA13Ex/8+A7MU3ylw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d38KlR/MuYzxPAAbdRNEgBP8Mql75O7n8rJdEqjMQ+DcZdfqx36RTT3/gnMBJN9IJ tBunQN7Q9IRqaD+L7F8AJpkQKO6/yOwB0ijH14fusqOB4sUCHYEg50Wj7u/ZZZDr8B KTLW0leq7EhBdmDDkm3YUDHmnder2HztqtcCadIM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Jason A. Donenfeld" , Geert Uytterhoeven , Sasha Levin Subject: [PATCH 6.0 227/862] m68k: Process bootinfo records before saving them Date: Wed, 19 Oct 2022 10:25:14 +0200 Message-Id: <20221019083300.092742604@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747125558684280443?= X-GMAIL-MSGID: =?utf-8?q?1747125558684280443?= From: Jason A. Donenfeld [ Upstream commit 7c236d93c6764dcaca7ab66d76768a044647876d ] The RNG seed boot record is memzeroed after processing, in order to preserve forward secrecy. By saving the bootinfo for procfs prior to that, forward secrecy is violated, since it becomes possible to recover past states. So, save the bootinfo block only after first processing them. Fixes: a1ee38ab1a75 ("m68k: virt: Use RNG seed from bootinfo block") Signed-off-by: Jason A. Donenfeld Link: https://lore.kernel.org/r/20220927130835.1629806-1-Jason@zx2c4.com Signed-off-by: Geert Uytterhoeven Signed-off-by: Sasha Levin --- arch/m68k/kernel/setup_mm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c index e62fa8f2149b..7e7ef67cff8b 100644 --- a/arch/m68k/kernel/setup_mm.c +++ b/arch/m68k/kernel/setup_mm.c @@ -109,10 +109,9 @@ extern void paging_init(void); static void __init m68k_parse_bootinfo(const struct bi_record *record) { + const struct bi_record *first_record = record; uint16_t tag; - save_bootinfo(record); - while ((tag = be16_to_cpu(record->tag)) != BI_LAST) { int unknown = 0; const void *data = record->data; @@ -182,6 +181,8 @@ static void __init m68k_parse_bootinfo(const struct bi_record *record) record = (struct bi_record *)((unsigned long)record + size); } + save_bootinfo(first_record); + m68k_realnum_memory = m68k_num_memory; #ifdef CONFIG_SINGLE_MEMORY_CHUNK if (m68k_num_memory > 1) { From patchwork Wed Oct 19 08:25: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: 5566 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp350490wrs; Wed, 19 Oct 2022 07:13:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5nCEkJI9ru2DUQ1360B88N5S20LHI3lnh6t3X1s8mmtntl1u/ybozLTJ0hUscgvmF8w7l5 X-Received: by 2002:a17:907:701:b0:780:2c44:e4dd with SMTP id xb1-20020a170907070100b007802c44e4ddmr7114957ejb.589.1666188827192; Wed, 19 Oct 2022 07:13:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666188827; cv=none; d=google.com; s=arc-20160816; b=YQ+e5ha/hmNSQ5N9NxgFXOS9FvuuWSq4F5S/veAja6X51avDBs4Zhvd4WzumpV15F0 MF96l/BwpjAMrIBjDCJWAWrhYPWVw4nobLxWnFvJlvk+GZFsAbWLU5LwAOM/qkng+SEB QH30lhYdW7OFHrmcnJuu08xDKdxXj5aLL7888+4XHENZLoiSn8VBWyaXI2W1K/1kKzCx yyeZfsY3uq7UJHtxG0M6PoYIkvZg0Zpz6keQMT8KEGHTQ8/wcFGy0KmQg4/p0WNkyBVI EiW/Ei3tT0aVUVe7zQn71uJxtN4hu9b0rC1GmriY0DXQftidmowRBAGuymZ84kYqALTQ EkgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lHZ66outyL92VwSAmP0g5ntTSDES40/cXDkBB/VMSXE=; b=aWj06hEzGMA8dY/D79Qum4HyvAw/XeOhjX/eUYjdYEvqpr4nV9q0n97XiI1UduIsbn PVMkj4dw/+JCXxmjQrf+A57bLb/WtKltpBnwxdhVZ7Fqctcq8HQDGO8BMIpYzFYHkqnz B/f8nlfLqmpA2uXjV0ndLYUosc/IHcACsPlIiH4n7BujzxG2FiVO1px5W0jMUQ5q6CxP N1ODVIB8CkyCHdCxgmd52AG04xMRrAKl2c3JrjFcOjU8GxHcN7ExDFe/nNWX7DUuIEcG 7B/YVeBqqSYPZPhtd7kA9LzcP8+Cho74y2q7ZuWMUBpd6mblRsPeUYKDr6uMMUnpTjMy d5nA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uV7GoQ5k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z9-20020a1709063a0900b00769d94690fesi12627534eje.326.2022.10.19.07.13.17; Wed, 19 Oct 2022 07:13: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=uV7GoQ5k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233029AbiJSN6w (ORCPT + 99 others); Wed, 19 Oct 2022 09:58:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234146AbiJSNzQ (ORCPT ); Wed, 19 Oct 2022 09:55:16 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E8A817C55F; Wed, 19 Oct 2022 06:37:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 38E79B82326; Wed, 19 Oct 2022 08:48:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87E87C433C1; Wed, 19 Oct 2022 08:48:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169307; bh=gdVxvXTVsxzy2ljfw76jvEClmWnODYkAY5VxrKNgL8U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uV7GoQ5kkpRe81u7hX9qWdRRVxsyu+X5A9zKz6ugVCuVeYdhY9wBcrnBccA/wRBX3 DaspGzUd80ZhAmI9Rq4juO+6HMVzlVaCMUSEd+SKLMDlIxJIKnZLtgjiAz7tq043N8 s25gUYWhNz1TALSDVpLCew1sdplCnBy0dAlwA+so= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Fainelli , Andrii Nakryiko , Jiri Olsa , Sasha Levin Subject: [PATCH 6.0 228/862] libbpf: Initialize err in probe_map_create Date: Wed, 19 Oct 2022 10:25:15 +0200 Message-Id: <20221019083300.143314598@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747125616050282110?= X-GMAIL-MSGID: =?utf-8?q?1747125616050282110?= From: Florian Fainelli [ Upstream commit 3045f42a64324d339125a8a1a1763bb9e1e08300 ] GCC-11 warns about the possibly unitialized err variable in probe_map_create: libbpf_probes.c: In function 'probe_map_create': libbpf_probes.c:361:38: error: 'err' may be used uninitialized in this function [-Werror=maybe-uninitialized] 361 | return fd < 0 && err == exp_err ? 1 : 0; | ~~~~^~~~~~~~~~ Fixes: 878d8def0603 ("libbpf: Rework feature-probing APIs") Signed-off-by: Florian Fainelli Signed-off-by: Andrii Nakryiko Acked-by: Jiri Olsa Link: https://lore.kernel.org/bpf/20220801025109.1206633-1-f.fainelli@gmail.com Signed-off-by: Sasha Levin --- tools/lib/bpf/libbpf_probes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/lib/bpf/libbpf_probes.c b/tools/lib/bpf/libbpf_probes.c index 0b5398786bf3..6d495656f554 100644 --- a/tools/lib/bpf/libbpf_probes.c +++ b/tools/lib/bpf/libbpf_probes.c @@ -193,7 +193,7 @@ static int probe_map_create(enum bpf_map_type map_type) LIBBPF_OPTS(bpf_map_create_opts, opts); int key_size, value_size, max_entries; __u32 btf_key_type_id = 0, btf_value_type_id = 0; - int fd = -1, btf_fd = -1, fd_inner = -1, exp_err = 0, err; + int fd = -1, btf_fd = -1, fd_inner = -1, exp_err = 0, err = 0; key_size = sizeof(__u32); value_size = sizeof(__u32); From patchwork Wed Oct 19 08:25: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: 4620 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp211894wrs; Wed, 19 Oct 2022 02:06:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6gzuZKrTKFTY3dVVRLPtcNmz4aV5lr9bZPXmL9zSchD4Xsqsn155Ny0uwJBJdhpdrz4LJ5 X-Received: by 2002:a17:906:cc0f:b0:78e:1208:8796 with SMTP id ml15-20020a170906cc0f00b0078e12088796mr5783983ejb.601.1666170370632; Wed, 19 Oct 2022 02:06:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170370; cv=none; d=google.com; s=arc-20160816; b=vlKJamnxEpS3AOOaU1SHCteJqlEOmFv/sOEn9Qtrhp8pVgCHd1b8oM02hoczgroXZN a8WrrQEWz7qVMLam40qjsB3/8IV4Vg7FcfeyVSkfqzvOE6Nb/5sG6GqS6T+MtXMG2x+9 JZbwWGxwEvKkpOMxJ1NzQ/y9WAwBvmDWZnNx451r7AifXoYHFWd1kmpSX1YbNCi+88kM iKdkVA65tQQmoNLlS+GqvU8yv5uNen/p+QxUdjCtlfD39EHHt+KeZQpDc6+X3QVXhJdL J3CX3KFo1blirWM7BeJNdWbYQaJ2eyjoRvPRbjz1hiwvwx/wvh7qymJ61iV2wqjPhAsd fcAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2ju0xb5J/7LgCjsTM1mnaFCYDOqG0uHEgD1DoR6rxkE=; b=A/1fJ9vcZ14sywvdAPN+pM46qh7nIeOqkqnrbviWAGKjcAKgP0UQhQGNIB9tIxMYDq o34dbjV5LcDlV0dVhUUe2VvQR9eh2peN08rewiaVbK9FlHrNrFDBBzjeXebTYvHHcRQD f9E2eKprBADpL7H5zg2NTU4SXpxcH/NM9FWPqxd2g2a99xWUIigwxGk49KmkhB/1H3tN fOEPQLgrosk0LRXGzl0hLL5OBAwxXZmDwNTFhwuGpJ3lBtak3VNCSMmFi9MYedEXQOr+ Gzy0Yz+MKQQRsiKn0cRuBtTP5JJCvdsg4f6RqDrVE0syL/0zwVFjhS7JzdgkRocNG6IX bx2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uvmWQSCU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e13-20020a1709062c0d00b0073d80d8b631si11218448ejh.268.2022.10.19.02.05.38; Wed, 19 Oct 2022 02:06: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=uvmWQSCU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231889AbiJSI4A (ORCPT + 99 others); Wed, 19 Oct 2022 04:56:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232151AbiJSIys (ORCPT ); Wed, 19 Oct 2022 04:54:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2797797EFB; Wed, 19 Oct 2022 01:51:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 287F56183D; Wed, 19 Oct 2022 08:50:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3AA5DC433C1; Wed, 19 Oct 2022 08:50:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169429; bh=HBbeeWj5cCSDh5GVLlnZ/XVO+E/RGuJ2akvlL/0LNDQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uvmWQSCUOzlvjBCFL2qs0fqZ4xT3QsuAZ3EfdpHrNKH8p6k3NFJTr8He4JoobnNHv 0+grZVAuAZu4ibt+TdagXPHgWsw997tImiaQLDdR1SdzYkSGR1FjbXejS1fFrNnwa1 WJym1NPmrSpcbomD1XWy31MK/izWwggB01uUNaXE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ping-Ke Shih , Kalle Valo , Sasha Levin Subject: [PATCH 6.0 229/862] wifi: rtlwifi: 8192de: correct checking of IQK reload Date: Wed, 19 Oct 2022 10:25:16 +0200 Message-Id: <20221019083300.185899884@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106262857124079?= X-GMAIL-MSGID: =?utf-8?q?1747106262857124079?= From: Ping-Ke Shih [ Upstream commit 93fbc1ebd978cf408ef5765e9c1630fce9a8621b ] Since IQK could spend time, we make a cache of IQK result matrix that looks like iqk_matrix[channel_idx].val[x][y], and we can reload the matrix if we have made a cache. To determine a cache is made, we check iqk_matrix[channel_idx].val[0][0]. The initial commit 7274a8c22980 ("rtlwifi: rtl8192de: Merge phy routines") make a mistake that checks incorrect iqk_matrix[channel_idx].val[0] that is always true, and this mistake is found by commit ee3db469dd31 ("wifi: rtlwifi: remove always-true condition pointed out by GCC 12"), so I recall the vendor driver to find fix and apply the correctness. Fixes: 7274a8c22980 ("rtlwifi: rtl8192de: Merge phy routines") Signed-off-by: Ping-Ke Shih Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220801113345.42016-1-pkshih@realtek.com Signed-off-by: Sasha Levin --- drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c index 15e6a6aded31..d18c092b6142 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c @@ -2386,11 +2386,10 @@ void rtl92d_phy_reload_iqk_setting(struct ieee80211_hw *hw, u8 channel) rtl_dbg(rtlpriv, COMP_SCAN, DBG_LOUD, "Just Read IQK Matrix reg for channel:%d....\n", channel); - _rtl92d_phy_patha_fill_iqk_matrix(hw, true, - rtlphy->iqk_matrix[ - indexforchannel].value, 0, - (rtlphy->iqk_matrix[ - indexforchannel].value[0][2] == 0)); + if (rtlphy->iqk_matrix[indexforchannel].value[0][0] != 0) + _rtl92d_phy_patha_fill_iqk_matrix(hw, true, + rtlphy->iqk_matrix[indexforchannel].value, 0, + rtlphy->iqk_matrix[indexforchannel].value[0][2] == 0); if (IS_92D_SINGLEPHY(rtlhal->version)) { if ((rtlphy->iqk_matrix[ indexforchannel].value[0][4] != 0) From patchwork Wed Oct 19 08:25:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5144 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp252983wrs; Wed, 19 Oct 2022 03:56:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5fwsH05+ERmknP0ec6RY9Y9+mQ00KsE/+Gr/qW8pD9DMtMupjX99IMNW8hIQSwNp5+3Akz X-Received: by 2002:a17:907:a40f:b0:790:540c:b6e3 with SMTP id sg15-20020a170907a40f00b00790540cb6e3mr6218381ejc.41.1666176974270; Wed, 19 Oct 2022 03:56:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176974; cv=none; d=google.com; s=arc-20160816; b=PzzJTsUNVRk1wx+gP3VHXOCgBDOqE2BID5NloQpGjudWNeatts0xKLgfhv6bt6eXdH QKmZ69yP5gqjZUfsKCfBIgjXnlteUgymt1WghZl735pkjRjl6/yUc/2l4buEsbeBLz/X n8vqG0wQ1h+vmzggmSpAjFHXD05Yc5tr1tbU8TrZ6s66DRS1GjoGchBF+dY8oYliAYeq eg8dob1qL8VzZ3w/gTV+lpoXlI55KZQWrBDi7GUOCrRgTdm8Vv2FpADQX6bu2ytH2evp vWVJ7p1TRSPb4Nv7p9IJL8uFr2ec8dvmyN6F0YpilhBlAHmXJlSII7HMnmk/MvvrtoBE VARA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=B6r5QhDYU3fd4Yxsp31H70whO5ONVpZ7UJY69Q2Vi0s=; b=D+AAtghRwoAtAEpkeVAIX084TYc63+eCcGhqSs8w7eoojqAlL2NRSG+5+BuqKBU5Zc 0sQSgPkyninFTdyHI0dabPMh2EtwsaHZ7ATgc2wLKqvDjTvAtm/KP3ZZwYZuLNAay+0Y DELs0SDwO2rpTYUdqvBNFici1zU3+LdmTm6Y/0gFlmbywVDHk/RoxFDGLlALIQHeZKnZ hds3frvG8Hjm36vFqYUzyFskZrTzvCtbz++Ch94E/zGD7SoJWpm0b+XiHxsYABFG3ClD wX8uCgwXkIyDWeSJyMxQvt14TVf50syM1CXaGmZ60/hCltFTeYeR+GZ9bf9jqB+i+H/d vjyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KZbVgTy1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ky14-20020a170907778e00b00789d185c39asi11271611ejc.62.2022.10.19.03.55.46; Wed, 19 Oct 2022 03:56: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=KZbVgTy1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234613AbiJSKxB (ORCPT + 99 others); Wed, 19 Oct 2022 06:53:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234597AbiJSKwa (ORCPT ); Wed, 19 Oct 2022 06:52: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 B3B63EA364; Wed, 19 Oct 2022 03:23: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 94AEF6173E; Wed, 19 Oct 2022 08:48:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8214C433C1; Wed, 19 Oct 2022 08:48:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169334; bh=tisD/e9ng4fFfYKxVzgUTkB5FFK+ZNC0Xb21FP3iqzw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KZbVgTy1TqOPBvk6FOYXhbL7gCJMDz1GD12+07aog4sEFNOMr1QPqi3Gy3AYpx5Oo MCMTdRERdDg/ZGvsdy5/PabM6UO/1pMX6n+8hLNWxf2L0CsI/29YcBbDWjmVx/4iDY qQgRoAAGFXumrzkL7pbBPl9Du3+P/nYQbcEiaekU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Youghandhar Chintala , Kalle Valo , Sasha Levin Subject: [PATCH 6.0 230/862] wifi: ath10k: Set tx credit to one for WCN3990 snoc based devices Date: Wed, 19 Oct 2022 10:25:17 +0200 Message-Id: <20221019083300.225040353@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747113186543182544?= X-GMAIL-MSGID: =?utf-8?q?1747113186543182544?= From: Youghandhar Chintala [ Upstream commit d81bbb684c250a637186d9286d75b1cb04d2986c ] Currently host can send two WMI commands at once. There is possibility to cause SMMU issues or corruption, if host wants to initiate 2 DMA transfers, it is possible when copy complete interrupt for first DMA reaches host, CE has already updated SRRI (Source ring read index) for both DMA transfers and is in the middle of 2nd DMA. Host uses SRRI (Source ring read index) to interpret how many DMA’s have been completed and tries to unmap/free both the DMA entries. Hence now it is limiting to one.Because CE is still in the middle of 2nd DMA which can cause these issues when handling two DMA transfers. This change will not impact other targets, as it is only for WCN3990. Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.2.0-01387-QCAHLSWMTPLZ-1 Signed-off-by: Youghandhar Chintala Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220801134941.15216-1-quic_youghand@quicinc.com Stable-dep-of: f020d9570a04 ("wifi: ath10k: add peer map clean up for peer delete in ath10k_sta_state()") Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath10k/core.c | 16 ++++++++++++++++ drivers/net/wireless/ath/ath10k/htc.c | 11 ++++++++--- drivers/net/wireless/ath/ath10k/hw.h | 2 ++ 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c index 276954b70d63..d1ac64026cb3 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c @@ -98,6 +98,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .tx_stats_over_pktlog = true, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA988X_HW_2_0_VERSION, @@ -136,6 +137,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .tx_stats_over_pktlog = true, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA9887_HW_1_0_VERSION, @@ -175,6 +177,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .tx_stats_over_pktlog = false, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA6174_HW_3_2_VERSION, @@ -209,6 +212,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .supports_peer_stats_info = true, .dynamic_sar_support = true, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA6174_HW_2_1_VERSION, @@ -247,6 +251,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .tx_stats_over_pktlog = false, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA6174_HW_2_1_VERSION, @@ -285,6 +290,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .tx_stats_over_pktlog = false, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA6174_HW_3_0_VERSION, @@ -323,6 +329,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .tx_stats_over_pktlog = false, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA6174_HW_3_2_VERSION, @@ -365,6 +372,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .supports_peer_stats_info = true, .dynamic_sar_support = true, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA99X0_HW_2_0_DEV_VERSION, @@ -409,6 +417,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .tx_stats_over_pktlog = false, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA9984_HW_1_0_DEV_VERSION, @@ -460,6 +469,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .tx_stats_over_pktlog = false, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA9888_HW_2_0_DEV_VERSION, @@ -508,6 +518,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .tx_stats_over_pktlog = false, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA9377_HW_1_0_DEV_VERSION, @@ -546,6 +557,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .tx_stats_over_pktlog = false, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA9377_HW_1_1_DEV_VERSION, @@ -586,6 +598,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .tx_stats_over_pktlog = false, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA9377_HW_1_1_DEV_VERSION, @@ -617,6 +630,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .credit_size_workaround = true, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA4019_HW_1_0_DEV_VERSION, @@ -662,6 +676,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .tx_stats_over_pktlog = false, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = WCN3990_HW_1_0_DEV_VERSION, @@ -693,6 +708,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .tx_stats_over_pktlog = false, .dynamic_sar_support = true, .hw_restart_disconnect = true, + .use_fw_tx_credits = false, }, }; diff --git a/drivers/net/wireless/ath/ath10k/htc.c b/drivers/net/wireless/ath/ath10k/htc.c index fab398046a3f..6d1784f74bea 100644 --- a/drivers/net/wireless/ath/ath10k/htc.c +++ b/drivers/net/wireless/ath/ath10k/htc.c @@ -947,13 +947,18 @@ int ath10k_htc_wait_target(struct ath10k_htc *htc) return -ECOMM; } - htc->total_transmit_credits = __le16_to_cpu(msg->ready.credit_count); + if (ar->hw_params.use_fw_tx_credits) + htc->total_transmit_credits = __le16_to_cpu(msg->ready.credit_count); + else + htc->total_transmit_credits = 1; + htc->target_credit_size = __le16_to_cpu(msg->ready.credit_size); ath10k_dbg(ar, ATH10K_DBG_HTC, - "Target ready! transmit resources: %d size:%d\n", + "Target ready! transmit resources: %d size:%d actual credits:%d\n", htc->total_transmit_credits, - htc->target_credit_size); + htc->target_credit_size, + msg->ready.credit_count); if ((htc->total_transmit_credits == 0) || (htc->target_credit_size == 0)) { diff --git a/drivers/net/wireless/ath/ath10k/hw.h b/drivers/net/wireless/ath/ath10k/hw.h index 93acf0dd580a..1b99f3a39a11 100644 --- a/drivers/net/wireless/ath/ath10k/hw.h +++ b/drivers/net/wireless/ath/ath10k/hw.h @@ -635,6 +635,8 @@ struct ath10k_hw_params { bool dynamic_sar_support; bool hw_restart_disconnect; + + bool use_fw_tx_credits; }; struct htt_resp; From patchwork Wed Oct 19 08:25: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: 5546 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp348932wrs; Wed, 19 Oct 2022 07:11:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4fOMmfQXzJF1MbgZcsvEUvqasDu57laQki8DblIq5/ohwuPqrSQO2PPCN5lgPcuRKh7o0f X-Received: by 2002:a63:5f54:0:b0:462:1149:f3b3 with SMTP id t81-20020a635f54000000b004621149f3b3mr7479893pgb.445.1666188662950; Wed, 19 Oct 2022 07:11:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666188662; cv=none; d=google.com; s=arc-20160816; b=D350poWlznPv+9FHyYkr7CrMm7NiA0E9YSJ7raWXzrVXYYNCpsQuQ1W49J9vaQte+d WMeGqHfBpD5m13YivLgJ+GMl0kktDf6gyTAfSmf6OP3x+iWaUUIy/vQU0V5Cb6lCgTVT 4QPfHVMMieGC71c0h0+B5Aa7YVZIM2M1/mMn8owGs1DXGLBA7OHqBQGMWw2iW2DtdgJj Q7LJtnV6kAFwTFtFWbgWNz7oMLpDOqrqFlMe5wLr3yPHuEeR9R3hRq8FqHRIPRBzfQnE r1IJ60duO5O4V/JW9RglsdE9PVp/30518Q8g4eTHehbzDp1Mupnn6z5WMc3cIbwnEATO RJ+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=xRR6V1beJcW3RBVdv/FPgRCLxs0pgJjV/N2AtfcfIr0=; b=nsBC3Xz8Za3ydu6IkEciOCrlJHcNaQtVG7TLA8CfvYyYMakebLkQDRd/DD3UVleULs M4H1MrxHrvL49701ww6wqZPq06J+lsT1GK1aWQJAgy/i8DapAPJUeGz0RwWZa4X3VMSN DrK+VynN1NwE3EsoXyfyOC54MtGXg+Emunu8/60CMGddktat3wPVbDZ4QpnEcuyKvAmJ ACDmEmx9v6fq0XBLRhhUQ7SW+dNdDRqhida7rXXfl3r5aKRmQToUgCgTwPc46UvJtUYG +SIXYgH8lhD1iMY9tlCuPVgJE+u/DfzzXMJrNvdz7R3nfoSXwgHSnRg9yEkOcdrx53sF WS6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=w5oRdgBe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u10-20020a056a00158a00b005583001558dsi19084400pfk.150.2022.10.19.07.10.34; Wed, 19 Oct 2022 07:11: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=w5oRdgBe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231751AbiJSN4K (ORCPT + 99 others); Wed, 19 Oct 2022 09:56:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233839AbiJSNyJ (ORCPT ); Wed, 19 Oct 2022 09: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 1B6EB16551E; Wed, 19 Oct 2022 06:36:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 68E20B822EC; Wed, 19 Oct 2022 08:49:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C2063C433D6; Wed, 19 Oct 2022 08:49:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169363; bh=PolXSAA/82XHintpRjAd8KKsn22M9jYz01u5u1QyXHc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w5oRdgBe76/DfsmiqnqZXFJl/5MBXzv0FetihFJOBChvTRuwMd2oATwydkEYW32oD /dOFDkHBfXPYfffzJYuYkYfPbpnCdNsTqIw9a6Qf/A5Yi9O+YyZ1M0gVsxMX3kCKUX jUYXAbuAAlps0lGQQqMa5qycep0dWOu0kkzDTMyI= 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 6.0 231/862] wifi: ath10k: add peer map clean up for peer delete in ath10k_sta_state() Date: Wed, 19 Oct 2022 10:25:18 +0200 Message-Id: <20221019083300.264802113@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747125443695748159?= X-GMAIL-MSGID: =?utf-8?q?1747125443695748159?= 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 9dd3b8fba4b0..23381a9db6ae 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -864,11 +864,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); @@ -880,25 +905,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); } @@ -7621,10 +7628,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 Wed Oct 19 08:25: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: 4726 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214049wrs; Wed, 19 Oct 2022 02:11:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5P3PNhc83TdJVGDR72LvWiRtJxBVDBY2WVdfFnX9/8DgRw546wge51M2C1W8NBQA4RC+r4 X-Received: by 2002:a05:6402:1941:b0:457:13a:cce9 with SMTP id f1-20020a056402194100b00457013acce9mr6578790edz.265.1666170706511; Wed, 19 Oct 2022 02:11:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170706; cv=none; d=google.com; s=arc-20160816; b=u66Qajk+4KhTV7l55bsb1ujNHqq13BKRBi5+9AZ//9dBu6xJ5l+1ELG+a1VKbmU3mS DfYm2ltmXWtdph/+yt1ZyZXi2KRA9q3ea976wrLubXjhcFpNpapyEFwVnV7Rm9RliS3l a4HjFwusViLhLgCG91GP69ftHNhhA9wHyON4RByuFRvaA29+q+eyC4Xi38olwETnXy6J YumnKT1pwIbNj9TuicL4vSB/DucEVZ8AfIusM7ax5DWR8C4ApwBTyM04CXY63+qnbTIh oaXQkx1H94MorrL9D3yzogLyfWhixMhmRAHKq9xJJ/iaAvNF6n8an4IFL+/S4jpmbo/0 abBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=72TVcTM5hVSr15gsHrU0FxbHpFzlrWnhGNJ+M0D3RaA=; b=fAOQU/FAwbMDHHvFWg4nQ8JQx3Uxx/eUusL121g/zSNYp2n9SanAwfQhc2MvEgIXo8 Az9MlKaIwNOk5LYQp2h42YUTN+JKql8tHtS5k/Gz68CHImzGsBKZXzTg/YPnfmJZLIUc r45jMuZZPka3ZewhG9QyH9jOQnet2nXwF96QYeGa/qJY2xnVfr9U9neoZj9buXkqqqJZ lVq6TNEuuxNxz197POw1NhR2efHo6KcfYTQ8dt4K/3esWhHtOSn014lHxM5zPvtqaOpn 5xpZiWET8wz19UbztumNU6l8Bk2Lco+6HMbvRnN127iRTItovZpACvgsBC/e/kgxla6O 9niw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=y3W+2dCV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020aa7c58d000000b0043b9617f589si11945242edq.209.2022.10.19.02.11.20; Wed, 19 Oct 2022 02:11: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=y3W+2dCV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232511AbiJSJIM (ORCPT + 99 others); Wed, 19 Oct 2022 05:08:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232315AbiJSJFb (ORCPT ); Wed, 19 Oct 2022 05:05:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53D7A19030; Wed, 19 Oct 2022 01:59:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9388E61753; Wed, 19 Oct 2022 08:49:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A45F8C433D6; Wed, 19 Oct 2022 08:49:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169392; bh=S+sbTEDYc7LdQZqL5XUaQKN6bnRZYGsQGEYT/s9QyC8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y3W+2dCVjBmqILKYoTouH3dflOpALXUooQ26DLOQH/qVirccZKeDZfvPvjPAPa8xs TeHw7RiyptiVa9pSb4+H5EQN5rbrP8a5CjTHBRqKvJMsRY9QUwtyey32Bv8+h4zJ9v ySeBoyfSBj8KavccJWuWas2THk0hd/p7xVgLMjDo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Marchevsky , Martin KaFai Lau , Joanne Koong , Kumar Kartikeya Dwivedi , Alexei Starovoitov , Sasha Levin Subject: [PATCH 6.0 232/862] bpf: Cleanup check_refcount_ok Date: Wed, 19 Oct 2022 10:25:19 +0200 Message-Id: <20221019083300.297463177@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106614725808836?= X-GMAIL-MSGID: =?utf-8?q?1747106614725808836?= From: Dave Marchevsky [ Upstream commit b2d8ef19c6e7ed71ba5092feb0710063a751834f ] Discussion around a recently-submitted patch provided historical context for check_refcount_ok [0]. Specifically, the function and its helpers - may_be_acquire_function and arg_type_may_be_refcounted - predate the OBJ_RELEASE type flag and the addition of many more helpers with acquire/release semantics. The purpose of check_refcount_ok is to ensure: 1) Helper doesn't have multiple uses of return reg's ref_obj_id 2) Helper with release semantics only has one arg needing to be released, since that's tracked using meta->ref_obj_id With current verifier, it's safe to remove check_refcount_ok and its helpers. Since addition of OBJ_RELEASE type flag, case 2) has been handled by the arg_type_is_release check in check_func_arg. To ensure case 1) won't result in verifier silently prioritizing one use of ref_obj_id, this patch adds a helper_multiple_ref_obj_use check which fails loudly if a helper passes > 1 test for use of ref_obj_id. [0]: lore.kernel.org/bpf/20220713234529.4154673-1-davemarchevsky@fb.com Signed-off-by: Dave Marchevsky Acked-by: Martin KaFai Lau Acked-by: Joanne Koong Acked-by: Kumar Kartikeya Dwivedi Link: https://lore.kernel.org/r/20220808171559.3251090-1-davemarchevsky@fb.com Signed-off-by: Alexei Starovoitov Stable-dep-of: 883743422ced ("bpf: Fix ref_obj_id for dynptr data slices in verifier") Signed-off-by: Sasha Levin --- kernel/bpf/verifier.c | 74 +++++++++++++++++-------------------------- 1 file changed, 29 insertions(+), 45 deletions(-) diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index 3eadb14e090b..1141a35216a7 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -467,25 +467,11 @@ static bool type_is_rdonly_mem(u32 type) return type & MEM_RDONLY; } -static bool arg_type_may_be_refcounted(enum bpf_arg_type type) -{ - return type == ARG_PTR_TO_SOCK_COMMON; -} - static bool type_may_be_null(u32 type) { return type & PTR_MAYBE_NULL; } -static bool may_be_acquire_function(enum bpf_func_id func_id) -{ - return func_id == BPF_FUNC_sk_lookup_tcp || - func_id == BPF_FUNC_sk_lookup_udp || - func_id == BPF_FUNC_skc_lookup_tcp || - func_id == BPF_FUNC_map_lookup_elem || - func_id == BPF_FUNC_ringbuf_reserve; -} - static bool is_acquire_function(enum bpf_func_id func_id, const struct bpf_map *map) { @@ -518,6 +504,26 @@ static bool is_ptr_cast_function(enum bpf_func_id func_id) func_id == BPF_FUNC_skc_to_tcp_request_sock; } +static bool is_dynptr_acquire_function(enum bpf_func_id func_id) +{ + return func_id == BPF_FUNC_dynptr_data; +} + +static bool helper_multiple_ref_obj_use(enum bpf_func_id func_id, + const struct bpf_map *map) +{ + int ref_obj_uses = 0; + + if (is_ptr_cast_function(func_id)) + ref_obj_uses++; + if (is_acquire_function(func_id, map)) + ref_obj_uses++; + if (is_dynptr_acquire_function(func_id)) + ref_obj_uses++; + + return ref_obj_uses > 1; +} + static bool is_cmpxchg_insn(const struct bpf_insn *insn) { return BPF_CLASS(insn->code) == BPF_STX && @@ -6456,33 +6462,6 @@ static bool check_arg_pair_ok(const struct bpf_func_proto *fn) return true; } -static bool check_refcount_ok(const struct bpf_func_proto *fn, int func_id) -{ - int count = 0; - - if (arg_type_may_be_refcounted(fn->arg1_type)) - count++; - if (arg_type_may_be_refcounted(fn->arg2_type)) - count++; - if (arg_type_may_be_refcounted(fn->arg3_type)) - count++; - if (arg_type_may_be_refcounted(fn->arg4_type)) - count++; - if (arg_type_may_be_refcounted(fn->arg5_type)) - count++; - - /* A reference acquiring function cannot acquire - * another refcounted ptr. - */ - if (may_be_acquire_function(func_id) && count) - return false; - - /* We only support one arg being unreferenced at the moment, - * which is sufficient for the helper functions we have right now. - */ - return count <= 1; -} - static bool check_btf_id_ok(const struct bpf_func_proto *fn) { int i; @@ -6506,8 +6485,7 @@ static int check_func_proto(const struct bpf_func_proto *fn, int func_id, { return check_raw_mode_ok(fn) && check_arg_pair_ok(fn) && - check_btf_id_ok(fn) && - check_refcount_ok(fn, func_id) ? 0 : -EINVAL; + check_btf_id_ok(fn) ? 0 : -EINVAL; } /* Packet data might have moved, any old PTR_TO_PACKET[_META,_END] @@ -7460,6 +7438,12 @@ static int check_helper_call(struct bpf_verifier_env *env, struct bpf_insn *insn if (type_may_be_null(regs[BPF_REG_0].type)) regs[BPF_REG_0].id = ++env->id_gen; + if (helper_multiple_ref_obj_use(func_id, meta.map_ptr)) { + verbose(env, "verifier internal error: func %s#%d sets ref_obj_id more than once\n", + func_id_name(func_id), func_id); + return -EFAULT; + } + if (is_ptr_cast_function(func_id)) { /* For release_reference() */ regs[BPF_REG_0].ref_obj_id = meta.ref_obj_id; @@ -7472,10 +7456,10 @@ static int check_helper_call(struct bpf_verifier_env *env, struct bpf_insn *insn regs[BPF_REG_0].id = id; /* For release_reference() */ regs[BPF_REG_0].ref_obj_id = id; - } else if (func_id == BPF_FUNC_dynptr_data) { + } else if (is_dynptr_acquire_function(func_id)) { int dynptr_id = 0, i; - /* Find the id of the dynptr we're acquiring a reference to */ + /* Find the id of the dynptr we're tracking the reference of */ for (i = 0; i < MAX_BPF_FUNC_REG_ARGS; i++) { if (arg_type_is_dynptr(fn->arg_type[i])) { if (dynptr_id) { From patchwork Wed Oct 19 08:25: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: 4821 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223412wrs; Wed, 19 Oct 2022 02:37:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5B7ANmvaG3WbRwOe2tZkydVCtO33fu3m+phlfjPXsxfzhpem3leSXX4GpeAdemNKB9dKBN X-Received: by 2002:a17:90a:4588:b0:205:d605:8bcc with SMTP id v8-20020a17090a458800b00205d6058bccmr8729782pjg.205.1666172247319; Wed, 19 Oct 2022 02:37:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172247; cv=none; d=google.com; s=arc-20160816; b=V5cm0KUMuodg3Pk7dieDESBXr7cIDh491xaAoxGHiAGoaxtqvmiGS8iOcKqnnLpdPU I8JdYygLx7mUuNGfX29xlVq8GsXXILerZ2H/L5rw0Q1o1bVWj0nJxLE/VjotG7spzUdG 4ED/nTM9LxA4MLYzCbOeilnEpKEy2Ty+4kK6s1lBwluuGW/WdbBRnqfDT1kpFEBnS3v/ 8GbXSzwAFU/MOUZb5QE5Rzg9MQqA1S33Jxlim6wrrEi2T49XVgcPRXl0XDhfhSarrZH7 Lu+dSjmqqbHBuKYhdMoEPA4pHO1HOSZupI2UnhffwvmVv8Fap7dGVkkfnvsOO/us2kMK fBNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=iB3+S81MdBCA1TeZbTNB6sF5PccPxxqBaZuaK//5QD8=; b=CXoYbaqehi5guLToQNx1o23lIC+dpZboA1S3PnwP6r/pTRvpxrKh0UM1cpjx92W6Gf jtrM4ogQOtiPk9loZiTV/feKdeeqIZ4CYI38Psmwh90o8o2urcpmPh5Sug61TGmBmkRb 2vSzD21kMPtG2kXG9jxhYe4Ehar28EI81UnhvspVbz0M+pfeW38M1Fllu9v0GMuinU0j iPQylNxUj+ykZDWMbEf72bUqq5vyoVsZTlTd88PweeFQac/m2bjcsI70i9MufdtUg+wn 1xOVXParIzzpnGirbw8Ghg6KclcKXpbcgQVIl17hT9EEV+16SsG2u66GTB4Sm2xdkLC3 ThcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jbPmEbmI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x185-20020a6386c2000000b0043961d07372si16356143pgd.585.2022.10.19.02.37.13; Wed, 19 Oct 2022 02:37: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=jbPmEbmI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233378AbiJSJVF (ORCPT + 99 others); Wed, 19 Oct 2022 05:21:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233635AbiJSJTt (ORCPT ); Wed, 19 Oct 2022 05:19:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6373D3DF10; Wed, 19 Oct 2022 02:09: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 DCFF3617E9; Wed, 19 Oct 2022 08:50:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E940FC433C1; Wed, 19 Oct 2022 08:50:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169413; bh=fCYDvPwsLwgEnvhcuZ0ycwDqjRtCNzRwDsH/BtX8qkk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jbPmEbmI6lasvaZgHCLMB8Qp+xwRaZoBQ8KIeADADdG+vnIiGiSwqXDFX+p41kGVe bWMWLGWaqmoVPde3wk3LB5BnQjeUtYIiJdCrD3KbjvH3o+My30DD3tu+Nxe/tjx7Wv fLiH+E63nj7fS2EV3Dlltcr316HRrYpVRc8DxaSM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joanne Koong , David Vernet , Alexei Starovoitov , Sasha Levin Subject: [PATCH 6.0 233/862] bpf: Fix ref_obj_id for dynptr data slices in verifier Date: Wed, 19 Oct 2022 10:25:20 +0200 Message-Id: <20221019083300.331989794@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108230625577542?= X-GMAIL-MSGID: =?utf-8?q?1747108230625577542?= From: Joanne Koong [ Upstream commit 883743422ced8c961ab05dc63ec81b75a4e56052 ] When a data slice is obtained from a dynptr (through the bpf_dynptr_data API), the ref obj id of the dynptr must be found and then associated with the data slice. The ref obj id of the dynptr must be found *before* the caller saved regs are reset. Without this fix, the ref obj id tracking is not correct for dynptrs that are at an offset from the frame pointer. Please also note that the data slice's ref obj id must be assigned after the ret types are parsed, since RET_PTR_TO_ALLOC_MEM-type return regs get zero-marked. Fixes: 34d4ef5775f7 ("bpf: Add dynptr data slices") Signed-off-by: Joanne Koong Acked-by: David Vernet Link: https://lore.kernel.org/r/20220809214055.4050604-1-joannelkoong@gmail.com Signed-off-by: Alexei Starovoitov Signed-off-by: Sasha Levin --- kernel/bpf/verifier.c | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index 1141a35216a7..c127585ad429 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -504,7 +504,7 @@ static bool is_ptr_cast_function(enum bpf_func_id func_id) func_id == BPF_FUNC_skc_to_tcp_request_sock; } -static bool is_dynptr_acquire_function(enum bpf_func_id func_id) +static bool is_dynptr_ref_function(enum bpf_func_id func_id) { return func_id == BPF_FUNC_dynptr_data; } @@ -518,7 +518,7 @@ static bool helper_multiple_ref_obj_use(enum bpf_func_id func_id, ref_obj_uses++; if (is_acquire_function(func_id, map)) ref_obj_uses++; - if (is_dynptr_acquire_function(func_id)) + if (is_dynptr_ref_function(func_id)) ref_obj_uses++; return ref_obj_uses > 1; @@ -7322,6 +7322,23 @@ static int check_helper_call(struct bpf_verifier_env *env, struct bpf_insn *insn } } break; + case BPF_FUNC_dynptr_data: + for (i = 0; i < MAX_BPF_FUNC_REG_ARGS; i++) { + if (arg_type_is_dynptr(fn->arg_type[i])) { + if (meta.ref_obj_id) { + verbose(env, "verifier internal error: meta.ref_obj_id already set\n"); + return -EFAULT; + } + /* Find the id of the dynptr we're tracking the reference of */ + meta.ref_obj_id = stack_slot_get_id(env, ®s[BPF_REG_1 + i]); + break; + } + } + if (i == MAX_BPF_FUNC_REG_ARGS) { + verbose(env, "verifier internal error: no dynptr in bpf_dynptr_data()\n"); + return -EFAULT; + } + break; } if (err) @@ -7444,7 +7461,7 @@ static int check_helper_call(struct bpf_verifier_env *env, struct bpf_insn *insn return -EFAULT; } - if (is_ptr_cast_function(func_id)) { + if (is_ptr_cast_function(func_id) || is_dynptr_ref_function(func_id)) { /* For release_reference() */ regs[BPF_REG_0].ref_obj_id = meta.ref_obj_id; } else if (is_acquire_function(func_id, meta.map_ptr)) { @@ -7456,21 +7473,6 @@ static int check_helper_call(struct bpf_verifier_env *env, struct bpf_insn *insn regs[BPF_REG_0].id = id; /* For release_reference() */ regs[BPF_REG_0].ref_obj_id = id; - } else if (is_dynptr_acquire_function(func_id)) { - int dynptr_id = 0, i; - - /* Find the id of the dynptr we're tracking the reference of */ - for (i = 0; i < MAX_BPF_FUNC_REG_ARGS; i++) { - if (arg_type_is_dynptr(fn->arg_type[i])) { - if (dynptr_id) { - verbose(env, "verifier internal error: multiple dynptr args in func\n"); - return -EFAULT; - } - dynptr_id = stack_slot_get_id(env, ®s[BPF_REG_1 + i]); - } - } - /* For release_reference() */ - regs[BPF_REG_0].ref_obj_id = dynptr_id; } do_refine_retval_range(regs, fn->ret_type, func_id, &meta); From patchwork Wed Oct 19 08:25:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5526 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp337339wrs; Wed, 19 Oct 2022 06:49:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6XbjxzYNiGKJIDLNJwvRj75awV8syukvb2r6yNPiQdoy4vUetOcGb1cG5/36lKWm0zTHvL X-Received: by 2002:a17:902:ce0d:b0:178:bd1e:e8da with SMTP id k13-20020a170902ce0d00b00178bd1ee8damr8509158plg.103.1666187342143; Wed, 19 Oct 2022 06:49:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666187342; cv=none; d=google.com; s=arc-20160816; b=Ux75is+EuBhB8Q1S0R2/0scs8qi/rohcdWCOeWTOSDO0cvVRJOCgCAwVqKd8GkSiSc ra8QCJDnLfMNfd/DgxVfAJah/SbJeafqDF3oayImSq3y9HbM9A1isEi+n+ehdyyjPsVC fwI6jsnM7Y6bT4L3uCCbaT5WTyKUTg5Q+Be612HvHQIP2JyxAS48FtfJvzJCQ6wICST0 +AcFckxf6baIF1IV0/3ZHvtBDxjneeSi7PaxNMUSjvRotu0ltLKX9Agt0mCu2zQ7Oeam lBPBuiA1gScnEBHJ0cmfzsImcZhZXN+tOOBUnjjxHcHGcBTESjNT9dvBQbnQc+WQbLhL Apmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qsY+PlN+INru3sODjU8AcjnXAP2aCl71b/S2vrXuI1w=; b=KCeJRNwAnU61+MUPlu6H48G61ciPbDWunTo2LG8DMxd4mN9mv6OV90sQ9cmNVlyzMV pjTp46XRe7TuqO72Aguck2egUHy0kiQ1D91BI5wRcjKAj6tjIZVIVFhzXNI9YfMOsjoc ojGmU24hSZ4hZurhU1ir3/6oTGB/q5myPMKyChBVavRTLM4K/PzA5IP1KJFr/dx8Jam8 gCENekGlMqbDVvy70B7L0ZFgWGptAFi+UG5o9xdmm021HcxLVM/+mb+2TRgets8oxgaO 3/ocXAAJF0u61Y+n/mAmMXL1AdLF0m5K+cBDbjL5WBUXKfOMpB41CVmOYzmWjM9nUvo0 XPfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RTv9l4x1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z11-20020a056a001d8b00b0054568a55597si16468243pfw.96.2022.10.19.06.48.49; Wed, 19 Oct 2022 06:49: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=RTv9l4x1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233485AbiJSNs1 (ORCPT + 99 others); Wed, 19 Oct 2022 09:48:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233204AbiJSNq6 (ORCPT ); Wed, 19 Oct 2022 09:46:58 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 553C450514; Wed, 19 Oct 2022 06:32: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 sin.source.kernel.org (Postfix) with ESMTPS id 84E4DCE2100; Wed, 19 Oct 2022 08:50:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83368C433D6; Wed, 19 Oct 2022 08:50:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169415; bh=oyGyxWJUXiy5R6FcVcV6T7cfpWGfVqEQbstwhBlVSqA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RTv9l4x126g/Q0yfxj8jONoZe4S3tFs2/qwehXhZx0RpaEs0f9PTxsgI56szSbaPo aosxKolWjsF9uI+xL7+4D5MxXzNmNw+QIUm1xUdOHiKQ1h5EL5BMbW1CKCqg0po750 eCsrHbIfvzCPLmOnmBhAqa5gdWuVhceKf2LApmCg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Machek , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Wolfram Sang , Sasha Levin Subject: [PATCH 6.0 234/862] leds: lm3601x: Dont use mutex after it was destroyed Date: Wed, 19 Oct 2022 10:25:21 +0200 Message-Id: <20221019083300.374919732@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747124058261538492?= X-GMAIL-MSGID: =?utf-8?q?1747124058261538492?= From: Uwe Kleine-König [ Upstream commit 32f7eed0c763a9b89f6b357ec54b48398fc7b99e ] The mutex might still be in use until the devm cleanup callback devm_led_classdev_flash_release() is called. This only happens some time after lm3601x_remove() completed. Fixes: e63a744871a3 ("leds: lm3601x: Convert class registration to device managed") Acked-by: Pavel Machek Signed-off-by: Uwe Kleine-König Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/leds/flash/leds-lm3601x.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/leds/flash/leds-lm3601x.c b/drivers/leds/flash/leds-lm3601x.c index d0e1d4814042..3d1272748201 100644 --- a/drivers/leds/flash/leds-lm3601x.c +++ b/drivers/leds/flash/leds-lm3601x.c @@ -444,8 +444,6 @@ static int lm3601x_remove(struct i2c_client *client) { struct lm3601x_led *led = i2c_get_clientdata(client); - mutex_destroy(&led->lock); - return regmap_update_bits(led->regmap, LM3601X_ENABLE_REG, LM3601X_ENABLE_MASK, LM3601X_MODE_STANDBY); From patchwork Wed Oct 19 08:25: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: 5555 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp349490wrs; Wed, 19 Oct 2022 07:12:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7vKQDHziu+PYkLS8+61JSnAJuKfwzJTFcEE9d+INd8XUx5ncLAwOtDTNprFFTh/QkVlOxN X-Received: by 2002:a17:902:b415:b0:178:2835:29e7 with SMTP id x21-20020a170902b41500b00178283529e7mr8652153plr.86.1666188723329; Wed, 19 Oct 2022 07:12:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666188723; cv=none; d=google.com; s=arc-20160816; b=aXLqZMoCyXbDQnvZxveUv7k0+NbfsPZee4qiJC1CxnReTzAbGUvdr00o/fv1VZM9S/ aX90zRTNKRCk8g7mPqlIMcyLYQmlSFUfrHddCTxsXgYlMzoIoHe0EpBBFZh946jPwxmj tO5wD31BMM6hikCB4vdFykNLorbfLM73lJGSmx7Hh/RlpitHarngSFF3OP2VtfzENP9a FVq/vD+UO1QqN2lctFqu+DTrBjidYBp1XT7Ao/rhTioupbtaVwRo81uwBQG1E83RRPA1 7p+EAf7SQgbWc2xJBBy8S8sOjv/mHjWXnyG0UvKGiSAQtTy6+5Qr5Qh1n5Tjfd8G9Mr0 aYMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xVaSAW6sWw+zbEBvbKS0owAphzDxOVcRN4lSYmKce7I=; b=hBPVTixnflUY0tJy2e/GY7ysVgm3oJN5trDEZl3AIPmRUj032YbqSt9KUQciJFh/mF 9KmP1akfeBBodnx5Wz7dpEYUavH9InnAk6dtTQxuIymR+KfA2Q64NruJwKXXfpwcqH6j IRQ9AERt4zlWTWE9VzwQ/ftjohLyZwGwVM8eNkm8K7fu8ia7WAniHqnGDWSsikiUNNwL HDPu++KVvna2uM48ag4NyEEQDuOK/yqSvJCH7BvJhjz0nsxACwlKUD/9HUucJ1+M6Ade TNnoauZGIRJngLDAtM/BUGTNOjMcIzP7sJbVVS9QNCKVbZws6sFRgyY3vgUcwwvoZNZx SLow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FbuyYs1s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z10-20020a170902d54a00b001769f4909b4si18569820plf.356.2022.10.19.07.11.30; Wed, 19 Oct 2022 07:12: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=FbuyYs1s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233807AbiJSN5B (ORCPT + 99 others); Wed, 19 Oct 2022 09:57:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233820AbiJSNyG (ORCPT ); Wed, 19 Oct 2022 09:54:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25A37193EFF; Wed, 19 Oct 2022 06:36:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3AEE8B82382; Wed, 19 Oct 2022 08:50:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B3E7C433D6; Wed, 19 Oct 2022 08:50:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169418; bh=c/sCNq7gkDPOwlsgPsrYGZOsvI3vWJnfm+lWwWvTG3M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FbuyYs1slHVBT/0ahPQ/mds082rR6BQTBLr2s6jswltPX6pNpJr4/3bbcoPR6H5qM U8qGrKPlOsLpeSFKgzdBbHDZ4IxTzqJhd6lQFnwji7k8ndGkcj/BcBLOA9svmWZDcq 1LZHz0+VwPxFQNrObh5K2ZEsOaKTHC50KR33DhgM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gerhard Engleder , "David S. Miller" , Sasha Levin Subject: [PATCH 6.0 235/862] tsnep: Fix TSNEP_INFO_TX_TIME register define Date: Wed, 19 Oct 2022 10:25:22 +0200 Message-Id: <20221019083300.424003623@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747125506902866877?= X-GMAIL-MSGID: =?utf-8?q?1747125506902866877?= From: Gerhard Engleder [ Upstream commit 7d8dd6b5cd1d67dd96c132f91d7ad29c49ed3c59 ] Fixed register define is not used, but register definition shall be kept in sync. Fixes: 403f69bbdbad ("tsnep: Add TSN endpoint Ethernet MAC driver") Signed-off-by: Gerhard Engleder Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/engleder/tsnep_hw.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/ethernet/engleder/tsnep_hw.h b/drivers/net/ethernet/engleder/tsnep_hw.h index 916ceac3ada2..e03aaafab559 100644 --- a/drivers/net/ethernet/engleder/tsnep_hw.h +++ b/drivers/net/ethernet/engleder/tsnep_hw.h @@ -92,8 +92,7 @@ /* tsnep register */ #define TSNEP_INFO 0x0100 -#define TSNEP_INFO_RX_ASSIGN 0x00010000 -#define TSNEP_INFO_TX_TIME 0x00020000 +#define TSNEP_INFO_TX_TIME 0x00010000 #define TSNEP_CONTROL 0x0108 #define TSNEP_CONTROL_TX_RESET 0x00000001 #define TSNEP_CONTROL_TX_ENABLE 0x00000002 From patchwork Wed Oct 19 08:25: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: 5565 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp350454wrs; Wed, 19 Oct 2022 07:13:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7mq5oR3O9TuWo/uvXgJLbNRiIzyyhKRZaYq6Dc51R7R0GCiGZiH6q52hArwc/K4SEPMnA4 X-Received: by 2002:a17:902:b48b:b0:182:42ce:5779 with SMTP id y11-20020a170902b48b00b0018242ce5779mr8902774plr.103.1666188822321; Wed, 19 Oct 2022 07:13:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666188822; cv=none; d=google.com; s=arc-20160816; b=ZShT+uN6/6jT6m3KgEalysrP4zQEjk8uPp0PL0ka2ZpidDvXSjsYUKtv97jAJqT8Nd nznAiQqV/1zd9QR9F9JzfwSeS8GQ3VFyfL+UT1C/hkrBvcnJToQ8ite2reRXTsBKcwY8 ho3FOgiOfMVRzdj023JnEnvSI5tB7w2EVsQRtGBM4hPCZYhDD7ftl+8fa7ELIcGKGzy3 PxBDxaLiZ36cITJHgmG/sCL/YqlGZ7QRTa+TSlE0vJImEWwuLiTH7KEUQBwM4nHMFcgc b1xqeGuiCT7qqMniiTn33DNsHYiheQSZ2F3VTuoCUeemzH+P4ZMGdHz/pta3ofIjWJke KOLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rhGRmicf1RgERPaYU3E1l2dx+nlPFQv+4byeRcNEc48=; b=TKP23ApiGh4oKb+DNxfm9L+qmJ8uaUOVpSwMbD2cKfGHy5TBqMgw4ezXV7pCkL7Ols G0wv2S1Oo8d/eXVETlAM/RKKAqIapsBuN+WdUIazdNHyIMefZve9hZCLgXMvxmYEfxUO g4TDY2buO4JWSgTecONjWCrheBc5fQqrjK1jUUhd5TzxG72ZEsGXUOePbrD1BB4JF8tz 6/E4hYtfGJCB+RW8Yrl9kt30JxnLXAWx5lz6Z4ekMLjAg1VRyhagN5sL8t0geNqm0LrU gklXGDlL9rMzBdrKdlaiOcLEsClZXhJo2HP+29AFLycpVMyxiCXY4Jw/g2OfdwjDO6oQ yW7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wt5WdrNq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t64-20020a635f43000000b0044fb0824e52si19392583pgb.171.2022.10.19.07.13.19; Wed, 19 Oct 2022 07:13: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=wt5WdrNq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232957AbiJSN5i (ORCPT + 99 others); Wed, 19 Oct 2022 09:57:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233924AbiJSNyY (ORCPT ); Wed, 19 Oct 2022 09:54:24 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 599F9193748; Wed, 19 Oct 2022 06:37: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 A860BB82383; Wed, 19 Oct 2022 08:50:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20439C433C1; Wed, 19 Oct 2022 08:50:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169421; bh=AWBYzKuSRGASn1poCM4D5EdymKeSS6RHn7wjl5AtJDo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wt5WdrNqjN+qaJGSOYvEfhZzMi65mnHFefvBzGjcTqFGveecyRVOpHbKWJ/0yz+fX SeH/u03I3bKWtaR7AyXEFy2PWQvtm3wJGWymfYlVhT7+zH8Uer2Q1sVL3yYuaX/XU/ PDon/pu1cMWXnq2SfEqYXvNJFBQC0v5Z5Lalw0ZY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Oleksandr Mazur , Maksym Glubokiy , "David S. Miller" , Sasha Levin Subject: [PATCH 6.0 236/862] net: prestera: cache port state for non-phylink ports too Date: Wed, 19 Oct 2022 10:25:23 +0200 Message-Id: <20221019083300.474641938@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747125610726299622?= X-GMAIL-MSGID: =?utf-8?q?1747125610726299622?= From: Maksym Glubokiy [ Upstream commit 704438dd4f030c1b3d28a2a9c8f182c32d9b6bc4 ] Port event data must stored to port-state cache regardless of whether the port uses phylink or not since this data is used by ethtool. Fixes: 52323ef75414 ("net: marvell: prestera: add phylink support") Signed-off-by: Oleksandr Mazur Signed-off-by: Maksym Glubokiy Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- .../ethernet/marvell/prestera/prestera_main.c | 36 +++++++++---------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/drivers/net/ethernet/marvell/prestera/prestera_main.c b/drivers/net/ethernet/marvell/prestera/prestera_main.c index a895862b4821..a0ad0bcbf89f 100644 --- a/drivers/net/ethernet/marvell/prestera/prestera_main.c +++ b/drivers/net/ethernet/marvell/prestera/prestera_main.c @@ -799,32 +799,30 @@ static void prestera_port_handle_event(struct prestera_switch *sw, caching_dw = &port->cached_hw_stats.caching_dw; - if (port->phy_link) { - memset(&smac, 0, sizeof(smac)); - smac.valid = true; - smac.oper = pevt->data.mac.oper; - if (smac.oper) { - smac.mode = pevt->data.mac.mode; - smac.speed = pevt->data.mac.speed; - smac.duplex = pevt->data.mac.duplex; - smac.fc = pevt->data.mac.fc; - smac.fec = pevt->data.mac.fec; - phylink_mac_change(port->phy_link, true); - } else { - phylink_mac_change(port->phy_link, false); - } - prestera_port_mac_state_cache_write(port, &smac); + memset(&smac, 0, sizeof(smac)); + smac.valid = true; + smac.oper = pevt->data.mac.oper; + if (smac.oper) { + smac.mode = pevt->data.mac.mode; + smac.speed = pevt->data.mac.speed; + smac.duplex = pevt->data.mac.duplex; + smac.fc = pevt->data.mac.fc; + smac.fec = pevt->data.mac.fec; } + prestera_port_mac_state_cache_write(port, &smac); if (port->state_mac.oper) { - if (!port->phy_link) + if (port->phy_link) + phylink_mac_change(port->phy_link, true); + else netif_carrier_on(port->dev); if (!delayed_work_pending(caching_dw)) queue_delayed_work(prestera_wq, caching_dw, 0); - } else if (netif_running(port->dev) && - netif_carrier_ok(port->dev)) { - if (!port->phy_link) + } else { + if (port->phy_link) + phylink_mac_change(port->phy_link, false); + else if (netif_running(port->dev) && netif_carrier_ok(port->dev)) netif_carrier_off(port->dev); if (delayed_work_pending(caching_dw)) From patchwork Wed Oct 19 08:25: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: 4970 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp226902wrs; Wed, 19 Oct 2022 02:47:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4ZHbGz7gJcXVeYXyjexOsfQG/3HF7Dfaa1/Wj660IcXhwB2uY8lyYTwVveNjmqsirip5dp X-Received: by 2002:a17:907:160c:b0:78d:b6f5:9f56 with SMTP id hb12-20020a170907160c00b0078db6f59f56mr4647912ejc.325.1666172834945; Wed, 19 Oct 2022 02:47:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172834; cv=none; d=google.com; s=arc-20160816; b=cvIib6cBfuYlqDkXiQ9xk86flJ8XFmUhZbTE0EjoOPhGhO9nZkhtc7TNZ7a8nNcaHd Irg4UOrsWCNfVyuBNdBI2RJd4UQ4cv7emGywLAFUNAdYvNtwpab0dm0KsQ6gSIPezNsY fJJfLW0dJZ5vUu1yzS20H4koGtSrkvJLQiG6GgHKwju2YWv+NF2YBFTcmwtNofgwGXXl TgNy7mSYTPrIo7/s1QvVxigjG8oyBcXfCJ3CCaAWDauMtb1omUljjD8Y90MQ1M1dnKsV Z/v5q3i9GZZLAiXlvN5BwUrc5wT6QQwbec1gTcTWW/oM7oYBfFy2v02soHIdlXaktXSB Sqsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZXtcWUEuzA4q/BgYeJfNvZZMkNiJoEqCmtJ5+lEy0H0=; b=QkzUMWrs5TthmzkXWDjwP+l8mIGdN+HFRumyFBRewFGh7E6MbC2Q/BOv3r0topV8as r7RwZ5SVb8E84v5vY9yNeUi1t89nJzI7d6tKr1tdZDLRJSfRjWWH8uvy3ESRWab3E9Eb iWmINELFS+aW5SE9h4fY5fKsW3x+Zs6JGx7LZQNDPQC6PHZ/WHNiKNnNZ9vNqZhs7m9k YBCBpzrumxhjnGO1YZsrqdaDI5dJ/EW+KU+xGg4DR+Uy+VQd7vjGf7n7Inlwe9HzHZfi SjAzBVTY8OAtSVXWE+8dw6AVCbFF/EVmzIx75dRDzkGrVGcFz004M7X+ZJ5oTZ4MhGqj iCXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XRCQisEN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ht15-20020a170907608f00b00781599eb7dbsi14486101ejc.573.2022.10.19.02.46.48; Wed, 19 Oct 2022 02:47: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=XRCQisEN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234536AbiJSJo1 (ORCPT + 99 others); Wed, 19 Oct 2022 05:44:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234759AbiJSJlT (ORCPT ); Wed, 19 Oct 2022 05:41:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 894FAF41BE; Wed, 19 Oct 2022 02:17: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 9BCFF61841; Wed, 19 Oct 2022 08:50:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE503C433C1; Wed, 19 Oct 2022 08:50:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169424; bh=EGcsfzoNPFKFZSw/DSUmI+rLPToiQsF/UsMGg+e9mb8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XRCQisENAx/Ipp+M60IQyMPgO5wVgIQsFlHsG2I63H7ABYPVjNEuvanhOR05IN983 0bTTgNSnraUTmFQV7YrdTJIA96BK93sMSrz+NFau7AfuBVKaID3/rLeXXTrwnRjSnk UOVN0vZk2nEhyidO7BaCDTVJJZjIWIazAR4LgnXc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kumar Kartikeya Dwivedi , Alexei Starovoitov , Sasha Levin Subject: [PATCH 6.0 237/862] bpf: Fix reference state management for synchronous callbacks Date: Wed, 19 Oct 2022 10:25:24 +0200 Message-Id: <20221019083300.514252157@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108846939141574?= X-GMAIL-MSGID: =?utf-8?q?1747108846939141574?= From: Kumar Kartikeya Dwivedi [ Upstream commit 9d9d00ac29d0ef7ce426964de46fa6b380357d0a ] Currently, verifier verifies callback functions (sync and async) as if they will be executed once, (i.e. it explores execution state as if the function was being called once). The next insn to explore is set to start of subprog and the exit from nested frame is handled using curframe > 0 and prepare_func_exit. In case of async callback it uses a customized variant of push_stack simulating a kind of branch to set up custom state and execution context for the async callback. While this approach is simple and works when callback really will be executed only once, it is unsafe for all of our current helpers which are for_each style, i.e. they execute the callback multiple times. A callback releasing acquired references of the caller may do so multiple times, but currently verifier sees it as one call inside the frame, which then returns to caller. Hence, it thinks it released some reference that the cb e.g. got access through callback_ctx (register filled inside cb from spilled typed register on stack). Similarly, it may see that an acquire call is unpaired inside the callback, so the caller will copy the reference state of callback and then will have to release the register with new ref_obj_ids. But again, the callback may execute multiple times, but the verifier will only account for acquired references for a single symbolic execution of the callback, which will cause leaks. Note that for async callback case, things are different. While currently we have bpf_timer_set_callback which only executes it once, even for multiple executions it would be safe, as reference state is NULL and check_reference_leak would force program to release state before BPF_EXIT. The state is also unaffected by analysis for the caller frame. Hence async callback is safe. Since we want the reference state to be accessible, e.g. for pointers loaded from stack through callback_ctx's PTR_TO_STACK, we still have to copy caller's reference_state to callback's bpf_func_state, but we enforce that whatever references it adds to that reference_state has been released before it hits BPF_EXIT. This requires introducing a new callback_ref member in the reference state to distinguish between caller vs callee references. Hence, check_reference_leak now errors out if it sees we are in callback_fn and we have not released callback_ref refs. Since there can be multiple nested callbacks, like frame 0 -> cb1 -> cb2 etc. we need to also distinguish between whether this particular ref belongs to this callback frame or parent, and only error for our own, so we store state->frameno (which is always non-zero for callbacks). In short, callbacks can read parent reference_state, but cannot mutate it, to be able to use pointers acquired by the caller. They must only undo their changes (by releasing their own acquired_refs before BPF_EXIT) on top of caller reference_state before returning (at which point the caller and callback state will match anyway, so no need to copy it back to caller). Fixes: 69c087ba6225 ("bpf: Add bpf_for_each_map_elem() helper") Signed-off-by: Kumar Kartikeya Dwivedi Link: https://lore.kernel.org/r/20220823013125.24938-1-memxor@gmail.com Signed-off-by: Alexei Starovoitov Signed-off-by: Sasha Levin --- include/linux/bpf_verifier.h | 11 ++++++++++ kernel/bpf/verifier.c | 42 ++++++++++++++++++++++++++++-------- 2 files changed, 44 insertions(+), 9 deletions(-) diff --git a/include/linux/bpf_verifier.h b/include/linux/bpf_verifier.h index 2e3bad8640dc..1fdddbf3546b 100644 --- a/include/linux/bpf_verifier.h +++ b/include/linux/bpf_verifier.h @@ -212,6 +212,17 @@ struct bpf_reference_state { * is used purely to inform the user of a reference leak. */ int insn_idx; + /* There can be a case like: + * main (frame 0) + * cb (frame 1) + * func (frame 3) + * cb (frame 4) + * Hence for frame 4, if callback_ref just stored boolean, it would be + * impossible to distinguish nested callback refs. Hence store the + * frameno and compare that to callback_ref in check_reference_leak when + * exiting a callback function. + */ + int callback_ref; }; /* state of the program: diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index c127585ad429..8b5ea7f6b536 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -1092,6 +1092,7 @@ static int acquire_reference_state(struct bpf_verifier_env *env, int insn_idx) id = ++env->id_gen; state->refs[new_ofs].id = id; state->refs[new_ofs].insn_idx = insn_idx; + state->refs[new_ofs].callback_ref = state->in_callback_fn ? state->frameno : 0; return id; } @@ -1104,6 +1105,9 @@ static int release_reference_state(struct bpf_func_state *state, int ptr_id) last_idx = state->acquired_refs - 1; for (i = 0; i < state->acquired_refs; i++) { if (state->refs[i].id == ptr_id) { + /* Cannot release caller references in callbacks */ + if (state->in_callback_fn && state->refs[i].callback_ref != state->frameno) + return -EINVAL; if (last_idx && i != last_idx) memcpy(&state->refs[i], &state->refs[last_idx], sizeof(*state->refs)); @@ -6919,10 +6923,17 @@ static int prepare_func_exit(struct bpf_verifier_env *env, int *insn_idx) caller->regs[BPF_REG_0] = *r0; } - /* Transfer references to the caller */ - err = copy_reference_state(caller, callee); - if (err) - return err; + /* callback_fn frame should have released its own additions to parent's + * reference state at this point, or check_reference_leak would + * complain, hence it must be the same as the caller. There is no need + * to copy it back. + */ + if (!callee->in_callback_fn) { + /* Transfer references to the caller */ + err = copy_reference_state(caller, callee); + if (err) + return err; + } *insn_idx = callee->callsite + 1; if (env->log.level & BPF_LOG_LEVEL) { @@ -7044,13 +7055,20 @@ record_func_key(struct bpf_verifier_env *env, struct bpf_call_arg_meta *meta, static int check_reference_leak(struct bpf_verifier_env *env) { struct bpf_func_state *state = cur_func(env); + bool refs_lingering = false; int i; + if (state->frameno && !state->in_callback_fn) + return 0; + for (i = 0; i < state->acquired_refs; i++) { + if (state->in_callback_fn && state->refs[i].callback_ref != state->frameno) + continue; verbose(env, "Unreleased reference id=%d alloc_insn=%d\n", state->refs[i].id, state->refs[i].insn_idx); + refs_lingering = true; } - return state->acquired_refs ? -EINVAL : 0; + return refs_lingering ? -EINVAL : 0; } static int check_bpf_snprintf_call(struct bpf_verifier_env *env, @@ -12319,6 +12337,16 @@ static int do_check(struct bpf_verifier_env *env) return -EINVAL; } + /* We must do check_reference_leak here before + * prepare_func_exit to handle the case when + * state->curframe > 0, it may be a callback + * function, for which reference_state must + * match caller reference state when it exits. + */ + err = check_reference_leak(env); + if (err) + return err; + if (state->curframe) { /* exit from nested function */ err = prepare_func_exit(env, &env->insn_idx); @@ -12328,10 +12356,6 @@ static int do_check(struct bpf_verifier_env *env) continue; } - err = check_reference_leak(env); - if (err) - return err; - err = check_return_code(env); if (err) return err; From patchwork Wed Oct 19 08:25: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: 5562 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp350257wrs; Wed, 19 Oct 2022 07:13:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5HL9rrWIMfbqpWnEk4eoiSEq353D6NrCrl5ummpbrJDimPr82OBfhaAuxRh+eafFfz3Acu X-Received: by 2002:a63:2a02:0:b0:42b:2711:d534 with SMTP id q2-20020a632a02000000b0042b2711d534mr7325469pgq.176.1666188800697; Wed, 19 Oct 2022 07:13:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666188800; cv=none; d=google.com; s=arc-20160816; b=FjPuIcIz02tVZTnoOjZda2Utx12VBhgkHH0aDF/7ZwotUG0QsF3fmSHpFZy+nqAFjZ 6sQIV1Kf9YvvBfVu0xkz/xNQTuQMCKhUs21nRTVg7NRqtgc8sqsi4u/Rikt7h52G16pG mhmTBmzwFujph4NvgCAFqohUfyOsqwcjFPWHqkEq0SKCWeNa6NWKcp6dUkPOgu6zSokK 7oTNRdyFPuu30S1DuQYF/RWh+g6Pc8e09HFvqVlDV40KwkAVTo/XouAKfrETMNi6rEsm ULLFzPJFEUNbLMlig23nZvHzM3QFhz/EBdh4pb4e88UyLBgLN0P6sRJj6i+aX3c+g8u+ X46g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gJ64OTZQe5zBDubnGL4U1/HAoT/pWCDP/EG4qB2TUaQ=; b=WVKqfeQkDg1qnOYNO9Q9Kvr/uC/3AY5IcJxydERaxa72NjaB67ztXoDx1XsuLYgSZn 8ORFOBcZHolj4Uu6AzswsqBZJE4NqFMahByKAZBVkw/pgZIU/jbbfQoj2egtJck641AE y3ZzNlv59D6a7Byhiw1qUI8WZDytSVVRQSaS2mokNM1CquWai9KYg9k9JNVHdvuuFBl6 RiBinzi62j1n1PRdmIh88R9h2s4UJpwounHjabz5SrVdYefQE1H8hiMhbUZ6RraxPadw pB8IoMiQiJ9fIQsyZwLdSBF7ixUXkbcRbNrO4O1g55YZh3XZbLw78fOVESnmeb8wmxYq 7ryQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yf2zINUJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y124-20020a636482000000b0042bb607f75esi17808018pgb.284.2022.10.19.07.12.47; Wed, 19 Oct 2022 07:13: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=yf2zINUJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233702AbiJSN6n (ORCPT + 99 others); Wed, 19 Oct 2022 09:58:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234069AbiJSNym (ORCPT ); Wed, 19 Oct 2022 09:54:42 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 881A3132DC1; Wed, 19 Oct 2022 06:37: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 4D933B82387; Wed, 19 Oct 2022 08:50:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F438C433C1; Wed, 19 Oct 2022 08:50:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169427; bh=bWaCn8E8sqheU4Kuv/pIWO/8UF7dv16NNlulGm9SNbI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yf2zINUJzTDhEDVIK+ONIX/hP2n9fzWZk1ImM0FLMT3X5SUuYNl+GqypFuczS8TvL R7qgFIxp78aHNHCXhmhUO8TLKUWQ1hSUc4xghzrv6llZYk8OEU40/mnc2AGoVS/g2G ina6uMIvNNdTNs7YSBFHn1WAFOXdT7zTA3thIIXk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shaul Triebitz , Johannes Berg , Sasha Levin Subject: [PATCH 6.0 238/862] wifi: mac80211: properly set old_links when removing a link Date: Wed, 19 Oct 2022 10:25:25 +0200 Message-Id: <20221019083300.554557388@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747125588142903875?= X-GMAIL-MSGID: =?utf-8?q?1747125588142903875?= From: Shaul Triebitz [ Upstream commit a8f62399daa6917e7f9efeb79bce4dd2cd494a1e ] In ieee80211_sta_remove_link, valid_links is set to the new_links before calling drv_change_sta_links, but is used for the old_links. Fixes: cb71f1d136a6 ("wifi: mac80211: add sta link addition/removal") Signed-off-by: Shaul Triebitz Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- net/mac80211/sta_info.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index 58998d821778..9d7b238a6737 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c @@ -2799,6 +2799,7 @@ int ieee80211_sta_activate_link(struct sta_info *sta, unsigned int link_id) void ieee80211_sta_remove_link(struct sta_info *sta, unsigned int link_id) { struct ieee80211_sub_if_data *sdata = sta->sdata; + u16 old_links = sta->sta.valid_links; lockdep_assert_held(&sdata->local->sta_mtx); @@ -2806,8 +2807,7 @@ void ieee80211_sta_remove_link(struct sta_info *sta, unsigned int link_id) if (test_sta_flag(sta, WLAN_STA_INSERTED)) drv_change_sta_links(sdata->local, sdata, &sta->sta, - sta->sta.valid_links, - sta->sta.valid_links & ~BIT(link_id)); + old_links, sta->sta.valid_links); sta_remove_link(sta, link_id, true); } From patchwork Wed Oct 19 08:25: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: 4788 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp215988wrs; Wed, 19 Oct 2022 02:17:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7U2bbPk4C0g7vLIJhlHN7N2gxLi0wjtjnzO9Oz2yUuNQ58Sq621CEaLdmhGuFP0poN0KH2 X-Received: by 2002:a17:906:ee8e:b0:730:3646:d178 with SMTP id wt14-20020a170906ee8e00b007303646d178mr5966392ejb.426.1666171034517; Wed, 19 Oct 2022 02:17:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666171034; cv=none; d=google.com; s=arc-20160816; b=npoAT3xlQ4zGezIEU8p8p/ND/F6zokCzVqCZHsOXVa/qAVOuqcIEa4x5BpWRSQZmnd s0Mh0Rwvab7QAhOnz0vSDtLY6l4UJaESrB7F65dESb3JjKH9tnIFjFr19hE+exPaq951 he93aky71Jw2OTqFD+nIH9fMAt911GnrBQAIpa27pQlyLdo2k0e3KwuyKS/kPG1EZ8rU FscvaUGbWwgYegciC1Kn/lqyM1N8phUIzCFLi9pDGm9P4dwcwnEdTA3/fKof+bC7aZ9u 83PvRGWDLZXoLyy7ZWrvkB4wObB2uNvSbnLHmKKX+CTnmr52LbbxC8f7Cba70l5Y85ZO on/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=axS1f6qLuUkKB8LOHa8gs2uBpoNPQVUglr6K1aeht3k=; b=tnGOww7H2wSq7L+CB3c5S6MzThq9KCQl4wRiVPHwGMffIEFSWeVpk3TIzv4a9tPAVH mf8vOM9JtJB2SyYpGnewn4LrUCqJJU5O9zKg/jdkvtqI+hTN+QON3gAP2oiwhr4dKVCg uh/euYXfQUIQviD/kE9ZhEnAJKDTnRkcdvo9NM+z+L08cgpnwkwbeiijteaypI+wUDxv Mfbt1ZDWUrZ0d7Bt1+bfgapmT8tilWvEOnohCdfukOQLUX9KGejErkJ7uL4Z3s+UjpRh 1OghrpzMIiQdFUCROkieReRXQW+ITPKVyarIK/pXH6lTXN5AJ+KRwSE6pA47NB3h8Iey D4vA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=an1HmjQE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hv17-20020a17090760d100b007807e3f6766si7721487ejc.581.2022.10.19.02.16.49; Wed, 19 Oct 2022 02:17:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=an1HmjQE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233111AbiJSJQK (ORCPT + 99 others); Wed, 19 Oct 2022 05:16:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233015AbiJSJNO (ORCPT ); Wed, 19 Oct 2022 05:13:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A038F92F7A; Wed, 19 Oct 2022 02:03: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 3BA1261777; Wed, 19 Oct 2022 08:48:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50037C433C1; Wed, 19 Oct 2022 08:48:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169336; bh=PBClYfgcUgCNfOMwp2cjYimZKZ/95lBXgpCYtvQU0AM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=an1HmjQEVSr5wpuHMsBes9iBINMD3bnUIe4pvhYJs4bfaI4wr/q0iI86lBdXHc3Ua HvDsDS0etkxVeNUj6ltouHkplaSoiyam9sbGm8lmBPGBdz4ZtUrNJNT1xmOa8Aitai Q1apVaSEdlZshw9Dt/xw2Ir/bvM1laFnw4NNFppc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shaul Triebitz , Johannes Berg , Sasha Levin Subject: [PATCH 6.0 239/862] wifi: cfg80211: get correct AP link chandef Date: Wed, 19 Oct 2022 10:25:26 +0200 Message-Id: <20221019083300.593549356@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106958553249923?= X-GMAIL-MSGID: =?utf-8?q?1747106958553249923?= From: Shaul Triebitz [ Upstream commit bc1857619cc7612117d2ee1ed05b5bfeb638614b ] When checking for channel regulatory validity, use the AP link chandef (and not mesh's chandef). Fixes: 7b0a0e3c3a88 ("wifi: cfg80211: do some rework towards MLO link APIs") Signed-off-by: Shaul Triebitz Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- net/wireless/reg.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/wireless/reg.c b/net/wireless/reg.c index c7383ede794f..d5c7a5aa6853 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c @@ -2389,6 +2389,10 @@ static bool reg_wdev_chan_valid(struct wiphy *wiphy, struct wireless_dev *wdev) switch (iftype) { case NL80211_IFTYPE_AP: case NL80211_IFTYPE_P2P_GO: + if (!wdev->links[link].ap.beacon_interval) + continue; + chandef = wdev->links[link].ap.chandef; + break; case NL80211_IFTYPE_MESH_POINT: if (!wdev->u.mesh.beacon_interval) continue; From patchwork Wed Oct 19 08:25: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: 5544 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp348705wrs; Wed, 19 Oct 2022 07:10:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6bDFKS+LuJ+2NNtwprxhd5Qya5gESgcO3FPD8YW6GsapEAOK3e1gONXG2bHVjKh/KYzOPH X-Received: by 2002:a17:902:d510:b0:185:475a:4057 with SMTP id b16-20020a170902d51000b00185475a4057mr8833471plg.54.1666188636389; Wed, 19 Oct 2022 07:10:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666188636; cv=none; d=google.com; s=arc-20160816; b=ynE2f3x2DeBAuPT5+E1vDC9TteMbUgDx2fE95/ThPhOdVcl7SVct58LUBow+BahKeb VI575RAaXixTnpCsBe477uUEcFyKJ5Be1RW3h3ag4ajessbeEkLDnbk43cZ/l1zF9+Ih PMiKtIKDFxvUyt8QgCGH8anrMzF7/NUG4kCjiTfKUtJ5807ZHbQZwq8rottN/Rlfotm/ 7UFOEOV6Z421rLLe+u21m5KxSw2h79eDhEnKWutQB7/I2MleAQBUaig7u2zHI2ZDf2S6 cnpQ6mB0CjpGgdREbKkysNaoK6tVr6Wwo8HBuApBRrRvm9QhPLpr+B9TNqJ+rl1cYNYY sR7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pY/eLsfK5Z82gErNorIFxThhfE7VFhuOC8niwt4aXrg=; b=ryQpKL9//cjbEa/f5Ze3UV7NZwG6NLVuGKpmPW/gYCDa0eUInjjAhN+sGtBkKlpBBr olCNIEyEVQeg+ZZUiHp7OdYb7nTgdq7h+HfvRyPLIqXTbeK/I/GRTZKuFSpiCCekZA2b LuS3Y4w/rKX0jNJPc9NOye4HPmXtzYVtZTWwL3Vz6kBSC9sEjSgH0HfCX+PQ9CKrwNX9 ELpxaKc+1n/bLtkd70xdKYyeK/sDD5zUDuuQKg30tHupbxqqNeCzhUFmV3j3d5JWiUea tjSlB0ZJHIH5YfYuAZh5Ke+yMjIXpPak8DZLZIs+SocXF2rPvph2E0zW0XiN717TetQY 1gUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tyFqr05e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n6-20020a654506000000b0044b817adee1si18204187pgq.78.2022.10.19.07.10.07; Wed, 19 Oct 2022 07:10: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=tyFqr05e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233785AbiJSNxr (ORCPT + 99 others); Wed, 19 Oct 2022 09:53:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230172AbiJSNwy (ORCPT ); Wed, 19 Oct 2022 09:52:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D836A1960AA; Wed, 19 Oct 2022 06:36: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 8B40EB82316; Wed, 19 Oct 2022 08:49:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3B70C433D6; Wed, 19 Oct 2022 08:48:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169339; bh=qcIfLVy8NdhyzguIZ1nO/PoYtpJQB81Qs76YDchO8XY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tyFqr05e+eoopmBTag7Xf2atGLn7ehS3lQ2foOSMiGksVYTjH1l1G/BEOgQq3JRgf BqgHVcooGXXpmakWyOBOkJyDDcz1GQIuIdEKM/eZXO+B2LtvgBCDwII8mz0KB9oIuh 7pJtX+/n7U1JujIl9WR+0TfvT6s3rVDZ+/sGdhlc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johannes Berg , Sasha Levin Subject: [PATCH 6.0 240/862] wifi: mac80211: fix use-after-free Date: Wed, 19 Oct 2022 10:25:27 +0200 Message-Id: <20221019083300.643211248@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747125415408716213?= X-GMAIL-MSGID: =?utf-8?q?1747125415408716213?= From: Johannes Berg [ Upstream commit 40fb87129049ec5876dabf4a4d4aed6642b31f1a ] We've already freed the assoc_data at this point, so need to use another copy of the AP (MLD) address instead. Fixes: 81151ce462e5 ("wifi: mac80211: support MLO authentication/association with one link") Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- net/mac80211/mlme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index fc764984d687..1e9cb4be6ed3 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -5122,7 +5122,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, resp.req_ies = ifmgd->assoc_req_ies; resp.req_ies_len = ifmgd->assoc_req_ies_len; if (sdata->vif.valid_links) - resp.ap_mld_addr = assoc_data->ap_addr; + resp.ap_mld_addr = sdata->vif.cfg.ap_addr; cfg80211_rx_assoc_resp(sdata->dev, &resp); notify_driver: drv_mgd_complete_tx(sdata->local, sdata, &info); From patchwork Wed Oct 19 08:25: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: 5569 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp350538wrs; Wed, 19 Oct 2022 07:13:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5jGNX1W720+NdwyC3bmnUaAgIhz44GAbXIY2+Y2QlRZf9Je5J9pKQdiNL+3e0SZSMqe7wp X-Received: by 2002:a17:902:d192:b0:182:b25c:e526 with SMTP id m18-20020a170902d19200b00182b25ce526mr8662180plb.13.1666188834499; Wed, 19 Oct 2022 07:13:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666188834; cv=none; d=google.com; s=arc-20160816; b=AJA8iKcW94B7hr2ygK6aX1qocteCC8DgvASrpVpHlnvAa93pamSw9B8GXHQvdC+EnC 19vQngMryyrabXHZ4cYRsVHsCqKknM0OBf5tl0Jt9nRQnAVPjO7Pad1jjb4o6XXUkW5Q EUSfYt+UlrEDV/uK6BaA1pQBdmaRZbBk0tiVIP2BUMNn4HDwOrJczBRP68VLcUuZcdYT zBGjb3/g7kLTE1gH3Z2VqPIu94E4GeAlns1wRgj9i5EydNeCymsWy6nmvsObj4yX4Za6 +VQa980rBsTQy+vamiGHw/C0vWsQZFVzlsSFMjIRroofmFGjAa2T+3t6ORG+LOa2wuhs Ly/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=jaBs9qLtQgom5RL2DUHyml1oRMgCiWswtTn/Ut5ydGY=; b=ToIzk/sSF2+pCt8tQwsPt5J8Jq9wZrYT5/M9loa1JWNmSl2FVP3GeSBqCRcu04vwdI cB6oN7AYrno1DpMxYwtNX/+7ZmxhPFFlitlTU+RHKUxEo9962WIqQd6PBjuVZJiWQwOy ZSU8aM23QHbqCXG14n2Hod46Nlk2EJ6ugTu3HqjUz2NdONYdY2JIvA+XuHIF7ZbJWNPD mvd8EbJ6bKEK3HJHHj82pjui3O/aq0J/eMYxkUA8/b68s5DcRjCAquRrYC+Gs07N7/hD plZdQUYPq6eztAEYSJaHFOVvuMwfQ6MAqENsPUnvkapcbkNcaDPUJB+sawOFlrAo2PNS Ln1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hH+EehRr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k6-20020a636f06000000b0045efd23abd4si17327845pgc.874.2022.10.19.07.13.32; Wed, 19 Oct 2022 07:13:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hH+EehRr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233921AbiJSN7C (ORCPT + 99 others); Wed, 19 Oct 2022 09:59:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234275AbiJSNzc (ORCPT ); Wed, 19 Oct 2022 09:55:32 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EFFC170DF2; Wed, 19 Oct 2022 06:38: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 0F083B822E8; Wed, 19 Oct 2022 08:49:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7802CC433D6; Wed, 19 Oct 2022 08:49:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169341; bh=Y4pMd06s9Gr1I5Zfl0sgVaB4qlD7jgp/s7Joa+5BCcw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hH+EehRrRSY/OBD9e1i+Jjf6oshllD8tBynvU57Agn/hyd4CMkYf07Fxr8htodOfg tAXfYEfDexeDArnTkPjv59lChOtUPPMQhCnnBlR7fBAh29HS1Tvbgv8dlDapUR1p3j lSpAF20i9jIcQ9UVrF0IvFFx2sFrp9CIrZfewrMA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mordechay Goodstein , Johannes Berg , Sasha Levin Subject: [PATCH 6.0 241/862] wifi: mac80211: mlme: dont add empty EML capabilities Date: Wed, 19 Oct 2022 10:25:28 +0200 Message-Id: <20221019083300.673827588@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747125623437761209?= X-GMAIL-MSGID: =?utf-8?q?1747125623437761209?= From: Mordechay Goodstein [ Upstream commit 1cb3cf372abe4a0d16620d2b1201de0e291a6c58 ] Draft P802.11be_D2.1, section 35.3.17 states that the EML Capabilities Field shouldn't be included in case the device doesn't have support for EMLSR or EMLMR. Fixes: 81151ce462e5 ("wifi: mac80211: support MLO authentication/association with one link") Signed-off-by: Mordechay Goodstein Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- net/mac80211/mlme.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 1e9cb4be6ed3..76ae6f03d77e 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -1220,14 +1220,21 @@ static void ieee80211_assoc_add_ml_elem(struct ieee80211_sub_if_data *sdata, ml_elem = skb_put(skb, sizeof(*ml_elem)); ml_elem->control = cpu_to_le16(IEEE80211_ML_CONTROL_TYPE_BASIC | - IEEE80211_MLC_BASIC_PRES_EML_CAPA | IEEE80211_MLC_BASIC_PRES_MLD_CAPA_OP); common = skb_put(skb, sizeof(*common)); common->len = sizeof(*common) + - 2 + /* EML capabilities */ 2; /* MLD capa/ops */ memcpy(common->mld_mac_addr, sdata->vif.addr, ETH_ALEN); - skb_put_data(skb, &eml_capa, sizeof(eml_capa)); + + /* add EML_CAPA only if needed, see Draft P802.11be_D2.1, 35.3.17 */ + if (eml_capa & + cpu_to_le16((IEEE80211_EML_CAP_EMLSR_SUPP | + IEEE80211_EML_CAP_EMLMR_SUPPORT))) { + common->len += 2; /* EML capabilities */ + ml_elem->control |= + cpu_to_le16(IEEE80211_MLC_BASIC_PRES_EML_CAPA); + skb_put_data(skb, &eml_capa, sizeof(eml_capa)); + } /* need indication from userspace to support this */ mld_capa_ops &= ~cpu_to_le16(IEEE80211_MLD_CAP_OP_TID_TO_LINK_MAP_NEG_SUPP); skb_put_data(skb, &mld_capa_ops, sizeof(mld_capa_ops)); From patchwork Wed Oct 19 08:25: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: 4652 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212487wrs; Wed, 19 Oct 2022 02:07:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Jf9AAtF7PLvShlmrx87XsIGhk1KlAKhNXpzBkHc4Jdv07jK7EgrMW1nL01R96ZA6oaMDN X-Received: by 2002:a05:6a00:994:b0:562:f5fe:9024 with SMTP id u20-20020a056a00099400b00562f5fe9024mr7721165pfg.12.1666170458045; Wed, 19 Oct 2022 02:07:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170458; cv=none; d=google.com; s=arc-20160816; b=jfF7XHp5AUSRJg9u2RVJdcfgb8mDviQAIdhFFUZbrKTZcAZiLI6ImqsYu8z5LiRcKf R89XH7Y0hi6H1FCl6VbBu2MTcRrZ0Ahm8FsCM4nviwDPR2sr6DsYi37RlIva9+KIsncm D4nPio0TF8MIPmbydFlsw1HMIK1S7uXurSwMFf+O2KK6Gcuxmb1A28jSHUAUrClSkUW/ xGVQlnCDEz53txFoc30rsGi7XZ3heaQ7dJX3lDjxNnSuDiKj2u8UjSYwEheXJplLjOow I0p83a+7yztGN3M9aaDkzxHcHs/6JowOaJ9MfYar+ig+TetDqaQ98srjeRB87L080f93 HtiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=g5lWdp1FDqfkRM7E5WwfG0gxADPXJfElQwwaWqYwRgw=; b=0nFtEv5Rb6H/X/zf6VPjQj/LkHUT8yWjfJOZhzIxMbTvgEACSCa5VOiWLmu7HbW6ux r8C98ZVNz93x5ajFUHaDP5L/xkYxJx4GwE+RRBQZm9LD5YNWkkyaKeiAZd5igJkzgcLp JZVkjrfvAo5S2DIlSbqP7HOQiHNLOfNxHbzvLwN7aEw0NzL+aEhb5rRakG5b63zc6ZPQ Yy632eFqKML7WelfDnMPqM5k/lrgX3g0p2+lbik3d9/Wr1xUTR5GmjCWi3IgQDggXzVj coCoWBjqMUtmG4hJu32hT/oI2PBZsKn/26bNuAtxrgT/ct5FzCh3E4lQy1XSOs3piYth 5cpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pwCHRqCq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n8-20020a170902f60800b001786b70f913si17922937plg.164.2022.10.19.02.07.20; Wed, 19 Oct 2022 02:07: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=pwCHRqCq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232012AbiJSI5c (ORCPT + 99 others); Wed, 19 Oct 2022 04:57:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231894AbiJSI4j (ORCPT ); Wed, 19 Oct 2022 04:56:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABF1A175A2; Wed, 19 Oct 2022 01:52: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 0730D617D4; Wed, 19 Oct 2022 08:49:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1C30FC433D6; Wed, 19 Oct 2022 08:49:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169344; bh=CDZp1MYri+orB59jg/D8jxZWD0sMczQ9N3voVKdnd0s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pwCHRqCqLLKX9lumbpz42T63VWdx7ULwU1xp0HNjhAXZ49lozdhktu9Sascii5Id7 lF36GbWebhYwxs2jqCFGfdLWTe2M5ZrYlcW6QqtTyWjcMW2jI4Noc4OboFfrbQTF5v yqGs+YXSGT0+l7H/WHkM36tOoo/tDsvREwSWBWac= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johannes Berg , Sasha Levin Subject: [PATCH 6.0 242/862] wifi: mac80211_hwsim: fix link change handling Date: Wed, 19 Oct 2022 10:25:29 +0200 Message-Id: <20221019083300.705612740@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106354273170132?= X-GMAIL-MSGID: =?utf-8?q?1747106354273170132?= From: Johannes Berg [ Upstream commit 65f7052b6c38f767d95ebfa4ae4b389b6da6a421 ] The code for determining which links to update in wmediumd or virtio was wrong, fix it to remove the deflink only if there were no old links, and also add the deflink if there are no other new links. Fixes: c204d9df0202 ("wifi: mac80211_hwsim: handle links for wmediumd/virtio") Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- drivers/net/wireless/mac80211_hwsim.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index ee34814bd12b..a074552bcec3 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c @@ -2995,10 +2995,15 @@ static int mac80211_hwsim_change_vif_links(struct ieee80211_hw *hw, u16 old_links, u16 new_links, struct ieee80211_bss_conf *old[IEEE80211_MLD_MAX_NUM_LINKS]) { - unsigned long rem = old_links & ~new_links ?: BIT(0); + unsigned long rem = old_links & ~new_links; unsigned long add = new_links & ~old_links; int i; + if (!old_links) + rem |= BIT(0); + if (!new_links) + add |= BIT(0); + for_each_set_bit(i, &rem, IEEE80211_MLD_MAX_NUM_LINKS) mac80211_hwsim_config_mac_nl(hw, old[i]->addr, false); From patchwork Wed Oct 19 08:25: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: 5543 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp348648wrs; Wed, 19 Oct 2022 07:10:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5HlTrNjFJwZspXfxXLKTTB1m+i/CKT/pmnxEQgJ71y9IIWx/w2tUJ5n7VeuvIDE0NaCgJa X-Received: by 2002:a05:6402:5485:b0:459:147a:d902 with SMTP id fg5-20020a056402548500b00459147ad902mr7946335edb.263.1666188628157; Wed, 19 Oct 2022 07:10:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666188628; cv=none; d=google.com; s=arc-20160816; b=K8D4qI0xU0sIt/Z64IUT4rcb+yh7BL+sa4gFJdiZncVBnLaPJ2aPs+SC/VAUBwWdyX NRL89nN35/kM77rFojF66VrtcinCsmnSCiXI1sXPUWCTBF3rRYbd/nyeOm7UVO03ErNF siHlhKRXeYhHAPzV7N0HN2H5iE+KcglnJwcRQB7CwO2JhUQXDe2cznT7F7kpSeZillxR gncm9Pt9fW1NzxaznTD5MdIUdXav4J5jYlCJUlokMcFdzUFvPoY9ze7UdqmUIk8Dp+yG 1PLGGXcnJKwTGjOs/gm6LtFoyAWxFSqY3csr4Nl2EEN7SJjfTXbrAv0nJg53IWO4oHzw XITQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QuSA+kxX7po9bgqRysegFXeVClYwDeYvUrva9tYk0Y4=; b=Xpzzt3rUAcyeBdEj5K+r0Xxc+gU0ip2VNKVAbHCCIaiH2tR+0/iTpebgEjDYHR4Ia0 l1ErL+9MPV3OFDjjdxApQf8Q28kJI8jtoeI16QMHpUaBBoS3bgmIF6TvOfX5CJ+cL3tV Ib4FAwL59R7uWp8/l5YhcJ0WJF8KGdERtZf5RMadOMygz2KaKplOKnsgQhvgzyDCDLHd kbiK1f8fiOMIYnv1RqCR4XUPH65B2iRYnYR9YAJYePCDhiOa+sr0/nNAP7EiF87FWzgp LVoyn/Rj4XVznH6aeQY2acQdl+uRevHbgwq79zcIStkA/jOgp7bO5QzIMlSUdcvqyK2z Z9rA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=loiDd8iK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o19-20020aa7dd53000000b00447dfae6181si12282404edw.235.2022.10.19.07.09.57; Wed, 19 Oct 2022 07:10: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=loiDd8iK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231960AbiJSNxT (ORCPT + 99 others); Wed, 19 Oct 2022 09:53:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233749AbiJSNwa (ORCPT ); Wed, 19 Oct 2022 09:52:30 -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 030A91946E7; Wed, 19 Oct 2022 06:36: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 51515B82321; Wed, 19 Oct 2022 08:49:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B421DC433C1; Wed, 19 Oct 2022 08:49:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169347; bh=JD5EGFdbeO8eIPr4yRiMiBSbkCZWKHBuu0ZkMSKqJqA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=loiDd8iKuiaHR5QOwzUrvtcnQcFAvJNjAyi2lpLbciBQYt+EZCC98cvMYISwP+eI0 mFxj6ujwlchbvE1l4VGLOYayoC6iPljYm19O/ELQOmkwjnU4hhbr0Y05iUwXybe9UE 4P330ApytTdqO1q/aDjwA4CWGcrK/Nq0+VmfxvhY= 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 6.0 243/862] wifi: mac80211: allow bw change during channel switch in mesh Date: Wed, 19 Oct 2022 10:25:30 +0200 Message-Id: <20221019083300.754397190@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747125406807681257?= X-GMAIL-MSGID: =?utf-8?q?1747125406807681257?= 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 a4f6971b7a19..e5239a17a875 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -3597,9 +3597,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 Wed Oct 19 08:25: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: 5574 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp351267wrs; Wed, 19 Oct 2022 07:15:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Tz7ko5wjm1FEg1U/m8PY/iqH+ZTXaE7iMuQ/iPtMTwtjJlRVdDrBOZAuyLtvd8fP21I6b X-Received: by 2002:a17:907:6e8b:b0:793:30e1:96c9 with SMTP id sh11-20020a1709076e8b00b0079330e196c9mr1879384ejc.97.1666188901002; Wed, 19 Oct 2022 07:15:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666188900; cv=none; d=google.com; s=arc-20160816; b=Qa1ZVzYrHupTf0s/3NrG+s+D9X0I2QV/yId4tr9llR3g+nqwR5cwkw9uZguMpHm9EB +Ais3n5aCERIb+Fxiw94UUhYx4bhQQSjjhh0q4yRtzMQk+kWZkV0uWRdWVXexCbABh86 hGwpj1tMjVYUeMeCx/D9uP6JPbuiY/uKTjlUCN8stDl8LZ29aOOycO/r8oksBt1RQpYi fq8dma93GVAKfbKJ4fIq/WbvmHH8cmHuPfDwQBbWkXSoaMn1v6EPkK9NRrbNoaPWd9rW EisnNnJJulVCa3QuzyM26p++nccYIgry7O1L5DIcKe7ELE0D6GroEsa91J6HJeVlPxLZ QHNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tgRNBsAGVSbqbAzQnO7L+2sMBFK3o1vvG/l5PH+R4Uk=; b=yIjLfhobnHKBzl1gxf3OzKIrfBvBdzOjInbzYm8xajE5ClG9L5pDDRwhpeVNV0cLRI l4XA1l0JY2CIj5ERBfEy3FDyvAeGNEpKy0eoNVmVbbIC435L66LxhWE9q8MZM0NVfIQM IdDCLyYdjOOW8qr1Uxm9XD2o9mgCLxGtoQ8JZ3Q0sA6s1xThjSfF+yr0vRziGKZ76Gob J1bcEWmyk6S0QQmTTRTTn0Xe11Q9idYmm5O/5TT1GFg0uYUU4ANZ2SB7KKtu9rJigfiq fuigusOE2yrw/4/ytJxQuUyxGMpt0Qo2jTOVLczeJ9NxA6yQiT1a8/UQOeH7WSqO93S1 /gwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DoukKzLs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o19-20020aa7dd53000000b00447dfae6181si12282404edw.235.2022.10.19.07.14.27; Wed, 19 Oct 2022 07:15: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=DoukKzLs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233835AbiJSN5p (ORCPT + 99 others); Wed, 19 Oct 2022 09:57:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233975AbiJSNyf (ORCPT ); Wed, 19 Oct 2022 09:54:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39BA518542D; Wed, 19 Oct 2022 06:37:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D0FBFB8232A; Wed, 19 Oct 2022 08:49:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C976C433D6; Wed, 19 Oct 2022 08:49:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169349; bh=boiTHlnuO/TKiwsbBxT4uNEIkYKD57pTRY5XdiRnf60=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DoukKzLs+mW3AKNP1Guu6XARVf26XA5saEjmy/P98BpSBs0Aca4T1oLHkiVPLRbSI bn2YhYxZZl4Tbr02tEFDimjTC+FZcEElzOsKrCR71ftza1rZUzO+MQO+1zsPDLoGu8 WpIlrA4fFwao2CNexndqpEQtOj5vRN9nHkbqoevg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lam Thai , Andrii Nakryiko , Quentin Monnet , John Fastabend , Sasha Levin Subject: [PATCH 6.0 244/862] bpftool: Fix a wrong type cast in btf_dumper_int Date: Wed, 19 Oct 2022 10:25:31 +0200 Message-Id: <20221019083300.795945784@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747125693265142016?= X-GMAIL-MSGID: =?utf-8?q?1747125693265142016?= From: Lam Thai [ Upstream commit 7184aef9c0f7a81db8fd18d183ee42481d89bf35 ] When `data` points to a boolean value, casting it to `int *` is problematic and could lead to a wrong value being passed to `jsonw_bool`. Change the cast to `bool *` instead. Fixes: b12d6ec09730 ("bpf: btf: add btf print functionality") Signed-off-by: Lam Thai Signed-off-by: Andrii Nakryiko Reviewed-by: Quentin Monnet Acked-by: John Fastabend Link: https://lore.kernel.org/bpf/20220824225859.9038-1-lamthai@arista.com Signed-off-by: Sasha Levin --- tools/bpf/bpftool/btf_dumper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/bpf/bpftool/btf_dumper.c b/tools/bpf/bpftool/btf_dumper.c index 125798b0bc5d..19924b6ce796 100644 --- a/tools/bpf/bpftool/btf_dumper.c +++ b/tools/bpf/bpftool/btf_dumper.c @@ -452,7 +452,7 @@ static int btf_dumper_int(const struct btf_type *t, __u8 bit_offset, *(char *)data); break; case BTF_INT_BOOL: - jsonw_bool(jw, *(int *)data); + jsonw_bool(jw, *(bool *)data); break; default: /* shouldn't happen */ From patchwork Wed Oct 19 08:25: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: 4614 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp211783wrs; Wed, 19 Oct 2022 02:05:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM66r2edJfdOOPY/yIEVxcT4uy52ngCq/DFnXyYrxqKbQiaFzEpV+TzfTaYUBJOQfDvDECyx X-Received: by 2002:a17:90b:278c:b0:20a:e1e6:5340 with SMTP id pw12-20020a17090b278c00b0020ae1e65340mr44081209pjb.239.1666170341562; Wed, 19 Oct 2022 02:05:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170341; cv=none; d=google.com; s=arc-20160816; b=HznolsyTy3AOeHAebXeR/tx3qBHBOBSVNU1svxoJ8ZlQ0OA20f6ce3RAn+oxT7Sgo+ Vmw4ryqvxTXHu7xCZDJUsl/byCOyXZZFv2Ra/vnj2HGgwxsT02xFg0cfnMSCLj7aPeia 29AkffQUvNaFTQgVh6e1/O9c5JKLvEJh7xymRw2QuyFf4Gic/LKt1I41YLcfPjZSsV5U cDeDoI/Ny1asvQQztMOZ4P86iEGaCHb5Z8m4+xiciekVUn/lUXy07nymNrfmCm+Pfzrd e9enGdBmFhIxl2c3Oxfu9iDSSMhbRxgu1mqgejRxcfQUX0e3IoUlF8PvpJquidYDWiFX xSCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Dinhm7mmZsD6dyhoitb5wMIGMjmqdcpeoumbhgKIkgc=; b=ulKHscHs2O29zRtxZ9AqRHtKCMsyH215t4w42l0PwkbweDOe8zzOC7gTS9AZmCffyv du1FgRRUdCgHZuwRMHvZoaKUwLoB355s99cRuJs3UrXmE9tMNLSvwydle4HzZJ7XhqFN +R85hSXLlxA41P3uHpdURqH1XUtT/ljOnm4/cHzszV1NLTfzl0JbsOMLVoodaYflpr3f RfnTIZq+tXNdXWj42m5JGgx8uMQn82TK86ntOKZtwug9ydDIQGblcx2O0BhCzKcF3av3 votRhUgLWmOcswR/Xj98hhQp2p9HpPatgWgAFTUIHRT1aPwuUMz2xgVZj0n5z9jr1bhr 5WCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KLmLx3Ef; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y4-20020a17090322c400b0017824f38242si22172954plg.75.2022.10.19.02.05.21; Wed, 19 Oct 2022 02:05: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=KLmLx3Ef; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231697AbiJSIx3 (ORCPT + 99 others); Wed, 19 Oct 2022 04:53:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231688AbiJSIwj (ORCPT ); Wed, 19 Oct 2022 04:52:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 520A06612E; Wed, 19 Oct 2022 01:50:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CF44E61841; Wed, 19 Oct 2022 08:49:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3E4EC433D6; Wed, 19 Oct 2022 08:49:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169352; bh=bxtpQ4/L1xjeH5XzKzquZqmtyjODMESCyeL/P6ddsBc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KLmLx3Ef95mqG9SJIxpYQfXouo6+Bznom2M9G8h7h9mXVhGwbONB4O7c+MPGV2bGa IAJPU1pXFHhXGG0mJGMWK4OmTEgU7Em/xWYJoIW9ODBt8oy6r3kQ9OQbi5xhZQDzIJ IsQgPPnFwgKO/aYZ7UROS1j8zNqthqDdodZ6ZNg8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jacob Keller , Tony Nguyen , Sasha Levin , Gurucharan Subject: [PATCH 6.0 245/862] ice: set tx_tstamps when creating new Tx rings via ethtool Date: Wed, 19 Oct 2022 10:25:32 +0200 Message-Id: <20221019083300.840724575@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106232118522453?= X-GMAIL-MSGID: =?utf-8?q?1747106232118522453?= From: Jacob Keller [ Upstream commit b3b173745c8cab1e24d6821488b60abed3acb24d ] When the user changes the number of queues via ethtool, the driver allocates new rings. This allocation did not initialize tx_tstamps. This results in the tx_tstamps field being zero (due to kcalloc allocation), and would result in a NULL pointer dereference when attempting a transmit timestamp on the new ring. Signed-off-by: Jacob Keller Tested-by: Gurucharan (A Contingent worker at Intel) Signed-off-by: Tony Nguyen Stable-dep-of: fc5ae5b44eb2 ("Bluetooth: L2CAP: Fix build errors in some archs") Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/ice/ice_ethtool.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c index a6fff8ebaf9d..bbf6a300078e 100644 --- a/drivers/net/ethernet/intel/ice/ice_ethtool.c +++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c @@ -2826,6 +2826,7 @@ ice_set_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring, tx_rings[i].count = new_tx_cnt; tx_rings[i].desc = NULL; tx_rings[i].tx_buf = NULL; + tx_rings[i].tx_tstamps = &pf->ptp.port.tx; err = ice_setup_tx_ring(&tx_rings[i]); if (err) { while (i--) From patchwork Wed Oct 19 08:25: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: 5551 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp349436wrs; Wed, 19 Oct 2022 07:11:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6kz6tcZlIXNcL+Eo62MQ8u6UE8w99emiJhH9XbnI1vKH1rntBizPixqtX85BXq6IDjQT1p X-Received: by 2002:a05:6a00:1501:b0:563:9f05:bd6e with SMTP id q1-20020a056a00150100b005639f05bd6emr8856766pfu.48.1666188707222; Wed, 19 Oct 2022 07:11:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666188707; cv=none; d=google.com; s=arc-20160816; b=z6OUwHreIKvESy3WZoaJ3jqhTu3f19GuSifTMcw4pAbHj//qKSYAptRjw9M0K520gh iLe+P7rxnpFm5g1CB5nIKagseWNmx1WyWxHR3viARSF7WYeW9oTln/P9KfRIt9oVFthZ +GsHejH5LXAdYVUuTD4FlhIGV3pxmDUJ/0aa4hQK3IfHcf4FjIwnFtkJw6rcORcdMZ97 DByfLsJor8x3eyv/tKDsKUcRNPEcJrklrEKPUFHq1HbdMPSHN7yB/UHNPGf8pJrYb5pq 0ibMZv3Ed5mjw5X8iFdy5UY5kOgM8eXJuB1JsE4XHNfmmbM2TwTyVJFKNdFSe+0P0V/h k03Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Z/LrEgVC6zAP0NpbV4RTUvfot8G25uycp17CrnatObA=; b=Vf9SHsdJw/dGShN/3UtonwgNj0D3BmM0plb6eJauf9se9S7amlw/z6lZiQzNHc3yBR PRxd261zI2yGL/FGaUxOuoSv2UqyobLOMoYUMduSMPZzs5kz/xwIzIwoQtMlwqvW/UMa 5LUN4YWZL/avdQfPRroaNdDQgz22oscWnlEb4yLAfgWbM0aEG4dd4yYJKCl5Eaa8o6lR k/OTUtRVpmBnMrhraoMIPq929BQKDXf+i67OeDZVLECfpPcVSuqMETaSw3Wtk01lsJC2 t8TptiFq+ZlkM3StuCtOcUANTaqmzi3vtdvO84OsdbIfLmPVdjaSTAUWsoyHVjHU3jvM J3eA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=stb10XTR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y124-20020a636482000000b0042bb607f75esi17808018pgb.284.2022.10.19.07.11.09; Wed, 19 Oct 2022 07:11: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=stb10XTR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233317AbiJSN4l (ORCPT + 99 others); Wed, 19 Oct 2022 09:56:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233819AbiJSNyG (ORCPT ); Wed, 19 Oct 2022 09:54:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E1761C5A58; Wed, 19 Oct 2022 06:36: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 32C73B82327; Wed, 19 Oct 2022 08:49:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 88A8FC433C1; Wed, 19 Oct 2022 08:49:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169354; bh=7MyABJGgUTVSou116WehLBxh9mUqA3bxD8cDImHoQxs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=stb10XTR6pKiPLDL1ovNwS9eXeOjWHggtwkTTPyljPfT3uYkCpivsOp4HKM9Ory3s uvqalHwHbFI14xUTT60wBGnq9j262L2CHnHRT1aHQY2AEbpUar7AtjMKPITb8VIM0+ pF9YH8TBPmUqeYMc4bwYlZTzqyccSZ1j7OWaPHjI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Richard Guy Briggs , Paul Moore , Sasha Levin Subject: [PATCH 6.0 246/862] audit: explicitly check audit_context->context enum value Date: Wed, 19 Oct 2022 10:25:33 +0200 Message-Id: <20221019083300.892749573@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747125489480079810?= X-GMAIL-MSGID: =?utf-8?q?1747125489480079810?= From: Richard Guy Briggs [ Upstream commit 3ed66951f952ed8f1a5d03e171722bf2631e8d58 ] Be explicit in checking the struct audit_context "context" member enum value rather than assuming the order of context enum values. Fixes: 12c5e81d3fd0 ("audit: prepare audit_context for use in calling contexts beyond syscalls") Signed-off-by: Richard Guy Briggs Signed-off-by: Paul Moore Signed-off-by: Sasha Levin --- kernel/auditsc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/auditsc.c b/kernel/auditsc.c index 79a5da1bc5bb..0ee09447ad04 100644 --- a/kernel/auditsc.c +++ b/kernel/auditsc.c @@ -2069,7 +2069,7 @@ void __audit_syscall_exit(int success, long return_code) /* run through both filters to ensure we set the filterkey properly */ audit_filter_syscall(current, context); audit_filter_inodes(current, context); - if (context->current_state < AUDIT_STATE_RECORD) + if (context->current_state != AUDIT_STATE_RECORD) goto out; audit_log_exit(); From patchwork Wed Oct 19 08:25: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: 5545 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp348753wrs; Wed, 19 Oct 2022 07:10:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7EhJMivuu+UKii9RLGa7tDhuhs4nGuqhav3gugEI3gr2JloV/4vLxs+jHPsIrikp+HFR0I X-Received: by 2002:a17:906:5dd8:b0:78d:efa7:f78d with SMTP id p24-20020a1709065dd800b0078defa7f78dmr6982971ejv.641.1666188642792; Wed, 19 Oct 2022 07:10:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666188642; cv=none; d=google.com; s=arc-20160816; b=UYFPLpQfHwThO/LvZyv5J9Dec3V6Le1mSKNZfwylyqm3CTj6/nSPpn6da+EjzZEfPr uMzV1DdjF09IvKlvgoC3Q7ezQXXNnlpZ8Y0r3QaR/oW/kzuIkjPC8EU4PEJBotQaJJhU A6L64rCDYF+3MAPtHgFE3JQ5wdtQJquf388TnsUPEtmMNwuAftu5tImBJfbDmL8bc60n GQf5DIqFtcKsK1vfdhTHfTMcyenlwv7puRiH3vOpHCAUCS//O2ODJCrcYBIpCfPjonhs MThqvN90pgs9remGIWcboPPxRpV0x1O5L9alwO3lyDJArEjRc22jkXtSNQGvJlkRkBN7 OBdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XpePGz2yBviPKKU+tSZWbDdfehmEGDxT17aPzm3EHs4=; b=Fbay3R0I0Sgv3OjFj5XvnzQyhM9oAJAjiWOl4YumN0Q4HJs32HMmlPsLJckxuePMes jcsOzHl+ZM5xg9CQTAMc9gCqFnromwo66iayjTmrKettg3gEKDRptatorpMFxvgG1u0Q vqkya3GX+1wgSdggNC0b8dKRJdVl5nnBVqxftRqn++zKQAkMY8gS1PKfwuYbA6YPuwd3 HQ0Uuwxmmi4gJBUquTNmWCGD+sPAOJmSVnCIhFL88aVosGn357L3oQRCXuxtKgkppFF2 iq26UJPwnLg8ORndh5tJFjSdp9DzCVZYjktiK4he4N5YZ713O7Z693xHonHsnjiuE+z2 6Ibw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dsa9TLmI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id du2-20020a17090772c200b0078deb92e490si16018966ejc.911.2022.10.19.07.10.03; Wed, 19 Oct 2022 07:10: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=dsa9TLmI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230160AbiJSNxb (ORCPT + 99 others); Wed, 19 Oct 2022 09:53:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230389AbiJSNwc (ORCPT ); Wed, 19 Oct 2022 09:52:32 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F48E1B8674; Wed, 19 Oct 2022 06:36: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 D3926B8232B; Wed, 19 Oct 2022 08:49:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35591C433C1; Wed, 19 Oct 2022 08:49:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169357; bh=Fq5bDuSWq61AfBRYdgTC2qpoeoE4a3r+TcYud3nUcGc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dsa9TLmI8Pzy69uyDQOgF21mloreix7/MUM9hWD5sCYs7nWno6mvdeA+U/2JZo59y qVwilClv8uwvKLIcnpJTOXqdeXEgEohnO3iAS/cDK669alt/YCFzAVW4MseEgf/NQ3 sgPfhz0vy5Q0xQG6HXBgxMIKwYtLN+EIuTQ/Kyv4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Richard Guy Briggs , Paul Moore , Sasha Levin Subject: [PATCH 6.0 247/862] audit: free audit_proctitle only on task exit Date: Wed, 19 Oct 2022 10:25:34 +0200 Message-Id: <20221019083300.942268675@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747125421945377048?= X-GMAIL-MSGID: =?utf-8?q?1747125421945377048?= From: Richard Guy Briggs [ Upstream commit c3f3ea8af44d0c5fba79fe8b198087342d0c7e04 ] Since audit_proctitle is generated at syscall exit time, its value is used immediately and cached for the next syscall. Since this is the case, then only clear it at task exit time. Otherwise, there is no point in caching the value OR bearing the overhead of regenerating it. Fixes: 12c5e81d3fd0 ("audit: prepare audit_context for use in calling contexts beyond syscalls") Signed-off-by: Richard Guy Briggs Signed-off-by: Paul Moore Signed-off-by: Sasha Levin --- kernel/auditsc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/auditsc.c b/kernel/auditsc.c index 0ee09447ad04..63a6fe99aa3a 100644 --- a/kernel/auditsc.c +++ b/kernel/auditsc.c @@ -1016,7 +1016,6 @@ static void audit_reset_context(struct audit_context *ctx) WARN_ON(!list_empty(&ctx->killed_trees)); audit_free_module(ctx); ctx->fds[0] = -1; - audit_proctitle_free(ctx); ctx->type = 0; /* reset last for audit_free_*() */ } @@ -1077,6 +1076,7 @@ static inline void audit_free_context(struct audit_context *context) { /* resetting is extra work, but it is likely just noise */ audit_reset_context(context); + audit_proctitle_free(context); free_tree_refs(context); kfree(context->filterkey); kfree(context); From patchwork Wed Oct 19 08:25: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: 5460 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp331168wrs; Wed, 19 Oct 2022 06:36:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7fgRvBJTB4STSAsq+l6ZmdU3mfBI+iHd6edO8Y8rhbzm9OurrOBTtoLbNXv5WwYa6W8UTO X-Received: by 2002:a17:902:b402:b0:179:e5b0:96d3 with SMTP id x2-20020a170902b40200b00179e5b096d3mr8414112plr.142.1666186569017; Wed, 19 Oct 2022 06:36:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666186569; cv=none; d=google.com; s=arc-20160816; b=R7GznHrjSL3XJmTGMz4z3qT7LVG8hnRxcv/jYmadqEhelnzBB5iAcmGGP2IRd2fJBB 1UriUs7+vCxEU5ZztIn/m6Q87JrZkQimh3Cz669eQhp8Td6aL28Z7tLkaWhor5/GkDSB 8YCLSKwmb/SmLSU3nGJPPJODv2kKSQQtBEWPHL7os6IQV+jhUaY0R7Lyad+03Vt4S+6T D50xvkhmRzUJE/D8nhPaJuMdq4mY6Is/TDLVCr3ACcUsOqGdIVDL4rZZjQ+XhtaeoTfv iBhPCc5mkR0l7clUFKyLCS940T8DYmtLV7Rzn2ftEaEcVqqN5EBmtmo7kTUhNYSotdKF Esjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6Luwm+6V4EnEcJDN6jv3v3LMxZdE/VcwQnoGBPu0axQ=; b=JkEV5SYOaLwNd4CvfX6tEgFHmeqwS+8JMmc8jpOLhhsD/8YT7Z1Io3n/FPyr8roksC JdqyPt9dXTUIWAcPgiNxI9HIB11fB25KG16z6lCJ++fLrdhoRb6d4Yzgp0MXi1KErAPc vDPQ3jn0eodOePG0CUMFEQJDq7GKx7Kz/XHSR8eQT7rPp20aTvgZAyK9EB0rlEvIBT6o MNsn19GamswjVyaU63g0XG1UjzWUntrB/Gq4bTcrLyoZx8ivXqrkTuPKvcdiVFZ3ga9I eypyTBoWWFxRaCr5ms4M7cbc1mnUb6EpbGnikekRp3HG5nHa3J05obT3Jktx/5OFTprU nxGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=B4xxqNBi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a9-20020a170902ecc900b00179e70b9e6csi23514954plh.519.2022.10.19.06.35.55; Wed, 19 Oct 2022 06:36: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=B4xxqNBi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231437AbiJSNZ3 (ORCPT + 99 others); Wed, 19 Oct 2022 09:25:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231349AbiJSNZD (ORCPT ); Wed, 19 Oct 2022 09:25:03 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36A1912D34; Wed, 19 Oct 2022 06:11: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 EBE86CE20FA; Wed, 19 Oct 2022 08:49:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D606EC433D6; Wed, 19 Oct 2022 08:49:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169360; bh=yVMy2NWsVdNDP54jbBTFxUQN5uZNosG28yGa4Gw8At0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B4xxqNBi8FNH54s9Y/Hjlchqc6mXkxtuAuXjlPsYAq8rKgEN3RjRRfgs5X6tDCVS7 +8a9vwbOsM2GCg+GgFHD3MRxDa4Gk0wUlQKjFJtgcXpuAom57LJInVFoiQR0+/0y9P p2tUNLE1Az5pqOHPb/0u/aFgBAi5vI7P4X+I3gG0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sabrina Dubroca , Steffen Klassert , Sasha Levin Subject: [PATCH 6.0 248/862] esp: choose the correct inner protocol for GSO on inter address family tunnels Date: Wed, 19 Oct 2022 10:25:35 +0200 Message-Id: <20221019083300.992358478@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123247502354378?= X-GMAIL-MSGID: =?utf-8?q?1747123247502354378?= From: Sabrina Dubroca [ Upstream commit 26dbd66eab8080be51759e48280da04015221e22 ] Commit 23c7f8d7989e ("net: Fix esp GSO on inter address family tunnels.") is incomplete. It passes to skb_eth_gso_segment the protocol for the outer IP version, instead of the inner IP version, so we end up calling inet_gso_segment on an inner IPv6 packet and ipv6_gso_segment on an inner IPv4 packet and the packets are dropped. This patch completes the fix by selecting the correct protocol based on the inner mode's family. Fixes: c35fe4106b92 ("xfrm: Add mode handlers for IPsec on layer 2") Signed-off-by: Sabrina Dubroca Signed-off-by: Steffen Klassert Signed-off-by: Sasha Levin --- net/ipv4/esp4_offload.c | 5 ++++- net/ipv6/esp6_offload.c | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/net/ipv4/esp4_offload.c b/net/ipv4/esp4_offload.c index 935026f4c807..170152772d33 100644 --- a/net/ipv4/esp4_offload.c +++ b/net/ipv4/esp4_offload.c @@ -110,7 +110,10 @@ static struct sk_buff *xfrm4_tunnel_gso_segment(struct xfrm_state *x, struct sk_buff *skb, netdev_features_t features) { - return skb_eth_gso_segment(skb, features, htons(ETH_P_IP)); + __be16 type = x->inner_mode.family == AF_INET6 ? htons(ETH_P_IPV6) + : htons(ETH_P_IP); + + return skb_eth_gso_segment(skb, features, type); } static struct sk_buff *xfrm4_transport_gso_segment(struct xfrm_state *x, diff --git a/net/ipv6/esp6_offload.c b/net/ipv6/esp6_offload.c index 3a293838a91d..79d43548279c 100644 --- a/net/ipv6/esp6_offload.c +++ b/net/ipv6/esp6_offload.c @@ -145,7 +145,10 @@ static struct sk_buff *xfrm6_tunnel_gso_segment(struct xfrm_state *x, struct sk_buff *skb, netdev_features_t features) { - return skb_eth_gso_segment(skb, features, htons(ETH_P_IPV6)); + __be16 type = x->inner_mode.family == AF_INET ? htons(ETH_P_IP) + : htons(ETH_P_IPV6); + + return skb_eth_gso_segment(skb, features, type); } static struct sk_buff *xfrm6_transport_gso_segment(struct xfrm_state *x, From patchwork Wed Oct 19 08:25: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: 5559 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp350008wrs; Wed, 19 Oct 2022 07:12:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4pa+BXD1F4VzBw5BSV6y+/ELNo69O9Zml2YO7sJR3PxpB5ALnkoF8BQMO4zt1D86ATWoHc X-Received: by 2002:aa7:9250:0:b0:563:723f:7914 with SMTP id 16-20020aa79250000000b00563723f7914mr8411840pfp.12.1666188771238; Wed, 19 Oct 2022 07:12:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666188771; cv=none; d=google.com; s=arc-20160816; b=uXsyYxRb3IGLJE4YscHCtHQNhyXXJTSnzgmsDmc63cdwiBAz2RgVlF+a+Mbp4tFrhs 2ZkUuN+SqYrp85U0ujXglZAwcxYaFLg2kVJjyRd6xbiRw5EE32cXokbsAmMH7nZBXYW5 mHGntinX0RKT9/Y8G5jSEoqJ4XFrPFUe6rx07FMgDnB7Wpc0hEDXXR5r+45lDAOKdzqQ u52ikKQZr7x0DGwgLFMdqQHtEZ8vV3JkvWRAt5uzPyXpaVteBmRMl0LlohlfXV1ol4iY gcOTpn3X0/dEtgQ9B3V+aHM5vuw6xORc9mgdJKIzET+axagkusMA2FoO3q9/WnHBLQU6 5v6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1SLUKWCGmB66dYqcLSnFazvp5hUW6/FmhLUOspQSX28=; b=gASJz6Nd1ikCWqK+0I77P/X39NLIaiJZ5zknRbHs27y8MvpNXQp+b2vdh40RGQF0RE ZEbPwDPpM35yLsLmA2rXPl5zN0aY6dBZqu24zi4BjDexu4UBz0tUHZ3lxbm0fNTmn2q0 lgaBX/gKf2T3+c5kokJkUL6K/d3XXgeMDr8P4AwIGmqivRFIzd55ctZd2BFNvjvbmHya OiWcfB9mG2TDMyIoLbEYZU3dB2ezMbArpnCoNPd92GQhfLqU6wx6QsvacL7kFr+C6QtV qatRViTSu45QNGCgWFBNGaqzbDzF9teAMREJFaK385EJUNsvOTp756tD5pwUsyfoyva/ 3Vjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HtOzV3QA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e6-20020a63aa06000000b00439286e51a2si17315800pgf.155.2022.10.19.07.12.20; Wed, 19 Oct 2022 07:12: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=HtOzV3QA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233796AbiJSN6L (ORCPT + 99 others); Wed, 19 Oct 2022 09:58:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234006AbiJSNyf (ORCPT ); Wed, 19 Oct 2022 09:54:35 -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 0095114BB55; Wed, 19 Oct 2022 06:37:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 04BACB8231E; Wed, 19 Oct 2022 08:49:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63D28C433C1; Wed, 19 Oct 2022 08:49:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169365; bh=KTZcokemeTem35PNMjBQHPCVWK2pq04hPNhpZ0yUFtw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HtOzV3QA+lcYTwM2ipTPNtmk5+sJtJ9PhpTI3kI2QLhbvXuEjvDCo5A1ugPVbzxHF khFgyIpSD+Nq5wwCH1RyiZb8eFvm4mvfOqHpJv/I54aYt2kxQMrh8tYj3gOxXE8jRT a1WGDl5y2YK4p3btJm+vqxqowUvlD4/RHqXY0OUQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Matthias Brugger , Mark Brown , Sasha Levin Subject: [PATCH 6.0 249/862] spi: mt7621: Fix an error message in mt7621_spi_probe() Date: Wed, 19 Oct 2022 10:25:36 +0200 Message-Id: <20221019083301.037688171@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747125556566941738?= X-GMAIL-MSGID: =?utf-8?q?1747125556566941738?= From: Christophe JAILLET [ Upstream commit 2b2bf6b7faa9010fae10dc7de76627a3fdb525b3 ] 'status' is known to be 0 at this point. The expected error code is PTR_ERR(clk). Switch to dev_err_probe() in order to display the expected error code (in a human readable way). This also filters -EPROBE_DEFER cases, should it happen. Fixes: 1ab7f2a43558 ("staging: mt7621-spi: add mt7621 support") Signed-off-by: Christophe JAILLET Reviewed-by: Matthias Brugger Link: https://lore.kernel.org/r/928f3fb507d53ba0774df27cea0bbba4b055993b.1661599671.git.christophe.jaillet@wanadoo.fr Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-mt7621.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/spi/spi-mt7621.c b/drivers/spi/spi-mt7621.c index b4b9b7309b5e..351b0ef52bbc 100644 --- a/drivers/spi/spi-mt7621.c +++ b/drivers/spi/spi-mt7621.c @@ -340,11 +340,9 @@ static int mt7621_spi_probe(struct platform_device *pdev) return PTR_ERR(base); clk = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(clk)) { - dev_err(&pdev->dev, "unable to get SYS clock, err=%d\n", - status); - return PTR_ERR(clk); - } + if (IS_ERR(clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(clk), + "unable to get SYS clock\n"); status = clk_prepare_enable(clk); if (status) From patchwork Wed Oct 19 08:25: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: 4624 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp211956wrs; Wed, 19 Oct 2022 02:06:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4DWA7HIn89Xbd7OD4S/awNgkIlIxT7phOsfXaEy9PKWPfPOokAkGbGs7oWKI7G75Q73OXb X-Received: by 2002:a05:6402:26d2:b0:45d:280b:5878 with SMTP id x18-20020a05640226d200b0045d280b5878mr6546458edd.385.1666170379844; Wed, 19 Oct 2022 02:06:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170379; cv=none; d=google.com; s=arc-20160816; b=A4ErUqGuVyiTrSirvfW16ZZrOrTnaPqzgIag8h2hrSSlIxxkZlAmme5oJj7sRWOFOt 2LnAsCZdPTjNhwOc21eLRfl14EB84yFCpqJBV/+Q35qmn1Ofh9TNY8ouGkmNFeYykYBi 15nqg67iN448X/dWw3pUohZR29hU3Oqp25Ys6QKZBlSfqf57oZNoeDtgGIS3ruR5p4XI LhhIgNiT+PRvWASrIkER2Ru+08h/YON7f+69FyVAOGI6zjfhkFHKQ9NhMVbCdJ0mP8RH xazsoCouiNpPZ1H2fIyN2aCZa+VYI3+kxDMCE1q++yyNov+UpSunM85pDQo9rD0qZnG9 Zbgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=urTV2LCUKsRbNs6/yzO7s1WlXfQQZZDfB6u/aXgcv8A=; b=zLEU1LclVdD3pad5NirfTTwHnx+/9wZEl/OBcVAaTiijR8y4HOw/vaKe543V6Z60ed G4ciKtQI/DBt7p8eClMYdKvu9o4vgVCu8piv789NDFJXvAz7CDSf7YHk6+foTCDIcE6d HLJ7ZjNgQhIiWeE/ubphkGL2jmOES5wHIngjCr/m+Dn2P+bC1A5b/X14x/VIdrpiXjFT rBZ6qgPLv+ZgNoLO8WVJBYqmaQZd73I3kS62Ykb6Zg+AIpY+0gXCM3Xgy1OtmxwDklFV y+yrX0Yr+HUMK0tMoPnBkoF1aQ329Ue/74SMbVWN1aMQ5cBs/qarvbJVlUzG0c45ncRa 0jbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qaT8NhQZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ht19-20020a170907609300b007808f947175si5341645ejc.492.2022.10.19.02.05.49; Wed, 19 Oct 2022 02:06: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=qaT8NhQZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231821AbiJSIxo (ORCPT + 99 others); Wed, 19 Oct 2022 04:53:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231818AbiJSIw5 (ORCPT ); Wed, 19 Oct 2022 04:52:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D65679A58; Wed, 19 Oct 2022 01:50: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 079EF6181D; Wed, 19 Oct 2022 08:49:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 136B8C433C1; Wed, 19 Oct 2022 08:49:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169368; bh=p6ayDb24pUcC13Ada1bVfO09ocE5wIRtINfIU329Dbg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qaT8NhQZRclRkSB13bBSJCuT/1yhVxtM06zkxQPIwYrprkZpQdDWN0ltE9s2CdH6o 5uJcLiY0CdyKXg7ikyquFrE5ad077HqXOQGc2cUXsOuwEe1xWsJoj2djuKPhO9Z5Sb tv3IYLRnNRbjwBRRZqx3wnkRNtomseHtWddS0fZM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kohei Tarumizu , Dave Hansen , Reinette Chatre , Sasha Levin Subject: [PATCH 6.0 250/862] x86/resctrl: Fix to restore to original value when re-enabling hardware prefetch register Date: Wed, 19 Oct 2022 10:25:37 +0200 Message-Id: <20221019083301.078959604@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106272346829884?= X-GMAIL-MSGID: =?utf-8?q?1747106272346829884?= From: Kohei Tarumizu [ Upstream commit 499c8bb4693d1c8d8f3d6dd38e5bdde3ff5bd906 ] The current pseudo_lock.c code overwrites the value of the MSR_MISC_FEATURE_CONTROL to 0 even if the original value is not 0. Therefore, modify it to save and restore the original values. Fixes: 018961ae5579 ("x86/intel_rdt: Pseudo-lock region creation/removal core") Fixes: 443810fe6160 ("x86/intel_rdt: Create debugfs files for pseudo-locking testing") Fixes: 8a2fc0e1bc0c ("x86/intel_rdt: More precise L2 hit/miss measurements") Signed-off-by: Kohei Tarumizu Signed-off-by: Dave Hansen Acked-by: Reinette Chatre Link: https://lkml.kernel.org/r/eb660f3c2010b79a792c573c02d01e8e841206ad.1661358182.git.reinette.chatre@intel.com Signed-off-by: Sasha Levin --- arch/x86/kernel/cpu/resctrl/pseudo_lock.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/pseudo_lock.c b/arch/x86/kernel/cpu/resctrl/pseudo_lock.c index db813f819ad6..4d8398986f78 100644 --- a/arch/x86/kernel/cpu/resctrl/pseudo_lock.c +++ b/arch/x86/kernel/cpu/resctrl/pseudo_lock.c @@ -420,6 +420,7 @@ static int pseudo_lock_fn(void *_rdtgrp) struct pseudo_lock_region *plr = rdtgrp->plr; u32 rmid_p, closid_p; unsigned long i; + u64 saved_msr; #ifdef CONFIG_KASAN /* * The registers used for local register variables are also used @@ -463,6 +464,7 @@ static int pseudo_lock_fn(void *_rdtgrp) * the buffer and evict pseudo-locked memory read earlier from the * cache. */ + saved_msr = __rdmsr(MSR_MISC_FEATURE_CONTROL); __wrmsr(MSR_MISC_FEATURE_CONTROL, prefetch_disable_bits, 0x0); closid_p = this_cpu_read(pqr_state.cur_closid); rmid_p = this_cpu_read(pqr_state.cur_rmid); @@ -514,7 +516,7 @@ static int pseudo_lock_fn(void *_rdtgrp) __wrmsr(IA32_PQR_ASSOC, rmid_p, closid_p); /* Re-enable the hardware prefetcher(s) */ - wrmsr(MSR_MISC_FEATURE_CONTROL, 0x0, 0x0); + wrmsrl(MSR_MISC_FEATURE_CONTROL, saved_msr); local_irq_enable(); plr->thread_done = 1; @@ -871,6 +873,7 @@ bool rdtgroup_pseudo_locked_in_hierarchy(struct rdt_domain *d) static int measure_cycles_lat_fn(void *_plr) { struct pseudo_lock_region *plr = _plr; + u32 saved_low, saved_high; unsigned long i; u64 start, end; void *mem_r; @@ -879,6 +882,7 @@ static int measure_cycles_lat_fn(void *_plr) /* * Disable hardware prefetchers. */ + rdmsr(MSR_MISC_FEATURE_CONTROL, saved_low, saved_high); wrmsr(MSR_MISC_FEATURE_CONTROL, prefetch_disable_bits, 0x0); mem_r = READ_ONCE(plr->kmem); /* @@ -895,7 +899,7 @@ static int measure_cycles_lat_fn(void *_plr) end = rdtsc_ordered(); trace_pseudo_lock_mem_latency((u32)(end - start)); } - wrmsr(MSR_MISC_FEATURE_CONTROL, 0x0, 0x0); + wrmsr(MSR_MISC_FEATURE_CONTROL, saved_low, saved_high); local_irq_enable(); plr->thread_done = 1; wake_up_interruptible(&plr->lock_thread_wq); @@ -940,6 +944,7 @@ static int measure_residency_fn(struct perf_event_attr *miss_attr, u64 hits_before = 0, hits_after = 0, miss_before = 0, miss_after = 0; struct perf_event *miss_event, *hit_event; int hit_pmcnum, miss_pmcnum; + u32 saved_low, saved_high; unsigned int line_size; unsigned int size; unsigned long i; @@ -973,6 +978,7 @@ static int measure_residency_fn(struct perf_event_attr *miss_attr, /* * Disable hardware prefetchers. */ + rdmsr(MSR_MISC_FEATURE_CONTROL, saved_low, saved_high); wrmsr(MSR_MISC_FEATURE_CONTROL, prefetch_disable_bits, 0x0); /* Initialize rest of local variables */ @@ -1031,7 +1037,7 @@ static int measure_residency_fn(struct perf_event_attr *miss_attr, */ rmb(); /* Re-enable hardware prefetchers */ - wrmsr(MSR_MISC_FEATURE_CONTROL, 0x0, 0x0); + wrmsr(MSR_MISC_FEATURE_CONTROL, saved_low, saved_high); local_irq_enable(); out_hit: perf_event_release_kernel(hit_event); From patchwork Wed Oct 19 08:25: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: 4728 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214092wrs; Wed, 19 Oct 2022 02:11:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Tw2oJC6xTVHrg5JCb97B3ntX+iUwWJcQRgxSqAcDhJvcVFlBXBcRvJ0SWgRn8scYQIzVk X-Received: by 2002:a17:907:2c74:b0:78d:b3ae:8408 with SMTP id ib20-20020a1709072c7400b0078db3ae8408mr5952780ejc.172.1666170712337; Wed, 19 Oct 2022 02:11:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170712; cv=none; d=google.com; s=arc-20160816; b=y/ZtuvBWYB9c1ErolfNVnMtY0nknJTXqfcyRj2wzoRC4W+mR6JANrGJLTnADfUWYvF bioktmsVPCYQ7xzH4H6bw89gvGk4V8JlZqDvG/92wc/TZXL82ao15b2OEz5lgpgkLCwx +pz75UqBPT8j4CQWS4n61Vf9qLN7zXkF3lCnmON4wi2wn+pZbZBuwFKgYEZOoj5hcei8 BmBheyRj9bW/g8R/XlxD0W+nYKVcrA+cxpVrLh0Byb3U/2teQvGoDnvYFhyOYx9gObY7 A6UHPcpqjmYZaoP9x+o5FU+0A9H9NZ+qF9TgqJ6iQkaHVHYWbmRZU5BTvPGV4cAy1cjM whJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=asRXrfQL5XwC+1q71+Lx0St7tP98D83GjlPLoMtzDls=; b=qwabFtrogh5VE+9NP+ecYc1oCkEIQUKvuYy43Vpo6xi/xamy267Sigp0/hibD+P23v KFZyMn0F0ZU7MKzB3HucDUPTglbk9BEQ4UOTC6LnovHZMEwTvk3J6/x5Dn3tnYK5+1Ek LyMkgGdBJkWL6R6jUJty+aOhjK37sxygMKSKbR/7K9IrnsYPSUoKxwiUYu5Q/kpMXN5M JIh9f3AzagHpMkHEq7aTda8ogVN2KTZBh4ovhXfzsKzxS9B8stWViTMpcARUaxY0rI7x vxJBDevadxRrV0dCMzrUnN5FZxWzCyx3vsDyrI+nQTx4kNY4p00AjOZboFa/19AcoN2F J4Kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Bxcai6RG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hr42-20020a1709073faa00b0078de51e658esi14782962ejc.208.2022.10.19.02.11.27; Wed, 19 Oct 2022 02:11: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=Bxcai6RG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232657AbiJSJIV (ORCPT + 99 others); Wed, 19 Oct 2022 05:08:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232328AbiJSJFf (ORCPT ); Wed, 19 Oct 2022 05:05:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4B752BFE; Wed, 19 Oct 2022 01:59:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A122A61843; Wed, 19 Oct 2022 08:49:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B308EC433D6; Wed, 19 Oct 2022 08:49:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169371; bh=naQsdsUwmv7ZYGgsCmUoqoGlQ8cz+SG8+yoMlmhiWOo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bxcai6RGK+KkgttwADRHY7cL8r0BC68I0G64G9canfewR63lh6EnzqmfPFH1riQrx aXDMEIkH0Dt3Jx/MQChJi4rbVfl6UUBKyBADJohWUFhjO3lXEVoXObEPJKv+fEXWLH 0q7jpdSST45hErgrR2GVm3dWGW1pEE8jWyaNlmKc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Magnus Karlsson , Maciej Fijalkowski , Daniel Borkmann , Sasha Levin Subject: [PATCH 6.0 251/862] xsk: Fix backpressure mechanism on Tx Date: Wed, 19 Oct 2022 10:25:38 +0200 Message-Id: <20221019083301.126980073@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106620932809110?= X-GMAIL-MSGID: =?utf-8?q?1747106620932809110?= From: Maciej Fijalkowski [ Upstream commit c00c4461689e15ac2cc3b9a595a54e4d8afd3d77 ] Commit d678cbd2f867 ("xsk: Fix handling of invalid descriptors in XSK TX batching API") fixed batch API usage against set of descriptors with invalid ones but introduced a problem when AF_XDP SW rings are smaller than HW ones. Mismatch of reported Tx'ed frames between HW generator and user space app was observed. It turned out that backpressure mechanism became a bottleneck when the amount of produced descriptors to CQ is lower than what we grabbed from XSK Tx ring. Say that 512 entries had been taken from XSK Tx ring but we had only 490 free entries in CQ. Then callsite (ZC driver) will produce only 490 entries onto HW Tx ring but 512 entries will be released from Tx ring and this is what will be seen by the user space. In order to fix this case, mix XSK Tx/CQ ring interractions by moving around internal functions and changing call order: * pull out xskq_prod_nb_free() from xskq_prod_reserve_addr_batch() up to xsk_tx_peek_release_desc_batch(); ** move xskq_cons_release_n() into xskq_cons_read_desc_batch() After doing so, algorithm can be described as follows: 1. lookup Tx entries 2. use value from 1. to reserve space in CQ (*) 3. Read from Tx ring as much descriptors as value from 2 3a. release descriptors from XSK Tx ring (**) 4. Finally produce addresses to CQ Fixes: d678cbd2f867 ("xsk: Fix handling of invalid descriptors in XSK TX batching API") Signed-off-by: Magnus Karlsson Signed-off-by: Maciej Fijalkowski Signed-off-by: Daniel Borkmann Link: https://lore.kernel.org/bpf/20220830121705.8618-1-maciej.fijalkowski@intel.com Signed-off-by: Sasha Levin --- net/xdp/xsk.c | 22 +++++++++++----------- net/xdp/xsk_queue.h | 22 ++++++++++------------ 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c index 7bada4e8460b..9f0561b67c12 100644 --- a/net/xdp/xsk.c +++ b/net/xdp/xsk.c @@ -355,16 +355,15 @@ static u32 xsk_tx_peek_release_fallback(struct xsk_buff_pool *pool, u32 max_entr return nb_pkts; } -u32 xsk_tx_peek_release_desc_batch(struct xsk_buff_pool *pool, u32 max_entries) +u32 xsk_tx_peek_release_desc_batch(struct xsk_buff_pool *pool, u32 nb_pkts) { struct xdp_sock *xs; - u32 nb_pkts; rcu_read_lock(); if (!list_is_singular(&pool->xsk_tx_list)) { /* Fallback to the non-batched version */ rcu_read_unlock(); - return xsk_tx_peek_release_fallback(pool, max_entries); + return xsk_tx_peek_release_fallback(pool, nb_pkts); } xs = list_first_or_null_rcu(&pool->xsk_tx_list, struct xdp_sock, tx_list); @@ -373,12 +372,7 @@ u32 xsk_tx_peek_release_desc_batch(struct xsk_buff_pool *pool, u32 max_entries) goto out; } - max_entries = xskq_cons_nb_entries(xs->tx, max_entries); - nb_pkts = xskq_cons_read_desc_batch(xs->tx, pool, max_entries); - if (!nb_pkts) { - xs->tx->queue_empty_descs++; - goto out; - } + nb_pkts = xskq_cons_nb_entries(xs->tx, nb_pkts); /* This is the backpressure mechanism for the Tx path. Try to * reserve space in the completion queue for all packets, but @@ -386,12 +380,18 @@ u32 xsk_tx_peek_release_desc_batch(struct xsk_buff_pool *pool, u32 max_entries) * packets. This avoids having to implement any buffering in * the Tx path. */ - nb_pkts = xskq_prod_reserve_addr_batch(pool->cq, pool->tx_descs, nb_pkts); + nb_pkts = xskq_prod_nb_free(pool->cq, nb_pkts); if (!nb_pkts) goto out; - xskq_cons_release_n(xs->tx, max_entries); + nb_pkts = xskq_cons_read_desc_batch(xs->tx, pool, nb_pkts); + if (!nb_pkts) { + xs->tx->queue_empty_descs++; + goto out; + } + __xskq_cons_release(xs->tx); + xskq_prod_write_addr_batch(pool->cq, pool->tx_descs, nb_pkts); xs->sk.sk_write_space(&xs->sk); out: diff --git a/net/xdp/xsk_queue.h b/net/xdp/xsk_queue.h index fb20bf7207cf..c6fb6b763658 100644 --- a/net/xdp/xsk_queue.h +++ b/net/xdp/xsk_queue.h @@ -205,6 +205,11 @@ static inline bool xskq_cons_read_desc(struct xsk_queue *q, return false; } +static inline void xskq_cons_release_n(struct xsk_queue *q, u32 cnt) +{ + q->cached_cons += cnt; +} + static inline u32 xskq_cons_read_desc_batch(struct xsk_queue *q, struct xsk_buff_pool *pool, u32 max) { @@ -226,6 +231,8 @@ static inline u32 xskq_cons_read_desc_batch(struct xsk_queue *q, struct xsk_buff cached_cons++; } + /* Release valid plus any invalid entries */ + xskq_cons_release_n(q, cached_cons - q->cached_cons); return nb_entries; } @@ -291,11 +298,6 @@ static inline void xskq_cons_release(struct xsk_queue *q) q->cached_cons++; } -static inline void xskq_cons_release_n(struct xsk_queue *q, u32 cnt) -{ - q->cached_cons += cnt; -} - static inline u32 xskq_cons_present_entries(struct xsk_queue *q) { /* No barriers needed since data is not accessed */ @@ -350,21 +352,17 @@ static inline int xskq_prod_reserve_addr(struct xsk_queue *q, u64 addr) return 0; } -static inline u32 xskq_prod_reserve_addr_batch(struct xsk_queue *q, struct xdp_desc *descs, - u32 max) +static inline void xskq_prod_write_addr_batch(struct xsk_queue *q, struct xdp_desc *descs, + u32 nb_entries) { struct xdp_umem_ring *ring = (struct xdp_umem_ring *)q->ring; - u32 nb_entries, i, cached_prod; - - nb_entries = xskq_prod_nb_free(q, max); + u32 i, cached_prod; /* A, matches D */ cached_prod = q->cached_prod; for (i = 0; i < nb_entries; i++) ring->desc[cached_prod++ & q->ring_mask] = descs[i].addr; q->cached_prod = cached_prod; - - return nb_entries; } static inline int xskq_prod_reserve_desc(struct xsk_queue *q, From patchwork Wed Oct 19 08:25: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: 4637 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212187wrs; Wed, 19 Oct 2022 02:06:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM40/VSbqnaXuTZv5oc8NZ1/kkhMUZ1YQ0L6pIXKwpGjqILai/WVItzgLXrgBnPfigUPIFwl X-Received: by 2002:a17:902:9a07:b0:178:8024:1393 with SMTP id v7-20020a1709029a0700b0017880241393mr7416754plp.128.1666170415352; Wed, 19 Oct 2022 02:06:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170415; cv=none; d=google.com; s=arc-20160816; b=PuymFUtjnrOCc7idCXvEQGDxJFinA/O81H9i/MtP2jcqI4On4dYJK/0VtwwzmDnVmN tyttR8K28xGiJHfajegvMLKPaoZpRvTdhQiTsQNN7HgHm4JbTfY5qLZuhgrSlNal/9lI Rx4/qDyIK6UZYbrEuYPzFySeq1BolNWgNDU7p9DCyy3dNc50qteAs2UuckZoNMUDd63H Y0UIbLcoNhyx7dIcMyFtwOjgL41f4OWik51w/JZcert5Wra8HT3+aCofU4doe12xoiAQ Y7pZf3NYUiFxvNnN3GIc8WiT0CNKxJXibppDMIUxh5dK5IttcTyhZaqsdRm1uWq11zCY tcFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=EQcSow+UjqoK5meE5wgXzlQ4RTS2s3cYi2NfPAuFfzU=; b=J7BfifeOlvmXgn5BKXlPM5lfpC46da6P6mAxHLcM2rjnUIPcoMPIgUhPZET6aIl3MH 7psNAwaY6fOCkfyo04ni8Z0KE1/N5edLSifS4BmkYyTVol3TdF7k6chMuCLs0DmhInCj uPZqTa2jQSPzOJXpPWrByMxDYke6kLXh3mnjjPyTT0g53k37meRaoxGYbzKmDQFPPvwF /SWGjmaM/6vpk8tUGJVktwUn6JTrjTUzAzzqIoyFIBZpQRv0UHRLKEdURlt/j/UyoQDw 4ZXvLjGm/cWpjc9gwIpWXyfXp2SWbGZVOlfbejbwI/q46ftDDJq/KhL8+B59qpFYhRO0 9eXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=spyKqjnA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a056a00081600b00557eeeb099csi18433895pfk.339.2022.10.19.02.06.35; Wed, 19 Oct 2022 02:06: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=spyKqjnA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231842AbiJSIxw (ORCPT + 99 others); Wed, 19 Oct 2022 04:53:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231840AbiJSIxI (ORCPT ); Wed, 19 Oct 2022 04: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 9AC8084E6D; Wed, 19 Oct 2022 01:50:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3D19461847; Wed, 19 Oct 2022 08:49:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4BFC1C433D6; Wed, 19 Oct 2022 08:49:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169373; bh=EQlopx31BUyrGQu0oSTme+DKanTOBlcrCtNgTG0TuYw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=spyKqjnAMoV7cSajhGgG0miGWeh5vw0bNnC/ztKfEV8jheLQOplUpaLdy+7xV574A 4+MseAQeZhGVAoOYNC2oL1MRr7hAlEyPlYL+f/aNd+2a0cZdz4/O3h+qTqvRQEIrgT KJN8BDhCjGjteGN1Ge6d8zmMf9Jo16z5teTbv5qs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maciej Fijalkowski , Daniel Borkmann , Magnus Karlsson , Sasha Levin Subject: [PATCH 6.0 252/862] selftests/xsk: Add missing close() on netns fd Date: Wed, 19 Oct 2022 10:25:39 +0200 Message-Id: <20221019083301.174955152@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106309407041581?= X-GMAIL-MSGID: =?utf-8?q?1747106309407041581?= From: Maciej Fijalkowski [ Upstream commit 8a7d61bdc2fac2c460a2f32a062f5c6dbd21a764 ] Commit 1034b03e54ac ("selftests: xsk: Simplify cleanup of ifobjects") removed close on netns fd, which is not correct, so let us restore it. Fixes: 1034b03e54ac ("selftests: xsk: Simplify cleanup of ifobjects") Signed-off-by: Maciej Fijalkowski Signed-off-by: Daniel Borkmann Acked-by: Magnus Karlsson Link: https://lore.kernel.org/bpf/20220830133905.9945-1-maciej.fijalkowski@intel.com Signed-off-by: Sasha Levin --- tools/testing/selftests/bpf/xskxceiver.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/testing/selftests/bpf/xskxceiver.c b/tools/testing/selftests/bpf/xskxceiver.c index 74d56d971baf..091402dc5390 100644 --- a/tools/testing/selftests/bpf/xskxceiver.c +++ b/tools/testing/selftests/bpf/xskxceiver.c @@ -1606,6 +1606,8 @@ static struct ifobject *ifobject_create(void) if (!ifobj->umem) goto out_umem; + ifobj->ns_fd = -1; + return ifobj; out_umem: @@ -1617,6 +1619,8 @@ static struct ifobject *ifobject_create(void) static void ifobject_delete(struct ifobject *ifobj) { + if (ifobj->ns_fd != -1) + close(ifobj->ns_fd); free(ifobj->umem); free(ifobj->xsk_arr); free(ifobj); From patchwork Wed Oct 19 08:25: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: 4617 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp211879wrs; Wed, 19 Oct 2022 02:06:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7EXtHa3/yizJwlIgurgfXzq5e/abBxwAM4oSIVwrZTrIeAMJZUjYvxmOGU/KH9edD7WYXv X-Received: by 2002:a17:907:a40f:b0:790:540c:b6e3 with SMTP id sg15-20020a170907a40f00b00790540cb6e3mr5874564ejc.41.1666170367503; Wed, 19 Oct 2022 02:06:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170367; cv=none; d=google.com; s=arc-20160816; b=Yf/i1HJLk+ZZ+WEh1WNxay7XMc5ChgFEiu4n+aykJL2MX9p4Enl7MD75UwuKFuwagD 2ls4cv+90gN1Y1NqjIz0WE+1bgbtm9tkpG5a4zxK1kodfA0ZTfCL8ZiltE/6CkuC/IZy aEB2Q9Z9VvnW6088quRoDIAU2GIzU9CzXVSM+pYfNH9HbyQQPFoQyXlgs3UQWm6FpXKo WEnQgopmEz7eQwpq4FOOzlpeIAQ1Jp556AtHMQ/sMyiqstbLiqCFK+g7NasTdHXijhVK Axx259sIjE3S7goboei0tXrokToR4ARdMTS3/7HeFwlrB5p/HRF7HVn1Yg7ZEPeO7eQB ujhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=EFDBE5nyGSrcm2tpyxMcW38Udd2tVoDal+DGm/2t2z0=; b=0eLkWwspXce5jqJRRaRtqMrhQb2e73ANrcRg5bYp2Cq8fBc6ZzPy2Q/WkLDVmq1Q9l jdHWD+XviQzfK8ECTn6eRTuYUX32aUH6zhecIxm/8MBGQspaf494DQ2kQiCB0MtUKUzA F8T9MXKJaZ1xE33Hi8AOg7ZSzoSRGi9kSbUYxpw4yPk1vS+cp5/ALtYwEMoC3+kSv8AI VANd36pmPOyPdkBwrTfx4KayhdVFTsK/5waCh6eeFuIYmofZSxVbbNh+L7euGpSAq6Ss WC56zLkgBM/mDNMNQo1W1affQ8eF/iouDiB9yC+Rp/79yNl1HJmcEPy8ITHBWqxPzHUC Ywww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="SkohTm/1"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170906644f00b00771d781fb88si11623038ejn.411.2022.10.19.02.05.35; Wed, 19 Oct 2022 02:06: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="SkohTm/1"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230059AbiJSIz0 (ORCPT + 99 others); Wed, 19 Oct 2022 04:55:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231788AbiJSIxm (ORCPT ); Wed, 19 Oct 2022 04:53:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E3EB8B2C0; Wed, 19 Oct 2022 01:50: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 DD9256184A; Wed, 19 Oct 2022 08:49:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F4025C433C1; Wed, 19 Oct 2022 08:49:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169376; bh=1AhSyl1Iu0oUeGTRso51nL9PiaJJ07eaewJREfqxWs8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SkohTm/1HCANiblnMzWGMr5VDWyIO4CQTvXnBTf+J2vQlP979t22ckEBej+7aM+K3 jYodt14gO7a6VAx6XGN/tVQX5AnJ5RG/YqdXEHAgwmhLh9Xitwf8OHbSkt8PKhxR0N Jip2vtNyUI4bc2abMLHEpRMe++jCUBcChYL26vIY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hao Luo , Hou Tao , Martin KaFai Lau , Sasha Levin Subject: [PATCH 6.0 253/862] bpf: Disable preemption when increasing per-cpu map_locked Date: Wed, 19 Oct 2022 10:25:40 +0200 Message-Id: <20221019083301.226018887@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106259545809610?= X-GMAIL-MSGID: =?utf-8?q?1747106259545809610?= From: Hou Tao [ Upstream commit 2775da21628738ce073a3a6a806adcbaada0f091 ] Per-cpu htab->map_locked is used to prohibit the concurrent accesses from both NMI and non-NMI contexts. But since commit 74d862b682f5 ("sched: Make migrate_disable/enable() independent of RT"), migrate_disable() is also preemptible under CONFIG_PREEMPT case, so now map_locked also disallows concurrent updates from normal contexts (e.g. userspace processes) unexpectedly as shown below: process A process B htab_map_update_elem() htab_lock_bucket() migrate_disable() /* return 1 */ __this_cpu_inc_return() /* preempted by B */ htab_map_update_elem() /* the same bucket as A */ htab_lock_bucket() migrate_disable() /* return 2, so lock fails */ __this_cpu_inc_return() return -EBUSY A fix that seems feasible is using in_nmi() in htab_lock_bucket() and only checking the value of map_locked for nmi context. But it will re-introduce dead-lock on bucket lock if htab_lock_bucket() is re-entered through non-tracing program (e.g. fentry program). One cannot use preempt_disable() to fix this issue as htab_use_raw_lock being false causes the bucket lock to be a spin lock which can sleep and does not work with preempt_disable(). Therefore, use migrate_disable() when using the spinlock instead of preempt_disable() and defer fixing concurrent updates to when the kernel has its own BPF memory allocator. Fixes: 74d862b682f5 ("sched: Make migrate_disable/enable() independent of RT") Reviewed-by: Hao Luo Signed-off-by: Hou Tao Link: https://lore.kernel.org/r/20220831042629.130006-2-houtao@huaweicloud.com Signed-off-by: Martin KaFai Lau Signed-off-by: Sasha Levin --- kernel/bpf/hashtab.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/kernel/bpf/hashtab.c b/kernel/bpf/hashtab.c index 6c530a5e560a..ad09da139589 100644 --- a/kernel/bpf/hashtab.c +++ b/kernel/bpf/hashtab.c @@ -162,17 +162,25 @@ static inline int htab_lock_bucket(const struct bpf_htab *htab, unsigned long *pflags) { unsigned long flags; + bool use_raw_lock; hash = hash & HASHTAB_MAP_LOCK_MASK; - migrate_disable(); + use_raw_lock = htab_use_raw_lock(htab); + if (use_raw_lock) + preempt_disable(); + else + migrate_disable(); if (unlikely(__this_cpu_inc_return(*(htab->map_locked[hash])) != 1)) { __this_cpu_dec(*(htab->map_locked[hash])); - migrate_enable(); + if (use_raw_lock) + preempt_enable(); + else + migrate_enable(); return -EBUSY; } - if (htab_use_raw_lock(htab)) + if (use_raw_lock) raw_spin_lock_irqsave(&b->raw_lock, flags); else spin_lock_irqsave(&b->lock, flags); @@ -185,13 +193,18 @@ static inline void htab_unlock_bucket(const struct bpf_htab *htab, struct bucket *b, u32 hash, unsigned long flags) { + bool use_raw_lock = htab_use_raw_lock(htab); + hash = hash & HASHTAB_MAP_LOCK_MASK; - if (htab_use_raw_lock(htab)) + if (use_raw_lock) raw_spin_unlock_irqrestore(&b->raw_lock, flags); else spin_unlock_irqrestore(&b->lock, flags); __this_cpu_dec(*(htab->map_locked[hash])); - migrate_enable(); + if (use_raw_lock) + preempt_enable(); + else + migrate_enable(); } static bool htab_lru_map_delete_node(void *arg, struct bpf_lru_node *node); From patchwork Wed Oct 19 08:25: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: 4713 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp213884wrs; Wed, 19 Oct 2022 02:11:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4tcDfXPvlikYdIs25TLEyhZ5gcKJQWgCxDnGbpgc9gwtJChww1r0ad6kY+U5Qik3jg8m1p X-Received: by 2002:a05:6402:3c5:b0:45b:55d8:21ff with SMTP id t5-20020a05640203c500b0045b55d821ffmr6455745edw.253.1666170681984; Wed, 19 Oct 2022 02:11:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170681; cv=none; d=google.com; s=arc-20160816; b=jfM0JK71YVE4vKxa0rQSUFRQkVWnWT6gQJSFXhVYVoPHYaPg3oQKspKqNd/hytSfh6 3uPTpPGOdT+/XRRoKn8mp/B3rH0x66CJ9o+Ee9VdoYAbbGSn7CPbxvJXKKWRH2WIBK+B SNq7SznlQ9lgHnKwz7CjL8ZjhiMXrw2Plp0v36ZUa9KbMXg737GBp+Kaq6gWoI6laY3V 3Gi+A+X1zOAKuGArSxF6eFdBLeEB7qpRfW8aNkL5E5A+oMSDbrP5fPWBJkF9beLpRLuK 7SIDhlGfaLjGgbtR2T+iq5Qe0r3fNhD5vNdRHFoqbHdiyFPw4u6SgrQT6T65+wcqVCJR t/4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=B8xFbSWI3Q/KI2+3yAXY6ILxH+VsePEyTPm6vJn9Tno=; b=Shfd/BgsifNusEAZMQNYHpQbrvAW6okopLc0RWqJ0L8tA9ZnohyRZvp6m9qVyBUjuW 4aNYOyUuTVXhC1XkVx0lar+vKZW7a1RqztDxsOynhtT07UAOvpbtLS6LxubleAWBsVLp S3xEftUGPK9fv4VDpTGD4YueBzPCCVwIcuFiKKpK7Hf4F85Kg6CyVbN4+2DKMQy58Frz 6xuVGEsQCzxbxJRUwejHE9dEj7BmpfaWHWjfA7w60hvKUl+wls8FVj8iB6Zsz22VKNvw Fxmy9nLK7N26azRiQb4CuvSIgpLvQUuRHm+43NijJQJOWkAnhgxbAPD5T37LfIfN4WOQ 5hfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UKYvfa06; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a056402278d00b0045ddb2076casi4007479ede.177.2022.10.19.02.10.56; Wed, 19 Oct 2022 02:11:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UKYvfa06; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232420AbiJSJHT (ORCPT + 99 others); Wed, 19 Oct 2022 05:07:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232735AbiJSJFA (ORCPT ); Wed, 19 Oct 2022 05:05: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 9CFAC80BE7; Wed, 19 Oct 2022 01:58:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6DDC461852; Wed, 19 Oct 2022 08:49:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 81EDEC433D7; Wed, 19 Oct 2022 08:49:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169378; bh=cWq4xP8NGRkzIrU/H+Fa2QHaOV3Z04pSDgZ9XoUKCLw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UKYvfa06Sjz5S6GBvBXckDcLfjfCIDwa3zbhFFofYvpfKOLoUX5a9bu5ILDvVg7kg qrGADoG8QkBjmioq8bP3nV4OzbB98iqhpZeFjGSIWtaNRqBSRhbnrmsNPWGSJbtv3k paB9al+SYAcqamZF2zofwIevrud9tccc1XHuupWw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hao Sun , Hou Tao , Martin KaFai Lau , Sasha Levin Subject: [PATCH 6.0 254/862] bpf: Propagate error from htab_lock_bucket() to userspace Date: Wed, 19 Oct 2022 10:25:41 +0200 Message-Id: <20221019083301.276436592@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106589423397750?= X-GMAIL-MSGID: =?utf-8?q?1747106589423397750?= From: Hou Tao [ Upstream commit 66a7a92e4d0d091e79148a4c6ec15d1da65f4280 ] In __htab_map_lookup_and_delete_batch() if htab_lock_bucket() returns -EBUSY, it will go to next bucket. Going to next bucket may not only skip the elements in current bucket silently, but also incur out-of-bound memory access or expose kernel memory to userspace if current bucket_cnt is greater than bucket_size or zero. Fixing it by stopping batch operation and returning -EBUSY when htab_lock_bucket() fails, and the application can retry or skip the busy batch as needed. Fixes: 20b6cc34ea74 ("bpf: Avoid hashtab deadlock with map_locked") Reported-by: Hao Sun Signed-off-by: Hou Tao Link: https://lore.kernel.org/r/20220831042629.130006-3-houtao@huaweicloud.com Signed-off-by: Martin KaFai Lau Signed-off-by: Sasha Levin --- kernel/bpf/hashtab.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/kernel/bpf/hashtab.c b/kernel/bpf/hashtab.c index ad09da139589..75f77df910dc 100644 --- a/kernel/bpf/hashtab.c +++ b/kernel/bpf/hashtab.c @@ -1704,8 +1704,11 @@ __htab_map_lookup_and_delete_batch(struct bpf_map *map, /* do not grab the lock unless need it (bucket_cnt > 0). */ if (locked) { ret = htab_lock_bucket(htab, b, batch, &flags); - if (ret) - goto next_batch; + if (ret) { + rcu_read_unlock(); + bpf_enable_instrumentation(); + goto after_loop; + } } bucket_cnt = 0; From patchwork Wed Oct 19 08:25: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: 4619 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp211888wrs; Wed, 19 Oct 2022 02:06:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7RThQb3ag+5XUvk8P2DOf5u2dfsLztyAgYPXEKRm8EOTtOsi0/A/sYI8uQ7MmflwlOMigM X-Received: by 2002:a17:906:9fc1:b0:761:9192:504f with SMTP id hj1-20020a1709069fc100b007619192504fmr5936625ejc.116.1666170369729; Wed, 19 Oct 2022 02:06:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170369; cv=none; d=google.com; s=arc-20160816; b=ddzrRoWzgao+pTE7WIjblruuHAz8HSiR234XjubmKdZY5maOvDf9Zdz5lnLXSG/xkC mzxNLgTxhbUt/MGnzuQ3V3BP4hWm25nPTMHgMqGFOXm2w2anjZSctHiUOlJcLsa84O8k WtHpcsXSx3MT/EI1U/21nfdip4tBmOCDwJNL8a4NdHfQBBiN4mHenhmWezKC4sRqy4Ij Cv6jPvU3EkonYs161a4gMiBFALmcQtG080GhHqUAu7/ZB4OV0FQf14Roa9zdAgm9JPbg kII6xbAqVSIeNIANz+ltvjDF4BANo+znJP+GIS2ULoUoqm9ueU18LewZelAHr621jlt2 gsBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uRfVZN634AXj9N1viR7LeWuiArfj95O2dQmbfj4x730=; b=h9Cqzfi9C+AWitZYElTdHwwkVkdLL5N0bMxM3F8NVtrjQJ6L20DsiX/Lk6J2dt7gBI M6C8khso0t4ULxMl5dsZsWhIJRNjm07Oo76vCmi14AtQ0gEw4Gj2NqYQ+ttE4UZ31RGp qW7OKsWjQHKafBdpk74mbBqMQ9g86MM4HDtI3HqY9FZMIIPhHFyDHEr/0/pIZS7v3Pj3 qT/4HiQLi8iFe/2RF1Hw67zUyq5E/zGs2UyHE/PxvpAXCHkahm2kEZmRCS91wgw38JyU A31UDqQcwB7M3Q8venkq1meURuVkzv2E9V3b+jOPingSJ8mf/9ld7bPw4jTu1wUw4ctS 8jUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0DPziJ7W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qa17-20020a170907869100b0078dec48d439si15666333ejc.590.2022.10.19.02.05.35; Wed, 19 Oct 2022 02:06: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=0DPziJ7W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231823AbiJSIz3 (ORCPT + 99 others); Wed, 19 Oct 2022 04:55:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231814AbiJSIxl (ORCPT ); Wed, 19 Oct 2022 04:53:41 -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 8E6E1900F3; Wed, 19 Oct 2022 01:50: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 dfw.source.kernel.org (Postfix) with ESMTPS id 252BA6185A; Wed, 19 Oct 2022 08:49:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 37B4FC433C1; Wed, 19 Oct 2022 08:49:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169381; bh=dpmfuil9lNxXifQSERoW/TzZX+NjtUzA3eqhEsAnYsE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0DPziJ7WQfx0ktEnMi1Mx9HPzNrlMClNnu9JjP/MgwfaYKyXY6o06DZGX4oIVCG53 B2xXETMur5w7ULUuoFPazhexWsmvh4AttcSuEzwzYdQ1GjUf2g7H0bsJh/YXLMtJ15 siwFyi4Qu/ix/H/kvti8OEWUjSrr4WmbppQmKsfE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Manikanta Pubbisetty , Kalle Valo , Sasha Levin Subject: [PATCH 6.0 255/862] wifi: ath11k: Fix incorrect QMI message ID mappings Date: Wed, 19 Oct 2022 10:25:42 +0200 Message-Id: <20221019083301.325933874@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106261847162207?= X-GMAIL-MSGID: =?utf-8?q?1747106261847162207?= From: Manikanta Pubbisetty [ Upstream commit b3ca32308e46b6384fdcb7e64b3fca4f61aff14b ] QMI message IDs for some of the QMI messages were incorrectly defined in the original implementation. These have to be corrected to enable cold boot support on WCN6750. These corrections are applicable for all chipsets and will not impact them. Refactor the code accordingly. Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1 Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices") Signed-off-by: Manikanta Pubbisetty Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220720134909.15626-2-quic_mpubbise@quicinc.com Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath11k/qmi.c | 38 ++++++++++++++++++++++++--- drivers/net/wireless/ath/ath11k/qmi.h | 10 +++++-- 2 files changed, 43 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/qmi.c b/drivers/net/wireless/ath/ath11k/qmi.c index 00136601cb7d..e6ced8597e1d 100644 --- a/drivers/net/wireless/ath/ath11k/qmi.c +++ b/drivers/net/wireless/ath/ath11k/qmi.c @@ -1696,6 +1696,13 @@ static struct qmi_elem_info qmi_wlanfw_wlan_ini_resp_msg_v01_ei[] = { }, }; +static struct qmi_elem_info qmi_wlfw_fw_init_done_ind_msg_v01_ei[] = { + { + .data_type = QMI_EOTI, + .array_type = NO_ARRAY, + }, +}; + static int ath11k_qmi_host_cap_send(struct ath11k_base *ab) { struct qmi_wlanfw_host_cap_req_msg_v01 req; @@ -3006,6 +3013,10 @@ static void ath11k_qmi_msg_fw_ready_cb(struct qmi_handle *qmi_hdl, struct ath11k_base *ab = qmi->ab; ath11k_dbg(ab, ATH11K_DBG_QMI, "qmi firmware ready\n"); + + ab->qmi.cal_done = 1; + wake_up(&ab->qmi.cold_boot_waitq); + ath11k_qmi_driver_event_post(qmi, ATH11K_QMI_EVENT_FW_READY, NULL); } @@ -3018,11 +3029,22 @@ static void ath11k_qmi_msg_cold_boot_cal_done_cb(struct qmi_handle *qmi_hdl, struct ath11k_qmi, handle); struct ath11k_base *ab = qmi->ab; - ab->qmi.cal_done = 1; - wake_up(&ab->qmi.cold_boot_waitq); ath11k_dbg(ab, ATH11K_DBG_QMI, "qmi cold boot calibration done\n"); } +static void ath11k_qmi_msg_fw_init_done_cb(struct qmi_handle *qmi_hdl, + struct sockaddr_qrtr *sq, + struct qmi_txn *txn, + const void *decoded) +{ + struct ath11k_qmi *qmi = container_of(qmi_hdl, + struct ath11k_qmi, handle); + struct ath11k_base *ab = qmi->ab; + + ath11k_qmi_driver_event_post(qmi, ATH11K_QMI_EVENT_FW_INIT_DONE, NULL); + ath11k_dbg(ab, ATH11K_DBG_QMI, "qmi firmware init done\n"); +} + static const struct qmi_msg_handler ath11k_qmi_msg_handlers[] = { { .type = QMI_INDICATION, @@ -3053,6 +3075,14 @@ static const struct qmi_msg_handler ath11k_qmi_msg_handlers[] = { sizeof(struct qmi_wlanfw_fw_cold_cal_done_ind_msg_v01), .fn = ath11k_qmi_msg_cold_boot_cal_done_cb, }, + { + .type = QMI_INDICATION, + .msg_id = QMI_WLFW_FW_INIT_DONE_IND_V01, + .ei = qmi_wlfw_fw_init_done_ind_msg_v01_ei, + .decoded_size = + sizeof(struct qmi_wlfw_fw_init_done_ind_msg_v01), + .fn = ath11k_qmi_msg_fw_init_done_cb, + }, }; static int ath11k_qmi_ops_new_server(struct qmi_handle *qmi_hdl, @@ -3145,7 +3175,7 @@ static void ath11k_qmi_driver_event_work(struct work_struct *work) } break; - case ATH11K_QMI_EVENT_FW_READY: + case ATH11K_QMI_EVENT_FW_INIT_DONE: clear_bit(ATH11K_FLAG_QMI_FAIL, &ab->dev_flags); if (test_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags)) { ath11k_hal_dump_srng_stats(ab); @@ -3168,6 +3198,8 @@ static void ath11k_qmi_driver_event_work(struct work_struct *work) set_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags); } + break; + case ATH11K_QMI_EVENT_FW_READY: break; case ATH11K_QMI_EVENT_COLD_BOOT_CAL_DONE: break; diff --git a/drivers/net/wireless/ath/ath11k/qmi.h b/drivers/net/wireless/ath/ath11k/qmi.h index c83cf822be81..2ec56a34fa81 100644 --- a/drivers/net/wireless/ath/ath11k/qmi.h +++ b/drivers/net/wireless/ath/ath11k/qmi.h @@ -31,8 +31,9 @@ #define QMI_WLFW_REQUEST_MEM_IND_V01 0x0035 #define QMI_WLFW_FW_MEM_READY_IND_V01 0x0037 -#define QMI_WLFW_COLD_BOOT_CAL_DONE_IND_V01 0x0021 -#define QMI_WLFW_FW_READY_IND_V01 0x0038 +#define QMI_WLFW_COLD_BOOT_CAL_DONE_IND_V01 0x003E +#define QMI_WLFW_FW_READY_IND_V01 0x0021 +#define QMI_WLFW_FW_INIT_DONE_IND_V01 0x0038 #define QMI_WLANFW_MAX_DATA_SIZE_V01 6144 #define ATH11K_FIRMWARE_MODE_OFF 4 @@ -69,6 +70,7 @@ enum ath11k_qmi_event_type { ATH11K_QMI_EVENT_FORCE_FW_ASSERT, ATH11K_QMI_EVENT_POWER_UP, ATH11K_QMI_EVENT_POWER_DOWN, + ATH11K_QMI_EVENT_FW_INIT_DONE, ATH11K_QMI_EVENT_MAX, }; @@ -291,6 +293,10 @@ struct qmi_wlanfw_fw_cold_cal_done_ind_msg_v01 { char placeholder; }; +struct qmi_wlfw_fw_init_done_ind_msg_v01 { + char placeholder; +}; + #define QMI_WLANFW_CAP_REQ_MSG_V01_MAX_LEN 0 #define QMI_WLANFW_CAP_RESP_MSG_V01_MAX_LEN 235 #define QMI_WLANFW_CAP_REQ_V01 0x0024 From patchwork Wed Oct 19 08:25: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: 5570 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp350544wrs; Wed, 19 Oct 2022 07:13:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4TiYi37BlssTYntVLO9F8qV2H86AmjdcAW3cfzPFI3yP/hv4C8fRfs7DTT89Fo40pVRgFC X-Received: by 2002:a17:90b:254c:b0:20a:8a92:ea5b with SMTP id nw12-20020a17090b254c00b0020a8a92ea5bmr10042861pjb.81.1666188834770; Wed, 19 Oct 2022 07:13:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666188834; cv=none; d=google.com; s=arc-20160816; b=wVDvLyV6bHcIaFUQ9mwky7NLrCbKeyVOqBJH6WsWwqD6T1Voq1Av5a8BxE17rrCV23 Lh7VoTuqT5LMfnKvNI0rGA/bIOOyo4/nFGgxEhjmOC1tdbsIRMT8kz5TMVCfN7D1F0y8 b7QOW9DMwXfYNh5Me+9lY9rY5YMwZP+ZmVHc/IvJo1YBR/NW86KifSj24gJPA74hsWfj b9KlTE0M6QxTNlVXaEIhwQMX0exAlI+cySumkLGqpWUY8LRpwp9pVVvSFwq3cQjb+xmi /dI0Qa+8XKMUzBbhfa5rY5OwJ3u9MB4iEiS2y+N2nrGydE5KpWZPaLcuXPYsDBu9c7Vh UFkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=P8mjak5nTDJH0TaxJk3QWYe/p1OZ6iGjt0fYIhsGcuw=; b=sSToEqxSMFGzFPekxIKBGpDPnfCZY+D4QvLvCCVvu1nQvA1wh3WwBlyQLolr/TrMIA j/3aNNKkw8ahWLYfSggyVYbmWJCJdsltPULaBwufHtQKYhxlhVsu0fKvsoemMI+YEbsS 8JDRNmAyGBGgZ2ZDgJbOBlaBXt3SG9D8T+u+6Q0U0ryVxlXFa5zB7/n9bMRrxaeahpwB csw6fmfKD4JfYCTyj881SmyYW4gPf597lW79yIMq8VSVqcqH3XYPH/HGio9TeYP4u/a7 ii4u35Kz2as5cZIxCM6QR+PixAqPdCZaJoW7jT46LcqTWerumECzvbZ5P57lCd2b3n/3 TeWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Z6I+mDO5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z10-20020a170902d54a00b001769f4909b4si18569820plf.356.2022.10.19.07.13.30; Wed, 19 Oct 2022 07:13:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Z6I+mDO5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233888AbiJSN67 (ORCPT + 99 others); Wed, 19 Oct 2022 09:58:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234248AbiJSNz3 (ORCPT ); Wed, 19 Oct 2022 09: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 7CD98132DFC; Wed, 19 Oct 2022 06:38: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 649DEB82338; Wed, 19 Oct 2022 08:49:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD20AC433D6; Wed, 19 Oct 2022 08:49:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169384; bh=fOZI99R9xfcgoIm40CdSm7/zmpiNb38vJN2fwxj97xQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z6I+mDO5PSD7DvnhvBuLwjUd+IkuOgj78a66Pu3aORz+Alga0SBBHXz4p9MZ7xSpa jxNCgLIjAeSf5VASxlyx/ia/jY3M8zQ6+itaT/IOeTTWvtx4JurKIIgDbrdkkWs7KL 3NU8VH6/URODpMPS+droH2WbfnN2gROJzRJ5Xmz0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hou Tao , Alexei Starovoitov , Martin KaFai Lau , Sasha Levin Subject: [PATCH 6.0 256/862] bpf: Use this_cpu_{inc|dec|inc_return} for bpf_task_storage_busy Date: Wed, 19 Oct 2022 10:25:43 +0200 Message-Id: <20221019083301.365324583@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747125623310296437?= X-GMAIL-MSGID: =?utf-8?q?1747125623310296437?= From: Hou Tao [ Upstream commit 197827a05e13808c60f52632e9887eede63f1c16 ] Now migrate_disable() does not disable preemption and under some architectures (e.g. arm64) __this_cpu_{inc|dec|inc_return} are neither preemption-safe nor IRQ-safe, so for fully preemptible kernel concurrent lookups or updates on the same task local storage and on the same CPU may make bpf_task_storage_busy be imbalanced, and bpf_task_storage_trylock() on the specific cpu will always fail. Fixing it by using this_cpu_{inc|dec|inc_return} when manipulating bpf_task_storage_busy. Fixes: bc235cdb423a ("bpf: Prevent deadlock from recursive bpf_task_storage_[get|delete]") Signed-off-by: Hou Tao Acked-by: Alexei Starovoitov Link: https://lore.kernel.org/r/20220901061938.3789460-2-houtao@huaweicloud.com Signed-off-by: Martin KaFai Lau Signed-off-by: Sasha Levin --- kernel/bpf/bpf_local_storage.c | 4 ++-- kernel/bpf/bpf_task_storage.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/kernel/bpf/bpf_local_storage.c b/kernel/bpf/bpf_local_storage.c index 8ce40fd869f6..d13ffb00e981 100644 --- a/kernel/bpf/bpf_local_storage.c +++ b/kernel/bpf/bpf_local_storage.c @@ -555,11 +555,11 @@ void bpf_local_storage_map_free(struct bpf_local_storage_map *smap, struct bpf_local_storage_elem, map_node))) { if (busy_counter) { migrate_disable(); - __this_cpu_inc(*busy_counter); + this_cpu_inc(*busy_counter); } bpf_selem_unlink(selem, false); if (busy_counter) { - __this_cpu_dec(*busy_counter); + this_cpu_dec(*busy_counter); migrate_enable(); } cond_resched_rcu(); diff --git a/kernel/bpf/bpf_task_storage.c b/kernel/bpf/bpf_task_storage.c index e9014dc62682..6f290623347e 100644 --- a/kernel/bpf/bpf_task_storage.c +++ b/kernel/bpf/bpf_task_storage.c @@ -26,20 +26,20 @@ static DEFINE_PER_CPU(int, bpf_task_storage_busy); static void bpf_task_storage_lock(void) { migrate_disable(); - __this_cpu_inc(bpf_task_storage_busy); + this_cpu_inc(bpf_task_storage_busy); } static void bpf_task_storage_unlock(void) { - __this_cpu_dec(bpf_task_storage_busy); + this_cpu_dec(bpf_task_storage_busy); migrate_enable(); } static bool bpf_task_storage_trylock(void) { migrate_disable(); - if (unlikely(__this_cpu_inc_return(bpf_task_storage_busy) != 1)) { - __this_cpu_dec(bpf_task_storage_busy); + if (unlikely(this_cpu_inc_return(bpf_task_storage_busy) != 1)) { + this_cpu_dec(bpf_task_storage_busy); migrate_enable(); return false; } From patchwork Wed Oct 19 08:25: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: 5558 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp349914wrs; Wed, 19 Oct 2022 07:12:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6FAOFFno99/SHak+9WcOtnqGvlDDHJ3ttbNmy0jH+ijYwDA6FE1zO0bH7b+w4m2kh/dawI X-Received: by 2002:a17:902:f78c:b0:17a:ef1:e902 with SMTP id q12-20020a170902f78c00b0017a0ef1e902mr8568110pln.5.1666188762860; Wed, 19 Oct 2022 07:12:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666188762; cv=none; d=google.com; s=arc-20160816; b=CNxq4e/kQfWpE57OMBTuPvKJujRPxugIrBwUy0VOTdp4DJCif/htnF/458eYgbsu81 ybBhxPNG9bExZcCUiCrTH1NNCuQmQzOo9m7Q0gW2RLysWtdCFzakUWem6AJYSsv3nUOo DtfB0ce5ofHntYE+wnkPiJBPj8hXcTK+hNdUhzwGakfw6lPIjaMTwQugkMzV58O2jHDL iRwEnYYJmkqupg2wwXJ8kGxpK4PmMwWMUsYPnuH4pIaUm5DA9ywDNkuYvS3hcVnX8QBS j5F0bU9BOzbQxL/pZriIlEGFOapeVM4WI/3a9A54xm935xo4ZKK1JKB5Jm67QT0Z3SXZ DMeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=t8U78CrPaII5mcDpQrc7pVPzmGmws8mbFikncnOMiDs=; b=mkLUjC4rZiKi9E4bIRfrzbrj4uAiR72ynUW9Ecm1a/dGDcf76z1Vb8rM8y7wvPkXuD rZW/AW4hHdsGiauS3H291Ud5PQ8IlphrlT7aU6lnvUZAk4U522c1PdQUsoxOOO5OxQRb pcBO1EskTIUCctsI/KpU4DjXw2V2OiYIHavPbDUNrAna0CeA5QZUuT47BiAtQrMMY6Qf O6tmzqSUWnVCYWGa3pQM0cr0fifbolc1M89EVQZsn2hGYvZVbnTChxyLjyo3hzGHDn/q EofFBtmll6DlVNWyhiPCJA8xNz/DwQfg3YWKdBbfta58oWQHwWWu2u8++RggFzwYp0np Hlzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vZJOy68s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a17090301cb00b001787f1922a7si23457334plh.19.2022.10.19.07.12.22; Wed, 19 Oct 2022 07:12: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=vZJOy68s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230063AbiJSN6a (ORCPT + 99 others); Wed, 19 Oct 2022 09:58:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234010AbiJSNyf (ORCPT ); Wed, 19 Oct 2022 09:54:35 -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 A41AC1DDC1D; Wed, 19 Oct 2022 06:37: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 081FAB82337; Wed, 19 Oct 2022 08:49:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6BF7FC433D7; Wed, 19 Oct 2022 08:49:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169386; bh=wQ4vvWEZ6w/RYnBZK7uYJgLompeNljXKcXo+SrdSuZc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vZJOy68sTzVZ5fdyI9kWgap0R8lusm9AulZ5eG6Y2yMIX+dzLJqA6FYkmXMG0d6pJ LZxURLjj4n8MSCe68VqLpWzKbJ+wnGbZv1maBD191kSWxowKyAEV3KqDciBP5C0Jga BrE+xmClkyuA+DI3dpwgB5R/B/+IXXzlqr3Ev7u4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hou Tao , Alexei Starovoitov , Martin KaFai Lau , Sasha Levin Subject: [PATCH 6.0 257/862] bpf: Use this_cpu_{inc_return|dec} for prog->active Date: Wed, 19 Oct 2022 10:25:44 +0200 Message-Id: <20221019083301.406438627@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747125548230738787?= X-GMAIL-MSGID: =?utf-8?q?1747125548230738787?= From: Hou Tao [ Upstream commit c89e843a11f1075d27684f6b42256213e4592383 ] Both __this_cpu_inc_return() and __this_cpu_dec() are not preemption safe and now migrate_disable() doesn't disable preemption, so the update of prog-active is not atomic and in theory under fully preemptible kernel recurisve prevention may do not work. Fixing by using the preemption-safe and IRQ-safe variants. Fixes: ca06f55b9002 ("bpf: Add per-program recursion prevention mechanism") Signed-off-by: Hou Tao Acked-by: Alexei Starovoitov Link: https://lore.kernel.org/r/20220901061938.3789460-3-houtao@huaweicloud.com Signed-off-by: Martin KaFai Lau Signed-off-by: Sasha Levin --- kernel/bpf/trampoline.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kernel/bpf/trampoline.c b/kernel/bpf/trampoline.c index ff87e38af8a7..ad76940b02cc 100644 --- a/kernel/bpf/trampoline.c +++ b/kernel/bpf/trampoline.c @@ -895,7 +895,7 @@ u64 notrace __bpf_prog_enter(struct bpf_prog *prog, struct bpf_tramp_run_ctx *ru run_ctx->saved_run_ctx = bpf_set_run_ctx(&run_ctx->run_ctx); - if (unlikely(__this_cpu_inc_return(*(prog->active)) != 1)) { + if (unlikely(this_cpu_inc_return(*(prog->active)) != 1)) { inc_misses_counter(prog); return 0; } @@ -930,7 +930,7 @@ void notrace __bpf_prog_exit(struct bpf_prog *prog, u64 start, struct bpf_tramp_ bpf_reset_run_ctx(run_ctx->saved_run_ctx); update_prog_stats(prog, start); - __this_cpu_dec(*(prog->active)); + this_cpu_dec(*(prog->active)); migrate_enable(); rcu_read_unlock(); } @@ -966,7 +966,7 @@ u64 notrace __bpf_prog_enter_sleepable(struct bpf_prog *prog, struct bpf_tramp_r migrate_disable(); might_fault(); - if (unlikely(__this_cpu_inc_return(*(prog->active)) != 1)) { + if (unlikely(this_cpu_inc_return(*(prog->active)) != 1)) { inc_misses_counter(prog); return 0; } @@ -982,7 +982,7 @@ void notrace __bpf_prog_exit_sleepable(struct bpf_prog *prog, u64 start, bpf_reset_run_ctx(run_ctx->saved_run_ctx); update_prog_stats(prog, start); - __this_cpu_dec(*(prog->active)); + this_cpu_dec(*(prog->active)); migrate_enable(); rcu_read_unlock_trace(); } From patchwork Wed Oct 19 08:25: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: 4755 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214682wrs; Wed, 19 Oct 2022 02:13:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4sKJMjlYN7o1vWecyw95msjfYl23uRTk+tyG0ZtYYEMBi5X0POI2YaMYobXpL+xAJXWyFf X-Received: by 2002:a17:907:728c:b0:78e:2856:7fed with SMTP id dt12-20020a170907728c00b0078e28567fedmr5927950ejc.2.1666170810643; Wed, 19 Oct 2022 02:13:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170810; cv=none; d=google.com; s=arc-20160816; b=Nn9A5CGELVdnutVrL33dFsirod6mi+KJ7FfRvqynpQcwzZuz38JXf8UPu1/hePv+Vr P8i8wnzNJkvijXXitRI+A3QxcEitjLg3PnSbEHNpfM0Q7fOiIiveo9HVvFcGafaeDLzP MhJ7GNQmrzvWZQxgfKYLvM5NyXtYnJNoAyd/yUf9UlKdNLgCHhoSq5Td95Egz5cnzugQ n0LRodELniByBD6XWOhw7DqoPrI553IMkGvvbvVGkvr18IWZmSXcdwd89rdca1/mLgY9 UyCjPAGpATz+MPCUFhN2h7fyOfhRKYeivqdUAhr1I+1idBukW6p33SmhdwwdlkyWhsRc /Igg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Pj1Lho5NIF0e2ry22f0mwYwi4/33CqvzJ3CbZx6e22c=; b=F9/8KQdro0xOJJf9S53Cz1hk/GVvQeyalf6jWRvgGCZN7dXGFpMAhNO9B8I2Bm1E7F TylLTyB0CZGbt5YOiw/FBiRYqjf3Xah8TeUO00ABpb+yDtBIoTpVTDTHjOOFxX5slNuT 8Min9IJbKuC0qCIS1YJMzpbkYcysqhR2ZXgTZr6I+e+pu+nL0iUt8U3luH+ad+e71XkO VCedHKAQvSfQGXQ9GSMeYkmP/Q+KDcwcijAYIX32v+3AF3DbAjl+tStkUr54ffVU9HKv ldUenVPzlfswKuKkRHNPlbkFRd/LLhe2frYcL99PcYpXYEX2tFiGxCIN+6zhnurPovlm 3udA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DRMo3F2R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170907a41400b007918f4994f4si9092277ejc.15.2022.10.19.02.13.05; Wed, 19 Oct 2022 02:13:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DRMo3F2R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232761AbiJSJJN (ORCPT + 99 others); Wed, 19 Oct 2022 05:09:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230020AbiJSJGX (ORCPT ); Wed, 19 Oct 2022 05:06:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C14EAB1C6; Wed, 19 Oct 2022 01:59: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 0A9086170D; Wed, 19 Oct 2022 08:49:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22837C433D6; Wed, 19 Oct 2022 08:49:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169389; bh=/qX+V962Z8ffZqgBaFS68MdpEU2Mzq0Z63D7zxH9BVk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DRMo3F2RQQtHwRJJmohBHWV8/e/J8QowBrjcsCDFla/HyKoSTlDjZhy+QH6SMfpIN Wpki8o6lpDUrBz+gmO3F6b1kxZusPIUkvxFpqzV6bSHWfRLjKpeBwna6UKNd+dD0zw fOzeem+wKa/uAAH1UiudK5d98L42UHplr9BHIfw8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jing Cai , Sean Wang , Luiz Augusto von Dentz , Sasha Levin Subject: [PATCH 6.0 258/862] Bluetooth: btusb: mediatek: fix WMT failure during runtime suspend Date: Wed, 19 Oct 2022 10:25:45 +0200 Message-Id: <20221019083301.453642654@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106723838924094?= X-GMAIL-MSGID: =?utf-8?q?1747106723838924094?= From: Sean Wang [ Upstream commit fd3f106677bac70437dc12e76c827294ed495a44 ] WMT cmd/event doesn't follow up the generic HCI cmd/event handling, it needs constantly polling control pipe until the host received the WMT event, thus, we should require to specifically acquire PM counter on the USB to prevent the interface from entering auto suspended while WMT cmd/event in progress. Fixes: a1c49c434e15 ("Bluetooth: btusb: Add protocol support for MediaTek MT7668U USB devices") Co-developed-by: Jing Cai Signed-off-by: Jing Cai Signed-off-by: Sean Wang Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin --- drivers/bluetooth/btusb.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 15caa6469538..1bb46cbff0fa 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -2477,15 +2477,29 @@ static int btusb_mtk_hci_wmt_sync(struct hci_dev *hdev, set_bit(BTUSB_TX_WAIT_VND_EVT, &data->flags); + /* WMT cmd/event doesn't follow up the generic HCI cmd/event handling, + * it needs constantly polling control pipe until the host received the + * WMT event, thus, we should require to specifically acquire PM counter + * on the USB to prevent the interface from entering auto suspended + * while WMT cmd/event in progress. + */ + err = usb_autopm_get_interface(data->intf); + if (err < 0) + goto err_free_wc; + err = __hci_cmd_send(hdev, 0xfc6f, hlen, wc); if (err < 0) { clear_bit(BTUSB_TX_WAIT_VND_EVT, &data->flags); + usb_autopm_put_interface(data->intf); goto err_free_wc; } /* Submit control IN URB on demand to process the WMT event */ err = btusb_mtk_submit_wmt_recv_urb(hdev); + + usb_autopm_put_interface(data->intf); + if (err < 0) goto err_free_wc; From patchwork Wed Oct 19 08:25: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: 4618 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp211890wrs; Wed, 19 Oct 2022 02:06:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7UpumzhG5gdZWwGOsaeafCvXS6gTzb+U9ks2Y27AoL8srxgZv3D+8n7emfhiYV4M2RQEVu X-Received: by 2002:a50:fc0a:0:b0:458:73c0:7e04 with SMTP id i10-20020a50fc0a000000b0045873c07e04mr6265647edr.270.1666170369903; Wed, 19 Oct 2022 02:06:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170369; cv=none; d=google.com; s=arc-20160816; b=sPN3ZS3w3bUVYVtFkXnIfX4qDV5M5gjkP62HNIlvFsrZLL7tH21EXanQ7MjxxYp34s hKhPVDCQQsZdOIJ5PoqQOm8AlrACxO0kSco/4M52LonF5PKXuEB1eSc7RwtxhpytFPzE aZ+6iCOH/mqowwJUbfViIl6T/6izcPJaLs+LE9mctK68ECmySffZSY7D+010Ek2bNsbZ BxHFBVtw7Sun+OmiRACyTqfxFABMIfS8sYqgks/PnRFV/+Q9JbsMYHY8CcZgm223r3Dc q5EITo+aXDQKkgBThC3gYIiWXBp3/SOYuBvk1NGzLjj2oSobc1j8qZqKxzF1NOlcbd9U Ec9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Uule/x24T85sk+sPvC7kNsdOIXK+mUzKYxSrfQNeKCQ=; b=Mf1oKYOn0lEsH2v3cL5VQwnBJa+1C7wxukSQNQ3xSNu/TWAlXe/yxINjJoHiwUfCWr ABWmpQWKgL2Ib0rEBL1Jf/YjR3V2Q/cMHbIhO5fZtfpxK7AROUtb4HmadXuVdYG8NtMo ZtBzO1E1HeT+ArdHhg9RVJKcbxtCGVvAq6luo0xddFrP9mC+kDwZWJDFqFLL+UBT3qBm UrcnetIsfIbGCe1Y7EIkSE6k7jeZoHhP6OGqZZZP2h8fCzkRfsfeK82GYkIlomDjCTQL 6kwaD4QNOXO3QiLrU6711X/oKubn/5ZqgZyN3AGBS82ju73OB8/0AofClnw5MhwJkLpb Wf+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uqch9o4N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q14-20020a056402248e00b00456d901922bsi13669732eda.510.2022.10.19.02.05.36; Wed, 19 Oct 2022 02:06: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=uqch9o4N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231848AbiJSIzi (ORCPT + 99 others); Wed, 19 Oct 2022 04:55:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231913AbiJSIyI (ORCPT ); Wed, 19 Oct 2022 04:54:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A8A52B1; Wed, 19 Oct 2022 01:50:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3B3AE6182F; Wed, 19 Oct 2022 08:49:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F6C5C433C1; Wed, 19 Oct 2022 08:49:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169394; bh=U6DIaa+5l2qaU6zxdowNtd6QAph7Rp5mOlckEM155/o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uqch9o4NRm6KEokI3y4RPgKlEhUJni/LemTje4jW5HrQl9jxbz71xPPHVRKao+Jv7 WRGXxyPR2I57lGviaNTt7TkokABAWkYo17BUw7a4zUYCY6U29lEcyWOE39GQL61ONR 3hsOHEWg5CAHbsc3nj9aGEEADMtLCoEvpKHySjJc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hou Tao , Martin KaFai Lau , Sasha Levin Subject: [PATCH 6.0 259/862] bpf: Only add BTF IDs for socket security hooks when CONFIG_SECURITY_NETWORK is on Date: Wed, 19 Oct 2022 10:25:46 +0200 Message-Id: <20221019083301.485339855@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106261574565542?= X-GMAIL-MSGID: =?utf-8?q?1747106261574565542?= From: Hou Tao [ Upstream commit ef331a8d4c0061ea4d353cd0db1c9b33fd45f0f2 ] When CONFIG_SECURITY_NETWORK is disabled, there will be build warnings from resolve_btfids: WARN: resolve_btfids: unresolved symbol bpf_lsm_socket_socketpair ...... WARN: resolve_btfids: unresolved symbol bpf_lsm_inet_conn_established Fixing it by wrapping these BTF ID definitions by CONFIG_SECURITY_NETWORK. Fixes: 69fd337a975c ("bpf: per-cgroup lsm flavor") Fixes: 9113d7e48e91 ("bpf: expose bpf_{g,s}etsockopt to lsm cgroup") Signed-off-by: Hou Tao Link: https://lore.kernel.org/r/20220901065126.3856297-1-houtao@huaweicloud.com Signed-off-by: Martin KaFai Lau Signed-off-by: Sasha Levin --- kernel/bpf/bpf_lsm.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/kernel/bpf/bpf_lsm.c b/kernel/bpf/bpf_lsm.c index fa71d58b7ded..832a0e48a2a1 100644 --- a/kernel/bpf/bpf_lsm.c +++ b/kernel/bpf/bpf_lsm.c @@ -41,17 +41,21 @@ BTF_SET_END(bpf_lsm_hooks) */ BTF_SET_START(bpf_lsm_current_hooks) /* operate on freshly allocated sk without any cgroup association */ +#ifdef CONFIG_SECURITY_NETWORK BTF_ID(func, bpf_lsm_sk_alloc_security) BTF_ID(func, bpf_lsm_sk_free_security) +#endif BTF_SET_END(bpf_lsm_current_hooks) /* List of LSM hooks that trigger while the socket is properly locked. */ BTF_SET_START(bpf_lsm_locked_sockopt_hooks) +#ifdef CONFIG_SECURITY_NETWORK BTF_ID(func, bpf_lsm_socket_sock_rcv_skb) BTF_ID(func, bpf_lsm_sock_graft) BTF_ID(func, bpf_lsm_inet_csk_clone) BTF_ID(func, bpf_lsm_inet_conn_established) +#endif BTF_SET_END(bpf_lsm_locked_sockopt_hooks) /* List of LSM hooks that trigger while the socket is _not_ locked, @@ -59,8 +63,10 @@ BTF_SET_END(bpf_lsm_locked_sockopt_hooks) * in the early init phase. */ BTF_SET_START(bpf_lsm_unlocked_sockopt_hooks) +#ifdef CONFIG_SECURITY_NETWORK BTF_ID(func, bpf_lsm_socket_post_create) BTF_ID(func, bpf_lsm_socket_socketpair) +#endif BTF_SET_END(bpf_lsm_unlocked_sockopt_hooks) #ifdef CONFIG_CGROUP_BPF From patchwork Wed Oct 19 08:25: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: 4900 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225567wrs; Wed, 19 Oct 2022 02:43:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM53rww+Qxm//pid7GfvgxmtCzNXOl+BWjl3lkdePM7xhdV8Ydsxcsq4t2bhhwUXjRQNGsIq X-Received: by 2002:a17:907:3181:b0:787:d81c:a6ad with SMTP id xe1-20020a170907318100b00787d81ca6admr5941499ejb.769.1666172606038; Wed, 19 Oct 2022 02:43:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172606; cv=none; d=google.com; s=arc-20160816; b=ZW39d505Zui/o1IlKNPj7nRTD/arvWAnlqq4ex+BRRSycD3wEQlC8IBzRwEvqD2Wr5 HTMnEqv9855sUsdb10KkOY9WDGx2Sy0PSE5YwQ7bzWDshDqCzyPuigDjG/D25Vv141JC JfkEin6bUkZRkr4joBJvDdxwt4qA+8XDQqa++yjL9UMcW5wXA5EMCcckZYTJZTW2Tbnh YNVF6D7NTMmMlFc6kRLRCfWsicJeGJJzHTfhwDmoDXDNrOKC11ro2HA/TGW8yhZXHztG T9RH73BbpVkX4l3A4FzY1W2l4c+YSrhFdaqjMzaghNLYKmmYM4SbmL8AKUs8NLAny56A 7SuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YpXg8/w1vmZARK6nmwtXr1AHLKukkApciuM0pi3pCjE=; b=L0tM38vney9YJwLDqWJoAyuPXsZTx97fl+0tW8v/f9ayJV/yYsoP2lJfkh+i00i/dU mMxXBD8S3lPKm8zOgG6p0RfbmMWAzVfhc32K0ddYxGEX2IaAPUSlB92/by1M04ghD+PE XgZPONXlmYDm09r7Ce95uWLaaxO8p8WibMChy4rzO2C9ToEtojPfIuvYzDE5l09Q8XS1 f76dYOSfs/pkYQ61QWhRc8U3yRYA4ZJaVQ2e9HSLqK8cfsz++z/shS9GC5Rk7CQbIFIR gE+la8FfuCLdPtqpYjOFET01eMCx2C2ZZfUbfT607R9jlUYO4oievVI3SD+uZLO8+99j 9Stw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AkkoVOIe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qf22-20020a1709077f1600b0073fc8e72882si13540939ejc.28.2022.10.19.02.42.58; Wed, 19 Oct 2022 02:43: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=AkkoVOIe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230064AbiJSJfE (ORCPT + 99 others); Wed, 19 Oct 2022 05:35:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233843AbiJSJ3i (ORCPT ); Wed, 19 Oct 2022 05:29:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 246C0BBF26; Wed, 19 Oct 2022 02:13: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 009D9617B0; Wed, 19 Oct 2022 08:49:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 15C93C433D6; Wed, 19 Oct 2022 08:49:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169397; bh=ofERgBikDVQ+ar+COdBWG8wzBxL4NHGfWH2UTVp+d7Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AkkoVOIeJYzvZCRT1cQ97KZrI4AYsyObrrRV1RPDDu4qsg9HsdKqM/3txwmaOtZOe Km0uJTUBE59zmaxweMaTVELuwi0aC5suQfBNs9eRJ4syBCyJoJJhy7cMbSv49mGwK0 M5YrNpxm83GO8cP/eVKCCrrxBAwxg6sbfzGdRA8k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ping-Ke Shih , Kalle Valo , Sasha Levin Subject: [PATCH 6.0 260/862] wifi: rtw89: pci: fix interrupt stuck after leaving low power mode Date: Wed, 19 Oct 2022 10:25:47 +0200 Message-Id: <20221019083301.537271863@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108606930833659?= X-GMAIL-MSGID: =?utf-8?q?1747108606930833659?= From: Ping-Ke Shih [ Upstream commit b7e715d3dcd2e9fa3a689ba0dd7ab85f8aaf6e9a ] We turn off interrupt in ISR, and re-enable interrupt in threadfn or napi_poll according to the mode it stays. If we are turning off interrupt, rtwpci->running flag is unset and interrupt handler stop processing even if it was called, so disallow to re-enable interrupt in this situation. Or, wifi chip doesn't trigger interrupt events anymore because interrupt status (ISR) isn't clear by interrupt handler anymore. Fixes: c83dcd0508e2 ("rtw89: pci: add a separate interrupt handler for low power mode") Signed-off-by: Ping-Ke Shih Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220824063312.15784-1-pkshih@realtek.com Signed-off-by: Sasha Levin --- drivers/net/wireless/realtek/rtw89/pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/realtek/rtw89/pci.c b/drivers/net/wireless/realtek/rtw89/pci.c index c68fec9eb5a6..8a093e1cb328 100644 --- a/drivers/net/wireless/realtek/rtw89/pci.c +++ b/drivers/net/wireless/realtek/rtw89/pci.c @@ -760,7 +760,8 @@ static irqreturn_t rtw89_pci_interrupt_threadfn(int irq, void *dev) enable_intr: spin_lock_irqsave(&rtwpci->irq_lock, flags); - rtw89_chip_enable_intr(rtwdev, rtwpci); + if (likely(rtwpci->running)) + rtw89_chip_enable_intr(rtwdev, rtwpci); spin_unlock_irqrestore(&rtwpci->irq_lock, flags); return IRQ_HANDLED; } From patchwork Wed Oct 19 08:25: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: 4675 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212835wrs; Wed, 19 Oct 2022 02:08:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5DqHUIc1TKmSzTHhNSPIlvbiUGDnLVofcaByDIZYa0qDqk7WsCIwokzcppg7g1gx4RmHaU X-Received: by 2002:aa7:c054:0:b0:453:98c6:f6c4 with SMTP id k20-20020aa7c054000000b0045398c6f6c4mr6432117edo.2.1666170506082; Wed, 19 Oct 2022 02:08:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170506; cv=none; d=google.com; s=arc-20160816; b=ZAGApwnxVvLOMt+RwFK1CpudjC6/DfaRd+pgvQf224AShTiwQz3NgzBt7GMw/R0/l6 5vtQWth7fZtJtfFDFVr7+Ku0e0Z42OXeqq16h7mwJBdxf4W445Nhs+B5edPbHjErdBzm IYTIMQOQjUkcklkZ/jkiewrTaDReHUW1PuB8l0J6Fox7m4g0nrx9wmTZ+o7eu4Bs2YdK Js50shZpYXXRcbQPGhuifbA55RxNczoF1Q+nZk2/pIyWZ6pvu7V8Osh8VRI56YKsvzNB S2QEFuJwfUMgVyxoFLSR6tNDDlrmrrB5+0ZZZsyeNfYK59qCe5FYZPWceXRemkQLn/qo H5CA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jP35xt3o2gnyjDDa78i6XfEaFjtys+hIX3YztqTlqmw=; b=P9PJwioTt3oJWNbRu6nf7xmuMWLkXhp51AH6gpT131QVwqd+KWOQgPUo/4bmFy61ih viaEf0Lltl7gw3naK/tUF7mOJJimN/PGxIWR1weoeP4acEFtBonedl0Br15i69V/htYV jCD2XJlKKTp+xxh0+lwY4XuJAox18P2lQBBjFau49sRBXSuEDMwN7ZZNLFoySWPe7vvr ngI/DXmvS5mc+Uu9O9iTtLkp1AgfBPLGaj9G2s+DtPI7s+EyWnmoCIB0mBQ7iDWHMz5z KsYqhIVVFW0t5M5+pdk6ocpyZSwhBXARez/qS61ejdaGrIivP4JpetZ9Z5Yx/JzDzNrf aDYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UQPw4dsQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dd3-20020a1709069b8300b00783d1a13d69si13931751ejc.231.2022.10.19.02.07.57; Wed, 19 Oct 2022 02:08: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=UQPw4dsQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232071AbiJSJCg (ORCPT + 99 others); Wed, 19 Oct 2022 05:02:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232428AbiJSI7t (ORCPT ); Wed, 19 Oct 2022 04:59: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 33FEC57BDC; Wed, 19 Oct 2022 01:55:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 92CC461861; Wed, 19 Oct 2022 08:50:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4979C433C1; Wed, 19 Oct 2022 08:49:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169400; bh=nEKjydNkPW4o0sHg6DBdaaxBgBMjm9DMWGeP35LsqpI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UQPw4dsQMnfrJIox3vIRIc1FcUF9+qhn5NkfIcSNdC9D5Bte9ojQ10b6btkau85gk cc8cAKqEyZdV74dwd7HzrO2f6R0eu1PS9N7JBQIdmnEtnxCxulxOp6DhfYe+gyq+DN 39+nkh/Iy/I8T2DLLGvWG3fIr9wsY9MRcV+z94rY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ping-Ke Shih , Kalle Valo , Sasha Levin Subject: [PATCH 6.0 261/862] wifi: rtw89: pci: correct TX resource checking in low power mode Date: Wed, 19 Oct 2022 10:25:48 +0200 Message-Id: <20221019083301.576592412@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106404338089192?= X-GMAIL-MSGID: =?utf-8?q?1747106404338089192?= From: Ping-Ke Shih [ Upstream commit 4a29213cd775cabcbe395229d175903accedbb9d ] Number of TX resource must be minimum of TX_BD and TX_WD. Only considering TX_BD could drop TX packets pulled from mac80211 if TX_WD is unavailable. Fixes: 52edbb9fb78a ("rtw89: ps: access TX/RX rings via another registers in low power mode") Signed-off-by: Ping-Ke Shih Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220824063312.15784-2-pkshih@realtek.com Signed-off-by: Sasha Levin --- drivers/net/wireless/realtek/rtw89/pci.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/wireless/realtek/rtw89/pci.c b/drivers/net/wireless/realtek/rtw89/pci.c index 8a093e1cb328..7bb1b494c5d1 100644 --- a/drivers/net/wireless/realtek/rtw89/pci.c +++ b/drivers/net/wireless/realtek/rtw89/pci.c @@ -926,10 +926,12 @@ u32 __rtw89_pci_check_and_reclaim_tx_resource_noio(struct rtw89_dev *rtwdev, { struct rtw89_pci *rtwpci = (struct rtw89_pci *)rtwdev->priv; struct rtw89_pci_tx_ring *tx_ring = &rtwpci->tx_rings[txch]; + struct rtw89_pci_tx_wd_ring *wd_ring = &tx_ring->wd_ring; u32 cnt; spin_lock_bh(&rtwpci->trx_lock); cnt = rtw89_pci_get_avail_txbd_num(tx_ring); + cnt = min(cnt, wd_ring->curr_num); spin_unlock_bh(&rtwpci->trx_lock); return cnt; From patchwork Wed Oct 19 08:25: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: 5568 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp350541wrs; Wed, 19 Oct 2022 07:13:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM710p0vJsZDiF+zg5NE7a+RE2D8zb7A18iYHiUsGD18aQdqHc5uy5pCIR1F/KPSR91hA7qp X-Received: by 2002:a63:2a86:0:b0:46a:eaba:f1f3 with SMTP id q128-20020a632a86000000b0046aeabaf1f3mr7332556pgq.79.1666188834582; Wed, 19 Oct 2022 07:13:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666188834; cv=none; d=google.com; s=arc-20160816; b=aOxiSFIYSNpjGONj1ncHGd+KbvElU4jX21fApzLr1v/VcogNjfl6aPrywHNpr4bYRv N8kbW31bm76dq5p8NVJVLgURauQYWsYFIRhe+qKEEcm7M8KIlv6qU/uYhX/LkOCYsc3d CV6kx1I6x6EVCT7LC/ZBHTdUipDxWlgato+fzJdUpg6JMSvBhLPwaZYAwym8o8Kjalx2 wQdiQpxtT/SWzNTqcfjiOv9SZTv2gOiqCemfYSC3PCZrGD2QJgFcOXLuoztTtZhXOjYw 7jnlLQwQHP9S3nl7GS6hQGCiFCYzVLZKLb8jMIFHRBHGNfkCkA7pDt4mO/9upEvEzuU3 bx/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=Ja5R+JcRPBtQWmflWTU+HMKgpSYjCmZV2qLlUqz+mak=; b=PGvSBjCwC+G92XmKBpg63QXUhepUAwVoRYwb6wSFWv5FD58XNf19rFD9NVyZmEA8r3 YLs6EA5Qvr5Ie0TYypE6e4m3LRCK2hv9SpvdrKv80vE/FZKYsB93UHx+KcNqH7Au3ajo 5eLNPRUsALoKa5ZZ9TnTXWrh1tvh/VBq8t+mMHd20wcC9bNcNSORiYp4z9SR032xdN04 maYmGCIRbjI/7uYZGaUR8sCPsL/bsxAGdsvvWGLMCuCrgnC46WLgJzMYRZ+kPVeMp+6F TR1mlPDosdudGQRLvYlNYpgKLyATJS4Y1dBgqzZZKdu04vHvYqy5nsYtbZln1ZuUrSJf QW7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bi3QvWxO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ds5-20020a056a004ac500b00562dd22d708si16426557pfb.189.2022.10.19.07.13.30; Wed, 19 Oct 2022 07:13:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bi3QvWxO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233792AbiJSN5O (ORCPT + 99 others); Wed, 19 Oct 2022 09:57:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233773AbiJSNw7 (ORCPT ); Wed, 19 Oct 2022 09:52: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 4C7251C20B6; Wed, 19 Oct 2022 06:36: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 DCE78B82320; Wed, 19 Oct 2022 08:50:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59563C433D7; Wed, 19 Oct 2022 08:50:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169402; bh=r3WVB8imRi0X/O5bSGPHZ7EyG3mO2MBxj8rd2X0UboY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bi3QvWxOnzNq3PzTj6++M845WU/HqYe32aDDxz+8SIXUmwAupJ7wImWOP/a47nt9z oiZ0NJ/rCXtrt6JszoIdAk0neq4YmkKzzL18nkp51U6Ak1zh3T1FHBfQlEwMr1EmIl iFX+opY2P+6DLnV+btMtTv3MRwyrnFlZqVzEhWlA= 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 6.0 262/862] wifi: rtl8xxxu: tighten bounds checking in rtl8xxxu_read_efuse() Date: Wed, 19 Oct 2022 10:25:49 +0200 Message-Id: <20221019083301.614732469@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747125623155963221?= X-GMAIL-MSGID: =?utf-8?q?1747125623155963221?= 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 c66f0726b253..f3a107f19cf5 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -1878,13 +1878,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)) { @@ -1895,6 +1888,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 Wed Oct 19 08:25: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: 4642 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212254wrs; Wed, 19 Oct 2022 02:07:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5d4kvDxcSifQyyXAS+/vJzMPtBCWXkXt7iPtNxfs4TzReQHV/P/oANnS5JN1e4dk4OhmFV X-Received: by 2002:a17:90a:86c6:b0:20b:dba4:758a with SMTP id y6-20020a17090a86c600b0020bdba4758amr8607679pjv.71.1666170425818; Wed, 19 Oct 2022 02:07:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170425; cv=none; d=google.com; s=arc-20160816; b=B1aGh37P7btug1dgTfgVttFdYrAK267eKiLdyFB5+VJYPw9fKgAZxR1c2Pw9NsSlJu axFFgOj5I1WC8FjIaC+9DWA+QIr8M/GiuqfARGYFcoJ8Cu7mnAuvok/DTiInfOZIikUD 7HrU1b4cMx+WuYSrWNXwV0azld+LMAIwrcX4QPkj34V4tJf6VaZPSzkKj6khrEOaXQ27 L3eS9uCNpBsPXuVInvHuljNYGiaJTNIIlV7Ufmiftes6YhVpQgQYBM+x6wzqrwCf8D3u Yv2R2Uhs87Bj2e4QO/wFv3+dva64LsCkXprk0ut6fToGg4HlHnfmovWmYCt9LQRvpmbi +lHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=H4PZH7WiCf/YvJbej1zBr8Hv8NavGNvZ/ApM6k840VA=; b=WvLVgCWQs5iSTvUIj0HOfaj5+TpDtQSn4eJ8L5MWaf3F5K1asC0tyXrYeF4Zuc/Ty9 wNbWeXESSY55E7JvuKyNoJlkUdxgzf83XW5qtSl+8GcPnCKcCJDVT31QtZL5AaVjRqQF p91eFXVa8V76C58gg8RMDa7ZQGie5nAKY9KOE3CGKuzJTk0YGPti16w+RI21Q/F5tvR1 Ngv1jprzqoVlaqsT363hyzE4POE7y2B4ETE37ja/raZXp4Cn3vRiJ6FE4WlRL779h+SM Gz8oJ3iWski+iKRoabYKLNQ8iH993mue8WNO8ZI6x+GqlcW+kVZPYIeIdwhm1WQqEY6f RFpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=awoqGgPS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l1-20020a056a00140100b0056191854bb4si19141020pfu.291.2022.10.19.02.06.45; Wed, 19 Oct 2022 02:07: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=awoqGgPS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231882AbiJSIz5 (ORCPT + 99 others); Wed, 19 Oct 2022 04:55:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232012AbiJSIyU (ORCPT ); Wed, 19 Oct 2022 04:54:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C22983F0E; Wed, 19 Oct 2022 01:51: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 DE6BB61865; Wed, 19 Oct 2022 08:50:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DDD6AC433D6; Wed, 19 Oct 2022 08:50:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169405; bh=E0P5Plv7o5uoE/gCMwmS7YD7vzFnZnNz9sL7HO26qXM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=awoqGgPSumNEPXSdTqZ0f86QE5UbUKC04Z213z999ECKTSjdMsMWyVY69wglU+FHq TRwql9B1737101OJPKMne/ieMoVZ/lmpM4RGoB3fTGAU1nyhPCECDo0rDNLXupBG8U s6yFwbPygwJJb9Do1Um+9OTvq89j9jODyx3LhBOs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , =?utf-8?b?SsOpcsO0bWUgUG91aWxs?= =?utf-8?b?ZXI=?= , Kalle Valo , Sasha Levin Subject: [PATCH 6.0 263/862] wifi: wfx: prevent underflow in wfx_send_pds() Date: Wed, 19 Oct 2022 10:25:50 +0200 Message-Id: <20221019083301.648139574@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106320054231965?= X-GMAIL-MSGID: =?utf-8?q?1747106320054231965?= From: Dan Carpenter [ Upstream commit f97c81f5b7f8047810b0d79a8f759a83951210a0 ] This does a "chunk_len - 4" subtraction later when it calls: ret = wfx_hif_configuration(wdev, buf + 4, chunk_len - 4); so check for "chunk_len" is less than 4. Fixes: dcbecb497908 ("staging: wfx: allow new PDS format") Signed-off-by: Dan Carpenter Reviewed-by: Jérôme Pouiller Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/Yv8eX7Xv2ubUOvW7@kili Signed-off-by: Sasha Levin --- drivers/net/wireless/silabs/wfx/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/silabs/wfx/main.c b/drivers/net/wireless/silabs/wfx/main.c index e015bfb8d221..84d82ddded56 100644 --- a/drivers/net/wireless/silabs/wfx/main.c +++ b/drivers/net/wireless/silabs/wfx/main.c @@ -181,7 +181,7 @@ int wfx_send_pds(struct wfx_dev *wdev, u8 *buf, size_t len) while (len > 0) { chunk_type = get_unaligned_le16(buf + 0); chunk_len = get_unaligned_le16(buf + 2); - if (chunk_len > len) { + if (chunk_len < 4 || chunk_len > len) { dev_err(wdev->dev, "PDS:%d: corrupted file\n", chunk_num); return -EINVAL; } From patchwork Wed Oct 19 08:25: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: 4645 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212296wrs; Wed, 19 Oct 2022 02:07:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5RDK30sDp7VLL1swA6i93x0he6d02v1JdLV7hC2qu8/wVBaSgCzOYdz/Qzr/CByPRMuS9L X-Received: by 2002:a63:2212:0:b0:43b:f03d:856a with SMTP id i18-20020a632212000000b0043bf03d856amr6386917pgi.192.1666170430460; Wed, 19 Oct 2022 02:07:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170430; cv=none; d=google.com; s=arc-20160816; b=ra5y4KMTsZj6S8xLnJ1RXovfaT8xI3i9xY+dXm3GocX1YuTDrjUq+m5txz3U8T8bMR 7V8ER1oRs0R3l5j+FkcrLHL+8Np5GdEbApmXgW4sN4QFOs896QtQsZEyjeRJtetIQj+u 5HyCNr+diCUKo4+X0mjz0KjGwY6VrKZJIP7geTVrFVnidOuu738qbWB++JAJNHrVUCqX ySaRamIfzfTbgKfvDg8Flh2erkIDKCtQyhPF212THu3GALYbAnSmAuWQ7jfTs+XpOwsO hC5M/zhAC06gJi7ttt1aD9L0urnQfMYPSxRnt40R/qDR9bRqZvDRjtmgqhiYaoBiygTY DW3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=b6XaaR/HHUa/x3KpQJeMHJVx2TjNf6+f1HNUjDNyQSg=; b=OARYpLb3+zIGbLsG+zfKVRZB6VCKnSomgQwZyI2bEMdtjzM8zeBlg+inwqtWQ5JD6s zckL1UpkEAbY62mfiKdQ/Csckut3SBepdzKMMPh8es2JXdX1H1QHH0MKgFCwgiTmNwte 5rO/+cVE/9WuxxToEx52tg3+a5PfS3Aw/nEgNgeC7EBjCnhaZQAMrQJVsl2b4mUwZ05p TMCnNPxFfpS3te7N26qkQdUb+Fu6Kxe4GA6J4TlIoAyNs4Iw0I+30cQ3eS05QGjX/h3K hDnsSOsFvKWR4f/jgTUUnFtvpFK4xbIGL+1EyULpEpzuOBPip3NNlF/vGFPKSsSQishO USZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="A/ovfSb8"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a630242000000b0046107c067c7si17529762pgc.822.2022.10.19.02.06.47; Wed, 19 Oct 2022 02:07: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="A/ovfSb8"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231877AbiJSIzv (ORCPT + 99 others); Wed, 19 Oct 2022 04:55:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231974AbiJSIyP (ORCPT ); Wed, 19 Oct 2022 04:54:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF9D591847; Wed, 19 Oct 2022 01:51: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 8F7AA61831; Wed, 19 Oct 2022 08:50:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1814C433C1; Wed, 19 Oct 2022 08:50:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169408; bh=N7Z0fmsOKPI6czj4QQoycKm9e6SPcritX2riAcV8dNE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A/ovfSb8tQsfvFg390bstU0B4HgJ0CT6NtVTc0qIsTTjJ5PJw19QVRtmS9AmWrDGE 8SJ8rImmwyAJI3ieJrBJQQsDSh2yLTJUlA+FIoi+tOfkDM9/PQhEsuR/DHQzxY676x aj+NjeaOTrHECG9TIoSCkK9rf0A2KVOlOFSvW+t0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yang Yingliang , Ping-Ke Shih , Kalle Valo , Sasha Levin Subject: [PATCH 6.0 264/862] wifi: rtw88: add missing destroy_workqueue() on error path in rtw_core_init() Date: Wed, 19 Oct 2022 10:25:51 +0200 Message-Id: <20221019083301.695786772@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106325083294199?= X-GMAIL-MSGID: =?utf-8?q?1747106325083294199?= From: Yang Yingliang [ Upstream commit b0ea758b30bbdf7c4323c78b7c50c05d2e1224d5 ] Add the missing destroy_workqueue() before return from rtw_core_init() in error path. Fixes: fe101716c7c9 ("rtw88: replace tx tasklet with work queue") Signed-off-by: Yang Yingliang Reviewed-by: Ping-Ke Shih Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220826023817.3908255-1-yangyingliang@huawei.com Signed-off-by: Sasha Levin --- drivers/net/wireless/realtek/rtw88/main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/drivers/net/wireless/realtek/rtw88/main.c +++ b/drivers/net/wireless/realtek/rtw88/main.c @@ -2045,7 +2045,7 @@ int rtw_core_init(struct rtw_dev *rtwdev ret = rtw_load_firmware(rtwdev, RTW_NORMAL_FW); if (ret) { rtw_warn(rtwdev, "no firmware loaded\n"); - return ret; + goto out; } if (chip->wow_fw_name) { @@ -2055,11 +2055,15 @@ int rtw_core_init(struct rtw_dev *rtwdev wait_for_completion(&rtwdev->fw.completion); if (rtwdev->fw.firmware) release_firmware(rtwdev->fw.firmware); - return ret; + goto out; } } return 0; + +out: + destroy_workqueue(rtwdev->tx_wq); + return ret; } EXPORT_SYMBOL(rtw_core_init); From patchwork Wed Oct 19 08:25: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: 5572 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp350769wrs; Wed, 19 Oct 2022 07:14:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5SZdPrV/m0cS5Bnc3Ha2EHtDamYGwAfhl6xQSL5HOsC/ReIGUkNJM06KWrvwvSjqhsSFIL X-Received: by 2002:a63:470b:0:b0:442:24d7:578 with SMTP id u11-20020a63470b000000b0044224d70578mr7491550pga.198.1666188855959; Wed, 19 Oct 2022 07:14:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666188855; cv=none; d=google.com; s=arc-20160816; b=VOzL7AA7+JewUPAg6SYpwOSD2u5p5kH91Rd5LZKDnunrcQK7uV+1WN7XbORjIICXAO tuGzkYzbrweAaxIrMvL0dBmsl3DZCzdiKhB7lmX10e1bvqDy0UKdJcY8xDjh4HrIuE9R txjvAivG6riH9VEEtiZ0RDtTTURph7u79+1qKjloiJDwICTytzTWqe8w4HQiZo5S4hou kFCHhXgpj02uxXjAKSc3JgSpHq8mwCOKuhFnj7CM0IcYUqBoO1B6ijUySano1KduA8zu byg8BA49o4/KTXyEvTwMlD9fMhFGjUGPteQokxWETTrOjd7B+FUEGvGGRXf1nR+tFtT5 k3Kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=KBP9CDjuSm1V730VCvHxKXemME8vhoad4zzweXXjX4o=; b=TN+fjEGzPJtE1y5R/Aiua3IsZwLQiGxIuuNAnSOaesd7mMTlCjJTItPC6x/GAMHB+x ptByIzkazbDg5MSBDqEsljQ9eGTtqLu6Ot6OHzpCvJsnXrourA/z/VOBno+uYlmYrV8e SwcuWeDsD8jUSCMofVPUhWiwALdBs1QjJkj7jum/YKWRPpQwlxgGHbMMloeDHITFnh0+ 6/UfRNNsNvP+jdkz/JwvHwIdpJOrRWaeP9dJxEZ6GTnQIBviAsUPS8hnnTYS9bBo9Rjv t3RURU3srlFAF3QvS12AzGT5t+AEE6FwivBVeo/7eZj8G4EJa6jkAha/Vq8hXXclSoiE QAlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="qV/rN+La"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s123-20020a632c81000000b00443860ee255si18289603pgs.17.2022.10.19.07.13.53; Wed, 19 Oct 2022 07:14: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="qV/rN+La"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233823AbiJSN5F (ORCPT + 99 others); Wed, 19 Oct 2022 09:57:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233741AbiJSNxS (ORCPT ); Wed, 19 Oct 2022 09:53: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 31164115401; Wed, 19 Oct 2022 06:36: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 ams.source.kernel.org (Postfix) with ESMTPS id E1153B82385; Wed, 19 Oct 2022 08:50:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D594C433D6; Wed, 19 Oct 2022 08:50:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169410; bh=fzYPWcBxAX/2ERexkBxL7ZPO3pSxG7BbIQ7qi2LD/8M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qV/rN+La5L8aE4pRe+fEaNeOYKFwEWJBnUbDs2ZxkZTlxdEL7nfUtKVyM02v4WRuy D4Nl3f8zv6UlhwxbkkmPqWSlhB/7dlF34UBzujgmalc0XINp6OtrGlaXdXdU817FG3 h9j36gozf28NMPk0WKgQ2R8a1enjvqzeEAgXLimM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ian Rogers , Daniel Borkmann , Magnus Karlsson , Sasha Levin Subject: [PATCH 6.0 265/862] selftests/xsk: Avoid use-after-free on ctx Date: Wed, 19 Oct 2022 10:25:52 +0200 Message-Id: <20221019083301.736032033@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747125646016439700?= X-GMAIL-MSGID: =?utf-8?q?1747125646016439700?= From: Ian Rogers [ Upstream commit af515a5587b8f45f19e11657746e0c89411b0380 ] The put lowers the reference count to 0 and frees ctx, reading it afterwards is invalid. Move the put after the uses and determine the last use by the reference count being 1. Fixes: 39e940d4abfa ("selftests/xsk: Destroy BPF resources only when ctx refcount drops to 0") Signed-off-by: Ian Rogers Signed-off-by: Daniel Borkmann Acked-by: Magnus Karlsson Link: https://lore.kernel.org/bpf/20220901202645.1463552-1-irogers@google.com Signed-off-by: Sasha Levin --- tools/testing/selftests/bpf/xsk.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/bpf/xsk.c b/tools/testing/selftests/bpf/xsk.c index f2721a4ae7c5..0b3ff49c740d 100644 --- a/tools/testing/selftests/bpf/xsk.c +++ b/tools/testing/selftests/bpf/xsk.c @@ -1237,15 +1237,15 @@ void xsk_socket__delete(struct xsk_socket *xsk) ctx = xsk->ctx; umem = ctx->umem; - xsk_put_ctx(ctx, true); - - if (!ctx->refcount) { + if (ctx->refcount == 1) { xsk_delete_bpf_maps(xsk); close(ctx->prog_fd); if (ctx->has_bpf_link) close(ctx->link_fd); } + xsk_put_ctx(ctx, true); + err = xsk_get_mmap_offsets(xsk->fd, &off); if (!err) { if (xsk->rx) { From patchwork Wed Oct 19 08:25: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: 5060 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp248203wrs; Wed, 19 Oct 2022 03:42:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM65AwoI2w9PjG9KyAj3FSttzJPgwmNEfxMnI97BeFoFYjUKKmyFCgQvB9oreaPuA2ueFClk X-Received: by 2002:a17:90b:1a91:b0:20d:268b:eab with SMTP id ng17-20020a17090b1a9100b0020d268b0eabmr8816578pjb.177.1666176174963; Wed, 19 Oct 2022 03:42:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176174; cv=none; d=google.com; s=arc-20160816; b=wVtuvWKlYrdl32V/A6qi/VRCnfNcRB9Pzb4moomlCtsVc2z9PDBkFSYqK5t0JvRl3k BE01/Rc4iz93pjcQFOxFZisAOQ9sfaJ/BbsxUIhGgvjxhFofU53PwWpoyvNf8Y3QoWTs UPdkZZ188fUVDtnb+TBxrkwUJI8KqAqH8WXrwMjpcHRLszF1cQ+o/m/YUbTe+Ruupmpt WYdb6lr6lbyU5TsXcO9D2SNxl6npKppscRJaVOnMFqpSyLnp16dPVy+k9inDia+YzQU+ 6s+0Z6GqbWKMev1zYxVLRCDF9pvAoAblQiKbhoUv9aty2Kg74zV5RRDuwF8K/ptKCR9D wHZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5uFaWiHe1r2pfkkvJNdB31S/kew3EFwJ425xGQInfxI=; b=JR3y1eXDY156K5rp+66D3iWLWMXK+iYwC30/CZiGQbJglLvFJmXsWKEsdIljHjIor4 xiSAk3Ad7U4P1VSHip5F9jBcz/F304n1yFw9HT89y6i+XImZO/2IPGzodZTfFj2cnbH0 cyiq9u3uIElerzIGalOctp/sI4rRZo8bHje186bq8SnFIAr7caN0uPRNuCfcg0WGtEpK +7nbW6F0D3PnZ/x7BJI6r+3tFLiRkHmwrDc9eEMeSZO6yqJYJvjSHT99R9GTUXN3sxKw Cqb9ajuOAvW7wB1qRSaZ9g3hsh8oR4nf8EiYAknkT+XsnHyKr3vksrWlXSItiqVnEaUF hnsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lDJz5hR1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d5-20020a056a00244500b00563764cecb3si19057003pfj.279.2022.10.19.03.42.42; Wed, 19 Oct 2022 03:42:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lDJz5hR1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232426AbiJSKl4 (ORCPT + 99 others); Wed, 19 Oct 2022 06:41:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232043AbiJSKlA (ORCPT ); Wed, 19 Oct 2022 06:41:00 -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 1C9A06346; Wed, 19 Oct 2022 03:19: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 150BEB8239C; Wed, 19 Oct 2022 08:52:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6DDE3C433D7; Wed, 19 Oct 2022 08:52:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169524; bh=0rl2z4tAdKp81nWROTRI1+4Lj05dL4bQD7NiLYtYuRM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lDJz5hR1jIq5fKQh8W6f3zWYkstLZXX/BU6ots9kDonAIXkRAv7RHiGZP2Qioh98F k0lFczFm3Sv4fxZrKi+b/wsfKIo/quU8w0nJ/S+kpDSMrE1Cz42CmhuKJxLW3QKqX+ QAXQdHRloYrwjD6DYqbtCVA5T+Qy1AFuqlHQ1zsA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johannes Berg , Sasha Levin Subject: [PATCH 6.0 266/862] wifi: mac80211: mlme: assign link address correctly Date: Wed, 19 Oct 2022 10:25:53 +0200 Message-Id: <20221019083301.786453547@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112348768543174?= X-GMAIL-MSGID: =?utf-8?q?1747112348768543174?= From: Johannes Berg [ Upstream commit acdc3e47881d86dc1cb89d4603e3fed90ab150db ] Right now, we assign the link address only after we add the link to the driver, which is quite obviously wrong. It happens to work in many cases because it gets updated immediately, and then link_conf updates may update it, but it's clearly not really right. Set the link address during ieee80211_mgd_setup_link() so it's set before telling the driver about the link. Fixes: 81151ce462e5 ("wifi: mac80211: support MLO authentication/association with one link") Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- net/mac80211/mlme.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 76ae6f03d77e..654414caeb71 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -6291,6 +6291,8 @@ void ieee80211_mgd_setup_link(struct ieee80211_link_data *link) if (sdata->u.mgd.assoc_data) ether_addr_copy(link->conf->addr, sdata->u.mgd.assoc_data->link[link_id].addr); + else if (!is_valid_ether_addr(link->conf->addr)) + eth_random_addr(link->conf->addr); } /* scan finished notification */ @@ -6378,9 +6380,6 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata, goto out_err; } - if (mlo && !is_valid_ether_addr(link->conf->addr)) - eth_random_addr(link->conf->addr); - if (WARN_ON(!ifmgd->auth_data && !ifmgd->assoc_data)) { err = -EINVAL; goto out_err; From patchwork Wed Oct 19 08:25: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: 5554 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp349468wrs; Wed, 19 Oct 2022 07:12:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6YxR/i5fZHFYaBQJkG6DFwgMQ74XSOQyaVFKVqU6JRADMQE9ke6+FTAifjl4dOQgp7QSY+ X-Received: by 2002:a17:907:1624:b0:78d:d61c:2b4a with SMTP id hb36-20020a170907162400b0078dd61c2b4amr6832712ejc.208.1666188720594; Wed, 19 Oct 2022 07:12:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666188720; cv=none; d=google.com; s=arc-20160816; b=03oI7fnHnw5RlENTu/QKVTBXmxW6yrEncCh7XbDiNQTDdTQymuJr6o8r4CMda/WbDt f+t/Q4Kil8dyidCVRsj0Y6ZYLgp2kIXeUtIyBO4rwgh7CEVrTVoMNaNPeXZ4TzaR991u 23aeU3n5deizD3KyztFG0zrxoLIFf9tK7F/UtiCU8OQSq2fLBCAV0X2ux1TZYP1KNo44 xHK2+7K6w97dcHDjYryTNql5et471MBOnNmuRIOjqhoxumqVpDvAaD4TW/5+UcZubmN1 +aPP51MAZ6e/I4K6n/jcuhEiTGBzDLEoNO8NpL+gpCsryjkkNLtCyFUWGgujITsgeQRN uPIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hwAFJISQXBxKrTnk6Pj2/+RIEOifuHUpBzBhdXa2T58=; b=FUdu5t2DbwQNWb9AFPtOgW6qFVh/DPMI5i2fzrn4ql2h5AC6+4BxmvFtqHv2h+GPIQ 768LLb6f8zcnKnV5jSnwdKYmhrSNQpPplO1+z1LjMRHM+gjv+eisSYsOkvOHLriSwGB0 4QoW6WtgszwnqS3gum2UXHvU2OGCgODzFegVXVk4y9rTgl4Jjnp64lPa1CwL0B6xyM7M qvYbtXYcsxflGUDYo/zsAxILjIc6EAGu6H8z93Zt2sf2f+wg7Rs78KpZtZeCMvUDDRFg Z55FicRamx7GWjMA2K5Bh0x8OnuuQmRGWi5DH2ZWeQXcXmkqO9mbTxwA84PYVYpEle06 R3Hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tWvluceJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qw20-20020a1709066a1400b0078dad5e8d65si13035327ejc.68.2022.10.19.07.11.28; Wed, 19 Oct 2022 07:12: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=tWvluceJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233783AbiJSN46 (ORCPT + 99 others); Wed, 19 Oct 2022 09:56:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233703AbiJSNxQ (ORCPT ); Wed, 19 Oct 2022 09:53:16 -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 7E4771C8816; Wed, 19 Oct 2022 06:36: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 7A86FB8238B; Wed, 19 Oct 2022 08:50:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1EE7C433D6; Wed, 19 Oct 2022 08:50:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169432; bh=Rz9rDCBJAQ2vRjx+afllaCE7dQcrdHH6ja7SalU0vXQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tWvluceJ4+KdQ8KQbcJMblJB18QlYqKR9G3Ejz/gPAoU6tI2b5Fl8VPK4FTcu7ZwN PIFjC/BOvgm7pJKf5JYQrBjuJxIFK9xb8SplI/BIOjthOWsWl2vLemDrvLCwoXd07t zn5PmcT/IrLdsl/y9qQJ14iPjvW4zYyCGxdWZz+E= 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 6.0 267/862] spi: qup: add missing clk_disable_unprepare on error in spi_qup_resume() Date: Wed, 19 Oct 2022 10:25:54 +0200 Message-Id: <20221019083301.819748343@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747125503407392060?= X-GMAIL-MSGID: =?utf-8?q?1747125503407392060?= 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 00d6084306b4..ae4e67f152ec 100644 --- a/drivers/spi/spi-qup.c +++ b/drivers/spi/spi-qup.c @@ -1245,14 +1245,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 Wed Oct 19 08:25:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4729 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214110wrs; Wed, 19 Oct 2022 02:11:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6X8aDoOCimbRe6N56sFZ8a/0ftokbpbVc9+y1HbRex5txaSDN12sf0Gw0JY+VYfvIx3xAF X-Received: by 2002:a17:906:fe44:b0:77c:e313:a8e8 with SMTP id wz4-20020a170906fe4400b0077ce313a8e8mr5982196ejb.700.1666170715144; Wed, 19 Oct 2022 02:11:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170715; cv=none; d=google.com; s=arc-20160816; b=VLF6gJZeRaFUrCxVu7py5833bWJ68lj5ctYIYup3bYRgmJttn93ZN40maA8W1tQmBV D0vkaCQvtqbPO7Jfbmca6L44oThhuY7X+mwuMrFygz0+I7HSU3PWlrYw8lkijNPNHKri 4A29NmFiLd4UyAc6KOQfD1glE/KTgef1ksj/sF+6oCDy9N/O2i3ZpakzueeZTelT/bmT L1p9awTvLV8K/actXFIO++wV4KE3fiI2sXbfbEC3EfaWq26V3NYvix4Vnm61R+z4ULGD XJ5sWN5oj/McES7aR4zM1TsD7Zzz/kZS3EY8h94DHTqAg6YnwKNTikX965c+h0fIr92i fV+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=Kf8t6uvex/h0oWfv3hpGINwdDDQvwzqtBEQquqgdTqQ=; b=Ix5ZWt9AgKiv189y4ujm/FW1835cGvMhPgtLHzLHkW1PXVuMfyZP9rtWyB1GkxFO8O 4zBbWJLzPALbHUQd4RzcDmkQF+mU6XunZ2BeFP0/dW4mR+5UvP9Q+y2+zDTJ/5T8l7Bj kvqM8OqKs9WtlLbDSf4FDqDd83QxAfohTopE31dezo/DXiTa69QWqdT8v4/27NDP9Nj0 mP38SFCAulQtbQhSVsvp3YFHT2FOeStOzNVfQMrBDom5DGzkcGXXkTHQSWeakmjEkUf6 vdlnJ6JVVg2dDXQ1k96jcP2fS+w+fqmQkU7zCQ8ui5C9J0bU79boMLl9qES6KavGhcrl DYQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QROmJsKD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v10-20020a056402348a00b0045901aa2468si16281066edc.333.2022.10.19.02.11.30; Wed, 19 Oct 2022 02:11: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=QROmJsKD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232593AbiJSJHj (ORCPT + 99 others); Wed, 19 Oct 2022 05:07:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232103AbiJSJFK (ORCPT ); Wed, 19 Oct 2022 05:05:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABC49B40F9; Wed, 19 Oct 2022 01:59: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 2476161847; Wed, 19 Oct 2022 08:51:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 37651C433D7; Wed, 19 Oct 2022 08:51:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169461; bh=ZHJKRnJNRELyEddaOAAZOUeQIBlE1rnuDZ7KrfCHud8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QROmJsKDfMQ8XatKK386Y/912ak9EOae2FjBBX3P6ltWY21QTnljSW1H7v/unaD1Z AGJdbSoBFRBXVG9Ycqsfqk0pOQTe7E6iNzSmux8mu8yHCSpCulDxsev5xSI/yXMy3p tNMBpkmMsylweDreJ4FMVA6tQTqWhZRg7aVVPKIw= 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 6.0 268/862] spi: qup: add missing clk_disable_unprepare on error in spi_qup_pm_resume_runtime() Date: Wed, 19 Oct 2022 10:25:55 +0200 Message-Id: <20221019083301.861564168@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106624307119860?= X-GMAIL-MSGID: =?utf-8?q?1747106624307119860?= 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 ae4e67f152ec..7d89510dc3f0 100644 --- a/drivers/spi/spi-qup.c +++ b/drivers/spi/spi-qup.c @@ -1198,8 +1198,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 Wed Oct 19 08:25: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: 4842 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223779wrs; Wed, 19 Oct 2022 02:38:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5QJ00y5ZJ77K7an3eWzSu7CYTGCTgAJk1hufW3oi/JgXQzXncZJvO6MKMj6+kEt1HYCkQY X-Received: by 2002:a17:907:2cd9:b0:78d:9f4c:9cff with SMTP id hg25-20020a1709072cd900b0078d9f4c9cffmr5955522ejc.345.1666172307807; Wed, 19 Oct 2022 02:38:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172307; cv=none; d=google.com; s=arc-20160816; b=bEClZWF0dCsmxleCHUsIhxGA06BD48KDfQiMYiM1kHFlF7PEzQI1km+uAcd23akEHu m3X1eBVAiRw2HbcHNzBOJHWsAhlFDtZt9/KhnU7Q8zPqJlZnsujNTl7VJqr5GZTDAxGP f6xqNbUOZ6IyG29JwH9gUqsZHQ7NGwQ8xwk5CYEgVKBVMx7IqAsEMNipmX+UMo4EsUzD umOivTaQ9OOKsuJozfTRaYHzzM0FYAtQmShaWSwvdzNKI6s7yJCCBg3UhXmBUrpR/u38 P1X5h39hkij+TEtJ64p3dVTofUEwerw2MwUFzphx48d2QF/VXuBCIc51GdorICr7Pdl7 yIJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ovVoHIMD7T2RlEfGpZPy4MGyHY9NaSNYA/K2arQ2hXQ=; b=IcB9cEHvx/d0gdjXBMiV5UYQ8BGoJSull/Il33JOeG/p+C+ICCYws7Z54PFkKdDXp9 de+8IuG7J77G9odbB4ihpfJC03zNVgBBcz//zApGEK2Wd3DBtSOjhSRKN5grHsKW5Uxj sBcjv3IxW5q3GjemjOpsHZq/1E01rqKswjKT0oeFPOcAN+hlBbMEqWWqe2OdTnKJoB94 /sIbMjB15uv7vf89j+0qJV8EZUfLsccjl/sqzhLxe9AsC3YmUWVQqTzepm7cvwAUlxQe pPOjPRMDI8GeGr8dXM41dQOmsOqyoKQx7AaDRhMsUJgPt/rwRzP9WUP3mlcojPmFvtxP CSWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lpFqE09l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a056402350d00b0045d4015cdaesi12636149edd.372.2022.10.19.02.38.02; Wed, 19 Oct 2022 02:38: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=lpFqE09l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233492AbiJSJ06 (ORCPT + 99 others); Wed, 19 Oct 2022 05:26:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233484AbiJSJZv (ORCPT ); Wed, 19 Oct 2022 05:25:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 513A0E4E4A; Wed, 19 Oct 2022 02:11: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 5358061870; Wed, 19 Oct 2022 08:51:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B3AAC433C1; Wed, 19 Oct 2022 08:51:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169490; bh=pDLk8CPU5P/QEWRsVq3Z/u8/VfPTkx2Zmqh4kWzuxxE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lpFqE09lmZcehYsn8myaubrMSy5dYWal83bvNAlN6aosDgHuUomBaG3l8261P9j3K 5p2NnH5bg5gGpYAPkiOy8PjYGcZrg7/bML19bZ13ap85nc1/5Yo0Hoky7z2RtL/uaP xwPkIGlmj79mVAz6vmMml5pttrxuCu3XAJsDoCQM= 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 6.0 269/862] wifi: rtl8xxxu: Fix skb misuse in TX queue selection Date: Wed, 19 Oct 2022 10:25:56 +0200 Message-Id: <20221019083301.905271087@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108293536902578?= X-GMAIL-MSGID: =?utf-8?q?1747108293536902578?= From: Bitterblue Smith [ Upstream commit edd5747aa12ed61a5ecbfa58d3908623fddbf1e8 ] rtl8xxxu_queue_select() selects the wrong TX queues because it's reading memory from the wrong address. It expects to find ieee80211_hdr at skb->data, but that's not the case after skb_push(). Move the call to rtl8xxxu_queue_select() before the call to skb_push(). Fixes: 26f1fad29ad9 ("New driver: rtl8xxxu (mac80211)") Signed-off-by: Bitterblue Smith Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/7fa4819a-4f20-b2af-b7a6-8ee01ac49295@gmail.com Signed-off-by: Sasha Levin --- drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c index f3a107f19cf5..02b7bc57d217 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -5062,6 +5062,8 @@ static void rtl8xxxu_tx(struct ieee80211_hw *hw, if (control && control->sta) sta = control->sta; + queue = rtl8xxxu_queue_select(hw, skb); + tx_desc = skb_push(skb, tx_desc_size); memset(tx_desc, 0, tx_desc_size); @@ -5074,7 +5076,6 @@ static void rtl8xxxu_tx(struct ieee80211_hw *hw, is_broadcast_ether_addr(ieee80211_get_DA(hdr))) tx_desc->txdw0 |= TXDESC_BROADMULTICAST; - queue = rtl8xxxu_queue_select(hw, skb); tx_desc->txdw1 = cpu_to_le32(queue << TXDESC_QUEUE_SHIFT); if (tx_info->control.hw_key) { From patchwork Wed Oct 19 08:25: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: 4735 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214250wrs; Wed, 19 Oct 2022 02:12:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6nZKsIfpyLbjsWdeNQWb/GTDlDDHZZ1wkLJMZ7xcj+cevzBar7G+JgeLQX3u2KewpWT084 X-Received: by 2002:a17:906:db02:b0:780:24e:cf9 with SMTP id xj2-20020a170906db0200b00780024e0cf9mr5851895ejb.460.1666170738317; Wed, 19 Oct 2022 02:12:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170738; cv=none; d=google.com; s=arc-20160816; b=gG7nJzMWLIIyr1mZ2MiOBuXc4cLcWK8SUispFf6On+JvatFBQty5vOtwoG+IA9Z3tq YgOPZ1gOfskaFwJ8M+nrCATqJ1l2AZRS5FYHDTBVPrZ6MA53Qba3DfH0kymjYTgvUMM2 23xnl0/xLPizm9EF4kqlzGdTSc21fLGFnU+ex2UzMpPYT2v3MADXp28dnEyJ5az7OAvM OAFW1jski078UtlyZXN9hQVXBJUNI0bS3X7dfRSscNgYYZDgWbqu5X7IRPefjW+Khfgy +0l7XhO39JSOtysEIFzIVSWoDt+76f8ZTJqE9GCpdXj1NucwQqmhaMoNpZkvJykhOnII jqnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bJmKRR/q+kBCiK96k8O/LhdQvMvn+L/FTaOJGRjEInI=; b=W+KvglPHkttYBNkrYKVZ8W+7z37ohOnDTRJbFCxaO67QMUPKvuqzRUiFQavXtIv+kh DQyvGE9GLRK4KE2dyWhtCubFielTn6ZjV8Kl1T2fdfGdnVuE57DRp0RPtUeNOB1f7z6b DegXDPdNI50LRMTeCTnWp7bdcd2XT6VPqIZA1MpXxxHhqowmX2tSdapYn5lmyW7tzLkF eA2PRV0Tmyt49bkDaJGbr4Wmh4hsfndQc3T8+vWptezXGj6kr2DnHBbeYNiXWHl9Tgth U7IQ8oxJaMJoVq79UCnnyLnNxVsa8709Po3dD+foVzvMMLhmY0VIgXSUrQDR3QVWBeLG oh0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HXMrPg+j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l23-20020a170907915700b0078dec48d442si11264745ejs.680.2022.10.19.02.11.53; Wed, 19 Oct 2022 02:12: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=HXMrPg+j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232741AbiJSJJL (ORCPT + 99 others); Wed, 19 Oct 2022 05:09:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232469AbiJSJG2 (ORCPT ); Wed, 19 Oct 2022 05:06:28 -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 276DE1EED2; Wed, 19 Oct 2022 01:59: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 995DF61865; Wed, 19 Oct 2022 08:51:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB859C433D7; Wed, 19 Oct 2022 08:51:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169509; bh=t3dMiH4XJXVQqT24zBIQwudtQaBoBJjPnA3eH7aaObo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HXMrPg+jqF6UZY0OWp9zRhhJTJXB0LS1Y/f4YHju9f8fljTkLh1m3OyRLueih/wpV UNMX25UT/MRH7p/Yoaw10VLtn/uS0a4z8Qx9AQJpK4WWS/OjhWb8FBDHE1tC3uumXL oYi/rOvbBM6VJugxZpJGZorXaKu4W9pXTjWoxPsE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Markus Schneider-Pargmann , Neil Armstrong , Mark Brown , Sasha Levin Subject: [PATCH 6.0 270/862] spi: meson-spicc: do not rely on busy flag in pow2 clk ops Date: Wed, 19 Oct 2022 10:25:57 +0200 Message-Id: <20221019083301.955710850@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106648488681263?= X-GMAIL-MSGID: =?utf-8?q?1747106648488681263?= From: Neil Armstrong [ Upstream commit 36acf80fc0c4b5ebe6fa010b524d442ee7f08fd3 ] Since [1], controller's busy flag isn't set anymore when the __spi_transfer_message_noqueue() is used instead of the __spi_pump_transfer_message() logic for spi_sync transfers. Since the pow2 clock ops were limited to only be available when a transfer is ongoing (between prepare_transfer_hardware and unprepare_transfer_hardware callbacks), the only way to track this down is to check for the controller cur_msg. [1] ae7d2346dc89 ("spi: Don't use the message queue if possible in spi_sync") Fixes: 09992025dacd ("spi: meson-spicc: add local pow2 clock ops to preserve rate between messages") Fixes: ae7d2346dc89 ("spi: Don't use the message queue if possible in spi_sync") Reported-by: Markus Schneider-Pargmann Signed-off-by: Neil Armstrong Tested-by: Markus Schneider-Pargmann Link: https://lore.kernel.org/r/20220908121803.919943-1-narmstrong@baylibre.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-meson-spicc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi-meson-spicc.c b/drivers/spi/spi-meson-spicc.c index e4cb52e1fe26..6974a1c947aa 100644 --- a/drivers/spi/spi-meson-spicc.c +++ b/drivers/spi/spi-meson-spicc.c @@ -537,7 +537,7 @@ static unsigned long meson_spicc_pow2_recalc_rate(struct clk_hw *hw, struct clk_divider *divider = to_clk_divider(hw); struct meson_spicc_device *spicc = pow2_clk_to_spicc(divider); - if (!spicc->master->cur_msg || !spicc->master->busy) + if (!spicc->master->cur_msg) return 0; return clk_divider_ops.recalc_rate(hw, parent_rate); @@ -549,7 +549,7 @@ static int meson_spicc_pow2_determine_rate(struct clk_hw *hw, struct clk_divider *divider = to_clk_divider(hw); struct meson_spicc_device *spicc = pow2_clk_to_spicc(divider); - if (!spicc->master->cur_msg || !spicc->master->busy) + if (!spicc->master->cur_msg) return -EINVAL; return clk_divider_ops.determine_rate(hw, req); @@ -561,7 +561,7 @@ static int meson_spicc_pow2_set_rate(struct clk_hw *hw, unsigned long rate, struct clk_divider *divider = to_clk_divider(hw); struct meson_spicc_device *spicc = pow2_clk_to_spicc(divider); - if (!spicc->master->cur_msg || !spicc->master->busy) + if (!spicc->master->cur_msg) return -EINVAL; return clk_divider_ops.set_rate(hw, rate, parent_rate); From patchwork Wed Oct 19 08:25: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: 4636 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212186wrs; Wed, 19 Oct 2022 02:06:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Zldaq+hEfisXjIKyxk5uBFu2Ff8WW3pyeIPy1O1iaysCoyJKB/NN9gnsd1SQgUA5PSrXA X-Received: by 2002:a17:906:5d04:b0:722:f46c:b891 with SMTP id g4-20020a1709065d0400b00722f46cb891mr5848686ejt.4.1666170405044; Wed, 19 Oct 2022 02:06:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170405; cv=none; d=google.com; s=arc-20160816; b=ypjsCUewH1E8eQT4Lmtwr/myYLr30uXSvrwL/1brBINH+3RG/+pYvNSe68kmwW4Q5R ULawi5Y+YhSY5cXxgItN2peuFlfdDJk2QU+amBZqJ/sCYsRx39GhOi3Ugoik0UX1a+Hc msGxRe3z8m/WCaZ4WV6it/V+PMt/SGTKMMBR/urg1NcsTfk3KKZUTWlayE0AD62wREJi F2pp5SMFBfBR0HPuyZT9UFKrRaYoxz4D4EhornrOzo6DrRNQTm75S376Dlui2PsGSjjz g6fdUpuh3IYPlF5bR1N0fpaFDDFXM722zXoAsk9Sdu1cknXWN1mBuSgk3UjRYXY8tFzd Pgvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=L1ovdmAtjtt1aDIRSjQsKmE77cBc3L+p+XtHOcJ0abc=; b=BjYz8pTsOmNAmmz2pv39kl5uuK3scGHK82E2TSzlII5sKGrgjOJqKtyoyD/luKc5JC R02FW9YiXZaSOAP5chij7EmRRMJuLrEEjhzd/CXhgwUMdBmz/mpxxkbo8hzu3BL0xysQ T3wPFxYXvAznpB2CuKa2KDUIHECInPOshwxSk28PgOkqlnIEIALcuXfLviBZW9dqK62c /+xNiRj0w67T9VC5jZp12rdD3n6hvWMJ/JMnqVPNw4AgeSh0Kl9jfTuvhuFFvHiC9+V+ 502RuQRJLXT4KRcIW730Gv2S9BQMAAHBCDCy9BjeT3A6QSTRZItQ9NQ24x7yK2hkLg1h mH1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UmHHcEOZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hr2-20020a1709073f8200b007919b3ad78esi4491616ejc.495.2022.10.19.02.06.12; Wed, 19 Oct 2022 02:06: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=UmHHcEOZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232024AbiJSI5f (ORCPT + 99 others); Wed, 19 Oct 2022 04:57:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231968AbiJSI4m (ORCPT ); Wed, 19 Oct 2022 04:56:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B947CE85; Wed, 19 Oct 2022 01:53: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 442906187C; Wed, 19 Oct 2022 08:51:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 52D8BC433C1; Wed, 19 Oct 2022 08:51:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169511; bh=G3B/VF+S16OMDOiqigw8aZvlTpB0ciFKkf7elAxmEL0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UmHHcEOZZLP1W7dByqKbK4yIZh7tRb8IHVlN6d5+8W+REWJ80L3OVdRAu61Kjph+D ga3QvgKlp5nAKuP7MWnYrpup4tUQP0LCMe4+jLhqszkSleb50NfNAnrCsJMIeKiDml ZDgZXXMz/sd6N/oKbb5CRuMC/zN1bfdsOovWJADg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stanislav Fomichev , Lorenz Bauer , Alexei Starovoitov , Sasha Levin Subject: [PATCH 6.0 271/862] bpf: btf: fix truncated last_member_type_id in btf_struct_resolve Date: Wed, 19 Oct 2022 10:25:58 +0200 Message-Id: <20221019083302.004100561@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106298572686280?= X-GMAIL-MSGID: =?utf-8?q?1747106298572686280?= From: Lorenz Bauer [ Upstream commit a37a32583e282d8d815e22add29bc1e91e19951a ] When trying to finish resolving a struct member, btf_struct_resolve saves the member type id in a u16 temporary variable. This truncates the 32 bit type id value if it exceeds UINT16_MAX. As a result, structs that have members with type ids > UINT16_MAX and which need resolution will fail with a message like this: [67414] STRUCT ff_device size=120 vlen=12 effect_owners type_id=67434 bits_offset=960 Member exceeds struct_size Fix this by changing the type of last_member_type_id to u32. Fixes: a0791f0df7d2 ("bpf: fix BTF limits") Reviewed-by: Stanislav Fomichev Signed-off-by: Lorenz Bauer Link: https://lore.kernel.org/r/20220910110120.339242-1-oss@lmb.io Signed-off-by: Alexei Starovoitov Signed-off-by: Sasha Levin --- kernel/bpf/btf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c index 7e64447659f3..36fd4b509294 100644 --- a/kernel/bpf/btf.c +++ b/kernel/bpf/btf.c @@ -3128,7 +3128,7 @@ static int btf_struct_resolve(struct btf_verifier_env *env, if (v->next_member) { const struct btf_type *last_member_type; const struct btf_member *last_member; - u16 last_member_type_id; + u32 last_member_type_id; last_member = btf_type_member(v->t) + v->next_member - 1; last_member_type_id = last_member->type; From patchwork Wed Oct 19 08:25: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: 5077 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp249319wrs; Wed, 19 Oct 2022 03:45:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5IUyuNnSZ78ZkVWpQTR4cBBC3TIE/jyeoaFjpmgN8lUlhqVHVuCoMGTSkp9VlnLnWxBl72 X-Received: by 2002:a17:90a:5e04:b0:20b:1f20:5069 with SMTP id w4-20020a17090a5e0400b0020b1f205069mr43360345pjf.126.1666176343615; Wed, 19 Oct 2022 03:45:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176343; cv=none; d=google.com; s=arc-20160816; b=x2S2LqNAtgY5k2Ns3XzsdDbb98MxkRj4nBgRVMyT2CUCPAGbQ7YYz5nEWVTTD8WaTq YGMPxrpxEnXPQL8VgA5fjMEslwwwOQ7kYfJuKR69jf4elmupvxKMjKzUkECrZA0Bl2Xz ITkccOl4wtH2BEm3xktXZFnG69+Iq74dKCGqk9sPD8pbFbT5tOQ9tmJUJaMBGobQZbJ3 LD8gzo8QuWNoL9eRpWzKPqp7MyJktrBI+Q3ef+jq+H7tbVf9Flp0TE46rxGMSdB9TeDp m6qncE+hyol4q+Nr24GXamsiFY4XHzlaeHNo8VtvECMBbqpcKXSK8y1bIXeoaijiHW9c A8Dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=i3PZAHvWp257PE7Cwr7Tv1+CvxsIuvyHdWkTPC0Kmfk=; b=N/JN6eYo1JpKjsKdh/rmPgVINYluPKr+Qm8c2ATDbi6rzYK3rIe8hSbXySjowOymqD XmiJuzYcoeIp49LkZghv56ud/fLSblCtMcDq5wPJ6RyeMotO3BOTB/DIvbiZ8Ed2V+51 9A0/yarQx1uBEHKqFaJUvRa4WFROIWUvEB/Id7fJKin42Bd6+9nFuuMbPf9+N0k/6/Ee 8TAnlqDslPY9IR1G9PJCyRYcfzj/NQiFroe9Y2OGI1DvqkrO3U0js+KPeIG8nmlI+koe 3Q8Wh2dmGjffjK7kSpE8hFU3bhXrz765TFE7eO9IwvCHJKPbMGxcVslw7XiEREK4mzpz oCUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xGJdSBgP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u4-20020a170902e5c400b001846e0e0511si22641329plf.226.2022.10.19.03.45.29; Wed, 19 Oct 2022 03:45: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=xGJdSBgP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232600AbiJSKpL (ORCPT + 99 others); Wed, 19 Oct 2022 06:45:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232031AbiJSKne (ORCPT ); Wed, 19 Oct 2022 06:43:34 -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 7248EACF44; Wed, 19 Oct 2022 03:20:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6EB0BB82336; Wed, 19 Oct 2022 08:51:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0B09C433D6; Wed, 19 Oct 2022 08:51:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169514; bh=r7arRSQHyneX+YQtZan5pfZMFZYfLBwooiTK+ip3S0A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xGJdSBgPoapChdlaZ8OiRORfL8CqPDhzs4ev8VJy4Fh0k6v8NvtGkKQZaBjxjy+vq Gf7QfqCdmRtzVMUu7/VWdbkFC1MIwKaWHz+um2sCJbqce3WmZhQFJf47ptfhS5eTTI YIQdsrBfI1UgDsyddSKaa1/PoyMhoVjyc6RSnrnE= 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 6.0 272/862] wifi: rtl8xxxu: gen2: Fix mistake in path B IQ calibration Date: Wed, 19 Oct 2022 10:25:59 +0200 Message-Id: <20221019083302.050234305@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112526026600987?= X-GMAIL-MSGID: =?utf-8?q?1747112526026600987?= 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 02b7bc57d217..7a1ea4a59569 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -2929,12 +2929,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 Wed Oct 19 08:26: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: 4816 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp222435wrs; Wed, 19 Oct 2022 02:34:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6JP+K/ZDDW5Z1+D62IgqDOVkWXLhC3icwMOsGFylCiNqwNcqkKzN9J1Y9bgBXZavZCb0Ay X-Received: by 2002:a17:907:7286:b0:78d:2848:bc88 with SMTP id dt6-20020a170907728600b0078d2848bc88mr6093763ejc.67.1666172073556; Wed, 19 Oct 2022 02:34:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172073; cv=none; d=google.com; s=arc-20160816; b=cWcbWiLiF8bTPspKXCvyTG5AgLguTJpBsMqzW16Tyy1Z/a77jUsv5NlVXkYKsmhXkI korvsEIuM3MAe/sveVp5xHJb3aqS7bI5OUyBlSVAnsIC00S5+fEZw0gNfV1fatkhRiHr RaJSvAY8Kh52J+ghZ+RWRqAcsAeMTf3Pb3Jhh0f2RADQbEKaDOAmHJGEPLo+PyneStck CO4EgyDLvXPQmDyp/xjQUUFiMrDQ1QLidhiJM1EOkAs8rkf7rCJ9vcJXyFMmHgV3Kjem 8fddd4er0DmwiFwXhuvnyQT++ZuXtSZz8FF91WXSX+N67k3vcYgStydLo9vJfFl6E86i TaPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BaU0Yu41eevi2I61jsKH9zPZFQ+gJZ2P3okFNMeA6zo=; b=oUYqNWaUb5drjFWRdUIRjbcPzJ26pjw1/rkCW6e6g7Ezlu0s4xNonGKD56Xh5SPrFU ZshkPcSfSp1xH764F6SLwFWyU+//GioxddChcGmLJvfQ7ha20VynaMhBmRKr3nlsZuZX 5cKkSrr+810D4xYM3oRJ38gxKxnGfobK33m1iT/b+BnccEMxrHew8o12LtYuP9iTJrBd W5q9cyV+g9mIuECcK/AtVZfmbO1nVxwGQL+1T3/HnLYQsxz4ywMUTWoVJlRDsVpo/OJx e/wy4NkSkxtjsEBYTvg7ak2l3djiOtv7OSCDOo1nXaadnb5B2oDEE2UnL5WbD1S6YA9Z hsgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zR0Tt6N3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b14-20020a17090630ce00b00782da4ff18dsi12199806ejb.668.2022.10.19.02.34.07; Wed, 19 Oct 2022 02:34: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=zR0Tt6N3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233158AbiJSJR5 (ORCPT + 99 others); Wed, 19 Oct 2022 05:17:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232984AbiJSJM6 (ORCPT ); Wed, 19 Oct 2022 05:12:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02F78C97D9; Wed, 19 Oct 2022 02:03:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9052E617DF; Wed, 19 Oct 2022 08:51:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 970FEC433C1; Wed, 19 Oct 2022 08:51:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169516; bh=Vhqc/iSSYlAG2gq4WdkPUvCQWXXp99Pauwt3oN6zyPk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zR0Tt6N3Ep4KHyvI1fvvl2EvmcMa8V8KDgxScm6DMwHugTpeAL+5pCBhb8aZtpmw7 kkbaMAqpapIEqqvKXp5+h2lgfWzofNDUhSxCW5hMmpyt8YnIPS5Utv0QsdtpTyWedY mtcc/VCWk3ZZUi2oOzTn1eR1eW4gIDyTOKqXkDOU= 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 6.0 273/862] wifi: rtl8xxxu: Remove copy-paste leftover in gen2_update_rate_mask Date: Wed, 19 Oct 2022 10:26:00 +0200 Message-Id: <20221019083302.098577605@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108048418249461?= X-GMAIL-MSGID: =?utf-8?q?1747108048418249461?= From: Bitterblue Smith [ Upstream commit d5350756c03cdf18696295c6b11d7acc4dbf825c ] It looks like a leftover from copying rtl8xxxu_update_rate_mask, which is used with the gen1 chips. It wasn't causing any problems for my RTL8188FU test device, but it's clearly a mistake, so remove it. Fixes: f653e69009c6 ("rtl8xxxu: Implement basic 8723b specific update_rate_mask() function") Signed-off-by: Bitterblue Smith Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/d5544fe8-9798-28f1-54bd-6839a1974b10@gmail.com Signed-off-by: Sasha Levin --- drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c index 7a1ea4a59569..41d46c54444f 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -4353,15 +4353,14 @@ void rtl8xxxu_gen2_update_rate_mask(struct rtl8xxxu_priv *priv, h2c.b_macid_cfg.ramask2 = (ramask >> 16) & 0xff; h2c.b_macid_cfg.ramask3 = (ramask >> 24) & 0xff; - h2c.ramask.arg = 0x80; h2c.b_macid_cfg.data1 = rateid; if (sgi) h2c.b_macid_cfg.data1 |= BIT(7); h2c.b_macid_cfg.data2 = bw; - dev_dbg(&priv->udev->dev, "%s: rate mask %08x, arg %02x, size %zi\n", - __func__, ramask, h2c.ramask.arg, sizeof(h2c.b_macid_cfg)); + dev_dbg(&priv->udev->dev, "%s: rate mask %08x, rateid %02x, sgi %d, size %zi\n", + __func__, ramask, rateid, sgi, sizeof(h2c.b_macid_cfg)); rtl8xxxu_gen2_h2c_cmd(priv, &h2c, sizeof(h2c.b_macid_cfg)); } From patchwork Wed Oct 19 08:26: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: 4641 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212255wrs; Wed, 19 Oct 2022 02:07:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4DATzYiTqCY7Pj7czTlG7oQnV5z8L6+KmGZox0JcXLLuxUj6xaNQ3bShlREWQS1nrh/0No X-Received: by 2002:a05:6402:2706:b0:45d:aaae:e74a with SMTP id y6-20020a056402270600b0045daaaee74amr6329219edd.72.1666170425944; Wed, 19 Oct 2022 02:07:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170425; cv=none; d=google.com; s=arc-20160816; b=b/Fg7/MPiLdqsYEwCBCZ/jLbHHwy68lb8yWYZADEzfJmB5vBNAayCQ1TIBG5xAk3ns WfJowy/c/EkW0tgrFl/vOFkPS5lvQlU5ebjCKvWujqPY0Li2UK3R7n9B8Xe1qhnrX36q xN9jPA21ib3fLNEnGgE9gy3sXbD6ySp11iErEBXTO6oaG/HfRl49AUt3Bigw8tzqmLn4 AE2qa6w9CbolhWNG4iXKH9mzRwF2b3dWmDPbfaRF9DpvmhzQG2i4QQe+S+1cQIhcE/wF gNCq8Uv0zQAr+PAItMuAZ14InhNMJcdlUj4oP2lqGAJPdRLrqs+IFeQIPc8B1qowBNVC cODQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RfGFOvzAZfKtgqDMIvd+71uixaNRQsRHdomjnX7NcU8=; b=ByMTR05gaseAzFyyvo6jCZJmusMaarldkhqyFRD9I7wR9465Pnp1nOzDCVMUh4Q2PM U/IBchQdT1ZKwdRzT2p4mFN5ZRtQzpJgKStDqFW/X6rXSWwN7TZEDFxdwh+i6scT0aj6 Vq/rvCMY6Dgf6Vf7jfmyhDhse9JJK/gKieUVtR8lPIB1EeLrLJ5yIutUzJQzljWtIOtV eU4JYFxyhB6PIqiC+/WDFfc5QlwhEH9EOYegkUoqarrBpCpk6zWe0Lcz6SOHfZZ+hLoA b2Lyp3TtslhwVoP/tODX5UWCpmgEoCO3lZpXvMdFIrm9rlXPcHg4RCfiAPdXy0sdVAca UXLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hv1P2c1d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bh6-20020a170906a0c600b0073d5f9aa5e9si12029666ejb.327.2022.10.19.02.06.30; Wed, 19 Oct 2022 02:07: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=hv1P2c1d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232053AbiJSI6P (ORCPT + 99 others); Wed, 19 Oct 2022 04:58:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231949AbiJSI5E (ORCPT ); Wed, 19 Oct 2022 04:57:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 051EC193EE; Wed, 19 Oct 2022 01:53:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 20F016186B; Wed, 19 Oct 2022 08:52:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34B58C433C1; Wed, 19 Oct 2022 08:51:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169519; bh=lpoonZ2TlVs0iMtpGE/VUE4JhkN9JsM8I1mBYYrYK/M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hv1P2c1d6yK2aanKopY2Cd7BD4nIncDvU2xdaTF6zk+px/W/zQBE8vqmIe/oXWZuq AO5ggzH+Io5MbO1JBM85rfsqX9pxANId0dhMNIYKXF+/ZU9K0gPOXJ1jKL0tFlkvP7 A3mZW9oCZIJia03Wj0wEuWjrScpDFWapcTyJovPA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+844c7bf1b1aa4119c5de@syzkaller.appspotmail.com, Tetsuo Handa , Luiz Augusto von Dentz , Sasha Levin Subject: [PATCH 6.0 274/862] Bluetooth: avoid hci_dev_test_and_set_flag() in mgmt_init_hdev() Date: Wed, 19 Oct 2022 10:26:01 +0200 Message-Id: <20221019083302.138874417@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106320700018470?= X-GMAIL-MSGID: =?utf-8?q?1747106320700018470?= From: Tetsuo Handa [ Upstream commit f74ca25d6d6629ffd4fd80a1a73037253b57d06b ] syzbot is again reporting attempt to cancel uninitialized work at mgmt_index_removed() [1], for setting of HCI_MGMT flag from mgmt_init_hdev() from hci_mgmt_cmd() from hci_sock_sendmsg() can race with testing of HCI_MGMT flag from mgmt_index_removed() from hci_sock_bind() due to lack of serialization via hci_dev_lock(). Since mgmt_init_hdev() is called with mgmt_chan_list_lock held, we can safely split hci_dev_test_and_set_flag() into hci_dev_test_flag() and hci_dev_set_flag(). Thus, in order to close this race, set HCI_MGMT flag after INIT_DELAYED_WORK() completed. This is a local fix based on mgmt_chan_list_lock. Lack of serialization via hci_dev_lock() might be causing different race conditions somewhere else. But a global fix based on hci_dev_lock() should deserve a future patch. Link: https://syzkaller.appspot.com/bug?extid=844c7bf1b1aa4119c5de Reported-by: syzbot+844c7bf1b1aa4119c5de@syzkaller.appspotmail.com Signed-off-by: Tetsuo Handa Fixes: 3f2893d3c142986a ("Bluetooth: don't try to cancel uninitialized works at mgmt_index_removed()") Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin --- net/bluetooth/mgmt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 72e6595a71cc..3d1cd0666968 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c @@ -1050,7 +1050,7 @@ static void discov_off(struct work_struct *work) static void mgmt_init_hdev(struct sock *sk, struct hci_dev *hdev) { - if (hci_dev_test_and_set_flag(hdev, HCI_MGMT)) + if (hci_dev_test_flag(hdev, HCI_MGMT)) return; BT_INFO("MGMT ver %d.%d", MGMT_VERSION, MGMT_REVISION); @@ -1065,6 +1065,8 @@ static void mgmt_init_hdev(struct sock *sk, struct hci_dev *hdev) * it */ hci_dev_clear_flag(hdev, HCI_BONDABLE); + + hci_dev_set_flag(hdev, HCI_MGMT); } static int read_controller_info(struct sock *sk, struct hci_dev *hdev, From patchwork Wed Oct 19 08:26: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: 4785 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp215921wrs; Wed, 19 Oct 2022 02:17:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7uwxbFEgDdcGb5+VuWgmSH8pmK4WwgJBvnDjHOLaWvuNcFXcjBbqjJmQb+ry3tOIA8bv9j X-Received: by 2002:a05:6402:3512:b0:45d:4f99:6151 with SMTP id b18-20020a056402351200b0045d4f996151mr6361225edd.74.1666171022439; Wed, 19 Oct 2022 02:17:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666171022; cv=none; d=google.com; s=arc-20160816; b=SLD9dCzN+5faQnR+lLeSU8lJoX6KPsTX98+f+R2YgTL/SJ/RzVolIFXhzYf1GvUET6 zZLIASb5EK2QCHMzkJ0PiJdE/oegQWOUtjerjh3h2hTxyPgkMbDv9QyQo/YbX9LNsCmD /j4BuQOGuTAQ3N0Fs94gy0p13k6qOmqixX8v0Df9P8Fj3zJ+OZ6SSUQ2dV/K/90Xzfp7 chndRfSFiO9JhesApxx7dhRMhOOG0TpQhH3lqXicnwyttDqK5gXm6PMCHl36t18njcEh N+0KQKt1412ZlJiF4YE86UorXxLbiTZsPjBHJgl8gE/N6gTprxurZ/0CffrR5Mjb4FJg H8IQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=mSMtweZNEf8HqZV3PlHLoWqEumGOtI3+vXVTAGqxsDo=; b=KJlKiIhWNVjOCS4BPb8/pYLjRU1QCIM3etPNM8Tpdr7ZnrJWhIwMaPCoItHK+O8HPD zQBq9sxbqQhkFIdEGdaQbtpyZnb8OS2OIH9ubtvIhXqoHktFFwm5EGaO/3BTPvlbuOIS 4Fj8fzmTbpMh/aw0T+YKDd+olYXHr6AQwk0CP9XB2lYU6RFqXoitnnZ9GUOHA+sUsDQR os6DLDlD2lvyrom4AWC0qVgmSM0KhWWqD/q8Y9VXH4XBRCXFqNSHQF6+387/02pojZWU 7gPEuiE9HD5r9bGuXS4mPCaFFwlTY19rOQD+eeNdmiDYXVl8N/wAZa+CT6ohIQIDbM+1 9LNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jgaYDsgT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dd17-20020a1709069b9100b0077cfec3a52fsi15073204ejc.839.2022.10.19.02.16.38; Wed, 19 Oct 2022 02: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=jgaYDsgT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233069AbiJSJQB (ORCPT + 99 others); Wed, 19 Oct 2022 05:16:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232992AbiJSJNC (ORCPT ); Wed, 19 Oct 2022 05:13:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F06B6BCBA2; Wed, 19 Oct 2022 02:03:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AE05361879; Wed, 19 Oct 2022 08:52:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1741C433D6; Wed, 19 Oct 2022 08:52:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169522; bh=h2b9klU9HPAy6q0Q6MKdBI8G1gu0t6l4l0Iv3oCvsdw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jgaYDsgTIJL70M5YOyOzIIlVx991R3OGuH6XdlEgFrG77Q7T34/FSAT0b+f0avdAw CQ0i/t+2YGYPjuq8hedTpG2pcTA2OMDAP5eI4ckqMN6DNSC6vm/y+1FlptERVDYJD2 xQhLi2FS46MQeUTzuplL5b7HBVWm2s5KdILqcrLc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, YN Chen , Sean Wang , Felix Fietkau , Sasha Levin Subject: [PATCH 6.0 275/862] wifi: mt76: mt7921e: fix race issue between reset and suspend/resume Date: Wed, 19 Oct 2022 10:26:02 +0200 Message-Id: <20221019083302.177387254@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106946067018376?= X-GMAIL-MSGID: =?utf-8?q?1747106946067018376?= From: Sean Wang [ Upstream commit ff6c4a6449793e9718ef2e9ad46864b63022648e ] It is unexpected that the reset work is running simultaneously with the suspend or resume context and it is possible that reset work is still running even after mt7921 is suspended if we don't fix the race issue. Thus, the suspend procedure should be waiting until the reset is completed at the beginning and ignore the subsequent the reset requests. In case there is an error that happens during either suspend or resume handler, we will schedule a reset task to recover the error before returning the error code to ensure we can immediately fix the error there. Fixes: 0c1ce9884607 ("mt76: mt7921: add wifi reset support") Co-developed-by: YN Chen Signed-off-by: YN Chen Signed-off-by: Sean Wang Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt7921/mac.c | 5 +++++ drivers/net/wireless/mediatek/mt76/mt7921/pci.c | 13 +++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c index 47f0aa81ab02..6bd9fc9228a2 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c @@ -780,6 +780,7 @@ void mt7921_mac_reset_work(struct work_struct *work) void mt7921_reset(struct mt76_dev *mdev) { struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76); + struct mt76_connac_pm *pm = &dev->pm; if (!dev->hw_init_done) return; @@ -787,8 +788,12 @@ void mt7921_reset(struct mt76_dev *mdev) if (dev->hw_full_reset) return; + if (pm->suspended) + return; + queue_work(dev->mt76.wq, &dev->reset_work); } +EXPORT_SYMBOL_GPL(mt7921_reset); void mt7921_mac_update_mib_stats(struct mt7921_phy *phy) { diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c index ea3069d18c35..2b015dacbba2 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c @@ -367,6 +367,7 @@ static int mt7921_pci_suspend(struct device *device) int i, err; pm->suspended = true; + flush_work(&dev->reset_work); cancel_delayed_work_sync(&pm->ps_work); cancel_work_sync(&pm->wake_work); @@ -428,6 +429,9 @@ static int mt7921_pci_suspend(struct device *device) restore_suspend: pm->suspended = false; + if (err < 0) + mt7921_reset(&dev->mt76); + return err; } @@ -441,7 +445,7 @@ static int mt7921_pci_resume(struct device *device) err = mt7921_mcu_drv_pmctrl(dev); if (err < 0) - return err; + goto failed; mt7921_wpdma_reinit_cond(dev); @@ -471,11 +475,12 @@ static int mt7921_pci_resume(struct device *device) mt76_connac_mcu_set_deep_sleep(&dev->mt76, false); err = mt76_connac_mcu_set_hif_suspend(mdev, false); - if (err) - return err; - +failed: pm->suspended = false; + if (err < 0) + mt7921_reset(&dev->mt76); + return err; } From patchwork Wed Oct 19 08:26: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: 5550 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp349351wrs; Wed, 19 Oct 2022 07:11:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7ejhQQcrTCqPhUe6hnzSmfOe2wTXtaZbtPHYy3Gd5LeZ4cxpkJLNHD1QEXdPGyirPQVUmi X-Received: by 2002:a17:907:7fa4:b0:791:9307:9d6a with SMTP id qk36-20020a1709077fa400b0079193079d6amr6934588ejc.464.1666188709154; Wed, 19 Oct 2022 07:11:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666188709; cv=none; d=google.com; s=arc-20160816; b=BkY4VbRV9yJL8X5BHOU05W/nIMeQ+asxDUwrApAGc3VciPgJnsDaWeANvqsOK5DHoj qWop0qByQTRnJpLAZPiniUsjIoJnn9aqvo28BLfudkkfexMea9KNk5K+CmDkEZkBoZo4 y7Lafhlzwxv0C+xsvZPGP0oH6eE2ZmBJvOLcUSSJLBbuCRFdS5DrlXpMx9QWAKx22MBR zZJLC8ziq4NzFbdMfPlHFzp3ujeC1W6c3XZUl2i6UyJSTqYGz7a3h1ij3+oNkvh+6toj 4J4DMJ8WrAUv3JD9HUKQ8BCDRBcVsYKM+OCpFiD04FBOaG4tLnfDj7qvhp8r4x3tzM3M 0E7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qkpqt7ljuSe0j8/kwV5lFpkG3cVgSfObRlkGBfw0zOw=; b=GtqiUbHKTPiA3HudkvMlRsPJBGbIV4lh6xC+SwVN9AXuZ3CG81fua3rS1TDyHtxOj1 W9SMrBmD36SFJQ5ElYz9lJ0Ucjw5W/I9Sz2bF0lGAd5nRgUbntVfUc7jy6YbYGNyrFua AzuzFmBQNPR5aP1mN5Qx/Y5WoCDerOPqpAMguXT4gTg7QHl5gYLuxmpcAFuIyQT3NxhD 0qLaLf2PM7/Oa0hK6pnfOuNoDF1siCJbWTj7T+sB7gGoefFQ9tzVldjQQuZ7cdQGTcx6 p/dlfoU6OQY/vBINKYNqCIj5LiXp7y8NcSJxD9ZxfQLWJi60kH7FshHwIbTNaKV0LXGx gi5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xYSjYRYb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e9-20020a056402190900b0045d9ceae633si9045855edz.55.2022.10.19.07.11.01; Wed, 19 Oct 2022 07:11:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xYSjYRYb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230261AbiJSN4c (ORCPT + 99 others); Wed, 19 Oct 2022 09:56:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233824AbiJSNyI (ORCPT ); Wed, 19 Oct 2022 09:54: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 C2F6D1DC822; Wed, 19 Oct 2022 06:36: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 2DC95B82388; Wed, 19 Oct 2022 08:50:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 810DBC433D6; Wed, 19 Oct 2022 08:50:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169434; bh=+Gu7QzlWRpwbVMYhNonG5PitRlXoTuYCdza+QJFhkd0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xYSjYRYbOXpjr/m6gPmYL/GRNQ647U2sx8quYnxeiYRGCtTwR48GsSpDOU7koccM6 JakXJ1vOsC/srAGoX6m+NTRE/3StYQHisOJRE+LEKT0IacsQQz8UpmUm4xGCuJfeTz 2mp/b6lWiCQfcitah2UFpq691LhhsZUAxtOOF0tc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, YN Chen , Sean Wang , Felix Fietkau , Sasha Levin Subject: [PATCH 6.0 276/862] wifi: mt76: mt7921s: fix race issue between reset and suspend/resume Date: Wed, 19 Oct 2022 10:26:03 +0200 Message-Id: <20221019083302.219343270@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747125492006390244?= X-GMAIL-MSGID: =?utf-8?q?1747125492006390244?= From: Sean Wang [ Upstream commit e86f10e6809add9132ecc2c6b3184ed59db7ca71 ] It is unexpected that the reset work is running simultaneously with the suspend or resume context and it is possible that reset work is still running even after mt7921 is suspended if we don't fix the race issue. Thus, the suspend procedure should be waiting until the reset is completed at the beginning and ignore the subsequent the reset requests. In case there is an error that happens during either suspend or resume handler, we will schedule a reset task to recover the error before returning the error code to ensure we can immediately fix the error there. Fixes: ca74b9b907f9 ("mt76: mt7921s: add reset support") Co-developed-by: YN Chen Signed-off-by: YN Chen Signed-off-by: Sean Wang Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt7921/sdio.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/sdio.c b/drivers/net/wireless/mediatek/mt76/mt7921/sdio.c index 487acd6e2be8..2face849fb4f 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/sdio.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/sdio.c @@ -206,6 +206,7 @@ static int mt7921s_suspend(struct device *__dev) pm->suspended = true; set_bit(MT76_STATE_SUSPEND, &mdev->phy.state); + flush_work(&dev->reset_work); cancel_delayed_work_sync(&pm->ps_work); cancel_work_sync(&pm->wake_work); @@ -261,6 +262,9 @@ static int mt7921s_suspend(struct device *__dev) clear_bit(MT76_STATE_SUSPEND, &mdev->phy.state); pm->suspended = false; + if (err < 0) + mt7921_reset(&dev->mt76); + return err; } @@ -276,7 +280,7 @@ static int mt7921s_resume(struct device *__dev) err = mt7921_mcu_drv_pmctrl(dev); if (err < 0) - return err; + goto failed; mt76_worker_enable(&mdev->tx_worker); mt76_worker_enable(&mdev->sdio.txrx_worker); @@ -288,11 +292,12 @@ static int mt7921s_resume(struct device *__dev) mt76_connac_mcu_set_deep_sleep(mdev, false); err = mt76_connac_mcu_set_hif_suspend(mdev, false); - if (err) - return err; - +failed: pm->suspended = false; + if (err < 0) + mt7921_reset(&dev->mt76); + return err; } From patchwork Wed Oct 19 08:26: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: 5547 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp349063wrs; Wed, 19 Oct 2022 07:11:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7+E1JIQoH5YUbJbsrOzfDQtTNNqkp7Fb6iVO0Yq1ucBE0/axpFD2x8jOXQcvHW3Z8Q68nr X-Received: by 2002:a17:902:ab1d:b0:180:4030:757d with SMTP id ik29-20020a170902ab1d00b001804030757dmr8430248plb.155.1666188674390; Wed, 19 Oct 2022 07:11:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666188674; cv=none; d=google.com; s=arc-20160816; b=BZ6Yno/W+ntbRx5z48TVrxZGZgZpmuy+v+sv9n68Uz1tOZij0RMQ9m9UxXqqkCzQAk qSO6LBFRBkCvb7Sf98TEVHZLy6uD/yWrKshXaA3LBvryzxYsbQckkV/wMpPHlQTPKaPn 1J7VaM4ZlfLDBrhZMc+Bt77BhSPZg+p3O4txDj4o0adyJmsdk0unXLEygVck9mVT5+AL utnYzM1Dgjrtfg+XDytn+y8kGwibaI2C+sLyy5Qtay7oStHBEWqmayrX5rMYOxEkxHqc MbPSmt00UvkSZpJgudVku9TmmHAjIwyRzDXVLM22W2utt10VqnW9HwgqIu2xMAN7wCKR Im/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=EGhGGUtBqfrtdHP4lsMHDBRvEDWkXEx0iLLJTqr7gdk=; b=JkLVFSh3b5GguDho8PevxV3BxpOm+mWEEUTOkUqKTw6U+X9UJ+56D0QMHdUYs9St09 i2JNkCdXzShrT6Cc+yHc/lnhimec5Xir5zc33RujBxMJTj5S8ZVFJev9wHKk73kxICnj 5gKEIOsJMl1EdayNhIU0CnvRwJUpebQJKqtiDczOb5w/iePVZPxp91T1bIJsLlRbmvOb TDDjEPTwYixLdzQZzYPEPWDgjCY4Y/8dPqWI90aNCt2q4ogY5nobf2s0sI5kZjx0QyJR 1dm2tgmjtrcQ6biEf8/2Gq603zHOASlvgl/9Jb8046LMjWQmZb627Se7O5VlUVEVlP6d AD5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=P6gAChRV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a15-20020a17090a70cf00b0020a98093e0bsi54063pjm.44.2022.10.19.07.10.53; Wed, 19 Oct 2022 07:11: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=P6gAChRV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231497AbiJSN4F (ORCPT + 99 others); Wed, 19 Oct 2022 09:56:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233875AbiJSNyP (ORCPT ); Wed, 19 Oct 2022 09:54: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 1FB3C1DB8B6; Wed, 19 Oct 2022 06:36: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 CEDD0B8238C; Wed, 19 Oct 2022 08:50:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D81EC4347C; Wed, 19 Oct 2022 08:50:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169437; bh=1xY5XAr/WSrFdgBgCftPjgXpxV3yIuGvvgk5dYMelJk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P6gAChRV4r5396VsDpu48o1vWzEe0Btxy1kM2seku/f4F5gUX68pfTQEprwIiZ8Ea jIGZ/5vlV0Djn1mMzJWec+tH7A/uR3b1h9KWfxVjixHcR8URO2Scixhk/wMUC6RC+E ucg5fIv8IddqPXPtBKKGm3ey7LG5POF4aVpX5Lp0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, YN Chen , Sean Wang , Felix Fietkau , Sasha Levin Subject: [PATCH 6.0 277/862] wifi: mt76: mt7921u: fix race issue between reset and suspend/resume Date: Wed, 19 Oct 2022 10:26:04 +0200 Message-Id: <20221019083302.268615421@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747125455379803611?= X-GMAIL-MSGID: =?utf-8?q?1747125455379803611?= From: Sean Wang [ Upstream commit 86f15d043ba7f13211d5c3e41961c3381fb12880 ] It is unexpected that the reset work is running simultaneously with the suspend or resume context and it is possible that reset work is still running even after mt7921 is suspended if we don't fix the race issue. Thus, the suspend procedure should be waiting until the reset is completed at the beginning and ignore the subsequent the reset requests. In case there is an error that happens during either suspend or resume handler, we will schedule a reset task to recover the error before returning the error code to ensure we can immediately fix the error there. Fixes: df3e4143ba8a ("mt76: mt7921u: add suspend/resume support") Co-developed-by: YN Chen Signed-off-by: YN Chen Signed-off-by: Sean Wang Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- .../net/wireless/mediatek/mt76/mt7921/usb.c | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/usb.c b/drivers/net/wireless/mediatek/mt76/mt7921/usb.c index dd3b8884e162..613d5cefffc7 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/usb.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/usb.c @@ -300,11 +300,15 @@ static void mt7921u_disconnect(struct usb_interface *usb_intf) static int mt7921u_suspend(struct usb_interface *intf, pm_message_t state) { struct mt7921_dev *dev = usb_get_intfdata(intf); + struct mt76_connac_pm *pm = &dev->pm; int err; + pm->suspended = true; + flush_work(&dev->reset_work); + err = mt76_connac_mcu_set_hif_suspend(&dev->mt76, true); if (err) - return err; + goto failed; mt76u_stop_rx(&dev->mt76); mt76u_stop_tx(&dev->mt76); @@ -312,11 +316,20 @@ static int mt7921u_suspend(struct usb_interface *intf, pm_message_t state) set_bit(MT76_STATE_SUSPEND, &dev->mphy.state); return 0; + +failed: + pm->suspended = false; + + if (err < 0) + mt7921_reset(&dev->mt76); + + return err; } static int mt7921u_resume(struct usb_interface *intf) { struct mt7921_dev *dev = usb_get_intfdata(intf); + struct mt76_connac_pm *pm = &dev->pm; bool reinit = true; int err, i; @@ -338,16 +351,23 @@ static int mt7921u_resume(struct usb_interface *intf) if (reinit || mt7921_dma_need_reinit(dev)) { err = mt7921u_dma_init(dev, true); if (err) - return err; + goto failed; } clear_bit(MT76_STATE_SUSPEND, &dev->mphy.state); err = mt76u_resume_rx(&dev->mt76); if (err < 0) - return err; + goto failed; + + err = mt76_connac_mcu_set_hif_suspend(&dev->mt76, false); +failed: + pm->suspended = false; + + if (err < 0) + mt7921_reset(&dev->mt76); - return mt76_connac_mcu_set_hif_suspend(&dev->mt76, false); + return err; } #endif /* CONFIG_PM */ From patchwork Wed Oct 19 08:26: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: 5567 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp350536wrs; Wed, 19 Oct 2022 07:13:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4ggFSDVLJKq4ujLnPNTyIei1lU2xEq7jT/4s/eKDdtTu0jksVdEYKxZLnIjvYz8hp87WZc X-Received: by 2002:a17:90b:1184:b0:20c:c0f:7c43 with SMTP id gk4-20020a17090b118400b0020c0c0f7c43mr46158960pjb.236.1666188834484; Wed, 19 Oct 2022 07:13:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666188834; cv=none; d=google.com; s=arc-20160816; b=Bn9tkGU1EaC3e08s9vWHXuWNrSc0mPS2BSsUOfPEIPi13psL8IxyBkvekqH8Ct9s7H +IEuHG+nylVRJQQvvMzbH9O1ryAfJ7GLUPFlw8BiGfil6qmsW61+j6iotWLyQd7AitYQ SVn+dnU/tqQgkTU4tIOO8iAEZzpiH+YNcGoahoiNvXChkEDtLrEwSnwVpKFdMR/aovc2 VE4hIEN4WdhEhIPXSW2FGJDmx7DinQQDSb7/8Dwcgu33i4EuD/leuw8qNXNRVlyS1Hyc 2fImsgmisIlJIaBhf2DumUw614I3qDF6rdwaqhDKvLrMSJ83SHJCL8lww9BKqiqQRfde tbHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wGyU6M+G5l6uYKOeCAkkDjMBiMsUEQOgQuuSJlln4wc=; b=uGNuG2lF7TmqcClPV8+EV4SE/akZmhZskn10gWnij69bYIsHrI6GWo72jHBiRRRip8 hO3Q2oa0tA3/LaIGauGhnCfKwmQlxwjcxndDeO6l3IEXOYkH1p1JKwlBCy2L3TQhjElf h6P/VfJuRJ2noqGb6UByo4nO28NK4SxSt22V7rdjCsEpC8miEA/I1S2i4yPyQ+xAVdnE ygDne0LQLDmNlU44wWD6dJe7s37vbhtY1yCs5Jf8qbCF7MOFrSjKnmG3tpvUIPJwtZks i52n2cyTMUJnEAYPKv4gGkSaMr0+iZ5uDAhxk6rk0N0JWw6TTeyvAKZlnfL16EqfXzA9 hK8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tsibVVda; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q17-20020a170902f35100b0017684491caasi15195589ple.594.2022.10.19.07.13.30; Wed, 19 Oct 2022 07:13:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tsibVVda; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233740AbiJSN4u (ORCPT + 99 others); Wed, 19 Oct 2022 09:56:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231302AbiJSNxc (ORCPT ); Wed, 19 Oct 2022 09:53:32 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C0B31CBAA1; Wed, 19 Oct 2022 06:36: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 594F2B82397; Wed, 19 Oct 2022 08:50:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C949FC4314D; Wed, 19 Oct 2022 08:50:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169440; bh=2K8Ly1+cLGZDbnIHbo7zA+ju2+Kk+NzBIKrGvopcenM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tsibVVdaloTosFNd05+uqZ09lvFMf1NtJ9RYhn0FOd3GCJjUZa7kGeeqXzleZKsgz T3f/zvHuLCJNwrbxDNRFvbhs6Nlf+WJdyiuZKCknIWiuz60F8KSEnCwr6HSHBjWpWl h6pxaBNSiXzh/0iArATo6j6EFp6kPPi5xodBlMlc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, YN Chen , Sean Wang , Felix Fietkau , Sasha Levin Subject: [PATCH 6.0 278/862] wifi: mt76: sdio: fix the deadlock caused by sdio->stat_work Date: Wed, 19 Oct 2022 10:26:05 +0200 Message-Id: <20221019083302.305602434@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747125623654596048?= X-GMAIL-MSGID: =?utf-8?q?1747125623654596048?= From: Sean Wang [ Upstream commit e5d78fd998be94fb459a3d625df7367849b997b8 ] Because wake_work and sdio->stat_work share the same workqueue mt76->wq, if sdio->stat_work cannot acquire the mutex lock such as that was possibly held up by [mt7615, mt7921]_mutex_acquire. Additionally, if [mt7615, mt7921]_mutex_acquire was called by sdio->stat_work self, the wake would be blocked by itself. Thus, we move the stat_work into ieee80211_workqueue instead to break the deadlock. Fixes: d39b52e31aa6 ("mt76: introduce mt76_sdio module") Co-developed-by: YN Chen Signed-off-by: YN Chen Signed-off-by: Sean Wang Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/sdio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/sdio.c b/drivers/net/wireless/mediatek/mt76/sdio.c index aba2a9865821..fb2caeae6dba 100644 --- a/drivers/net/wireless/mediatek/mt76/sdio.c +++ b/drivers/net/wireless/mediatek/mt76/sdio.c @@ -481,7 +481,7 @@ static void mt76s_status_worker(struct mt76_worker *w) if (dev->drv->tx_status_data && !test_and_set_bit(MT76_READING_STATS, &dev->phy.state) && !test_bit(MT76_STATE_SUSPEND, &dev->phy.state)) - queue_work(dev->wq, &dev->sdio.stat_work); + ieee80211_queue_work(dev->hw, &dev->sdio.stat_work); } while (nframes > 0); if (resched) @@ -508,7 +508,7 @@ static void mt76s_tx_status_data(struct work_struct *work) } if (count && test_bit(MT76_STATE_RUNNING, &dev->phy.state)) - queue_work(dev->wq, &sdio->stat_work); + ieee80211_queue_work(dev->hw, &sdio->stat_work); else clear_bit(MT76_READING_STATS, &dev->phy.state); } From patchwork Wed Oct 19 08:26: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: 5563 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp350393wrs; Wed, 19 Oct 2022 07:13:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4mAMZ8uP0fWdspTijlcxozAC/xvLe6MAKtYDMPKPY2YVI0QqpkBv3gjE15o4PSea3wLkBu X-Received: by 2002:a17:907:168c:b0:78d:8b6c:a209 with SMTP id hc12-20020a170907168c00b0078d8b6ca209mr7350971ejc.185.1666188814613; Wed, 19 Oct 2022 07:13:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666188814; cv=none; d=google.com; s=arc-20160816; b=PGt2a9IgVh0Gy4qFoUGBZ6Hken9KutyAMlgg4EBqKI+XOfVzDrthn2+OEm0ltIzA/9 JsvzeVLQIjON4mBmNzPS/9liCz0tK1qDG4CEB3YE9JTxEFroSaqd7cFEKtQV3n0gjUkl rYjH+gqTJkSbkZ7inqHMslRlKrhdpohhTgysDTmZPakgLtHnT2uo274ZaX955ao2eeD4 alpKKCkpjEKRAOEGvUHZW67ttPwKRuKJUSg/WVCyuzKcfykiYbXMzxehvI4kfy0t9cd7 PuDl9a2it8AAjeZgcVjRi/W1kG6EaJOcwlwQUFxntA8OD6dSFBQedhxXASzuceidmrVx TYcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BMK3QLdSE7MdI3peCjttmS41IZPZEYS2eybE2hH8QsE=; b=LGn+9G4TwULwtOmpYezUC/aZvke29xNuyvp1Y/2oXi0ttOXmUWY4lhyNqabF3bAo5J z+hyM6tvQB5QHbYutQlnMO+pnhVabEfHbYHj3V/aPxiudQRB5zYMagrStyhFmG6F4rvS skzlZfAPCOyhUpw0jHKNe6zimvnWne7l+bjLrZmlBoba8h8xoZ3l020e0YiF6kUoTN/V BV6qbQFxhtw6FL2wSXpvprokJEb+bR97IEIzVBlZSIMq6DLKPQDksdx/xRFM/tF0/435 i0vTXg+2nJW8wH3OcWpZ9r3e67AZreKmOOkxDLoRadrsSdqTVthLwou92sEhbcWXw3yo US8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=n3pVIZnX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sh40-20020a1709076ea800b0078d1e610b3esi14186436ejc.26.2022.10.19.07.12.56; Wed, 19 Oct 2022 07:13:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=n3pVIZnX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231237AbiJSN6t (ORCPT + 99 others); Wed, 19 Oct 2022 09:58:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234079AbiJSNyr (ORCPT ); Wed, 19 Oct 2022 09:54:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D7DE1DDC21; Wed, 19 Oct 2022 06:37:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 068E7B82386; Wed, 19 Oct 2022 08:50:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A77BC433D7; Wed, 19 Oct 2022 08:50:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169442; bh=NFjboH5Ssva6H4YiEcOPIbsLI+ky7p8zequ7ek/+zBc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n3pVIZnX0Di40y1c+KHerC/uNdQViD3pLrP+ccidM+IlLY3CLpMK147FHP0N95OYd iXw0OE4F5uFqkaSbKRm1ylYIg+XZp9fpKlFAHs2OUcvfgIePCJxrtvEqQfhzCFGy2V SRiTqkOaA2wZaY0ou9Ocb7CPK+yIY76HNui1jqBA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Wang , Felix Fietkau , Sasha Levin Subject: [PATCH 6.0 279/862] wifi: mt76: sdio: poll sta stat when device transmits data Date: Wed, 19 Oct 2022 10:26:06 +0200 Message-Id: <20221019083302.353274253@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747125602713852020?= X-GMAIL-MSGID: =?utf-8?q?1747125602713852020?= From: Sean Wang [ Upstream commit a323e5f041dd11af5e3de19ed7ea95a97d588c11 ] It is not meaningful to poll sta stat when there is no data traffic. So polling sta stat when the device has transmitted data instead to save CPU power. That implies that it is unallowed the stat_work to work while MCU is being initialized in the really early stage to fix the possible time to time MCU initialization failure. Fixes: d39b52e31aa6 ("mt76: introduce mt76_sdio module") Signed-off-by: Sean Wang Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/sdio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/sdio.c b/drivers/net/wireless/mediatek/mt76/sdio.c index fb2caeae6dba..ece4e4bb94a1 100644 --- a/drivers/net/wireless/mediatek/mt76/sdio.c +++ b/drivers/net/wireless/mediatek/mt76/sdio.c @@ -478,7 +478,7 @@ static void mt76s_status_worker(struct mt76_worker *w) if (ndata_frames > 0) resched = true; - if (dev->drv->tx_status_data && + if (dev->drv->tx_status_data && ndata_frames > 0 && !test_and_set_bit(MT76_READING_STATS, &dev->phy.state) && !test_bit(MT76_STATE_SUSPEND, &dev->phy.state)) ieee80211_queue_work(dev->hw, &dev->sdio.stat_work); From patchwork Wed Oct 19 08:26: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: 4714 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp213904wrs; Wed, 19 Oct 2022 02:11:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM69YMxeljvhhircSnVKYkU8PZHlXH6h7Hq4pC7eD+ddBeF5bZ5nTk8xzmaZpJdQcUhNm/+D X-Received: by 2002:a05:6402:1941:b0:457:13a:cce9 with SMTP id f1-20020a056402194100b00457013acce9mr6577350edz.265.1666170684400; Wed, 19 Oct 2022 02:11:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170684; cv=none; d=google.com; s=arc-20160816; b=iIOn0wPrQkrKMInMzdmNqyBWTMq+nFwM374j1VC2JU7ehtpR1OKgePelZHlSXTCrU7 d+MKvLSAAyY6CnhCBSkBVkMjiyKoUTFqJG6+z9Iiwe8Egna/mq9VonIJV8QC9rNrAbjn lhgkBnZLJaGvh6ur9mAnFmDiv80x3a828PHvOUSxr+v/DKLwu3Gi0aAC4DiVXi9yJPO5 xz582nU20TNWspvk6CwOFrhOY7De8nLHuT+G6tTLiFoyllTLD4io4TaBCmw7SH13OtQi vE6NFplQjbm9v8H015WvZz2dm9N8m/fghnKm3J6/XA1iOT1SIbfIlTZWLOKtwSA8W7xt uHZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZGqAC2cvXFobH69MHozHeP82BOM6MhWD2AOvD81hul8=; b=t66YWncIcR3MiL6GrHItZ4uZvMxIlaeHt7g1HZcnyRdPHdVpHsiVxrl2Xon4q07680 2F9NcN2saBBZy+bv2GXa6RHEAIGT1lRkSYOR2tVzVVrTDaNmvB6LBYMLai8ai7wIrGRK kMGa/k7mfNGOOOQnxr79WuBgg3M9yW98Fc4i99ujaGBZVozo5WRlliQUNi7I7WkPgGN9 7sfR79qceZ6pYeKC6uVVM2XF1CdCX1Nt7h1dhJHdJ3PgHjlzjbfAlrX3JscH4IdhlX5L 8vbPvRK0OzeENcE+/Pe+CrGASsRrqe9+gCkxFi6zFHmsPsBkTNC7paiy43O3xwZeqZgx u2zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=r2Zv6Nvt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a1709076d1a00b00741c0bd7061si14087927ejc.644.2022.10.19.02.10.59; Wed, 19 Oct 2022 02:11: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=r2Zv6Nvt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232580AbiJSJHb (ORCPT + 99 others); Wed, 19 Oct 2022 05:07:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232770AbiJSJFF (ORCPT ); Wed, 19 Oct 2022 05:05: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 11DB1B3B2A; Wed, 19 Oct 2022 01:59: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 D6645617D6; Wed, 19 Oct 2022 08:50:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E58DBC433C1; Wed, 19 Oct 2022 08:50:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169445; bh=Y3IO5HhywAPti2cGUGNnM3/p1KnERdnF6bkopTa9wOI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r2Zv6NvtFEpY1eNkxKljG9SlgliWB9yxGjt6EsfH3Wd4dYfaP2t+wHqYjnD/BKZDW 90CjziSs3m0/lrGeOar7jnsadsev6IRwWw8ug5iIK9S+M4sY3sA7Y4BbGJr02O+NlN w/ke77ouZe6MiyyXuotnv3HT4ehE7xe52+G6+Nts= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Felix Fietkau , Sasha Levin Subject: [PATCH 6.0 280/862] wifi: mt76: mt7915: fix an uninitialized variable bug Date: Wed, 19 Oct 2022 10:26:07 +0200 Message-Id: <20221019083302.394228816@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106591104719743?= X-GMAIL-MSGID: =?utf-8?q?1747106591104719743?= From: Dan Carpenter [ Upstream commit b5ee771c84082b4e54cc39d9d9a2dd239e4f6b86 ] Smatch complains that: drivers/net/wireless/mediatek/mt76/mt7915/mac.c:428 mt7915_mac_fill_rx() error: uninitialized symbol 'msta'. It looks like this was supposed to be initialized to NULL. Fixes: 0880d40871d1 ("mt76: connac: move mt76_connac2_reverse_frag0_hdr_trans in mt76-connac module") Signed-off-by: Dan Carpenter Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c index 60ae834d95a6..4ddcd3afa428 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c @@ -232,7 +232,7 @@ mt7915_mac_fill_rx(struct mt7915_dev *dev, struct sk_buff *skb) bool unicast, insert_ccmp_hdr = false; u8 remove_pad, amsdu_info; u8 mode = 0, qos_ctl = 0; - struct mt7915_sta *msta; + struct mt7915_sta *msta = NULL; bool hdr_trans; u16 hdr_gap; u16 seq_ctrl = 0; From patchwork Wed Oct 19 08:26: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: 4623 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp211946wrs; Wed, 19 Oct 2022 02:06:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4RG/g//IsMvM+6aMy6q9roKDv4Z3fq4NrmbuaLpbcetgrBjPmJgbPhqHv/XpI8lJoayEkA X-Received: by 2002:a17:906:b08d:b0:782:d526:3e36 with SMTP id x13-20020a170906b08d00b00782d5263e36mr5886087ejy.358.1666170378884; Wed, 19 Oct 2022 02:06:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170378; cv=none; d=google.com; s=arc-20160816; b=JeayAz+GklvRHeJ4XFjsjaBFPmLeTkg7aPRUSRJ6PWiqnAyIqLSOZsGjGEAQ5/S6zt 6ZC63zjXJ6UbfVTAzQEAgZJHZYpkSIAWaJrLKfoCJfSmiOBIEVcM1FEY2p4qkVWiq6GY xwOKOGlcVF5Ft9NIfjMfNjqSZ+7wyav2iu00/2EoR3rrkUA/r/rP2qyprxfV8+lB007h nqnIcp2t0VxcsOK8diG3uO6qRWNa44a+vV5I3C3kjQpx1yJ/mI8iHnNiVrkssrh9o9W8 SbI5fQ0EDi3MFQWYRfcL16rgPq95nq/jYcBmxJBeC8awiw114SihLBr5pD7kwxcYkFlN KCcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lswE+F6V1jSOfcAdXoKPWxPJCqcGz8cksMXS6oNULv8=; b=THNzn1SjP0wRBOAf2+69G38FdxFVy6Nl04V2Dy6uxf2Xfhlj993EspKCq/Sbo3itkZ HtfcSzeUGjGsuiOBftRGX6futg2yaZMetlEMTRQMSzcetnCz9ZtfYpt0HC2NZ+ilbu2T g/NnmsEMnjqqLPsUfqXDxxplZ3S8HAUtphbJ3rUUywh7dYo0VrcfZhTFv8O21mloJPZW xIvtnSvMT3G0rM61SD+fULlpITZR5fP/PbuKkxDUX6SMvkMRxiu8alkmUdt4X37KbCfR uuER2B5TqQsBsJyhOuH5b4fMVGN/z3wRAttIPRgOjrfjUwsTQkbvtaEjDpEoumlFab0b nSjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=f86j4q0i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hg3-20020a1709072cc300b007839bfdaa33si11071820ejc.358.2022.10.19.02.05.45; Wed, 19 Oct 2022 02:06: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=f86j4q0i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231687AbiJSI4W (ORCPT + 99 others); Wed, 19 Oct 2022 04:56:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232221AbiJSIzF (ORCPT ); Wed, 19 Oct 2022 04:55:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D17C9AFB3; Wed, 19 Oct 2022 01:52:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9040C6181D; Wed, 19 Oct 2022 08:50:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4324C433D6; Wed, 19 Oct 2022 08:50:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169448; bh=8V/2WBaxDidT9ubYw7k2req5w3xsG1WRMgg2TbhCdpU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f86j4q0izFUzIqYktpMc9gBd4kRY72gnov2TxABdZBSfwuNC75SLBKhFI/ZhpMwY4 SjkE0BpQedmLiaw5EeamVKbTiZh13O7QLyAOh28XWHWNEPwGcaoa5HjU0EJM0VtueA mC0g1vCC/ECkL4yns9wI7i/0anDg0EDS/oS8xoT0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Felix Fietkau , Sasha Levin Subject: [PATCH 6.0 281/862] wifi: mt76: mt7921: fix use after free in mt7921_acpi_read() Date: Wed, 19 Oct 2022 10:26:08 +0200 Message-Id: <20221019083302.440733021@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106271435285456?= X-GMAIL-MSGID: =?utf-8?q?1747106271435285456?= From: Dan Carpenter [ Upstream commit e7de4b4979bd8d313ec837931dde936653ca82ea ] Don't dereference "sar_root" after it has been freed. Fixes: f965333e491e ("mt76: mt7921: introduce ACPI SAR support") Signed-off-by: Dan Carpenter Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt7921/acpi_sar.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/acpi_sar.c b/drivers/net/wireless/mediatek/mt76/mt7921/acpi_sar.c index be4f07ad3af9..47e034a9b003 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/acpi_sar.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/acpi_sar.c @@ -13,6 +13,7 @@ mt7921_acpi_read(struct mt7921_dev *dev, u8 *method, u8 **tbl, u32 *len) acpi_handle root, handle; acpi_status status; u32 i = 0; + int ret; root = ACPI_HANDLE(mdev->dev); if (!root) @@ -52,9 +53,11 @@ mt7921_acpi_read(struct mt7921_dev *dev, u8 *method, u8 **tbl, u32 *len) *(*tbl + i) = (u8)sar_unit->integer.value; } free: + ret = (i == sar_root->package.count) ? 0 : -EINVAL; + kfree(sar_root); - return (i == sar_root->package.count) ? 0 : -EINVAL; + return ret; } /* MTCL : Country List Table for 6G band */ From patchwork Wed Oct 19 08:26: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: 4783 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp215886wrs; Wed, 19 Oct 2022 02:16:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7AoVoO8pbE89tlQV5pbChfWXChiUJW2nKuQJSDFIFAW9OoGF+RiHANTQRKtr/xzvjuxtEO X-Received: by 2002:a17:907:7f8f:b0:791:a840:56b4 with SMTP id qk15-20020a1709077f8f00b00791a84056b4mr1491612ejc.540.1666171016234; Wed, 19 Oct 2022 02:16:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666171016; cv=none; d=google.com; s=arc-20160816; b=hasVl84kYimZXyzdjMYyXzvfr4wnyCTHMywk6bRZnSXvWD/fSFtAj/b60gnmGPH8Tn UhJwjlnQjn8sChspmvpfBN++3/xBuRX2uzG2HHPjFr1ltP+CmkWZ9MfLWa6gt2fMeY8Q 84ShHzIUiGPFpnDgnDS2/8BBQcg/a6EtyWDtkucD0tL3pA/LaEq0NppgjvLQNTsQAMz0 5vnFNGOG5rXe0v2OdZldYer0dPmUf+5msGFlxU5VpnsjThb68G3T8/XUddIYHQU1WQ2c URadjNnB84rJsgYbgGJZrSf6CFHSAxPXZO78hCoSZDH21bzDorcVgOo/La1Qs+lhy/58 pVSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MvaBctPznPdORHxa0z1G0kp7B+LSIJE3+98dG0nqfCM=; b=cEs1jaQKQmpt7i/TU7RP6tAJfWyNSJ8s/g+jVp0yv275N4bKAG/JlmPe4JlajtnJYh 6fZe3A50i7pWqccph8eZ9t/PxY0nyIWddHNwVMk/BsCPh1tJ13GcedHtjDKgZNQgdm/v cq85OTtkQOzLzCgbR4bgZvTJV2vUnun6z1eHCPWMnDLJB8uNsQXbGhen0NMCAnc0dKt2 86HR5kZrS4Ima4C32ZxeVT8ILHH+5jKbjLtzResGNDUV1eHLfy/d3Rg5NOJtpSB1Ov9w SfqwO4l7eSDm1S3hxOBw8vV9Qoyq1O19DEXl8QkHEFPKcuJs+HL7f/NcgpcpvFOGrmVe 72vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="R/MCH9oZ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sd23-20020a1709076e1700b007414886601asi13018090ejc.25.2022.10.19.02.16.31; Wed, 19 Oct 2022 02:16: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="R/MCH9oZ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233011AbiJSJP6 (ORCPT + 99 others); Wed, 19 Oct 2022 05:15:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232903AbiJSJMK (ORCPT ); Wed, 19 Oct 2022 05:12:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DA4AC8976; Wed, 19 Oct 2022 02:03:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4090561857; Wed, 19 Oct 2022 08:50:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 472FBC433D7; Wed, 19 Oct 2022 08:50:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169450; bh=mNavhjTu2yfMxnJCyu1lv2P3CIMvrTtMyZ8wrnDm0f4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R/MCH9oZqMQ6qDPIA5ZPZdJAuY1eCwawU6kw4ptY9gdpUvXaqeVWNki59iYVGd8Nn 2/nopqh3jfBES8auM3FfqZPrreR0Nc2erriTR7QwJx3/cHvgACw3PTqVMNavajgHgl 50lnW777kMlbN3Sz2fuJIzSvhuE9xUhjiwDT4/7o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Wang , YN Chen , Felix Fietkau , Sasha Levin Subject: [PATCH 6.0 282/862] wifi: mt76: sdio: fix transmitting packet hangs Date: Wed, 19 Oct 2022 10:26:09 +0200 Message-Id: <20221019083302.482931288@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106939552191559?= X-GMAIL-MSGID: =?utf-8?q?1747106939552191559?= From: YN Chen [ Upstream commit 250b1827205846ff346a76044955cb79d4963f70 ] Fix transmitting packets hangs with continuing to pull the pending packet from mac80211 queues when receiving Tx status notification from the device. Fixes: aac5104bf631 ("mt76: sdio: do not run mt76_txq_schedule directly") Acked-by: Sean Wang Signed-off-by: YN Chen Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/sdio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/sdio.c b/drivers/net/wireless/mediatek/mt76/sdio.c index ece4e4bb94a1..0ec308f99af5 100644 --- a/drivers/net/wireless/mediatek/mt76/sdio.c +++ b/drivers/net/wireless/mediatek/mt76/sdio.c @@ -485,7 +485,7 @@ static void mt76s_status_worker(struct mt76_worker *w) } while (nframes > 0); if (resched) - mt76_worker_schedule(&dev->sdio.txrx_worker); + mt76_worker_schedule(&dev->tx_worker); } static void mt76s_tx_status_data(struct work_struct *work) From patchwork Wed Oct 19 08:26: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: 4634 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212114wrs; Wed, 19 Oct 2022 02:06:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4enagif5Q7dPkB+a/c0v7u/TdDvPo5q2DRRiR8fZmtzsIY/EONafVVHBAiSrA8rxilkru7 X-Received: by 2002:a17:906:c08c:b0:78d:b8ce:c28f with SMTP id f12-20020a170906c08c00b0078db8cec28fmr5779146ejz.437.1666170406003; Wed, 19 Oct 2022 02:06:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170405; cv=none; d=google.com; s=arc-20160816; b=rGcO6T8iWlwrZy7jmXKf/D0P6NASMQb+V/Ro1WmKlMjBuxYcpl/of1yhwf1Uzj1KIg DuJ+wLW1/SWUXkzjIzHfWGAzXAmFUXhEfUZlNwUrJtqqq1kx+h0y2ckA5UdDUHUKGU8H KU+PFaGe6lANLyrHgTnAF8GDt7Vfyd6p+/rg6848xR5/ja7wZuVm7HOYjFgiXEkkJ/0I VItOhuGEJTtu/Ea40urTxli324Vhto6fcOMFUJ9qAS00HQmL4I8+2WUXO//xm3jzO6Id iEFA4XTDeUeXhSuFIvWZHey5dvwX4HwxEphxKuKRg2CgIuezlBsR1UlzFJHuLNK+wAmc EUKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bX5iEXCgDimOeAxt07iO6NjziRGf1OOwOPj6/8Gog/s=; b=nqn41sv95MYygxE5wgRBXd09TPODx2ivUEZNhz10dz5gv/NyQ5vv77My4MAHBEr1YL 4aWOYpU9iUYz3gvZ+fxJVxnBuGSG8ZbB+XwfLYzs9nQbuPdyKl0rNnyJCbfeEcOIEdxX +zM9ne/dgJ62qX/bAQch8kL9TjZdcwSERFqmaIRqNdkL0ysve5dslRzgoVTJ1OobZocu fet3W5+klDZkgSmFvKmF5lxcA7uqXcb1K0c5di+sFUpP+ztTnZgo32LRYCnek6No9Thy EUXh5brWkoEzRNsPSpGYv+dCSUVKdG3fp37uuBPFW7i6VkSQWiInjRltJSijEGq1YKOR EnLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kXx78nHo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id he38-20020a1709073da600b0078dbc4ea733si13986475ejc.730.2022.10.19.02.06.15; Wed, 19 Oct 2022 02:06: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=kXx78nHo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231916AbiJSI4u (ORCPT + 99 others); Wed, 19 Oct 2022 04:56:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231905AbiJSI4F (ORCPT ); Wed, 19 Oct 2022 04:56:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1D5F9B871; Wed, 19 Oct 2022 01: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 dfw.source.kernel.org (Postfix) with ESMTPS id 0E35F61868; Wed, 19 Oct 2022 08:50:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25D71C433C1; Wed, 19 Oct 2022 08:50:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169453; bh=5hFsduFDooxb/R2PcYIuH4Pnf/toVcyN16MWoPsuRb0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kXx78nHoE9zy49Gr21mtFOlB1TpLS4OOe6n6Tc7ASqv93z6gvqBd7rQVnn0YLkqH0 BFPqGAaTY60xcPfIyZXcSOpZ91d/q36iv8dNOEt2sAQnPW4Uydj2cd7OFiyJnY1euy CT9Z0lCEF7fmx6AkF+3pVX3mudoQQpm+N597D78Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lorenzo Bianconi , Felix Fietkau , Sasha Levin Subject: [PATCH 6.0 283/862] wifi: mt76: mt7615: add mt7615_mutex_acquire/release in mt7615_sta_set_decap_offload Date: Wed, 19 Oct 2022 10:26:10 +0200 Message-Id: <20221019083302.521043144@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106299544031317?= X-GMAIL-MSGID: =?utf-8?q?1747106299544031317?= From: Lorenzo Bianconi [ Upstream commit 765c69d477a44c088e5d19e7758dfa4db418e3ba ] Similar to mt7921 driver, introduce mt7615_mutex_acquire/release in mt7615_sta_set_decap_offload in order to avoid sending mcu commands while the device is in low-power state. Fixes: d4b98c63d7a77 ("mt76: mt7615: add support for rx decapsulation offload") Signed-off-by: Lorenzo Bianconi Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt7615/main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/main.c b/drivers/net/wireless/mediatek/mt76/mt7615/main.c index 9bf8545c8c17..8d4733f87cda 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/main.c @@ -1195,12 +1195,16 @@ static void mt7615_sta_set_decap_offload(struct ieee80211_hw *hw, struct mt7615_dev *dev = mt7615_hw_dev(hw); struct mt7615_sta *msta = (struct mt7615_sta *)sta->drv_priv; + mt7615_mutex_acquire(dev); + if (enabled) set_bit(MT_WCID_FLAG_HDR_TRANS, &msta->wcid.flags); else clear_bit(MT_WCID_FLAG_HDR_TRANS, &msta->wcid.flags); mt7615_mcu_set_sta_decap_offload(dev, vif, sta); + + mt7615_mutex_release(dev); } #ifdef CONFIG_PM From patchwork Wed Oct 19 08:26: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: 4632 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212065wrs; Wed, 19 Oct 2022 02:06:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM79LMz2yHspquq8+RwaPstlcacx0s2T77NWKiTq9SdfeWW0vQ8z5cuQojI21619RtSSSv+0 X-Received: by 2002:a17:906:cc10:b0:78d:f741:9d87 with SMTP id ml16-20020a170906cc1000b0078df7419d87mr5820503ejb.295.1666170398039; Wed, 19 Oct 2022 02:06:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170398; cv=none; d=google.com; s=arc-20160816; b=Ohf5CFIc25d8IPk3O+x5Dy+NId6h1ruv0gh0mZCT0z/Pv0WMlDYBW1PVROySbQAUS9 Yh1+TvDKLJ4zr0TJGPaURs4C6oFTOItYgoE+/NhxbGqWJX9K1ZC4kq1jq3lnGanAa38T Rb/gBf+qGzCCusje1nGdkl5I28XpdyS1UOg9Uu3FSSW7hT7Y0cKlZb7AS6EPWJ696N10 bTh0pZllEsHbkSlLj9LpCrnLefuMqxS7B/gvf9WWNrgeABDcVdTd9We6W6q4LZMYFSRu DrTJUGOEMEZAJZ8DXR2/X+p90ExFOgz2VAi9IM4VjiQI+2ZPcFN28ObANSXNMvq5QemV A/Zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lqmgkvzfGbiu/mtdanLwq7B+xk4ma/cyc0UEVphaLwA=; b=sYX+a0mrtBBkWjIW7gkz2KXV19IwB/ZM8qc8tfq7d/GVbPup+YVw1uMl48hXxMqrqC eaFtKzaIYU2zJwXrimOvmcvIg3zKSBb9ZLYMsFu8hYVBCvtAE8vETHHmaUDn3MoAAUeB Phr1NoIkWQ+5h5dmygnuNSUZQRIXY8Wug66NdB0kM6VO2BKjmW3qZyOdDtb9YwAH6IUf UTotQ6PBa4Wqcioucg4rbS8hiWT8oSy7DvpPCfT9//BzjDgZn4H2B7LXGT7Q9/j44wSW ktfA6jU7IhKZQtGW2zTHEsF04EKduUhnaC2qTHRnOifs8kB0QqFJZ1WFSifDV9zZJAob 10iQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Gym8csTl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170907729300b0078168566b26si14457087ejc.356.2022.10.19.02.06.06; Wed, 19 Oct 2022 02:06: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=Gym8csTl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232004AbiJSI5T (ORCPT + 99 others); Wed, 19 Oct 2022 04:57:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231795AbiJSI4f (ORCPT ); Wed, 19 Oct 2022 04:56:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34E3B193DC; Wed, 19 Oct 2022 01:52:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AB18C61866; Wed, 19 Oct 2022 08:50:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC0E0C433C1; Wed, 19 Oct 2022 08:50:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169456; bh=kwElycgk0G90REzPfSoa4Yxr7/w7BcPRL2CXRgWe54U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Gym8csTlV+Opwmw6lrQ8a8KKD2MuWRRvDGGfqbZROyReNd9FuBwBUgD+BK9+DJf6a 2rVFFCEHblC4H3LxVGZhgfUjwxCfkZ/ZPsA2Jz8cRKG0OM4VIo6j430Rw2zlTWD8rb VDpNaw2ML3nD4Vq16UsM4lOZ4AoSg4+7kUB6fhMI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Lorenzo Bianconi , Felix Fietkau , Sasha Levin Subject: [PATCH 6.0 284/862] wifi: mt76: mt7915: fix possible unaligned access in mt7915_mac_add_twt_setup Date: Wed, 19 Oct 2022 10:26:11 +0200 Message-Id: <20221019083302.553066406@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106291193558660?= X-GMAIL-MSGID: =?utf-8?q?1747106291193558660?= From: Lorenzo Bianconi [ Upstream commit 3d9aa54355d863e5412a7e08180f50a8f1827b7f ] Fix possible unaligned pointer in mt7915_mac_add_twt_setup routine. Reported-by: kernel test robot Fixes: 3782b69d03e71 ("mt76: mt7915: introduce mt7915_mac_add_twt_setup routine") Signed-off-by: Lorenzo Bianconi Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c index 4ddcd3afa428..49aa5c056063 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c @@ -2071,8 +2071,9 @@ void mt7915_mac_add_twt_setup(struct ieee80211_hw *hw, } flowid = ffs(~msta->twt.flowid_mask) - 1; - le16p_replace_bits(&twt_agrt->req_type, flowid, - IEEE80211_TWT_REQTYPE_FLOWID); + twt_agrt->req_type &= ~cpu_to_le16(IEEE80211_TWT_REQTYPE_FLOWID); + twt_agrt->req_type |= le16_encode_bits(flowid, + IEEE80211_TWT_REQTYPE_FLOWID); table_id = ffs(~dev->twt.table_mask) - 1; exp = FIELD_GET(IEEE80211_TWT_REQTYPE_WAKE_INT_EXP, req_type); @@ -2122,8 +2123,9 @@ void mt7915_mac_add_twt_setup(struct ieee80211_hw *hw, unlock: mutex_unlock(&dev->mt76.mutex); out: - le16p_replace_bits(&twt_agrt->req_type, setup_cmd, - IEEE80211_TWT_REQTYPE_SETUP_CMD); + twt_agrt->req_type &= ~cpu_to_le16(IEEE80211_TWT_REQTYPE_SETUP_CMD); + twt_agrt->req_type |= + le16_encode_bits(setup_cmd, IEEE80211_TWT_REQTYPE_SETUP_CMD); twt->control = (twt->control & IEEE80211_TWT_CONTROL_WAKE_DUR_UNIT) | (twt->control & IEEE80211_TWT_CONTROL_RX_DISABLED); } From patchwork Wed Oct 19 08:26: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: 5462 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp331511wrs; Wed, 19 Oct 2022 06:36:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5+IwOmbkwLL+vHtDiIDW11KNhT/WHmh7iMYkGnPmWwHxqGUl5uDA2xIB2IzRW2Unp3F85W X-Received: by 2002:a65:590f:0:b0:46b:1a7b:a7d3 with SMTP id f15-20020a65590f000000b0046b1a7ba7d3mr7521628pgu.136.1666186617774; Wed, 19 Oct 2022 06:36:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666186617; cv=none; d=google.com; s=arc-20160816; b=MYxPKqE7PBJvWGUfvNQlCTFU0vQGoenXe/qN5Ev0Pt9tjUs5DOgUsQsx8+Fy1yNZZG 01NidihEJL3eY2iSw2Kl5SWhJ+XZUxsBkfCVXCffh2flPVdC4/d12Btp/x7wNnLpZrvr JD3tvzlWkGBsXFLGx3QtJHGiii1DYEfyxz5lI7IVrVhdJ/r0rzfoYQ/uBthvZe0+DrBJ gdcNowraNJoYe4VxiEOswcZ7WkfoaIRbZlkQ8OB5m4X/sLJJfAjjvlnwPS4mw/y1m7ni +VtoNOw8t1DNna01+h8qAD4gRdP//77G4EJErlQ2ZK9/WoXnrBx2npw0klEvuOzr998V BZrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Z8ldVgMzB5lWwF/pzgLBb6mqyH3ZktNE+VkHL1gh7sY=; b=oQ+N0ldGo7ZOhmfZ0Dk/NGZ4zH5Ou12U8LuQgvWTncYokkR2iWsv0uz4K6BYHEuxtj FnV9HxYCG44V53j6hcpJ4jGLXUvK3s6cCt2nff3KPf8mdsNYrmGr3KqYSYkyhEyt7/Jc aqFX7QNJrBnMmMARQB/ANvnJc93BdSyg4aeQNtZIKDc098iNAcu1mdQbDt+JTQyCU/bX ZsV6y8r4cW9S0j28jZTzPuB8/9UbzdKJlvARRlla9S8tMgu5wcxozNzr8TmhLPjQ7+Wd sUSqk8RP9X0IlUe9qlFUjcGLAuT2oPHE4qIQOhAK5wfHG8JohDy3ICdU/9mkxfL1MyHd ec/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VWNHdvlM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m8-20020a170902f64800b00179d9679ad0si18352510plg.190.2022.10.19.06.36.44; Wed, 19 Oct 2022 06:36: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=VWNHdvlM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229999AbiJSN0g (ORCPT + 99 others); Wed, 19 Oct 2022 09:26:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231406AbiJSN0H (ORCPT ); Wed, 19 Oct 2022 09:26:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF8DD1D3A5D; Wed, 19 Oct 2022 06:12: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 279F3B8238F; Wed, 19 Oct 2022 08:51:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A43FC433D6; Wed, 19 Oct 2022 08:50:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169458; bh=Fe2eaMVMJuai5RAeCwO60IBS5K+pDaQ07JaRfMxVcPM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VWNHdvlMI1Za/eZHibwmFmFfUgdZT/gN+Q0Rsz05135v/FdQfAC5saDVgXfByQXpX IIfP/9/3ckys/RZpxhVKRbRCQ45bz032P1IBQhGV6nVR58dM8TMux9Fy+Shqn67k5L V/EXe4LIJ7JxKbZN8r7TGS3Wd67XOjx0ufrRvHCs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Lorenzo Bianconi , Felix Fietkau , Sasha Levin Subject: [PATCH 6.0 285/862] wifi: mt76: connac: fix possible unaligned access in mt76_connac_mcu_add_nested_tlv Date: Wed, 19 Oct 2022 10:26:12 +0200 Message-Id: <20221019083302.600692455@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123298731303740?= X-GMAIL-MSGID: =?utf-8?q?1747123298731303740?= From: Lorenzo Bianconi [ Upstream commit 0a4860f627f1f2b2b777f54f993de1638a79da9f ] Fix possible unaligned pointer in mt76_connac_mcu_add_nested_tlv routine. Reported-by: kernel test robot Fixes: 25702d9c55dc5 ("mt76: connac: rely on le16_add_cpu in mt76_connac_mcu_add_nested_tlv") Signed-off-by: Lorenzo Bianconi Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c index 9b17bd97ec09..13d4722e4186 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c @@ -260,8 +260,10 @@ mt76_connac_mcu_add_nested_tlv(struct sk_buff *skb, int tag, int len, ntlv = le16_to_cpu(ntlv_hdr->tlv_num); ntlv_hdr->tlv_num = cpu_to_le16(ntlv + 1); - if (sta_hdr) - le16_add_cpu(&sta_hdr->len, len); + if (sta_hdr) { + len += le16_to_cpu(sta_hdr->len); + sta_hdr->len = cpu_to_le16(len); + } return ptlv; } From patchwork Wed Oct 19 08:26: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: 5556 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp349537wrs; Wed, 19 Oct 2022 07:12:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM42vtA+bN+16Nn2BazQ1mUXkId61h7+6X5hy5zcMxPu99BacWDTYYicnyq9jP4COiV1uaVE X-Received: by 2002:a17:90b:4c85:b0:20d:7040:532a with SMTP id my5-20020a17090b4c8500b0020d7040532amr9795467pjb.243.1666188727352; Wed, 19 Oct 2022 07:12:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666188727; cv=none; d=google.com; s=arc-20160816; b=R1tvw03gaWHNBuuxxBFmK7+8UnSkwaQ+6DWYyWxiJVDDC1kof7vSYrPLb62qOhEiqf JOUsCOuvJW32tQlbPSW66GGv3pWU/wiPrGpLJb7m4AY7KF0RgWkl65xoRM7oyTGeXhgC XI3Ae7aS71shryzA+wdy8AT7cZ/+R8rE9BRU40tsYLX3cNdNVSL9W8SrJuBgHu9e7dO8 YTk6ZyHaDmAmKY76l3cqUZy+ILHNcTGLUzKKMm2pO5abovq7RZdIWNUkkZfEb1A7/EKY x/GoyyOOMsreDTf4y0C1xjkr1+cS/29JmXH+MaiVj7HYC/vUq0j2DLTsEIyrylj7aE6k XtVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=D4hFyx5tSNOPnJlJFBeFcGkb6V5mbYngtjzql4OIhl4=; b=st16kgHtXnO9YbxuZN3QJF6vDu5ZYgpgcxU8QjZPNQSdUt+xWn6LzpndaN82fdiBlI ROejdkX/24Y4j9SnyY++294qzFOcA1gHhn3LpGkdY5pGXdjWQPErG8iJlxEWrPr9kp2G hbsvEIourH5xH/xeZzTfsR9XGA+OdYH/ZaelIubxUiCFUTw4qzo9TAJKBMqFzd4PIZye JzmEu2QWhiNnZK1qo/Q/TdiL5rZ5Ckw17syNrWQeHh3vr1BOZamVct5sSj5Oq7rAhoUi 1gQ3kOZdE0HJ3Qt+fz29peRb75XUbu6zhiEDFIhOBNHXLAH0W1afOUMIqi1qGBjD7XnC 3L0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=T0+vtTQd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t13-20020a63534d000000b0043cb1c6af1bsi18568457pgl.126.2022.10.19.07.11.48; Wed, 19 Oct 2022 07:12: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=T0+vtTQd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233811AbiJSN53 (ORCPT + 99 others); Wed, 19 Oct 2022 09:57:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230297AbiJSNxQ (ORCPT ); Wed, 19 Oct 2022 09:53:16 -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 A74361C883B; Wed, 19 Oct 2022 06:36: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 B2E74B82322; Wed, 19 Oct 2022 08:51:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02488C433D7; Wed, 19 Oct 2022 08:51:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169464; bh=wde+d8xYopnhbnQaBQyev8/m4C8AapAZ0029aEYLjS4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T0+vtTQdBenIxFwumBYKCmeOyfk8K23dpNoJJS4dOOmPA3ALloQrfcXDO53lv061m 0vibgIvZd0t5mztji29kowHCZiMeDDgjrk8/EPZs3Yfu/0srqd/FyswC4+GhFRJd31 JbgSsF+2+o1m7Ry/rWfX2Tz46emwGEJoC1PKIyoA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, AngeloGioacchino Del Regno , Sean Wang , Lorenzo Bianconi , Felix Fietkau , Sasha Levin Subject: [PATCH 6.0 286/862] wifi: mt76: mt7921: add mt7921_mutex_acquire at mt7921_[start, stop]_ap Date: Wed, 19 Oct 2022 10:26:13 +0200 Message-Id: <20221019083302.651159389@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747125511149877229?= X-GMAIL-MSGID: =?utf-8?q?1747125511149877229?= From: Sean Wang [ Upstream commit 52b44015f031f629f1ce1d73415a2017593c7ade ] Add mt7921_mutex_acquire at mt7921_[start, stop]_ap to fix the race with the context holding dev->muxtex and the driver might access the device in low power state. Fixes: 9d958b60ebc2 ("mt76: mt7921: fix command timeout in AP stop period") Tested-by: AngeloGioacchino Del Regno Signed-off-by: Sean Wang Acked-by: Lorenzo Bianconi Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- .../net/wireless/mediatek/mt76/mt7921/main.c | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c index 1438a9f8d1fd..63fd33dcd3af 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c @@ -1526,17 +1526,23 @@ mt7921_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct mt7921_dev *dev = mt7921_hw_dev(hw); int err; + mt7921_mutex_acquire(dev); + err = mt76_connac_mcu_uni_add_bss(phy->mt76, vif, &mvif->sta.wcid, true); if (err) - return err; + goto out; err = mt7921_mcu_set_bss_pm(dev, vif, true); if (err) - return err; + goto out; + + err = mt7921_mcu_sta_update(dev, NULL, vif, true, + MT76_STA_INFO_STATE_NONE); +out: + mt7921_mutex_release(dev); - return mt7921_mcu_sta_update(dev, NULL, vif, true, - MT76_STA_INFO_STATE_NONE); + return err; } static void @@ -1548,11 +1554,16 @@ mt7921_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct mt7921_dev *dev = mt7921_hw_dev(hw); int err; + mt7921_mutex_acquire(dev); + err = mt7921_mcu_set_bss_pm(dev, vif, false); if (err) - return; + goto out; mt76_connac_mcu_uni_add_bss(phy->mt76, vif, &mvif->sta.wcid, false); + +out: + mt7921_mutex_release(dev); } const struct ieee80211_ops mt7921_ops = { From patchwork Wed Oct 19 08:26: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: 5048 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp247543wrs; Wed, 19 Oct 2022 03:41:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM666V3vi2WAKjw9P+L6eqwIdfClLdwpKIeZLW+PcDSb7bMi/my3f0ujOb6StMIDzV3oGun4 X-Received: by 2002:a17:906:5dae:b0:78e:302f:4218 with SMTP id n14-20020a1709065dae00b0078e302f4218mr6478717ejv.22.1666176065898; Wed, 19 Oct 2022 03:41:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176065; cv=none; d=google.com; s=arc-20160816; b=po1hDptEZf5kou2IRMPfwFfYIhhHTj6yF74JcP9jlNQxR+Drm1/MACJtUVqYGSS+T9 qxWZS4boede8MtyO8EO1xVII8JetLdvFBJ0tm7fQ/e4puzqIyg9lYYXyct1dgotCkwmI Yh1qoZVthYcQ1mPtcuTaMCJ+ifMa9QlUKl3zklnYNpfX29ZjGHHtO/DPtstzp6qXTTcB GT/IXwbRSAS1uDTe772h8dIuF7dIQ3Bt7km9x3ukwQYCIc/nL29a0dz5paKRE/t8AqEC XZ0Lms8J0nnP423CIze4a1m2OkDKSGZhEk3i8SuEOaGIaiaiLZdZBb7iVNmN+MRIKTzq pCLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TxSQPc1PiCdqnAqxm87TMyulJScA6bOqZUXMDOhmHeI=; b=TtakjzqL7436Sxfx3nr6KyybztdZZ6N3dNlL66ayD9qNm4F0h709wn1GlI4kNRb1aZ fyk96Egf2dmWKBXSmLSXW/feYF1SuLSZr9bWEnt5kNaQfJ0NXVyNuelk8GFvDepKu9jQ yS1w1zkwzM7I8gVFmCKvgPdcRro8XKWU4wZErua3xgFN3hzx1H8d2u3UidLeS9G9N0O5 7Pc33MDSMAks2tgFjBDzohL2XgvovPsO5Cg73YpsIX96DAoi8Knjt30789IcxJHAUV08 LxC2yHAzelAvEFh/Gp3FZEOCuK0on8fHv6/A01QDle05ZkKYFIDmfJX5JzcneraX8mH4 soqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FwHvII86; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xc9-20020a170907074900b00730aa841c5bsi14229414ejb.964.2022.10.19.03.40.38; Wed, 19 Oct 2022 03:41: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=FwHvII86; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232035AbiJSKj7 (ORCPT + 99 others); Wed, 19 Oct 2022 06:39:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232297AbiJSKjH (ORCPT ); Wed, 19 Oct 2022 06:39:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1ECE15626B; Wed, 19 Oct 2022 03:18: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 4A4DFB822D8; Wed, 19 Oct 2022 08:51:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6E80C433C1; Wed, 19 Oct 2022 08:51:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169467; bh=mq8aG3PtaIpytEmkRarYYnE2UdSfF3zSy5rZl30dsz8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FwHvII86Pg6LdAFn/a6yjs+dgURQ5+7duyhvgHtzqtKxDnhMcTjPYBrPmWpDWsouG hb9sH+sXSKeHwe4G5vX2+a8Ex102p6eR7voyjYi6SPBA0SplU1m6oTa+Cvt3VjvoYA s9jHc0dCGNjf8nW8RJvAD25tDovrhmY7gdU/LmUQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, AngeloGioacchino Del Regno , Lorenzo Bianconi , Sean Wang , Felix Fietkau , Sasha Levin Subject: [PATCH 6.0 287/862] wifi: mt76: mt7921: add mt7921_mutex_acquire at mt7921_sta_set_decap_offload Date: Wed, 19 Oct 2022 10:26:14 +0200 Message-Id: <20221019083302.689314366@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112234421835395?= X-GMAIL-MSGID: =?utf-8?q?1747112234421835395?= From: Sean Wang [ Upstream commit 59c20b91786d5f140ee7be2f24c242b5f8986046 ] Add mt7921_mutex_acquire at mt7921_[start, stop]_ap to fix the race with the context holding dev->muxtex and the driver might access the device in low power state. Fixes: 24299fc869f7 ("mt76: mt7921: enable rx header traslation offload") Tested-by: AngeloGioacchino Del Regno Acked-by: Lorenzo Bianconi Signed-off-by: Sean Wang Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt7921/main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c index 63fd33dcd3af..7214735011d0 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c @@ -1404,6 +1404,8 @@ static void mt7921_sta_set_decap_offload(struct ieee80211_hw *hw, struct mt7921_sta *msta = (struct mt7921_sta *)sta->drv_priv; struct mt7921_dev *dev = mt7921_hw_dev(hw); + mt7921_mutex_acquire(dev); + if (enabled) set_bit(MT_WCID_FLAG_HDR_TRANS, &msta->wcid.flags); else @@ -1411,6 +1413,8 @@ static void mt7921_sta_set_decap_offload(struct ieee80211_hw *hw, mt76_connac_mcu_sta_update_hdr_trans(&dev->mt76, vif, &msta->wcid, MCU_UNI_CMD(STA_REC_UPDATE)); + + mt7921_mutex_release(dev); } #if IS_ENABLED(CONFIG_IPV6) From patchwork Wed Oct 19 08:26: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: 5380 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp302628wrs; Wed, 19 Oct 2022 05:39:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM525pm8hfsRynuOKZfJvxyCeHcimICRPUa4G8YEC30KcPOQ6j+PSUVYz51d0Z7AKfQ+DjpI X-Received: by 2002:a05:6402:1cc1:b0:453:1517:94e4 with SMTP id ds1-20020a0564021cc100b00453151794e4mr7200679edb.399.1666183153208; Wed, 19 Oct 2022 05:39:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666183153; cv=none; d=google.com; s=arc-20160816; b=SUn+fJjyVq6CN8T/VQ3/LMuCb+xojhpoknzObL+EvRA9z0FEatsBnsJ9cFTAk4d+PA mqFWwQeN7gPWrNqHG4fyi9CU0+LatWTuDN1ui0pnb/yXFY/y7JqtmIsNpg0zt7QUvkB1 ovfUeaxfZhy9DsZFRHbH/nDD2cogc7ukLX71pnJN5s8aeImvgVFDoOOB1dVRRe0v4LTN Z6Nyj2xILlDID49x0JAdAXZlxLJcW/v6rvGCvUAeVOjmyR1XnXAQyJS2b4vEcngQPe6h gRqlUM5igqUJfp8UPQKZMTvHsckUPp8WbNcTyuaZGzAWQh//znBdGgXfoRMh6zwqJqe1 A2zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GmwvHgT4s23e4ZqfXvZhsJVKVdUeDFpp8UN/UcUkXDM=; b=FteZakueeaOH1H/1BoVJNamoqh7BWmEsOvpq5sSgWlQIZT/M8Py+fX3QMciJWcK45P IRqy0iQEnKJxTFUeYdyWfnPadDFh3VVTwMyk9Ipeh8SUeBEhplCkdtPqZOu9JqU96tt3 WLJb3QEGjak1lvo04wDmabZXmaelpE3wDVYhwU3/nEpFEUPlL68267r7xtUD637q9XEe zlOZP20No1IhFIuJIYJybzzUKVyn1BeJ05bjyvP45FT3L8Rf7ERNLVup2FBZfsOeZ4WJ FZmiL/HYV17WlA+7SPXRscz5MTkLEswiX9+9civGFoQIIEtdizvjCY/ggoq2uCThVvDW 80oA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xqegrmoI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r17-20020a170906a21100b0077547abf08fsi14329435ejy.169.2022.10.19.05.38.46; Wed, 19 Oct 2022 05:39:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xqegrmoI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229840AbiJSMZV (ORCPT + 99 others); Wed, 19 Oct 2022 08:25:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233109AbiJSMXo (ORCPT ); Wed, 19 Oct 2022 08:23:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8841E696FB; Wed, 19 Oct 2022 04:59: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 447AF6184A; Wed, 19 Oct 2022 08:51:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54681C433D6; Wed, 19 Oct 2022 08:51:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169469; bh=2+gx3wWCA2o5UX2WNEx+l1I7W2tZK/1eydy8g3EycQg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xqegrmoIt4n7t8Xh8hKdIxZRMKljSwEe6WP7J6WRRM6CN9hSiN1SwUlxan7qiRSAb IskXaTnwmbMZuYDEgBEnwNJ/EO/tCZDBl6DDNEbqtIavfWY3LgPmdUYKUo3dEOb/45 MFAA+aSsDfbhZQoFua3GBD2jcRzwcqJSfMmGXcJ8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Wang , Felix Fietkau , Sasha Levin Subject: [PATCH 6.0 288/862] wifi: mt76: mt7921: fix the firmware version report Date: Wed, 19 Oct 2022 10:26:15 +0200 Message-Id: <20221019083302.732187973@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747119666251228631?= X-GMAIL-MSGID: =?utf-8?q?1747119666251228631?= From: Sean Wang [ Upstream commit 00be84d6dfc8319ed1864d3ca8658569d36a1882 ] Fix the regression of the firmware version report since 'b9ec27102ac0 ('mt76: connac: move mt76_connac2_load_ram in connac module')'. Fixes: b9ec27102ac0 ("mt76: connac: move mt76_connac2_load_ram in connac module") Signed-off-by: Sean Wang Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c index 13d4722e4186..7cac7b126e59 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c @@ -2888,6 +2888,10 @@ int mt76_connac2_load_ram(struct mt76_dev *dev, const char *fw_wm, goto out; } + snprintf(dev->hw->wiphy->fw_version, + sizeof(dev->hw->wiphy->fw_version), + "%.10s-%.15s", hdr->fw_ver, hdr->build_date); + release_firmware(fw); if (!fw_wa) From patchwork Wed Oct 19 08:26: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: 5040 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp247065wrs; Wed, 19 Oct 2022 03:39:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM46zCUj7kUju2b88or1fg6n/l50rSZkq+x92I5zhHaFnuwHP0Idg7siM5vgQlwAm3cRnqeu X-Received: by 2002:a05:6402:51d0:b0:45d:5ba4:c3d2 with SMTP id r16-20020a05640251d000b0045d5ba4c3d2mr6812341edd.132.1666175989741; Wed, 19 Oct 2022 03:39:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666175989; cv=none; d=google.com; s=arc-20160816; b=oaJVnPpfoeZEOUolB/LNvaIdni2MgJ854/QBDb/cBJ2yV+gkP8KJSVzyMJe+W0ycYT +vRwpdKhNbIApDXgRxyYxBz+g4I2i6/DcWIt69fuiR+DpeFttASDxGeet5G3DE4thclc Esk7+QubCjkaTii9Xvo41kmJcR22sdwF6Z1lL6YljV5eVKG0SdsPgABKkKNA53u+Edel Ok0QqCfRKFkAupl3bhihUg4DSEISo5+bid5f/oOr/ZOqn0mxnbm98Y4IJtv/Fyc7O5IE B3vlYxZ2adwhHtmVwkDHzzP/wC7KvBz1M4sF+W+MUh34L9DeSElEYCG48KeXbX+RIYiG 9Pgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=94xTN4WNCd8MNrAB6s29Yrvauv9Ty1cLCPtxGcd/mdE=; b=DhXgeZkh1kf5Hzm54FBbTvS5OaIn29uGdiwQwrjvQAGZREvFbs2LfnFgp54lh7PaoA cZbBh/ym4dwWy7eUv/93HXqtMT/sWg2YM+mhEQ+44aBLLkW8ebO29xPxgkTS3TEvaZmr r6XDZJF5QtZD0zLL/o3dANHrxHc6KF1E5OCT8YsHUDnI97ek6mNru2ogwsi/eelH+DqD NZSTfgOpPQ2R1ia6ikrDpwzodFkdQIe/maWQ3Z22zkzcC3H0oYVB/OO/am+qj8BvhoFJ By7DUUAwxRXfSnkdN5ZVhkjYrAeHKKy3+9iB3nmRWlu7Lb2CzOMkzQyrIL1W3j3oxOMV a22A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sew4FdAM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hw8-20020a170907a0c800b00780e89aecd1si13518723ejc.849.2022.10.19.03.39.24; Wed, 19 Oct 2022 03:39: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=sew4FdAM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232004AbiJSKic (ORCPT + 99 others); Wed, 19 Oct 2022 06:38:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230210AbiJSKiE (ORCPT ); Wed, 19 Oct 2022 06:38:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DA65152C68; Wed, 19 Oct 2022 03:17:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BF2CFB822EA; Wed, 19 Oct 2022 08:51:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 226A8C433B5; Wed, 19 Oct 2022 08:51:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169472; bh=C8mJs/DW0I+lDN5k5E9k6cEFjftALrJf9Lm2fiFCk6w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sew4FdAMXlO+w7FrWEvy5ZI2Q4pRE5WzS7+Ao7p4qQb2hyd7x9BCozKw57jkbQFfA 8EMtPDKKBOb1JNd73t5T4TBCrAE4RwqBgnKQgrl33/n1rQDsxNCqho0bqhQbOOJYUt nEywpRbPEfCWe1fhi01bxL5dQ3hssbiDIS78kRls= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Howard Hsu , Felix Fietkau , Sasha Levin Subject: [PATCH 6.0 289/862] wifi: mt76: mt7915: fix mcs value in ht mode Date: Wed, 19 Oct 2022 10:26:16 +0200 Message-Id: <20221019083302.780637133@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112154134438932?= X-GMAIL-MSGID: =?utf-8?q?1747112154134438932?= From: Howard Hsu [ Upstream commit c6d3e16ad4362502e804a6ca01e955612f3b8222 ] Fix the error that mcs will be reduced to a range of 0 to 7 in ht mode. Fixes: 70fd1333cd32 ("mt76: mt7915: rework .set_bitrate_mask() to support more options") Signed-off-by: Howard Hsu Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt7915/mcu.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c index f83067961945..e99fdacc11ce 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c @@ -1360,7 +1360,7 @@ mt7915_mcu_add_rate_ctrl_fixed(struct mt7915_dev *dev, struct sta_phy phy = {}; int ret, nrates = 0; -#define __sta_phy_bitrate_mask_check(_mcs, _gi, _he) \ +#define __sta_phy_bitrate_mask_check(_mcs, _gi, _ht, _he) \ do { \ u8 i, gi = mask->control[band]._gi; \ gi = (_he) ? gi : gi == NL80211_TXRATE_FORCE_SGI; \ @@ -1373,15 +1373,17 @@ mt7915_mcu_add_rate_ctrl_fixed(struct mt7915_dev *dev, continue; \ nrates += hweight16(mask->control[band]._mcs[i]); \ phy.mcs = ffs(mask->control[band]._mcs[i]) - 1; \ + if (_ht) \ + phy.mcs += 8 * i; \ } \ } while (0) if (sta->deflink.he_cap.has_he) { - __sta_phy_bitrate_mask_check(he_mcs, he_gi, 1); + __sta_phy_bitrate_mask_check(he_mcs, he_gi, 0, 1); } else if (sta->deflink.vht_cap.vht_supported) { - __sta_phy_bitrate_mask_check(vht_mcs, gi, 0); + __sta_phy_bitrate_mask_check(vht_mcs, gi, 0, 0); } else if (sta->deflink.ht_cap.ht_supported) { - __sta_phy_bitrate_mask_check(ht_mcs, gi, 0); + __sta_phy_bitrate_mask_check(ht_mcs, gi, 1, 0); } else { nrates = hweight32(mask->control[band].legacy); phy.mcs = ffs(mask->control[band].legacy) - 1; From patchwork Wed Oct 19 08:26: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: 5319 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp285271wrs; Wed, 19 Oct 2022 05:07:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4slpLnVm37c9+Y64vRR2Q+hEMxx3HSyqEAdZ3TBrRxBUHA4rgTeP6v5VR6I0sHbb0URnwI X-Received: by 2002:a17:90a:590a:b0:20a:e93e:2022 with SMTP id k10-20020a17090a590a00b0020ae93e2022mr9215663pji.141.1666181250399; Wed, 19 Oct 2022 05:07:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666181250; cv=none; d=google.com; s=arc-20160816; b=U9pqBfsxu566wPYZ+DRGssvZSitgKZD6i78FHcDn3vMp5cp2TfqirFvxMHht32wdXT R65o2w/sXYAn2Q9iZB2TPq+9yAILgb3TBvI77T23s4eb+EZxV0/EDMcscPcISHESQQ3L OmfhxaL463no65G+EvWn3Z/OOJUWEkLxh5BHPr2kU9K1T+xHhw14VhNZJAyIscxLl5y/ VYhiakrdeR0P422MfeKhq2V0SdFOcoCgjoQrT9sJ0mXIp+Mu7kC4N1JYGnWVZKkshEtK X+OFslTXT9SwscFXmOXY/4m7NAoHLZ9iPw+DGMSWp6jk3l/34b/xOu7Ox8JcostOYEuo Hf2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=B56lol8SL30SE8KEiPRKxYcaJXhxaU7EC+drJR+BzQY=; b=nJxGrIxhLqvx3dzhSrMfSTpa6mwo9BqtVPpllXSe358MlDcnNEfrlzsXihhOpXXzqr iKuZqH0hTa+wwot6QrO4QLs7xpsC3BRnJ1DSXeKjp5BhsDoyMJztKAp/BELt+xkuZkpu XcigfGwXm3i9RVHlo3tzNMZuC+aOdP1+Z9boxjh1tHWBvy4D7O7uK84fB2uSY7eTVqrG O623KkAzbhkBlBn5ItbdRhn/sFLL5kM65WJimdBD0uvdRVm8BF0S6WRW213MspB+8Y+C +RW8e9xahb6uGzugmToCCblsf5IivCd/PtdSrj8hMXMSyjMd8FFwKbqSVQAA/AwhpgI9 bWwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=f1ugUAqn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q18-20020a631f52000000b0043447486c84si17927034pgm.875.2022.10.19.05.07.14; Wed, 19 Oct 2022 05:07: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=f1ugUAqn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232524AbiJSMDq (ORCPT + 99 others); Wed, 19 Oct 2022 08:03:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231713AbiJSMDO (ORCPT ); Wed, 19 Oct 2022 08:03:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFA2B4C627; Wed, 19 Oct 2022 04:39: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 37FE1B8239B; Wed, 19 Oct 2022 08:51:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA378C433D6; Wed, 19 Oct 2022 08:51:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169475; bh=HEgbHPH4lSpqw0IoD5a5jolqD6Cro97cGscbSfURixw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f1ugUAqnjPZykZh2zVV+TFVO09corr+XSB4Z0FxV1IRK8HBkuvJ64cWbqPGBKmMQI l7yY7WAyewahUJnI+iNAtNoQYGAsPpaB8OCNu9HTtdbGkH8wBGpPtChIgbkHQDSbHT s/IvAtaYZ6Lcj7QU5IDp3n5LxOO+4ifAYvRJtaqE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lorenzo Bianconi , Felix Fietkau , Sasha Levin Subject: [PATCH 6.0 290/862] wifi: mt76: fix uninitialized pointer in mt7921_mac_fill_rx Date: Wed, 19 Oct 2022 10:26:17 +0200 Message-Id: <20221019083302.829350594@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747117670670921875?= X-GMAIL-MSGID: =?utf-8?q?1747117670670921875?= From: Lorenzo Bianconi [ Upstream commit 9be57ad73984545d594ed359dac19457bcb9fc27 ] Initialize msta pointer to NULL in mt7921_mac_fill_rx() in order to not dereference a uninitialized pointer. Fixes: 0880d40871d1d ("mt76: connac: move mt76_connac2_reverse_frag0_hdr_trans in mt76-connac module") Signed-off-by: Lorenzo Bianconi Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt7921/mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c index 6bd9fc9228a2..e8a7a5831782 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c @@ -235,7 +235,7 @@ mt7921_mac_fill_rx(struct mt7921_dev *dev, struct sk_buff *skb) u32 rxd2 = le32_to_cpu(rxd[2]); u32 rxd3 = le32_to_cpu(rxd[3]); u32 rxd4 = le32_to_cpu(rxd[4]); - struct mt7921_sta *msta; + struct mt7921_sta *msta = NULL; u16 seq_ctrl = 0; __le16 fc = 0; u8 mode = 0; From patchwork Wed Oct 19 08:26: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: 4630 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212045wrs; Wed, 19 Oct 2022 02:06:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6JYcgxojo2tghwC8h39sypW15/sDgvLo7JuKgeTlOOeg9rMYPt0uQzQxI8ACg4WhHhMyz4 X-Received: by 2002:a17:907:60c8:b0:78d:bc56:8f04 with SMTP id hv8-20020a17090760c800b0078dbc568f04mr5677298ejc.560.1666170396058; Wed, 19 Oct 2022 02:06:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170396; cv=none; d=google.com; s=arc-20160816; b=itTKyGKo3XT2TumU0HBR81aEyZG6RdBn0MOreC6qBtHpIVLN1/5JnlSA4ynWU9m9yn czpy9cJZ9Ul4SicZ3EyrPtiUKQhTd0gqEfMXgxgSJl2NvlCYQJJ643SbINtSTHKeIMAk H9S1QO8Cg6D1ugZWbydm3wFlAQGuVkQwvVjHuKUcLZWjva5yhsJrqVXIwaE3j/fxFvGe TlCI6whTN1vLHiflJJmiPt9fZCAsvggA0fEB4Mtq3RSdO4eb5UviMGJBN0C+XRxXnbRh 1Th7Oo+LQ2GWKHoW6jvA7P5v3LLmO5Gzme+RVmK8OfdfO/NP72Ty5rCAowIQFYT00xTK oyEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9OkU7jflebU7ac1SOB6VUMqY0HxBV2bUBpUPRMJ7S+c=; b=Llq8OCG9KdfyL0BRpf81TnExQuZz39CRblObR+cbLVt0FSk/fTJj76XGY0oWCxwiV8 3heSCxnJJdtWMsmhNvNZnHYjOmczPV/Tu/Kafk720Y4gl5XycqjZJcD7NIjlDtHWPRiI Y173NdFgy2RYLia3ERtfQ7rYOV+DxQy2s9goKTgXjYaJv3oTSHePkGDMMgCXE1Rxn96C Tl/DJ0NmgfPFgfhg6mp+tcaNLhknf3gw3DQ/rP/Wzia0xoaN/AIVZBvoZypgeQQKNzNM h2o6GYS9TyKGDWKba4DnL+y31J2bDBjFraVYd7tupdFjQixcmZZCt+CQAaCa3dIL341G X/YQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dIQu+Not; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ga13-20020a1709070c0d00b0078db1343eedsi14272233ejc.774.2022.10.19.02.06.04; Wed, 19 Oct 2022 02:06: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=dIQu+Not; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231864AbiJSI5O (ORCPT + 99 others); Wed, 19 Oct 2022 04:57:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231800AbiJSI4f (ORCPT ); Wed, 19 Oct 2022 04:56:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 447589D516; Wed, 19 Oct 2022 01:52:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 41BD761820; Wed, 19 Oct 2022 08:51:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 567C5C433D6; Wed, 19 Oct 2022 08:51:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169477; bh=tIBsBLLuzY+hkWm+XuxHlNQ6uSDfN7fZPVjIX6Wp4vk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dIQu+Not6mHqXQXqvM/AHGv/z0v7Zu4pFBGGXeFkIIVK8dQO/FlaCFpm9xzix7ba3 PalNgosjS++MQnEFB07+S61zKhZEhWqOCM+RFrvurNhar1CA61J4F28RNprRKsOgwU KocQ8ymW04QY2KDfZaAjYaPZlkJNFlnxZlppmBUs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Howard Hsu , Felix Fietkau , Sasha Levin Subject: [PATCH 6.0 291/862] wifi: mt76: mt7915: do not check state before configuring implicit beamform Date: Wed, 19 Oct 2022 10:26:18 +0200 Message-Id: <20221019083302.867996062@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106289224343602?= X-GMAIL-MSGID: =?utf-8?q?1747106289224343602?= From: Howard Hsu [ Upstream commit d2b5bb6dfab29fe32bedefaade88dcd182c03a00 ] Do not need to check running state before configuring implicit Tx beamform. It is okay to configure implicit Tx beamform in run time. Noted that the existing connected stations will be applied for new configuration only if they reconnected to the interface. Fixes: 6d6dc980e07d ("mt76: mt7915: add implicit Tx beamforming support") Signed-off-by: Howard Hsu Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c index fd76db8f5269..6ef3431cad64 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c @@ -23,9 +23,9 @@ mt7915_implicit_txbf_set(void *data, u64 val) { struct mt7915_dev *dev = data; - if (test_bit(MT76_STATE_RUNNING, &dev->mphy.state)) - return -EBUSY; - + /* The existing connected stations shall reconnect to apply + * new implicit txbf configuration. + */ dev->ibf = !!val; return mt7915_mcu_set_txbf(dev, MT_BF_TYPE_UPDATE); From patchwork Wed Oct 19 08:26: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: 5066 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp248551wrs; Wed, 19 Oct 2022 03:43:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4TAXFFrSRyYQu8d04xmRwwHVCLY634dOuvfjH/BQmPllI/H0jbobqqLLQ5+6I83JGiLR7R X-Received: by 2002:a17:902:d510:b0:185:480a:85d3 with SMTP id b16-20020a170902d51000b00185480a85d3mr8021689plg.4.1666176234428; Wed, 19 Oct 2022 03:43:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176234; cv=none; d=google.com; s=arc-20160816; b=zHWW9dWgiPja0HO5I50yNnkOwc3f0CrggE4pHeMXys68hMCE4bybS1rT2WwVoe/9Ae 30lgUpwhuqGu2uTt86PiZ7tV/PotsMUl77HmuKU13LU3GyzR07YrJTzeTSTC/jZDZGa+ woIGxp+KD5JAd+JIiInVLCjfwwXVTi/OnbBYerxyIw4PAWkrKpCZJpHPPu5Pyt474nFh rRVpOxH01nTfqLCNLGeMnrqcp74Pch3h/bSdNvqK3O3aOcS/ldzMJxNMg8Pxzcdmydto ZR33F/vERQTMCaxnZkO4sh04liFUM36NHW2oXgEXrzX57FtqkBQVwCZGRyYzfhWD6Z5q 6K8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=KJVrexF1Subx3MagWsdrtcz7oEWbmoE2NJ/GIsmOsvM=; b=NWtL6BLj/a/+8GzYi92uHIZp0bJNTinqXU/qvzdg2DLQ8r6zMD8OaLqE+BRCFFaM2G aL5DpyCHx6iS5IMridh8bNRIwG2tRDqfG2pQYwE4wY3YDZQ1V+kTyqm9Cpksjij/MvUV Ru7Y4oaknByqmMkMtb+TWTCh9s5BJ1PX7PKvTtrAOLYu3KEnPqjZdmbIufPHP5f8cSYf MD4Hyeq57lfBnkW2hvsXtoNO2FhTtPJQ5NFsVuZ9JPKs46Bz0aNXkG6WldqTv5HoxFWY oS7+teg1QLcDI2yWrTBQybM0vvVv+C4kG9+tEbFTJCZUy9NwDZEIwV+DjPoqseuepIf3 SaWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=s19ShQsq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f22-20020a17090ace1600b0020038eb8b5asi16602600pju.21.2022.10.19.03.43.41; Wed, 19 Oct 2022 03:43:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=s19ShQsq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232271AbiJSKnT (ORCPT + 99 others); Wed, 19 Oct 2022 06:43:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232242AbiJSKmX (ORCPT ); Wed, 19 Oct 2022 06:42:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4719BB97A0; Wed, 19 Oct 2022 03:20: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 ams.source.kernel.org (Postfix) with ESMTPS id 6ACB0B82389; Wed, 19 Oct 2022 08:51:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DBB19C433C1; Wed, 19 Oct 2022 08:51:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169480; bh=CPeINRe0pEMnOWV5lqV0MslZCm4GwrZoEHYIiNvKaLk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s19ShQsqy3POhaiw8YauC9RFXT9AqbJXVU92Mt7Q7qt2889cOZ6HaMgKFHlrkwE+x zDUzDv6sAC/gsd4ZvodeRCrwrutoUBO6WvBMV+Fnkyp8aomGgiI2Aucym4cI+FMUDC uV7kFr+Ced1yvDN4It9kLNwb57ZP9AWaYk6ngRH8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Deren Wu , Felix Fietkau , Sasha Levin Subject: [PATCH 6.0 292/862] wifi: mt76: mt7921e: fix rmmod crash in driver reload test Date: Wed, 19 Oct 2022 10:26:19 +0200 Message-Id: <20221019083302.915300879@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112410843573604?= X-GMAIL-MSGID: =?utf-8?q?1747112410843573604?= From: Deren Wu [ Upstream commit b5a62d612b7baf6e09884e4de94decb6391d6a9d ] In insmod/rmmod stress test, the following crash dump shows up immediately. The problem is caused by missing mt76_dev in mt7921_pci_remove(). We should make sure the drvdata is ready before probe() finished. [168.862789] ================================================================== [168.862797] BUG: KASAN: user-memory-access in try_to_grab_pending+0x59/0x480 [168.862805] Write of size 8 at addr 0000000000006df0 by task rmmod/5361 [168.862812] CPU: 7 PID: 5361 Comm: rmmod Tainted: G OE 5.19.0-rc6 #1 [168.862816] Hardware name: Intel(R) Client Systems NUC8i7BEH/NUC8BEB, 05/04/2020 [168.862820] Call Trace: [168.862822] [168.862825] dump_stack_lvl+0x49/0x63 [168.862832] print_report.cold+0x493/0x6b7 [168.862845] kasan_report+0xa7/0x120 [168.862857] kasan_check_range+0x163/0x200 [168.862861] __kasan_check_write+0x14/0x20 [168.862866] try_to_grab_pending+0x59/0x480 [168.862870] __cancel_work_timer+0xbb/0x340 [168.862898] cancel_work_sync+0x10/0x20 [168.862902] mt7921_pci_remove+0x61/0x1c0 [mt7921e] [168.862909] pci_device_remove+0xa3/0x1d0 [168.862914] device_remove+0xc4/0x170 [168.862920] device_release_driver_internal+0x163/0x300 [168.862925] driver_detach+0xc7/0x1a0 [168.862930] bus_remove_driver+0xeb/0x2d0 [168.862935] driver_unregister+0x71/0xb0 [168.862939] pci_unregister_driver+0x30/0x230 [168.862944] mt7921_pci_driver_exit+0x10/0x1b [mt7921e] [168.862949] __x64_sys_delete_module+0x2f9/0x4b0 [168.862968] do_syscall_64+0x38/0x90 [168.862973] entry_SYSCALL_64_after_hwframe+0x63/0xcd Test steps: 1. insmode 2. do not ifup 3. rmmod quickly (within 1 second) Fixes: 1c71e03afe4b ("mt76: mt7921: move mt7921_init_hw in a dedicated work") Signed-off-by: Deren Wu Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt7921/pci.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c index 2b015dacbba2..e5b1f6249763 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c @@ -288,6 +288,8 @@ static int mt7921_pci_probe(struct pci_dev *pdev, goto err_free_pci_vec; } + pci_set_drvdata(pdev, mdev); + dev = container_of(mdev, struct mt7921_dev, mt76); dev->hif_ops = &mt7921_pcie_ops; From patchwork Wed Oct 19 08:26: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: 5062 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp248396wrs; Wed, 19 Oct 2022 03:43:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7wPwndHSxQX3k6Y3AsEbVVYbAoQunHxvxjF49k/aBjbOFZ63WmwbUg5Ux1+aXSm5EeLzhP X-Received: by 2002:a17:902:ef96:b0:17e:e7f3:31db with SMTP id iz22-20020a170902ef9600b0017ee7f331dbmr7607865plb.127.1666176192777; Wed, 19 Oct 2022 03:43:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176192; cv=none; d=google.com; s=arc-20160816; b=fei4cWHGuGVpNHKp/qODvW6suujoxUZdsdSGuP5s9+OxIUnWOd/aGqB4+epDk+cmjh N7t/7YRgExJM+itn0rtInM7SCkesQodRC/S423Xl3KOrEE3rg8f2A+7YVIw+yvjb+o4u NrJf0NXZPxgNSwcC5QoSr7g2yuKN217g44HIavOW7Kkfn8gYO66seuypcfB6KVNHkh+M 5QfVztd1B/f7MghuI/EB4k2WHF6AE2SSYX9H9CClZMCZe3f7+ruxAGREYv8YlITuNqIm m8loIll9NLEXD9KXgWnW13EQ0u4gzYA49rtORUF0oU1hKlYF8j5i9S9FQ3gpzgflGWnX umhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JpdVq4gNkwurGSmqYH9Aof38YZcYgwm7+YigtH/JSMI=; b=mgEZhm7fIRqeluyZMXfyjDwTcmuXi/4aJAbkrOvP8auW9ajTJoDGJOK313Nun1mjBf hBSuYnvku7IRBI36+xInmbpQmgT+R6CjCWRoL6r+ZoRLPTLiQG0Mvlb+lKExSTMa32Ow Et+zK5sU2fNrZUnVkqrAO2kgcPzP0/+0sv4qYufzIaV5fuZyuX7ixkKedN7sHwkC93cw kWmJiBta5qwaUA/wjEJ7uQ6P47t9sfa2BKB0DkwSZCtlptvz/MmyAGk1LoPzNRMhRvCd 7v+bYE56IQOPOY2ggDitVhCMOwjL2/jur1HofqTUFzmKm71O9X6DfpAirjb1ePdJx2yv E6dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wwmUABvm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s33-20020a634521000000b0046108b8e40bsi17699032pga.363.2022.10.19.03.42.58; Wed, 19 Oct 2022 03:43: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=wwmUABvm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232514AbiJSKml (ORCPT + 99 others); Wed, 19 Oct 2022 06:42:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231986AbiJSKlq (ORCPT ); Wed, 19 Oct 2022 06:41:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45A5A27DEB; Wed, 19 Oct 2022 03:19: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 19F4DB822E1; Wed, 19 Oct 2022 08:51:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B977C433C1; Wed, 19 Oct 2022 08:51:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169482; bh=C6CwbD+x4Djmkf1hfONC+CIP9Mm3gn2aJ3WQUw0pJs4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wwmUABvmBIrj2jHgzEuKzwjTuHfGkUBB5k9K4ENhAiCc4RsTbVv10T49UqPu3Dhhh Edh6aRNYHRpj+k1C6/ZTDvKlDRCkAdfmzOK012dga7JWoIt2lEHryYPd+sgoTXGScQ hyCXYP/nCS7WgiHScdHcynufDoDELzAxwgWalUhM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Luiz Augusto von Dentz , Sasha Levin Subject: [PATCH 6.0 293/862] Bluetooth: RFCOMM: Fix possible deadlock on socket shutdown/release Date: Wed, 19 Oct 2022 10:26:20 +0200 Message-Id: <20221019083302.963385999@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112367435768180?= X-GMAIL-MSGID: =?utf-8?q?1747112367435768180?= From: Luiz Augusto von Dentz [ Upstream commit 812e92b824c1db16c9519f8624d48a9901a0d38f ] Due to change to switch to use lock_sock inside rfcomm_sk_state_change the socket shutdown/release procedure can cause a deadlock: rfcomm_sock_shutdown(): lock_sock(); __rfcomm_sock_close(): rfcomm_dlc_close(): __rfcomm_dlc_close(): rfcomm_dlc_lock(); rfcomm_sk_state_change(): lock_sock(); To fix this when the call __rfcomm_sock_close is now done without holding the lock_sock since rfcomm_dlc_lock exists to protect the dlc data there is no need to use lock_sock in that code path. Link: https://lore.kernel.org/all/CAD+dNTsbuU4w+Y_P7o+VEN7BYCAbZuwZx2+tH+OTzCdcZF82YA@mail.gmail.com/ Fixes: b7ce436a5d79 ("Bluetooth: switch to lock_sock in RFCOMM") Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin --- net/bluetooth/rfcomm/sock.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c index 4bf4ea6cbb5e..21e24da4847f 100644 --- a/net/bluetooth/rfcomm/sock.c +++ b/net/bluetooth/rfcomm/sock.c @@ -902,7 +902,10 @@ static int rfcomm_sock_shutdown(struct socket *sock, int how) lock_sock(sk); if (!sk->sk_shutdown) { sk->sk_shutdown = SHUTDOWN_MASK; + + release_sock(sk); __rfcomm_sock_close(sk); + lock_sock(sk); if (sock_flag(sk, SOCK_LINGER) && sk->sk_lingertime && !(current->flags & PF_EXITING)) From patchwork Wed Oct 19 08:26: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: 4629 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212027wrs; Wed, 19 Oct 2022 02:06:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5SmO54KBmjPCbLxtCHyUIzqner9Y1eBYEPbTLdphFciYVtQP096Xal5iDRNzRJhshUGI7b X-Received: by 2002:aa7:c0cf:0:b0:45c:6a06:ea9a with SMTP id j15-20020aa7c0cf000000b0045c6a06ea9amr6402715edp.211.1666170393417; Wed, 19 Oct 2022 02:06:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170393; cv=none; d=google.com; s=arc-20160816; b=1Ip64MeNYA2aOuHBMAzZBK8QILYa/jXAtyGdbmlpcQ9b/SGrxawTYo2PlZtGMWQ/nS XsVLCbxvyKR32LoXeR60mJ4ahkPqv2E+Ugohb+dUvEE1c/wPwQIz/47Z5SsF5PYsp3hp OFkfJ1R91hlAaDTwlo88ccL784ta34t87cs3CP3DoHyXTp5728wutwYP5ty79Cf9q2Xk kPE8ujS6WrITv7Ckn4y9wNz2QM/jkUjNZaZdJZkoCYmEyE+2sr7nKDwgO6B7dFdz70NP 2AP4oo3a57W6w8E0ZHhqQ0hMez6yHxHwAiuvrdu8t3S1uzSZUpyJnn1GybwrAeSzbY9M 9CIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2faJEEOkcg0BFFaPon09pTeCWDOh8zjLxsdn9OWF0Hw=; b=rOkd0WGcX6/l9QmfXIc5ScuHiOXSqb2v7DMlkGmFQyUfQDUuctXw1yFgyCxjRDUaca CFSUwd9gUsagozv+qQ688QKfXVwyjH5muWlIxF0sCpoEBZKaAcCVVqnV7gVs8rkU19n2 BVBrbxvIMXFxWA0OoXkfS0SRKfE6nLb6U2pVrpMuZt70i39ztctn7+Xx4h0VJuiaQU1R nZBuFXu8YNzSOoHTlUr+a0KN8KJkxR5obNgkNBwVQvNlJCgT9yT6Ju3z+/Y0+O/jr40X ahk4J9Q7SZGX1Ee+dHUlkji4QT0C/ug9hpFE12ET7YyrKNb6ll418PUhFJJXWOTa6Fda 9X6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lTyS4P3y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nb38-20020a1709071ca600b00773db351c39si15085855ejc.64.2022.10.19.02.06.02; Wed, 19 Oct 2022 02:06: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=lTyS4P3y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231857AbiJSI5K (ORCPT + 99 others); Wed, 19 Oct 2022 04:57:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231952AbiJSI41 (ORCPT ); Wed, 19 Oct 2022 04:56:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41BA99B847; Wed, 19 Oct 2022 01:52: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 dfw.source.kernel.org (Postfix) with ESMTPS id EC2D06186E; Wed, 19 Oct 2022 08:51:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C9C7C433D6; Wed, 19 Oct 2022 08:51:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169485; bh=deb/+f+bTm4Ytyvf8OL7N3yZQGGpLOBi7QxH7ZECr8U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lTyS4P3y11/NrwdV3qBGEw0NotbUZiTb8vaNbWBsWrWxXOVEreptwilF5ZVan1no4 3CK0pOgZBAONhpTXK+hH/YKYCqWkzJYpxaWgy0ReTxsq5A3IY135JmmTNpxdG0gDhP 8qFPd52nxrqGtHoqBU2ql78pHsmVU5U+Mdd3ERcg= 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 6.0 294/862] net: fs_enet: Fix wrong check in do_pd_setup Date: Wed, 19 Oct 2022 10:26:21 +0200 Message-Id: <20221019083303.002949848@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106286170101548?= X-GMAIL-MSGID: =?utf-8?q?1747106286170101548?= 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 99fe2c210d0f..61f4b6e50d29 100644 --- a/drivers/net/ethernet/freescale/fs_enet/mac-fec.c +++ b/drivers/net/ethernet/freescale/fs_enet/mac-fec.c @@ -98,7 +98,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 Wed Oct 19 08:26: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: 4635 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212120wrs; Wed, 19 Oct 2022 02:06:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7NZOFKh/IIH5f3TlVsV5WuM7LLE3Y3l+jJNvgzStc2DPhN0I5O5R4kR5xtN0u5el0zAleN X-Received: by 2002:a17:907:2cce:b0:77a:6958:5aaa with SMTP id hg14-20020a1709072cce00b0077a69585aaamr5536411ejc.245.1666170406540; Wed, 19 Oct 2022 02:06:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170406; cv=none; d=google.com; s=arc-20160816; b=zgh8jrj4m3LmdLuppZhmG1qSHLdA0R6A5OMqyLiFKk0sEw5gYNhK1TFkUoZb0zI7Wz Ssd36Wd48lqwj9eUgWaP6mbxsXzxUE266gGirnD9HjfodDWJXppe59Oj1/SXv4rCWpSK N5AO9hiG6j8dJN+G2EfcvGXTVD3hn5597jwUmntHBxRlG2AlQXHO247qRki+YDrjXvqi bDwuu3xfkG8rud8qI+zV7pPV27uhSg2Dm+rcrrjouc8U9TffDqUAhaTDAodAWm6fV1x8 DmmcahmNiy0L2H1JqkiTTyVRrCwWxTfvSkNqGf14TN5HoiB/M/558d+MN2PmhkfK1sYa GULQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=acMFAQ3aTEDH3kQ/Mwv8mHr+nt2Xjg4utcxyqzl3trE=; b=ZwyBmprGjp5VvwYQIvxd8Lt0nRSirADWu4ZJRM0NuJTyYQjMet7sbj0d53NkwYgLXU 0Qx+di7SM92MRwTCVwzUe0E0cst2rpINNzfTS1nkNDICPmaUAckFvWRx9d7UmULEAHMv mAYx+aP3iKTpphCfKdXjEaEmc/0VeONESunQdWXz+xm784Z1gIGlx8ngTfZjWIAldIFD hUoGtwusi2K9g7YjShruofQu42apKaXWlQrnFB118qUy1blCKO2VJT3oNBR6RORPpciZ /hCg7slk/DCsHk8vFO1tp/0uF+YeAIbVJv5Tt266tgLw5dqmaCs35bDFH6OUEUq+9F6P S6xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=L6J39VaK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dm1-20020a05640222c100b004589ea2d983si11436027edb.287.2022.10.19.02.06.16; Wed, 19 Oct 2022 02:06: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=L6J39VaK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231984AbiJSI5j (ORCPT + 99 others); Wed, 19 Oct 2022 04:57:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231969AbiJSI4m (ORCPT ); Wed, 19 Oct 2022 04:56: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 C1FE62651; Wed, 19 Oct 2022 01:52: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 A36D66186D; Wed, 19 Oct 2022 08:51:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B323BC433C1; Wed, 19 Oct 2022 08:51:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169488; bh=om/giBk3YTiuMx8dz8TMp1iqQLWcdwOEeaBePXe6aw8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L6J39VaKYngYSEVBq1mS7iAV0sRoEPWCL+zJ/TLt+nGlh4MUflQTYmINTsH2fyUEg Wle5dJy5prHCajvUjEJU9p1VGWRIn4MkJlLmiw/b+M5iHwXAQqJxCx9pShd/zycrnR 7ELAEPG+dGnZXwV3kVZa8MO+GheqByHznt62VL6U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lee Jones , Daniel Borkmann , Yonghong Song , Sasha Levin Subject: [PATCH 6.0 295/862] bpf: Ensure correct locking around vulnerable function find_vpid() Date: Wed, 19 Oct 2022 10:26:22 +0200 Message-Id: <20221019083303.050438456@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106300502840334?= X-GMAIL-MSGID: =?utf-8?q?1747106300502840334?= From: Lee Jones [ Upstream commit 83c10cc362d91c0d8d25e60779ee52fdbbf3894d ] The documentation for find_vpid() clearly states: "Must be called with the tasklist_lock or rcu_read_lock() held." Presently we do neither for find_vpid() instance in bpf_task_fd_query(). Add proper rcu_read_lock/unlock() to fix the issue. Fixes: 41bdc4b40ed6f ("bpf: introduce bpf subcommand BPF_TASK_FD_QUERY") Signed-off-by: Lee Jones Signed-off-by: Daniel Borkmann Acked-by: Yonghong Song Link: https://lore.kernel.org/bpf/20220912133855.1218900-1-lee@kernel.org Signed-off-by: Sasha Levin --- kernel/bpf/syscall.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index f798acd43a28..22e7a805c672 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c @@ -4395,7 +4395,9 @@ static int bpf_task_fd_query(const union bpf_attr *attr, if (attr->task_fd_query.flags != 0) return -EINVAL; + rcu_read_lock(); task = get_pid_task(find_vpid(pid), PIDTYPE_PID); + rcu_read_unlock(); if (!task) return -ENOENT; From patchwork Wed Oct 19 08:26: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: 5036 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp246838wrs; Wed, 19 Oct 2022 03:39:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4FlcmzMoSVhOC7IzoA0znUfbGATocTOXK2D8NySBnaZiIApn265jxwKue4W89l2Lf6R0UA X-Received: by 2002:a17:906:4fcd:b0:78d:4b28:9d57 with SMTP id i13-20020a1709064fcd00b0078d4b289d57mr6133377ejw.303.1666175956994; Wed, 19 Oct 2022 03:39:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666175956; cv=none; d=google.com; s=arc-20160816; b=GAUJwnKsg2zfLhyTKbwZfi8cMUKSp3t9WTn+XyUqKM6+W5I5Jvbw3I+95aMpY99VTQ nQ8Sf+zOReD/x6sr39NqgasH0FKILvqvrR2UqexKovpw2PqhRTpT4C8vSbtVw76TqwGX K269seSCuCDRywpLsr9Ku2RLu4vmwhct8SCs6RbITfoN0W6DawOylfh7TDc+t3xMtMCw VQcthbrQPy9BxF7DuJWOLEwvEG3Wm8KvaEeq0hQ/PBC+r7JMjjIWvi0hAYmWfiAZeTud Y+GZ6c+iVy4q8dE9Pd+nv5UzTKwvEuHIu+wx5Pce4DQGb6sIlS1oVjcOiEGMJIsKQMSA 9goA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bjksqVOXQBfaH9ZWHXkPPOm4GgaCwe7HdZj9vT9HmKY=; b=k9ruVxfBs4o4l28T+fuwWBJMjJvc5a15RM0qDOjwG9R3z6FOxHW2Jx7YSxD1rRVzGP 2TDVnNTZ0DXeLaZM/7vfoY7W5D4Hv9Wba+DJWwS8B2Jsqm2E7r3vm/7XIeo1Qm39tQJB qnKzT+GBfyzKKmwj4mpgFl7BJIaNf5uNUDgcANW8cGk8G7m9vj6maklBfdMp1j/3mUdT BcsFQddFN4r3wLUQWrwpVFlbe/NRYFglYjc5D6uWswha3/lpf/ONmKcBKcnIiV4okN8s zshexQWvgCi4E9cwh0IilYaVp+GBry5/szAQva+z1Ud2sfGR/ws+W1UffSlY1mZwPnFB CkEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xKjD8QTL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cb25-20020a170906a45900b0078e1d213812si11102688ejb.184.2022.10.19.03.38.51; Wed, 19 Oct 2022 03:39: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=xKjD8QTL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231883AbiJSKiF (ORCPT + 99 others); Wed, 19 Oct 2022 06:38:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230429AbiJSKhb (ORCPT ); Wed, 19 Oct 2022 06:37:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17B2B108254; Wed, 19 Oct 2022 03:16: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 ams.source.kernel.org (Postfix) with ESMTPS id 7D0C5B8238A; Wed, 19 Oct 2022 08:51:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EBE0BC433D6; Wed, 19 Oct 2022 08:51:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169493; bh=cSXhoQQnS0sgrIV1JzC+sZBN08NptzZPX3j/Utqtc7Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xKjD8QTLm/a+WfkIty0SGGd/vBQn+xADypRod55e0jZl1FYDODChzbeIXb3ELnTrr /qOW162DDPuYSapBV7B4tME2mRifdMVRK+kZGGIluhFNodWdYToBZHBu9TFq/pIduC pXJrK3UsAKf5OBzfjMwEs2ZRbfdYX4NdSrvLnh6Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrii Nakryiko , Daniel Borkmann , Sasha Levin Subject: [PATCH 6.0 296/862] libbpf: Fix crash if SEC("freplace") programs dont have attach_prog_fd set Date: Wed, 19 Oct 2022 10:26:23 +0200 Message-Id: <20221019083303.081773927@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112119953940098?= X-GMAIL-MSGID: =?utf-8?q?1747112119953940098?= From: Andrii Nakryiko [ Upstream commit 749c202cb6ea40f4d7ac95c4a1217a7b506f43a8 ] Fix SIGSEGV caused by libbpf trying to find attach type in vmlinux BTF for freplace programs. It's wrong to search in vmlinux BTF and libbpf doesn't even mark vmlinux BTF as required for freplace programs. So trying to search anything in obj->vmlinux_btf might cause NULL dereference if nothing else in BPF object requires vmlinux BTF. Instead, error out if freplace (EXT) program doesn't specify attach_prog_fd during at the load time. Fixes: 91abb4a6d79d ("libbpf: Support attachment of BPF tracing programs to kernel modules") Signed-off-by: Andrii Nakryiko Signed-off-by: Daniel Borkmann Link: https://lore.kernel.org/bpf/20220909193053.577111-3-andrii@kernel.org Signed-off-by: Sasha Levin --- tools/lib/bpf/libbpf.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -9056,11 +9056,15 @@ static int libbpf_find_attach_btf_id(str int err = 0; /* BPF program's BTF ID */ - if (attach_prog_fd) { + if (prog->type == BPF_PROG_TYPE_EXT || attach_prog_fd) { + if (!attach_prog_fd) { + pr_warn("prog '%s': attach program FD is not set\n", prog->name); + return -EINVAL; + } err = libbpf_find_prog_btf_id(attach_name, attach_prog_fd); if (err < 0) { - pr_warn("failed to find BPF program (FD %d) BTF ID for '%s': %d\n", - attach_prog_fd, attach_name, err); + pr_warn("prog '%s': failed to find BPF program (FD %d) BTF ID for '%s': %d\n", + prog->name, attach_prog_fd, attach_name, err); return err; } *btf_obj_fd = 0; @@ -9077,7 +9081,8 @@ static int libbpf_find_attach_btf_id(str err = find_kernel_btf_id(prog->obj, attach_name, attach_type, btf_obj_fd, btf_type_id); } if (err) { - pr_warn("failed to find kernel BTF type ID of '%s': %d\n", attach_name, err); + pr_warn("prog '%s': failed to find kernel BTF type ID of '%s': %d\n", + prog->name, attach_name, err); return err; } return 0; From patchwork Wed Oct 19 08:26: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: 4639 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212200wrs; Wed, 19 Oct 2022 02:06:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5916VlNB53YriMcLD6aKL8fO5igSxw8z5u5zDXjwHujRJVp4I4lTf1UhQSKUMklT4txIcv X-Received: by 2002:aa7:c144:0:b0:459:f897:793e with SMTP id r4-20020aa7c144000000b00459f897793emr6446025edp.8.1666170417665; Wed, 19 Oct 2022 02:06:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170417; cv=none; d=google.com; s=arc-20160816; b=lPteF8L1pcx/Kk1GhOVURMDan1Ymad5pa+kGio6po+YBstm6zi4Cy0TNJC4YoSTH2q yOBoYwE9ROgKQYDugrKzLnu1gbuFRMw1tOSo+W8aVc/iI3efwvM3zfKIEG8OBZdRPPIh +q/WVo8GIoXIY8b5rdGInPgG4rfy87X44IpIPruN6D7NTw9l6TzhkMVnaRZjz6YG2VUj s8MSjwHvuVqflaWgsMXf176gUJYeQhjfQldnQ6ZBdjSo4gIZvfOuxRnZBNauxXwcp8xT lGn8OMPzb89NEujN+fdHwXWMh0MCs7D4qjP0Z/sgQNmikjyZ5QO/5HxQb7SnF580u2wY LISg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4D79jPn2E8Rb0sRwzdZPMafsndc2hPYlxm9lISzxC+U=; b=A4k3MsOXGvy+chsqH8O+tB/eBvQTXTQd2e36oeC+P2vq88BNNAMlNBxvO8XMWkGxQT YcbG4xVCMuvBAjWTZEsacIcwwk2idIYKaonsxIvh8zK0WfwH7Xxskyr1lElkIQlDT3OF O6gyU4Vn9iNxUg1HWmyc43gjbjDtSZEVYygbNBjHy4VFnwkTCVzH3IA8k8yEo4n0JHaj PcLtZVV/BHMqOZwFNe3IW6oGQKUErvWZmexPmdv1lJU5BaacOvb/0chdeAI2ozeNVOwK 9UCOfjYuBf8oDrHBfMS23Px+D8fx/OnBLjO284QLe2rhDVWJr2G0e6lptiErPmGnJ3lw rzAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uAgRG3N0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dz13-20020a0564021d4d00b00453a0393deasi15621009edb.368.2022.10.19.02.06.23; Wed, 19 Oct 2022 02:06: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=uAgRG3N0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232037AbiJSI6I (ORCPT + 99 others); Wed, 19 Oct 2022 04:58:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230390AbiJSI5C (ORCPT ); Wed, 19 Oct 2022 04:57:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4321452085; Wed, 19 Oct 2022 01:52: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 82E906174E; Wed, 19 Oct 2022 08:51:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9410AC433D7; Wed, 19 Oct 2022 08:51:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169495; bh=mFUfEOAY7UgFEz0zOrho4a8Un5hZ2rqTQSz5pjCrbhc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uAgRG3N0LhpELRlwVxPdsWE9MxHE32t0zQE2/oDmJz82eosuu0wGtaDr5P3xpepSi tI8Pt+li50GV4KJu16pacMJi/ABCcK2VGCR/aFcQq+MNBOR+UT9IcnDsUQWxnbBaXp Zd91yr6lVWWK0LcV36WlZNGeO/oZcGMBKs5TPqj0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Baochen Qiang , Kalle Valo , Sasha Levin Subject: [PATCH 6.0 297/862] wifi: ath11k: Include STA_KEEPALIVE_ARP_RESPONSE TLV header by default Date: Wed, 19 Oct 2022 10:26:24 +0200 Message-Id: <20221019083303.127004220@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106311837988508?= X-GMAIL-MSGID: =?utf-8?q?1747106311837988508?= From: Baochen Qiang [ Upstream commit b7b6f86149a7e06269d61a7a5206360f5b642f80 ] In current code STA_KEEPALIVE_ARP_RESPONSE TLV header is included only when ARP method is used, this causes firmware always to crash when wowlan is enabled because firmware needs it to be present no matter ARP method is used or not. Fix this issue by including STA_KEEPALIVE_ARP_RESPONSE TLV header by default. Also fix below typo: s/WMI_TAG_STA_KEEPALVE_ARP_RESPONSE/WMI_TAG_STA_KEEPALIVE_ARP_RESPONSE/ Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3 Fixes: 0f84a156aa3b ("ath11k: Handle keepalive during WoWLAN suspend and resume") Signed-off-by: Baochen Qiang Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220913044358.2037-1-quic_bqiang@quicinc.com Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath11k/wmi.c | 9 +++++---- drivers/net/wireless/ath/ath11k/wmi.h | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c index 88ee4f9d19da..b658ea60dcf7 100644 --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c @@ -8962,12 +8962,13 @@ int ath11k_wmi_sta_keepalive(struct ath11k *ar, cmd->interval = arg->interval; cmd->method = arg->method; + arp = (struct wmi_sta_keepalive_arp_resp *)(cmd + 1); + arp->tlv_header = FIELD_PREP(WMI_TLV_TAG, + WMI_TAG_STA_KEEPALIVE_ARP_RESPONSE) | + FIELD_PREP(WMI_TLV_LEN, sizeof(*arp) - TLV_HDR_SIZE); + if (arg->method == WMI_STA_KEEPALIVE_METHOD_UNSOLICITED_ARP_RESPONSE || arg->method == WMI_STA_KEEPALIVE_METHOD_GRATUITOUS_ARP_REQUEST) { - arp = (struct wmi_sta_keepalive_arp_resp *)(cmd + 1); - arp->tlv_header = FIELD_PREP(WMI_TLV_TAG, - WMI_TAG_STA_KEEPALVE_ARP_RESPONSE) | - FIELD_PREP(WMI_TLV_LEN, sizeof(*arp) - TLV_HDR_SIZE); arp->src_ip4_addr = arg->src_ip4_addr; arp->dest_ip4_addr = arg->dest_ip4_addr; ether_addr_copy(arp->dest_mac_addr.addr, arg->dest_mac_addr); diff --git a/drivers/net/wireless/ath/ath11k/wmi.h b/drivers/net/wireless/ath/ath11k/wmi.h index 4da248ffa318..ba5343a3411f 100644 --- a/drivers/net/wireless/ath/ath11k/wmi.h +++ b/drivers/net/wireless/ath/ath11k/wmi.h @@ -1214,7 +1214,7 @@ enum wmi_tlv_tag { WMI_TAG_NS_OFFLOAD_TUPLE, WMI_TAG_FTM_INTG_CMD, WMI_TAG_STA_KEEPALIVE_CMD, - WMI_TAG_STA_KEEPALVE_ARP_RESPONSE, + WMI_TAG_STA_KEEPALIVE_ARP_RESPONSE, WMI_TAG_P2P_SET_VENDOR_IE_DATA_CMD, WMI_TAG_AP_PS_PEER_CMD, WMI_TAG_PEER_RATE_RETRY_SCHED_CMD, From patchwork Wed Oct 19 08:26: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: 5142 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp252885wrs; Wed, 19 Oct 2022 03:55:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6ag1WqeShijfA4jg14OJcSpCRoKk35NCQjqbs53CMG0q+yCQu1sFG+3DYiBEWlHHEo2xZg X-Received: by 2002:a05:6402:b3c:b0:458:f680:6ab8 with SMTP id bo28-20020a0564020b3c00b00458f6806ab8mr7064667edb.267.1666176958354; Wed, 19 Oct 2022 03:55:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176958; cv=none; d=google.com; s=arc-20160816; b=MJNiPWukyCpGbEsxnr+Es3a7QvFxmE1zfMzUNRAr+c+DS5jp05ky3fPAOf0ra7yWWy FqjluFn+0c42QtOv8mqUyX4KFa1lh+f3SIYsc7eQCfmaBLAxSHO3Uy4062Pk9A4DBN4l /fpodgOWXtMLYtSU/RfrW0KnmT/qFDoIL4U6EwItruwB7OAXzrFE9KcEBcBB6dmUk8aH 01/hCRaLLUobRjnXmDrTcwoiIeFtQG4mdbT4R0+xlVKOScKRTg2Kl2Pt/aR9AG41hzpk t5lF3SOZdkkgui2zbQ6ak9QMSURAq8mozAHzDVu8DuQy6znXYHJ9BK8ix86902Gtz3i4 sN1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=iDZxBpHEMuWW/IHcoGPFen8vKYrYIQgt1kpP0dt7gdk=; b=qbzRn6nwTqQgF6RI1EG2LxmF3ZH0VIwvrmZQkqJgXwAKF0sx3cieSpuLb4DihUZeVD q/y/y8bPxb20ofmEgD03mYUeuhBuYnyT0k/zoahMUZjJU83VhE3GrA0hlZa0HW9q0gXW 2HuqPWPfcjUz9LpKxekab3yRL62nViydIwTWrecrG8r3UEeRiOI63oYB/iiFCM2lqn6g obKRrklQI/GBVRNTgzGImE+Pcy6erQn591Du4Ta8j3swGpnJ0v+qt9shEBzVnVdfLXyF 6TaRUI2/aTsTpTczuzGEXYYzxYybYZfZpoP75twJtRI99C4ljCc/DEiyWqba8CPSE2rM ImvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1Mb57gMi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ko1-20020a170907986100b00782a5657512si13017033ejc.416.2022.10.19.03.55.31; Wed, 19 Oct 2022 03:55: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=1Mb57gMi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234615AbiJSKwz (ORCPT + 99 others); Wed, 19 Oct 2022 06:52:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234550AbiJSKw2 (ORCPT ); Wed, 19 Oct 2022 06:52:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAFAC15DB36; Wed, 19 Oct 2022 03:23: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 B3F66B82390; Wed, 19 Oct 2022 08:51:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2DF16C433D6; Wed, 19 Oct 2022 08:51:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169498; bh=7h9aWcGCfgx2rKr3+DGUU7gZV0M1EwXuVeR7W2iK1KQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1Mb57gMi8Zzw+vx0lh0NZZ1XWGIowbwIVVwpLD8EQYaZMjke31LhZ8ntiNMtI5D9+ fEn1tf5E72VzLjNq6rtGIXKYHyPvQgFhp4EAsYXfn43SG+zTt05e6zGI8I41B5fZn0 gmgH/lT8KzNE5XZ4BZKzvQamthMI7M9tgZDfgeiE= 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 6.0 298/862] Bluetooth: hci_{ldisc,serdev}: check percpu_init_rwsem() failure Date: Wed, 19 Oct 2022 10:26:25 +0200 Message-Id: <20221019083303.176643973@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747113170376673085?= X-GMAIL-MSGID: =?utf-8?q?1747113170376673085?= From: Tetsuo Handa [ Upstream commit 3124d320c22f3f4388d9ac5c8f37eaad0cefd6b1 ] syzbot is reporting NULL pointer dereference at hci_uart_tty_close() [1], for rcu_sync_enter() is called without rcu_sync_init() due to hci_uart_tty_open() ignoring percpu_init_rwsem() failure. While we are at it, fix that hci_uart_register_device() ignores percpu_init_rwsem() failure and hci_uart_unregister_device() does not call percpu_free_rwsem(). Link: https://syzkaller.appspot.com/bug?extid=576dfca25381fb6fbc5f [1] Reported-by: syzbot Signed-off-by: Tetsuo Handa Fixes: 67d2f8781b9f00d1 ("Bluetooth: hci_ldisc: Allow sleeping while proto locks are held.") Fixes: d73e172816652772 ("Bluetooth: hci_serdev: Init hci_uart proto_lock to avoid oops") Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin --- drivers/bluetooth/hci_ldisc.c | 7 +++++-- drivers/bluetooth/hci_serdev.c | 10 +++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c index f537673ede17..865112e96ff9 100644 --- a/drivers/bluetooth/hci_ldisc.c +++ b/drivers/bluetooth/hci_ldisc.c @@ -493,6 +493,11 @@ static int hci_uart_tty_open(struct tty_struct *tty) BT_ERR("Can't allocate control structure"); return -ENFILE; } + if (percpu_init_rwsem(&hu->proto_lock)) { + BT_ERR("Can't allocate semaphore structure"); + kfree(hu); + return -ENOMEM; + } tty->disc_data = hu; hu->tty = tty; @@ -505,8 +510,6 @@ static int hci_uart_tty_open(struct tty_struct *tty) INIT_WORK(&hu->init_ready, hci_uart_init_work); INIT_WORK(&hu->write_work, hci_uart_write_work); - percpu_init_rwsem(&hu->proto_lock); - /* Flush any pending characters in the driver */ tty_driver_flush_buffer(tty); diff --git a/drivers/bluetooth/hci_serdev.c b/drivers/bluetooth/hci_serdev.c index c0e5f42ec6b7..f16fd79bc02b 100644 --- a/drivers/bluetooth/hci_serdev.c +++ b/drivers/bluetooth/hci_serdev.c @@ -310,11 +310,12 @@ int hci_uart_register_device(struct hci_uart *hu, serdev_device_set_client_ops(hu->serdev, &hci_serdev_client_ops); + if (percpu_init_rwsem(&hu->proto_lock)) + return -ENOMEM; + err = serdev_device_open(hu->serdev); if (err) - return err; - - percpu_init_rwsem(&hu->proto_lock); + goto err_rwsem; err = p->open(hu); if (err) @@ -389,6 +390,8 @@ int hci_uart_register_device(struct hci_uart *hu, p->close(hu); err_open: serdev_device_close(hu->serdev); +err_rwsem: + percpu_free_rwsem(&hu->proto_lock); return err; } EXPORT_SYMBOL_GPL(hci_uart_register_device); @@ -410,5 +413,6 @@ void hci_uart_unregister_device(struct hci_uart *hu) clear_bit(HCI_UART_PROTO_READY, &hu->flags); serdev_device_close(hu->serdev); } + percpu_free_rwsem(&hu->proto_lock); } EXPORT_SYMBOL_GPL(hci_uart_unregister_device); From patchwork Wed Oct 19 08:26: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: 4997 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp228609wrs; Wed, 19 Oct 2022 02:52:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM45T+Ag2x8mp3UtpgZQwUbmmXeXZSaC8CjyckGYV7YSRWrdrPjhhuxZ/S5whapoHnI1UsO9 X-Received: by 2002:a17:907:2c5b:b0:78d:3f8a:19d0 with SMTP id hf27-20020a1709072c5b00b0078d3f8a19d0mr5875096ejc.369.1666173168416; Wed, 19 Oct 2022 02:52:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666173168; cv=none; d=google.com; s=arc-20160816; b=XK6ZBrs8pnbT2X7Lrepqj2NJfVG6b2yXll/TBFyQoPtvHPNRrmndtdnsuiaALMDNie sHBhGUzfRl+n9XXFKgPqTB51dR8P1pQQJ/bS9INA5qEkabqNhCtRFkYI7gQfIjFYHp8X u1kWsk2V63T9bH8JmoZzQMO0WQvp+pqEJmHqSyHqsldJbEAhY/qlG5woSnY7mb9XMASk m0IVZQsZWl6dtMMIK/GTQ+6h5NDzHUJyD+M0H9kcdRVqbvMEQxDEQs7Eul/fRZb8qGqF WriYjE5dBTPSU7tofUxIpAqeFa8ahOh6ntCvjR3P2+8Y62KyQi2k6tKnGtTQsqdJQxaa racA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xISEV4Ml7kzp84rB1YFcw2AxqkOcBi+tuDbY9WzCrbM=; b=ZJnPnA6Vaj3JO30JIgI98oST9aK7pldEImm6Zk8hO+IY88iueSm6PF8YpuKZtZUywa N6xFvq1Eoxebyb481tvKkexYvr2D1Vik+mUpV2PKvTK56EBLNlDYHkdITDLEpc0OR738 YrDAuqrcQ7R+lSQXXHqjBJHis7L+ZLWRjI0h8izIRcBPZcWkfFsROq2h9P/jdtmv1Mi4 Gu49xq6xeVLfEVpEI2v/xZDmE0Lh6aIQJwFl7zFhulEcBktF+IU5j7/kIkeKoyrv9war NLfxmW/xJdJEuhKBeKMD2uh9QcvQLPYvCsvSdOpE2P6L8e8xfJ6ix/olZ1Lpk4dbmVvh U++g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="PJjeyq/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 go37-20020a1709070da500b0078df79d698dsi14295501ejc.810.2022.10.19.02.52.23; Wed, 19 Oct 2022 02:52: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="PJjeyq/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 S234310AbiJSJpg (ORCPT + 99 others); Wed, 19 Oct 2022 05:45:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234868AbiJSJlp (ORCPT ); Wed, 19 Oct 2022 05:41:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB553559D; Wed, 19 Oct 2022 02:18:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AF06561873; Wed, 19 Oct 2022 08:51:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C2E0CC433C1; Wed, 19 Oct 2022 08:51:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169501; bh=JG8aswyTxj+PG1imCI7E1yc8Njj0+tfR7kirz+dwzUg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PJjeyq/PLW6FJSe0u7ezCfDhdt1eAkZSXCVsA8WbyhneaASXZ6nxy3+EqdFlCMwKI ztdIb3Om5+tNmrwRvgFEgQuLtdTW/hac8PurlDBKZYWjj+4VvFCz9BlotQDe8CQrZE eIZyWTFY00BUJQUpBc/mObxhQ04XVRLhKz8a46tY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xin Liu , Weibin Kong , Andrii Nakryiko , Sasha Levin Subject: [PATCH 6.0 299/862] libbpf: Fix NULL pointer exception in API btf_dump__dump_type_data Date: Wed, 19 Oct 2022 10:26:26 +0200 Message-Id: <20221019083303.226230896@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747109196420776303?= X-GMAIL-MSGID: =?utf-8?q?1747109196420776303?= From: Xin Liu [ Upstream commit 7620bffbf72cd66a5d18e444a143b5b5989efa87 ] We found that function btf_dump__dump_type_data can be called by the user as an API, but in this function, the `opts` parameter may be used as a null pointer.This causes `opts->indent_str` to trigger a NULL pointer exception. Fixes: 2ce8450ef5a3 ("libbpf: add bpf_object__open_{file, mem} w/ extensible opts") Signed-off-by: Xin Liu Signed-off-by: Weibin Kong Signed-off-by: Andrii Nakryiko Link: https://lore.kernel.org/bpf/20220917084809.30770-1-liuxin350@huawei.com Signed-off-by: Sasha Levin --- tools/lib/bpf/btf_dump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/lib/bpf/btf_dump.c b/tools/lib/bpf/btf_dump.c index 627edb5bb6de..4221f73a74d0 100644 --- a/tools/lib/bpf/btf_dump.c +++ b/tools/lib/bpf/btf_dump.c @@ -2385,7 +2385,7 @@ int btf_dump__dump_type_data(struct btf_dump *d, __u32 id, d->typed_dump->indent_lvl = OPTS_GET(opts, indent_level, 0); /* default indent string is a tab */ - if (!opts->indent_str) + if (!OPTS_GET(opts, indent_str, NULL)) d->typed_dump->indent_str[0] = '\t'; else libbpf_strlcpy(d->typed_dump->indent_str, opts->indent_str, From patchwork Wed Oct 19 08:26: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: 5321 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp285362wrs; Wed, 19 Oct 2022 05:07:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4mMv/F2Eole6bRgn+nE+0ChXyb/b2uvwM3RGguZYobJRO9DPU9x8tsMFJUvkWVHCN+7Ubk X-Received: by 2002:a17:902:ce12:b0:17a:3e76:8568 with SMTP id k18-20020a170902ce1200b0017a3e768568mr8163843plg.11.1666181259301; Wed, 19 Oct 2022 05:07:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666181259; cv=none; d=google.com; s=arc-20160816; b=UmXVAvPILnKiubhwW/DGPk8AFcvG8QFazAVXSuqR+MUx6au2kKSuXDc9sy0o3IQ51Z rEHQ5rns+vDtaoMXWJwuoSR8oelnkI8MImF9mDhFrM2+PW5dKLRpdECvrma6bpVIWM3T qY0uwFjxx2L3Ad7D1IAWTkC27wK2tjXXUr4id53jaTMi1VdINxt50HSWBzU0bPiw2UHs gZir+7tGqtnalUkGSOlhsQJjIkkObK3zRuI80J83ynuDt9KIs9DWFdes4aNcfD92rEIv jgHw0Cxz749LztRd/hmQxb2321pa+tpsQ0WFQ9RznVJnQlUmO5XfC5lVZHjbwiBTVFmO x+Nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NkOKFAJiDB6uYWzHec69OUhGH8hkhygDRKflYb3jGDg=; b=HCMLxRysiCfM/BJZkuJPaBbSvSNxXJOGmef68nghphWKeAL8ZMJvUmun4ahuCd+V7z zIEGromyCwyyY6ghYfh62e9PDwiBrf8fdxjEpVfGMXJCuxGjyrSs5dn3Gah4okZxDpEK LjPPN5+fXctK80zk4GY6ViSp5spCnNN9guUcxvqdiResy3/VmX4Do1+t9xme8A3N0J05 xhY/udkxDk1eSm/KVd456/xf2MG8di14jN8FfPBxuBlfXZ7hEwipIeWzHLgtE8RI7geS N/so6a9hkstIIVeqNUfImHWO1w5BhHDWETHw4eXizlGoD4OSydZZBYBT+mMMCRhpMEjB qrtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ggoYda00; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x17-20020a656ab1000000b004347b49d045si19304117pgu.631.2022.10.19.05.07.21; Wed, 19 Oct 2022 05:07: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=ggoYda00; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232027AbiJSMEz (ORCPT + 99 others); Wed, 19 Oct 2022 08:04:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229687AbiJSMDf (ORCPT ); Wed, 19 Oct 2022 08:03:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53AD550199; Wed, 19 Oct 2022 04:39: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 ams.source.kernel.org (Postfix) with ESMTPS id 38CDEB82391; Wed, 19 Oct 2022 08:51:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70733C433C1; Wed, 19 Oct 2022 08:51:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169503; bh=nUoYxlS4P3sUkSZzW3n7UycxsTcJ6Of6LllWPr/hLhI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ggoYda00wrGE0upzqdwYOJUwwCgthxXevOOu+DTPXEOOrWCpyDocYi0L+MDsVpshT kf4/9NCWIVdbHtBHyeslsheGRboo89CC4FRHW/qPWuiByc1g3mk7PnkJICV18SynsW UYeiBaLB9JL1c9TG6CJRJEz/azAdA8IoQY4+8k1U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Westphal , Antoine Tenart , Sasha Levin Subject: [PATCH 6.0 300/862] netfilter: conntrack: fix the gc rescheduling delay Date: Wed, 19 Oct 2022 10:26:27 +0200 Message-Id: <20221019083303.262065457@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747117680450906870?= X-GMAIL-MSGID: =?utf-8?q?1747117680450906870?= From: Antoine Tenart [ Upstream commit 95eabdd207024312876d0ebed90b4c977e050e85 ] Commit 2cfadb761d3d ("netfilter: conntrack: revisit gc autotuning") changed the eviction rescheduling to the use average expiry of scanned entries (within 1-60s) by doing: for (...) { expires = clamp(nf_ct_expires(tmp), ...); next_run += expires; next_run /= 2; } The issue is the above will make the average ('next_run' here) more dependent on the last expiration values than the firsts (for sets > 2). Depending on the expiration values used to compute the average, the result can be quite different than what's expected. To fix this we can do the following: for (...) { expires = clamp(nf_ct_expires(tmp), ...); next_run += (expires - next_run) / ++count; } Fixes: 2cfadb761d3d ("netfilter: conntrack: revisit gc autotuning") Cc: Florian Westphal Signed-off-by: Antoine Tenart Signed-off-by: Florian Westphal Signed-off-by: Sasha Levin --- net/netfilter/nf_conntrack_core.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index 1357a2729a4b..2e6d5f1e6d63 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c @@ -67,6 +67,7 @@ struct conntrack_gc_work { struct delayed_work dwork; u32 next_bucket; u32 avg_timeout; + u32 count; u32 start_time; bool exiting; bool early_drop; @@ -1466,6 +1467,7 @@ static void gc_worker(struct work_struct *work) unsigned int expired_count = 0; unsigned long next_run; s32 delta_time; + long count; gc_work = container_of(work, struct conntrack_gc_work, dwork.work); @@ -1475,10 +1477,12 @@ static void gc_worker(struct work_struct *work) if (i == 0) { gc_work->avg_timeout = GC_SCAN_INTERVAL_INIT; + gc_work->count = 1; gc_work->start_time = start_time; } next_run = gc_work->avg_timeout; + count = gc_work->count; end_time = start_time + GC_SCAN_MAX_DURATION; @@ -1498,8 +1502,8 @@ static void gc_worker(struct work_struct *work) hlist_nulls_for_each_entry_rcu(h, n, &ct_hash[i], hnnode) { struct nf_conntrack_net *cnet; - unsigned long expires; struct net *net; + long expires; tmp = nf_ct_tuplehash_to_ctrack(h); @@ -1513,6 +1517,7 @@ static void gc_worker(struct work_struct *work) gc_work->next_bucket = i; gc_work->avg_timeout = next_run; + gc_work->count = count; delta_time = nfct_time_stamp - gc_work->start_time; @@ -1528,8 +1533,8 @@ static void gc_worker(struct work_struct *work) } expires = clamp(nf_ct_expires(tmp), GC_SCAN_INTERVAL_MIN, GC_SCAN_INTERVAL_CLAMP); + expires = (expires - (long)next_run) / ++count; next_run += expires; - next_run /= 2u; if (nf_conntrack_max95 == 0 || gc_worker_skip_ct(tmp)) continue; @@ -1570,6 +1575,7 @@ static void gc_worker(struct work_struct *work) delta_time = nfct_time_stamp - end_time; if (delta_time > 0 && i < hashsz) { gc_work->avg_timeout = next_run; + gc_work->count = count; gc_work->next_bucket = i; next_run = 0; goto early_exit; From patchwork Wed Oct 19 08:26: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: 4682 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212955wrs; Wed, 19 Oct 2022 02:08:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4oM6Ma7BcVC9WyKGk1xT9p4i/ENrX25r477VKIAlcG3jvU86w+Au1sevxhOFYzaDnf9qci X-Received: by 2002:a17:907:1608:b0:78e:1e21:6359 with SMTP id hb8-20020a170907160800b0078e1e216359mr6019230ejc.205.1666170527208; Wed, 19 Oct 2022 02:08:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170527; cv=none; d=google.com; s=arc-20160816; b=LoJv8bDJtacQro1+PhdkWglsx73yvSJSv/SiJqAYVdqX+7QfshQsGSaU0eDBSI6wQZ E2RNcJkq1CrdjSr6kbRrw4r5Kq6OB/QySOaSjCS/k5lWH7Tj3FPmNHlUg/2znAWu18s/ GqEXFtCXET5MHHUX1wJFNeyFkAt//KfZVTVqMjFCcMCDeyU8s8rYMy80RXVe6EVwb3oE Uq71+z8e8dESkgZw67qilgvpuqm7Y5R65K2oLcqI9UF9OyMGtyjZE++6dTIAan0Nd8+Z HDLG9O2VywbhWu/dUZUkmy75V8r7JJ27h5ezQhwodQJnw+PxuUup5dBrG0zMsJFVr1tt LLFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Aek2K1xDgbBqfusdY1vSbvzwGgMJbQPVLV54V1rGFQM=; b=mb3p7Z/ir/HvF1d4SYLjRm3Np2VfEB9edIOhlSWJ1Zg8UnljWdjzo/9/TA4pEKFT0W 3UmnqdYGvtz5ZomOtv2LpLXhCKuICrlOB7scDxOgGTAmHuObhdOqj4c4z3rSWHfpOSw1 gj+weSgLe1OxCEJYtj56ihh86LXXmjNO+yvXr/wSg8FX40FMLoOcI+EJx6hECeBhfI/l 8w/HggkElNZdhC8ELdafwz5rWJezX85l0u/QW/k68oEnUb+Hn8KN6100jKS2xtBH7AGh BGNDHVl9pRvIVFtD9rzDq4f/yI8Ny5KXF2WYXJKRAj0Ctvm8U/uVL4WJOO3D4XKR9HQM /q/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2QEqDLnK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lv10-20020a170906bc8a00b00775326fb2ebsi12271254ejb.665.2022.10.19.02.08.13; Wed, 19 Oct 2022 02:08: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=2QEqDLnK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232300AbiJSJDO (ORCPT + 99 others); Wed, 19 Oct 2022 05:03:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232089AbiJSJCT (ORCPT ); Wed, 19 Oct 2022 05:02:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12A0163F16; Wed, 19 Oct 2022 01:56: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 134766182C; Wed, 19 Oct 2022 08:51:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1DF6AC43470; Wed, 19 Oct 2022 08:51:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169506; bh=ctfW1jwWyZwvrZn7RrkuwyfiafKfZcdHmUmoCiCw6cA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2QEqDLnKD2pj8N1cIuuKPnct5bGZNQhuOFRZdLg5MQJ025whklPMHVoDmPJZ5Kq6i 7USfRVD0s3TYzafJW56jbtZ+xpH6onz8kwyKVlNmsxUzAC1YaRsxWhNNz/HxbbH4Wm m0ir77HUUrOO5aBU8Lpmh9JP0At3WJJejW8rBzgM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Westphal , Antoine Tenart , Sasha Levin Subject: [PATCH 6.0 301/862] netfilter: conntrack: revisit the gc initial rescheduling bias Date: Wed, 19 Oct 2022 10:26:28 +0200 Message-Id: <20221019083303.305878707@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106426567728162?= X-GMAIL-MSGID: =?utf-8?q?1747106426567728162?= From: Antoine Tenart [ Upstream commit 2aa192757005f130b2dd3547dda6e462e761199f ] The previous commit changed the way the rescheduling delay is computed which has a side effect: the bias is now represented as much as the other entries in the rescheduling delay which makes the logic to kick in only with very large sets, as the initial interval is very large (INT_MAX). Revisit the GC initial bias to allow more frequent GC for smaller sets while still avoiding wakeups when a machine is mostly idle. We're moving from a large initial value to pretending we have 100 entries expiring at the upper bound. This way only a few entries having a small timeout won't impact much the rescheduling delay and non-idle machines will have enough entries to lower the delay when needed. This also improves readability as the initial bias is now linked to what is computed instead of being an arbitrary large value. Fixes: 2cfadb761d3d ("netfilter: conntrack: revisit gc autotuning") Suggested-by: Florian Westphal Signed-off-by: Antoine Tenart Signed-off-by: Florian Westphal Signed-off-by: Sasha Levin --- net/netfilter/nf_conntrack_core.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index 2e6d5f1e6d63..8f261cd5b3a5 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c @@ -86,10 +86,12 @@ static DEFINE_MUTEX(nf_conntrack_mutex); /* clamp timeouts to this value (TCP unacked) */ #define GC_SCAN_INTERVAL_CLAMP (300ul * HZ) -/* large initial bias so that we don't scan often just because we have - * three entries with a 1s timeout. +/* Initial bias pretending we have 100 entries at the upper bound so we don't + * wakeup often just because we have three entries with a 1s timeout while still + * allowing non-idle machines to wakeup more often when needed. */ -#define GC_SCAN_INTERVAL_INIT INT_MAX +#define GC_SCAN_INITIAL_COUNT 100 +#define GC_SCAN_INTERVAL_INIT GC_SCAN_INTERVAL_MAX #define GC_SCAN_MAX_DURATION msecs_to_jiffies(10) #define GC_SCAN_EXPIRED_MAX (64000u / HZ) @@ -1477,7 +1479,7 @@ static void gc_worker(struct work_struct *work) if (i == 0) { gc_work->avg_timeout = GC_SCAN_INTERVAL_INIT; - gc_work->count = 1; + gc_work->count = GC_SCAN_INITIAL_COUNT; gc_work->start_time = start_time; } From patchwork Wed Oct 19 08:26: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: 5084 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp249478wrs; Wed, 19 Oct 2022 03:46:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7EgG3mymgb0KM1x1u5MrZcGRWIExyQSRuYwDAP4215BHKKeYz3KwGeBuGKbDIr1Z/elerh X-Received: by 2002:a63:513:0:b0:462:f15e:5efc with SMTP id 19-20020a630513000000b00462f15e5efcmr6880540pgf.113.1666176378659; Wed, 19 Oct 2022 03:46:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176378; cv=none; d=google.com; s=arc-20160816; b=hY3Grf4Et+rpDfYiTF1canIejTSZx1QygG6LV++QRV3Y/zEL/2ykG+EYKz52QiPudJ ElrNqQ8XkoQWd3nQ96vhZR/v1T82bKgGuEEBmT28lt1eyp1yPBGf9H03nRvgxCckYNQq AkUtqFV01kR/Z7/i3h2hXmmMqTcwTPcoZJzwd7OcAsQ4qvIq50SkHQ5tfnOhx530p8OA guxTmfQvXanZnm12CFl03mROV4d2W2rdMhP+4VU7xgMEBJ8Ca5dgGRyEqC6LmhtaRzqR DHoxSBbaJZHFjWWpq7aIV9azlSiTiNSlDEiwg7+GRuKTNuqHqrdv/g9+jHhsbc9I9m2Q JvbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=j1Uv2Fbp6yWXslSYzEZm2lSdac3T2G96ivic6eH743c=; b=t54yGQTbCz8MmjqbYzyJ/gcsfxHynu/LgC2yxkdJZnIewIIjYCx/WLqnRy1jYx1TAW u5+oHCzKg8cjBuWDNyNwpL6Y77iA+Jfn3yYj7UF+UP07deVEJ4MFpqT0+4xmC8bZT0qN yWjLnaAvtUSYVIQybjaRgwfPZRCfAXplt8BJM9e0HmTHH2l/ELBmNO7DKPc7b1Y6tQEZ Jh4uNfb2QxEsV6DxIGRdQDwjS0Oz8OhQDwZ2YbhvaRk7PamUggdH006/dn5gd9boyF7E KtKQOhEpffJCsHMlVoRbi1JicIZLtnJ8xEySaWnqZ1L4OVQERS1EP7YEvvcKzdP/2faZ dOwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ckLRt+Rg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a056a0022d400b0052f60f7e0bcsi19835214pfj.346.2022.10.19.03.46.04; Wed, 19 Oct 2022 03:46:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ckLRt+Rg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232757AbiJSKps (ORCPT + 99 others); Wed, 19 Oct 2022 06:45:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232792AbiJSKoH (ORCPT ); Wed, 19 Oct 2022 06:44: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 8ED3F9411F; Wed, 19 Oct 2022 03:20: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 21B12B823B8; Wed, 19 Oct 2022 08:53:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77DEDC433C1; Wed, 19 Oct 2022 08:53:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169621; bh=A/aO55xe4WmqYijgeMiod1WeF6BH4BkxrGnVD4eeRn8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ckLRt+RgrNYpZGkQiOVFDUISVJJzZtKvFNdNcCubbQemJmgsnngGVW+CXQqP4t2BI ukyNZ2kcvhiOIjrRs0TVJYBJRaKW6mCvvoxPIacgMfJHO0fEwfqF35QvI2b4Z+c40q n8gxx3+TDsahGV9cea9jRCCudBsOIomUMpZm/3yU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pu Lehui , Martin KaFai Lau , Sasha Levin Subject: [PATCH 6.0 302/862] bpf, cgroup: Reject prog_attach_flags array when effective query Date: Wed, 19 Oct 2022 10:26:29 +0200 Message-Id: <20221019083303.339950744@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112562538514799?= X-GMAIL-MSGID: =?utf-8?q?1747112562538514799?= From: Pu Lehui [ Upstream commit 0e426a3ae030a9e891899370229e117158b35de6 ] Attach flags is only valid for attached progs of this layer cgroup, but not for effective progs. For querying with EFFECTIVE flags, exporting attach flags does not make sense. So when effective query, we reject prog_attach_flags array and don't need to populate it. Also we limit attach_flags to output 0 during effective query. Fixes: b79c9fc9551b ("bpf: implement BPF_PROG_QUERY for BPF_LSM_CGROUP") Signed-off-by: Pu Lehui Link: https://lore.kernel.org/r/20220921104604.2340580-2-pulehui@huaweicloud.com Signed-off-by: Martin KaFai Lau Signed-off-by: Sasha Levin --- include/uapi/linux/bpf.h | 7 +++++-- kernel/bpf/cgroup.c | 28 ++++++++++++++++++---------- tools/include/uapi/linux/bpf.h | 7 +++++-- 3 files changed, 28 insertions(+), 14 deletions(-) diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h index 59a217ca2dfd..4eff7fc7ae58 100644 --- a/include/uapi/linux/bpf.h +++ b/include/uapi/linux/bpf.h @@ -1233,7 +1233,7 @@ enum { /* Query effective (directly attached + inherited from ancestor cgroups) * programs that will be executed for events within a cgroup. - * attach_flags with this flag are returned only for directly attached programs. + * attach_flags with this flag are always returned 0. */ #define BPF_F_QUERY_EFFECTIVE (1U << 0) @@ -1432,7 +1432,10 @@ union bpf_attr { __u32 attach_flags; __aligned_u64 prog_ids; __u32 prog_cnt; - __aligned_u64 prog_attach_flags; /* output: per-program attach_flags */ + /* output: per-program attach_flags. + * not allowed to be set during effective query. + */ + __aligned_u64 prog_attach_flags; } query; struct { /* anonymous struct used by BPF_RAW_TRACEPOINT_OPEN command */ diff --git a/kernel/bpf/cgroup.c b/kernel/bpf/cgroup.c index 4a400cd63731..22888aaa68b6 100644 --- a/kernel/bpf/cgroup.c +++ b/kernel/bpf/cgroup.c @@ -1020,6 +1020,7 @@ static int __cgroup_bpf_query(struct cgroup *cgrp, const union bpf_attr *attr, union bpf_attr __user *uattr) { __u32 __user *prog_attach_flags = u64_to_user_ptr(attr->query.prog_attach_flags); + bool effective_query = attr->query.query_flags & BPF_F_QUERY_EFFECTIVE; __u32 __user *prog_ids = u64_to_user_ptr(attr->query.prog_ids); enum bpf_attach_type type = attr->query.attach_type; enum cgroup_bpf_attach_type from_atype, to_atype; @@ -1029,8 +1030,12 @@ static int __cgroup_bpf_query(struct cgroup *cgrp, const union bpf_attr *attr, int total_cnt = 0; u32 flags; + if (effective_query && prog_attach_flags) + return -EINVAL; + if (type == BPF_LSM_CGROUP) { - if (attr->query.prog_cnt && prog_ids && !prog_attach_flags) + if (!effective_query && attr->query.prog_cnt && + prog_ids && !prog_attach_flags) return -EINVAL; from_atype = CGROUP_LSM_START; @@ -1045,7 +1050,7 @@ static int __cgroup_bpf_query(struct cgroup *cgrp, const union bpf_attr *attr, } for (atype = from_atype; atype <= to_atype; atype++) { - if (attr->query.query_flags & BPF_F_QUERY_EFFECTIVE) { + if (effective_query) { effective = rcu_dereference_protected(cgrp->bpf.effective[atype], lockdep_is_held(&cgroup_mutex)); total_cnt += bpf_prog_array_length(effective); @@ -1054,6 +1059,8 @@ static int __cgroup_bpf_query(struct cgroup *cgrp, const union bpf_attr *attr, } } + /* always output uattr->query.attach_flags as 0 during effective query */ + flags = effective_query ? 0 : flags; if (copy_to_user(&uattr->query.attach_flags, &flags, sizeof(flags))) return -EFAULT; if (copy_to_user(&uattr->query.prog_cnt, &total_cnt, sizeof(total_cnt))) @@ -1068,7 +1075,7 @@ static int __cgroup_bpf_query(struct cgroup *cgrp, const union bpf_attr *attr, } for (atype = from_atype; atype <= to_atype && total_cnt; atype++) { - if (attr->query.query_flags & BPF_F_QUERY_EFFECTIVE) { + if (effective_query) { effective = rcu_dereference_protected(cgrp->bpf.effective[atype], lockdep_is_held(&cgroup_mutex)); cnt = min_t(int, bpf_prog_array_length(effective), total_cnt); @@ -1090,15 +1097,16 @@ static int __cgroup_bpf_query(struct cgroup *cgrp, const union bpf_attr *attr, if (++i == cnt) break; } - } - if (prog_attach_flags) { - flags = cgrp->bpf.flags[atype]; + if (prog_attach_flags) { + flags = cgrp->bpf.flags[atype]; - for (i = 0; i < cnt; i++) - if (copy_to_user(prog_attach_flags + i, &flags, sizeof(flags))) - return -EFAULT; - prog_attach_flags += cnt; + for (i = 0; i < cnt; i++) + if (copy_to_user(prog_attach_flags + i, + &flags, sizeof(flags))) + return -EFAULT; + prog_attach_flags += cnt; + } } prog_ids += cnt; diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h index 59a217ca2dfd..4eff7fc7ae58 100644 --- a/tools/include/uapi/linux/bpf.h +++ b/tools/include/uapi/linux/bpf.h @@ -1233,7 +1233,7 @@ enum { /* Query effective (directly attached + inherited from ancestor cgroups) * programs that will be executed for events within a cgroup. - * attach_flags with this flag are returned only for directly attached programs. + * attach_flags with this flag are always returned 0. */ #define BPF_F_QUERY_EFFECTIVE (1U << 0) @@ -1432,7 +1432,10 @@ union bpf_attr { __u32 attach_flags; __aligned_u64 prog_ids; __u32 prog_cnt; - __aligned_u64 prog_attach_flags; /* output: per-program attach_flags */ + /* output: per-program attach_flags. + * not allowed to be set during effective query. + */ + __aligned_u64 prog_attach_flags; } query; struct { /* anonymous struct used by BPF_RAW_TRACEPOINT_OPEN command */ From patchwork Wed Oct 19 08:26:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5070 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp249008wrs; Wed, 19 Oct 2022 03:45:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4BYQzleFX+7fZxBkFoRvEKvkqdp6TqrXt6SqCVckYO9ivZENjnzuC35qIr1Y1CMrozkR0A X-Received: by 2002:a17:90b:4c04:b0:20d:4ef6:aacc with SMTP id na4-20020a17090b4c0400b0020d4ef6aaccmr45310659pjb.199.1666176308764; Wed, 19 Oct 2022 03:45:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176308; cv=none; d=google.com; s=arc-20160816; b=HEbQDBrog0sdQd6KwsJXsHPDZYiymtKz+hD/vGMwWbxX0Sjy7t4YdQDYj/kk7PBgAm ySBwhtOaEcDD7eJSUzP2nucr9i8VWntpF4I6k0aeS+yn/ksJPBlHKFcFCjbxeK4UJBpx zQOrWKQROL53ITfPd+cEIWYjL6iF8xP58EsGrJ75xlYExrBEgzkh7lEoZrN1PaNpGCNX X5sF4CJvNGUOP7SsfUKeCHZNF1uuLwGzTQHmqhs/l6zR0+xyJaJv7hNdcqQYkQZa/INl HLb1JhiwFJkdltHwUiv1NFUfqMtY45lEeyKYwQ0DnuVlvJIz+cewVQQHNZcUlv5fMaYQ lvvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=edyoKFzh1w121UA/d3RLp+VfLdvFxFf5x/R5d3/NRDo=; b=a5pR7NH9JFtu8oXOSZ36lRPTytjv1X+zWBsOINVnLCt8mReB/uGLfh+87kj3KnY9+T yAjqIQBY02qH40X3OA2csXJKWB9jwaTDiphmEiCzZnp9PF4/z0S1CGIPOi7WMbO3cJzh xTahXkZiyrIkJZ4h/ElgDQcZ8gPUimVbBeJUbqXaInDG/0j17s3Mw1Ioxty7TQv2S8We rqmre92ZJSnnHoMN06Imm/1vzWrSf2sbF4ck8zdrIcxmRrIgKYZi8c0oj22Ys8AD79a8 GS92okAePS0jR+9VyWUYCJ1/bKZDrat+0ZGmUKf691F33WtaBKySVhIgNI7YbvFPD9KA cnjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sDiYYdXa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i7-20020a17090a65c700b00202c850b5a8si22841113pjs.11.2022.10.19.03.44.55; Wed, 19 Oct 2022 03:45: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=sDiYYdXa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232646AbiJSKnk (ORCPT + 99 others); Wed, 19 Oct 2022 06:43:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230493AbiJSKms (ORCPT ); Wed, 19 Oct 2022 06:42:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C45451119D8; Wed, 19 Oct 2022 03:20: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 C3EECB823AB; Wed, 19 Oct 2022 08:52:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E312C433D6; Wed, 19 Oct 2022 08:52:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169527; bh=c6jaiSw5Oz8WJHTSZ7ux3MCbsJtx19rEilrmCIVTGds=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sDiYYdXa6j2m978GyW7JnJhNhCvVxy7+rPji8h0Crj5B54qAqP+D1m0DL/NzbIaVR AvT9TRMDXwEuhcZNkT+70nn7B3ILCqtCH54HCCPUQboN/G36h2tMtgF9L84oTbUbtr a3eUCTjfqFFITRnM3wldoqnSXaBONtCAzDE1rq4s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pu Lehui , Martin KaFai Lau , Sasha Levin Subject: [PATCH 6.0 303/862] bpftool: Fix wrong cgroup attach flags being assigned to effective progs Date: Wed, 19 Oct 2022 10:26:30 +0200 Message-Id: <20221019083303.389799738@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112489116392130?= X-GMAIL-MSGID: =?utf-8?q?1747112489116392130?= From: Pu Lehui [ Upstream commit bdcee1b0b0834d031c76a12209840afe949b048a ] When root-cgroup attach multi progs and sub-cgroup attach a override prog, bpftool will display incorrectly for the attach flags of the sub-cgroup’s effective progs: $ bpftool cgroup tree /sys/fs/cgroup effective CgroupPath ID AttachType AttachFlags Name /sys/fs/cgroup 6 cgroup_sysctl multi sysctl_tcp_mem 13 cgroup_sysctl multi sysctl_tcp_mem /sys/fs/cgroup/cg1 20 cgroup_sysctl override sysctl_tcp_mem 6 cgroup_sysctl override sysctl_tcp_mem <- wrong 13 cgroup_sysctl override sysctl_tcp_mem <- wrong /sys/fs/cgroup/cg1/cg2 20 cgroup_sysctl sysctl_tcp_mem 6 cgroup_sysctl sysctl_tcp_mem 13 cgroup_sysctl sysctl_tcp_mem Attach flags is only valid for attached progs of this layer cgroup, but not for effective progs. For querying with EFFECTIVE flags, exporting attach flags does not make sense. So let's remove the AttachFlags field and the associated logic. After this patch, the above effective cgroup tree will show as bellow: $ bpftool cgroup tree /sys/fs/cgroup effective CgroupPath ID AttachType Name /sys/fs/cgroup 6 cgroup_sysctl sysctl_tcp_mem 13 cgroup_sysctl sysctl_tcp_mem /sys/fs/cgroup/cg1 20 cgroup_sysctl sysctl_tcp_mem 6 cgroup_sysctl sysctl_tcp_mem 13 cgroup_sysctl sysctl_tcp_mem /sys/fs/cgroup/cg1/cg2 20 cgroup_sysctl sysctl_tcp_mem 6 cgroup_sysctl sysctl_tcp_mem 13 cgroup_sysctl sysctl_tcp_mem Fixes: b79c9fc9551b ("bpf: implement BPF_PROG_QUERY for BPF_LSM_CGROUP") Fixes: a98bf57391a2 ("tools: bpftool: add support for reporting the effective cgroup progs") Signed-off-by: Pu Lehui Link: https://lore.kernel.org/r/20220921104604.2340580-3-pulehui@huaweicloud.com Signed-off-by: Martin KaFai Lau Signed-off-by: Sasha Levin --- tools/bpf/bpftool/cgroup.c | 54 ++++++++++++++++++++++++++++++++++---- 1 file changed, 49 insertions(+), 5 deletions(-) diff --git a/tools/bpf/bpftool/cgroup.c b/tools/bpf/bpftool/cgroup.c index cced668fb2a3..b46a998d8f8d 100644 --- a/tools/bpf/bpftool/cgroup.c +++ b/tools/bpf/bpftool/cgroup.c @@ -136,8 +136,8 @@ static int show_bpf_prog(int id, enum bpf_attach_type attach_type, jsonw_string_field(json_wtr, "attach_type", attach_type_str); else jsonw_uint_field(json_wtr, "attach_type", attach_type); - jsonw_string_field(json_wtr, "attach_flags", - attach_flags_str); + if (!(query_flags & BPF_F_QUERY_EFFECTIVE)) + jsonw_string_field(json_wtr, "attach_flags", attach_flags_str); jsonw_string_field(json_wtr, "name", prog_name); if (attach_btf_name) jsonw_string_field(json_wtr, "attach_btf_name", attach_btf_name); @@ -150,7 +150,10 @@ static int show_bpf_prog(int id, enum bpf_attach_type attach_type, printf("%-15s", attach_type_str); else printf("type %-10u", attach_type); - printf(" %-15s %-15s", attach_flags_str, prog_name); + if (query_flags & BPF_F_QUERY_EFFECTIVE) + printf(" %-15s", prog_name); + else + printf(" %-15s %-15s", attach_flags_str, prog_name); if (attach_btf_name) printf(" %-15s", attach_btf_name); else if (info.attach_btf_id) @@ -195,6 +198,32 @@ static int cgroup_has_attached_progs(int cgroup_fd) return no_prog ? 0 : 1; } + +static int show_effective_bpf_progs(int cgroup_fd, enum bpf_attach_type type, + int level) +{ + LIBBPF_OPTS(bpf_prog_query_opts, p); + __u32 prog_ids[1024] = {0}; + __u32 iter; + int ret; + + p.query_flags = query_flags; + p.prog_cnt = ARRAY_SIZE(prog_ids); + p.prog_ids = prog_ids; + + ret = bpf_prog_query_opts(cgroup_fd, type, &p); + if (ret) + return ret; + + if (p.prog_cnt == 0) + return 0; + + for (iter = 0; iter < p.prog_cnt; iter++) + show_bpf_prog(prog_ids[iter], type, NULL, level); + + return 0; +} + static int show_attached_bpf_progs(int cgroup_fd, enum bpf_attach_type type, int level) { @@ -245,6 +274,14 @@ static int show_attached_bpf_progs(int cgroup_fd, enum bpf_attach_type type, return 0; } +static int show_bpf_progs(int cgroup_fd, enum bpf_attach_type type, + int level) +{ + return query_flags & BPF_F_QUERY_EFFECTIVE ? + show_effective_bpf_progs(cgroup_fd, type, level) : + show_attached_bpf_progs(cgroup_fd, type, level); +} + static int do_show(int argc, char **argv) { enum bpf_attach_type type; @@ -292,6 +329,8 @@ static int do_show(int argc, char **argv) if (json_output) jsonw_start_array(json_wtr); + else if (query_flags & BPF_F_QUERY_EFFECTIVE) + printf("%-8s %-15s %-15s\n", "ID", "AttachType", "Name"); else printf("%-8s %-15s %-15s %-15s\n", "ID", "AttachType", "AttachFlags", "Name"); @@ -304,7 +343,7 @@ static int do_show(int argc, char **argv) * If we were able to get the show for at least one * attach type, let's return 0. */ - if (show_attached_bpf_progs(cgroup_fd, type, 0) == 0) + if (show_bpf_progs(cgroup_fd, type, 0) == 0) ret = 0; } @@ -362,7 +401,7 @@ static int do_show_tree_fn(const char *fpath, const struct stat *sb, btf_vmlinux = libbpf_find_kernel_btf(); for (type = 0; type < __MAX_BPF_ATTACH_TYPE; type++) - show_attached_bpf_progs(cgroup_fd, type, ftw->level); + show_bpf_progs(cgroup_fd, type, ftw->level); if (errno == EINVAL) /* Last attach type does not support query. @@ -436,6 +475,11 @@ static int do_show_tree(int argc, char **argv) if (json_output) jsonw_start_array(json_wtr); + else if (query_flags & BPF_F_QUERY_EFFECTIVE) + printf("%s\n" + "%-8s %-15s %-15s\n", + "CgroupPath", + "ID", "AttachType", "Name"); else printf("%s\n" "%-8s %-15s %-15s %-15s\n", From patchwork Wed Oct 19 08:26: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: 4664 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212703wrs; Wed, 19 Oct 2022 02:08:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4suoTEsuJxjzHqXeP8p8p5poRnqsoGyMx19o5C0ajaoWRVzKM/r2JjIr7ulV9Em9eGUzlA X-Received: by 2002:a05:6402:27d4:b0:45d:a69e:336d with SMTP id c20-20020a05640227d400b0045da69e336dmr6410811ede.298.1666170486702; Wed, 19 Oct 2022 02:08:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170486; cv=none; d=google.com; s=arc-20160816; b=1B/PLUntBjnGXjlPkn3pVZo69hUTSMM4dZL21JTOnkMktnaH3err9a8+VqDRQBieoE dQB/CSmxkCIsH8xqz8ac34dmGZETGXEKe/aBn1zRb0ocQnKQsEBY1nUW0jvye0LLIRDZ qQnH4cGEkieuVUibaeZTKwlfBjtJZp3lG5lbHXPsqt8BzrtVmZbY0Ukt70Mu30/ivZh6 ZYnEOawwa2HJZmBxRu/8LYYRTBRjTyGaLWE6Y7CzVhw/zGd6WMOfc/FWcp2QsC9dF4+x WBk4LyOtcjdKzOgWxqk5yLij+fif002f2MfGRuK2ElsMPfx+9wcKvn/tvWhV6qKYC4gP A2AA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=snKNt9eh/9zTFtoA6TDwy3aDGm4U0uJ3pXNL/5Vo4aE=; b=I+qnquVj500Xw21PrRtSTBAwcOW7Gw6et8XLutu7EkbiYVKXVj50yM5hzzZ8qznUWy 1FTY3w+2haLicuM/rgwf8ncyBuWjsoNodKxdcRn5GXUrA7SD1yR6mzbB8vsy0W/VOUIO /jylMm0viW4NZqC337odNFBk91jV958WYZ+jwrZ00Tzm91mX4e3PTTdi6OOkpdioktw2 yQCzVatWApfB/o6hJI7BfGzZ4oamAW7NQ8gAGulmn7tls1gs9CIPVaji4nfEPvvBPEGR qhLzoUjOjAzhtPxM8GIIKtOpa/Qv0oNOfU3IK66BJ6y8kmkc5QaG+cI6y3Y3jenkg4CE KNmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="TZ15T5a/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g12-20020a1709065d0c00b0077e9225816csi15154557ejt.837.2022.10.19.02.07.37; Wed, 19 Oct 2022 02:08: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="TZ15T5a/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230136AbiJSJBi (ORCPT + 99 others); Wed, 19 Oct 2022 05:01:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232223AbiJSI7S (ORCPT ); Wed, 19 Oct 2022 04:59:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A039CDFC0; Wed, 19 Oct 2022 01:54: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 6E279617E1; Wed, 19 Oct 2022 08:52:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7DC2EC433C1; Wed, 19 Oct 2022 08:52:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169557; bh=++xZ9cOrQDr9pnFr2qPK44wCfNxJfYGFxx6qpI+u2Lg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TZ15T5a/7g6kcEI7OygVObqOFcP+h56euIyFzMkkHDD2NIBUUopPfvCiPZREjGd1c d7jRqn5Fva6EOvNEfzUMwCshFSFeAbhzlqKvzub+EJ4xDas115+oOrB02hxWF4v10K MFfk+hrPE12yqRMdvUEf3OAm0H704wAnT09EyOJ4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pu Lehui , Martin KaFai Lau , Sasha Levin Subject: [PATCH 6.0 304/862] selftests/bpf: Adapt cgroup effective query uapi change Date: Wed, 19 Oct 2022 10:26:31 +0200 Message-Id: <20221019083303.438903129@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106383932626314?= X-GMAIL-MSGID: =?utf-8?q?1747106383932626314?= From: Pu Lehui [ Upstream commit d2aa993b7d9de6deeb1df6c9a6b9b6193c337cc6 ] The attach flags is meaningless for effective query and its value will always be set as 0 during effective query. Root cg's effective progs is always its attached progs, so we use non-effective query to get its progs count and attach flags. And we don't need the remain attach flags check. Fixes: b79c9fc9551b ("bpf: implement BPF_PROG_QUERY for BPF_LSM_CGROUP") Signed-off-by: Pu Lehui Link: https://lore.kernel.org/r/20220921104604.2340580-4-pulehui@huaweicloud.com Signed-off-by: Martin KaFai Lau Signed-off-by: Sasha Levin --- tools/testing/selftests/bpf/prog_tests/cgroup_link.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/tools/testing/selftests/bpf/prog_tests/cgroup_link.c b/tools/testing/selftests/bpf/prog_tests/cgroup_link.c index 9e6e6aad347c..15093a69510e 100644 --- a/tools/testing/selftests/bpf/prog_tests/cgroup_link.c +++ b/tools/testing/selftests/bpf/prog_tests/cgroup_link.c @@ -71,10 +71,9 @@ void serial_test_cgroup_link(void) ping_and_check(cg_nr, 0); - /* query the number of effective progs and attach flags in root cg */ + /* query the number of attached progs and attach flags in root cg */ err = bpf_prog_query(cgs[0].fd, BPF_CGROUP_INET_EGRESS, - BPF_F_QUERY_EFFECTIVE, &attach_flags, NULL, - &prog_cnt); + 0, &attach_flags, NULL, &prog_cnt); CHECK_FAIL(err); CHECK_FAIL(attach_flags != BPF_F_ALLOW_MULTI); if (CHECK(prog_cnt != 1, "effect_cnt", "exp %d, got %d\n", 1, prog_cnt)) @@ -85,17 +84,15 @@ void serial_test_cgroup_link(void) BPF_F_QUERY_EFFECTIVE, NULL, NULL, &prog_cnt); CHECK_FAIL(err); - CHECK_FAIL(attach_flags != BPF_F_ALLOW_MULTI); if (CHECK(prog_cnt != cg_nr, "effect_cnt", "exp %d, got %d\n", cg_nr, prog_cnt)) goto cleanup; /* query the effective prog IDs in last cg */ err = bpf_prog_query(cgs[last_cg].fd, BPF_CGROUP_INET_EGRESS, - BPF_F_QUERY_EFFECTIVE, &attach_flags, - prog_ids, &prog_cnt); + BPF_F_QUERY_EFFECTIVE, NULL, prog_ids, + &prog_cnt); CHECK_FAIL(err); - CHECK_FAIL(attach_flags != BPF_F_ALLOW_MULTI); if (CHECK(prog_cnt != cg_nr, "effect_cnt", "exp %d, got %d\n", cg_nr, prog_cnt)) goto cleanup; From patchwork Wed Oct 19 08:26: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: 4695 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp213304wrs; Wed, 19 Oct 2022 02:09:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4pZIsQMGyVzpZsXBfi3u2LuLshqYyQtmxRtf/6ARSwAbmNp8TVHyIqDAdvKP1D+9FqOGs2 X-Received: by 2002:a17:906:5a4b:b0:78d:8790:d4a1 with SMTP id my11-20020a1709065a4b00b0078d8790d4a1mr5847757ejc.329.1666170583235; Wed, 19 Oct 2022 02:09:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170583; cv=none; d=google.com; s=arc-20160816; b=zOkwndLBdGWTWuAteqMKWeHjF4F4zjE5Yk6HANCoqOGNHGbgoYRI9v7W4bd+uqEgdK BIgRXPF+BeoxLB7hVSFZ1kkLsQewLc954aTuZgseoEy/qiSozV5qQCwRR0US0k3CnzPg dDsBvRsY5y6nT4VH7z7f3fF9Etn/c7NO7QtREk7Ke/T/SnYIw27Fty66vj95pFohWqfK 0ru2c83NuiVVz2FESrAHAh1wKQDM1ySC8TUC780kGYpEKKweX3QsCkm9EO/kNY1CLkrK BE10QmWT6R91qqEAhDvv7IBUyBDVP3/qFsJm9ydcWY2Cs2nmVOMIPejrdCXm4lvjy90X T+1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NaJa3SgGdlrdmi7o/e+AsEyVY3xUf1e7eJ44Gj6LJTQ=; b=N5Ris3XDPGP4PydlDieGTuAaS25XmzflAxPPzdvYKH5kx9i3SRSUvufR0p7JiPlzgh 7spFnLneE2ZCcU+7mIKWyiSC/ZjkU3hNhpjVFma/l7qY/n7ogI8+50ps1kUydlXX9s5s q42rXUze9/7mpBCLPyc7EE1ETeyGJr4ZsZ8j5UADh1xwoMVbbWalU1RH1xHin1Nzg9sg gYOU7idU+uDxY4r3UbLEsA0ahaJK6NbpCvya4ePAN5OsQkMdbHOU34FmKBFC7mWDWSgH I9zfHUdsFTTVIoc24WB/d33imzqOuMFkZTkFUeVgTlSTDN/ELlRYryEvraf/FsR6+mSs 9G3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="fS2O/jUc"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170907a41400b007918f4994f4si9092277ejc.15.2022.10.19.02.09.17; Wed, 19 Oct 2022 02:09: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="fS2O/jUc"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232356AbiJSJFm (ORCPT + 99 others); Wed, 19 Oct 2022 05:05:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232390AbiJSJEI (ORCPT ); Wed, 19 Oct 2022 05:04:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5275F2E690; Wed, 19 Oct 2022 01:57: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 3775F6187A; Wed, 19 Oct 2022 08:53:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 48B5FC43144; Wed, 19 Oct 2022 08:53:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169587; bh=EtP+T23VdFQowWwzjB9/ws5vszh9Tjc6/grKZe9yz5M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fS2O/jUcYY6x53pERcsiL5Z/V6Q2Nv9OXf7guhNIZeyOrUYb5XQzVcuLitiPA7pKF YmD+69G/2GDu1NIVBhOfiKcA0PNvAeRRZJGDAbNUi2FFvh2rQAQFLwM7RrMKhDSWdH QauLr4T3AkDVOIkwQB2MTYddHWQ9dFG6kQ5hGleQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Qingqing Yang , Boris Sukholitko , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.0 305/862] flow_dissector: Do not count vlan tags inside tunnel payload Date: Wed, 19 Oct 2022 10:26:32 +0200 Message-Id: <20221019083303.487021389@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106485708865086?= X-GMAIL-MSGID: =?utf-8?q?1747106485708865086?= From: Qingqing Yang [ Upstream commit 9f87eb4246994e32a4e4ea88476b20ab3b412840 ] We've met the problem that when there is a vlan tag inside GRE encapsulation, the match of num_of_vlans fails. It is caused by the vlan tag inside GRE payload has been counted into num_of_vlans, which is not expected. One example packet is like this: Ethernet II, Src: Broadcom_68:56:07 (00:10:18:68:56:07) Dst: Broadcom_68:56:08 (00:10:18:68:56:08) 802.1Q Virtual LAN, PRI: 0, DEI: 0, ID: 100 Internet Protocol Version 4, Src: 192.168.1.4, Dst: 192.168.1.200 Generic Routing Encapsulation (Transparent Ethernet bridging) Ethernet II, Src: Broadcom_68:58:07 (00:10:18:68:58:07) Dst: Broadcom_68:58:08 (00:10:18:68:58:08) 802.1Q Virtual LAN, PRI: 0, DEI: 0, ID: 200 ... It should match the (num_of_vlans 1) rule, but it matches the (num_of_vlans 2) rule. The vlan tags inside the GRE or other tunnel encapsulated payload should not be taken into num_of_vlans. The fix is to stop counting the vlan number when the encapsulation bit is set. Fixes: 34951fcf26c5 ("flow_dissector: Add number of vlan tags dissector") Signed-off-by: Qingqing Yang Reviewed-by: Boris Sukholitko Link: https://lore.kernel.org/r/20220919074808.136640-1-qingqing.yang@broadcom.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/core/flow_dissector.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c index 5dc3860e9fc7..7105529abb0f 100644 --- a/net/core/flow_dissector.c +++ b/net/core/flow_dissector.c @@ -1173,8 +1173,8 @@ bool __skb_flow_dissect(const struct net *net, nhoff += sizeof(*vlan); } - if (dissector_uses_key(flow_dissector, - FLOW_DISSECTOR_KEY_NUM_OF_VLANS)) { + if (dissector_uses_key(flow_dissector, FLOW_DISSECTOR_KEY_NUM_OF_VLANS) && + !(key_control->flags & FLOW_DIS_ENCAPSULATION)) { struct flow_dissector_key_num_of_vlans *key_nvs; key_nvs = skb_flow_dissector_target(flow_dissector, From patchwork Wed Oct 19 08:26: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: 5050 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp247673wrs; Wed, 19 Oct 2022 03:41:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5fu2jxtwyQz4ftfyxTDyJ+YGCtnhhEwgIHlJo99j/VGr3pKiSpbB0pNRUK71wTxVd4mAoH X-Received: by 2002:a17:907:75ef:b0:78d:98a2:8380 with SMTP id jz15-20020a17090775ef00b0078d98a28380mr6256027ejc.752.1666176088597; Wed, 19 Oct 2022 03:41:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176088; cv=none; d=google.com; s=arc-20160816; b=c0jMquG9ZhYNFHYOOF5gczy4q8/bPaGr1ANSk8oxKP6DDnBXipATb/+iY7oM97iUAe HW3tKW4ZxM2Lnq7RnJUmeikpoE9uMqjNaLhcQ+eIFKbgiQKtTvj2XPpqnxyWWxneGX3f i7w47h9wl9Xxba7IWNOcJD+mpefv7PAckUZIenzXohl03PAmDo5JCAvfwZFrFyFML+D1 PWMMaz/XuKT4DTXV/q3SWHIAPWZWjK5oDSeuDgN7ORrgkvErjA1+GtX+iWGBqxe+YJNH kG5ZmPQkwW5QuH1jer5Je8zDjgN5clPX4CTOiv7+TgMLvoR5zRZQiw4bk/07G/M1PABD WHAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZK7aqd7byFn0w+X/vT9xT1dEWWBz+0TaaNMQvrb4Itc=; b=rNkbagNBvpWT8JP9Q3gKUVN2mNEJlEIpAXJTLg71VAS4F4RulGviqss0qWQ8gGNgM+ j+HxOl1TRWodXskfQoOOPMopefMuEBx3zlfHazztMl63ejKwFg2L94/XnsbO3YmCXWSR a3jC2+ykiiJf5I2Vv1W92AjDeDzd7QTgu1RPJSoCSAKUw5dhvUZdqbzQrAuu3HAXW+7g 1j/P0017ChOjMN/eCP0awJQhISYX8Shh61O3paDSJP+V7YF8WMzTfhWpGqCaX5zEz0ab rsE10oOGMo27XlJsmWUWMJVGyaFVWyXDRZvb9ODEg+/+iTLIBm8bDZuTls7Nsbigcv4t v7yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Cvapa5ni; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z88-20020a509e61000000b00459dc4e4b7fsi12807173ede.143.2022.10.19.03.41.03; Wed, 19 Oct 2022 03:41: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=Cvapa5ni; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232261AbiJSKkY (ORCPT + 99 others); Wed, 19 Oct 2022 06:40:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230429AbiJSKj2 (ORCPT ); Wed, 19 Oct 2022 06:39:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22AA36587; Wed, 19 Oct 2022 03:18: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 3E7E7B823B7; Wed, 19 Oct 2022 08:53:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB032C433D7; Wed, 19 Oct 2022 08:53:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169606; bh=TCo4by4CCbBMMGpHCxdYLBrGbgOCt+MtL6GXRYTS2bA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cvapa5nimW2xavZQR9eQ9IzMhCGWpb0WVRCR1/D5MEqoDtGlKtxePEWfyhBl+zWvi 7m4ly8fS+TSXELAel6phdSq/zcnoJu9oCvs5yMnJppQfnKdqj8MKGviQNf9Buy4fji zOGxHWYWy7Hnzju5NeAlATdCjDgiaonDhvn0120A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Duoming Zhou , Brian Norris , Kalle Valo , Sasha Levin Subject: [PATCH 6.0 306/862] mwifiex: fix sleep in atomic context bugs caused by dev_coredumpv Date: Wed, 19 Oct 2022 10:26:33 +0200 Message-Id: <20221019083303.537673194@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112257746220178?= X-GMAIL-MSGID: =?utf-8?q?1747112257746220178?= From: Duoming Zhou [ Upstream commit 551e4745c7f218da7070b36a06318592913676ff ] There are sleep in atomic context bugs when uploading device dump data in mwifiex. The root cause is that dev_coredumpv could not be used in atomic contexts, because it calls dev_set_name which include operations that may sleep. The call tree shows execution paths that could lead to bugs: (Interrupt context) fw_dump_timer_fn mwifiex_upload_device_dump dev_coredumpv(..., GFP_KERNEL) dev_coredumpm() kzalloc(sizeof(*devcd), gfp); //may sleep dev_set_name kobject_set_name_vargs kvasprintf_const(GFP_KERNEL, ...); //may sleep kstrdup(s, GFP_KERNEL); //may sleep The corresponding fail log is shown below: [ 135.275938] usb 1-1: == mwifiex dump information to /sys/class/devcoredump start [ 135.281029] BUG: sleeping function called from invalid context at include/linux/sched/mm.h:265 ... [ 135.293613] Call Trace: [ 135.293613] [ 135.293613] dump_stack_lvl+0x57/0x7d [ 135.293613] __might_resched.cold+0x138/0x173 [ 135.293613] ? dev_coredumpm+0xca/0x2e0 [ 135.293613] kmem_cache_alloc_trace+0x189/0x1f0 [ 135.293613] ? devcd_match_failing+0x30/0x30 [ 135.293613] dev_coredumpm+0xca/0x2e0 [ 135.293613] ? devcd_freev+0x10/0x10 [ 135.293613] dev_coredumpv+0x1c/0x20 [ 135.293613] ? devcd_match_failing+0x30/0x30 [ 135.293613] mwifiex_upload_device_dump+0x65/0xb0 [ 135.293613] ? mwifiex_dnld_fw+0x1b0/0x1b0 [ 135.293613] call_timer_fn+0x122/0x3d0 [ 135.293613] ? msleep_interruptible+0xb0/0xb0 [ 135.293613] ? lock_downgrade+0x3c0/0x3c0 [ 135.293613] ? __next_timer_interrupt+0x13c/0x160 [ 135.293613] ? lockdep_hardirqs_on_prepare+0xe/0x220 [ 135.293613] ? mwifiex_dnld_fw+0x1b0/0x1b0 [ 135.293613] __run_timers.part.0+0x3f8/0x540 [ 135.293613] ? call_timer_fn+0x3d0/0x3d0 [ 135.293613] ? arch_restore_msi_irqs+0x10/0x10 [ 135.293613] ? lapic_next_event+0x31/0x40 [ 135.293613] run_timer_softirq+0x4f/0xb0 [ 135.293613] __do_softirq+0x1c2/0x651 ... [ 135.293613] RIP: 0010:default_idle+0xb/0x10 [ 135.293613] RSP: 0018:ffff888006317e68 EFLAGS: 00000246 [ 135.293613] RAX: ffffffff82ad8d10 RBX: ffff888006301cc0 RCX: ffffffff82ac90e1 [ 135.293613] RDX: ffffed100d9ff1b4 RSI: ffffffff831ad140 RDI: ffffffff82ad8f20 [ 135.293613] RBP: 0000000000000003 R08: 0000000000000000 R09: ffff88806cff8d9b [ 135.293613] R10: ffffed100d9ff1b3 R11: 0000000000000001 R12: ffffffff84593410 [ 135.293613] R13: 0000000000000000 R14: 0000000000000000 R15: 1ffff11000c62fd2 ... [ 135.389205] usb 1-1: == mwifiex dump information to /sys/class/devcoredump end This patch uses delayed work to replace timer and moves the operations that may sleep into a delayed work in order to mitigate bugs, it was tested on Marvell 88W8801 chip whose port is usb and the firmware is usb8801_uapsta.bin. The following is the result after using delayed work to replace timer. [ 134.936453] usb 1-1: == mwifiex dump information to /sys/class/devcoredump start [ 135.043344] usb 1-1: == mwifiex dump information to /sys/class/devcoredump end As we can see, there is no bug now. Fixes: f5ecd02a8b20 ("mwifiex: device dump support for usb interface") Signed-off-by: Duoming Zhou Reviewed-by: Brian Norris Acked-by: Greg Kroah-Hartman Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/5cfa5c473ff6d069cb67760ffa04a2f84ef450a8.1661252818.git.duoming@zju.edu.cn Signed-off-by: Sasha Levin --- drivers/net/wireless/marvell/mwifiex/init.c | 9 +++++---- drivers/net/wireless/marvell/mwifiex/main.h | 3 ++- drivers/net/wireless/marvell/mwifiex/sta_event.c | 6 +++--- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/init.c b/drivers/net/wireless/marvell/mwifiex/init.c index fc77489cc511..7dddb4b5dea1 100644 --- a/drivers/net/wireless/marvell/mwifiex/init.c +++ b/drivers/net/wireless/marvell/mwifiex/init.c @@ -51,9 +51,10 @@ static void wakeup_timer_fn(struct timer_list *t) adapter->if_ops.card_reset(adapter); } -static void fw_dump_timer_fn(struct timer_list *t) +static void fw_dump_work(struct work_struct *work) { - struct mwifiex_adapter *adapter = from_timer(adapter, t, devdump_timer); + struct mwifiex_adapter *adapter = + container_of(work, struct mwifiex_adapter, devdump_work.work); mwifiex_upload_device_dump(adapter); } @@ -309,7 +310,7 @@ static void mwifiex_init_adapter(struct mwifiex_adapter *adapter) adapter->active_scan_triggered = false; timer_setup(&adapter->wakeup_timer, wakeup_timer_fn, 0); adapter->devdump_len = 0; - timer_setup(&adapter->devdump_timer, fw_dump_timer_fn, 0); + INIT_DELAYED_WORK(&adapter->devdump_work, fw_dump_work); } /* @@ -388,7 +389,7 @@ static void mwifiex_adapter_cleanup(struct mwifiex_adapter *adapter) { del_timer(&adapter->wakeup_timer); - del_timer_sync(&adapter->devdump_timer); + cancel_delayed_work_sync(&adapter->devdump_work); mwifiex_cancel_all_pending_cmd(adapter); wake_up_interruptible(&adapter->cmd_wait_q.wait); wake_up_interruptible(&adapter->hs_activate_wait_q); diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h index 87729d251fed..63f861e6b28a 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.h +++ b/drivers/net/wireless/marvell/mwifiex/main.h @@ -37,6 +37,7 @@ #include #include #include +#include #include "decl.h" #include "ioctl.h" @@ -1043,7 +1044,7 @@ struct mwifiex_adapter { /* Device dump data/length */ void *devdump_data; int devdump_len; - struct timer_list devdump_timer; + struct delayed_work devdump_work; bool ignore_btcoex_events; }; diff --git a/drivers/net/wireless/marvell/mwifiex/sta_event.c b/drivers/net/wireless/marvell/mwifiex/sta_event.c index b95e90a7d124..e80e372cce8c 100644 --- a/drivers/net/wireless/marvell/mwifiex/sta_event.c +++ b/drivers/net/wireless/marvell/mwifiex/sta_event.c @@ -611,8 +611,8 @@ mwifiex_fw_dump_info_event(struct mwifiex_private *priv, * transmission event get lost, in this cornel case, * user would still get partial of the dump. */ - mod_timer(&adapter->devdump_timer, - jiffies + msecs_to_jiffies(MWIFIEX_TIMER_10S)); + schedule_delayed_work(&adapter->devdump_work, + msecs_to_jiffies(MWIFIEX_TIMER_10S)); } /* Overflow check */ @@ -631,7 +631,7 @@ mwifiex_fw_dump_info_event(struct mwifiex_private *priv, return; upload_dump: - del_timer_sync(&adapter->devdump_timer); + cancel_delayed_work_sync(&adapter->devdump_work); mwifiex_upload_device_dump(adapter); } From patchwork Wed Oct 19 08:26: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: 4784 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp215896wrs; Wed, 19 Oct 2022 02:16:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7HvDsVezpuMTgVEQR0TwoIoUcZ/4V3uCMjp8730GKAk5qUzKZR5xt9FJ12pfAJZaR+ImLz X-Received: by 2002:a17:907:75d4:b0:78d:efa7:f78c with SMTP id jl20-20020a17090775d400b0078defa7f78cmr5756157ejc.454.1666171008146; Wed, 19 Oct 2022 02:16:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666171008; cv=none; d=google.com; s=arc-20160816; b=gWpAm90SgLALN/WjIuUNSAKoL9VBbDraNCXim3zWlgPoE/R4lwzth6tDgQins3NSQq nQyU1ecu6qVoeE4NRyh2/QUthKRob4ErDlbT7ddgPO9ZSFlKavEWhoYAuLJP1+fSni8v z+H89ISphU/z9/JWV1cVVozMw3trdDzh8L6ZJQtVdzkl640gJvTUvu/l8iuTaF5PiLDc DabIhOdY6fHNKsJSAzcNUygG+j2XrXqGY0vQDy/sgI1zKuU8/jsswEBeMRjQVXmr8/6L OHHWbgaaHel852CsUbO3Ztz01Tcae4HCB5Krtei+J5qidho/rgz/M0OZ3g7T83Zzk0LC 5I9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Ss5AJmB/Xn0JNvdbhfc67zm5w3fTYqKtWFhu42a69fU=; b=lSqNky3lhO3qsSUBC5B2Zi+vr19TpHTK505Avl6/Y/8QvyfUZGPRJR2fKaR47+GvbZ ZQ8/U7/7ESqJgoTVgufanDZPdE2xpkj92n9VJzpK6aq+uqr5l7qm9xjBvWrny6d6I860 osGg2ynQnk/Di7zUcUVTO42z+6IxXrQABjeuxAkKSN0k0fiMNNorPuNOWXUtLQ8OjMUW P42srbafkRsu/xxtOegQbmOSqCZobwJQBJSJFaom/cS65Uw15/ufAy69Havr1SjwUBMS bgoi8nco9r+xPlyuANEWtUlDqXa4p0GEL3E3K4/zCewy4zs9biGO6qmJq3J0jEk/JfBd pKIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=D26drXDw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hb10-20020a170907160a00b0078341b2e269si12701583ejc.886.2022.10.19.02.16.23; Wed, 19 Oct 2022 02:16: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=D26drXDw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232910AbiJSJPz (ORCPT + 99 others); Wed, 19 Oct 2022 05:15:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232839AbiJSJMI (ORCPT ); Wed, 19 Oct 2022 05:12:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C916C1DBB; Wed, 19 Oct 2022 02:02: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 4370F61877; Wed, 19 Oct 2022 08:53:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D726C433C1; Wed, 19 Oct 2022 08:53:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169608; bh=vIZuRLYkwg87Qecmw6blftFLy/i13Q/X8wXkEXDp5zY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D26drXDwsB4EWaWrlyWRfFAkqr7/hlc97k6sTCb89VZstyqBn0kYmEFORKMGWb5nH HhU53J8tyrZI008jlquFDwgn88doWXkbHMBApfDFeuPIoDA2V03J7aHW54qqa7eKV2 XC9LJ9cY0G4OY3dp2Uqe3WggJ0Z9InlCCpGhifd4= 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 6.0 307/862] wifi: ath11k: fix failed to find the peer with peer_id 0 when disconnected Date: Wed, 19 Oct 2022 10:26:34 +0200 Message-Id: <20221019083303.587170296@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106931198285077?= X-GMAIL-MSGID: =?utf-8?q?1747106931198285077?= From: Wen Gong [ Upstream commit a20ed60bb357776301c2dad7b4a4f0db97e143e9 ] It has a fail log which is ath11k_dbg in ath11k_dp_rx_process_mon_status(), as below, it will not print when debug_mask is not set ATH11K_DBG_DATA. ath11k_dbg(ab, ATH11K_DBG_DATA, "failed to find the peer with peer_id %d\n", ppdu_info.peer_id); When run scan with station disconnected, the peer_id is 0 for case HAL_RX_MPDU_START in ath11k_hal_rx_parse_mon_status_tlv() which called from ath11k_dp_rx_process_mon_status(), and the peer_id of ppdu_info is reset to 0 in the while loop, so it does not match condition of the check "if (ppdu_info->peer_id == HAL_INVALID_PEERID" in the loop, and then the log "failed to find the peer with peer_id 0" print after the check in the loop, it is below call stack when debug_mask is set ATH11K_DBG_DATA. The reason is this commit 01d2f285e3e5 ("ath11k: decode HE status tlv") add "memset(ppdu_info, 0, sizeof(struct hal_rx_mon_ppdu_info))" in ath11k_dp_rx_process_mon_status(), but the commit does not initialize the peer_id to HAL_INVALID_PEERID, then lead the check mis-match. Callstack of the failed log: [12335.689072] RIP: 0010:ath11k_dp_rx_process_mon_status+0x9ea/0x1020 [ath11k] [12335.689157] Code: 89 ff e8 f9 10 00 00 be 01 00 00 00 4c 89 f7 e8 dc 4b 4e de 48 8b 85 38 ff ff ff c7 80 e4 07 00 00 01 00 00 00 e9 20 f8 ff ff <0f> 0b 41 0f b7 96 be 06 00 00 48 c7 c6 b8 50 44 c1 4c 89 ff e8 fd [12335.689180] RSP: 0018:ffffb874001a4ca0 EFLAGS: 00010246 [12335.689210] RAX: 0000000000000000 RBX: ffff995642cbd100 RCX: 0000000000000000 [12335.689229] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff99564212cd18 [12335.689248] RBP: ffffb874001a4dc0 R08: 0000000000000001 R09: 0000000000000000 [12335.689268] R10: 0000000000000220 R11: ffffb874001a48e8 R12: ffff995642473d40 [12335.689286] R13: ffff99564212c5b8 R14: ffff9956424736a0 R15: ffff995642120000 [12335.689303] FS: 0000000000000000(0000) GS:ffff995739000000(0000) knlGS:0000000000000000 [12335.689323] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [12335.689341] CR2: 00007f43c5d5e039 CR3: 000000011c012005 CR4: 00000000000606e0 [12335.689360] Call Trace: [12335.689377] [12335.689418] ? rcu_read_lock_held_common+0x12/0x50 [12335.689447] ? rcu_read_lock_sched_held+0x25/0x80 [12335.689471] ? rcu_read_lock_held_common+0x12/0x50 [12335.689504] ath11k_dp_rx_process_mon_rings+0x8d/0x4f0 [ath11k] [12335.689578] ? ath11k_dp_rx_process_mon_rings+0x8d/0x4f0 [ath11k] [12335.689653] ? lock_acquire+0xef/0x360 [12335.689681] ? rcu_read_lock_sched_held+0x25/0x80 [12335.689713] ath11k_dp_service_mon_ring+0x38/0x60 [ath11k] [12335.689784] ? ath11k_dp_rx_process_mon_rings+0x4f0/0x4f0 [ath11k] [12335.689860] call_timer_fn+0xb2/0x2f0 [12335.689897] ? ath11k_dp_rx_process_mon_rings+0x4f0/0x4f0 [ath11k] [12335.689970] run_timer_softirq+0x21f/0x540 [12335.689999] ? ktime_get+0xad/0x160 [12335.690025] ? lapic_next_deadline+0x2c/0x40 [12335.690053] ? clockevents_program_event+0x82/0x100 [12335.690093] __do_softirq+0x151/0x4a8 [12335.690135] irq_exit_rcu+0xc9/0x100 [12335.690165] sysvec_apic_timer_interrupt+0xa8/0xd0 [12335.690189] [12335.690204] [12335.690225] asm_sysvec_apic_timer_interrupt+0x12/0x20 Reset the default value to HAL_INVALID_PEERID each time after memset of ppdu_info as well as others memset which existed in function ath11k_dp_rx_process_mon_status(), then the failed log disappeared. Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3 Fixes: 01d2f285e3e5 ("ath11k: decode HE status tlv") Signed-off-by: Wen Gong Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220518033556.31940-1-quic_wgong@quicinc.com Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath11k/dp_rx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath11k/dp_rx.c b/drivers/net/wireless/ath/ath11k/dp_rx.c index 2148acf37071..e9c56ad1ec9d 100644 --- a/drivers/net/wireless/ath/ath11k/dp_rx.c +++ b/drivers/net/wireless/ath/ath11k/dp_rx.c @@ -5197,7 +5197,8 @@ int ath11k_dp_rx_process_mon_status(struct ath11k_base *ab, int mac_id, if (log_type != ATH11K_PKTLOG_TYPE_INVALID) trace_ath11k_htt_rxdesc(ar, skb->data, log_type, rx_buf_sz); - memset(ppdu_info, 0, sizeof(struct hal_rx_mon_ppdu_info)); + memset(ppdu_info, 0, sizeof(*ppdu_info)); + ppdu_info->peer_id = HAL_INVALID_PEERID; hal_status = ath11k_hal_rx_parse_mon_status(ab, ppdu_info, skb); if (test_bit(ATH11K_FLAG_MONITOR_STARTED, &ar->monitor_flags) && From patchwork Wed Oct 19 08:26: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: 5027 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp246452wrs; Wed, 19 Oct 2022 03:38:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7AlCVPjrxZ+/kKCG9/9lT4t0g8/BNlAcPYmGO/e7p+d/4M1Eu+JABtstiSOdGBAr/+uj1Q X-Received: by 2002:a05:6402:2683:b0:45d:3c44:dad4 with SMTP id w3-20020a056402268300b0045d3c44dad4mr6779409edd.124.1666175896143; Wed, 19 Oct 2022 03:38:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666175896; cv=none; d=google.com; s=arc-20160816; b=KeIXcWie6nIdX4XBr124X2rtSoqzKlkmkX/HuHm6PASELospHc71mGiBR5GD46hMVy QaDjaSQtsqFMRCDK8wkYRdwfGDitlRpt1hUYbx+6wd98DhUSi5IQYq7m/cjvU1FuzhIj AhkGcPINyhEoMic/LMIg8jqHmt6iafe+X8FojDRrNSL7WH9KJ6riv42pfI6K/cf5SLjZ lmZB6RP+HfKGLscPVxZEw193sIDk7vbF8OmdOU/7YxUhZhFbRUndDv/4axHOhod5wlpW oRiuxGrazN4arWvv8TVVW8xo+HGnqN1LbthKBwNg3znF/mzyHPCYo1H9eY9N8IotVjlL UKhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=cThV5rtMIYLgxa1lUHUksv0mAjKNspXtgJPBcTj7Edk=; b=FKGLcuaI7w4pXuER5xEbbynGLfcQSdsoNZq/8ldjx1oLHyYF/oMqshPVB8g57hM2q0 SpZBM2titKwq9op0FZy9TI2qMuyshcmDKBf6BFbFZ8asl94yCv4uyuIa8WRtuDgy8Uj7 XkM87rtQEwmPxnNV7w6H69+NYGOHu/c/eP+FTqNze/E+x8zSUYcPl+Z/cnxpEnz0TbG1 txooaupzYJCaZ1jC6+9nIu7+g4Xr98cpSU2lnea+vMqOvJTOZnm0xepM+CGqq2Rmzl0+ 6tH1+R9InCwuXvmI52/y5Q/JOM1Wikk6Yy/f0VCuc0VzQrOkPdYn7492E2r/9vMrgMV9 JYcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ddUxmY9p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nb36-20020a1709071ca400b0078ddffd4660si15754304ejc.651.2022.10.19.03.37.51; Wed, 19 Oct 2022 03:38: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=ddUxmY9p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230465AbiJSKfq (ORCPT + 99 others); Wed, 19 Oct 2022 06:35:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232103AbiJSKe3 (ORCPT ); Wed, 19 Oct 2022 06:34: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 9AD26E4E46; Wed, 19 Oct 2022 03:13: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 822B3B823AF; Wed, 19 Oct 2022 08:53:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ECD19C433C1; Wed, 19 Oct 2022 08:53:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169611; bh=ocXP7p6k+F8ZylaxYyqY5HxHpFjlyhStwz5dqTrHkEs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ddUxmY9p9/TUb1OtthEZfaIpvAnZFThYLtZD+lgQ/9h04VdL2h8YtL01fGGeUD8U0 K7ueGdkU2v57hvrqCWIDBmMLs9Q/kFOOx//9utQmmtwifb6Xe/anDjMIpAyrN9f8TV 7oQ8jubuAE2c+VIzUDpToY/n4kFdRptD6G2OxrlU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jesus Fernandez Manzano , Kalle Valo , Sasha Levin Subject: [PATCH 6.0 308/862] wifi: ath11k: fix number of VHT beamformee spatial streams Date: Wed, 19 Oct 2022 10:26:35 +0200 Message-Id: <20221019083303.635120026@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112056792986048?= X-GMAIL-MSGID: =?utf-8?q?1747112056792986048?= From: Jesus Fernandez Manzano [ Upstream commit 55b5ee3357d7bb98ee578cf9b84a652e7a1bc199 ] The number of spatial streams used when acting as a beamformee in VHT mode are reported by the firmware as 7 (8 sts - 1) both in IPQ6018 and IPQ8074 which respectively have 2 and 4 sts each. So the firmware should report 1 (2 - 1) and 3 (4 - 1). Fix this by checking that the number of VHT beamformee sts reported by the firmware is not greater than the number of receiving antennas - 1. The fix is based on the same approach used in this same function for sanitizing the number of sounding dimensions reported by the firmware. Without this change, acting as a beamformee in VHT mode is not working properly. Tested-on: IPQ6018 hw1.0 AHB WLAN.HK.2.5.0.1-01208-QCAHKSWPL_SILICONZ-1 Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-01208-QCAHKSWPL_SILICONZ-1 Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices") Signed-off-by: Jesus Fernandez Manzano Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220616173947.21901-1-jesus.manzano@galgus.net Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath11k/mac.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c index 7e91e347c9ff..7f6521314b2d 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -4954,6 +4954,8 @@ static int ath11k_mac_set_txbf_conf(struct ath11k_vif *arvif) if (vht_cap & (IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE)) { nsts = vht_cap & IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK; nsts >>= IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT; + if (nsts > (ar->num_rx_chains - 1)) + nsts = ar->num_rx_chains - 1; value |= SM(nsts, WMI_TXBF_STS_CAP_OFFSET); } @@ -4994,7 +4996,7 @@ static int ath11k_mac_set_txbf_conf(struct ath11k_vif *arvif) static void ath11k_set_vht_txbf_cap(struct ath11k *ar, u32 *vht_cap) { bool subfer, subfee; - int sound_dim = 0; + int sound_dim = 0, nsts = 0; subfer = !!(*vht_cap & (IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE)); subfee = !!(*vht_cap & (IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE)); @@ -5004,6 +5006,11 @@ static void ath11k_set_vht_txbf_cap(struct ath11k *ar, u32 *vht_cap) subfer = false; } + if (ar->num_rx_chains < 2) { + *vht_cap &= ~(IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE); + subfee = false; + } + /* If SU Beaformer is not set, then disable MU Beamformer Capability */ if (!subfer) *vht_cap &= ~(IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE); @@ -5016,7 +5023,9 @@ static void ath11k_set_vht_txbf_cap(struct ath11k *ar, u32 *vht_cap) sound_dim >>= IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_SHIFT; *vht_cap &= ~IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK; - /* TODO: Need to check invalid STS and Sound_dim values set by FW? */ + nsts = (*vht_cap & IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK); + nsts >>= IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT; + *vht_cap &= ~IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK; /* Enable Sounding Dimension Field only if SU BF is enabled */ if (subfer) { @@ -5028,9 +5037,15 @@ static void ath11k_set_vht_txbf_cap(struct ath11k *ar, u32 *vht_cap) *vht_cap |= sound_dim; } - /* Use the STS advertised by FW unless SU Beamformee is not supported*/ - if (!subfee) - *vht_cap &= ~(IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK); + /* Enable Beamformee STS Field only if SU BF is enabled */ + if (subfee) { + if (nsts > (ar->num_rx_chains - 1)) + nsts = ar->num_rx_chains - 1; + + nsts <<= IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT; + nsts &= IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK; + *vht_cap |= nsts; + } } static struct ieee80211_sta_vht_cap From patchwork Wed Oct 19 08:26:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4946 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp226283wrs; Wed, 19 Oct 2022 02:45:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM48+zqinzF4NL3clfqkO4S7rFggpbNVe0l2456vH6J3hwASwfYJM1kfYYgwwRTdWFRIkNul X-Received: by 2002:a17:907:724c:b0:791:a7ff:aa7a with SMTP id ds12-20020a170907724c00b00791a7ffaa7amr1743416ejc.105.1666172606040; Wed, 19 Oct 2022 02:43:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172606; cv=none; d=google.com; s=arc-20160816; b=IXa/kX93hm7mAGOuKykW2jKlNTdb3mAs985PQ2C9PGANCs/c1H2EJunWKf5fpFNnIe F+PWZ7KdS8atV8y9H+w+EsscJo8jG4ChpslAIJTcgSfS8Szdw/hkcY/0ivhjlIbbE0tX XU4/3UPK8FMWStf4gPYh3Knt9nPQXjqWgl6rUGFhYkUAQdPOA70FpWT1rhBHr/z4mNnm ljcmP9fQCL5p4hOFd+YhBO1cP5JCh7OucInsknW9O4A50r+xw7PBPVKXWG7amvgMgRsm UgryNX5Vazgd/E8ixIVidknogRMFiTfCxDAaEtGM0mJH/VHZrgiWkRv4Vn6kgV/o2uor RMzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=mwvETbQOyckzezkLqI+H4sueatgfH5Ey995dyVK8Yjs=; b=vFU3xdSQlVr49qhwjEPt02LbfGUzS9jDU3JgOEmQTf21mLcR/Pa2njq5WNOPxGe11w uwcfoqKVTVhiHkKfhLVs0zhC8q4xSHKSH1sDIy0PxNheploxyxXYRaa4EAh4rfV589Ds PC7YmoehVUptM7cfCl5aS13C2YhotcfuZwqIGsjBzAanPryENS2mmoIKIBFYZV+nYFCx b+6UCrCn13jzjliiJktbjYaFoZHooWnDERC9Q7U+4IxQowWVVtf3SMJlp9lplRVi0uwq fnPdYAwFTKVbBy5tOyIblrNgHm3Kq3D9kjZjBe/nl7lF9h0YpNocUJMTyu+vZcQxJ4UX rV/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NzkCksIp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h21-20020a056402281500b0045b293121f1si11931847ede.12.2022.10.19.02.42.58; Wed, 19 Oct 2022 02:43: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=NzkCksIp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233717AbiJSJfK (ORCPT + 99 others); Wed, 19 Oct 2022 05:35:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233849AbiJSJ3j (ORCPT ); Wed, 19 Oct 2022 05:29:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1558E9876; Wed, 19 Oct 2022 02:13: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 71F5C61871; Wed, 19 Oct 2022 08:53:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7AB9BC433C1; Wed, 19 Oct 2022 08:53:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169613; bh=8gQEWHoNqgu10m7+wDNW67gAMFr38wt2cO3VmWtUs9s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NzkCksIpVfdQ31GQA25njkVhtwlQCTuTqzkNLxktzotcSv6UsyV2rSPFytgm43vl+ E0hkGjKG6nsN6VS6tn7W+6gLLv4Xp4qQlSBHD9mPxwc0ivBqCZunjQQO6JKJsOyZhN 7oXOzcShsjTEgJ/+yrm8q+aHstteCGmFW+7lDUlA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= , Sergio Paracuellos , "David S. Miller" , Sasha Levin Subject: [PATCH 6.0 309/862] mips: dts: ralink: mt7621: fix external phy on GB-PC2 Date: Wed, 19 Oct 2022 10:26:36 +0200 Message-Id: <20221019083303.681208191@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108606613215223?= X-GMAIL-MSGID: =?utf-8?q?1747108606613215223?= From: Arınç ÜNAL [ Upstream commit 247825f991b34440f9b9d4fe607502435a42ac7b ] The address of the external phy on the mdio bus is 5. Update the devicetree for GB-PC2 accordingly. Fixes: 5bc148649cf3 ("staging: mt7621-dts: fix GB-PC2 devicetree") Signed-off-by: Arınç ÜNAL Reviewed-by: Sergio Paracuellos Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- arch/mips/boot/dts/ralink/mt7621-gnubee-gb-pc2.dts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/mips/boot/dts/ralink/mt7621-gnubee-gb-pc2.dts b/arch/mips/boot/dts/ralink/mt7621-gnubee-gb-pc2.dts index 34006e667780..0d01e542a0a6 100644 --- a/arch/mips/boot/dts/ralink/mt7621-gnubee-gb-pc2.dts +++ b/arch/mips/boot/dts/ralink/mt7621-gnubee-gb-pc2.dts @@ -83,12 +83,12 @@ &gmac1 { status = "okay"; - phy-handle = <ðphy7>; + phy-handle = <ðphy5>; }; &mdio { - ethphy7: ethernet-phy@7 { - reg = <7>; + ethphy5: ethernet-phy@5 { + reg = <5>; phy-mode = "rgmii-rxid"; }; }; From patchwork Wed Oct 19 08:26: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: 4711 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp213759wrs; Wed, 19 Oct 2022 02:11:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5t6OubE7zfs3ZIqJyoVhYZABpErvCtN1bAiG9BCSAP/KC2nz8m8kHtqjTR10vSVZualQlN X-Received: by 2002:a05:6402:27c7:b0:45d:45f0:e6c4 with SMTP id c7-20020a05640227c700b0045d45f0e6c4mr6350812ede.325.1666170660531; Wed, 19 Oct 2022 02:11:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170660; cv=none; d=google.com; s=arc-20160816; b=MXQOhRFmnL8tdj1qxO1iF0WyMKKPWgjw+7lCi9wU3ajIPYzsojk+Wmorfo33K4/yOj RqKp5+4Y4QWnZtrVyIlqvX004c4M3ME/EP85WsYBSX6E1ghoqeTEHQfmAdRoXyICHWVh d5k/47me+I8MdT13geXAHrIUjdsux+bX2AeuKdCElUSEgwwx7wwRHdcPxQGWM0My4RLQ wsz2SgeDEN4WeZp++OuRu9lQdY3nH+wxnT3nD6FmLW9imH/bRT6mZN5kgEw2ZXnHsZqu 46iOlIgJbOD48lQlMS3o0yKJ4gXFqIWJ9W+jifGjmumr1h4JUbt9epVU1KGRhPnw2tCk Jmbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nTfs9PJCZDLNOu+dE21FTZpjlwAbI6Ad0yqiNqNjXEE=; b=elLQLiFmaIApXRl4ktPGCicUxCE6rIBTYuP1/ApCzwkLA/qkRETIR0cfVHQbE3ndfU F1WefNOP9GQYa0ERbhNRYKIimpKwizl0M2yFLsaAIak1wCMBz7z+YEXiAD9jPYePTenF Na2VzTd57dGRAYCOp7auAONbRoJZkpUUtjRCfjmV3A2wFXIccybsP3FbhOzHy1KhaInh ibMInVQkgVmJp3cKqTmRRX2Qzmr1c/KMgUOHcWGgzCtsivU2RoQikn39IPahKf7Gr3zZ dQgV4qDZrx+FquwhoahTbyTvMh4UUgkjCYnVgl++E3O/d7xHT9kmXKlHm9dRyzsr9rr4 4s3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IBRPN1Aj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id wu13-20020a170906eecd00b0072f38ecf74asi15221288ejb.794.2022.10.19.02.10.33; Wed, 19 Oct 2022 02:11: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=IBRPN1Aj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232392AbiJSJGB (ORCPT + 99 others); Wed, 19 Oct 2022 05:06:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232450AbiJSJES (ORCPT ); Wed, 19 Oct 2022 05:04: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 59EE4AE224; Wed, 19 Oct 2022 01:57: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 0DE2D6181D; Wed, 19 Oct 2022 08:53:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1FF81C433C1; Wed, 19 Oct 2022 08:53:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169616; bh=DxdqHRq9n3CnM6oqOwqOVl6LE5qMcE9fhLL5nLUgjn8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IBRPN1AjWBEZ2IfWKKrF9BaRdlaobdrjDtkVork5TcsFGEgE33PT4YhOWZSN5T7hs VJZ9LsN0O/18jCuMoMzXDGIsr7pK19dims7egdAp3Z7y4sXlQzOO7vJ9JWKnZgjhfd zCVr0HLw13V5JiOM0dLqgEYa6Hsh+DpviVVAxRUg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Micay , Kees Cook , Borislav Petkov , Sasha Levin Subject: [PATCH 6.0 310/862] x86/microcode/AMD: Track patch allocation size explicitly Date: Wed, 19 Oct 2022 10:26:37 +0200 Message-Id: <20221019083303.715483748@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106566684415260?= X-GMAIL-MSGID: =?utf-8?q?1747106566684415260?= From: Kees Cook [ Upstream commit 712f210a457d9c32414df246a72781550bc23ef6 ] In preparation for reducing the use of ksize(), record the actual allocation size for later memcpy(). This avoids copying extra (uninitialized!) bytes into the patch buffer when the requested allocation size isn't exactly the size of a kmalloc bucket. Additionally, fix potential future issues where runtime bounds checking will notice that the buffer was allocated to a smaller value than returned by ksize(). Fixes: 757885e94a22 ("x86, microcode, amd: Early microcode patch loading support for AMD") Suggested-by: Daniel Micay Signed-off-by: Kees Cook Signed-off-by: Borislav Petkov Link: https://lore.kernel.org/lkml/CA+DvKQ+bp7Y7gmaVhacjv9uF6Ar-o4tet872h4Q8RPYPJjcJQA@mail.gmail.com/ Signed-off-by: Sasha Levin --- arch/x86/include/asm/microcode.h | 1 + arch/x86/kernel/cpu/microcode/amd.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/microcode.h b/arch/x86/include/asm/microcode.h index 0c3d3440fe27..aa675783412f 100644 --- a/arch/x86/include/asm/microcode.h +++ b/arch/x86/include/asm/microcode.h @@ -9,6 +9,7 @@ struct ucode_patch { struct list_head plist; void *data; /* Intel uses only this one */ + unsigned int size; u32 patch_id; u16 equiv_cpu; }; diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c index 8b2fcdfa6d31..615bc6efa1dd 100644 --- a/arch/x86/kernel/cpu/microcode/amd.c +++ b/arch/x86/kernel/cpu/microcode/amd.c @@ -788,6 +788,7 @@ static int verify_and_add_patch(u8 family, u8 *fw, unsigned int leftover, kfree(patch); return -EINVAL; } + patch->size = *patch_size; mc_hdr = (struct microcode_header_amd *)(fw + SECTION_HDR_SIZE); proc_id = mc_hdr->processor_rev_id; @@ -869,7 +870,7 @@ load_microcode_amd(bool save, u8 family, const u8 *data, size_t size) return ret; memset(amd_ucode_patch, 0, PATCH_MAX_SIZE); - memcpy(amd_ucode_patch, p->data, min_t(u32, ksize(p->data), PATCH_MAX_SIZE)); + memcpy(amd_ucode_patch, p->data, min_t(u32, p->size, PATCH_MAX_SIZE)); return ret; } From patchwork Wed Oct 19 08:26: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: 5024 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp246239wrs; Wed, 19 Oct 2022 03:37:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Ntq3TcvKpa7GaMkLmuj/RRi2aUZGkxRkI80HemJe7beJMVnG1bLO2VMvac3qqW+ot1YRB X-Received: by 2002:a17:907:3da2:b0:78d:3b45:11d9 with SMTP id he34-20020a1709073da200b0078d3b4511d9mr6163779ejc.87.1666175863896; Wed, 19 Oct 2022 03:37:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666175863; cv=none; d=google.com; s=arc-20160816; b=gc21g8suxTIb9ouFYckb1Hdg2zHFhzpDM2gIKjhOMr7HCToCb+xFII+SgbOxHbWxe5 M/8dEvyuf8UIvVSKMZmGXXCywWnsYEmU43vyvA+H7PTQuiYYNZZVbGxwtsKZxbsPeLgd RAwktssEyral4OCqUers4YXvsDX4Wl+lV9VOO+mSIW/Q17tGwn1MUF8eOwcL99sig4ij SB1AtC5Ch84TyhfPrfLONRWu2wz2omEcJZrDykGbjYDTKmUyPtfL1SVbxB+2cbuIjQdX xLOZLf6QhIo7nInZoU5UN01L180P6hpW3rgTJP/mz0cWvfDwNwyxHNopKsGIdRYBcRGw cLMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RIkfwStvFGMUot9Z7jY0YMCcbsRhgnogPqVX1f9Q9AI=; b=opzsplSZ0U68K/U91XMPF51IC2sk72Dzxwmy+N8GkJs37TUzZjF1YUmxEYuNgnBEzm WuJQWg4GTQMR4505A4P829/qonXawqOLAOZT2Asx6SSEhsfQVvHJVIV/3Jfe1Oul4zKD XXDPc+zYSXM+YjW8VV0/Y6jj7SAP3WJyfXwfMtGswYCLrjUYXmM4mgzLXCNikfWpMTc1 3xtLI1ND800VJpX+aWR+68FqOiZTESZHMCvbPS50AlwRMx5NVorgaTSCMiURt+0Tf8mm G1179G8CXoH9D4HdXk48fHW+N4gytyyKpMqFMLkzBBwmksywAjwaJApTWCgiEAtsDrTM K5Vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zcCqxMZE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ko1-20020a170907986100b00782a5657512si12994539ejc.416.2022.10.19.03.37.17; Wed, 19 Oct 2022 03:37: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=zcCqxMZE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230339AbiJSKfg (ORCPT + 99 others); Wed, 19 Oct 2022 06:35:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231910AbiJSKeG (ORCPT ); Wed, 19 Oct 2022 06:34:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5480BC467; Wed, 19 Oct 2022 03:13:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 82117B823B4; Wed, 19 Oct 2022 08:53:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D3359C433C1; Wed, 19 Oct 2022 08:53:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169619; bh=OPp2VmU2xuhn8QhfIRqDT+QYwwrcCJFreKlrbF9Gf0k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zcCqxMZENL3UvsK8P+nXb+sTlR0Y+98qorPa6o5O5ZD49Py/guZHEmpbN0a/79t7e lDqKL+6ezSRaJAsLHBXQT1JCn8Yg9mq2688yd7HIgenpBuI9HpQQcynzh7ZHjpwBdC LwLnz8OYFJSGhnewUWkGedMJhQb31eFl4M86m4C8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Grant Seltzer Richman , Andrii Nakryiko , Martin KaFai Lau , Sasha Levin Subject: [PATCH 6.0 311/862] libbpf: restore memory layout of bpf_object_open_opts Date: Wed, 19 Oct 2022 10:26:38 +0200 Message-Id: <20221019083303.755808690@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112022731498975?= X-GMAIL-MSGID: =?utf-8?q?1747112022731498975?= From: Andrii Nakryiko [ Upstream commit dbdea9b36fb61da3b9a1be0dd63542e2bfd3e5d7 ] When attach_prog_fd field was removed in libbpf 1.0 and replaced with `long: 0` placeholder, it actually shifted all the subsequent fields by 8 byte. This is due to `long: 0` promising to adjust next field's offset to long-aligned offset. But in this case we were already long-aligned as pin_root_path is a pointer. So `long: 0` had no effect, and thus didn't feel the gap created by removed attach_prog_fd. Non-zero bitfield should have been used instead. I validated using pahole. Originally kconfig field was at offset 40. With `long: 0` it's at offset 32, which is wrong. With this change it's back at offset 40. While technically libbpf 1.0 is allowed to break backwards compatibility and applications should have been recompiled against libbpf 1.0 headers, but given how trivial it is to preserve memory layout, let's fix this. Reported-by: Grant Seltzer Richman Fixes: 146bf811f5ac ("libbpf: remove most other deprecated high-level APIs") Signed-off-by: Andrii Nakryiko Link: https://lore.kernel.org/r/20220923230559.666608-1-andrii@kernel.org Signed-off-by: Martin KaFai Lau Signed-off-by: Sasha Levin --- tools/lib/bpf/libbpf.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h index 61493c4cddac..9f956e6058ed 100644 --- a/tools/lib/bpf/libbpf.h +++ b/tools/lib/bpf/libbpf.h @@ -118,7 +118,9 @@ struct bpf_object_open_opts { * auto-pinned to that path on load; defaults to "/sys/fs/bpf". */ const char *pin_root_path; - long :0; + + __u32 :32; /* stub out now removed attach_prog_fd */ + /* Additional kernel config content that augments and overrides * system Kconfig for CONFIG_xxx externs. */ From patchwork Wed Oct 19 08:26: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: 4662 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212687wrs; Wed, 19 Oct 2022 02:08:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4OW75/hkj6HONHMchtb0z/ftJXVLzhLDI0iThjLIK+pow9XVB+hbB2WKf+hVFf1DNhu0eF X-Received: by 2002:a17:90b:1c88:b0:203:8400:13a9 with SMTP id oo8-20020a17090b1c8800b00203840013a9mr8762185pjb.46.1666170484839; Wed, 19 Oct 2022 02:08:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170484; cv=none; d=google.com; s=arc-20160816; b=wfpWFGVy5JLVVpQQuQJU3/kB7odJ8ZUeeqiOIeXjFlJ/80myA+Y/Dwa+lvdiz7ilbq 53BEhsFcIISNNtQp4CgDnz3zpbEXHpAET9vDfVdd9IiegvN1P2/Jfh96TSonVD81ZSZV sQN/UPIJhJ+1VOxtp5Zqd6uSiOWUiMqwoP3PhzDsQ1OGa/ylDXipvwuNEyz14DDg+qOi uwdF/fALpeBeM8J5lGL9k8LpP8JjcafHcyWjH185tzs2kMRPkcdJg8wAnSucqV3aOCVp 186HrqwDd/ks4HEIhK/c7VzBi+ccNP9aUwD7hWdH0RoKiaHOsjHw9hwdzqYPr96jYJSP ib+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=0/IKtHvtUfdAprwwiZIAqWdyMzyiigcUYvkxESl7Jds=; b=rI143hcjLnFoH26L8lv9RyF16lcN4lmyPAz5sPkG0l7pfzzPKlr6rZR8zzfCUb3CtI admoAIi1jHx2dHmEsEZfL9ZMX2YgMTh8V1i44o38LNyNVmPwGPnYlgUsRbXv8yH84PWk uMGEXuiJCtgrKZmCxTbftOIEBGCcy8Z1HfdGkmxrXUsLlabagcG7XTEOLjq+FV9Rr/GE uV93SrTiKe9Wct8dYFcBsfhuBIcpJNoQ/TBaZ5LJhOwnvH3h0ACEfSCpPza4P2cS2S3k 4gIVIY64hgED4dHAVFAbShjrFAWIsBnMZWBCzeH3nD5tbSQTEEB1HT59+bct3OPi1PpL qLeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=F6Oy1KmT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e16-20020a056a001a9000b0053f6f9b00b7si17588605pfv.81.2022.10.19.02.07.46; Wed, 19 Oct 2022 02:08: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=F6Oy1KmT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229714AbiJSI6X (ORCPT + 99 others); Wed, 19 Oct 2022 04:58:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231951AbiJSI5E (ORCPT ); Wed, 19 Oct 2022 04:57: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 4225E356F0; Wed, 19 Oct 2022 01:53:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D6A4A61867; Wed, 19 Oct 2022 08:52:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7C55C433C1; Wed, 19 Oct 2022 08:52:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169530; bh=z8354MLPzt46BjyGsVWJYbQLbpGutp1mNQkt1bEaeCo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F6Oy1KmTEWygE+aLYJNUGLISV6huOfrks9lp9wupjtw6o0lOxX8jf5hkTvEId7ivV LJCLcc7fDH0uo11xtkBigd3My8cOHyKY4nSjF0V4elQx5QIHJaoJAmYh/e9XrX0saX pS+w5Xw45k7C7kxJj+QCtXwJr6uDmSei/yWIL1xE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christian Ansuel Marangi , Kalle Valo , Sasha Levin Subject: [PATCH 6.0 312/862] wifi: ath11k: fix peer addition/deletion error on sta band migration Date: Wed, 19 Oct 2022 10:26:39 +0200 Message-Id: <20221019083303.796631363@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106382632834725?= X-GMAIL-MSGID: =?utf-8?q?1747106382632834725?= From: Christian 'Ansuel' Marangi [ Upstream commit d673cb6fe6c03b2be157cc6c5db40481828d282d ] This patch try to fix the following error. Wed Jun 1 22:19:30 2022 kern.warn kernel: [ 119.561227] ath11k c000000.wifi: peer already added vdev id 0 req, vdev id 1 present Wed Jun 1 22:19:30 2022 kern.warn kernel: [ 119.561282] ath11k c000000.wifi: Failed to add peer: 28:c2:1f:xx:xx:xx for VDEV: 0 Wed Jun 1 22:19:30 2022 kern.warn kernel: [ 119.568053] ath11k c000000.wifi: Failed to add station: 28:c2:1f:xx:xx:xx for VDEV: 0 Wed Jun 1 22:19:31 2022 daemon.notice hostapd: wlan2: STA 28:c2:1f:xx:xx:xx IEEE 802.11: Could not add STA to kernel driver Wed Jun 1 22:19:31 2022 daemon.notice hostapd: wlan2: STA 28:c2:1f:xx:xx:xx IEEE 802.11: did not acknowledge authentication response Wed Jun 1 22:19:31 2022 daemon.notice hostapd: wlan1: AP-STA-DISCONNECTED 28:c2:1f:xx:xx:xx Wed Jun 1 22:19:31 2022 daemon.info hostapd: wlan1: STA 28:c2:1f:xx:xx:xx IEEE 802.11: disassociated due to inactivity Wed Jun 1 22:19:32 2022 daemon.info hostapd: wlan1: STA 28:c2:1f:xx:xx:xx IEEE 802.11: deauthenticated due to inactivity (timer DEAUTH/REMOVE) To repro this: - Have 2 Wifi with the same bssid and pass on different band (2.4 and 5GHz) - Enable 802.11r Fast Transaction with same mobility domain - FT Protocol: FT over the Air >From a openwrt system issue the command (with the correct mac) ubus call hostapd.wlan1 wnm_disassoc_imminent '{"addr":"28:C2:1F:xx:xx:xx"}' Notice the log printing the errors. The cause of this error has been investigated and we found that this is related to the WiFi Fast Transaction feature. We observed that this is triggered when the router tells the device to change band. In this case the device first auth to the other band and then the disconnect path from the prev band is triggered. This is problematic with the current rhash implementation since the addrs is used as key and the logic of "adding first, delete later" conflicts with the rhash logic. In fact peer addition will fail since the peer is already added and with that fixed a peer deletion will cause unitended effect by removing the peer just added. Current solution to this is to add additional logic to the peer delete, make sure we are deleting the correct peer taken from the rhash table (and fallback to the peer list) and for the peer add logic delete the peer entry for the rhash list before adding the new one (counting as an error only when a peer with the same vlan_id is asked to be added). With this change, a sta can correctly transition from 2.4GHz and 5GHZ with no drop and no error are printed. Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-01208-QCAHKSWPL_SILICONZ-1 Fixes: 7b0c70d92a43 ("ath11k: Add peer rhash table support") Signed-off-by: Christian 'Ansuel' Marangi Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220603164559.27769-1-ansuelsmth@gmail.com Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath11k/peer.c | 30 ++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/peer.c b/drivers/net/wireless/ath/ath11k/peer.c index 9e22aaf34b88..1ae7af02c364 100644 --- a/drivers/net/wireless/ath/ath11k/peer.c +++ b/drivers/net/wireless/ath/ath11k/peer.c @@ -302,6 +302,21 @@ static int __ath11k_peer_delete(struct ath11k *ar, u32 vdev_id, const u8 *addr) spin_lock_bh(&ab->base_lock); peer = ath11k_peer_find_by_addr(ab, addr); + /* Check if the found peer is what we want to remove. + * While the sta is transitioning to another band we may + * have 2 peer with the same addr assigned to different + * vdev_id. Make sure we are deleting the correct peer. + */ + if (peer && peer->vdev_id == vdev_id) + ath11k_peer_rhash_delete(ab, peer); + + /* Fallback to peer list search if the correct peer can't be found. + * Skip the deletion of the peer from the rhash since it has already + * been deleted in peer add. + */ + if (!peer) + peer = ath11k_peer_find(ab, vdev_id, addr); + if (!peer) { spin_unlock_bh(&ab->base_lock); mutex_unlock(&ab->tbl_mtx_lock); @@ -312,8 +327,6 @@ static int __ath11k_peer_delete(struct ath11k *ar, u32 vdev_id, const u8 *addr) return -EINVAL; } - ath11k_peer_rhash_delete(ab, peer); - spin_unlock_bh(&ab->base_lock); mutex_unlock(&ab->tbl_mtx_lock); @@ -372,8 +385,17 @@ int ath11k_peer_create(struct ath11k *ar, struct ath11k_vif *arvif, spin_lock_bh(&ar->ab->base_lock); peer = ath11k_peer_find_by_addr(ar->ab, param->peer_addr); if (peer) { - spin_unlock_bh(&ar->ab->base_lock); - return -EINVAL; + if (peer->vdev_id == param->vdev_id) { + spin_unlock_bh(&ar->ab->base_lock); + return -EINVAL; + } + + /* Assume sta is transitioning to another band. + * Remove here the peer from rhash. + */ + mutex_lock(&ar->ab->tbl_mtx_lock); + ath11k_peer_rhash_delete(ar->ab, peer); + mutex_unlock(&ar->ab->tbl_mtx_lock); } spin_unlock_bh(&ar->ab->base_lock); From patchwork Wed Oct 19 08:26:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4640 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212214wrs; Wed, 19 Oct 2022 02:07:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5JoNS1uC4muNmVWpV+KhhEJKW7ozSPBniVs4u6e7/yHDdLe9ieWeDVJDQD7HzNrQPuUd4P X-Received: by 2002:a05:6402:164c:b0:459:1e2e:e742 with SMTP id s12-20020a056402164c00b004591e2ee742mr6323971edx.125.1666170420614; Wed, 19 Oct 2022 02:07:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170420; cv=none; d=google.com; s=arc-20160816; b=faEH9w971vrAbd9CiVP07NvjkIhg6wzkK9OyG3Pw0RUB4wiq+lPDJAl2r5AUhli7FG s0hTQa7YmuzbVezY6PKnkYKDzhdpJgCoN3hMSX7BWEzLfXu5yMZ3C5C0rUjwIepXbniT 2oCv7Ak9FHXtwiHJsaM1ymyjNz0Dx3fWfPSszwhA4YUCu9WHeDLcXiHHScVaBY47Av5d 0QYXmrdivTFopDHqvtCpfTHlByjCnjK5t6xpRt/mLpavg0oCqf3IJw79DsWqg3nP0nD7 lZm3GttzJFXLLbRBZ5JPeDqFSJvaW5Vgl0wK5PD/ePFe4GvYf4tdtx2Fb27Jl1PGjba2 uRaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FAGbx/MxnqFgHELDtcN+iShERdidZuWmFv33ps23Soc=; b=gAttnbOiHVtBqTzvioe6R98OA6AlzZzgE2Z1ruNRoUpoWg5hnVec3aXY8r6Ig+QKNV u7oQfITS6OWGWjjWi4WnOKv94ow0620gR8wxZso2yvNc4RNCUIoDtK1S1HOfjhq5fM8k 13umcT+pdjRO+yvUUjv/7BMs7r7OSHeQxBz0+KeNZA7muAcUm8ow3tNBLU6Fq/3GwV8d DbQJEkgdEzSUooHMnK7f8RM9XL93YP3QB0noYYYf2wwlIr2TgkgRYtUlIl54XgFuP5KY TSEzVcoMkwmNi6h2uUNv2VZqp35i4Tv38UipiPcr9dkWyzBpcI0G473iVXJdzNElSRRY PJ8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="tYbPcJE/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g7-20020a1709065d0700b007316ac034a1si11449001ejt.831.2022.10.19.02.06.24; Wed, 19 Oct 2022 02:07: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="tYbPcJE/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232042AbiJSI6K (ORCPT + 99 others); Wed, 19 Oct 2022 04:58:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231942AbiJSI5D (ORCPT ); Wed, 19 Oct 2022 04:57: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 76E0E9E0D1; Wed, 19 Oct 2022 01:53: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 8B0D061877; Wed, 19 Oct 2022 08:52:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91766C433D6; Wed, 19 Oct 2022 08:52:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169533; bh=L++NyLPF29P94YsyQAgGB6D++lyuxhHufzqYhYkdOmI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tYbPcJE/qdglMsQRKRRz3cLnodVDnkXApr20n0pn4y3U90WV0yHldxJsUsRaQ+LaN TBgFyewimMSbGhM/l+hxYaRJPx7cdGY2J7E+Sy9iG8dXapENtIZ5PGn29yeKzPOI3P YsrN71BRbNmbAZjoXv2viIFGs00xHrYAx91P0eZ0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Luciano_Le=C3=A3o?= , Borislav Petkov , " =?utf-8?q?N=C3=ADcolas_F_=2E__R_=2E__A_=2E_?= =?utf-8?q?_Prado?= " , Sasha Levin Subject: [PATCH 6.0 313/862] x86/cpu: Include the header of init_ia32_feat_ctl()s prototype Date: Wed, 19 Oct 2022 10:26:40 +0200 Message-Id: <20221019083303.846947248@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106314583075302?= X-GMAIL-MSGID: =?utf-8?q?1747106314583075302?= From: Luciano Leão [ Upstream commit 30ea703a38ef76ca119673cd8bdd05c6e068e2ac ] Include the header containing the prototype of init_ia32_feat_ctl(), solving the following warning: $ make W=1 arch/x86/kernel/cpu/feat_ctl.o arch/x86/kernel/cpu/feat_ctl.c:112:6: warning: no previous prototype for ‘init_ia32_feat_ctl’ [-Wmissing-prototypes] 112 | void init_ia32_feat_ctl(struct cpuinfo_x86 *c) This warning appeared after commit 5d5103595e9e5 ("x86/cpu: Reinitialize IA32_FEAT_CTL MSR on BSP during wakeup") had moved the function init_ia32_feat_ctl()'s prototype from arch/x86/kernel/cpu/cpu.h to arch/x86/include/asm/cpu.h. Note that, before the commit mentioned above, the header include "cpu.h" (arch/x86/kernel/cpu/cpu.h) was added by commit 0e79ad863df43 ("x86/cpu: Fix a -Wmissing-prototypes warning for init_ia32_feat_ctl()") solely to fix init_ia32_feat_ctl()'s missing prototype. So, the header include "cpu.h" is no longer necessary. [ bp: Massage commit message. ] Fixes: 5d5103595e9e5 ("x86/cpu: Reinitialize IA32_FEAT_CTL MSR on BSP during wakeup") Signed-off-by: Luciano Leão Signed-off-by: Borislav Petkov Reviewed-by: Nícolas F. R. A. Prado Link: https://lore.kernel.org/r/20220922200053.1357470-1-lucianorsleao@gmail.com Signed-off-by: Sasha Levin --- arch/x86/kernel/cpu/feat_ctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/feat_ctl.c b/arch/x86/kernel/cpu/feat_ctl.c index 993697e71854..03851240c3e3 100644 --- a/arch/x86/kernel/cpu/feat_ctl.c +++ b/arch/x86/kernel/cpu/feat_ctl.c @@ -1,11 +1,11 @@ // SPDX-License-Identifier: GPL-2.0 #include +#include #include #include #include #include -#include "cpu.h" #undef pr_fmt #define pr_fmt(fmt) "x86/cpu: " fmt From patchwork Wed Oct 19 08:26: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: 4648 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212353wrs; Wed, 19 Oct 2022 02:07:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4KLmDwDtFUwLt9P2rioprhI5lAat9tR+INgf9lYZJTWMjYUmSxMfKHnxT4h7Q7gef/BsGw X-Received: by 2002:a17:906:fe46:b0:730:ca2b:cb7b with SMTP id wz6-20020a170906fe4600b00730ca2bcb7bmr6020673ejb.703.1666170438505; Wed, 19 Oct 2022 02:07:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170438; cv=none; d=google.com; s=arc-20160816; b=1I8Zh3U+YRrWK/0HKnm/4PYX+ACkZOXxPWhEZHjIba7fxKK+Ci1+iduHXobafcypGN F/3T0SYhObFAgLhcqH2sqbg2f6/XhP31ytQZemPr0YkmrPxs8gjHhomrAwIjUdMKFyQA TRdtrB5zVGUFLs7y+J/L7BmFWqfEGKB/m1fQZKDE9B81/xMSuNIP/tQ318Eo9kLevPDa N0MGBJtF+Nma296WPwmeq+vBmifFG9TbYgPuLz+4GC0141kG3IFjHzvZ1D8cz6d4TDcr HH0DGkG0bCXKL4iWOFLPH+L21wDW2Gk5qpwWVU/UyIyF/WK2Yj2u9R5MMM0PFesXzcH+ ipZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8d+NLM5dxkX/g9BIofeb+8e/SjWtSV3LRCTJNljLySU=; b=lrf331UsYlhfknT1uUDF42TVJ5pdHmD1IgvdjL1e2DBEH0qTZhTMzKER4Ng46n1yYD dTMO5p8h9ZhwifiWzV46HqIPrNQX29pX0jaqIX/6h4/nRZvdL3a6p5i/d1OgnRjcLQEr Z2F2T4g7jBGI59GzMHdKXV191uHLgrZsm6A1DlhFe0sh5cqC+m7IZfsa+C4JkNyZbIlF 59w4OZryC0jdfdp29RDA5IN0RVE7xouKXLYmrxCJzpyKJeIw97c1Jeo9xOeAg3/QrNKQ yLnTkYJCYAUbANrGJy6znn7q2mQe9yMrSqadDVf+LRqCVjV7bak5VpG+KLadnfk/Pdkf am3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=h6dbdmGi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id go38-20020a1709070da600b0078d8614e809si14583020ejc.504.2022.10.19.02.06.47; Wed, 19 Oct 2022 02:07: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=h6dbdmGi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231899AbiJSJAG (ORCPT + 99 others); Wed, 19 Oct 2022 05:00:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229746AbiJSI6b (ORCPT ); Wed, 19 Oct 2022 04:58:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 285889C7C8; Wed, 19 Oct 2022 01:53:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 21A4E61874; Wed, 19 Oct 2022 08:52:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3807EC433D6; Wed, 19 Oct 2022 08:52:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169535; bh=/MMQJwUCkSGAQuZsDumh02OKZlu0Vv4GwX0O4ak+tV0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h6dbdmGimpzAsc/ImkadAsQXfpeNiX3MA4hwuJSv4dN71JKnkT1PgiOEZVcoO90Gd xszGq/yldhdCucsWun5ppiaN6DXXCj2DQ28cJlaw0+9kdWTlDt1YaBeN8AQW3pLL9o U1sDxb7DsEaeBlMAK3kGRGyHQgf6XfotxpS0bsos= 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 6.0 314/862] spi: cadence-quadspi: Fix PM disable depth imbalance in cqspi_probe Date: Wed, 19 Oct 2022 10:26:41 +0200 Message-Id: <20221019083303.896654051@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106333714491587?= X-GMAIL-MSGID: =?utf-8?q?1747106333714491587?= From: Zhang Qilong [ Upstream commit 4d0ef0a1c35189a6e8377d8ee8310ea5ef22c5f3 ] 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:73d5fe0462702 ("spi: cadence-quadspi: Remove spi_master_put() in probe failure path") Signed-off-by: Zhang Qilong Link: https://lore.kernel.org/r/20220924121310.78331-2-zhangqilong3@huawei.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-cadence-quadspi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-cadence-quadspi.c b/drivers/spi/spi-cadence-quadspi.c index e12ab5b43f34..447230547945 100644 --- a/drivers/spi/spi-cadence-quadspi.c +++ b/drivers/spi/spi-cadence-quadspi.c @@ -1645,7 +1645,7 @@ static int cqspi_probe(struct platform_device *pdev) pm_runtime_enable(dev); ret = pm_runtime_resume_and_get(dev); if (ret < 0) - return ret; + goto probe_pm_failed; ret = clk_prepare_enable(cqspi->clk); if (ret) { @@ -1740,6 +1740,7 @@ static int cqspi_probe(struct platform_device *pdev) clk_disable_unprepare(cqspi->clk); probe_clk_failed: pm_runtime_put_sync(dev); +probe_pm_failed: pm_runtime_disable(dev); return ret; } From patchwork Wed Oct 19 08:26: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: 5031 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp246533wrs; Wed, 19 Oct 2022 03:38:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7BcPA8kqzcNL6SPHiBA0rYyrn/6BZ86bhx7G/Mtv415xfJESeQoqlgB0Dq/Q/OLqQCC1xb X-Received: by 2002:a17:906:8474:b0:78d:ce9c:284e with SMTP id hx20-20020a170906847400b0078dce9c284emr6387860ejc.702.1666175911311; Wed, 19 Oct 2022 03:38:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666175911; cv=none; d=google.com; s=arc-20160816; b=p+ExnodSK9yJ4L8hZs012Ter5djFTXnmJ5xSn3B25dRbQb1o0IWfqkH8gBk+PN1Rgz M5F4kSpvVrXzZhHDyMrxbpYlIXGqi37aNkeyphV1dWffw7uO65LnmxePa1GfpX4ZLI/8 ryOSuXtqceHU4xBpInmL7Q3BGgMlnTGrcowLhwLAKkypGQYD86CFamGbUSpWEb99l9zS ZEMz0LhiA4cUlwaa6WskZ19x2BLm3oAjwo9qtfjZt8HPquRCN0M98qevFvcXdHeQETR4 UGuARys7epo1DldQ7BlSuJOJHSInvL2R99dvhqskYTFVZiQ24inJGtHof1uka1Q/2q7d Ydkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9Vy9pEX22U2fIvLJ9gZXt6BGMwqqLoqhUmM8Cm9n57M=; b=0d8ZMjqepPID7KuIIb4cQ1WSdHXhJahkiubr8vInt+vmUmAD4LE8D2f2R5Hzus9yK6 PZHisCEepD7Bd0z6yUIRZuS45ayWB1IR6EhLbM2FDLJuR8PLo7XBgmEs7jkrhlb+8gRv qcLgM2TedMtO97WXLBZHcCo65qltafaDhF/xkfSb+qOXZTRYY3dMa0cMlGGvUeyEqiMc uSyLdsHUyytj25EClLr1oXTLd8lR8mayAGD2na3G79BfDwUEY9LykilcPj7ODpWq8/wR Q7g0Uq8Dz1gsjtNOE0zdtI+qvhgxKw7hHNmwj6GtPqhASmI65dz1PEP77cPSGZtRXAAb z9Kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uKYl3loo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o18-20020aa7c7d2000000b00458ec94d128si12442891eds.513.2022.10.19.03.38.06; Wed, 19 Oct 2022 03:38: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=uKYl3loo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231421AbiJSKg6 (ORCPT + 99 others); Wed, 19 Oct 2022 06:36:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231163AbiJSKge (ORCPT ); Wed, 19 Oct 2022 06:36:34 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E123BAE876; Wed, 19 Oct 2022 03:15: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 ams.source.kernel.org (Postfix) with ESMTPS id 5B4E2B823B3; Wed, 19 Oct 2022 08:52:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CDA1BC433D6; Wed, 19 Oct 2022 08:52:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169538; bh=ts0uQ0ZHszs3Hfyb7b4wNuPKsVvQ1XetjCglba3KlkA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uKYl3loowQwA1nGQvvLASzZIhaBa/HfA5+fYyrDopOf1o6RxAb+lXixzzztlKA3VE ZRzMFvwYovkDxaCaPUz4t7lCM1NaBSCkv5UGU8yxucsyivHDbEkZXFaYQh6frIGrIl ELPdvpt0d1sRH7YPgI+K2ZIgPnmojYA8a3tayQyk= 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 6.0 315/862] spi: dw: Fix PM disable depth imbalance in dw_spi_bt1_probe Date: Wed, 19 Oct 2022 10:26:42 +0200 Message-Id: <20221019083303.943891998@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112072402239909?= X-GMAIL-MSGID: =?utf-8?q?1747112072402239909?= From: Zhang Qilong [ Upstream commit 618d815fc93477b1675878f3c04ff32657cc18b4 ] 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:abf00907538e2 ("spi: dw: Add Baikal-T1 SPI Controller glue driver") Signed-off-by: Zhang Qilong Link: https://lore.kernel.org/r/20220924121310.78331-3-zhangqilong3@huawei.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-dw-bt1.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-dw-bt1.c b/drivers/spi/spi-dw-bt1.c index c06553416123..3fb89dee595e 100644 --- a/drivers/spi/spi-dw-bt1.c +++ b/drivers/spi/spi-dw-bt1.c @@ -293,8 +293,10 @@ static int dw_spi_bt1_probe(struct platform_device *pdev) pm_runtime_enable(&pdev->dev); ret = dw_spi_add_host(&pdev->dev, dws); - if (ret) + if (ret) { + pm_runtime_disable(&pdev->dev); goto err_disable_clk; + } platform_set_drvdata(pdev, dwsbt1); From patchwork Wed Oct 19 08:26: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: 4643 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212269wrs; Wed, 19 Oct 2022 02:07:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4G7CzSxboFBVWN8GQoE28cvRhwxyZVgET1Z6P9BUCYw2Xd+HEu6nKn0+bVWvc2klaeP5xu X-Received: by 2002:a05:6402:d75:b0:459:fad8:fbf with SMTP id ec53-20020a0564020d7500b00459fad80fbfmr6370118edb.0.1666170427634; Wed, 19 Oct 2022 02:07:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170427; cv=none; d=google.com; s=arc-20160816; b=jXbzAWR1iOQCCVBTExYg7SGmdKZoM1Nq9lfEuWZDScwjasrDrFftf2x896vNarOBuB 3ubisIujqCKO6BXMEA0Lg7gEBJ9W7cLRvtXyJHW3SzEarDqcEvoI4zC/Dn6YXl+yrTMy 6zbM6oeAWtVPOdQ/cjXc0lWuTfNDd2A5Aou9YkKW5iJXKADJVJrMTNFr8oOPSToCVTpt hGYbOAQvwG9Hz0kom9cMef7m2JQiK+KpFs5hkis2+IHCq0qDGXYISP4x8VRmteVaz+Qr GT3Lk/mLGiZZTG4x/irgCDDm4Dvmf1gLFj1HnkloL+zLxOsZkLb946BeAHpOZ4qBjtA8 choQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=AvkYwu7Y3jkvZ6alWLtfagXvYipmN3O5BMvV5lnyp0g=; b=fo0hwwcB4kAbBMm3XCrftKwtJvPs2jB59YJ8/qq32X6Cnqme8awAHjWhoqYqorDtfD e0/UdwVaW1kAtwk/BFZi/vh/MaXQrR8VroLA2pUdLTDT0+GBiN/zNwNnS3DnuZDbC5x4 tCvunNuk9iS29rOoPgv9DzUGVHvrHbmUGBQNmxF6rtRgpl7uPmR9vxDBL8oxJGvPNu4g BL4xP0Hi8gBxaxksxcBKmBv9ZVqdoGkcjf4z7kHravw4uiuW9hzHp1mugN4BIG4ycrux lvbHXOiqcmNxVefNvsBfXhWi3fRAmQPxSh09fbveR5jYmpXmFv9gNKkknQ9achHy8E5S bEbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vmCu7S4g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ht22-20020a170907609600b0078de8d119d5si14769072ejc.899.2022.10.19.02.06.34; Wed, 19 Oct 2022 02:07: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=vmCu7S4g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231971AbiJSI6i (ORCPT + 99 others); Wed, 19 Oct 2022 04:58:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231967AbiJSI5e (ORCPT ); Wed, 19 Oct 2022 04:57: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 CC92A15FC3; Wed, 19 Oct 2022 01:53: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 750CB6181D; Wed, 19 Oct 2022 08:52:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89B50C433D6; Wed, 19 Oct 2022 08:52:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169540; bh=qfRkPOfBXEFDRbBTB/Q/Jpv5q9piXIqG1CnSctn/W4I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vmCu7S4geP7VtF91JBYzMEkikmhCXk1uW4RJa0lP+gbPdstsaJaHF9luWTMRYzArf 6X5S7fEXSGR6exgLgTcHfLexNqYfy2w3xqfq+Szob122GL/pUBw+PdVMdPmrjbWI+c 3mq76vMVEqs5iEjENXKq+kP8Ia0B3SllgEvSVSn4= 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 6.0 316/862] spi/omap100k:Fix PM disable depth imbalance in omap1_spi100k_probe Date: Wed, 19 Oct 2022 10:26:43 +0200 Message-Id: <20221019083303.993259120@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106322226308190?= X-GMAIL-MSGID: =?utf-8?q?1747106322226308190?= 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 20b047172965..061f7394e5b9 100644 --- a/drivers/spi/spi-omap-100k.c +++ b/drivers/spi/spi-omap-100k.c @@ -412,6 +412,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 Wed Oct 19 08:26: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: 5039 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp247044wrs; Wed, 19 Oct 2022 03:39:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6SFtJOxSTcl94Q7OIVbaiYKDUDHdeYd9NfN7wnsipBhUr2giiEbmModabm3eMj/Suz3u0F X-Received: by 2002:a17:907:d02:b0:78d:b3cd:a277 with SMTP id gn2-20020a1709070d0200b0078db3cda277mr6098639ejc.622.1666175986293; Wed, 19 Oct 2022 03:39:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666175986; cv=none; d=google.com; s=arc-20160816; b=RwxzQiZ0Bilv4ZPqP37nSsIkAJNqTLh0zFzhG3pLIU+VAG58Ev/PhILnsgbPLqxN/y 9miOl3sdKrDG3Ot20YrrvfTq22cVS+hnm9mgBVXFEIszd0AAkfsRgOt8Nk4gv2gZTtFm XQ3NIG8KPSN7XFMcWiD0HWuYv9Xk6PWmK2dCUIi86cAn0D55kGE30mOqiULW5aY+Nrab JtHBRnwe6GrnhSjEk+73CBG2bA55hpfbo9qegVl1DNPKr4QesmdZA1DblA+FWZnZQlzx Z1AOwp8MAMv7vSXs66lVskdFu6qt3lju0P7p3gzK1rZqZGXcxcSV8NpVLICBhOzl238C YJDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Z8gj8aVbf9h8X59FytrCHBlrPuLInsMxZ63iHvnXq3g=; b=TkKog7LoxVtUHKmVSjaAg1d+aJe86h0pRqpQrJafCVKFpcJrhPU5D7GzTRzLdRXgDU 5IHTIGsYScCoHdoDHIaht1zJw/B1T3MMPzb6kDfE21Ohjo2+WX220LoTj6+5bKhML6mM CYrWQc1rxnkOgcRnXqfKxxT8hldm122yPrfL34bk3pumFx4uzTHZm2ngEUTfhLbHQRLt JdpGKcWvxGnnrIy+YUP6gKgoZ3K2XCVAnaBONmxwjyhKMtGpgLKw7x67AIybfU7ErmB6 Jklhvg8ItbJ7fE1R8OLKQ4zHQvWhh2D4XzJrB6gVB2vrHAn8uX/G6cFBYafBisGXkBuq DRBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ns+QLlvZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a056402248b00b0044e8fe826a0si12477350eda.156.2022.10.19.03.39.21; Wed, 19 Oct 2022 03:39: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=Ns+QLlvZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231757AbiJSKhP (ORCPT + 99 others); Wed, 19 Oct 2022 06:37:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231671AbiJSKgk (ORCPT ); Wed, 19 Oct 2022 06:36:40 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89CB0167D1; Wed, 19 Oct 2022 03:15:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D3503B823AD; Wed, 19 Oct 2022 08:52:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3251CC433C1; Wed, 19 Oct 2022 08:52:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169543; bh=84VswrwwfjQvWqlHGuaNrTFLiXO7xcJlvXZBgToTAdI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ns+QLlvZijcrn6u4w8H1Sodzd2kb+ZALnJBZKizOakRDy5vK6xnb5L4l+ApTckLnQ yKXGRC/DXdBo7JnudAEdp9zcj1gUaKsN2xI9q32Nw2F6Z+i9PNQ8cNZqigJjNM+i4B FBOK/m6uJ/hRHcjHF6RndzioYZF7I6Rdw3VgjCFg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liu Jian , Daniel Borkmann , John Fastabend , Sasha Levin Subject: [PATCH 6.0 317/862] skmsg: Schedule psock work if the cached skb exists on the psock Date: Wed, 19 Oct 2022 10:26:44 +0200 Message-Id: <20221019083304.026586017@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112151399356630?= X-GMAIL-MSGID: =?utf-8?q?1747112151399356630?= From: Liu Jian [ Upstream commit bec217197b412d74168c6a42fc0f76d0cc9cad00 ] In sk_psock_backlog function, for ingress direction skb, if no new data packet arrives after the skb is cached, the cached skb does not have a chance to be added to the receive queue of psock. As a result, the cached skb cannot be received by the upper-layer application. Fix this by reschedule the psock work to dispose the cached skb in sk_msg_recvmsg function. Fixes: 604326b41a6f ("bpf, sockmap: convert to generic sk_msg interface") Signed-off-by: Liu Jian Signed-off-by: Daniel Borkmann Acked-by: John Fastabend Link: https://lore.kernel.org/bpf/20220907071311.60534-1-liujian56@huawei.com Signed-off-by: Sasha Levin --- net/core/skmsg.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/net/core/skmsg.c b/net/core/skmsg.c index 188f8558d27d..ca70525621c7 100644 --- a/net/core/skmsg.c +++ b/net/core/skmsg.c @@ -434,8 +434,10 @@ int sk_msg_recvmsg(struct sock *sk, struct sk_psock *psock, struct msghdr *msg, if (copied + copy > len) copy = len - copied; copy = copy_page_to_iter(page, sge->offset, copy, iter); - if (!copy) - return copied ? copied : -EFAULT; + if (!copy) { + copied = copied ? copied : -EFAULT; + goto out; + } copied += copy; if (likely(!peek)) { @@ -455,7 +457,7 @@ int sk_msg_recvmsg(struct sock *sk, struct sk_psock *psock, struct msghdr *msg, * didn't copy the entire length lets just break. */ if (copy != sge->length) - return copied; + goto out; sk_msg_iter_var_next(i); } @@ -477,7 +479,9 @@ int sk_msg_recvmsg(struct sock *sk, struct sk_psock *psock, struct msghdr *msg, } msg_rx = sk_psock_peek_msg(psock); } - +out: + if (psock->work_state.skb && copied > 0) + schedule_work(&psock->work); return copied; } EXPORT_SYMBOL_GPL(sk_msg_recvmsg); From patchwork Wed Oct 19 08:26: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: 5091 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp249716wrs; Wed, 19 Oct 2022 03:46:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5JK91jVLMdwRGKw00pZp8ldUL7XTI7s7rgNz9sXB1ZVFQ3SbS6KKdk+C9iHBASoC7V8D5u X-Received: by 2002:a17:902:b942:b0:178:be25:203f with SMTP id h2-20020a170902b94200b00178be25203fmr8026873pls.101.1666176419064; Wed, 19 Oct 2022 03:46:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176419; cv=none; d=google.com; s=arc-20160816; b=CmOT+fLi/ooj6Hrp6akqLCq/2UCrvxciJVwsC2DuCalg7BIuHEZsOJnPrHDLpeidYD vyqzqqDILN3kbhF7NcuTuHm5KiWLavvsyfCNT5PLY0MRnN5ee5dnKuiA/dDx7lUi+Npz sB4cYQVZWut+VgwU9yaBEvRD51J0gTXeBbDN59NQc8eeTsDB9iOn49kTp6K5me/wsRvm J8/S7bF2u4xepQBzWPXqwngqiOP7zO6XAZBcPvk3cDJE6GE0x4tHUBj6WFQaQWaY7328 Wq4GdNopyzWPj7BbiuM9uWewKqw3J3fqfUD9SK39c78YRnb4yMXKqnjWGFNBjZX2cxqo ntWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Nfa+HXInf3+9WrIfRzS6/6EK+owEXMGAUIzzaIB4kIM=; b=vAod7XK7WcyAkrw6D4g75H/r3rEWbVZ+cLtoyt6Ps4w5MBQcwZM1zpARQ1Y1saZMz2 PYT4IqzayCO7bJwC12b/8Bou007BSjfvye6dr+IreFKe/XVKMklgZsCikK8a8bH9zHEc AX1aRdS5IUYcyxOLEQ3HOOoV6gGpjVMh4X5LOpTI1gnhDGsTc3oojUHg/JSgWLJMs0L5 gc/TBcZ0et8UTbgDDW8hgRxK3YYo6uHfVt1vMPbULWvQRhbMrlBaOe79zmFR7exF6XMK fgR8T0i+xtkN96lAfuhOlMXqBsBo3JvjaNAdauVJwYazKgi1xhqy4nyiDpadXiZ8E4ht iG0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uKqM23aa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l19-20020a17090b079300b0020d67aeb299si22390002pjz.53.2022.10.19.03.46.46; Wed, 19 Oct 2022 03:46: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=uKqM23aa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233219AbiJSKq0 (ORCPT + 99 others); Wed, 19 Oct 2022 06:46:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233150AbiJSKoa (ORCPT ); Wed, 19 Oct 2022 06:44:30 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BDEF1578BD; Wed, 19 Oct 2022 03:20: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 0C018B823B0; Wed, 19 Oct 2022 08:52:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75ED2C433C1; Wed, 19 Oct 2022 08:52:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169546; bh=dVDJSEzRrPtFqIsoE3zXwmOWCE8M6Zw0BQZP6LOW0Mw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uKqM23aaQh5eGBkp3tyKgTLhQQtBauVikuDueIY3SJdsxmi/vXwM1VynbO/bBGgQu xtXMUUCmxbG6ok1UlwVArRAR7gos7OlEF7+cfhDAfGVSA97lDa6EfNaU5T2vgkshMO 25MOW0xomKMxwbFX12AEo/abSYFJbV5DjXGM6c/A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiaomeng Tong , Kalle Valo , Sasha Levin Subject: [PATCH 6.0 318/862] cw1200: fix incorrect check to determine if no element is found in list Date: Wed, 19 Oct 2022 10:26:45 +0200 Message-Id: <20221019083304.064274432@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112604956196486?= X-GMAIL-MSGID: =?utf-8?q?1747112604956196486?= From: Xiaomeng Tong [ Upstream commit 86df5de5c632d3bd940f59bbb14ae912aa9cc363 ] The bug is here: "} else if (item) {". The list iterator value will *always* be set and non-NULL by list_for_each_entry(), so it is incorrect to assume that the iterator value will be NULL if the list is empty or no element is found in list. Use a new value 'iter' as the list iterator, while use the old value 'item' as a dedicated pointer to point to the found element, which 1. can fix this bug, due to now 'item' is NULL only if it's not found. 2. do not need to change all the uses of 'item' after the loop. 3. can also limit the scope of the list iterator 'iter' *only inside* the traversal loop by simply declaring 'iter' inside the loop in the future, as usage of the iterator outside of the list_for_each_entry is considered harmful. https://lkml.org/lkml/2022/2/17/1032 Fixes: a910e4a94f692 ("cw1200: add driver for the ST-E CW1100 & CW1200 WLAN chipsets") Signed-off-by: Xiaomeng Tong Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220413091723.17596-1-xiam0nd.tong@gmail.com Signed-off-by: Sasha Levin --- drivers/net/wireless/st/cw1200/queue.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/st/cw1200/queue.c b/drivers/net/wireless/st/cw1200/queue.c index e06da4b3b0d4..805a3c1bf8fe 100644 --- a/drivers/net/wireless/st/cw1200/queue.c +++ b/drivers/net/wireless/st/cw1200/queue.c @@ -91,23 +91,25 @@ static void __cw1200_queue_gc(struct cw1200_queue *queue, bool unlock) { struct cw1200_queue_stats *stats = queue->stats; - struct cw1200_queue_item *item = NULL, *tmp; + struct cw1200_queue_item *item = NULL, *iter, *tmp; bool wakeup_stats = false; - list_for_each_entry_safe(item, tmp, &queue->queue, head) { - if (time_is_after_jiffies(item->queue_timestamp + queue->ttl)) + list_for_each_entry_safe(iter, tmp, &queue->queue, head) { + if (time_is_after_jiffies(iter->queue_timestamp + queue->ttl)) { + item = iter; break; + } --queue->num_queued; - --queue->link_map_cache[item->txpriv.link_id]; + --queue->link_map_cache[iter->txpriv.link_id]; spin_lock_bh(&stats->lock); --stats->num_queued; - if (!--stats->link_map_cache[item->txpriv.link_id]) + if (!--stats->link_map_cache[iter->txpriv.link_id]) wakeup_stats = true; spin_unlock_bh(&stats->lock); cw1200_debug_tx_ttl(stats->priv); - cw1200_queue_register_post_gc(head, item); - item->skb = NULL; - list_move_tail(&item->head, &queue->free_pool); + cw1200_queue_register_post_gc(head, iter); + iter->skb = NULL; + list_move_tail(&iter->head, &queue->free_pool); } if (wakeup_stats) From patchwork Wed Oct 19 08:26:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5053 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp247787wrs; Wed, 19 Oct 2022 03:41:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6z9rbJ8M8rK3P/fnc2PSxOa3yGnhmUVIGMDeDe78VuUnv6GHgx/tgsq2Mylyk5z9pcmPEi X-Received: by 2002:a17:907:6e9e:b0:78c:5533:4158 with SMTP id sh30-20020a1709076e9e00b0078c55334158mr5857191ejc.417.1666176111488; Wed, 19 Oct 2022 03:41:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176111; cv=none; d=google.com; s=arc-20160816; b=e12ctKZqORYhpX2OgvkEFprvW+JtQTRe4gfejoUr5bxa9ONl7aqzaMMp1dYQs59n1q +2EDZmKA5IoEU002dLdM+11fo6AjTAr47YC5Yvps9K+d+wmX5QSK5HiE2oicRuwA5Z6u +Ib2yBNnOiH+/41VN7FwgtIBdPUxYbM2BexC/vN6NSr8Xqb/8ZlJeLlvJkit5zrPUPv/ RXlAra4GfM5xR47LzpmVTetiKCkjVnmKDff4Mr1L/2G41eiGpyJ5CwbVzLd42K1qDIXG 6y/lM2/+FQpJ/1oa7xiUw74tx+w2VY/lJmTygt7tvX06BwVkJ++fmKuwC0A1nG+ZQoRl moqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wxxECDAQGzigeSeZLPf7PBJXIf8D8jHRjdGKI7sgdY0=; b=Ly8475swc60UHOC2mtxjW5sRm7GIqQxv0Ysn7I18/Sm5tzBLvufT0g3WxXl09978IM MofDQXGYibK1t86wWMQQdMZ9pX7BkdwoFEbIZQSokg6DVGTveE65BUsX+JuMyghzPDty CiyBRagKD6vO6aH0A+t7hxB1nEkpc6Hvl9zRltt8sArPK6xMnqsOwUfVjmS+6HNiiyca HG4c84B/ZDeH8N9gjcUyv1zo0q4hcnkjRnGeinqBpRjopPNVtzu39rIIigeWTDAa1ayt 6+OuPivH4682+Kpw/+m+Da9l7mEG3nECyQ1hO8eacEzXc2CbijPJvkSyuvdSAEejSpBU 8Mdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="p3ddpY/w"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q4-20020a50aa84000000b00458b87a0919si13082049edc.114.2022.10.19.03.41.25; Wed, 19 Oct 2022 03:41: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="p3ddpY/w"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231864AbiJSKkp (ORCPT + 99 others); Wed, 19 Oct 2022 06:40:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231855AbiJSKjt (ORCPT ); Wed, 19 Oct 2022 06:39:49 -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 C1D8E15745E; Wed, 19 Oct 2022 03:18: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 354FAB823B2; Wed, 19 Oct 2022 08:52:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 81200C433C1; Wed, 19 Oct 2022 08:52:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169549; bh=LoFmpQ3886X+NWnu6AizYWHdAbOt4zyiwxpdLya/P7g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p3ddpY/wQ+mwcN54Lvk0gfa+CEaQu6qV2pokV8j1sRAfVDa9n1Ey3oBeD8k96tOHI /kGeqAG54j6LOqtPGGfc5oVyTKfEn8qsWjJl8cbQzpwg5J4n/WzF3CSB9ogw+uTNNo RRy2UAom/LwwgZOzCwXqcnthdC2CPYIgOLQGhl+A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rgensen?= , Andrii Nakryiko , Daniel Borkmann , Sasha Levin Subject: [PATCH 6.0 319/862] libbpf: Dont require full struct enum64 in UAPI headers Date: Wed, 19 Oct 2022 10:26:46 +0200 Message-Id: <20221019083304.107157180@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112282201218910?= X-GMAIL-MSGID: =?utf-8?q?1747112282201218910?= From: Andrii Nakryiko [ Upstream commit 87dbdc230d162bf9ee1ac77c8ade178b6b1e199e ] Drop the requirement for system-wide kernel UAPI headers to provide full struct btf_enum64 definition. This is an unexpected requirement that slipped in libbpf 1.0 and put unnecessary pressure ([0]) on users to have a bleeding-edge kernel UAPI header from unreleased Linux 6.0. To achieve this, we forward declare struct btf_enum64. But that's not enough as there is btf_enum64_value() helper that expects to know the layout of struct btf_enum64. So we get a bit creative with reinterpreting memory layout as array of __u32 and accesing lo32/hi32 fields as array elements. Alternative way would be to have a local pointer variable for anonymous struct with exactly the same layout as struct btf_enum64, but that gets us into C++ compiler errors complaining about invalid type casts. So play it safe, if ugly. [0] Closes: https://github.com/libbpf/libbpf/issues/562 Fixes: d90ec262b35b ("libbpf: Add enum64 support for btf_dump") Reported-by: Toke Høiland-Jørgensen Signed-off-by: Andrii Nakryiko Signed-off-by: Daniel Borkmann Acked-by: Toke Høiland-Jørgensen Link: https://lore.kernel.org/bpf/20220927042940.147185-1-andrii@kernel.org Signed-off-by: Sasha Levin --- tools/lib/bpf/btf.h | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/tools/lib/bpf/btf.h b/tools/lib/bpf/btf.h index 583760df83b4..d421d656a076 100644 --- a/tools/lib/bpf/btf.h +++ b/tools/lib/bpf/btf.h @@ -487,6 +487,8 @@ static inline struct btf_enum *btf_enum(const struct btf_type *t) return (struct btf_enum *)(t + 1); } +struct btf_enum64; + static inline struct btf_enum64 *btf_enum64(const struct btf_type *t) { return (struct btf_enum64 *)(t + 1); @@ -494,7 +496,28 @@ static inline struct btf_enum64 *btf_enum64(const struct btf_type *t) static inline __u64 btf_enum64_value(const struct btf_enum64 *e) { - return ((__u64)e->val_hi32 << 32) | e->val_lo32; + /* struct btf_enum64 is introduced in Linux 6.0, which is very + * bleeding-edge. Here we are avoiding relying on struct btf_enum64 + * definition coming from kernel UAPI headers to support wider range + * of system-wide kernel headers. + * + * Given this header can be also included from C++ applications, that + * further restricts C tricks we can use (like using compatible + * anonymous struct). So just treat struct btf_enum64 as + * a three-element array of u32 and access second (lo32) and third + * (hi32) elements directly. + * + * For reference, here is a struct btf_enum64 definition: + * + * const struct btf_enum64 { + * __u32 name_off; + * __u32 val_lo32; + * __u32 val_hi32; + * }; + */ + const __u32 *e64 = (const __u32 *)e; + + return ((__u64)e64[2] << 32) | e64[1]; } static inline struct btf_member *btf_members(const struct btf_type *t) From patchwork Wed Oct 19 08:26: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: 5041 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp247176wrs; Wed, 19 Oct 2022 03:40:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4pNfwOGrHLXEcoHWbT7tYfz5bz4WN/TDLMgOnff47/0T1WuMLvWat88QBXhb10h7afdx6W X-Received: by 2002:a17:907:2ced:b0:78d:ece6:7cad with SMTP id hz13-20020a1709072ced00b0078dece67cadmr6075089ejc.136.1666176010195; Wed, 19 Oct 2022 03:40:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176010; cv=none; d=google.com; s=arc-20160816; b=wziVHCvMIZTSGkwINvD+DExjfohfFOBbtv7OSLfh2jB/Zq7ierojHSZv3/v2ifcZ4B W/O2U0P6KVPcTAmgHVsL2rv0/ca8QKPEsLgK3Gmt9zA8PjwIAvPbNMxQahgRm2kSWyUj 1aasqk3g7hqmOcazhVOmKwDO9a1FEVOyP0fpAVQ/k4579/W0r9U6Op9crWgfu0P9HwD4 3QIvjYma9ENmu3qNfdIBtLdDtK5WsDXOlVbHe74bSn734Nbg4C7cx50e9ERqK8/zU1vL 6nMNXUgDqz2hZf19S2aXPGPV/khGYSvfG5tUyo0q3wfMEELdf1PJu+2VC2LMY8HNK56S j0aQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DBsSQLLby1VNi70VhMbPTIBsxbPnnca8nnhb9/MOEbY=; b=LaYZK1ZEGHmlGKXsEhs48mXKQKgAjkvYurYwnCb+h5GfWVstRkzsZbyZkXWbivusdF UFbA7ZWg9Ipr2QMEcI14qNtaWoU20AB6WXGMJNGhVBvZofz3TWW6U0R8sUl5lXz2v+L8 OdTRzBOGqucnP2rVrO4YGSkHK45Adzwmc3aYjY92FD5dbBlUwZ1BvswTRC6XiaK2GHI3 /lbAwyOGi9Bu1HFqMxSZ+r2ki8G+Y5a+088TwQReP0cIgYbjOdLqy2+32gLsq9FuQrm2 TcqZCfVK9sQltDewXyRgyvaTo8bghCjchI6dKBrk80KDAWj7lX08Jwni8567qVUtDmps sckA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="XeQFZf2/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p11-20020a05640210cb00b00456b734ceebsi13165258edu.436.2022.10.19.03.39.43; Wed, 19 Oct 2022 03:40: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="XeQFZf2/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231819AbiJSKin (ORCPT + 99 others); Wed, 19 Oct 2022 06:38:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231500AbiJSKiN (ORCPT ); Wed, 19 Oct 2022 06:38:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7CDA15380D; Wed, 19 Oct 2022 03:17: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 ams.source.kernel.org (Postfix) with ESMTPS id BBB40B8232E; Wed, 19 Oct 2022 08:52:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 392FEC433D6; Wed, 19 Oct 2022 08:52:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169552; bh=W+SzmJ4+Ai0GJAXfRt/BGB8Dxa/vhps1D+4o/1qiegw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XeQFZf2/OiT1C0LnGV58MKJwGMJ1pFVzLiluQ9TMU1LlLTyzfXcMGMYJVw5OL5Z2s IW9xjvWtCZpzY687K64pnvasy6NVE3vSu5Y75Wemyhg/fzmHDWbrHx1tdAJFos5W/a Cw0iADLW9/7KfmzLlCRWFeHtPiyHDJmm6QUrykGY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Khalil Blaiech , Asmaa Mnebhi , Wolfram Sang , Sasha Levin Subject: [PATCH 6.0 320/862] i2c: mlxbf: support lock mechanism Date: Wed, 19 Oct 2022 10:26:47 +0200 Message-Id: <20221019083304.159499469@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112175973669371?= X-GMAIL-MSGID: =?utf-8?q?1747112175973669371?= From: Asmaa Mnebhi [ Upstream commit 86067ccfa1424a26491542d6f6d7546d40b61a10 ] Linux is not the only entity using the BlueField I2C busses so support a lock mechanism provided by hardware to avoid issues when multiple entities are trying to access the same bus. The lock is acquired whenever written explicitely or the lock register is read. So make sure it is always released at the end of a successful or failed transaction. Fixes: b5b5b32081cd206b (i2c: mlxbf: I2C SMBus driver for Mellanox BlueField SoC) Reviewed-by: Khalil Blaiech Signed-off-by: Asmaa Mnebhi Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-mlxbf.c | 44 ++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 5 deletions(-) diff --git a/drivers/i2c/busses/i2c-mlxbf.c b/drivers/i2c/busses/i2c-mlxbf.c index ad5efd7497d1..0e840eba4fd6 100644 --- a/drivers/i2c/busses/i2c-mlxbf.c +++ b/drivers/i2c/busses/i2c-mlxbf.c @@ -306,6 +306,7 @@ static u64 mlxbf_i2c_corepll_frequency; * exact. */ #define MLXBF_I2C_SMBUS_TIMEOUT (300 * 1000) /* 300ms */ +#define MLXBF_I2C_SMBUS_LOCK_POLL_TIMEOUT (300 * 1000) /* 300ms */ /* Encapsulates timing parameters. */ struct mlxbf_i2c_timings { @@ -514,6 +515,25 @@ static bool mlxbf_smbus_master_wait_for_idle(struct mlxbf_i2c_priv *priv) return false; } +/* + * wait for the lock to be released before acquiring it. + */ +static bool mlxbf_i2c_smbus_master_lock(struct mlxbf_i2c_priv *priv) +{ + if (mlxbf_smbus_poll(priv->smbus->io, MLXBF_I2C_SMBUS_MASTER_GW, + MLXBF_I2C_MASTER_LOCK_BIT, true, + MLXBF_I2C_SMBUS_LOCK_POLL_TIMEOUT)) + return true; + + return false; +} + +static void mlxbf_i2c_smbus_master_unlock(struct mlxbf_i2c_priv *priv) +{ + /* Clear the gw to clear the lock */ + writel(0, priv->smbus->io + MLXBF_I2C_SMBUS_MASTER_GW); +} + static bool mlxbf_i2c_smbus_transaction_success(u32 master_status, u32 cause_status) { @@ -705,10 +725,19 @@ mlxbf_i2c_smbus_start_transaction(struct mlxbf_i2c_priv *priv, slave = request->slave & GENMASK(6, 0); addr = slave << 1; - /* First of all, check whether the HW is idle. */ - if (WARN_ON(!mlxbf_smbus_master_wait_for_idle(priv))) + /* + * Try to acquire the smbus gw lock before any reads of the GW register since + * a read sets the lock. + */ + if (WARN_ON(!mlxbf_i2c_smbus_master_lock(priv))) return -EBUSY; + /* Check whether the HW is idle */ + if (WARN_ON(!mlxbf_smbus_master_wait_for_idle(priv))) { + ret = -EBUSY; + goto out_unlock; + } + /* Set first byte. */ data_desc[data_idx++] = addr; @@ -732,8 +761,10 @@ mlxbf_i2c_smbus_start_transaction(struct mlxbf_i2c_priv *priv, write_en = 1; write_len += operation->length; if (data_idx + operation->length > - MLXBF_I2C_MASTER_DATA_DESC_SIZE) - return -ENOBUFS; + MLXBF_I2C_MASTER_DATA_DESC_SIZE) { + ret = -ENOBUFS; + goto out_unlock; + } memcpy(data_desc + data_idx, operation->buffer, operation->length); data_idx += operation->length; @@ -765,7 +796,7 @@ mlxbf_i2c_smbus_start_transaction(struct mlxbf_i2c_priv *priv, ret = mlxbf_i2c_smbus_enable(priv, slave, write_len, block_en, pec_en, 0); if (ret) - return ret; + goto out_unlock; } if (read_en) { @@ -792,6 +823,9 @@ mlxbf_i2c_smbus_start_transaction(struct mlxbf_i2c_priv *priv, priv->smbus->io + MLXBF_I2C_SMBUS_MASTER_FSM); } +out_unlock: + mlxbf_i2c_smbus_master_unlock(priv); + return ret; } From patchwork Wed Oct 19 08:26: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: 5471 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp332484wrs; Wed, 19 Oct 2022 06:38:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM68KzU+DZCm8V8n//txKjaKhmVvFbptfXBiyaTL2B2iNLytzrAHkTcypT7w0viCg8fOuNOm X-Received: by 2002:a63:6c01:0:b0:429:ea6e:486d with SMTP id h1-20020a636c01000000b00429ea6e486dmr7098153pgc.247.1666186736515; Wed, 19 Oct 2022 06:38:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666186736; cv=none; d=google.com; s=arc-20160816; b=DhGgzgojxaq5qxBCAHeXCpxK5oIEC6plTwRn9DFQoANkYZmFSCE2r6eA7Wt7CgSffp hLMrSQKSU1hn1TvvipkrCPPwbcAfN67zv1P8MFWAfQlpG5XqK+eJBkcUOWJaBZLRWwp7 Hksb0qDKHJI6nNwLeU33kUBg3k6C6ERxftJAzRDQ6NsEIO54YWF7vNreyyHFSwvsoI/H 7H/52/xtaaYu74s4yM8eeUDtwXRiTAD5TqOL9ZeivIBhbGE8gR9IrMYXtLRRRJ2RyRQr 954VqjGugtlSBq4/356SjjaLvRRiLBWHa64wt0q/0zaCADBCfVZfLVVsDRiSfPtgzmI8 iM0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=N5+6W52oNuwX1MYAtGC48SwvfaoTk37ZkQUM1d9OjUY=; b=VLl5fNWdODo0QX/oc0bauwHNIgutBHni+U+yFvPdfdDlpuSpdsDvd2MsVovJ12oXXn jVj+QHXamGt0qd88fDIf0bNRzbNSsKJwH/1E+uB2DZb/cW3ZxSA0NZb/LdyzL9eOqXNg J9JIXAyOiiV2SNKCKruigNbjLUdnOJxniRyjWlWE6qAcTjhnR5gRNJLBWj4LoezQ4bWm OyFaFFl2yhRVDBBbjG0Sr/vPhMwQOUUarO667GHYWSVXccTRm8HGmewQnjx/+Crm2Hn+ o6siRYUl0LW3Jwvd6/gezgUjXAJ4j70UUItBabvJiIssV+EWGgXww8gBiPDy3BNznSaG pavA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Nqy2lxy2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t10-20020a17090a5d8a00b0020243dc975bsi22404538pji.116.2022.10.19.06.38.43; Wed, 19 Oct 2022 06:38: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=Nqy2lxy2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231572AbiJSNcQ (ORCPT + 99 others); Wed, 19 Oct 2022 09:32:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231881AbiJSNbr (ORCPT ); Wed, 19 Oct 2022 09:31:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95EC21DCCE7; Wed, 19 Oct 2022 06:18: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 C96F6617FE; Wed, 19 Oct 2022 08:52:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DDB36C433D6; Wed, 19 Oct 2022 08:52:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169555; bh=m67spaPwy6G0W7GWUEBmAnkxzPcnmPiPMNmD2VWVvX4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Nqy2lxy2ibtpCWSOtTGgTbyF/dQ6n90xaeTQtj46m0+z7aITG2BgPt3xshD3ZZF9Q UtpfmfzVl/JG5HDdnmVXETRKA1UOL+MMLW7eYw4aN2OayP5ifjr23rz0gjsXfVurIM cBACfyA/jnDKI0BW/wVlWVVCNlKGgNtjpnHdL/e4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Luiz Augusto von Dentz , David Beinder , Sasha Levin Subject: [PATCH 6.0 321/862] Bluetooth: hci_core: Fix not handling link timeouts propertly Date: Wed, 19 Oct 2022 10:26:48 +0200 Message-Id: <20221019083304.209428283@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123423139447222?= X-GMAIL-MSGID: =?utf-8?q?1747123423139447222?= From: Luiz Augusto von Dentz [ Upstream commit 116523c8fac05d1d26f748fee7919a4ec5df67ea ] Change that introduced the use of __check_timeout did not account for link types properly, it always assumes ACL_LINK is used thus causing hdev->acl_last_tx to be used even in case of LE_LINK and then again uses ACL_LINK with hci_link_tx_to. To fix this __check_timeout now takes the link type as parameter and then procedure to use the right last_tx based on the link type and pass it to hci_link_tx_to. Fixes: 1b1d29e51499 ("Bluetooth: Make use of __check_timeout on hci_sched_le") Signed-off-by: Luiz Augusto von Dentz Tested-by: David Beinder Signed-off-by: Sasha Levin --- net/bluetooth/hci_core.c | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 9873d2e67988..e6be18eb7fe6 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -3478,15 +3478,27 @@ static inline int __get_blocks(struct hci_dev *hdev, struct sk_buff *skb) return DIV_ROUND_UP(skb->len - HCI_ACL_HDR_SIZE, hdev->block_len); } -static void __check_timeout(struct hci_dev *hdev, unsigned int cnt) +static void __check_timeout(struct hci_dev *hdev, unsigned int cnt, u8 type) { - if (!hci_dev_test_flag(hdev, HCI_UNCONFIGURED)) { - /* ACL tx timeout must be longer than maximum - * link supervision timeout (40.9 seconds) */ - if (!cnt && time_after(jiffies, hdev->acl_last_tx + - HCI_ACL_TX_TIMEOUT)) - hci_link_tx_to(hdev, ACL_LINK); + unsigned long last_tx; + + if (hci_dev_test_flag(hdev, HCI_UNCONFIGURED)) + return; + + switch (type) { + case LE_LINK: + last_tx = hdev->le_last_tx; + break; + default: + last_tx = hdev->acl_last_tx; + break; } + + /* tx timeout must be longer than maximum link supervision timeout + * (40.9 seconds) + */ + if (!cnt && time_after(jiffies, last_tx + HCI_ACL_TX_TIMEOUT)) + hci_link_tx_to(hdev, type); } /* Schedule SCO */ @@ -3544,7 +3556,7 @@ static void hci_sched_acl_pkt(struct hci_dev *hdev) struct sk_buff *skb; int quote; - __check_timeout(hdev, cnt); + __check_timeout(hdev, cnt, ACL_LINK); while (hdev->acl_cnt && (chan = hci_chan_sent(hdev, ACL_LINK, "e))) { @@ -3587,8 +3599,6 @@ static void hci_sched_acl_blk(struct hci_dev *hdev) int quote; u8 type; - __check_timeout(hdev, cnt); - BT_DBG("%s", hdev->name); if (hdev->dev_type == HCI_AMP) @@ -3596,6 +3606,8 @@ static void hci_sched_acl_blk(struct hci_dev *hdev) else type = ACL_LINK; + __check_timeout(hdev, cnt, type); + while (hdev->block_cnt > 0 && (chan = hci_chan_sent(hdev, type, "e))) { u32 priority = (skb_peek(&chan->data_q))->priority; @@ -3669,7 +3681,7 @@ static void hci_sched_le(struct hci_dev *hdev) cnt = hdev->le_pkts ? hdev->le_cnt : hdev->acl_cnt; - __check_timeout(hdev, cnt); + __check_timeout(hdev, cnt, LE_LINK); tmp = cnt; while (cnt && (chan = hci_chan_sent(hdev, LE_LINK, "e))) { From patchwork Wed Oct 19 08:26: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: 4674 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212831wrs; Wed, 19 Oct 2022 02:08:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4xR8q46nbSrAZ5YSvXrckkGIgjsHPv6yRdUrUSz1+xQwv+Wk/S8ohK+sgPZcpghCk0TobD X-Received: by 2002:a17:907:6e93:b0:78d:dff1:71e3 with SMTP id sh19-20020a1709076e9300b0078ddff171e3mr5570339ejc.94.1666170505327; Wed, 19 Oct 2022 02:08:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170505; cv=none; d=google.com; s=arc-20160816; b=g21m7BFipoCcWN0p2VW5qgV5be8RfNO3BvQzCI09grGSIBe8eoVl7at+SPiIQFpAkW 2soNoEkTCLbg3Z7dkDuQGgG8uIkuf115d1py0ndMx7hrsKXAFYLcoB7Wu4fwvvZFdyxb wxyTjdstfV5BynqTXGLY/R4iUNDkSG38px7sz98LkN1y24WU0WwwnXb7gO5Au05Rfhm5 74ZoHRu/iW8NtHx2RY+AjIAJY5onn7FuQH35tLTcbgOqfWOeZGZe2dfOGSeNhXGCBA5Z KvEEgoWsC6+jenjTOLy6E5yn9duwoxMJVDtS4G42QTlR/2EkuvXFFZ6eXE8vJFqnLob8 ncnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nmKHs+8MV5p9zsQ1uZschs/OXHne+3MhEcyHmhYx0rI=; b=S1c/QYeXizJHVfWd28ffl4GaWISmXcPT/y3cl9EhIEDLP6QaQWidW34vcGuOSZ+k3L CiCOtldop7v4iCZdABnqIECwn4xuj+dL7PbAfdFL5DnR+6Gu8k+/wjgQrWmElTGwtT/B rIaMdLIbkg50IUJ+H2Hj3/RrZ8qMGhJWm0wuTnoYOlAIFmRAWIh7kaEfuYSskLZsYOXJ SC1ye8WHtz9q9BOPbpqeGUi3pBrmYEH5CekbTpdOhFFWMHWtkPJiMJOXiwVpsTxnxUxO Sz83yZqfBnTw+PHUTdEu6+cG4E3/p2xnZP3zqd7CAZYW5J3dpHlP6/NhgUQazGlPsN0c T59g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ScEQ7UqM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nd18-20020a170907629200b0073306ff26besi15690329ejc.969.2022.10.19.02.07.54; Wed, 19 Oct 2022 02: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=ScEQ7UqM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232234AbiJSJBW (ORCPT + 99 others); Wed, 19 Oct 2022 05:01:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232198AbiJSI7J (ORCPT ); Wed, 19 Oct 2022 04:59:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA49E17061; Wed, 19 Oct 2022 01:54: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 11A9F61831; Wed, 19 Oct 2022 08:52:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27E88C433D6; Wed, 19 Oct 2022 08:52:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169560; bh=9le4u6YBKk5xmMeRChSacgla+pEWkHdhSCXIYxa77Mo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ScEQ7UqMtFTlAr+fWCYT4tOJLBnfqEzif/QE8/YCkSoLtqXJkKOaisn0b/cME8T/B Lfmq+vh3nuQhHagDRsIwfTv775fIJzialHwUbgyLGJu7KGotx63OY5Dy0/15AhW98g CBMGVI6KE8Cwf65zy/rXbEET9pWHBgomq1JEK2Mc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liu Jian , Steffen Klassert , Sasha Levin Subject: [PATCH 6.0 322/862] xfrm: Reinject transport-mode packets through workqueue Date: Wed, 19 Oct 2022 10:26:49 +0200 Message-Id: <20221019083304.251090708@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106403991792742?= X-GMAIL-MSGID: =?utf-8?q?1747106403991792742?= From: Liu Jian [ Upstream commit 4f4920669d21e1060b7243e5118dc3b71ced1276 ] The following warning is displayed when the tcp6-multi-diffip11 stress test case of the LTP test suite is tested: watchdog: BUG: soft lockup - CPU#0 stuck for 22s! [ns-tcpserver:48198] CPU: 0 PID: 48198 Comm: ns-tcpserver Kdump: loaded Not tainted 6.0.0-rc6+ #39 Hardware name: QEMU KVM Virtual Machine, BIOS 0.0.0 02/06/2015 pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : des3_ede_encrypt+0x27c/0x460 [libdes] lr : 0x3f sp : ffff80000ceaa1b0 x29: ffff80000ceaa1b0 x28: ffff0000df056100 x27: ffff0000e51e5280 x26: ffff80004df75030 x25: ffff0000e51e4600 x24: 000000000000003b x23: 0000000000802080 x22: 000000000000003d x21: 0000000000000038 x20: 0000000080000020 x19: 000000000000000a x18: 0000000000000033 x17: ffff0000e51e4780 x16: ffff80004e2d1448 x15: ffff80004e2d1248 x14: ffff0000e51e4680 x13: ffff80004e2d1348 x12: ffff80004e2d1548 x11: ffff80004e2d1848 x10: ffff80004e2d1648 x9 : ffff80004e2d1748 x8 : ffff80004e2d1948 x7 : 000000000bcaf83d x6 : 000000000000001b x5 : ffff80004e2d1048 x4 : 00000000761bf3bf x3 : 000000007f1dd0a3 x2 : ffff0000e51e4780 x1 : ffff0000e3b9a2f8 x0 : 00000000db44e872 Call trace: des3_ede_encrypt+0x27c/0x460 [libdes] crypto_des3_ede_encrypt+0x1c/0x30 [des_generic] crypto_cbc_encrypt+0x148/0x190 crypto_skcipher_encrypt+0x2c/0x40 crypto_authenc_encrypt+0xc8/0xfc [authenc] crypto_aead_encrypt+0x2c/0x40 echainiv_encrypt+0x144/0x1a0 [echainiv] crypto_aead_encrypt+0x2c/0x40 esp6_output_tail+0x1c8/0x5d0 [esp6] esp6_output+0x120/0x278 [esp6] xfrm_output_one+0x458/0x4ec xfrm_output_resume+0x6c/0x1f0 xfrm_output+0xac/0x4ac __xfrm6_output+0x130/0x270 xfrm6_output+0x60/0xec ip6_xmit+0x2ec/0x5bc inet6_csk_xmit+0xbc/0x10c __tcp_transmit_skb+0x460/0x8c0 tcp_write_xmit+0x348/0x890 __tcp_push_pending_frames+0x44/0x110 tcp_rcv_established+0x3c8/0x720 tcp_v6_do_rcv+0xdc/0x4a0 tcp_v6_rcv+0xc24/0xcb0 ip6_protocol_deliver_rcu+0xf0/0x574 ip6_input_finish+0x48/0x7c ip6_input+0x48/0xc0 ip6_rcv_finish+0x80/0x9c xfrm_trans_reinject+0xb0/0xf4 tasklet_action_common.constprop.0+0xf8/0x134 tasklet_action+0x30/0x3c __do_softirq+0x128/0x368 do_softirq+0xb4/0xc0 __local_bh_enable_ip+0xb0/0xb4 put_cpu_fpsimd_context+0x40/0x70 kernel_neon_end+0x20/0x40 sha1_base_do_update.constprop.0.isra.0+0x11c/0x140 [sha1_ce] sha1_ce_finup+0x94/0x110 [sha1_ce] crypto_shash_finup+0x34/0xc0 hmac_finup+0x48/0xe0 crypto_shash_finup+0x34/0xc0 shash_digest_unaligned+0x74/0x90 crypto_shash_digest+0x4c/0x9c shash_ahash_digest+0xc8/0xf0 shash_async_digest+0x28/0x34 crypto_ahash_digest+0x48/0xcc crypto_authenc_genicv+0x88/0xcc [authenc] crypto_authenc_encrypt+0xd8/0xfc [authenc] crypto_aead_encrypt+0x2c/0x40 echainiv_encrypt+0x144/0x1a0 [echainiv] crypto_aead_encrypt+0x2c/0x40 esp6_output_tail+0x1c8/0x5d0 [esp6] esp6_output+0x120/0x278 [esp6] xfrm_output_one+0x458/0x4ec xfrm_output_resume+0x6c/0x1f0 xfrm_output+0xac/0x4ac __xfrm6_output+0x130/0x270 xfrm6_output+0x60/0xec ip6_xmit+0x2ec/0x5bc inet6_csk_xmit+0xbc/0x10c __tcp_transmit_skb+0x460/0x8c0 tcp_write_xmit+0x348/0x890 __tcp_push_pending_frames+0x44/0x110 tcp_push+0xb4/0x14c tcp_sendmsg_locked+0x71c/0xb64 tcp_sendmsg+0x40/0x6c inet6_sendmsg+0x4c/0x80 sock_sendmsg+0x5c/0x6c __sys_sendto+0x128/0x15c __arm64_sys_sendto+0x30/0x40 invoke_syscall+0x50/0x120 el0_svc_common.constprop.0+0x170/0x194 do_el0_svc+0x38/0x4c el0_svc+0x28/0xe0 el0t_64_sync_handler+0xbc/0x13c el0t_64_sync+0x180/0x184 Get softirq info by bcc tool: ./softirqs -NT 10 Tracing soft irq event time... Hit Ctrl-C to end. 15:34:34 SOFTIRQ TOTAL_nsecs block 158990 timer 20030920 sched 46577080 net_rx 676746820 tasklet 9906067650 15:34:45 SOFTIRQ TOTAL_nsecs block 86100 sched 38849790 net_rx 676532470 timer 1163848790 tasklet 9409019620 15:34:55 SOFTIRQ TOTAL_nsecs sched 58078450 net_rx 475156720 timer 533832410 tasklet 9431333300 The tasklet software interrupt takes too much time. Therefore, the xfrm_trans_reinject executor is changed from tasklet to workqueue. Add add spin lock to protect the queue. This reduces the processing flow of the tcp_sendmsg function in this scenario. Fixes: acf568ee859f0 ("xfrm: Reinject transport-mode packets through tasklet") Signed-off-by: Liu Jian Signed-off-by: Steffen Klassert Signed-off-by: Sasha Levin --- net/xfrm/xfrm_input.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c index b2f4ec9c537f..aa5220565763 100644 --- a/net/xfrm/xfrm_input.c +++ b/net/xfrm/xfrm_input.c @@ -24,7 +24,8 @@ #include "xfrm_inout.h" struct xfrm_trans_tasklet { - struct tasklet_struct tasklet; + struct work_struct work; + spinlock_t queue_lock; struct sk_buff_head queue; }; @@ -760,18 +761,22 @@ int xfrm_input_resume(struct sk_buff *skb, int nexthdr) } EXPORT_SYMBOL(xfrm_input_resume); -static void xfrm_trans_reinject(struct tasklet_struct *t) +static void xfrm_trans_reinject(struct work_struct *work) { - struct xfrm_trans_tasklet *trans = from_tasklet(trans, t, tasklet); + struct xfrm_trans_tasklet *trans = container_of(work, struct xfrm_trans_tasklet, work); struct sk_buff_head queue; struct sk_buff *skb; __skb_queue_head_init(&queue); + spin_lock_bh(&trans->queue_lock); skb_queue_splice_init(&trans->queue, &queue); + spin_unlock_bh(&trans->queue_lock); + local_bh_disable(); while ((skb = __skb_dequeue(&queue))) XFRM_TRANS_SKB_CB(skb)->finish(XFRM_TRANS_SKB_CB(skb)->net, NULL, skb); + local_bh_enable(); } int xfrm_trans_queue_net(struct net *net, struct sk_buff *skb, @@ -789,8 +794,10 @@ int xfrm_trans_queue_net(struct net *net, struct sk_buff *skb, XFRM_TRANS_SKB_CB(skb)->finish = finish; XFRM_TRANS_SKB_CB(skb)->net = net; + spin_lock_bh(&trans->queue_lock); __skb_queue_tail(&trans->queue, skb); - tasklet_schedule(&trans->tasklet); + spin_unlock_bh(&trans->queue_lock); + schedule_work(&trans->work); return 0; } EXPORT_SYMBOL(xfrm_trans_queue_net); @@ -817,7 +824,8 @@ void __init xfrm_input_init(void) struct xfrm_trans_tasklet *trans; trans = &per_cpu(xfrm_trans_tasklet, i); + spin_lock_init(&trans->queue_lock); __skb_queue_head_init(&trans->queue); - tasklet_setup(&trans->tasklet, xfrm_trans_reinject); + INIT_WORK(&trans->work, xfrm_trans_reinject); } } From patchwork Wed Oct 19 08:26: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: 5072 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp249147wrs; Wed, 19 Oct 2022 03:45:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4nakBX5fmzZgh1qzoUJbBPTamt1EPHwEJCQ1T+VRcmjyYnGUHF+o7lc+/iRR259maCGImg X-Received: by 2002:a17:90b:2243:b0:20b:42a:4c0d with SMTP id hk3-20020a17090b224300b0020b042a4c0dmr43187861pjb.123.1666176328981; Wed, 19 Oct 2022 03:45:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176328; cv=none; d=google.com; s=arc-20160816; b=IK3XvIt5Xde5CYeOns0LtAYpOfXKniiSEyVB2e3X1C422/9Do83DCbIPZoQwbV0WjZ KU/HCQDIyuNmT33RsNP0cdw3AeqXGyRK+J2vs3+woZsK7rvPuRhk9iKKwF4etaYmAEb0 prNc4MYrGkp5hvNQIiERCAdYqCEiSaWYRaxiKCdLUZYGeiKXuTbvhgWhP7slk/JFTI6M 7WKqa/mvogscsEfUvk/Xj2h+855EVjPWHsPO8oN9qHs9vKRb/nAq7Oxx1IHYVdKM7c2d Kd7qj495HB7mX+EC8JhKNN7OzdLv7KIHpJCiOePFzxkhjWiC/Y1owkQID5CdiWEUOPFG Nxiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hoUERXjGNd2o8CnyFPbMc5XcSFDIi9YpZZfdtR5QjIY=; b=R894BKkpSrlDF+j9fVUGe6PUpkPX/zvf+adv9jkmEoXPoh1NBVitmft7HxuT8KgsZf 5Dfb7+f1UcMvYTEND2Q9yo8yCPIrLhjzR9wtISGdrmNEysggdsQocY+riytmWAyRhVNm oUbjD6fN887sodxNFupc3fbY7YK0DVl5JtcvTmcrNI9X8W1tPj3xro+De+ozcxjDjJkC aD0n/IiDshrfsC7tkF5RsXJxluFVlFxtKIKfc9Y0QiHZOmngPebZfIl9I4ltyurlohfR tB8AGgVseNuVfUvUPI0vfEQkBscNdPSjhZF3nTorZ79WWxXdO68/4ExqbUBAURUEz4w6 lT+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=t+JK6u6r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t18-20020a63dd12000000b004637c92ef98si19423793pgg.195.2022.10.19.03.45.12; Wed, 19 Oct 2022 03:45: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=t+JK6u6r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232242AbiJSKox (ORCPT + 99 others); Wed, 19 Oct 2022 06:44:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231953AbiJSKnV (ORCPT ); Wed, 19 Oct 2022 06:43:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B3F0157F59; Wed, 19 Oct 2022 03:20:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 55EE0B823AA; Wed, 19 Oct 2022 08:52:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC23CC433C1; Wed, 19 Oct 2022 08:52:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169563; bh=xNMqv/ZsY0vx5mTBDBy94sW1JDIi2qFUa783AYIVEJU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t+JK6u6rPR6uPtMcJTziYve+ffdwEtZMwHiSAdyFfSbb1h5czmuIVpAJeZPjo9rdL I24qXgV65mBK1YJUkccI7Sp3GIP6wy19or6IwS0+GDcWGVuDGDrK19JPopqAIbhHFm kQyLKMn3jB5zFpp++ZR5Y/TbB+FmYPHPgv3KTerQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Phil Sutter , Florian Westphal , Sasha Levin Subject: [PATCH 6.0 323/862] netfilter: nft_fib: Fix for rpath check with VRF devices Date: Wed, 19 Oct 2022 10:26:50 +0200 Message-Id: <20221019083304.295705229@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112510575893287?= X-GMAIL-MSGID: =?utf-8?q?1747112510575893287?= From: Phil Sutter [ Upstream commit 2a8a7c0eaa8747c16aa4a48d573aa920d5c00a5c ] Analogous to commit b575b24b8eee3 ("netfilter: Fix rpfilter dropping vrf packets by mistake") but for nftables fib expression: Add special treatment of VRF devices so that typical reverse path filtering via 'fib saddr . iif oif' expression works as expected. Fixes: f6d0cbcf09c50 ("netfilter: nf_tables: add fib expression") Signed-off-by: Phil Sutter Signed-off-by: Florian Westphal Signed-off-by: Sasha Levin --- net/ipv4/netfilter/nft_fib_ipv4.c | 3 +++ net/ipv6/netfilter/nft_fib_ipv6.c | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/net/ipv4/netfilter/nft_fib_ipv4.c b/net/ipv4/netfilter/nft_fib_ipv4.c index b75cac69bd7e..7ade04ff972d 100644 --- a/net/ipv4/netfilter/nft_fib_ipv4.c +++ b/net/ipv4/netfilter/nft_fib_ipv4.c @@ -83,6 +83,9 @@ void nft_fib4_eval(const struct nft_expr *expr, struct nft_regs *regs, else oif = NULL; + if (priv->flags & NFTA_FIB_F_IIF) + fl4.flowi4_oif = l3mdev_master_ifindex_rcu(oif); + if (nft_hook(pkt) == NF_INET_PRE_ROUTING && nft_fib_is_loopback(pkt->skb, nft_in(pkt))) { nft_fib_store_result(dest, priv, nft_in(pkt)); diff --git a/net/ipv6/netfilter/nft_fib_ipv6.c b/net/ipv6/netfilter/nft_fib_ipv6.c index 8970d0b4faeb..1d7e520d9966 100644 --- a/net/ipv6/netfilter/nft_fib_ipv6.c +++ b/net/ipv6/netfilter/nft_fib_ipv6.c @@ -41,6 +41,9 @@ static int nft_fib6_flowi_init(struct flowi6 *fl6, const struct nft_fib *priv, if (ipv6_addr_type(&fl6->daddr) & IPV6_ADDR_LINKLOCAL) { lookup_flags |= RT6_LOOKUP_F_IFACE; fl6->flowi6_oif = get_ifindex(dev ? dev : pkt->skb->dev); + } else if ((priv->flags & NFTA_FIB_F_IIF) && + (netif_is_l3_master(dev) || netif_is_l3_slave(dev))) { + fl6->flowi6_oif = dev->ifindex; } if (ipv6_addr_type(&fl6->saddr) & IPV6_ADDR_UNICAST) @@ -197,7 +200,8 @@ void nft_fib6_eval(const struct nft_expr *expr, struct nft_regs *regs, if (rt->rt6i_flags & (RTF_REJECT | RTF_ANYCAST | RTF_LOCAL)) goto put_rt_err; - if (oif && oif != rt->rt6i_idev->dev) + if (oif && oif != rt->rt6i_idev->dev && + l3mdev_master_ifindex_rcu(rt->rt6i_idev->dev) != oif->ifindex) goto put_rt_err; nft_fib_store_result(dest, priv, rt->rt6i_idev->dev); From patchwork Wed Oct 19 08:26: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: 4670 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212803wrs; Wed, 19 Oct 2022 02:08:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5j7cRtHleMgmc5XbAc+mnGPC8ucIFBsqk3wnz+g9Cv60hkfp97Le3M5yAfQDPdZWp0L470 X-Received: by 2002:a05:6402:ca:b0:45c:dbdd:8143 with SMTP id i10-20020a05640200ca00b0045cdbdd8143mr6426312edu.213.1666170499412; Wed, 19 Oct 2022 02:08:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170499; cv=none; d=google.com; s=arc-20160816; b=YVY+JdPUn8WmkPgCye7xqHuNzYZKVXNB24L/jgcYb1DEKDCUzqE7LomZlb/3ZzyfmW nu28m98YLddO+ulBZN+PF3+G3uJ7OSBAPiZYnhvInjCRh4iWTheOM5ByNS4UX5A1Tz7C diF47gM0M/3M/6xt2z/zqrshjYperwSpBC8bQbvmSN+/kc+MRqehNXW0iB6nd02xnzQG YvCfE3TZKkNqU+Uz6C66kM//6uUYG2pxhaB0ufecimOAIhV8iQ4t6IvJN96T4pvzXe/C 0bK+nkctNshhq1oNPYJPHGITjgV5BL4Z8H9MGXWLCjRow13K8KYosFeO6SIwXv8h1qAd Yh/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=p2X3a8beoo1d9rtCVEG9ZSA5U7hTVPkKBawke6CJGAU=; b=F/UdoRMPkL8rx+J5Bldcy73c9ZPfnb2c1ZxCVvL25dt67Mm8smO+tTCN2XHmXgMqHs gvtCV1Goy0LT8qjqiy74o7vIUeYP65m9n+dBhY8ccwDd9vHaCCSswG6jfuyNDlpx7Dcl NDDGXwL6eyC3wXtkn3Mes4f6y8GUH97CV09/GFIl2V13UQo8DlZyzvn5I4zJiEFqqcwT uCiUaGsoho7E5lQeDAtxdBzdcxiIQpKxzq4Bcvj8h/dw7TBiCaxjQZ+ntjm3FxffzZK/ w/t6rBMceGOhfK/mS/ZUyhr7NwJ8oeO61fpqIYhjq84iiq2yUjirQovZT1B+E3LqqCBT z0Ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kt3rKgZ6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d25-20020a056402001900b0045c26f0050esi12015053edu.238.2022.10.19.02.07.47; Wed, 19 Oct 2022 02:08: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=kt3rKgZ6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232174AbiJSJCP (ORCPT + 99 others); Wed, 19 Oct 2022 05:02:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232318AbiJSI72 (ORCPT ); Wed, 19 Oct 2022 04:59:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 943D01F9CE; Wed, 19 Oct 2022 01:54: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 616F4617E2; Wed, 19 Oct 2022 08:52:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73BA1C433D6; Wed, 19 Oct 2022 08:52:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169565; bh=5u3kOrzXDHW67/4WydkJbp5+FsobPaSHWftOVuCCVsU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kt3rKgZ6AFc3jlW97jCzZe4DNWRyzQ2Pil3TtOYaN8rDWtzSjN8uV3uuQpJ/0n1RU JuvZ0X9tdEv+MB76wVVDrmZniMwD7hrTgMSA2dxU5iPiXFhS+FZM/fpRTyDEBMPcJl czxjlIH94QlRDFVyK5IJXczamWj202Cmchyzmfw4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vincent Whitchurch , Mark Brown , Sasha Levin Subject: [PATCH 6.0 324/862] spi: s3c64xx: Fix large transfers with DMA Date: Wed, 19 Oct 2022 10:26:51 +0200 Message-Id: <20221019083304.335658021@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106397709070132?= X-GMAIL-MSGID: =?utf-8?q?1747106397709070132?= From: Vincent Whitchurch [ Upstream commit 1224e29572f655facfcd850cf0f0a4784f36a903 ] The COUNT_VALUE in the PACKET_CNT register is 16-bit so the maximum value is 65535. Asking the driver to transfer a larger size currently leads to the DMA transfer timing out. Implement ->max_transfer_size() and have the core split the transfer as needed. Fixes: 230d42d422e7 ("spi: Add s3c64xx SPI Controller driver") Signed-off-by: Vincent Whitchurch Link: https://lore.kernel.org/r/20220927112117.77599-5-vincent.whitchurch@axis.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-s3c64xx.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 651c35dd9124..71d324ec9a70 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -84,6 +84,7 @@ #define S3C64XX_SPI_ST_TX_FIFORDY (1<<0) #define S3C64XX_SPI_PACKET_CNT_EN (1<<16) +#define S3C64XX_SPI_PACKET_CNT_MASK GENMASK(15, 0) #define S3C64XX_SPI_PND_TX_UNDERRUN_CLR (1<<4) #define S3C64XX_SPI_PND_TX_OVERRUN_CLR (1<<3) @@ -711,6 +712,13 @@ static int s3c64xx_spi_prepare_message(struct spi_master *master, return 0; } +static size_t s3c64xx_spi_max_transfer_size(struct spi_device *spi) +{ + struct spi_controller *ctlr = spi->controller; + + return ctlr->can_dma ? S3C64XX_SPI_PACKET_CNT_MASK : SIZE_MAX; +} + static int s3c64xx_spi_transfer_one(struct spi_master *master, struct spi_device *spi, struct spi_transfer *xfer) @@ -1152,6 +1160,7 @@ static int s3c64xx_spi_probe(struct platform_device *pdev) master->unprepare_transfer_hardware = s3c64xx_spi_unprepare_transfer; master->prepare_message = s3c64xx_spi_prepare_message; master->transfer_one = s3c64xx_spi_transfer_one; + master->max_transfer_size = s3c64xx_spi_max_transfer_size; master->num_chipselect = sci->num_cs; master->use_gpio_descriptors = true; master->dma_alignment = 8; From patchwork Wed Oct 19 08:26: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: 4669 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212800wrs; Wed, 19 Oct 2022 02:08:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6vr2cpvJKbqVjBsp2fW/v35Y0tvL2NZPd1FLBRtLHXA0gM43/DZubOHRRildNFt0MsYcUZ X-Received: by 2002:a17:907:9627:b0:78d:a7d8:9407 with SMTP id gb39-20020a170907962700b0078da7d89407mr5794749ejc.675.1666170498828; Wed, 19 Oct 2022 02:08:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170498; cv=none; d=google.com; s=arc-20160816; b=iFj+uANVuKqCWl5ZCcPqkmMxe2rDsBO4FgFOxaVhNfOd4DznYpuAwMRS1qzeK3cUWq gqS8OWS/ZTcHHtQ2gqaQ5YJSXDHB28o5WlkPhqOrwmO/gkmW66jU8B+Ex449INnakn19 n4vxXo8CrJAyWI7p6grGvv3N410oSmLU1VScnN0x03/8zI7XQOinWW8PjQVmxEqVZUmW XjTarCLrmMbW/9vLuHQQgBryV4a9fkirlXuJcuMza2WAVjopeVjREOIrFNWYAMZypIQ1 8lIYVHkJijhk3cEAsueQ1MZHE0LKYOpbRzUh6DC9cD6hL1O/m5wJay8i2N53xToroByY bdhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=eyx9WKEv31raS08rAveujdoUmiyFckZaJZ2yYS0B0r4=; b=EALChzDGGjGCOIfR/gME/zrRpVefyggdn33Ey7Ks0zPznKjjGssHdiaHeKWjfqZ4QX 5184R7vMqOq3EbSjbpY2MyiUcYZM++LUNN18b8lYUrOpi6eC9sqJh719qcZRs2ifqRfL KZzdkriem3nNa0i4WBTmE9Mu5bOyaMKHycCdjugoxH/0MuKcXUesu2Pfv1yF1JsX2n6R wKEK9qKrfdgIjyDMBYnw11yJYdiLUU4QyIuae9JDfrJyg83fK/2bFAirzoLrTYDO3h8n NuL2hUQBHMFr37AF+/wtltyPMR8p4fIOq8hA92+L7bcM40k/s5nVTkZ4b6V2IeDVbHqn 7POg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=T1JV272B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hw8-20020a170907a0c800b0073d8830e4c7si13277914ejc.954.2022.10.19.02.07.41; Wed, 19 Oct 2022 02:08: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=T1JV272B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232081AbiJSJCB (ORCPT + 99 others); Wed, 19 Oct 2022 05:02:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232306AbiJSI72 (ORCPT ); Wed, 19 Oct 2022 04:59:28 -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 CFD632316E; Wed, 19 Oct 2022 01:54: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 6840C61840; Wed, 19 Oct 2022 08:52:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79C46C433D6; Wed, 19 Oct 2022 08:52:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169568; bh=rMXzGfT+AwXnfRT0f5JD55o8ci30M3mUQCL/5UtoNGE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T1JV272Bjd1wO+SEr9GEbyUjfVqiol4nCf3vZ/hIs3opzAAdCIhxvt+arZpP+/jWk Pd4DzzBZDcZyZsvazB9I2Qo3ueAS26/ghzUMhtBoqQ/d6QMyQ4sav2HfXJMyYTUCgh g0p+QDcg0ficca7rdMtFwuwT/n6kDaBzAk8dyoZM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot , Abhishek Pandit-Subedi , Luiz Augusto von Dentz , Sasha Levin Subject: [PATCH 6.0 325/862] Bluetooth: Prevent double register of suspend Date: Wed, 19 Oct 2022 10:26:52 +0200 Message-Id: <20221019083304.385189903@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106396923929344?= X-GMAIL-MSGID: =?utf-8?q?1747106396923929344?= From: Abhishek Pandit-Subedi [ Upstream commit 4b8af331bb4d4cc8bb91c284b11b98dd1e265185 ] Suspend notifier should only be registered and unregistered once per hdev. Simplify this by only registering during driver registration and simply exiting early when HCI_USER_CHANNEL is set. Reported-by: syzbot Fixes: 359ee4f834f5 (Bluetooth: Unregister suspend with userchannel) Signed-off-by: Abhishek Pandit-Subedi Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin --- net/bluetooth/hci_core.c | 4 ++++ net/bluetooth/hci_sock.c | 3 --- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index e6be18eb7fe6..6ae5aa5c0927 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -2400,6 +2400,10 @@ static int hci_suspend_notifier(struct notifier_block *nb, unsigned long action, container_of(nb, struct hci_dev, suspend_notifier); int ret = 0; + /* Userspace has full control of this device. Do nothing. */ + if (hci_dev_test_flag(hdev, HCI_USER_CHANNEL)) + return NOTIFY_DONE; + if (action == PM_SUSPEND_PREPARE) ret = hci_suspend_dev(hdev); else if (action == PM_POST_SUSPEND) diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index 0d015d4a8e41..bd8358b44aa4 100644 --- a/net/bluetooth/hci_sock.c +++ b/net/bluetooth/hci_sock.c @@ -887,7 +887,6 @@ static int hci_sock_release(struct socket *sock) */ hci_dev_do_close(hdev); hci_dev_clear_flag(hdev, HCI_USER_CHANNEL); - hci_register_suspend_notifier(hdev); mgmt_index_added(hdev); } @@ -1216,7 +1215,6 @@ static int hci_sock_bind(struct socket *sock, struct sockaddr *addr, } mgmt_index_removed(hdev); - hci_unregister_suspend_notifier(hdev); err = hci_dev_open(hdev->id); if (err) { @@ -1231,7 +1229,6 @@ static int hci_sock_bind(struct socket *sock, struct sockaddr *addr, err = 0; } else { hci_dev_clear_flag(hdev, HCI_USER_CHANNEL); - hci_register_suspend_notifier(hdev); mgmt_index_added(hdev); hci_dev_put(hdev); goto done; From patchwork Wed Oct 19 08:26: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: 4673 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212813wrs; Wed, 19 Oct 2022 02:08:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4X7Iqn8+NwZt/pHAlIoI+7w3tC9Y8HHbzrjnLJFJnfjfsCGopN7ANvJHXvV98K9ytZkZrT X-Received: by 2002:aa7:cd10:0:b0:45c:2c83:1208 with SMTP id b16-20020aa7cd10000000b0045c2c831208mr6277135edw.81.1666170500711; Wed, 19 Oct 2022 02:08:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170500; cv=none; d=google.com; s=arc-20160816; b=LT/Q7M1nPTs6WR+3JDXDYkrVltP5lV9UZjQAAfuN+Qw02ehMsby/upuYdDlbc/nelD pLQ1rw7/R5DgJYnzkzsrdCtX2e+8uvyFYnDO0zS9uZt61cgNfw26apfXCpRB7cOrNy+a oDbPTcXlmJCMD4SLQFiRGuNDa/Ru7tdlzKb4KBuAXjKWECDTbDkWup6+kj5hvrvUUuAJ 1uoXJ6K+EeXILBy1ubjRV0CCl2XSpkBR23HAwTZwl0nm3xXcSuSZImdek+2iVyxlGfbY rKcQxvmoh2fjMP1NqBhuRC/mvIdMxGeQVveAsrvVB5e6/7FTy/HbF+aQUJl9FubwYume nCEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6IE8WVVwqeE00JVfC0gS7Gb5dEhWuMYnU1CEXyg9EAw=; b=e54HN+gh/5geRP5FZZMJfVZ/CbP5n5p2fqmc6RDF+taPX4JerEqFOB7jXSoPOHgARa D9XgC+VtQuv14RDud2N6WR4CdQpnPFNvqjIw41clJ4hjzhELBpuRJsxf0s0GgbMiilHd RXruMuiRt+ukZz0kb1xTxpUKcOxGEer8cHvLxK9DtHcAYCcHe/KUcj2MGjKsXKMEZo1A IkyxMzDVbQoYVocXIURuEhqjjx4dw/P3TpSk1PSncmamJjxiijc7jaiEnAOiwgkpli0J O4uiJth1cAbr0D/L7SrgVmJVI7LsHVqFr3HNy4GQNnQUVKpQU9YhngmfvDFDH0/L7CxR EbUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="ny/BQHfb"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i20-20020a05640242d400b0045c93142111si17798776edc.70.2022.10.19.02.07.51; Wed, 19 Oct 2022 02:08: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="ny/BQHfb"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232105AbiJSJCZ (ORCPT + 99 others); Wed, 19 Oct 2022 05:02:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232370AbiJSI7g (ORCPT ); Wed, 19 Oct 2022 04:59:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF90B22B28; Wed, 19 Oct 2022 01:54: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 5E45461851; Wed, 19 Oct 2022 08:52:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55B3BC433D6; Wed, 19 Oct 2022 08:52:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169571; bh=rKtJJTV78P1dsP+5UpZHs4hE+FzHhUvoCzhw/+Vtm3Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ny/BQHfbJSaHtKThjKy49Tvix/E91RdZGOBFjLqscUe8xkDsUQDE+4wzAi9rr3X5N +DLv1OMTGivIZKi4dmRxQa1PiryCDxTBzoUvl2kiQ5mWqmwMuO57eraMnwwdW5MgQD m6hTT1x8G8ZGzsioOQPVz9JPhOSa7and586NO4V4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bitterblue Smith , Jes Sorensen , Kalle Valo , Sasha Levin Subject: [PATCH 6.0 326/862] wifi: rtl8xxxu: gen2: Enable 40 MHz channel width Date: Wed, 19 Oct 2022 10:26:53 +0200 Message-Id: <20221019083304.425217585@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106398949434622?= X-GMAIL-MSGID: =?utf-8?q?1747106398949434622?= From: Bitterblue Smith [ Upstream commit a8b5aef2cca15b7fa533421d462e4e0a3429bd6f ] The module parameter ht40_2g was supposed to enable 40 MHz operation, but it didn't. Tell the firmware about the channel width when updating the rate mask. This makes it work with my gen 2 chip RTL8188FU. I'm not sure if anything needs to be done for the gen 1 chips, if 40 MHz channel width already works or not. They update the rate mask with a different structure which doesn't have a field for the channel width. Also set the channel width correctly for sta_statistics. Fixes: f653e69009c6 ("rtl8xxxu: Implement basic 8723b specific update_rate_mask() function") Fixes: bd917b3d28c9 ("rtl8xxxu: fill up txrate info for gen1 chips") Signed-off-by: Bitterblue Smith Acked-by: Jes Sorensen Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/3a950997-7580-8a6b-97a0-e0a81a135456@gmail.com Signed-off-by: Sasha Levin --- .../net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 6 +++--- .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 21 +++++++++++++------ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h index 7ddce3c3f0c4..782b089a2e1b 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h @@ -1425,7 +1425,7 @@ struct rtl8xxxu_fileops { void (*set_tx_power) (struct rtl8xxxu_priv *priv, int channel, bool ht40); void (*update_rate_mask) (struct rtl8xxxu_priv *priv, - u32 ramask, u8 rateid, int sgi); + u32 ramask, u8 rateid, int sgi, int txbw_40mhz); void (*report_connect) (struct rtl8xxxu_priv *priv, u8 macid, bool connect); void (*fill_txdesc) (struct ieee80211_hw *hw, struct ieee80211_hdr *hdr, @@ -1511,9 +1511,9 @@ void rtl8xxxu_gen2_config_channel(struct ieee80211_hw *hw); void rtl8xxxu_gen1_usb_quirks(struct rtl8xxxu_priv *priv); void rtl8xxxu_gen2_usb_quirks(struct rtl8xxxu_priv *priv); void rtl8xxxu_update_rate_mask(struct rtl8xxxu_priv *priv, - u32 ramask, u8 rateid, int sgi); + u32 ramask, u8 rateid, int sgi, int txbw_40mhz); void rtl8xxxu_gen2_update_rate_mask(struct rtl8xxxu_priv *priv, - u32 ramask, u8 rateid, int sgi); + u32 ramask, u8 rateid, int sgi, int txbw_40mhz); void rtl8xxxu_gen1_report_connect(struct rtl8xxxu_priv *priv, u8 macid, bool connect); void rtl8xxxu_gen2_report_connect(struct rtl8xxxu_priv *priv, diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c index 41d46c54444f..d8f5b4bb1fa9 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -4320,7 +4320,7 @@ static void rtl8xxxu_sw_scan_complete(struct ieee80211_hw *hw, } void rtl8xxxu_update_rate_mask(struct rtl8xxxu_priv *priv, - u32 ramask, u8 rateid, int sgi) + u32 ramask, u8 rateid, int sgi, int txbw_40mhz) { struct h2c_cmd h2c; @@ -4340,10 +4340,15 @@ void rtl8xxxu_update_rate_mask(struct rtl8xxxu_priv *priv, } void rtl8xxxu_gen2_update_rate_mask(struct rtl8xxxu_priv *priv, - u32 ramask, u8 rateid, int sgi) + u32 ramask, u8 rateid, int sgi, int txbw_40mhz) { struct h2c_cmd h2c; - u8 bw = RTL8XXXU_CHANNEL_WIDTH_20; + u8 bw; + + if (txbw_40mhz) + bw = RTL8XXXU_CHANNEL_WIDTH_40; + else + bw = RTL8XXXU_CHANNEL_WIDTH_20; memset(&h2c, 0, sizeof(struct h2c_cmd)); @@ -4621,7 +4626,11 @@ rtl8xxxu_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, RATE_INFO_FLAGS_SHORT_GI; } - rarpt->txrate.bw |= RATE_INFO_BW_20; + if (rtl8xxxu_ht40_2g && + (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40)) + rarpt->txrate.bw = RATE_INFO_BW_40; + else + rarpt->txrate.bw = RATE_INFO_BW_20; } bit_rate = cfg80211_calculate_bitrate(&rarpt->txrate); rarpt->bit_rate = bit_rate; @@ -4630,7 +4639,7 @@ rtl8xxxu_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, priv->vif = vif; priv->rssi_level = RTL8XXXU_RATR_STA_INIT; - priv->fops->update_rate_mask(priv, ramask, 0, sgi); + priv->fops->update_rate_mask(priv, ramask, 0, sgi, rarpt->txrate.bw == RATE_INFO_BW_40); rtl8xxxu_write8(priv, REG_BCN_MAX_ERR, 0xff); @@ -6344,7 +6353,7 @@ static void rtl8xxxu_refresh_rate_mask(struct rtl8xxxu_priv *priv, } priv->rssi_level = rssi_level; - priv->fops->update_rate_mask(priv, rate_bitmap, ratr_idx, sgi); + priv->fops->update_rate_mask(priv, rate_bitmap, ratr_idx, sgi, txbw_40mhz); } } From patchwork Wed Oct 19 08:26: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: 4689 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp213076wrs; Wed, 19 Oct 2022 02:09:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5r2Iu4H2mkTacjhNS3jweBfVGotgEf4h2rvHceQC7CcZkLpWDbOlV18ahWyvKlbaIp5chx X-Received: by 2002:a17:906:1ec5:b0:78d:b3d1:183b with SMTP id m5-20020a1709061ec500b0078db3d1183bmr5794758ejj.709.1666170546762; Wed, 19 Oct 2022 02:09:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170546; cv=none; d=google.com; s=arc-20160816; b=TGhiHjuJQUYar2uyzVPsR0OBnY2GoxSU31MVsZcjfSfFxbH5hFh10VURpausS273lR vLdOBCr6G18X3cC4CfZi1FSRuFENQZ33UQacqQrfks+m1PutjbEtWhl1nFN2/vSvTZBo yDNQIUrmuUkx2UMah8v3d41UC7tniAubK7diwp+Et87QsrYAbTGM6e2PZZejbQ3u7nNO GT5uuKV/+neMYjCWq1ex/pgo9JWbkUc5X1qpGtGewMvcmbiHF8hLWUC0gfNaA93Zho70 hTLYfyvQjg3ZJacC+pVss6gJpdZaXEexZF5lRQFyesOHBbC+qs/hCUss5EVDQbbsLPP/ e9cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=EEITlSytrn0CYt5c6KigYEaip61DSfN8ymywDT4Tvm4=; b=rIpI3udZdUytonaHBvNixBO/VDtbwri80KY4q4JqFY90CV5aXHrLcFCEQ3ifMgLY5U leuSIu3u9fibDAYr3dcyl0KH7cHptP17Ge8qRASl6wxnHeHTCGh/0jO8Dm4ifWAWuQPx HFzlnu5RHcVoNFhurpX6SMC9i6aLDoxcuJw40MFtwrTzqYPeuPwqYXI7ftA1YpKhB7Q5 CfuqyBs9sAwf7GpjgrODw9NlFkWZQQfoLdki5XcmkuvE5F+I1oMuhjU9Kfifrk2Z/C0B uO1bn7UgTZVlg/mbV+g7eljhiiD21kwnl+pXUk3wj1zlVMsAvbvUezLSv/KnMeBi+9tl jgZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eQ1ObCn0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h17-20020a05640250d100b0045ca3839229si827786edb.274.2022.10.19.02.08.41; Wed, 19 Oct 2022 02:09: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=eQ1ObCn0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232302AbiJSJFa (ORCPT + 99 others); Wed, 19 Oct 2022 05:05:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232343AbiJSJEB (ORCPT ); Wed, 19 Oct 2022 05:04: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 1CBD7A8365; Wed, 19 Oct 2022 01:56: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 1A0D56186E; Wed, 19 Oct 2022 08:52:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 31F0EC433C1; Wed, 19 Oct 2022 08:52:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169574; bh=oHE9tJqv8CS6nL9BapG4VAu818gukBIxqWQHi+694Ok=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eQ1ObCn0VjuCHnkDMT4jozTL/qghmqR5rIkd90mEMLNFnRPNtD+b+sR/ARn+oPQEX 1xUkVq/aBiaOMQNayJaaL284DPTdFBOqgP7COJBmq4kQuieIxQgRPj/apZ5YNpx6bq Rsa5ndtoz8D+SW6UBJLWdgync7slbByEWL/lpqNU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bitterblue Smith , Jes Sorensen , Kalle Valo , Sasha Levin Subject: [PATCH 6.0 327/862] wifi: rtl8xxxu: Fix AIFS written to REG_EDCA_*_PARAM Date: Wed, 19 Oct 2022 10:26:54 +0200 Message-Id: <20221019083304.476481771@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106447680756312?= X-GMAIL-MSGID: =?utf-8?q?1747106447680756312?= From: Bitterblue Smith [ Upstream commit 5574d3290449916397f3092dcd2bac92415498e1 ] ieee80211_tx_queue_params.aifs is not supposed to be written directly to the REG_EDCA_*_PARAM registers. Instead process it like the vendor drivers do. It's kinda hacky but it works. This change boosts the download speed and makes it more stable. Tested with RTL8188FU but all the other supported chips should also benefit. Fixes: 26f1fad29ad9 ("New driver: rtl8xxxu (mac80211)") Signed-off-by: Bitterblue Smith Acked-by: Jes Sorensen Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/038cc03f-3567-77ba-a7bd-c4930e3b2fad@gmail.com Signed-off-by: Sasha Levin --- .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c index d8f5b4bb1fa9..08f9d17dce12 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -4560,6 +4560,53 @@ rtl8xxxu_wireless_mode(struct ieee80211_hw *hw, struct ieee80211_sta *sta) return network_type; } +static void rtl8xxxu_set_aifs(struct rtl8xxxu_priv *priv, u8 slot_time) +{ + u32 reg_edca_param[IEEE80211_NUM_ACS] = { + [IEEE80211_AC_VO] = REG_EDCA_VO_PARAM, + [IEEE80211_AC_VI] = REG_EDCA_VI_PARAM, + [IEEE80211_AC_BE] = REG_EDCA_BE_PARAM, + [IEEE80211_AC_BK] = REG_EDCA_BK_PARAM, + }; + u32 val32; + u16 wireless_mode = 0; + u8 aifs, aifsn, sifs; + int i; + + if (priv->vif) { + struct ieee80211_sta *sta; + + rcu_read_lock(); + sta = ieee80211_find_sta(priv->vif, priv->vif->bss_conf.bssid); + if (sta) + wireless_mode = rtl8xxxu_wireless_mode(priv->hw, sta); + rcu_read_unlock(); + } + + if (priv->hw->conf.chandef.chan->band == NL80211_BAND_5GHZ || + (wireless_mode & WIRELESS_MODE_N_24G)) + sifs = 16; + else + sifs = 10; + + for (i = 0; i < IEEE80211_NUM_ACS; i++) { + val32 = rtl8xxxu_read32(priv, reg_edca_param[i]); + + /* It was set in conf_tx. */ + aifsn = val32 & 0xff; + + /* aifsn not set yet or already fixed */ + if (aifsn < 2 || aifsn > 15) + continue; + + aifs = aifsn * slot_time + sifs; + + val32 &= ~0xff; + val32 |= aifs; + rtl8xxxu_write32(priv, reg_edca_param[i], val32); + } +} + static void rtl8xxxu_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_bss_conf *bss_conf, u64 changed) @@ -4679,6 +4726,8 @@ rtl8xxxu_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, else val8 = 20; rtl8xxxu_write8(priv, REG_SLOT, val8); + + rtl8xxxu_set_aifs(priv, val8); } if (changed & BSS_CHANGED_BSSID) { From patchwork Wed Oct 19 08:26: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: 4671 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212809wrs; Wed, 19 Oct 2022 02:08:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Ww/1RShBkG5sg4kLBITijO+v7DqG6IC22Afw2IIh7Kp1h+nmkBxHqe2HGzkUKje7/3VqL X-Received: by 2002:a05:6402:2686:b0:45d:82c0:c2b6 with SMTP id w6-20020a056402268600b0045d82c0c2b6mr6278013edd.390.1666170500320; Wed, 19 Oct 2022 02:08:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170500; cv=none; d=google.com; s=arc-20160816; b=GXivSiIHaguYREmXdmEYKuGHA9gBaeWeHYTAqaHWz1KkwvwWSdLolPtudGLb4PLczs oyLqoiP2lMEQGLquGlyu3v4XRfAvuTV1/+axBswhti1o7fDnMtYSs0CmxqLLbLbjDMEn yr4gbjSrgN5Q7Qhev0fXznxk5y/xP2pMLyZERNOtXYG/izJVhBBcJtlhNrF4Q2Ll2+YH tHK0VDuUjo8Nc+uRBTRI7vfJ/07ohCM0Gm0wmh5gR+1I9LL50q1/B6b71dYi7hG6CEcT RKLI1Y5Wp8QpI1eUJjvmV9mE1IXbTPWSUfv8h3y2jSSclRoeFDe0OWZJV1rJCAGfqDho kC8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TrJi4IFQSSyIRcOaI4/eWPMMO9CVY6q+RJgai3SVUsg=; b=bEaZY1nJ39LX3IIFTL475KTwSyhgeh2EuMQTzUdVKFzNTlbe7W5uq5xCfWQsQeJFDc YfivkCKUPffSKhxlFhE3k+GlYfc1G24yHEpTUYzvCpaKBThaMzhLGgLU8QbuALsvqbRz RjjXA9uBXY7/J4OqSjs8DhpgTVy2mKXkf7J14o3+nhxpBwW4rY7xNr6CG45FSbJFj5hK LuC/uPbFUOHT/6OE+jkwSXeZpUHOi6YpjbDRcbqnM4DGBg4VQKQcL1OAleDeGsi3wXlc k5v/ZWu8TnrIBCyqa69bezStTrFDLlQVPEAt8W2i+gY2ODNcFw3mc5qAYAS9kXbmaG+N YzaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1otpvgNo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f9-20020a17090660c900b00782c6ab6f01si11760419ejk.410.2022.10.19.02.07.48; Wed, 19 Oct 2022 02:08: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=1otpvgNo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232086AbiJSJCV (ORCPT + 99 others); Wed, 19 Oct 2022 05:02:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232339AbiJSI7a (ORCPT ); Wed, 19 Oct 2022 04:59: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 1F2C645F59; Wed, 19 Oct 2022 01:55:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B4B786186A; Wed, 19 Oct 2022 08:52:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8476C433C1; Wed, 19 Oct 2022 08:52:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169577; bh=qI9liugzN9G0XVfsXLBml/djNWH/lcscIH6cMpNxmU4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1otpvgNo50GNs9CuQUCXlBilL1KKhzwP+QHO+jG/wo2a7z0hH6u5d5AtVJZKto5xx UsNqlsBLupIvFO4NONaXGqPDpoJ1Vojt43hy3rlwmqurJJ1IrDWIWvPrCDAY/zAAD8 vbt6mOxuGJ0s635YmBCEWqXB37QYfPlUzTZ819sk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Junichi Uekawa , Stefano Garzarella , "Michael S. Tsirkin" , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.0 328/862] vhost/vsock: Use kvmalloc/kvfree for larger packets. Date: Wed, 19 Oct 2022 10:26:55 +0200 Message-Id: <20221019083304.525246952@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106398426013990?= X-GMAIL-MSGID: =?utf-8?q?1747106398426013990?= From: Junichi Uekawa [ Upstream commit 0e3f72931fc47bb81686020cc643cde5d9cd0bb8 ] When copying a large file over sftp over vsock, data size is usually 32kB, and kmalloc seems to fail to try to allocate 32 32kB regions. vhost-5837: page allocation failure: order:4, mode:0x24040c0 Call Trace: [] dump_stack+0x97/0xdb [] warn_alloc_failed+0x10f/0x138 [] ? __alloc_pages_direct_compact+0x38/0xc8 [] __alloc_pages_nodemask+0x84c/0x90d [] alloc_kmem_pages+0x17/0x19 [] kmalloc_order_trace+0x2b/0xdb [] __kmalloc+0x177/0x1f7 [] ? copy_from_iter+0x8d/0x31d [] vhost_vsock_handle_tx_kick+0x1fa/0x301 [vhost_vsock] [] vhost_worker+0xf7/0x157 [vhost] [] kthread+0xfd/0x105 [] ? vhost_dev_set_owner+0x22e/0x22e [vhost] [] ? flush_kthread_worker+0xf3/0xf3 [] ret_from_fork+0x4e/0x80 [] ? flush_kthread_worker+0xf3/0xf3 Work around by doing kvmalloc instead. Fixes: 433fc58e6bf2 ("VSOCK: Introduce vhost_vsock.ko") Signed-off-by: Junichi Uekawa Reviewed-by: Stefano Garzarella Acked-by: Michael S. Tsirkin Link: https://lore.kernel.org/r/20220928064538.667678-1-uekawa@chromium.org Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/vhost/vsock.c | 2 +- net/vmw_vsock/virtio_transport_common.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c index 368330417bde..5703775af129 100644 --- a/drivers/vhost/vsock.c +++ b/drivers/vhost/vsock.c @@ -393,7 +393,7 @@ vhost_vsock_alloc_pkt(struct vhost_virtqueue *vq, return NULL; } - pkt->buf = kmalloc(pkt->len, GFP_KERNEL); + pkt->buf = kvmalloc(pkt->len, GFP_KERNEL); if (!pkt->buf) { kfree(pkt); return NULL; diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c index ec2c2afbf0d0..3a12aee33e92 100644 --- a/net/vmw_vsock/virtio_transport_common.c +++ b/net/vmw_vsock/virtio_transport_common.c @@ -1342,7 +1342,7 @@ EXPORT_SYMBOL_GPL(virtio_transport_recv_pkt); void virtio_transport_free_pkt(struct virtio_vsock_pkt *pkt) { - kfree(pkt->buf); + kvfree(pkt->buf); kfree(pkt); } EXPORT_SYMBOL_GPL(virtio_transport_free_pkt); From patchwork Wed Oct 19 08:26: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: 5075 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp249280wrs; Wed, 19 Oct 2022 03:45:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4/aRqRV/EbwDC/7XUsAdRNLiPKuTCR94lEPAybVD+CW+dC7C6VOuvLF2LjPX/BWVT06rkh X-Received: by 2002:a17:902:c792:b0:17f:9255:3185 with SMTP id w18-20020a170902c79200b0017f92553185mr7633958pla.100.1666176348796; Wed, 19 Oct 2022 03:45:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176348; cv=none; d=google.com; s=arc-20160816; b=eakiyVkgNMaNMNeu3/0uCD7oldVIWkOF4Awj11B1CGvSAO8pwDwajQRanNfQAqFyYW 0qJWS3Zkdxc8iOTubvNkDs0nb4ZF4ieSRV9Rplni4iFaIT6j3ZzbpPcQARfW3++2JWFg kohC/YHYdhzAwpAJDe1KLy8r3Y1Uwv4hj4zTmveOfbCaoshdaH77lsofxNZh2S4wRDUW IM7rJ7WMYfHi7Qx+p5G3oS9HDoHM1KQoHOk2DW4/F+CIDXalN+Q2ckHdmTm/mW/CIbGN 6iQpdQbPM/P9sh+oqyWD3wZUYR6L69y4KYNHmrhkvv2/NN/sdf7hU72cBZR7S/o02eJg SAkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dRWhc9IrM5i0Z6x5VvW/anGd+5oiVAOqYKSYFU6kae4=; b=Ir24DoZmEMsDZ0OWWWuX9kaUi2JPAnL2saYZdH2b3MAaIW+TA1FnU7jkgkXEsA9Gnz VyvG+RLA2bgtYiM+ROgEveleIRyimV4J3VJAxA9ellaWWGDpy5p5sD0mNitcw7ECqaZo QUXBCQH/O21/+AwEp6h7CTudkgu0U5fEJGtkB4hfgmxfjE8dUMeKAmDTHrW+W6s6oIML 5S7pOw4v79cFJxlW5tWyNB6dfDWQrev0eH1PX6LLwWYto1gnq+oV4GIoW1QS76RLDl7R X8Iu0urlPEd8UC6nwCHTW1E4Xwt8AK0OXa4rKUzJ0QoRa5NKgL7BlsuEyalSW2qyj2w6 vwuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MxAaIDye; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b14-20020a170902b60e00b00176a2d5ae14si17069428pls.363.2022.10.19.03.45.32; Wed, 19 Oct 2022 03:45: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=MxAaIDye; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232615AbiJSKpQ (ORCPT + 99 others); Wed, 19 Oct 2022 06:45:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232511AbiJSKng (ORCPT ); Wed, 19 Oct 2022 06:43:36 -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 A25DF237E0; Wed, 19 Oct 2022 03:20:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 021E7B823A5; Wed, 19 Oct 2022 08:53:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7679FC433D6; Wed, 19 Oct 2022 08:52:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169579; bh=RZ6NS0SnC3gnbfETbcJ/j5wvx8/vJ3dE1h7eQRYb3WY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MxAaIDyeIWw6On5qTJFRLHSTgEYJVTX0AHT+CSEGE2qGr+Dq8/Zgq5189e1540KNG WlSMkBgQy7eVqt9nyaoDN7tLt2vDz8iatXpM2zVNm7jSOkGQ6tDEULQ9RQHP57PA9B fXDZ8tZ9gbDgMjWODVnjFSWvgz7ehMsU7+5iAFac= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Niels Dossche , Jakub Kicinski , Sasha Levin , Zbynek Michl Subject: [PATCH 6.0 329/862] eth: alx: take rtnl_lock on resume Date: Wed, 19 Oct 2022 10:26:56 +0200 Message-Id: <20221019083304.575357707@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112531061487656?= X-GMAIL-MSGID: =?utf-8?q?1747112531061487656?= From: Jakub Kicinski [ Upstream commit 6ad1c94e1e7e374d88f0cfd77936dddb8339aaba ] Zbynek reports that alx trips an rtnl assertion on resume: RTNL: assertion failed at net/core/dev.c (2891) RIP: 0010:netif_set_real_num_tx_queues+0x1ac/0x1c0 Call Trace: __alx_open+0x230/0x570 [alx] alx_resume+0x54/0x80 [alx] ? pci_legacy_resume+0x80/0x80 dpm_run_callback+0x4a/0x150 device_resume+0x8b/0x190 async_resume+0x19/0x30 async_run_entry_fn+0x30/0x130 process_one_work+0x1e5/0x3b0 indeed the driver does not hold rtnl_lock during its internal close and re-open functions during suspend/resume. Note that this is not a huge bug as the driver implements its own locking, and does not implement changing the number of queues, but we need to silence the splat. Fixes: 4a5fe57e7751 ("alx: use fine-grained locking instead of RTNL") Reported-and-tested-by: Zbynek Michl Reviewed-by: Niels Dossche Link: https://lore.kernel.org/r/20220928181236.1053043-1-kuba@kernel.org Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/atheros/alx/main.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/ethernet/atheros/alx/main.c b/drivers/net/ethernet/atheros/alx/main.c index a89b93cb4e26..d5939586c82e 100644 --- a/drivers/net/ethernet/atheros/alx/main.c +++ b/drivers/net/ethernet/atheros/alx/main.c @@ -1912,11 +1912,14 @@ static int alx_suspend(struct device *dev) if (!netif_running(alx->dev)) return 0; + + rtnl_lock(); netif_device_detach(alx->dev); mutex_lock(&alx->mtx); __alx_stop(alx); mutex_unlock(&alx->mtx); + rtnl_unlock(); return 0; } @@ -1927,6 +1930,7 @@ static int alx_resume(struct device *dev) struct alx_hw *hw = &alx->hw; int err; + rtnl_lock(); mutex_lock(&alx->mtx); alx_reset_phy(hw); @@ -1943,6 +1947,7 @@ static int alx_resume(struct device *dev) unlock: mutex_unlock(&alx->mtx); + rtnl_unlock(); return err; } From patchwork Wed Oct 19 08:26: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: 4913 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225743wrs; Wed, 19 Oct 2022 02:43:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6N8ZFnCvUMxQ1y8LR/qZ/0zEbNhFg5hVnt6nsFgeqnh0PMDnesXPx6fpDsmemC5mdSFXvm X-Received: by 2002:a05:6402:11ce:b0:45c:a2a2:4207 with SMTP id j14-20020a05640211ce00b0045ca2a24207mr6517148edw.3.1666172635055; Wed, 19 Oct 2022 02:43:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172635; cv=none; d=google.com; s=arc-20160816; b=n1MnDPUiO+5bEag+aSotI7nv/TIYzRaNIPfIUVDHZxwFcJ4emY4a3cXENXIrh2aNEP X2/4jp5zGHK2EeQzgCCLhD9Pi8/GQ7D2TKhuM8A4Km2c+KmNJIzHOYsE1U9uuRVxMRE5 wb7b7l4KvggtCTwUP86E32Zzm5OIwuWxHe310A9JNzCdrrpLoSbRrObl4yIgq/0WQue9 GavvkmIa7Wwsv2MVaI1YnmpE9Y4CkcbgzYLj1nqYkyuEsG2GHKwOFW9pkjEMxHwPB7eR sM0vcIyt3WlFAx8CT+uznTL0TG7IMb8jJP2/dGYMAWHZChXWatXpmV/2UrNu02La5bsV F64g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=p8l2m2NHhPOpZ8OREbIlejd/CKEhwKGWuFVuNbozv38=; b=z/r0WtKTacHF5H9OAV5Omw1NU0Y+BkJP5S23LMnjJjbedHKjVI6lWElqMl1l9+Fefx kBOUmdewVB8367AHtxaz0mE+Zh6n/YgP/Mx3Myw1kjs0in3PAA6YCvfVgemDNQpPSg/9 8smV1LHQ/AmfJSg+HaW8QpT55y/7CuuzUIHWbQS+IMB1RY7A/qR4XNhH/kCgHguK8rc2 AN9/ia0xNWzyenrJKezsCDUbCjlhYtCqV9zO9UKZqKN1MGlRikCfV9tDJdqHQ8iudgVz ms/rTgKn7/yrmHgo0op+L+oxCD9fwqkrrD9T9s5Ow5w3+fpA9zg191Fww3iGcPxJiaQN B5Bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Yr4moDHi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y18-20020aa7ce92000000b00442296a8407si11982250edv.629.2022.10.19.02.43.23; Wed, 19 Oct 2022 02:43: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=Yr4moDHi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233784AbiJSJfP (ORCPT + 99 others); Wed, 19 Oct 2022 05:35:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233852AbiJSJ3j (ORCPT ); Wed, 19 Oct 2022 05:29:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4711DEC506; Wed, 19 Oct 2022 02:13: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 0136A617D4; Wed, 19 Oct 2022 08:53:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 15B61C433D6; Wed, 19 Oct 2022 08:53:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169582; bh=1vk9cCfPuQn9h6X3LRfdcgmD8iNffBsmLEgziE8/sDQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yr4moDHiumw1htwqf5LLIr/JIYqnHhsemD1jOpoEpF4kxUx5sc/KGxvlhJfgDx/JX RWlahGynZc47t+LOrh3NhfYOyTiUKRTeZZS4dSKWjoj4p+WqB3D5zBNKy7b3fDoksD 0v6Mb1uZdZ+IbmmWYPhQHLlLq3HlZmeYO1tWkFgA= 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 6.0 330/862] mISDN: fix use-after-free bugs in l1oip timer handlers Date: Wed, 19 Oct 2022 10:26:57 +0200 Message-Id: <20221019083304.622646224@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108637027180361?= X-GMAIL-MSGID: =?utf-8?q?1747108637027180361?= From: Duoming Zhou [ Upstream commit 2568a7e0832ee30b0a351016d03062ab4e0e0a3f ] The l1oip_cleanup() traverses the l1oip_ilist and calls release_card() to cleanup module and stack. However, release_card() calls del_timer() to delete the timers such as keep_tl and timeout_tl. If the timer handler is running, the del_timer() will not stop it and result in UAF bugs. One of the processes is shown below: (cleanup routine) | (timer handler) release_card() | l1oip_timeout() ... | del_timer() | ... ... | kfree(hc) //FREE | | hc->timeout_on = 0 //USE Fix by calling del_timer_sync() in release_card(), which makes sure the timer handlers have finished before the resources, such as l1oip and so on, have been deallocated. What's more, the hc->workq and hc->socket_thread can kick those timers right back in. We add a bool flag to show if card is released. Then, check this flag in hc->workq and hc->socket_thread. Fixes: 3712b42d4b1b ("Add layer1 over IP support") Signed-off-by: Duoming Zhou Reviewed-by: Leon Romanovsky Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/isdn/mISDN/l1oip.h | 1 + drivers/isdn/mISDN/l1oip_core.c | 13 +++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/isdn/mISDN/l1oip.h b/drivers/isdn/mISDN/l1oip.h index 7ea10db20e3a..48133d022812 100644 --- a/drivers/isdn/mISDN/l1oip.h +++ b/drivers/isdn/mISDN/l1oip.h @@ -59,6 +59,7 @@ struct l1oip { int bundle; /* bundle channels in one frm */ int codec; /* codec to use for transmis. */ int limit; /* limit number of bchannels */ + bool shutdown; /* if card is released */ /* timer */ struct timer_list keep_tl; diff --git a/drivers/isdn/mISDN/l1oip_core.c b/drivers/isdn/mISDN/l1oip_core.c index 2c40412466e6..a77195e378b7 100644 --- a/drivers/isdn/mISDN/l1oip_core.c +++ b/drivers/isdn/mISDN/l1oip_core.c @@ -275,7 +275,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; @@ -601,7 +601,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 */ @@ -1232,11 +1234,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 Wed Oct 19 08:26: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: 5578 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp352608wrs; Wed, 19 Oct 2022 07:17:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM58eaLHXfm7wLaK/1s1XAeyyAHNnGcZ95uHnAJhlTuEtPHPBULLEuOytMbsX8OKb2uvXYvn X-Received: by 2002:a17:907:a047:b0:78d:b8ac:765d with SMTP id gz7-20020a170907a04700b0078db8ac765dmr6887618ejc.631.1666189031344; Wed, 19 Oct 2022 07:17:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666189031; cv=none; d=google.com; s=arc-20160816; b=aA3Y1oJ1b8LBhgC8wLLMp4aDThzJbUxosTzzl5O9T67dvxxVRzB5XJ2qJeUd8j53o5 7qBipCKM5ZK+Izi9ITPRblnS1tqq5rUzBVH0+z4NK8J4ht9j+Nn5HPScUz+CwNBEC+0E BY2H/gKUS5MdPZv/bDdhjxJP6jGiaGrUKCFyHyYu2eo2EPzLg36IExcGEgmPhkac80Kn 3jbCYJrVMbZ1sCcezGOlaryfw5aHW9/cYM/OV/vIokHNRYVa4TY+HRO5nHvKFYnSOwxw xekbEnMbdrwB3QmpOnGZYgEfNqXIAEpIi2WqHZckuoXplGS8TywPLW5qrEcjLDeCBb34 zxQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=g9z8YdGt90JpK2hCM+zsBv3a81ZKd8cUT021uMxF+YI=; b=MJiHNpUwlWVmHZBlItDu2gOvNctMQDTjBQhb52yzNH2ir6xD3X6KAloEnU2pmINWtr eEHURZ5dnidJWvIlxB/3ZMCrz9CvfWTV/w8HQBrHiMD0/tEKq8GZ6kFqKTIOg7lUnveq vvrzSaS67Zs/i5mP+RjWGAlPvgxxWretq9CPxDAZDs5FpGDzjixeGHLP1Q3f3OCEhjoa 3wKfr3M7fXwy7mbS5SwhqkPvqp0z2pbPKWSg7aXB7BDaqoa7tN5uRKCaOU1CB10+F0+X BUt40nvP1ky7XIFYmj2UrSzWrsTfyHtbrUvnYiOuqwQF1cwnn7EZkdAsrz/i6fd2w9CI OK6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=o3YpWtus; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a05640250d000b0045a1e2373dbsi16430235edb.44.2022.10.19.07.16.35; Wed, 19 Oct 2022 07:17: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=o3YpWtus; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230424AbiJSOGQ (ORCPT + 99 others); Wed, 19 Oct 2022 10:06:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231197AbiJSOFy (ORCPT ); Wed, 19 Oct 2022 10:05:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6ED7E18F0EA; Wed, 19 Oct 2022 06:47: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 53D05B823A6; Wed, 19 Oct 2022 08:53:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ACDF9C433C1; Wed, 19 Oct 2022 08:53:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169585; bh=jOc7LW7IWzijjP0DhfLG0KzytqA6AuX/PkOEIoEOpsI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o3YpWtusGJWny0DDTbl5HgnPAAHms+odBVXZnIn01lPv15rB+fSvr8om7gqMMvI87 unj1Haqk01aKYjtCKAi/jh3Kj54Zh8tU3ObitecEjcLOyyAVl2NQOa7bg/psBCQFuD /XHsKuk4s38qWmoey+6bvbnUmYCGN1vgMD8UL6Uw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+a236dd8e9622ed8954a3@syzkaller.appspotmail.com, Xin Long , "David S. Miller" , Sasha Levin Subject: [PATCH 6.0 331/862] sctp: handle the error returned from sctp_auth_asoc_init_active_key Date: Wed, 19 Oct 2022 10:26:58 +0200 Message-Id: <20221019083304.672045967@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747125829530842064?= X-GMAIL-MSGID: =?utf-8?q?1747125829530842064?= From: Xin Long [ Upstream commit 022152aaebe116a25c39818a07e175a8cd3c1e11 ] When it returns an error from sctp_auth_asoc_init_active_key(), the active_key is actually not updated. The old sh_key will be freeed while it's still used as active key in asoc. Then an use-after-free will be triggered when sending patckets, as found by syzbot: sctp_auth_shkey_hold+0x22/0xa0 net/sctp/auth.c:112 sctp_set_owner_w net/sctp/socket.c:132 [inline] sctp_sendmsg_to_asoc+0xbd5/0x1a20 net/sctp/socket.c:1863 sctp_sendmsg+0x1053/0x1d50 net/sctp/socket.c:2025 inet_sendmsg+0x99/0xe0 net/ipv4/af_inet.c:819 sock_sendmsg_nosec net/socket.c:714 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:734 This patch is to fix it by not replacing the sh_key when it returns errors from sctp_auth_asoc_init_active_key() in sctp_auth_set_key(). For sctp_auth_set_active_key(), old active_key_id will be set back to asoc->active_key_id when the same thing happens. Fixes: 58acd1009226 ("sctp: update active_key for asoc when old key is being replaced") Reported-by: syzbot+a236dd8e9622ed8954a3@syzkaller.appspotmail.com Signed-off-by: Xin Long Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/sctp/auth.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/net/sctp/auth.c b/net/sctp/auth.c index db6b7373d16c..34964145514e 100644 --- a/net/sctp/auth.c +++ b/net/sctp/auth.c @@ -863,12 +863,17 @@ int sctp_auth_set_key(struct sctp_endpoint *ep, } list_del_init(&shkey->key_list); - sctp_auth_shkey_release(shkey); list_add(&cur_key->key_list, sh_keys); - if (asoc && asoc->active_key_id == auth_key->sca_keynumber) - sctp_auth_asoc_init_active_key(asoc, GFP_KERNEL); + if (asoc && asoc->active_key_id == auth_key->sca_keynumber && + sctp_auth_asoc_init_active_key(asoc, GFP_KERNEL)) { + list_del_init(&cur_key->key_list); + sctp_auth_shkey_release(cur_key); + list_add(&shkey->key_list, sh_keys); + return -ENOMEM; + } + sctp_auth_shkey_release(shkey); return 0; } @@ -902,8 +907,13 @@ int sctp_auth_set_active_key(struct sctp_endpoint *ep, return -EINVAL; if (asoc) { + __u16 active_key_id = asoc->active_key_id; + asoc->active_key_id = key_id; - sctp_auth_asoc_init_active_key(asoc, GFP_KERNEL); + if (sctp_auth_asoc_init_active_key(asoc, GFP_KERNEL)) { + asoc->active_key_id = active_key_id; + return -ENOMEM; + } } else ep->active_key_id = key_id; From patchwork Wed Oct 19 08:26: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: 4676 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212834wrs; Wed, 19 Oct 2022 02:08:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Jx5vQRyoYSZ+5P9HP8JFxUL4kD8vseRGR6VZqBDnDwFF4iF0APelniXHkNs72ej5H/5gr X-Received: by 2002:a17:906:db0d:b0:77b:a7cd:8396 with SMTP id xj13-20020a170906db0d00b0077ba7cd8396mr6152084ejb.264.1666170506087; Wed, 19 Oct 2022 02:08:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170506; cv=none; d=google.com; s=arc-20160816; b=MMlzwSNtCYHwPEt+3KEYjJ1Mv2+5IoVB64BL5NqivTygFrL09QWNIDyLhH8IlLj6Sk DCpM7r3vWzfZBxpc9RDF3TWOt5yMuZUpNAyvJ9JoMJppcV5S68ucJt5ZRBwQ3fpfVmsP Ka4DP+8L2PbDYe/3E6DqU1JPureEjgtvTYuohkAK0rF2gEoQgC+32syHF2WtcgI93ycb 4rI81nytoSN266k0gUb7Zx2q7grK+2aumJzD9k1lxTzExSSD4SDshu6seJdGBK3Ar/Om LoJZcEVONn4Pen9qE0omzPL43qPk5lK/rjrd7zdefq+xZ/WsnV9X0cpEPiqOMtpTEOLh R8aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=V+087jM+Kzpqm/ohpXzL5yjbM2c7Rs45KMmy8kc5zqE=; b=wxE82/jWMYENmhs2efmZ/GXJw5tAc8r80XPzLGk5sJPeTZTNT8JRqW4BuRiOZP7nBC F20wQrKhdRoMYUSugbSkBVC2dWOrE4Obqz2zbz61GQOJTQdhK+xv0XKP9ogMXyDzpFRr bwCDvJwcNfx39cxRu2kmOAqNq7TQ4n0SuEra2fSJU1myvBjduW3Jx/b2RQ5eSgZcFdeF bL6KZVCPFCnvMwycv1LZFREZuOEW6cQR/Z+EYCcN3nQkypd13Ubnu/6Lu8gUWvZBYbtX E3yutRpZBYFdxRpILVdMzZYd1o0QdnDWxchY+2ZbFQbZxhR4hGuDltznTuSwJG+ct1Rg B/iQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IaTKdeSg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id tz14-20020a170907c78e00b0078e27f2fbe4si9070011ejc.293.2022.10.19.02.07.55; Wed, 19 Oct 2022 02:08: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=IaTKdeSg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232119AbiJSJCc (ORCPT + 99 others); Wed, 19 Oct 2022 05:02:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232415AbiJSI7q (ORCPT ); Wed, 19 Oct 2022 04:59:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3061612A9D; Wed, 19 Oct 2022 01:55: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 C826461866; Wed, 19 Oct 2022 08:53:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4F4EC433D6; Wed, 19 Oct 2022 08:53:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169590; bh=6kvcWx+c4BB3mvwttTIv3Zj7qhfnuhSGxxgp4Ktanp8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IaTKdeSgjXKOejuFSKAQ+JP+SwDq/0NMktOMYoV6Ab244sCeRAc1R8nRsuYOe9cMA X1/xEuNJucukd6x4Uuj6t3lxJmAuHHbxuf37h9Anc7CsXpG+Os1YpNtMNJgkW3JUCF z79UDOuhebgsqWpPu20GgeTqHotCAmRKHm1IPyJQ= 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 6.0 332/862] tcp: fix tcp_cwnd_validate() to not forget is_cwnd_limited Date: Wed, 19 Oct 2022 10:26:59 +0200 Message-Id: <20221019083304.711344157@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106404248238037?= X-GMAIL-MSGID: =?utf-8?q?1747106404248238037?= 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 a9fbe22732c3..4791fd801945 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h @@ -295,7 +295,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 d10962b9f0d0..95c1d51393ac 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -1295,11 +1295,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 tcp_snd_cwnd(tp) < 2 * tp->max_packets_out; - return tp->is_cwnd_limited; + return false; } /* BBR congestion control needs pacing. diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index e373dde1f46f..997a80ce1e13 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -3137,6 +3137,8 @@ int tcp_disconnect(struct sock *sk, int flags) tp->snd_ssthresh = TCP_INFINITE_SSTHRESH; tcp_snd_cwnd_set(tp, TCP_INIT_CWND); tp->snd_cwnd_cnt = 0; + tp->is_cwnd_limited = 0; + tp->max_packets_out = 0; tp->window_clamp = 0; tp->delivered = 0; tp->delivered_ce = 0; diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 290019de766d..c69f4d966024 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -1875,15 +1875,20 @@ static void tcp_cwnd_validate(struct sock *sk, bool is_cwnd_limited) const struct tcp_congestion_ops *ca_ops = inet_csk(sk)->icsk_ca_ops; struct tcp_sock *tp = tcp_sk(sk); - /* Track the maximum number of outstanding packets in each - * window, and remember whether we were cwnd-limited then. + /* Track the strongest available signal of the degree to which the cwnd + * is fully utilized. If cwnd-limited then remember that fact for the + * current window. If not cwnd-limited then track the maximum number of + * outstanding packets in the current window. (If cwnd-limited then we + * chose to not update tp->max_packets_out to avoid an extra else + * clause with no functional impact.) */ - if (!before(tp->snd_una, tp->max_packets_seq) || - tp->packets_out > tp->max_packets_out || - is_cwnd_limited) { - tp->max_packets_out = tp->packets_out; - tp->max_packets_seq = tp->snd_nxt; + if (!before(tp->snd_una, tp->cwnd_usage_seq) || + is_cwnd_limited || + (!tp->is_cwnd_limited && + tp->packets_out > tp->max_packets_out)) { tp->is_cwnd_limited = is_cwnd_limited; + tp->max_packets_out = tp->packets_out; + tp->cwnd_usage_seq = tp->snd_nxt; } if (tcp_is_cwnd_limited(sk)) { From patchwork Wed Oct 19 08:27: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: 4678 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212864wrs; Wed, 19 Oct 2022 02:08:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5OpxqUQjwhAbsjXSQHqfpVJ8TqWpzLxReSirBprNc9qBmhEaZoFHxOd2lyAwe7e7YnLxyO X-Received: by 2002:a17:907:2702:b0:78e:e94:2ac4 with SMTP id w2-20020a170907270200b0078e0e942ac4mr5816599ejk.679.1666170511803; Wed, 19 Oct 2022 02:08:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170511; cv=none; d=google.com; s=arc-20160816; b=XxegMDIXX8lZu0tu7sg0GAZHVIWsZbwC6K82TnWO4eaDAi0pWvpqJgnLCid89LKI7X Gi1QE4hC7FMBXamKkspPnp87ASN4X/xwjEVAtAf6dmvShqunjhNSkWGxkRzIgnWHi2eJ cSo6d5WtF1eB805qOnBkHUqVDpXLB00VKQSQoQ8IXSmo6y6B22Qs44EIIpFlsHX9dkoL anbd9BFI+G4kgnTqoqSWKNRIh0u0pRpu985RQiutIF6XA+5mgiCkJnNJ6lUqHetnWmlf AiZQ1Ngfd03FuZGSwdBDRFsnbx/55Ri+ODTseFdL8gaQPAsMMFrvSe2YeEQussepjkn2 aCIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fL15fGdblnwNlIPCWmI+gsYyn/RSY8WYIj7lQ0ZygOU=; b=LoZsQAHVl7ZqXdC8cAVDXkkYlSFqPPXAWM3kCkdcivbOZaAkDdNd73gIiy9/F4ULRK Zq+3uNLIBwGQ97ldFbds88sCKfj4CcLqgrt9NMcJ3LnszkW1q3bhd81kBuF2dGn/osJf KQxLw9HEzJN3JfBTxK2HYXPjCLBXH/eBnlshCR7xUpUBiUAGACZyif1/tfg8sDxN4jJE xPZze1ZD8rDwWbK18ZPPTTt3IvZfSBXDCBFw9QpHBOL6S4fkUFn/SbpJxF+FcYLAXs9w /vro0OPkVpZjELSOjMKCmWjoDUyEANoLRA/LowqnsaKgtARCPuc7q9Fn6PcKXSN2cMW6 ybPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lVH1b+Sj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mp34-20020a1709071b2200b0078034101c0esi14431149ejc.978.2022.10.19.02.07.59; Wed, 19 Oct 2022 02:08: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=lVH1b+Sj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230108AbiJSJCm (ORCPT + 99 others); Wed, 19 Oct 2022 05:02:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232430AbiJSI7t (ORCPT ); Wed, 19 Oct 2022 04:59: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 74990580A6; Wed, 19 Oct 2022 01:55:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6323D61820; Wed, 19 Oct 2022 08:53:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78432C433C1; Wed, 19 Oct 2022 08:53:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169592; bh=eeSeoHdymaZAStSpJkEUImWkEipTe314hArLSoIZmUo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lVH1b+SjaBFPNaegwA/qVHzefePQPaDZIG79UeTUr1H8oG/z4XANTlEwqUx2IVCPt uNU/1H5ZCWwTkZrMHt/UuN2KkHFKmoWzI/WrrFy00uEk6dgxgCSvzuzEQJ6JBNvXJc TmgiT4oxw4sz+4ASG6r8PGgp917UdZtPCCc+jej0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marek Szyprowski , Mark Brown , Sasha Levin Subject: [PATCH 6.0 333/862] spi: Ensure that sg_table wont be used after being freed Date: Wed, 19 Oct 2022 10:27:00 +0200 Message-Id: <20221019083304.757698722@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106410637576543?= X-GMAIL-MSGID: =?utf-8?q?1747106410637576543?= From: Marek Szyprowski [ Upstream commit 8e9204cddcc3fea9affcfa411715ba4f66e97587 ] SPI code checks for non-zero sgt->orig_nents to determine if the buffer has been DMA-mapped. Ensure that sg_table is really zeroed after free to avoid potential NULL pointer dereference if the given SPI xfer object is reused again without being DMA-mapped. Fixes: 0c17ba73c08f ("spi: Fix cache corruption due to DMA/PIO overlap") Signed-off-by: Marek Szyprowski Link: https://lore.kernel.org/r/20220930113408.19720-1-m.szyprowski@samsung.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 32c01e684af3..4b42f2302a8a 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -1097,6 +1097,8 @@ void spi_unmap_buf(struct spi_controller *ctlr, struct device *dev, if (sgt->orig_nents) { dma_unmap_sg(dev, sgt->sgl, sgt->orig_nents, dir); sg_free_table(sgt); + sgt->orig_nents = 0; + sgt->nents = 0; } } From patchwork Wed Oct 19 08:27: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: 5579 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp352762wrs; Wed, 19 Oct 2022 07:17:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4BLhLS6FYLeOCnmT8Gra+nu+pje+uovxgHJof9AcK8fwUKSN3bj5XowK2+4EENKCBZ5/uO X-Received: by 2002:a17:906:cc0f:b0:78e:1208:8796 with SMTP id ml15-20020a170906cc0f00b0078e12088796mr6881028ejb.601.1666189046623; Wed, 19 Oct 2022 07:17:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666189046; cv=none; d=google.com; s=arc-20160816; b=emuFU16nEUMKfKBS7FeYreAeAFAxJvqxKVphhHxUJvTvGYiGZufujYbMcVZ0a3rUOf AeAqq10Nf6ssR9/2P+oarziK/XWfeXdyrtd/EDwZYg6+fsJfTcWdrpi7eFWKDjsVJWrk vSRXuYXSZ3RkfScj+n8fI7vgI3dSmzBtChZ6IDI37oi3L/bKh8hlrfuVeVx9s5fhwfKO 2+zfOkiTmWzf8t0CTM5Uqa4rm3RPODdUbTU9CjfgjSck4tZdD9GeYxn4VyXtL4g5n01C MO9PZqjMJPR9/cQO4B8b1vRseaogljTjFulNlnaatkxbmOj7xdQ1sU57PbLeX9lU2Emb TflQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tBtdbcsK+t0wOohTUHzEQT96sqhjLsrcaEN0zRpbzn8=; b=BvKXMZueXRS3/baTV8bRBU3fJHVWiLTQGnPUWOXsvdbw1vkruxrpow+R7TNRyjM+hB dNNfGAVIh3OFG4WCDKvJtLGJptm2AeWcnYpTlh0qDv7EjadOw0l/kADqx0cSZQ3G3IF7 ZONsJgP+WANZUwlQENlgNLFlcsVcrm21d8x++Fhg9NYOEKeshqvOx6NNI+rT2SiYw7wr kjjWNUrZiOTtOYWhM6oNn4BZHYX3idy9I6mnO6LcyYpcuG0RDyCBHHrSwgFjEfzSo7PM RJ1mxgt8kQfbhlBQQj01hrsEPLSBCDyqPAGOHe9zYDFXND6zgrR2Ve+7vu7GgqU+K8dU nYIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RsdyRXQF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qw20-20020a1709066a1400b0078dad5e8d65si13035327ejc.68.2022.10.19.07.16.53; Wed, 19 Oct 2022 07:17: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=RsdyRXQF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232323AbiJSOGy (ORCPT + 99 others); Wed, 19 Oct 2022 10:06:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232353AbiJSOGd (ORCPT ); Wed, 19 Oct 2022 10:06:33 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E31D172B64; Wed, 19 Oct 2022 06:48:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A6A8BB823AC; Wed, 19 Oct 2022 08:53:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D3DCC433D6; Wed, 19 Oct 2022 08:53:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169595; bh=0KkmT5SgT36Ll04Lwr9o7RYoOWeWFnvdMbc5wTRsvb0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RsdyRXQFU62y3KRlku0zMPRsg41cEw+uxanDm+pgSPdZ3+WFHP8lMLGAE7OyGXL1I rH8tFL8MwziEYU1kVYnFLd6fafw2Dyip2hqH84qn4JjOm4xbqUWjVNeDdZnFX/lX/y Tj+1o6Vy5pn6Y18UR31myAkMzUXUha6b+kM4CjcU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Luiz Augusto von Dentz , Tedd Ho-Jeong An , Sasha Levin Subject: [PATCH 6.0 334/862] Bluetooth: hci_sync: Fix not indicating power state Date: Wed, 19 Oct 2022 10:27:01 +0200 Message-Id: <20221019083304.805307471@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747125845508560540?= X-GMAIL-MSGID: =?utf-8?q?1747125845508560540?= From: Luiz Augusto von Dentz [ Upstream commit 6abf0dae8c3c927f54e62c46faf8aba580ba0d04 ] When setting power state using legacy/non-mgmt API (e.g hcitool hci0 up) the likes of mgmt_set_powered_complete won't be called causing clients of the MGMT API to not be notified of the change of the state. Fixes: cf75ad8b41d2 ("Bluetooth: hci_sync: Convert MGMT_SET_POWERED") Signed-off-by: Luiz Augusto von Dentz Tested-by: Tedd Ho-Jeong An Signed-off-by: Sasha Levin --- net/bluetooth/hci_sync.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c index fbd5613eebfc..f70798589bf5 100644 --- a/net/bluetooth/hci_sync.c +++ b/net/bluetooth/hci_sync.c @@ -4355,6 +4355,7 @@ int hci_dev_open_sync(struct hci_dev *hdev) hci_dev_test_flag(hdev, HCI_MGMT) && hdev->dev_type == HCI_PRIMARY) { ret = hci_powered_update_sync(hdev); + mgmt_power_on(hdev, ret); } } else { /* Init failed, cleanup */ From patchwork Wed Oct 19 08:27:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5051 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp247722wrs; Wed, 19 Oct 2022 03:41:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4vMpWGXDNgAHgXHCuv8dILMapOuZlqL5hQj5aFhXIXwVNwn1gTKtlHJdfGLBqlGnmHbYCY X-Received: by 2002:a17:907:d22:b0:78e:2788:51ae with SMTP id gn34-20020a1709070d2200b0078e278851aemr6037043ejc.689.1666176097310; Wed, 19 Oct 2022 03:41:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176097; cv=none; d=google.com; s=arc-20160816; b=tiVNPoeIe1TYCKJlFUa7TGcAJwDKCfSEID6zzmZ3r/Q3LjD1iZH/PRCTV3vf32djm8 R2rur3ArFJnm36uGjCCljEPUrerBYVNDb906KW5nAV73OpU8Z0EhzIU0VfZ4cZ70kw13 EUHQO6kl8kZynpBsbHKFZ7OSTbl5bP9j8MlLOsWbQhJ1uigxccYYvEND2VccQD9exBb9 BlToDVePml0E+/XNg9ERKQiWJxHb5c6HvE/CAxswQKz4SBIR76BYrW5/gNy8MTy4Flwp kqMb0BQTlWjJHMHDLexBy9mXhYQC6vNPUhFkJ3Ba/lUAw/Z2pjPaPTLJeCj582GbMkNk zkZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2Zbb8w+LmaZVDpJVt0ahQZ3eHBRJJKPNOm/xBC0g4yQ=; b=r8ex69GnstS8a6fv5gkUy7u3XW7EnBTvCMW4yb+soBrNq25Fze6cCQepkpmPm8ycYx X3Hh6MzPvaykic7TZTqobVrEtngnV2fcIB5mcwPXfj9qtcxd1PWFD4NXaI1H4aDU5z4B 4Hz3nKNUZrtJuqpSn9pMCdOpzu6XwXO/0x2tvqBOPG6abJq3eMlZXa4C8+XsdQMrxtvs S28veXW60EjbNFliuEbBBSyk1aHl5YhZFE5uiMXRT7mZ2XigdHUOwozEWVdMB6xGKTnk 2fLPIz8BugCs+ujTCMpBKhCLVSZKJxcx4C9qNoNXwG4EPS0aHGJdrs9fuEQX91XvDZ4M 8Ldw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lHnBJ4XV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a1-20020a056402168100b0045cb45925bdsi12121252edv.284.2022.10.19.03.41.12; Wed, 19 Oct 2022 03:41: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=lHnBJ4XV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231795AbiJSKkc (ORCPT + 99 others); Wed, 19 Oct 2022 06:40:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231325AbiJSKjk (ORCPT ); Wed, 19 Oct 2022 06:39:40 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8415F24946; Wed, 19 Oct 2022 03:18: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 3CDD7B823B5; Wed, 19 Oct 2022 08:53:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1DDBC433D7; Wed, 19 Oct 2022 08:53:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169598; bh=HZaN/LuBXVRxq6KpjERBiJycbpJDZKdsXB0MQGoEFeE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lHnBJ4XVmLfjuadNsmOo7dBcQFhfu8yiY4ixhs1vdaIVZDYiY8+yvSao+bHcTLkYM Ybo5BOXaOuQargkneeUzsAav3qe40Kv3S+50bkUnCAFWfxofoIvNbSoabud6OzG24G j6JdS/p0fSOeKfJ17fQpYTIIYMaOKLUnEfc27piY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Oleksandr Shamray , Vadim Pasternak , Guenter Roeck , Sasha Levin Subject: [PATCH 6.0 335/862] hwmon: (pmbus/mp2888) Fix sensors readouts for MPS Multi-phase mp2888 controller Date: Wed, 19 Oct 2022 10:27:02 +0200 Message-Id: <20221019083304.853608171@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112267770109326?= X-GMAIL-MSGID: =?utf-8?q?1747112267770109326?= From: Oleksandr Shamray [ Upstream commit 525dd5aed67a2f4f7278116fb92a24e6a53e2622 ] Fix scale factors for reading MPS Multi-phase mp2888 controller. Fixed sensors: - PIN/POUT: based on vendor documentation, set bscale factor 0.5W/LSB - IOUT: based on vendor documentation, set scale factor 0.25 A/LSB Fixes: e4db7719d037 ("hwmon: (pmbus) Add support for MPS Multi-phase mp2888 controller") Signed-off-by: Oleksandr Shamray Reviewed-by: Vadim Pasternak Link: https://lore.kernel.org/r/20220929121642.63051-1-oleksandrs@nvidia.com Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin --- drivers/hwmon/pmbus/mp2888.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/hwmon/pmbus/mp2888.c b/drivers/hwmon/pmbus/mp2888.c index 8ecd4adfef40..24e5194706cf 100644 --- a/drivers/hwmon/pmbus/mp2888.c +++ b/drivers/hwmon/pmbus/mp2888.c @@ -34,7 +34,7 @@ struct mp2888_data { int curr_sense_gain; }; -#define to_mp2888_data(x) container_of(x, struct mp2888_data, info) +#define to_mp2888_data(x) container_of(x, struct mp2888_data, info) static int mp2888_read_byte_data(struct i2c_client *client, int page, int reg) { @@ -109,7 +109,7 @@ mp2888_read_phase(struct i2c_client *client, struct mp2888_data *data, int page, * - Kcs is the DrMOS current sense gain of power stage, which is obtained from the * register MP2888_MFR_VR_CONFIG1, bits 13-12 with the following selection of DrMOS * (data->curr_sense_gain): - * 00b - 5µA/A, 01b - 8.5µA/A, 10b - 9.7µA/A, 11b - 10µA/A. + * 00b - 8.5µA/A, 01b - 9.7µA/A, 1b - 10µA/A, 11b - 5µA/A. * - Rcs is the internal phase current sense resistor. This parameter depends on hardware * assembly. By default it is set to 1kΩ. In case of different assembly, user should * scale this parameter by dividing it by Rcs. @@ -118,10 +118,9 @@ mp2888_read_phase(struct i2c_client *client, struct mp2888_data *data, int page, * because sampling of current occurrence of bit weight has a big deviation, especially for * light load. */ - ret = DIV_ROUND_CLOSEST(ret * 100 - 9800, data->curr_sense_gain); - ret = (data->phase_curr_resolution) ? ret * 2 : ret; + ret = DIV_ROUND_CLOSEST(ret * 200 - 19600, data->curr_sense_gain); /* Scale according to total current resolution. */ - ret = (data->total_curr_resolution) ? ret * 8 : ret * 4; + ret = (data->total_curr_resolution) ? ret * 2 : ret; return ret; } @@ -212,7 +211,7 @@ static int mp2888_read_word_data(struct i2c_client *client, int page, int phase, ret = pmbus_read_word_data(client, page, phase, reg); if (ret < 0) return ret; - ret = data->total_curr_resolution ? ret * 2 : ret; + ret = data->total_curr_resolution ? ret : DIV_ROUND_CLOSEST(ret, 2); break; case PMBUS_POUT_OP_WARN_LIMIT: ret = pmbus_read_word_data(client, page, phase, reg); @@ -223,7 +222,7 @@ static int mp2888_read_word_data(struct i2c_client *client, int page, int phase, * set 1. Actual power is reported with 0.5W or 1W respectively resolution. Scaling * is needed to match both. */ - ret = data->total_curr_resolution ? ret * 4 : ret * 2; + ret = data->total_curr_resolution ? ret * 2 : ret; break; /* * The below registers are not implemented by device or implemented not according to the From patchwork Wed Oct 19 08:27: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: 5063 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp248412wrs; Wed, 19 Oct 2022 03:43:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6ZN+TYRUotGneI+tyBShFKSB0ywqmuePEizzmO9uyJzDhmixXATbdUIR+YaBdPuM0M3fXG X-Received: by 2002:a63:90ca:0:b0:458:f28d:917e with SMTP id a193-20020a6390ca000000b00458f28d917emr6736875pge.201.1666176206223; Wed, 19 Oct 2022 03:43:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176206; cv=none; d=google.com; s=arc-20160816; b=JinBvP2NoD5Hiz3qXCDN6qLDU4fRGNMNpi6EXeBeOdezOMu4z2TlyYHOGsF6aDQF0q xnADdHD29ty/gLvpgKJwZ5qIKrgV708+rzrpaqsp1H+YgCGU0+x7MEf6ye5bWGwh9UkY VCwKDqwfK2S09zj/ZlK6wOtUBBeIfnvcEc3vAniYphaW7kyLLXX22DOx131mvxQpIlms 4+O6bZ5dyKnxUubHnLYbkwkvIj7mxvnwqbxS0xc3dXVJirWt0PvFVYp95WzTQ5jl+T3F EtPiiaRW6IRRUGZZJM9i1JP10WYzOkViDkYq3VrWBPTDlrSOVYcR2wRiks75hXd51Wlm DL/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=x49Iyp1n8uAaMK7VPCIDJHRf1Fld/cAWjRw6nf6Gsl4=; b=YIpBRAamq54iCLIk+2gxeqJzTfBJiBOXruo6dOrsoNV4Nel59V4KbpQGJEpa4Y/xqC 0FAHnkveFT8kGpjzNA4Mb2GtErIufuOeRXe+oJQcBUTZdF5iqZn7VXtksoep+PSUblqk FFlNTqD0fF6jrOJz7UendMXhoM4afxrmfqhm39gsxVqznysI3LWgITABsSj6eFlIkfAn yOrYELX/16JTb67/oknHxtpkuTICSjUNN4YSkkkswAAsQU7mqPvsYbxQGlXQiKxpPPvF qQIcMRBiSLVq98z52M1ZC0REpG2DNRUkECf8qdrhbZVRiywNoZC0XAj1sRlmEN9BSeVS /U5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MQ6FJZq6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b5-20020a170902d50500b0017841dd2ee6si21110092plg.170.2022.10.19.03.43.13; Wed, 19 Oct 2022 03:43: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=MQ6FJZq6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232466AbiJSKmt (ORCPT + 99 others); Wed, 19 Oct 2022 06:42:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232445AbiJSKl6 (ORCPT ); Wed, 19 Oct 2022 06:41:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C11DE60490; Wed, 19 Oct 2022 03:19:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id ECD5FB823B1; Wed, 19 Oct 2022 08:53:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60244C433D6; Wed, 19 Oct 2022 08:53:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169600; bh=epD93SGW1hEwjy9oseb8+CuhtM2ecZygpN9U7N9We9Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MQ6FJZq65dO3dLkDvTp9Nzn23H2sZThRxxa1ibLXvQZeNAThM3yHdheo6P5R/NfXy Qb76JqYU9H64UHUxLmrmUt3W51p61epE26/V/7KHARL4LPMVmKomNR6+S3/VCrbZzC cQaLcLsAqj2f1ow7ZPPg8l6TRPhzRwJeIa95RRFI= 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 6.0 336/862] net: rds: dont hold sock lock when cancelling work from rds_tcp_reset_callbacks() Date: Wed, 19 Oct 2022 10:27:03 +0200 Message-Id: <20221019083304.902949554@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112381495470939?= X-GMAIL-MSGID: =?utf-8?q?1747112381495470939?= 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 73ee2771093d..d0ff413f697c 100644 --- a/net/rds/tcp.c +++ b/net/rds/tcp.c @@ -166,10 +166,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 Wed Oct 19 08:27: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: 5412 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp314745wrs; Wed, 19 Oct 2022 06:04:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4g64ROORFw6WIpiB32bDFj92HOTmr1cyZ7xT6Bm+viGR+xjCh8Anj1jDnyzFLp/8cm4aDb X-Received: by 2002:a17:902:7e0e:b0:17f:8edd:5f00 with SMTP id b14-20020a1709027e0e00b0017f8edd5f00mr8440693plm.96.1666184698369; Wed, 19 Oct 2022 06:04:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666184698; cv=none; d=google.com; s=arc-20160816; b=lLQ3q8Eppx0v32BWOKiIyw+mHavcmbNntWe/bauOtkYnvFdT73bKZEgrc6HAdRmdAK q5Iaq0wnJIgOnwIcc116fVNKkwXwSy5IBk7fbSzGKTca2ziRsedc+RrjTNxQIY0GTGuJ btXCg/ixPxzema7QvFTgO58yO2tbKvwzIrQxiLsr3mEsUcBSYrLrevInH1/tx9URwfjP EOLkIJx/6fRu4Cdj0twIDIobc3msP/D2ejvU3Z4dzqprSk+NQQDMx6WdjymNvAlEO/KJ WSrErR07anzF98zRKi0rnBV3ElJFafMBliJz8KizqHtZgyKW/9BfafaU0xAKhLokFsGR dQIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=F2oFJAyo6oTirjW2nzzzb/ouhsVAwSat3mfq2uLN0JU=; b=W4TQ3Kv1+G5TKDuESIaq2kjgmKOrW5N1e+edR0OXeAM1vcsbaCEFoFBzSy65BWUMqF hnh1hul4Fe3bui44Y9favERXcOODEDzqFo+oRo+P++Suzyd5mGGT9d3wy8ooW42UOrj8 v3P6FlFU2RaByFWMdFVvgHcq47ILt+u7MhbuWfwRnLeKgLi0HNS+9dwL1utOZXAX3wC8 T6DHpOZiYpUEzdnCuZhxsMd2mS55s4VGXU4jNs5YtqG7l2lVibe+8732WrsQShwgKBnc choXWxk7jNh3JlZ96ZtXskJ2AOcmfqKfMxY1sVFtDsAChz9BIdpnO5oOw5IltEwpuogp U16A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yyiRtPJX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k7-20020aa788c7000000b005628e7b59e2si20013427pff.198.2022.10.19.06.04.29; Wed, 19 Oct 2022 06:04: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=yyiRtPJX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232514AbiJSMym (ORCPT + 99 others); Wed, 19 Oct 2022 08:54:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233662AbiJSMyM (ORCPT ); Wed, 19 Oct 2022 08:54: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 5C1184D253; Wed, 19 Oct 2022 05:37: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 8793EB82396; Wed, 19 Oct 2022 08:53:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08E7DC433D6; Wed, 19 Oct 2022 08:53:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169603; bh=b4hXYuJD7zXZ+MCKsBqyfRKwm0ck2hRfWHoN4eDxoIY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yyiRtPJXKoM3XfBhqHjxuQq86v7CCe1YmAaEZX/5/2ntWMvUsA8hmB7V0H0UcXV17 8xM+aOlfsv40yZgehsaWTvJgn+Mb+bH2FRwIIhHjn+B3GL08zNz0DSi0N+xY/4N6jc qXJcvkFrITkzogjmLKJyJIiiOuNk2kF/OJszifdw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot , Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 6.0 337/862] af_unix: Fix memory leaks of the whole sk due to OOB skb. Date: Wed, 19 Oct 2022 10:27:04 +0200 Message-Id: <20221019083304.951615244@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747121286203483247?= X-GMAIL-MSGID: =?utf-8?q?1747121286203483247?= From: Kuniyuki Iwashima [ Upstream commit 7a62ed61367b8fd01bae1e18e30602c25060d824 ] syzbot reported a sequence of memory leaks, and one of them indicated we failed to free a whole sk: unreferenced object 0xffff8880126e0000 (size 1088): comm "syz-executor419", pid 326, jiffies 4294773607 (age 12.609s) hex dump (first 32 bytes): 00 00 00 00 00 00 00 00 7d 00 00 00 00 00 00 00 ........}....... 01 00 07 40 00 00 00 00 00 00 00 00 00 00 00 00 ...@............ backtrace: [<000000006fefe750>] sk_prot_alloc+0x64/0x2a0 net/core/sock.c:1970 [<0000000074006db5>] sk_alloc+0x3b/0x800 net/core/sock.c:2029 [<00000000728cd434>] unix_create1+0xaf/0x920 net/unix/af_unix.c:928 [<00000000a279a139>] unix_create+0x113/0x1d0 net/unix/af_unix.c:997 [<0000000068259812>] __sock_create+0x2ab/0x550 net/socket.c:1516 [<00000000da1521e1>] sock_create net/socket.c:1566 [inline] [<00000000da1521e1>] __sys_socketpair+0x1a8/0x550 net/socket.c:1698 [<000000007ab259e1>] __do_sys_socketpair net/socket.c:1751 [inline] [<000000007ab259e1>] __se_sys_socketpair net/socket.c:1748 [inline] [<000000007ab259e1>] __x64_sys_socketpair+0x97/0x100 net/socket.c:1748 [<000000007dedddc1>] do_syscall_x64 arch/x86/entry/common.c:50 [inline] [<000000007dedddc1>] do_syscall_64+0x38/0x90 arch/x86/entry/common.c:80 [<000000009456679f>] entry_SYSCALL_64_after_hwframe+0x63/0xcd We can reproduce this issue by creating two AF_UNIX SOCK_STREAM sockets, send()ing an OOB skb to each other, and close()ing them without consuming the OOB skbs. int skpair[2]; socketpair(AF_UNIX, SOCK_STREAM, 0, skpair); send(skpair[0], "x", 1, MSG_OOB); send(skpair[1], "x", 1, MSG_OOB); close(skpair[0]); close(skpair[1]); Currently, we free an OOB skb in unix_sock_destructor() which is called via __sk_free(), but it's too late because the receiver's unix_sk(sk)->oob_skb is accounted against the sender's sk->sk_wmem_alloc and __sk_free() is called only when sk->sk_wmem_alloc is 0. In the repro sequences, we do not consume the OOB skb, so both two sk's sock_put() never reach __sk_free() due to the positive sk->sk_wmem_alloc. Then, no one can consume the OOB skb nor call __sk_free(), and we finally leak the two whole sk. Thus, we must free the unconsumed OOB skb earlier when close()ing the socket. Fixes: 314001f0bf92 ("af_unix: Add OOB support") Reported-by: syzbot Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/unix/af_unix.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index bf338b782fc4..d686804119c9 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -569,12 +569,6 @@ static void unix_sock_destructor(struct sock *sk) skb_queue_purge(&sk->sk_receive_queue); -#if IS_ENABLED(CONFIG_AF_UNIX_OOB) - if (u->oob_skb) { - kfree_skb(u->oob_skb); - u->oob_skb = NULL; - } -#endif DEBUG_NET_WARN_ON_ONCE(refcount_read(&sk->sk_wmem_alloc)); DEBUG_NET_WARN_ON_ONCE(!sk_unhashed(sk)); DEBUG_NET_WARN_ON_ONCE(sk->sk_socket); @@ -620,6 +614,13 @@ static void unix_release_sock(struct sock *sk, int embrion) unix_state_unlock(sk); +#if IS_ENABLED(CONFIG_AF_UNIX_OOB) + if (u->oob_skb) { + kfree_skb(u->oob_skb); + u->oob_skb = NULL; + } +#endif + wake_up_interruptible_all(&u->peer_wait); if (skpair != NULL) { From patchwork Wed Oct 19 08:27: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: 4933 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp226206wrs; Wed, 19 Oct 2022 02:45:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6bKDEKTub+QvoXKTqU328oU+awpbeawtjgV15LbUQUJ45QJk6/1PpP0peh0+/O//6sOQw2 X-Received: by 2002:a17:907:1c17:b0:78d:df89:26c6 with SMTP id nc23-20020a1709071c1700b0078ddf8926c6mr6270989ejc.20.1666172600933; Wed, 19 Oct 2022 02:43:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172600; cv=none; d=google.com; s=arc-20160816; b=mBEg5XHSLNKNl8rTQwkETP1oOiCnq1ijN7A8sVNXZnxKX3pWCqM52v1m0WQxJfvdKA uhFKaORunHihrCYtWZzw9xNpp86JvQkRhVavCTRayqd4tDw11b6UM6OXyTWzzDyVsrly gTeGpldjIImZHvftjGsrw/lb5gXI7cJlB40R67xtN2SAqJMMQKG31AHC7fSepfJnBSpw NkG8ahvqFtWazzWoZyadONW3p3e2vmvfbcTdwS2Gdc1QAs2GQwmh/Ta9pdo5pg2OlMBF eabnkbihYrBt3ZiYh7r17OaHNBZ8iRB4M/F02ZzZjbG0mRcIksn7mL+fkdtFJ/o7x7H3 R1Sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=oP8eedEWj6ZD0sD7ZMbIbuoN/P3SPUwH6tBzKZboaJQ=; b=TIEWoyJu8MEaPhMAy7MpA/zmrLF+0+f+LooumzmaixEVAOTkD/SJ2hdfZBQqDhirbK RRD618Gy34LER0By9t2jEAMUVjH4BfKjDXPdSbs86MV1CXRC1cTE/gzrL62A68UBVc9J aCIafdoeLnXd/9mW3qhdZmeq/k7+uV00jTcnjYA+iJb1upESEnq1+U34RrVgeG8gDpn0 VLMhHPBtOjNX8JIzA74Hg9+y3B5qw5zx/AlOZwgF7JX/Hk+r1+9V+4Y6s1vKnqJ3rWek +13bu9jLr2wjSIrE7Xm/LQYxAf2hq2bmoaemJEAgZTPObHgZhji+BzGoWhmvu016xZgX i+mA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GS5yOWPN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g12-20020aa7c84c000000b00459c2ac54e2si12570696edt.255.2022.10.19.02.42.55; Wed, 19 Oct 2022 02:43: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=GS5yOWPN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233994AbiJSJeT (ORCPT + 99 others); Wed, 19 Oct 2022 05:34:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233789AbiJSJ31 (ORCPT ); Wed, 19 Oct 2022 05:29:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86138EAC85; Wed, 19 Oct 2022 02:12: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 EE86A61826; Wed, 19 Oct 2022 08:55:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F059C433D6; Wed, 19 Oct 2022 08:55:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169716; bh=94Vil/zmhvmsJ0iy/6ZnYelSEc/3VoLdzE2dwZt/+lw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GS5yOWPNqSSMGvu8AwFZ3YCb8tv7gda4bthxA/1wKG5kZJ7pqjQQE6NsH+a01HRzm 6TDhRn/uqtrx51Sn8d88NEXvgM7/PkirNIka8NZFS/GgfNsW8Pfig+n4cIPY18dHMT oqg3Lh6uaofJHidasvUnOqk8BTnJNsviLezFw8S4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Taras Chornyi , "David S. Miller" , Sasha Levin Subject: [PATCH 6.0 338/862] net: prestera: acl: Add check for kmemdup Date: Wed, 19 Oct 2022 10:27:05 +0200 Message-Id: <20221019083304.999767544@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108601398996245?= X-GMAIL-MSGID: =?utf-8?q?1747108601398996245?= From: Jiasheng Jiang [ Upstream commit 9e6fd874c7bb47b6a4295abc4c81b2f41b97e970 ] As the kemdup could return NULL, it should be better to check the return value and return error if fails. Moreover, the return value of prestera_acl_ruleset_keymask_set() should be checked by cascade. Fixes: 604ba230902d ("net: prestera: flower template support") Signed-off-by: Jiasheng Jiang Reviewed-by: Taras Chornyi Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/marvell/prestera/prestera_acl.c | 8 ++++++-- drivers/net/ethernet/marvell/prestera/prestera_acl.h | 4 ++-- drivers/net/ethernet/marvell/prestera/prestera_flower.c | 6 +++++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/marvell/prestera/prestera_acl.c b/drivers/net/ethernet/marvell/prestera/prestera_acl.c index 3d4b85f2d541..f6b2933859d0 100644 --- a/drivers/net/ethernet/marvell/prestera/prestera_acl.c +++ b/drivers/net/ethernet/marvell/prestera/prestera_acl.c @@ -178,10 +178,14 @@ prestera_acl_ruleset_create(struct prestera_acl *acl, return ERR_PTR(err); } -void prestera_acl_ruleset_keymask_set(struct prestera_acl_ruleset *ruleset, - void *keymask) +int prestera_acl_ruleset_keymask_set(struct prestera_acl_ruleset *ruleset, + void *keymask) { ruleset->keymask = kmemdup(keymask, ACL_KEYMASK_SIZE, GFP_KERNEL); + if (!ruleset->keymask) + return -ENOMEM; + + return 0; } int prestera_acl_ruleset_offload(struct prestera_acl_ruleset *ruleset) diff --git a/drivers/net/ethernet/marvell/prestera/prestera_acl.h b/drivers/net/ethernet/marvell/prestera/prestera_acl.h index 03fc5b9dc925..131bfbc87cd7 100644 --- a/drivers/net/ethernet/marvell/prestera/prestera_acl.h +++ b/drivers/net/ethernet/marvell/prestera/prestera_acl.h @@ -185,8 +185,8 @@ struct prestera_acl_ruleset * prestera_acl_ruleset_lookup(struct prestera_acl *acl, struct prestera_flow_block *block, u32 chain_index); -void prestera_acl_ruleset_keymask_set(struct prestera_acl_ruleset *ruleset, - void *keymask); +int prestera_acl_ruleset_keymask_set(struct prestera_acl_ruleset *ruleset, + void *keymask); bool prestera_acl_ruleset_is_offload(struct prestera_acl_ruleset *ruleset); int prestera_acl_ruleset_offload(struct prestera_acl_ruleset *ruleset); void prestera_acl_ruleset_put(struct prestera_acl_ruleset *ruleset); diff --git a/drivers/net/ethernet/marvell/prestera/prestera_flower.c b/drivers/net/ethernet/marvell/prestera/prestera_flower.c index 19d3b55c578e..cf551a8379ac 100644 --- a/drivers/net/ethernet/marvell/prestera/prestera_flower.c +++ b/drivers/net/ethernet/marvell/prestera/prestera_flower.c @@ -452,7 +452,9 @@ int prestera_flower_tmplt_create(struct prestera_flow_block *block, } /* preserve keymask/template to this ruleset */ - prestera_acl_ruleset_keymask_set(ruleset, rule.re_key.match.mask); + err = prestera_acl_ruleset_keymask_set(ruleset, rule.re_key.match.mask); + if (err) + goto err_ruleset_keymask_set; /* skip error, as it is not possible to reject template operation, * so, keep the reference to the ruleset for rules to be added @@ -468,6 +470,8 @@ int prestera_flower_tmplt_create(struct prestera_flow_block *block, list_add_rcu(&template->list, &block->template_list); return 0; +err_ruleset_keymask_set: + prestera_acl_ruleset_put(ruleset); err_ruleset_get: kfree(template); err_malloc: From patchwork Wed Oct 19 08:27: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: 4782 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp215823wrs; Wed, 19 Oct 2022 02:16:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5jkIxZrObawgVluHWZfooQmZllJxN3Gjyp4Q25mGa5waiTmkdBxf5qRmLZ2bnOEtoYUeW0 X-Received: by 2002:a17:907:31ca:b0:780:2170:e08c with SMTP id xf10-20020a17090731ca00b007802170e08cmr5817371ejb.145.1666171004894; Wed, 19 Oct 2022 02:16:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666171004; cv=none; d=google.com; s=arc-20160816; b=IyQK4VLpOPDh1WNK3hH9dQPbnBoS8a+pon77rWLQ4gfGEcJh9fjeFl3ktEeFzs/Mez ZETOIZxS+r0g6yhv5LbD+XJVnZ2+590lAQZhorHRBR0Ul4gkySjFAyFby9B1Da7HnBlV i/2XEtNfU1WUyfklzaeHuMwFGXDlHJDCEuN+W/nU0wApLiZ22M6tASZW76oXcP86T59V 5qZsLWZYwoj5np8U+eLTacrkPoC0+yuWa9a1rC/2G5/asS4KGeEtlpr2xQWIMftp71f6 q+npO9YXP/nNlrZ73OwuHtxucUO6sAUykcOqtHQMF3wFW54uJJpRDjW6sjq2QwBs0cjR JY/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=/jEnyGqp+5UM9rxW0zL6ebiol0WSNs70t1/LnQqcBzE=; b=ULDryk8H5r4torXkXquoDNQoOxNqpmWTTYvGhl2mZg/5HLA0+bBY8IpuUwirp6oyEB 0M/oZE9W9bOs5R0vDcsB8Dk6ls1av/EUUgPhg6QKGun2n4TjkQzIw4h9kJ669GzFz3de xuQM23QZ2I7j2PZoccRkbRibmchBPYHUzpMFZbJpe2qID5f4T7k3GvaQyo0W9up4rHIP 5pQ62I/x/AMSef7+8zWKjVgw6Mj+Q4cqbP90mryI8My05vBIoe4OFfnue+VhQyQP7zkx OEJjDElhyh/xWWjN/df61TQTBV4Ng3UPi5lKa8Mjp6IDBXlKxNa9+k9MM9QTtsi8nxLw ZrAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1qsw4TpI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j1-20020a508a81000000b004593faf4fccsi12997340edj.110.2022.10.19.02.16.21; Wed, 19 Oct 2022 02:16: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=1qsw4TpI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232901AbiJSJPv (ORCPT + 99 others); Wed, 19 Oct 2022 05:15:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232845AbiJSJLc (ORCPT ); Wed, 19 Oct 2022 05:11:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F0EF8E0E8; Wed, 19 Oct 2022 02:02: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 2E0386181B; Wed, 19 Oct 2022 08:53:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D6EDC433D6; Wed, 19 Oct 2022 08:53:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169624; bh=XGkmMzPTDEeMhMngRVduxRnock1hXej9ySL7e00w6T0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1qsw4TpI/Vi+CzMiexYPTqPD+5y1LEVEipUdO92Z7k2WOmyytADd98FRJ7eumFAhr MA+EVqnM+A6XQaQg/Ah/ITFE5Zc9/xskttdbF/8sa3B7seps45fcw8dfDiuB6IG3FK E2CF/Gi+GkQbecx8h2+Za941O4RMmvv1JRIyoVJo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Raju Lakkaraju , Horatiu Vultur , "David S. Miller" , Sasha Levin Subject: [PATCH 6.0 339/862] eth: lan743x: reject extts for non-pci11x1x devices Date: Wed, 19 Oct 2022 10:27:06 +0200 Message-Id: <20221019083305.047086672@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106927592617591?= X-GMAIL-MSGID: =?utf-8?q?1747106927592617591?= From: Raju Lakkaraju [ Upstream commit cb4b12071a4b68df323c339f60805834246b3e9e ] Remove PTP_PF_EXTTS support for non-PCI11x1x devices since they do not support the PTP-IO Input event triggered timestamping mechanisms added Fixes: 60942c397af6 ("net: lan743x: Add support for PTP-IO Event Input External Timestamp (extts)") Signed-off-by: Raju Lakkaraju Reviewed-by: Horatiu Vultur Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/microchip/lan743x_ptp.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/ethernet/microchip/lan743x_ptp.c b/drivers/net/ethernet/microchip/lan743x_ptp.c index 6a11e2ceb013..da3ea905adbb 100644 --- a/drivers/net/ethernet/microchip/lan743x_ptp.c +++ b/drivers/net/ethernet/microchip/lan743x_ptp.c @@ -1049,6 +1049,10 @@ static int lan743x_ptpci_verify_pin_config(struct ptp_clock_info *ptp, enum ptp_pin_function func, unsigned int chan) { + struct lan743x_ptp *lan_ptp = + container_of(ptp, struct lan743x_ptp, ptp_clock_info); + struct lan743x_adapter *adapter = + container_of(lan_ptp, struct lan743x_adapter, ptp); int result = 0; /* Confirm the requested function is supported. Parameter @@ -1057,7 +1061,10 @@ static int lan743x_ptpci_verify_pin_config(struct ptp_clock_info *ptp, switch (func) { case PTP_PF_NONE: case PTP_PF_PEROUT: + break; case PTP_PF_EXTTS: + if (!adapter->is_pci11x1x) + result = -1; break; case PTP_PF_PHYSYNC: default: From patchwork Wed Oct 19 08:27: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: 5052 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp247736wrs; Wed, 19 Oct 2022 03:41:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4DZimWcLc/aGSTdoVv7fXlRa+pIYGS4fNhZGUy962fPffv6LFB8ean5juuTbPNtnL/91kL X-Received: by 2002:a17:907:6087:b0:78d:ee99:a06a with SMTP id ht7-20020a170907608700b0078dee99a06amr6191253ejc.52.1666176101458; Wed, 19 Oct 2022 03:41:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176101; cv=none; d=google.com; s=arc-20160816; b=JrVMfy8ZdVbhnfKeLnXJiB/IGUi7oVs/ISoYCTiAERXirrbDwgTq4AyU/Ig3lgfKxT g5YQaAY2TFxkwBzC7DQY12tm0kaPbcHpplvepv7vV6WdsbJllGm9nXO4zln8oP5wBLur 7Plkgr45kC2HwONJvVrmsS43IHuU0nzSaMAKoMKBtYwsMYFiFNjIkqRswvke7HpcrJON SDeZI0aw91PINlxqCMX+EP+P9ihFQrjAiez00kdh642GqMarIm+yzTDME017b3oG4huv 4mfOd4d1sre+2AeuOEbmLxGr6zxd8NNqvU6PSFVLyjqCyh78j8H/cXkhAd3XP2KJcDIi dvkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FR9mua4Ku8Z6Wc92MSeDb1Z7Qx+86KosRnQTZCN+1hQ=; b=UZiiLsK+EDh0XKA7ujlFe0K6J9hL2GDTI9dxu/t3CMQkSyjvn/W66QzJG0Cp7dLZND SvP86Fli28Jo1J7rGRN7Nk8IqttO6sbLaLfn2Vq1zXCoisiO22OgwOdsCVCrtMxQZopn EUhqutqCOS/95BLW6FXxkCJFJ82co1Z5zc/kha5DNprZdtE1/jbJXQpc2QC00f6gvaV1 pqZ5TwLB9TJc3sUNCZ8F0zlReBWApuxJ2elhVulSP/MQz88dNfhpkSkMUfjIncwyonKL 3bUrAnmw9/gOlPjzfJDu1YI161bQ7WO8Wvdy/DcLn6M7T5eldkBhrs5q9pb64f2+3MWU IpfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fGJajGsi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id go9-20020a1709070d8900b007879f5efba7si11499841ejc.872.2022.10.19.03.41.16; Wed, 19 Oct 2022 03:41: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=fGJajGsi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231991AbiJSKkg (ORCPT + 99 others); Wed, 19 Oct 2022 06:40:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231846AbiJSKjt (ORCPT ); Wed, 19 Oct 2022 06:39:49 -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 EA4A9157477; Wed, 19 Oct 2022 03:18: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 BC3D0B823BD; Wed, 19 Oct 2022 08:54:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 239BAC433D7; Wed, 19 Oct 2022 08:54:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169653; bh=7go1yIvRjCUaDnh/t/n91CkD5U8iI4PuQcrNJySH2nM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fGJajGsie3uqGMLMhq2tuKo3V9xi7kmEKSjtaC6y24KvmCXVZSPKJbXLBXOrbSbVj 4XP2Vv6z/vXNJh/o+sKaaVwZNm/qHmmPwsGfh5LdZX9zfFQSH/8LyZVOrzxK4UkTHv sjpsRoG3s77U4xuCyQvQMVPbkBSVTo3zW9S4mOQQ= 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 6.0 340/862] bnx2x: fix potential memory leak in bnx2x_tpa_stop() Date: Wed, 19 Oct 2022 10:27:07 +0200 Message-Id: <20221019083305.081784871@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112271727555549?= X-GMAIL-MSGID: =?utf-8?q?1747112271727555549?= 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 712b5595bc39..24bfc65e28e1 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c @@ -789,6 +789,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 Wed Oct 19 08:27: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: 4681 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212938wrs; Wed, 19 Oct 2022 02:08:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6wjQ31FpWv53Ae+a+auhKsKlTtTdIQjfSqIeS8lv2F95897F6ZrvrhqA1h8kUaSdAmO/av X-Received: by 2002:a17:907:7805:b0:780:24fd:c4e8 with SMTP id la5-20020a170907780500b0078024fdc4e8mr5857849ejc.78.1666170524704; Wed, 19 Oct 2022 02:08:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170524; cv=none; d=google.com; s=arc-20160816; b=oJQyIncJbMJm+r7IEo91pe+3ufVauWC2JA2xmc8bC/CMEIZPtr8aTOnJclHVPNRvhJ YhUrp6btElibZbRDh32CvoyaYgOrowaUSv6AxawFEnKEvCOyn0+eZRkXP82hzFri6/Ji fZbtuXwiHXb0oD8wuQLMdZOh5hlgj8p/SOne3Wfl3OwzxU9kFiokp7aIG5f4QZUeCRww clSp44KhmrOv8ci98eEkq7pqQmsxRGK0QTy1qmazWWJc2JSPjXjkMg5cB9XiUFpr22YY 0PBgDsmPAc6N7kXJpFVbJPCjQ7s5uzJ9rUOc590QT58IIg/J25RsCQnf8vXcXocRFs3V gSlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=KZR55gRxc0NIlDMe4ISkDS8oMW6oSpQvv4XE03H1BxA=; b=nBpdtsSoPENS9TFVi40356unvVKk51WXKiQ1yx+mNj1oAoUDtMvlbF6E288lf3b+Wn pUYqfdCeZV6Qs29Y9CHrD2AxFffYB7YHQ4hpqN73zhEMAKATxpGAgfOPaCH34/h2PpHr d/mFdRptI7nLZrmOukmxjUkVk3Z5BORY7H+117z489m4awpR6sqK94VqJZOrMlHMg/6U I/D2pki1y2KuyIF6PlUL6Ir4bR/2cGjB5eBwrzEt72VsP/9vqy0cYStchDxymSjXv1We t3l2dF2750yH3I3OGWCROyUkernEBGJRjTBQbV4OsacvdKAb4YSQy7e3okRELY2FAIVJ kDtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=J9inPIEv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ji6-20020a170907980600b0077e8ff79426si14412824ejc.511.2022.10.19.02.08.20; Wed, 19 Oct 2022 02:08: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=J9inPIEv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232316AbiJSJDq (ORCPT + 99 others); Wed, 19 Oct 2022 05:03:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232149AbiJSJCk (ORCPT ); Wed, 19 Oct 2022 05:02: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 A828B97EF7; Wed, 19 Oct 2022 01:56:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C701361802; Wed, 19 Oct 2022 08:54:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D63ADC433D6; Wed, 19 Oct 2022 08:54:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169682; bh=XvxXrB03lskT/0SF6VJa6ZjRDrEAMuxJWTrz1oa5Eus=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J9inPIEvlWkd2snhcKavQ8FFC3GyVTz2kWjmAQ15kYE0KPSRGGGH56xRwo1Y30/1z mZjwsjvfaafKz1g+6rsOlMTpHwP4xo+EFsrpUqzUCRYE5jo+rLwfHqyqX2SuPTbX3l G/RasUMEvAVcU5wZYiAj7tDlpVyFXnaR3hZhxwak= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheng Wang , "David S. Miller" , Sasha Levin Subject: [PATCH 6.0 341/862] eth: sp7021: fix use after free bug in spl2sw_nvmem_get_mac_address Date: Wed, 19 Oct 2022 10:27:08 +0200 Message-Id: <20221019083305.132887688@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106424614134767?= X-GMAIL-MSGID: =?utf-8?q?1747106424614134767?= From: Zheng Wang [ Upstream commit 12aece8b01507a2d357a1861f470e83621fbb6f2 ] This frees "mac" and tries to display its address as part of the error message on the next line. Swap the order. Fixes: fd3040b9394c ("net: ethernet: Add driver for Sunplus SP7021") Signed-off-by: Zheng Wang Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/sunplus/spl2sw_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/sunplus/spl2sw_driver.c b/drivers/net/ethernet/sunplus/spl2sw_driver.c index 546206640492..61d1d07dc070 100644 --- a/drivers/net/ethernet/sunplus/spl2sw_driver.c +++ b/drivers/net/ethernet/sunplus/spl2sw_driver.c @@ -248,8 +248,8 @@ static int spl2sw_nvmem_get_mac_address(struct device *dev, struct device_node * /* Check if mac address is valid */ if (!is_valid_ether_addr(mac)) { - kfree(mac); dev_info(dev, "Invalid mac address in nvmem (%pM)!\n", mac); + kfree(mac); return -EINVAL; } From patchwork Wed Oct 19 08:27: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: 4687 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp213022wrs; Wed, 19 Oct 2022 02:08:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6gc4rPlTP/9iDJelUWhpld+oLUAtYZDTumgekk/tpF/vkZXKMHuik0HcSjFgjWhniVR4Qx X-Received: by 2002:a05:6402:1bd0:b0:458:f170:fa74 with SMTP id ch16-20020a0564021bd000b00458f170fa74mr6521446edb.382.1666170536582; Wed, 19 Oct 2022 02:08:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170536; cv=none; d=google.com; s=arc-20160816; b=gT8kckxFy48pgT1gm3LEi/cPjc/puwMC94UASPNgHg6FhujomTSVhC1PtMC6fcHSU9 uvqPK/ffH4TjycfgYncbtF50dZ/vT6IBb5j+mTtYb2fH+QPPcurMVou3V3Qg6PcgYrG6 zK/WZ22umG25/XnGwscRwptSC9E8C12Q60bw9Xl2LBZ7GkJi2KCo8LAgatTwDh09oj7S 9ZNYhvx+8K27e1ZuxRWkRCwtZAAiYQ8sT1axWfVFnEH6Re9oFtC8Y3q/inwC1MG1cRJv jhPhLlX6t8Nl/ytT/pn0ykR9DOX7wLpNTPUNpegzVt1E5GhopMM7bDAAcY+4iQgMpFI4 BJTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rhXD+g75m/68woPSUp34I8eVax0JZdfTvkjJkjSYwkY=; b=1I5jGJzqHJQ+1F0HYLmMrIo0iSgqlrpbhUOenyXCpPThP9r5v8HMAMfWub/3sOyT96 OLL6zsk5iFkJFMHKD43uD9SpUGukf5msDbM+0g8MEvXt7rbPXVc3PY3FvAzA9t8AiTJW kmmetGHJ7UxPLIN2XOlkNgUkl7O61YIZqTkn9Bj+hig+blDNjPSIBpDTf9vOts4kqlI8 3mVN8To+TaPQdJ1/LS1UNOKjruguHYMZWzcBVMOEFjyeP8QoKZu2/g+aw9O13Ihbk3J/ q/eNDT3t7iysXFzmTjLLm0Wi4F5EdwolRVC1zZDtPuGbjCOGYDwnC2TKMVU99fY03mNW aI+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="qBuk/t0Q"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t7-20020a170906268700b0073de493b83esi11908492ejc.147.2022.10.19.02.08.31; Wed, 19 Oct 2022 02:08: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="qBuk/t0Q"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232163AbiJSJFT (ORCPT + 99 others); Wed, 19 Oct 2022 05:05:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232149AbiJSJDt (ORCPT ); Wed, 19 Oct 2022 05:03: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 D55321658A; Wed, 19 Oct 2022 01:56: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 E8B4861812; Wed, 19 Oct 2022 08:55:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 06DC1C433D6; Wed, 19 Oct 2022 08:54:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169700; bh=KNf54MzYOzZQ7PIZ9pF8uzpHZeVH6NK8nEr5MpJ/Xzk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qBuk/t0Q1n4pINunZfKttzn1cIZ73BZaO9gkVUc4KsA4qt+qrFzDU7Wd5vQxnZlCN 1m7rThqbWm4ev+pirA7zYlYYQ657Z4h8W6zePbsdGTtEHL7oxD6bM31d1xwb2f9uJw WiJ0ewZRNqbPRipDR0WhPCqpVjuPyWMd3ofELgk4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxim Mikityanskiy , M Chetan Kumar , "David S. Miller" , Sasha Levin Subject: [PATCH 6.0 342/862] net: wwan: iosm: Call mutex_init before locking it Date: Wed, 19 Oct 2022 10:27:09 +0200 Message-Id: <20221019083305.170906285@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106436746919693?= X-GMAIL-MSGID: =?utf-8?q?1747106436746919693?= From: Maxim Mikityanskiy [ Upstream commit ba0fbdb95da5ddd8db457ce6ba09d16dd979a294 ] wwan_register_ops calls wwan_create_default_link, which ends up in the ipc_wwan_newlink callback that locks ipc_wwan->if_mutex. However, this mutex is not yet initialized by that point. Fix it by moving mutex_init above the wwan_register_ops call. This also makes the order of operations in ipc_wwan_init symmetric to ipc_wwan_deinit. Fixes: 83068395bbfc ("net: iosm: create default link via WWAN core") Signed-off-by: Maxim Mikityanskiy Reviewed-by: M Chetan Kumar Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/wwan/iosm/iosm_ipc_wwan.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/wwan/iosm/iosm_ipc_wwan.c b/drivers/net/wwan/iosm/iosm_ipc_wwan.c index 27151148c782..4712f01a7e33 100644 --- a/drivers/net/wwan/iosm/iosm_ipc_wwan.c +++ b/drivers/net/wwan/iosm/iosm_ipc_wwan.c @@ -323,15 +323,16 @@ struct iosm_wwan *ipc_wwan_init(struct iosm_imem *ipc_imem, struct device *dev) ipc_wwan->dev = dev; ipc_wwan->ipc_imem = ipc_imem; + mutex_init(&ipc_wwan->if_mutex); + /* WWAN core will create a netdev for the default IP MUX channel */ if (wwan_register_ops(ipc_wwan->dev, &iosm_wwan_ops, ipc_wwan, IP_MUX_SESSION_DEFAULT)) { + mutex_destroy(&ipc_wwan->if_mutex); kfree(ipc_wwan); return NULL; } - mutex_init(&ipc_wwan->if_mutex); - return ipc_wwan; } From patchwork Wed Oct 19 08:27: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: 5049 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp247593wrs; Wed, 19 Oct 2022 03:41:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4+ljCrCqzkVE7ey9KaM+AzafgduF4Hh5LAReX9YkSL8zXzikoq2Wi/NHjrqnZxIn6TGmkm X-Received: by 2002:a05:6402:50cf:b0:45c:dfce:66ae with SMTP id h15-20020a05640250cf00b0045cdfce66aemr6516762edb.370.1666176073694; Wed, 19 Oct 2022 03:41:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176073; cv=none; d=google.com; s=arc-20160816; b=hu42+rFt6hKR4igcebVnJhAblm/dYrlnIWSmagk4gwLkO5LzFPmwsxhg6xMzYwpOCR L1aU6BAibHof1wqlXC7IXXobIR5OVkIoy70018hxClRtUJLa8it9RNGHV4gc32Gms8I1 l44NZsj26rlB8odGjAUKEIp2HrqHKBjKDfSqSas9O01EVXAzgxyCNjx+d+POyYYDfARR lG0DY6VZFKZ4NSgIz36Q0niFTi9IufRiPH3n387WPr//dtFWaImdWFDdx7ECPXzjfnGk 7nJ3zIDKeuIQj6TrXga3+ZVCdKauyRTP9lkACmqdlc8Mnz2cRnUg1REU4V6zmvY0lDQS NV+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=H2e7y1sYXqrXeGy2KXktBigbXNeCvcebPWS3U5Oo238=; b=dTCr5tCoYP+R/BI8edPLmynnf2ym8/i5rreSzneO0Lh6LvGbnwL5q14NLdRfVepGZN F5YAFBY17fDGdhXygVB77oCe1IRIGlF+k2K9RTaq6X2rnxBfCBOSgg6quWyYaAdVrQxu jXhDT/4BdUTOWOmxnBCQl0wtUoiXZ3juQVI7XcT3U7WunPfTNT/p9fSKLBgdkn1KBbB8 KO5zQjGZlWlBBSdiS2coss/9gPTfDZLMQGmx0SSkvaGiPNPhp3EeiYACkLPrHePYqOh4 KUY3pFcHnKJgKQhoTUfXP8V8rUWzJl5GWJIyxKWqpi3tJw3UM4us7vu6XIDeeM/cU9iT DIsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=093RJ8kt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i21-20020a170906a29500b0077bd009107dsi11351287ejz.714.2022.10.19.03.40.47; Wed, 19 Oct 2022 03:41:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=093RJ8kt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231215AbiJSKkU (ORCPT + 99 others); Wed, 19 Oct 2022 06:40:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230415AbiJSKj1 (ORCPT ); Wed, 19 Oct 2022 06:39:27 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFD7F15627F; Wed, 19 Oct 2022 03:18: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 4B89DB823C8; Wed, 19 Oct 2022 08:55:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 98EB4C433D6; Wed, 19 Oct 2022 08:55:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169703; bh=4skOxrJgX4AfIkPHOIg87BN7DK+WMUVYiGNtnr5td+c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=093RJ8ktsEQMpHiblS+LnEmpjvMXUc2QOaZ4OJ6G3IvjWvrocnaQJC7EmmapVvHPX +Fl81fWxUiRslFpOIMv2+NItddXdxH3D3QOR4LmP9k36QfYAWgW0L+56I0tjSNasqc WhSXxUrHiiNJ65DXGlMB0h3q8QDnYnQrNF8ySN2o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot , Tetsuo Handa , "David S. Miller" , Sasha Levin Subject: [PATCH 6.0 343/862] net/ieee802154: reject zero-sized raw_sendmsg() Date: Wed, 19 Oct 2022 10:27:10 +0200 Message-Id: <20221019083305.219389595@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112242382571222?= X-GMAIL-MSGID: =?utf-8?q?1747112242382571222?= From: Tetsuo Handa [ Upstream commit 3a4d061c699bd3eedc80dc97a4b2a2e1af83c6f5 ] syzbot is hitting skb_assert_len() warning at raw_sendmsg() for ieee802154 socket. What commit dc633700f00f726e ("net/af_packet: check len when min_header_len equals to 0") does also applies to ieee802154 socket. Link: https://syzkaller.appspot.com/bug?extid=5ea725c25d06fb9114c4 Reported-by: syzbot Fixes: fd1894224407c484 ("bpf: Don't redirect packets with invalid pkt_len") Signed-off-by: Tetsuo Handa Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/ieee802154/socket.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/ieee802154/socket.c b/net/ieee802154/socket.c index 7889e1ef7fad..cbd0e2ac4ffe 100644 --- a/net/ieee802154/socket.c +++ b/net/ieee802154/socket.c @@ -251,6 +251,9 @@ static int raw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size) return -EOPNOTSUPP; } + if (!size) + return -EINVAL; + lock_sock(sk); if (!sk->sk_bound_dev_if) dev = dev_getfirstbyhwtype(sock_net(sk), ARPHRD_IEEE802154); From patchwork Wed Oct 19 08:27: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: 5083 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp249476wrs; Wed, 19 Oct 2022 03:46:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7LbE7QwQCt36IPuKtGUlLLiYWDLvyFyR88/J9Gbt+dGzutNiGF/CHlfGnDBu7CDtOKCByz X-Received: by 2002:a05:6a00:2393:b0:566:813c:ae26 with SMTP id f19-20020a056a00239300b00566813cae26mr8123843pfc.8.1666176378349; Wed, 19 Oct 2022 03:46:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176378; cv=none; d=google.com; s=arc-20160816; b=TJzsDvbCLsReJFrX7ZlAYodR59BHAMUbGvV3Da1i1+v4WHLmKogKnPNwUr0i7ufc7l 2rkpbd8c/gs+RHpR+X/fLr5zU2KgWYgDTzsIW8RkOebF8WiVIj6kTp3fg3xMM58VWcC7 QOmlC4tjPTFyIyzRyoF5+Msm8rufQhPg2zPZM9xpojNIIcYe+WV5Fa0Lf3Y21Rf1SE39 srr0S1VXHa8tvr7wG/tj/oYUKYAVOmELGqvhgWCuUSoraIB6BoKOsN3+M57I0SFo94wN wiUVM6Pc7OdEb9uJAuKX+zXEEGXGHvDP59IFqwhlw1A6lnRClMaL8FgY5noXZ/0JxwOX dSqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=70fOScWGwIv62qMC9OZ0TrG0RCFW3U73ZDUFKv9kFGA=; b=ue/gOP5pwtKSMlbI091s18d/EOvrjTpiGDUoyBOMkLmA/aSARiHBsQHT/eDr1AeAwE t2evbfjpIIj2/sMQKI7EviG131x/qMGkUkwXWTOSXYcIhvXfkKeJgJJk+dR9im5LpmJR lUuiqWCiTmBlpE0hRzRHQl94rOORwAjRs/74BTGNuceGuTykHhlI+sLLNnMm3r9WarcU 1oW/1uAcg4WnSAC4UkYwxYAsBP3uboKpOojOQBzG6Csww7XRFR2XQ/bzu50XAmjQJU2I Y2IERVlcMKSbjH+ks0An0J9JOCuai1OuGs6LUhsh5L8YeVmCDjpu9pFggLIOPeJr7hBl /org== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PI33Tbx4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t7-20020a17090a4e4700b0020d2286c30csi16865681pjl.134.2022.10.19.03.46.04; Wed, 19 Oct 2022 03:46:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PI33Tbx4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232847AbiJSKpl (ORCPT + 99 others); Wed, 19 Oct 2022 06:45:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232781AbiJSKoG (ORCPT ); Wed, 19 Oct 2022 06:44:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31237F0C; Wed, 19 Oct 2022 03:20: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 377C3B823CB; Wed, 19 Oct 2022 08:55:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D3B2C433D6; Wed, 19 Oct 2022 08:55:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169705; bh=5IibGUbnaDyymlKAGw0nRFBcXsRrahr/c/gXdKIKcYg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PI33Tbx4MRTQoKfFtFHBGs5oldoNo12xYNqJ46FsmIHKRs+bcbdg6NLqFc8j4CGme 3AY8haCKvsJcLUzz9FRRNk67xFf23LIVzt0LS0Rb3Y/4Pj5+2wC6y3AnMS/eQ0aL1C 4/8WucN9ApFAhOPidnnNU6ssSSutaAAlWw98BMaI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe Leroy , Eric Dumazet , Willy Tarreau , "David S. Miller" , Sasha Levin Subject: [PATCH 6.0 344/862] once: add DO_ONCE_SLOW() for sleepable contexts Date: Wed, 19 Oct 2022 10:27:11 +0200 Message-Id: <20221019083305.253646153@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112562084399084?= X-GMAIL-MSGID: =?utf-8?q?1747112562084399084?= From: Eric Dumazet [ Upstream commit 62c07983bef9d3e78e71189441e1a470f0d1e653 ] Christophe Leroy reported a ~80ms latency spike happening at first TCP connect() time. This is because __inet_hash_connect() uses get_random_once() to populate a perturbation table which became quite big after commit 4c2c8f03a5ab ("tcp: increase source port perturb table to 2^16") get_random_once() uses DO_ONCE(), which block hard irqs for the duration of the operation. This patch adds DO_ONCE_SLOW() which uses a mutex instead of a spinlock for operations where we prefer to stay in process context. Then __inet_hash_connect() can use get_random_slow_once() to populate its perturbation table. Fixes: 4c2c8f03a5ab ("tcp: increase source port perturb table to 2^16") Fixes: 190cc82489f4 ("tcp: change source port randomizarion at connect() time") Reported-by: Christophe Leroy Link: https://lore.kernel.org/netdev/CANn89iLAEYBaoYajy0Y9UmGFff5GPxDUoG-ErVB2jDdRNQ5Tug@mail.gmail.com/T/#t Signed-off-by: Eric Dumazet Cc: Willy Tarreau Tested-by: Christophe Leroy Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- include/linux/once.h | 28 ++++++++++++++++++++++++++++ lib/once.c | 30 ++++++++++++++++++++++++++++++ net/ipv4/inet_hashtables.c | 4 ++-- 3 files changed, 60 insertions(+), 2 deletions(-) diff --git a/include/linux/once.h b/include/linux/once.h index b14d8b309d52..176ab75b42df 100644 --- a/include/linux/once.h +++ b/include/linux/once.h @@ -5,10 +5,18 @@ #include #include +/* Helpers used from arbitrary contexts. + * Hard irqs are blocked, be cautious. + */ bool __do_once_start(bool *done, unsigned long *flags); void __do_once_done(bool *done, struct static_key_true *once_key, unsigned long *flags, struct module *mod); +/* Variant for process contexts only. */ +bool __do_once_slow_start(bool *done); +void __do_once_slow_done(bool *done, struct static_key_true *once_key, + struct module *mod); + /* Call a function exactly once. The idea of DO_ONCE() is to perform * a function call such as initialization of random seeds, etc, only * once, where DO_ONCE() can live in the fast-path. After @func has @@ -52,7 +60,27 @@ void __do_once_done(bool *done, struct static_key_true *once_key, ___ret; \ }) +/* Variant of DO_ONCE() for process/sleepable contexts. */ +#define DO_ONCE_SLOW(func, ...) \ + ({ \ + bool ___ret = false; \ + static bool __section(".data.once") ___done = false; \ + static DEFINE_STATIC_KEY_TRUE(___once_key); \ + if (static_branch_unlikely(&___once_key)) { \ + ___ret = __do_once_slow_start(&___done); \ + if (unlikely(___ret)) { \ + func(__VA_ARGS__); \ + __do_once_slow_done(&___done, &___once_key, \ + THIS_MODULE); \ + } \ + } \ + ___ret; \ + }) + #define get_random_once(buf, nbytes) \ DO_ONCE(get_random_bytes, (buf), (nbytes)) +#define get_random_slow_once(buf, nbytes) \ + DO_ONCE_SLOW(get_random_bytes, (buf), (nbytes)) + #endif /* _LINUX_ONCE_H */ diff --git a/lib/once.c b/lib/once.c index 59149bf3bfb4..351f66aad310 100644 --- a/lib/once.c +++ b/lib/once.c @@ -66,3 +66,33 @@ void __do_once_done(bool *done, struct static_key_true *once_key, once_disable_jump(once_key, mod); } EXPORT_SYMBOL(__do_once_done); + +static DEFINE_MUTEX(once_mutex); + +bool __do_once_slow_start(bool *done) + __acquires(once_mutex) +{ + mutex_lock(&once_mutex); + if (*done) { + mutex_unlock(&once_mutex); + /* Keep sparse happy by restoring an even lock count on + * this mutex. In case we return here, we don't call into + * __do_once_done but return early in the DO_ONCE_SLOW() macro. + */ + __acquire(once_mutex); + return false; + } + + return true; +} +EXPORT_SYMBOL(__do_once_slow_start); + +void __do_once_slow_done(bool *done, struct static_key_true *once_key, + struct module *mod) + __releases(once_mutex) +{ + *done = true; + mutex_unlock(&once_mutex); + once_disable_jump(once_key, mod); +} +EXPORT_SYMBOL(__do_once_slow_done); diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c index b9d995b5ce24..f5950a7172d6 100644 --- a/net/ipv4/inet_hashtables.c +++ b/net/ipv4/inet_hashtables.c @@ -729,8 +729,8 @@ int __inet_hash_connect(struct inet_timewait_death_row *death_row, if (likely(remaining > 1)) remaining &= ~1U; - net_get_random_once(table_perturb, - INET_TABLE_PERTURB_SIZE * sizeof(*table_perturb)); + get_random_slow_once(table_perturb, + INET_TABLE_PERTURB_SIZE * sizeof(*table_perturb)); index = port_offset & (INET_TABLE_PERTURB_SIZE - 1); offset = READ_ONCE(table_perturb[index]) + (port_offset >> 32); From patchwork Wed Oct 19 08:27: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: 5057 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp248030wrs; Wed, 19 Oct 2022 03:42:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7vzTG2u/OXTby1OWH3Rm6Ttm1IJ7PqOqt0a1bViFf1yUBrNGtu96n85NYDAbdhdRQqQEGs X-Received: by 2002:a17:906:9b90:b0:78d:9704:752 with SMTP id dd16-20020a1709069b9000b0078d97040752mr5943590ejc.695.1666176149093; Wed, 19 Oct 2022 03:42:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176149; cv=none; d=google.com; s=arc-20160816; b=qw6ybzEBfkBaGYNiIWaL1IPRjFvVVyOKZlX+q2/XgERui8lE8zplPF1KakbRX7tEpD sI8v0e0uRIOsWgrjY8C5Q4hR9KVU/VWkDkK63CNQ6SS5rdLYoxXhZbT6IlEmPI/nAIUQ sH72H5g9iaKrrk9FnbRXdG+8KiXUEiEqE8MGqLJJa3s+6WG91ofyeky0ZKml6grXR1Aj wCEBwlWN07QmITAu9v85eNGry7ttTzmIBB5sp5UCta/khgUX3Nl+HwXcCn+S6WzS+YJX 3DxCs9kfrDnnXfctMikd6AIgUHBLFpCmebeyzvec+QCSi1EKENBQ9j+oRdlIS+0daUa2 aX+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=0FZfFRDggJThrZKP5h0o9Bgs4E9AylyY3r2+ZY2GSlA=; b=EVvoODhVBjM1KuZ2ZbuKIaUzDkalX/02OY1AZlIGwPOgfOKfvokW84Az5beQt1Ucxo ksa8l94BtfkSXRHRrMN/T8IZn6VT71fFUQOuWgGaDyi13k/MZqXlyaC7PPBe/AKCdbJb hWk8XINcmWhOH5hKy4BvtIGlC2RfcXsfYMVSm7cu9kNgeKTMjq2lvQeg8uEnJVpUbleu YwkPsluqV7Z5dCKFKYObDlN9WdB6XR1F8pkOE3ql2GuNhIzv/F8UHpQ/lyjW+fhmDr7J OE2J1iFUBytGhdWg7WJkzMOQIan318DDuzthue2ppDZ82zdzqsKW0KcA7HQrmHb8dNa7 Xbgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gS2V5IMe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v4-20020a056402348400b0045cfb639ff2si14615168edc.506.2022.10.19.03.42.02; Wed, 19 Oct 2022 03:42: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=gS2V5IMe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232390AbiJSKlf (ORCPT + 99 others); Wed, 19 Oct 2022 06:41:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231480AbiJSKkW (ORCPT ); Wed, 19 Oct 2022 06:40: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 6533410EA09; Wed, 19 Oct 2022 03:19: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 C2225B823CC; Wed, 19 Oct 2022 08:55:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25468C433D6; Wed, 19 Oct 2022 08:55:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169708; bh=LVfDi4HCdgetF0yIHxqNdI6P3WM866A87brlpoCcN4g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gS2V5IMeBj6EMoNWQOVnIHK90f89dZj3jUAv1ulQIySYbPx6P590cMZd9HzjS5ZR+ Yf/Gc0+dG+UkbkY8mZoPH46ejlcNJH56+tTuYHXeMW3xHY3KH3K0FYdpQYvLfajfRR IZ8E1PM7Jaeo2RRqfQ0CFhSsTzv2R7k7VXyv3G0E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Russell King (Oracle)" , Marcin Wojtas , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.0 345/862] net: mvpp2: fix mvpp2 debugfs leak Date: Wed, 19 Oct 2022 10:27:12 +0200 Message-Id: <20221019083305.293903036@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112321790027870?= X-GMAIL-MSGID: =?utf-8?q?1747112321790027870?= From: Russell King (Oracle) [ Upstream commit 0152dfee235e87660f52a117fc9f70dc55956bb4 ] When mvpp2 is unloaded, the driver specific debugfs directory is not removed, which technically leads to a memory leak. However, this directory is only created when the first device is probed, so the hardware is present. Removing the module is only something a developer would to when e.g. testing out changes, so the module would be reloaded. So this memory leak is minor. The original attempt in commit fe2c9c61f668 ("net: mvpp2: debugfs: fix memory leak when using debugfs_lookup()") that was labelled as a memory leak fix was not, it fixed a refcount leak, but in doing so created a problem when the module is reloaded - the directory already exists, but mvpp2_root is NULL, so we lose all debugfs entries. This fix has been reverted. This is the alternative fix, where we remove the offending directory whenever the driver is unloaded. Fixes: 21da57a23125 ("net: mvpp2: add a debugfs interface for the Header Parser") Signed-off-by: Russell King (Oracle) Reviewed-by: Greg Kroah-Hartman Reviewed-by: Marcin Wojtas Link: https://lore.kernel.org/r/E1ofOAB-00CzkG-UO@rmk-PC.armlinux.org.uk Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/marvell/mvpp2/mvpp2.h | 1 + drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c | 10 ++++++++-- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 13 ++++++++++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2.h b/drivers/net/ethernet/marvell/mvpp2/mvpp2.h index ad73a488fc5f..11e603686a27 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2.h +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2.h @@ -1530,6 +1530,7 @@ u32 mvpp2_read(struct mvpp2 *priv, u32 offset); void mvpp2_dbgfs_init(struct mvpp2 *priv, const char *name); void mvpp2_dbgfs_cleanup(struct mvpp2 *priv); +void mvpp2_dbgfs_exit(void); void mvpp23_rx_fifo_fc_en(struct mvpp2 *priv, int port, bool en); diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c index 4a3baa7e0142..75e83ea2a926 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c @@ -691,6 +691,13 @@ static int mvpp2_dbgfs_port_init(struct dentry *parent, return 0; } +static struct dentry *mvpp2_root; + +void mvpp2_dbgfs_exit(void) +{ + debugfs_remove(mvpp2_root); +} + void mvpp2_dbgfs_cleanup(struct mvpp2 *priv) { debugfs_remove_recursive(priv->dbgfs_dir); @@ -700,10 +707,9 @@ void mvpp2_dbgfs_cleanup(struct mvpp2 *priv) void mvpp2_dbgfs_init(struct mvpp2 *priv, const char *name) { - struct dentry *mvpp2_dir, *mvpp2_root; + struct dentry *mvpp2_dir; int ret, i; - mvpp2_root = debugfs_lookup(MVPP2_DRIVER_NAME, NULL); if (!mvpp2_root) mvpp2_root = debugfs_create_dir(MVPP2_DRIVER_NAME, NULL); diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c index b84128b549b4..eaa51cd7456b 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c @@ -7706,7 +7706,18 @@ static struct platform_driver mvpp2_driver = { }, }; -module_platform_driver(mvpp2_driver); +static int __init mvpp2_driver_init(void) +{ + return platform_driver_register(&mvpp2_driver); +} +module_init(mvpp2_driver_init); + +static void __exit mvpp2_driver_exit(void) +{ + platform_driver_unregister(&mvpp2_driver); + mvpp2_dbgfs_exit(); +} +module_exit(mvpp2_driver_exit); MODULE_DESCRIPTION("Marvell PPv2 Ethernet Driver - www.marvell.com"); MODULE_AUTHOR("Marcin Wojtas "); From patchwork Wed Oct 19 08:27:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4688 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp213058wrs; Wed, 19 Oct 2022 02:09:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7+rMOs5p6JRn9q5htgXStDWT44J6Ljmwo9kGGN/pca36uTAZ8bIGaqicASYEPpkSkIq4It X-Received: by 2002:a05:6402:3806:b0:450:bad8:8cd5 with SMTP id es6-20020a056402380600b00450bad88cd5mr6655097edb.305.1666170543600; Wed, 19 Oct 2022 02:09:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170543; cv=none; d=google.com; s=arc-20160816; b=ueO17cG/I/IiZf6a1RQ32lJZ5OYmqiBAycF06DFQkvzteqcsrdeVpn0vmz9B6mjyoO aK72BnvSCM/tKgJm4qRBQ01a9X0cHNHx1Tw0GcGrhXNxBE4hbmIpCYd5Pp1ecuF7ZwZs /xNvJVsrWoCaleUHuB0dSiSNwcT4wvf95mUZl+7QIZ1BBEIRD0MP5D/4NnkZ50Qf03dT P3szu13fMhQB+Ahp5hTotRI2K0V1KO2OeLhD5eezCDtYlyYt14dKZiedRra8Rd0OZLt+ ck88PE3GwihvzRSzmi1xLZELcoWxy9lmonoIin1hQbwk9AODiWOjdxl8c90IlCKt/uGv MvrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9Ql+8mskdflqjs60zn5boSVajE1zrmUsKWcrthwMS8c=; b=ihMD56yF0BsXJAjlglQfCW/xYXby0OWsjKPfSUWobZ0XZXzsp1SfJE5s5vGodlhaE+ jbmgqTf+L1tlaH8Jpz3I7qBG+nNlkMwakXPqffJAzc37BOtZTYCWkPNNj3mqIb00CToJ 5ZBTmVyV8ZhrHuNYx4hraGGnVi0rfQA34PSi52zOJ62Ytg2OJYByezLL1hu6szxPYDwl 42uaY3I75+3ThVVRpiqhys+lRV7e0lMF79RqkG4qkLFdK9KeHta4do7kSLmjOHnCWLZ+ 9rYrnidM8e/pySpNQZqcBIU7c8/L/DxQPdWqObeAz1FTnc6DoocUM6EmDeH0KfSC5Nyo urMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vI5Sp7zE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id go13-20020a1709070d8d00b0078e31b05896si10927990ejc.766.2022.10.19.02.08.37; Wed, 19 Oct 2022 02:09: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=vI5Sp7zE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232246AbiJSJFZ (ORCPT + 99 others); Wed, 19 Oct 2022 05:05:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232278AbiJSJD6 (ORCPT ); Wed, 19 Oct 2022 05:03:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 113EEA5729; Wed, 19 Oct 2022 01: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 dfw.source.kernel.org (Postfix) with ESMTPS id 98DFA61831; Wed, 19 Oct 2022 08:55:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B183FC433D6; Wed, 19 Oct 2022 08:55:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169711; bh=bf1vPmgo21IJELc6XjmdXWEzqUu73Vv87VkAI1mMerA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vI5Sp7zEL9Z+4sy0lGKUQFyZXdKBK71R10ucwt6jeOxQBk+I3u5R7gg5abF43UcWy Y9vyZ02rHMgd6YsJXbGxY8YtQ4tGiFT5vWD9b8RkzWpWztJMrgvturoInhMDdBdN68 QW5izvYtKpwoVzRajeifzDqhAFT07iqR3vz7robY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Alvin_=C5=A0ipraga?= , Robert Foss , Sasha Levin Subject: [PATCH 6.0 346/862] drm: bridge: adv7511: fix CEC power down control register offset Date: Wed, 19 Oct 2022 10:27:13 +0200 Message-Id: <20221019083305.334165717@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106443455245527?= X-GMAIL-MSGID: =?utf-8?q?1747106443455245527?= From: Alvin Šipraga [ Upstream commit 1d22b6033ea113a4c3850dfa2c0770885c81aec8 ] The ADV7511_REG_CEC_CTRL = 0xE2 register is part of the main register map - not the CEC register map. As such, we shouldn't apply an offset to the register address. Doing so will cause us to address a bogus register for chips with a CEC register map offset (e.g. ADV7533). Fixes: 3b1b975003e4 ("drm: adv7511/33: add HDMI CEC support") Signed-off-by: Alvin Šipraga Reviewed-by: Robert Foss Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20220612144854.2223873-2-alvin@pqrs.dk Signed-off-by: Sasha Levin --- drivers/gpu/drm/bridge/adv7511/adv7511.h | 5 +---- drivers/gpu/drm/bridge/adv7511/adv7511_cec.c | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511.h b/drivers/gpu/drm/bridge/adv7511/adv7511.h index a031a0cd1f18..94de73cbeb2d 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7511.h +++ b/drivers/gpu/drm/bridge/adv7511/adv7511.h @@ -394,10 +394,7 @@ void adv7511_cec_irq_process(struct adv7511 *adv7511, unsigned int irq1); #else static inline int adv7511_cec_init(struct device *dev, struct adv7511 *adv7511) { - unsigned int offset = adv7511->type == ADV7533 ? - ADV7533_REG_CEC_OFFSET : 0; - - regmap_write(adv7511->regmap, ADV7511_REG_CEC_CTRL + offset, + regmap_write(adv7511->regmap, ADV7511_REG_CEC_CTRL, ADV7511_CEC_CTRL_POWER_DOWN); return 0; } diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_cec.c b/drivers/gpu/drm/bridge/adv7511/adv7511_cec.c index 0b266f28f150..99964f5a5457 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7511_cec.c +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_cec.c @@ -359,7 +359,7 @@ int adv7511_cec_init(struct device *dev, struct adv7511 *adv7511) goto err_cec_alloc; } - regmap_write(adv7511->regmap, ADV7511_REG_CEC_CTRL + offset, 0); + regmap_write(adv7511->regmap, ADV7511_REG_CEC_CTRL, 0); /* cec soft reset */ regmap_write(adv7511->regmap_cec, ADV7511_REG_CEC_SOFT_RESET + offset, 0x01); @@ -386,7 +386,7 @@ int adv7511_cec_init(struct device *dev, struct adv7511 *adv7511) dev_info(dev, "Initializing CEC failed with error %d, disabling CEC\n", ret); err_cec_parse_dt: - regmap_write(adv7511->regmap, ADV7511_REG_CEC_CTRL + offset, + regmap_write(adv7511->regmap, ADV7511_REG_CEC_CTRL, ADV7511_CEC_CTRL_POWER_DOWN); return ret == -EPROBE_DEFER ? ret : 0; } From patchwork Wed Oct 19 08:27: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: 4834 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223667wrs; Wed, 19 Oct 2022 02:38:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5kukWaUt1KdPVDnUek7PMsbBybA9psVlC7TmKa1ETEwVaIyiiq3AkPFVurjIabd9QukrJO X-Received: by 2002:a17:902:e846:b0:180:c732:1e53 with SMTP id t6-20020a170902e84600b00180c7321e53mr7764380plg.110.1666172287328; Wed, 19 Oct 2022 02:38:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172287; cv=none; d=google.com; s=arc-20160816; b=V57vufvkOzALobEAejDN/autkClc/iW4Xv1ZqwYadEBwzJOkim8QfLfXpmQfA/UA9n 6UVtjvjB2qqbk6QT7SOGspERfmXN+3XMHNH85OhWjUFAYDEIK2rpvZ5deZ/U2QVmVDm2 DdwHoAy+7YOXV8WEafSF/2ZLgHJmpCOP6gLBh//SP+C05IaEqzvCAtW5spehIYKi5L+z FtaOed+Wx5L2Q7d6JCnjp/R9uGwUr3Y1uyHxnY5tu7VGuhUqMCoU6y873VKrpjlt/F3p HK7N+nb6tZHnoBrN7rHpDhOM3Lvf4SBvcmQH3hUqLHJq7l53RmLNmIxU6RXYyCGdAv5V USbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FK8udx5g6EqaQ0vX+IbXDNGhPAHhwa8PempJmDXwer8=; b=CbfE6aAcInooJAr7DLG7birFSF1klUbqbjcZaJ99QrFHGnsC81W9v6jH978zCV/RiU SnfAlM7eOVQMeMwfHw+EoZBWMaOsG33REa3qftst+5O6Q8i/vqj9PknyEsW5dZbSAY1V 0ef/A4Ry/YJMxw/Xtlspyv6Usx9/3D2sqwuedWvD6y20lVS09y3Dnrn290jY17zWOppE HQxpDjNGXtHt2D76rpuRPlSZXbTQYpynZXmWQ8fMX3NKSswVKW23DxJf4oNOrbfrZhmu XGifRgsZ5vzSNYWU+uZzgau3IGWVZulw2P4bwltwruJOxAli2WjYWSwJKbzRYc9/DVL1 43fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vLhv4n3X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s10-20020a170902a50a00b0017f5a057061si16143674plq.500.2022.10.19.02.37.52; Wed, 19 Oct 2022 02:38: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=vLhv4n3X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233230AbiJSJ0d (ORCPT + 99 others); Wed, 19 Oct 2022 05:26:33 -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 S233798AbiJSJY7 (ORCPT ); Wed, 19 Oct 2022 05:24:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F78763E4; Wed, 19 Oct 2022 02:11:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 527BF6181A; Wed, 19 Oct 2022 08:55:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41F83C433C1; Wed, 19 Oct 2022 08:55:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169713; bh=tHZ+Kc3V7pkYjCTEr+UzdBcU68D87nzYfaa2EbrgrWY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vLhv4n3XhyQhtYifuziQyzniAyYRt+z2UApvCAN1Wfw0fpyzVXF4h0HqxMjWmL2vh DnYInNW6Y0JyaTeW5SLlLBkNENuVj/R7bQMTlth1itHNwdjyq5de135MBEXMkwwsVB /FsCWv2AQsCghKj2PjyTCctiSztAkzkFkjbTiMk8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Alvin_=C5=A0ipraga?= , Robert Foss , Sasha Levin Subject: [PATCH 6.0 347/862] drm: bridge: adv7511: unregister cec i2c device after cec adapter Date: Wed, 19 Oct 2022 10:27:14 +0200 Message-Id: <20221019083305.371901294@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108272303465714?= X-GMAIL-MSGID: =?utf-8?q?1747108272303465714?= From: Alvin Šipraga [ Upstream commit 40cdb02cb9f965732eb543d47f15bef8d10f0f5f ] cec_unregister_adapter() assumes that the underlying adapter ops are callable. For example, if the CEC adapter currently has a valid physical address, then the unregistration procedure will invalidate the physical address by setting it to f.f.f.f. Whence the following kernel oops observed after removing the adv7511 module: Unable to handle kernel execution of user memory at virtual address 0000000000000000 Internal error: Oops: 86000004 [#1] PREEMPT_RT SMP Call trace: 0x0 adv7511_cec_adap_log_addr+0x1ac/0x1c8 [adv7511] cec_adap_unconfigure+0x44/0x90 [cec] __cec_s_phys_addr.part.0+0x68/0x230 [cec] __cec_s_phys_addr+0x40/0x50 [cec] cec_unregister_adapter+0xb4/0x118 [cec] adv7511_remove+0x60/0x90 [adv7511] i2c_device_remove+0x34/0xe0 device_release_driver_internal+0x114/0x1f0 driver_detach+0x54/0xe0 bus_remove_driver+0x60/0xd8 driver_unregister+0x34/0x60 i2c_del_driver+0x2c/0x68 adv7511_exit+0x1c/0x67c [adv7511] __arm64_sys_delete_module+0x154/0x288 invoke_syscall+0x48/0x100 el0_svc_common.constprop.0+0x48/0xe8 do_el0_svc+0x28/0x88 el0_svc+0x1c/0x50 el0t_64_sync_handler+0xa8/0xb0 el0t_64_sync+0x15c/0x160 Code: bad PC value ---[ end trace 0000000000000000 ]--- Protect against this scenario by unregistering i2c_cec after unregistering the CEC adapter. Duly disable the CEC clock afterwards too. Fixes: 3b1b975003e4 ("drm: adv7511/33: add HDMI CEC support") Signed-off-by: Alvin Šipraga Reviewed-by: Robert Foss Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20220612144854.2223873-3-alvin@pqrs.dk Signed-off-by: Sasha Levin --- drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c index 38bf28720f3a..6031bdd92342 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c @@ -1340,9 +1340,6 @@ static int adv7511_remove(struct i2c_client *i2c) { struct adv7511 *adv7511 = i2c_get_clientdata(i2c); - i2c_unregister_device(adv7511->i2c_cec); - clk_disable_unprepare(adv7511->cec_clk); - adv7511_uninit_regulators(adv7511); drm_bridge_remove(&adv7511->bridge); @@ -1350,6 +1347,8 @@ static int adv7511_remove(struct i2c_client *i2c) adv7511_audio_exit(adv7511); cec_unregister_adapter(adv7511->cec_adap); + i2c_unregister_device(adv7511->i2c_cec); + clk_disable_unprepare(adv7511->cec_clk); i2c_unregister_device(adv7511->i2c_packet); i2c_unregister_device(adv7511->i2c_edid); From patchwork Wed Oct 19 08:27: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: 4677 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212861wrs; Wed, 19 Oct 2022 02:08:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4aMTRQ2GFhNUynqYghK1/IiI1DnbTQ//P8mVuXEtRYGCabzIu3Not8gBdE6dXORKHIOSf6 X-Received: by 2002:a17:906:8451:b0:78d:d467:55a4 with SMTP id e17-20020a170906845100b0078dd46755a4mr5817437ejy.352.1666170511065; Wed, 19 Oct 2022 02:08:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170511; cv=none; d=google.com; s=arc-20160816; b=TSdxROys6/4KRmgzJEzWY9XVCqmqKQTk2rxv/OrXYZJkp0Ufbt6zx57C9+tLXr+c44 si18CP++BoYz9dv2HeTP0TkPMvyMwE8OV2CudKFXSk9X22Snzz7ggQSo/4ez6Oe5nHxC j/ezFW4lgAR8h0JksGa5Nj3sadsDXeGHUYKXPC/bR9VzRX+JrvfHpsRMFXUvurNubtCg sSp8yl9kWs5pbOhDHipzMNekPaHkhmkfE9E/wsAytJ9ndFGee2bFUi4sG2+5kNITK05t 8E4vs4j87V4sQ5w6cy2E5/xYo28Rp/equWnEYfm+CFMtd3a/le8ROu8bKEfCSXHIyEm/ pgjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UYDvG08FMZhJkUR+WtYW1e2YAaoX4bNMuuddIuLRM3c=; b=wLIYEaod8ee6tE6KnCyog2uG4pfKZ+S3PivC/K0d2XmtezmayjmJoPgsSXxurWdStk 2xfv/gHP39yAYaiXFlLJ9KzV2R3duL139JP7+BEXU3FBYnh5hTN+ocy3JNg4Q63USL6v MToDQbM3U2+uoHsMvBKzHzGt6oinCQ8YyvevNXY8LAoR/gLg++N1EoCVDiwPYFDnJHuK F8ZttS85F5OcHJxE2KrZJ/LJzNsJeArhewZe56E2g1yx1jRyWEUHCaU/5pKpprFyWlZi sRuXA+Q7Q4NF7/G8DebE772yempyw0rm3qmAqZqmWYFEQECIqmoBh7ndcav2vFEDzzwU 8NMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="RKfn/eXH"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sd42-20020a1709076e2a00b0077ccad52420si14215606ejc.275.2022.10.19.02.08.01; Wed, 19 Oct 2022 02:08: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="RKfn/eXH"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232269AbiJSJCp (ORCPT + 99 others); Wed, 19 Oct 2022 05:02:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232444AbiJSI7w (ORCPT ); Wed, 19 Oct 2022 04:59: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 168D76AEA9; Wed, 19 Oct 2022 01:55: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 D03FD617F0; Wed, 19 Oct 2022 08:53:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1B72C433D6; Wed, 19 Oct 2022 08:53:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169627; bh=OowrNALwkvS4Tcm3QNdrx2jP/lE+fwctiM0D4EOC+ts=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RKfn/eXHp9Maka1nkEiw+NQunJlYkT3q9Cw8E8Cg9T69oZLMKCTEIw1PPDlWryZvA aYohxiHZwpYpwnQSVkq4+uifVayzBPrAF2prDYRJUt7HVoUIHJBrC6T337jqxPvwUg RGfwDxcmmOJXpBo024DYK/BImJgBDrirdG6SwivU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Maxime Ripard , Sasha Levin Subject: [PATCH 6.0 348/862] drm/bridge: Avoid uninitialized variable warning Date: Wed, 19 Oct 2022 10:27:15 +0200 Message-Id: <20221019083305.417150627@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106409719682971?= X-GMAIL-MSGID: =?utf-8?q?1747106409719682971?= From: Dan Carpenter [ Upstream commit 7d1202738efda60155d98b370b3c70d336be0eea ] This code works, but technically it uses "num_in_bus_fmts" before it has been initialized so it leads to static checker warnings and probably KMEMsan warnings at run time. Initialize the variable to zero to silence the warning. Fixes: f32df58acc68 ("drm/bridge: Add the necessary bits to support bus format negotiation") Signed-off-by: Dan Carpenter Signed-off-by: Maxime Ripard Link: https://patchwork.freedesktop.org/patch/msgid/YrrIs3hoGcPVmXc5@kili Signed-off-by: Sasha Levin --- drivers/gpu/drm/drm_bridge.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index 6abf7a2407e9..1545c50fd1c8 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -847,8 +847,8 @@ static int select_bus_fmt_recursive(struct drm_bridge *first_bridge, struct drm_connector_state *conn_state, u32 out_bus_fmt) { + unsigned int i, num_in_bus_fmts = 0; struct drm_bridge_state *cur_state; - unsigned int num_in_bus_fmts, i; struct drm_bridge *prev_bridge; u32 *in_bus_fmts; int ret; @@ -969,7 +969,7 @@ drm_atomic_bridge_chain_select_bus_fmts(struct drm_bridge *bridge, struct drm_connector *conn = conn_state->connector; struct drm_encoder *encoder = bridge->encoder; struct drm_bridge_state *last_bridge_state; - unsigned int i, num_out_bus_fmts; + unsigned int i, num_out_bus_fmts = 0; struct drm_bridge *last_bridge; u32 *out_bus_fmts; int ret = 0; From patchwork Wed Oct 19 08:27: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: 5288 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp281305wrs; Wed, 19 Oct 2022 05:01:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7H+5RWZ5ciOFHvaUFE7HOUZCVOQ7l56o6yWMl1ZZ8X8t4vPmdVqkN24eWRnErqGXZzwz/D X-Received: by 2002:a05:6402:26cf:b0:45d:48d7:928e with SMTP id x15-20020a05640226cf00b0045d48d7928emr6865196edd.275.1666180913168; Wed, 19 Oct 2022 05:01:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666180913; cv=none; d=google.com; s=arc-20160816; b=T1/6w/C70UWNsUZgHB0YiQ9dznhy0bveWhZOOrPm+RhPoLLVLR4mdXEPbMqWwemvOE w+Hdc2mOfG5R+ZHKmsK7eaWaHVE+SrD3arwoC45HNjVbenxu33/Dgk0J7sQDloLQgC1H EQfX9+X39g6bysMoS+tuJTPCd9J+UL918oBs5+cF72Vu5rQ/Y55Q+k0/SahBAKUJFQVf 3SfxcEXbJoa96Spi2l+OBmIKq8QoS7bZpE/VxHlQbFmgg25b7pV0zUHi96/PlnvdR/VO r0SuARmj6KQhWP2ZV7mOytt+Y820nOG8qlwZofxhy1zPt6vxVQ1UJIoz380Z2TVO0KpS 7PUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pYwhLFZiUeP2h3tEcszipLvkPOELhk0OpaIfhgBrjww=; b=wNRv+ZIyyRgM3KFmImxQ1puCoFO4Mg/Y1L4QIacHm90M3zvZ2rDGb2D3indjGJFFHJ tIzgsV/J+75Qt86ITvN1y/R0YCizdaHEGTABdnCeosRXwclYM76nS+GnC8JAClgZtj2D Qu6V/wTUCdOLwp8HXQFbRAWnEur/JbmE+zoXcoKM0F8qhyNXdeun8m0+5BdRjnlL12Lh eiHgD37hBb3z4CI6WhAabide5W1ROH8grkI+3fM5Oee/vToydFqHHR2Td1bjf2gle1OP WLidbxxSHKueJEenjFNgH8T0/rjx/6XcBwU2M5kPKjGAMGLjY6u3O0eDAE64tizCBP64 Sv/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pZrrTJgj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e6-20020a50a686000000b0045cf1500ffesi13206467edc.275.2022.10.19.05.01.23; Wed, 19 Oct 2022 05:01: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=pZrrTJgj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232096AbiJSL4l (ORCPT + 99 others); Wed, 19 Oct 2022 07:56:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231512AbiJSLzo (ORCPT ); Wed, 19 Oct 2022 07:55:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FE8423E94; Wed, 19 Oct 2022 04:34: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 32A38B823B9; Wed, 19 Oct 2022 08:53:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99B43C433D6; Wed, 19 Oct 2022 08:53:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169630; bh=QhYu81M8WtAo05jbsad99FIeUifFSmuabQ0GNCOz7wI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pZrrTJgjFSvo6CRT8Qu87FCHPcHzS4fFPz+SVWRY//zoXQxIL00kB64cKBy0URuC/ vwsBcT9iq5qS0Sj+6J6uQfcFEsqHEoFUWDfpEkebRyG8uPyCgLady0M3dEU8EejUru xbcTNNW40s7j0LymleL82XJevpejdoM2jATjhYRw= 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 6.0 349/862] drm/mipi-dsi: Detach devices when removing the host Date: Wed, 19 Oct 2022 10:27:16 +0200 Message-Id: <20221019083305.464236614@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747117317690124004?= X-GMAIL-MSGID: =?utf-8?q?1747117317690124004?= 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 c40bde96cfdf..c317ee9fa445 100644 --- a/drivers/gpu/drm/drm_mipi_dsi.c +++ b/drivers/gpu/drm/drm_mipi_dsi.c @@ -346,6 +346,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 Wed Oct 19 08:27: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: 4684 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212978wrs; Wed, 19 Oct 2022 02:08:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5surA0M5t59gXXRvjCgOu9OtYTyTb/ZUt8OQSDs56bIYujm8TRDcrceXSWf6i6AB29CZLx X-Received: by 2002:a17:907:75dc:b0:783:9c71:5e20 with SMTP id jl28-20020a17090775dc00b007839c715e20mr5903683ejc.125.1666170530415; Wed, 19 Oct 2022 02:08:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170530; cv=none; d=google.com; s=arc-20160816; b=i0jjO3seVbaLxrsRHFShwpodSTijUPpgynrbCKpJ5KTbiCd7llKvf+IOAuJhzb/v4q bKjNw4IWqqCaaVApnZZQRfQUjOInxHkKf3tqwx74BjQdSzyoFAVvUiFTGxz2RIY1aKwY mQ1zstT16JVHcMe6Tlos7juyuNdmOTgpgAnecWCjgMjIxZw4UwhHRHoinboXFqxL/ER1 Jj5syXfW7ChSv7vxw7aEW1r4WQAlWJqYUxqd0q/wJny55/tJ6HX5M2El7VEOUwalbLex xyZn/66jQxdnQFjtyASHt7JKvG8lcWutde3LETYSMa85bfmFdZBTP9ZML4kg/bM/33RJ pG8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6SuWmLSUfcXoD0M8eeBEyhf4Y0NcQfMogjFvUOZaANY=; b=nYoQKqvepCK3WGjjgPAPxqTK9IYCVvOq8IYm7SYgrEOA60FZvskHMCNw39cSA8+hBZ zI5pzimvXnRHcFvrOdFhhR6Q14H14VzVY/t5CYc30C8OwyotopGaeUz2HpBgaQNYRJnV WKamvyAPAqlOgeTToXjkxvdzwiy8HZf4gdCy3ZEzKI2xBTRfmRs0qem4bI4ldPD3Iwsk L5I/dbEqViOvamKp+5s28ahheq7vEB6kLKsdM4vn+1fqUBnIxT4/uVjty4qS58ytVBxb oW96f1YO/cIXxLTnxHMyL4GkD4WafVGCnMXrfFw1+OSxEVJcN9r711TJ0ANVDlNTZOw2 2lPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="fX0/fdnO"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o19-20020a170906975300b00787b0b0a96esi5410313ejy.131.2022.10.19.02.08.10; Wed, 19 Oct 2022 02:08: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="fX0/fdnO"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232184AbiJSJDG (ORCPT + 99 others); Wed, 19 Oct 2022 05:03:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232248AbiJSJB1 (ORCPT ); Wed, 19 Oct 2022 05:01:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87D0A6B145; Wed, 19 Oct 2022 01:55:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4C37E61868; Wed, 19 Oct 2022 08:53:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C81AC433D7; Wed, 19 Oct 2022 08:53:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169632; bh=XnpClHE9RQmHtFBJmFrb2Cl9NXJDMVz8DiOdTVUb21I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fX0/fdnOFdDPF9F3oQbTmiRPeqRJCtt+A3qYB/sndfUfcAY6Cvh2/NlkuwTJ2jpZ1 ZGE0ykDR5/OlgggLrefEoKwQemjC5MYVAmy4vlhGPdOensph+OyaZw6NGOZICZjcrv KPP0XQksb8k6qMLOBpouOoF8xk+igPYYM63bc0Lo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Zimmermann , Dave Stevenson , Maxime Ripard , Sasha Levin Subject: [PATCH 6.0 350/862] drm/vc4: drv: Call component_unbind_all() Date: Wed, 19 Oct 2022 10:27:17 +0200 Message-Id: <20221019083305.514238398@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106430266135724?= X-GMAIL-MSGID: =?utf-8?q?1747106430266135724?= From: Maxime Ripard [ Upstream commit 6cf61bf49c9bdb9ba2d33be812d90dd406326c6c ] While we were using the component framework to deal with all the DRM subdevices, we were not calling component_unbind_all(). This leads to none of the subdevices freeing up their resources as part of their unbind() or device managed hooks. Fixes: c8b75bca92cb ("drm/vc4: Add KMS support for Raspberry Pi.") Acked-by: Thomas Zimmermann Reviewed-by: Dave Stevenson Signed-off-by: Maxime Ripard Link: https://lore.kernel.org/r/20220711173939.1132294-13-maxime@cerno.tech Signed-off-by: Sasha Levin --- drivers/gpu/drm/vc4/vc4_drv.c | 14 ++++++++++++-- drivers/gpu/drm/vc4/vc4_drv.h | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c index 292d1b6a01b6..6b8dfa1e7650 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.c +++ b/drivers/gpu/drm/vc4/vc4_drv.c @@ -267,6 +267,13 @@ static void vc4_match_add_drivers(struct device *dev, } } +static void vc4_component_unbind_all(void *ptr) +{ + struct vc4_dev *vc4 = ptr; + + component_unbind_all(vc4->dev, &vc4->base); +} + static const struct of_device_id vc4_dma_range_matches[] = { { .compatible = "brcm,bcm2711-hvs" }, { .compatible = "brcm,bcm2835-hvs" }, @@ -310,6 +317,7 @@ static int vc4_drm_bind(struct device *dev) if (IS_ERR(vc4)) return PTR_ERR(vc4); vc4->is_vc5 = is_vc5; + vc4->dev = dev; drm = &vc4->base; platform_set_drvdata(pdev, drm); @@ -360,6 +368,10 @@ static int vc4_drm_bind(struct device *dev) if (ret) return ret; + ret = devm_add_action_or_reset(dev, vc4_component_unbind_all, vc4); + if (ret) + return ret; + ret = vc4_plane_create_additional_planes(drm); if (ret) goto unbind_all; @@ -380,8 +392,6 @@ static int vc4_drm_bind(struct device *dev) return 0; unbind_all: - component_unbind_all(dev, drm); - return ret; } diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h index 1beb96b77b8c..950056b83843 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.h +++ b/drivers/gpu/drm/vc4/vc4_drv.h @@ -76,6 +76,7 @@ struct vc4_perfmon { struct vc4_dev { struct drm_device base; + struct device *dev; bool is_vc5; From patchwork Wed Oct 19 08:27: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: 5046 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp247444wrs; Wed, 19 Oct 2022 03:40:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6OhOd3ooQ7RiiNAYRE12HxceFS5bTMZAe0HaVHccxoRmmw+ViyTErOiPp57rZ+LIUwKLSX X-Received: by 2002:a05:6402:2d8:b0:458:c152:67bd with SMTP id b24-20020a05640202d800b00458c15267bdmr6779200edx.308.1666176048922; Wed, 19 Oct 2022 03:40:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176048; cv=none; d=google.com; s=arc-20160816; b=1JrQjxt9lvw2s5aFN3+dv71l7rkE2ONirEbzr0gFzVQWicLVlygSMFEZgwLs1u5LDs eHGgsKiGHD3weZWfJjRv0UFuW+W7bGtpgaFFSfhAm7i4NgSQTZJiYqfFydXHqvp8ItQl KrvfqINcqlfCFp88aWWKR6a9/QSPU2YH9BX682E+/ehdK42GWjt2BU60/QPpBlUtGRP/ 4W7CVq0ajB93qL1af9U3lFDMS0r77uAfV8KjnO9HWzsMn6jKxOCpK4hr5iwjCE/xKrun JCVMwr9BbTLgiZghsqJ85XWOFDnNV5ttRbWQJSfLoTgaMrqh/KdIvFAKZ6G8sX4Yfr9M xgLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Ko9cPGMesre6Lm8lyZdkvZ3XiHviKS2Au2xKN1iwn7c=; b=gBB51RxdHPkWmi18S67uMMI6KjIJcsvtyj3xxpir/YUrB0R8DlzKZiYS2AjDP/GoPU h8Rkyk+Jtx8m5732MlbHUZdrUuv79peWw3W5arbn8t3wvpaUyzVKdO0Q3nDGzJM2pIWv MmqokhgJr4yuaUxYOHY+7X8QA3hdSZ/QBM5lVL9Otn8rRKQqCtoTu+LoPxD1RhspG4V+ D/nKyWNXbDV+QZw+CcXdN2+ZEescE7v7MNwY7mn1fenEuhEDK+6XrrqFn5spxahQtC2h WmPOkTQY0BQqLoyizZRBYyrSPRrq/bfkRzE/+sUlF6wM9ZVT3wfaJfTPLGCvrn76YGLa CknQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="m0Cap/cR"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g8-20020a056402090800b0045c7611d8ddsi15850939edz.179.2022.10.19.03.40.22; Wed, 19 Oct 2022 03:40: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="m0Cap/cR"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231520AbiJSKjm (ORCPT + 99 others); Wed, 19 Oct 2022 06:39:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232079AbiJSKiz (ORCPT ); Wed, 19 Oct 2022 06:38:55 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BDE8156264; Wed, 19 Oct 2022 03:18: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 A65D3B823A2; Wed, 19 Oct 2022 08:53:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09C92C433D6; Wed, 19 Oct 2022 08:53:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169635; bh=phSnUqnY7Kv4or2QaTwjWCnYha4ABTmtG8iuKHhbVc4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m0Cap/cRl7UFypbqz0lJu+ekgouYE7mUPpff2b0dt5OI9wqg3zS15OiKKJem0qclr DChIMB793OTQKVbSxUazac3l4uPZDM5bg4mK42o8SoxAVzI0rMAPHdKrJ4a8Xz6U2Q 2jkR0VcNPlifScje8zynrbFuna+UcDNGYF94rqxE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pin-Yen Lin , Allen Chen , Robert Foss , Sasha Levin Subject: [PATCH 6.0 351/862] drm/bridge: it6505: Power on downstream device in .atomic_enable Date: Wed, 19 Oct 2022 10:27:18 +0200 Message-Id: <20221019083305.554417900@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112216458849625?= X-GMAIL-MSGID: =?utf-8?q?1747112216458849625?= From: Pin-Yen Lin [ Upstream commit fbc1fdaa8338ec4ebd862d918a0ce3e12033e8a3 ] Send DPCD DP_SET_POWER_D0 command to the monitor in .atomic_enable callback. Without this command, some monitors won't show up again after changing the resolution. Fixes: 46ca7da7f1e8 ("drm/bridge: it6505: Send DPCD SET_POWER to downstream") Signed-off-by: Pin-Yen Lin Reviewed-by: Allen Chen Fixes: 46ca7da7f1e8 ("drm/bridge: it6505: Send DPCD SET_POWER to downstream") Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20220714173715.v2.1.I85af54e9ceda74ec69f661852825845f983fc343@changeid Signed-off-by: Sasha Levin --- drivers/gpu/drm/bridge/ite-it6505.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c index 4b673c4792d7..e5626035f311 100644 --- a/drivers/gpu/drm/bridge/ite-it6505.c +++ b/drivers/gpu/drm/bridge/ite-it6505.c @@ -2945,6 +2945,9 @@ static void it6505_bridge_atomic_enable(struct drm_bridge *bridge, if (ret) dev_err(dev, "Failed to setup AVI infoframe: %d", ret); + it6505_drm_dp_link_set_power(&it6505->aux, &it6505->link, + DP_SET_POWER_D0); + it6505_update_video_parameter(it6505, mode); ret = it6505_send_video_infoframe(it6505, &frame); From patchwork Wed Oct 19 08:27: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: 5069 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp248959wrs; Wed, 19 Oct 2022 03:45:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6vy+y+LHeAJT+se18a30viChs8qnoR5K1qVJ8I4CkgDpJMkD95g02BceCXQL2DgLTBN4DD X-Received: by 2002:a17:90a:354:b0:20a:6867:4a2b with SMTP id 20-20020a17090a035400b0020a68674a2bmr44639388pjf.157.1666176301343; Wed, 19 Oct 2022 03:45:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176301; cv=none; d=google.com; s=arc-20160816; b=PuMURJ4kQl78kNFbqy4ZMEKePVY03rL/ayTe4RMBal2PnSvZpvbr6F6VbgVVrja10L uy2nNG2GtS7mvV8Mm/wWwRtc4bK+/fvuU2hg1XFhTXEChWZa9RL3dhEhM9ZAaTJ3GRPr y7H46SHwqdxeMe/sBfVjwJCLR974vXW3rdSTWs9iRzV1XEslPuBVDQWRtx23fGMY8k6j JKzHU42KJ6iVuNOFfrKhXLcCbELabZa0i+7A9o4TDdo2kahjbc9PmPKHJ4/KvO0Dq+BX rf/j9XDRPbGF/cXcCOigLdI7en4THHnZMute1KLIEh2AFzpkJR7uNvc4dkfzQvXxAaP6 nkmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=U6eY5bL12X2qKp52Hitse650aPa62aN54mPIuo3+3nU=; b=QhvGUBPRncnx0I7yFeZxtlVxCBTJzZ5AcDES6sumVHg38mmudgoTcUo0b8i9ATtll+ lHMD0mvCN/CZ1GZ2vnSFHr42y4n63fXqwTvjtUNQ42AAeZb2YnuW8IRQ09R5lbjJmIcu KhHp8J3HV01dtfLhiGd8tDwdMWwrteg4c0nOfUAd7Sk83ddzT0ijYM6K7zXgU6Efcvg1 N0w2MnOOQ/WvyFtWySMHbDD4EC4OotvzjRjmFUt1rU1Xn3vc+dJUXoNveDSFPGxn8GWC f4MbJPaScNGThQw4wqqHuXjEPEWiA0w+NxnBGfT5IlC/QXHeSBFREboU1z8raG8RkdMx dx0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=asJX0QaT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lp15-20020a17090b4a8f00b00202a34035bfsi18401215pjb.78.2022.10.19.03.44.46; Wed, 19 Oct 2022 03:45: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=asJX0QaT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232559AbiJSKns (ORCPT + 99 others); Wed, 19 Oct 2022 06:43:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232255AbiJSKmu (ORCPT ); Wed, 19 Oct 2022 06:42: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 C0BDD5F103; Wed, 19 Oct 2022 03:19:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 314FFB823BC; Wed, 19 Oct 2022 08:53:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 681ADC433C1; Wed, 19 Oct 2022 08:53:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169637; bh=0n3wCM2FLB57ac0bicBovbICBhHb3K3wk0u9suBfZPM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=asJX0QaTJV8qDwBShXtiIXXHST2Qybn+sceGuRkw6+BW9Ed6TMkB6Bemzm2WfmJ/u G1c2WwoHEUg/WUpDrK2fkWWT92B+zagQucJAkc9sJEeeNJao1WQL2qk/IJc/E6lwmY A3UQv3oyYv3nugP2SEBSCQl8dlcrIULq37teh2fQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Zimmermann , Javier Martinez Canillas , Zack Rusin , Daniel Vetter , Daniel Vetter , Sam Ravnborg , Helge Deller , Alex Deucher , Zhen Lei , Changcheng Deng , Maarten Lankhorst , Maxime Ripard , dri-devel@lists.freedesktop.org, Sasha Levin Subject: [PATCH 6.0 352/862] video/aperture: Disable and unregister sysfb devices via aperture helpers Date: Wed, 19 Oct 2022 10:27:19 +0200 Message-Id: <20221019083305.595661084@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112481315439885?= X-GMAIL-MSGID: =?utf-8?q?1747112481315439885?= From: Thomas Zimmermann [ Upstream commit 5e01376124309b4dbd30d413f43c0d9c2f60edea ] Call sysfb_disable() before removing conflicting devices in aperture helpers. Fixes sysfb state if fbdev has been disabled. Signed-off-by: Thomas Zimmermann Reviewed-by: Javier Martinez Canillas Fixes: fb84efa28a48 ("drm/aperture: Run fbdev removal before internal helpers") Cc: Zack Rusin Cc: Thomas Zimmermann Cc: Javier Martinez Canillas Cc: Daniel Vetter Cc: Daniel Vetter Cc: Sam Ravnborg Cc: Helge Deller Cc: Alex Deucher Cc: Zhen Lei Cc: Changcheng Deng Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: dri-devel@lists.freedesktop.org Link: https://patchwork.freedesktop.org/patch/msgid/20220718072322.8927-8-tzimmermann@suse.de Signed-off-by: Sasha Levin --- drivers/video/aperture.c | 14 ++++++++++++++ drivers/video/fbdev/core/fbmem.c | 12 ------------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/drivers/video/aperture.c b/drivers/video/aperture.c index 538f2d40acda..d245826a9324 100644 --- a/drivers/video/aperture.c +++ b/drivers/video/aperture.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -286,7 +287,20 @@ int aperture_remove_conflicting_devices(resource_size_t base, resource_size_t si #if IS_REACHABLE(CONFIG_FB) struct apertures_struct *a; int ret; +#endif + + /* + * If a driver asked to unregister a platform device registered by + * sysfb, then can be assumed that this is a driver for a display + * that is set up by the system firmware and has a generic driver. + * + * Drivers for devices that don't have a generic driver will never + * ask for this, so let's assume that a real driver for the display + * was already probed and prevent sysfb to register devices later. + */ + sysfb_disable(); +#if IS_REACHABLE(CONFIG_FB) a = alloc_apertures(1); if (!a) return -ENOMEM; diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index 02b0cf2cfafe..bda4d304feb6 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include @@ -1777,17 +1776,6 @@ int remove_conflicting_framebuffers(struct apertures_struct *a, do_free = true; } - /* - * If a driver asked to unregister a platform device registered by - * sysfb, then can be assumed that this is a driver for a display - * that is set up by the system firmware and has a generic driver. - * - * Drivers for devices that don't have a generic driver will never - * ask for this, so let's assume that a real driver for the display - * was already probed and prevent sysfb to register devices later. - */ - sysfb_disable(); - mutex_lock(®istration_lock); do_remove_conflicting_framebuffers(a, name, primary); mutex_unlock(®istration_lock); From patchwork Wed Oct 19 08:27: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: 4679 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212880wrs; Wed, 19 Oct 2022 02:08:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7qPNfDZUHC+OdQZ4U+rCCPlR1dTunZ8vqYk3tQ3Pks23giTyLSeQBhfHelIfwPyJVrCwCL X-Received: by 2002:a17:907:1dcf:b0:78d:8afc:bc9f with SMTP id og15-20020a1709071dcf00b0078d8afcbc9fmr5737446ejc.518.1666170515092; Wed, 19 Oct 2022 02:08:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170515; cv=none; d=google.com; s=arc-20160816; b=JK+Gw2VkSpUi4f5cW8bCdlGxvARAb/EvUGMh/soyY0vfxIKebrOXBZX1C3djQO92zh Q5ZKV8tDZNT2DawaViHjLB+33OeJCu9LBpKevz318MxXFJU0hZYSrpLB7Ql/FhOxR+Lr CaPUp0Y5rt4NdifoCJn0fg+0e/BcsAslRfTovP/hfZ6mwvMnLlWHDugQx7066flSMqAh DrPkoIaayjCYpRlLUiFm0kf9JGWc7Du5s0Zohs1iB62hc0Kx8DMTAkl/gSmjOC5H+lz2 lTnBkOCNQLT1L7O/FiwLd3N1SHcwOFMrG4ZITw0FhNCKUq/cPMnnqna+pKiHm49ZWFGJ W8ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GN0+YOy70zoYZPp5tqaWEccb5XQrXOx1r1uqZfcxcn4=; b=T968VfwZsk8RvUjexwl9/7c8ocu0sDIQ9nFpbS6oHByYdTJ5WHu8aFhip8gsFULni0 gXmzJ+npqKKjPgZQn/kb/u54q9Ht4/g4YnNksSpzuXK9amKFevsD12lHzZB43pB2yxFD SVxZ0b35FwHlep7PFNEDEQSbt79oYxFG+3qPasuR4rDpyg5YXAkYe7g0Uutru2b6Remw HfrvSqzQT5k9QQcS42FpMBFxOTjWAWXv8dhoMPPBaWTDR/i+ogvXfebpYpI92VO8EdKd rp+jd7xWT/0XXm3wuv1k32ql/6MO33ic4FhCRscHBwyHYXy++hjYq06CYv+ykLkRYLDp GKCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=L2xY8hWv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o8-20020a170906974800b0073db512d918si13814546ejy.765.2022.10.19.02.08.04; Wed, 19 Oct 2022 02:08: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=L2xY8hWv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232000AbiJSJCt (ORCPT + 99 others); Wed, 19 Oct 2022 05:02:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231896AbiJSJAG (ORCPT ); Wed, 19 Oct 2022 05:00: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 CA1ED6B67F; Wed, 19 Oct 2022 01:55:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1218A617EC; Wed, 19 Oct 2022 08:54:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 211B3C433D6; Wed, 19 Oct 2022 08:53:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169640; bh=EEbUB2+t3mQjhUpvR8BIh6PyoINtwoaI6t93TceIrNU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L2xY8hWvskFnNNIu6U8YF7NJtHb9Zt89RJ95eWHoTLLxGdQbuNnExZ4ejLSt/93rh b8e1KENBRlKin1pxP7r7UXJMLsDKCN8yqhTzMEAmzk83Rt9N4UAInMX7jv0WPraH1W C2gUE5tNW3PvrOqvoD7dKY+Oq88NRNBuld3d4D1E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Emil Velikov , Dmitry Osipenko , Gerd Hoffmann , Sasha Levin Subject: [PATCH 6.0 353/862] drm/virtio: Correct drm_gem_shmem_get_sg_table() error handling Date: Wed, 19 Oct 2022 10:27:20 +0200 Message-Id: <20221019083305.639563564@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106414385547508?= X-GMAIL-MSGID: =?utf-8?q?1747106414385547508?= From: Dmitry Osipenko [ Upstream commit 64b88afbd92fbf434759d1896a7cf705e1c00e79 ] Previous commit fixed checking of the ERR_PTR value returned by drm_gem_shmem_get_sg_table(), but it missed to zero out the shmem->pages, which will crash virtio_gpu_cleanup_object(). Add the missing zeroing of the shmem->pages. Fixes: c24968734abf ("drm/virtio: Fix NULL vs IS_ERR checking in virtio_gpu_object_shmem_init") Reviewed-by: Emil Velikov Signed-off-by: Dmitry Osipenko Link: http://patchwork.freedesktop.org/patch/msgid/20220630200726.1884320-2-dmitry.osipenko@collabora.com Signed-off-by: Gerd Hoffmann Signed-off-by: Sasha Levin --- drivers/gpu/drm/virtio/virtgpu_object.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/virtio/virtgpu_object.c b/drivers/gpu/drm/virtio/virtgpu_object.c index b38c338211aa..75a159df0af6 100644 --- a/drivers/gpu/drm/virtio/virtgpu_object.c +++ b/drivers/gpu/drm/virtio/virtgpu_object.c @@ -170,6 +170,7 @@ static int virtio_gpu_object_shmem_init(struct virtio_gpu_device *vgdev, shmem->pages = drm_gem_shmem_get_sg_table(&bo->base); if (IS_ERR(shmem->pages)) { drm_gem_shmem_unpin(&bo->base); + shmem->pages = NULL; return PTR_ERR(shmem->pages); } From patchwork Wed Oct 19 08:27: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: 5306 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp283229wrs; Wed, 19 Oct 2022 05:04:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5dAvUbfPHyMKzwOBcmERj4zha16kMmMIcDFNInv/A9PAaQd9jlKYK8TRkq+6FYmvpRv05l X-Received: by 2002:a17:906:9c83:b0:779:c14c:55e4 with SMTP id fj3-20020a1709069c8300b00779c14c55e4mr6244785ejc.619.1666181060719; Wed, 19 Oct 2022 05:04:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666181060; cv=none; d=google.com; s=arc-20160816; b=dNzjpf1IKbGumJJx6zRMk4LktkBZAJeBEjHQ8k+Z8vo3AXtgwW3eThuk8pBPGqYUXO mkJd/I7372brb1cZstwZsKRELjdu22v7V68W0q1o2cNYdvNDl+Enp4zPweL6f81uys0u 4QVcMbx/BHE92xrNlPtpyU1b/P5MQvKyHHRLncnGTr+YYKCBuuWypOSgu1MreCJ6TJC2 zHcil1fdioqDN54K5pWKiNMwyxW9UZu/UpUqaon/l/ABWnH+Wbv/ru+7y+Zn/q+SDXJB AAvL1tYqnzJwmw1Y0kKEggOl7biQ2ga+id8wmxvFbTXTtBE6d1kNknlBErkM6dSUidsb 0Hhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lnxDdR4fUwXlujoAvLEXf2RGpy3f9J7F02NLf2roYlU=; b=Re91bciL6uL5WrsTwwtXIFouB2GvT6x5i/epTreP0K0lrjuGEgPwpFyd5aJ7sJLcES cBA5oVl+2Zi3KnQC86gr4r7m7gbY7tMFPRhZpDqRW4t2MyUU0w5chbkaXDmnSfUGrZFA //aR1QqxDMbTRhGro3vpc3ixMGs4JH89PqFs0fpcwtX9ewBNF/kS9/ZHfPp66c3XWm1F /zuEwWFMl5h5oBCzSw4fQx3AhDRQqON92+/K4MMPDEC1aNvlxPglcN4RfpRhpVKYh+ep 0UH7cH+cePWkOfQdHyItv0Fmj+SimTJPE4sIDJCxw8MBUSyUTdvnq2GJr1p8oDswXMqU 4q/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UW739ri0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mf4-20020a170906cb8400b0078e1cd71067si12210105ejb.205.2022.10.19.05.03.55; Wed, 19 Oct 2022 05:04: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=UW739ri0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231864AbiJSLyd (ORCPT + 99 others); Wed, 19 Oct 2022 07:54:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232312AbiJSLyA (ORCPT ); Wed, 19 Oct 2022 07:54:00 -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 B04DE1ACAA1; Wed, 19 Oct 2022 04:33:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 57585B823BB; Wed, 19 Oct 2022 08:54:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B711FC433C1; Wed, 19 Oct 2022 08:54:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169643; bh=rB+7liTz6fUSTUIeYUpesRGUTcU+4qwtivdpWxzWjnI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UW739ri0f9VVT0z+fv6q001rhFUi5lw5S77u7c4w7Qg9bJn6LIsP92DqREqTIIXmF rAFG1ubTCW1ePCgRTxuumHQzoIQ4VgYOpBr7kOrNBYZ6gGOnFRJdqubyDy/ZScptni Ut8XKxyioZPOBCBPgT3xANxB0oBR8vLhbc+RWHJw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Robert Foss , Sasha Levin Subject: [PATCH 6.0 354/862] drm/bridge: anx7625: Fix refcount bug in anx7625_parse_dt() Date: Wed, 19 Oct 2022 10:27:21 +0200 Message-Id: <20221019083305.680888969@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747117472203763664?= X-GMAIL-MSGID: =?utf-8?q?1747117472203763664?= From: Liang He [ Upstream commit 1d43a5120ab49f22ba6c5901ad3994e254510303 ] In anx7625_parse_dt(), 'pdata->mipi_host_node' will be assigned a new reference with of_graph_get_remote_node() which will increase the refcount of the object, correspondingly, we should call of_node_put() for the old reference stored in the 'pdata->mipi_host_node'. Fixes: 8bdfc5dae4e3 ("drm/bridge: anx7625: Add anx7625 MIPI DSI/DPI to DP") Signed-off-by: Liang He Reviewed-by: Robert Foss Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20220719065447.1080817-1-windhl@126.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/bridge/analogix/anx7625.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c index d1f1d525aeb6..79fc7a50b497 100644 --- a/drivers/gpu/drm/bridge/analogix/anx7625.c +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c @@ -1642,6 +1642,7 @@ static int anx7625_parse_dt(struct device *dev, anx7625_get_swing_setting(dev, pdata); pdata->is_dpi = 0; /* default dsi mode */ + of_node_put(pdata->mipi_host_node); pdata->mipi_host_node = of_graph_get_remote_node(np, 0, 0); if (!pdata->mipi_host_node) { DRM_DEV_ERROR(dev, "fail to get internal panel.\n"); From patchwork Wed Oct 19 08:27: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: 5303 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp282944wrs; Wed, 19 Oct 2022 05:03:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5YpHAwY0r69E00qca8PnoGKxfOHvbX5rYQpjFfm+s25ehFvJFByXx0v1rDqTCBwMjrlCS0 X-Received: by 2002:a17:902:bd46:b0:17e:8ee5:7b61 with SMTP id b6-20020a170902bd4600b0017e8ee57b61mr8354497plx.44.1666181034780; Wed, 19 Oct 2022 05:03:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666181034; cv=none; d=google.com; s=arc-20160816; b=NN0JpgcTLSDD83UpEIze6X7SlHsjg2qRy3RspIK9crqCvdBJgCrEDGX2qRK6mTDW52 QhQ1Sa+i1LIeu3ozaxMLaqdMZza8bJZ4ItAtnxGWrxoRsG0ZSA7u99BQ06ZT8eS/OEiX zNizX5N3uRlXfgnHswmQ3HY4hG5ffrlIKYUjIKPM+me72H/8PUEYFOxy6TFLtHBwe3UX cqVwqnT04AWIQmRwhATSDQBN1t8vKasS4DIcq13uuoEF6FSJOCo8vVsMNIzaVSTmJADu P2ypEzSckTau4jIrdjKFeOXjcV5KdENbOXBnIeHmOflT3CyzgYMskxh7LHXUI6eXIXjF jahQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MziyT5vg+H67whEHrQd9zuEHgG49Q9pMI1vq7fFIVYg=; b=Geivz/Sv8pAi2nDbR2C+cXP02kan90FFSbzDyNW4HJfdm2KAwpGiSjMHhvC9dQYJFD coNFjIE+C9C+eMzBqS24B+wE/pF2OgWfYi6zASmn/g1qi7xxkEvaCoejzcN0/P/jigjJ OLOWUp7zEpWkoX1/PtUt3NcZfiT/0dJvFDkz6el6r/uaPOGou3yWMhoCuxR/7znaskTe xP/n+y481FSADilmzcqXQEuWSBu5LXBz4zguKUblFsFE7CHpxiBOqiFn7hJrzxy2X8hK EO2pWjgkwM3OYNXRfu8c9q4HGQb+FFTEVufe9IQNSQqb77cLlINCqvqjf5UCM7W2DrpF JIUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IxRqG3Ag; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k12-20020a170902d58c00b0017d2bb81273si18143155plh.600.2022.10.19.05.03.40; Wed, 19 Oct 2022 05:03:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IxRqG3Ag; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232387AbiJSMAj (ORCPT + 99 others); Wed, 19 Oct 2022 08:00:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231989AbiJSL7c (ORCPT ); Wed, 19 Oct 2022 07:59:32 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 185A0181C99; Wed, 19 Oct 2022 04:37: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 CE73AB823C0; Wed, 19 Oct 2022 08:54:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 48E8CC433C1; Wed, 19 Oct 2022 08:54:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169645; bh=GcEtVsWKnpmNwwgXJ7eWwXOSgwnZJUIhbPIQKSK6ZAg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IxRqG3Ag8oO8yLR8KjzoEmSKE6gmd8kPAJVYNGeL9bRMGOH44KtcKw4mu3dtXba0d qQCVsYoaiEwyi1RXF3dL4voRzIb6tslXxpNlWevynQkes77uAuGQ1SM4OAvgQnnyGF 3Rhokjuzk2smQ5qBk5m90Zgbop1NJKaf3n7SPJI4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Robert Foss , Sasha Levin Subject: [PATCH 6.0 355/862] drm/bridge: tc358767: Add of_node_put() when breaking out of loop Date: Wed, 19 Oct 2022 10:27:22 +0200 Message-Id: <20221019083305.720386538@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747117444430287028?= X-GMAIL-MSGID: =?utf-8?q?1747117444430287028?= From: Liang He [ Upstream commit 14e7157afb055248ed34901fcd6fbf54201cfea1 ] In tc_probe_bridge_endpoint(), we should call of_node_put() when breaking out of the for_each_endpoint_of_node() which will automatically increase and decrease the refcount. Fixes: 71f7d9c03118 ("drm/bridge: tc358767: Detect bridge mode from connected endpoints in DT") Signed-off-by: Liang He Reviewed-by: Robert Foss Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20220719065447.1080817-2-windhl@126.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/bridge/tc358767.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index 02bd757a8987..1dc107f13645 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -2010,9 +2010,10 @@ static int tc_probe_bridge_endpoint(struct tc_data *tc) for_each_endpoint_of_node(dev->of_node, node) { of_graph_parse_endpoint(node, &endpoint); - if (endpoint.port > 2) + if (endpoint.port > 2) { + of_node_put(node); return -EINVAL; - + } mode |= BIT(endpoint.port); } From patchwork Wed Oct 19 08:27: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: 4680 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212881wrs; Wed, 19 Oct 2022 02:08:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5vU/H1gnVsMpGGBlXOx19n2YbvmwO/O1kPOyY3K2aDmxlBbnl9pADw9ntVD0MEXzPiBSUR X-Received: by 2002:a17:906:846a:b0:78d:dfe6:4db5 with SMTP id hx10-20020a170906846a00b0078ddfe64db5mr5678714ejc.90.1666170515252; Wed, 19 Oct 2022 02:08:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170515; cv=none; d=google.com; s=arc-20160816; b=vhKX+JZn3M7UUBolZPB3u5DGj0lyWN+fIlF2h5hf2D2fUYuZcCZszvW6PAtDAz/KaU yNFSlRN3Hkeez5IV0FS7ch+ign46dGtppZUs7TYNbLYIci9vAzH+V/n6wVtpYgZyhfza vZqrnzrerQUyWkaqvCYTuAbfNgZK19/sBlDB96jld3lOITkTNvrBbWHBhmJ89r/4sm6m 3ULPPRCrp0OaHNCudT76O/Xg5UqbIuTeNHkIYa3wt6cHodsgJCV0HI8Tx+3P7MmnUAQ1 zYlRwX/MQvobj3ehyv5WryXJQfhLKhB56ZMAPB/W+gdYiuUMT3lPdSQiCs74sh1A5JCo pTtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ciBtspp4x8gYcYZzMiotZZwlOdC07bIMFT0IPGrfNxY=; b=NhtuZw96lpkwudKbUvW5FcqU2ysYD6INgw7/ZS8EKNfTErbQZQCxtd/WSOE9cGIHUj kBYcgAuZYUZ3i/xX9QfK3zU5yy06VqJMT1aAo0wmMgOTpl6fCYXf3UkHmHEmKtEuEg9v XmvA+EPGo/L2PvuxrVq1r+BVbLJzFh5H33nqPWHjw5rixZxigccmioDIowzVDTImOp63 1V3Sy1KjtupxcDz92gp1McuQ/WbcuhS9l5I5nVmiJavg3P9UdC/1aJlmh7PG7MJVU5xE vxXqnQcu7b6obq1KUGX35BgBQKbNxklL1Qf7RaZkT/nTucLlIuuQRJqYPNhIsFH4aA/k mAlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=itO6kHUS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e19-20020a17090658d300b007829d30452asi16945959ejs.583.2022.10.19.02.08.07; Wed, 19 Oct 2022 02:08: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=itO6kHUS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229705AbiJSJDA (ORCPT + 99 others); Wed, 19 Oct 2022 05:03:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232155AbiJSJAh (ORCPT ); Wed, 19 Oct 2022 05:00:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 919296C106; Wed, 19 Oct 2022 01:55:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D94226174B; Wed, 19 Oct 2022 08:54:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC7FAC433D6; Wed, 19 Oct 2022 08:54:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169648; bh=KtKdx8ciCkHxA71SnFUdpSaQth5te/5OBQ4Stjo6Rlg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=itO6kHUSCXqiLVNs1oYyC8hSdys/dRNxTtXJzdTSrTO1ml82YPYoS0L4HymJ2GT/o vdk/fRZb6GkT2jH3wM0VXKymlLPZNUuaBAaXB6+XuxSQ2esh8MJC9h2oP1OS/d6Q8g oNNlY7PhA8ol1rUkeMZRfB60RIfweIVs3llAaRyk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chen-Yu Tsai , Neil Armstrong , Robert Foss , Sasha Levin Subject: [PATCH 6.0 356/862] drm/bridge: parade-ps8640: Fix regulator supply order Date: Wed, 19 Oct 2022 10:27:23 +0200 Message-Id: <20221019083305.759061047@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106414298510226?= X-GMAIL-MSGID: =?utf-8?q?1747106414298510226?= From: Chen-Yu Tsai [ Upstream commit fc94224c2e0ae8d83ac511a3ef4962178505469d ] The datasheet says that VDD12 must be enabled and at full voltage before VDD33 is enabled. Reorder the bulk regulator supply names so that VDD12 is enabled before VDD33. Any enable ramp delays should be handled by setting proper constraints on the regulators. Fixes: bc1aee7fc8f0 ("drm/bridge: Add I2C based driver for ps8640 bridge") Signed-off-by: Chen-Yu Tsai Reviewed-by: Neil Armstrong Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20220721092258.3397461-1-wenst@chromium.org Signed-off-by: Sasha Levin --- drivers/gpu/drm/bridge/parade-ps8640.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/parade-ps8640.c b/drivers/gpu/drm/bridge/parade-ps8640.c index 31e88cb39f8a..49107a6cdac1 100644 --- a/drivers/gpu/drm/bridge/parade-ps8640.c +++ b/drivers/gpu/drm/bridge/parade-ps8640.c @@ -631,8 +631,8 @@ static int ps8640_probe(struct i2c_client *client) if (!ps_bridge) return -ENOMEM; - ps_bridge->supplies[0].supply = "vdd33"; - ps_bridge->supplies[1].supply = "vdd12"; + ps_bridge->supplies[0].supply = "vdd12"; + ps_bridge->supplies[1].supply = "vdd33"; ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(ps_bridge->supplies), ps_bridge->supplies); if (ret) From patchwork Wed Oct 19 08:27:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5081 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp249425wrs; Wed, 19 Oct 2022 03:46:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6EtbRavkYH9RItgevCcD9mvF1j7iSLhq5YUFfT0pIT5MoVDGlDpcq86xb3WqI+FuNyrF6h X-Received: by 2002:a63:4307:0:b0:464:a24d:8201 with SMTP id q7-20020a634307000000b00464a24d8201mr6757445pga.116.1666176370662; Wed, 19 Oct 2022 03:46:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176370; cv=none; d=google.com; s=arc-20160816; b=L9rQhTJ/BwSXOYyYQRgNvZIquJx6mIt/H0erWH6uuBUDObBQeZ0Dsft+AbNfZ3cgTa foPgrhBGY51S0ZK7ABYggZ5CcIYt/xZPGEfHTr5yTsdEHf7PiCqdeF1AzEDmunYDtknF dtba0QAg7G4HfDbe63Zoxy6iKIt3XEUhrJrxUBzTzTg3mKEgbo3xs2gqxopohy/mQqz4 ZZbbGGKsC/6ohKxSMGpgx1v36c2+GgtuBkt+FBiVWadsJXHpIvzOqix5jG0m7oB6LzWk BxxFysO9eqmjZv5KEFjilwMOncc8EpceEt0PDe6JIUKQoGhlb/tpjPB90dQs4RaN+cmD mE3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VHGesMtAzo8FPiBH/wj1OVOaaJOl88BTUokQhG+Xhiw=; b=MJaqw9DF526fFbCDwzu4gM5tGWh7JOysvb3PybO6BKivETC5kA5xO6DP8pBz05hwtH SpcCN0YyZAncvRsLLNgi3h8I7rjWnrWN37TGNpGEc+bCaqhiSt1b6CkVMC2QgHsJgpmO zNI6XdqDnYpgXlSPAdXyfHrDgl94wTFWQ+Leo9gkOGNn9yEMXAJDB0/wsdcehxQIALsS 9Um/kvvzJGU61IHioMl3pdIQgUHfjgkKnkvye8BUb10yfImI/URkUKmT5qUqv0xmH5wI zeMxm3U+svz02TRqNOFRXdh85VSLOYV7kVaRuD1qB+Ys+kDB97RaDFxSyDhKl9/irKIv qP9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lil9xeFs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p4-20020a170902e74400b0017d6ffda9e3si20554535plf.369.2022.10.19.03.45.54; Wed, 19 Oct 2022 03: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=lil9xeFs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232710AbiJSKpj (ORCPT + 99 others); Wed, 19 Oct 2022 06:45:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232761AbiJSKoF (ORCPT ); Wed, 19 Oct 2022 06:44:05 -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 2A3C3AB803; Wed, 19 Oct 2022 03:20:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2A72FB823BA; Wed, 19 Oct 2022 08:54:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B77DC433D6; Wed, 19 Oct 2022 08:54:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169650; bh=esWIenx8gII1JJLWa5PV7a3Z/OUnhFQz9LcMdo2nw8I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lil9xeFsifLllLfompE4Ew2KE3jViYbjMlpACsCfiXx3+6/kVOzbRaNKaUjih9g79 P5GYAhBfGYfLkSSp2Pt9Uu/qcLe+JIxQf/7usHA4ZiBsbmE5UMbD4KIHHScZxjmTzo PzX6TusEqonMSZpXDCxlPVULzredzjHX4vzXwk9U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Gow , =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= , Sasha Levin Subject: [PATCH 6.0 357/862] drm/format-helper: Fix test on big endian architectures Date: Wed, 19 Oct 2022 10:27:24 +0200 Message-Id: <20221019083305.790911380@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112553584894253?= X-GMAIL-MSGID: =?utf-8?q?1747112553584894253?= From: José Expósito [ Upstream commit 18c8485236a5e3f491b670c018ae391c9cb84dfa ] The tests fail on big endian architectures, like PowerPC: $ ./tools/testing/kunit/kunit.py run \ --kunitconfig=drivers/gpu/drm/tests \ --arch=powerpc --cross_compile=powerpc64-linux-gnu- Transform the XRGB8888 buffer from little endian to the CPU endian before calling the conversion function to avoid this error. Fixes: 8f456104915f ("drm/format-helper: Add KUnit tests for drm_fb_xrgb8888_to_rgb332()") Reported-by: David Gow Reviewed-by: David Gow Signed-off-by: José Expósito Link: https://patchwork.freedesktop.org/patch/msgid/20220726230916.390575-2-jose.exposito89@gmail.com Signed-off-by: Sasha Levin --- .../gpu/drm/tests/drm_format_helper_test.c | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/tests/drm_format_helper_test.c b/drivers/gpu/drm/tests/drm_format_helper_test.c index 98583bf56044..eefaba3aaea2 100644 --- a/drivers/gpu/drm/tests/drm_format_helper_test.c +++ b/drivers/gpu/drm/tests/drm_format_helper_test.c @@ -111,6 +111,21 @@ static size_t conversion_buf_size(u32 dst_format, unsigned int dst_pitch, return dst_pitch * drm_rect_height(clip); } +static u32 *le32buf_to_cpu(struct kunit *test, const u32 *buf, size_t buf_size) +{ + u32 *dst = NULL; + int n; + + dst = kunit_kzalloc(test, sizeof(*dst) * buf_size, GFP_KERNEL); + if (!dst) + return NULL; + + for (n = 0; n < buf_size; n++) + dst[n] = le32_to_cpu((__force __le32)buf[n]); + + return dst; +} + static void xrgb8888_to_rgb332_case_desc(struct xrgb8888_to_rgb332_case *t, char *desc) { @@ -125,6 +140,7 @@ static void xrgb8888_to_rgb332_test(struct kunit *test) const struct xrgb8888_to_rgb332_case *params = test->param_value; size_t dst_size; __u8 *dst = NULL; + __u32 *src = NULL; struct drm_framebuffer fb = { .format = drm_format_info(DRM_FORMAT_XRGB8888), @@ -138,8 +154,11 @@ static void xrgb8888_to_rgb332_test(struct kunit *test) dst = kunit_kzalloc(test, dst_size, GFP_KERNEL); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dst); - drm_fb_xrgb8888_to_rgb332(dst, params->dst_pitch, params->xrgb8888, - &fb, ¶ms->clip); + src = le32buf_to_cpu(test, params->xrgb8888, TEST_BUF_SIZE); + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, src); + + drm_fb_xrgb8888_to_rgb332(dst, params->dst_pitch, src, &fb, + ¶ms->clip); KUNIT_EXPECT_EQ(test, memcmp(dst, params->expected, dst_size), 0); } From patchwork Wed Oct 19 08:27: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: 4683 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212969wrs; Wed, 19 Oct 2022 02:08:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7ZSCYeTJe4+GjdDY++4PKoPCoFkdElIewHn98GL1TRWhvzAmV2aKSBV937HaNAbQSsqb5Y X-Received: by 2002:a17:907:3f23:b0:78e:260a:fc33 with SMTP id hq35-20020a1709073f2300b0078e260afc33mr5981940ejc.152.1666170529751; Wed, 19 Oct 2022 02:08:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170529; cv=none; d=google.com; s=arc-20160816; b=sDCsglXMmsULDBxKTrDelWfFoknGrRpCUY7OM28BXNb2yGKBVlc5py2hL9Tze7c5Je FfLm6ZAwxoptPVEp4hbZb1Ermw8KkAyVseHzjrJ+DT12RTjE8QafsfUO49/EafD0iqpX SgbYJNDNjEGzq/LVy382kNx8hG3HKNJvCLAc/3OuXNgNMSGEfrllKX5ZOnXUO7xHycro 9govPoXsC9JcXxE4uYpxoI/5wp2yLnRHkOSQKlgBADE++viVAINI5eekMX9FmqRkI7O6 vbetJED78YSM7HRzk0kpbL72F337eddPFqI0AP9NIeZsos+DXh1mQ8MDiqA//YqwvZG1 o75w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=krJBN5/BmQpwW44WhkmjdCPYneucenoWHe7kuMHkqoY=; b=gFpZZqvlXgMBgSV/3Qj5Sjp914T4eJsfzcLHRC/zsH/NcUPblhIcpJbtG3IZwcCcAn Nj0rq0YGtZACE63YNMwbfPs6SAdO04g6ir8rxCHr9Lh22B2UhorVL4OusT039w2Ig/aD 9dQYns06BWx0dZNOE6x6SKy8ZuxjEkkmuM/49FnUl/03sMrzxO0YdLs3Z5INTqlZDViF efXfiWrvfb8f3jxLlBCWoLajVImvdBtyUb4TrrzcZynjoIL4dNg8zsLDlFFzZvGVDq/Q kx8z6/Fe9uvyiPZigCkrqkZAx8ojd9jhcAziHdovKhAwEcKbpdWt0ljxsS5v3Z6gk30G sQ3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uskLR9Pp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sz15-20020a1709078b0f00b0078ddc074afdsi10693260ejc.577.2022.10.19.02.08.10; Wed, 19 Oct 2022 02:08: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=uskLR9Pp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232206AbiJSJDL (ORCPT + 99 others); Wed, 19 Oct 2022 05:03:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232265AbiJSJBf (ORCPT ); Wed, 19 Oct 2022 05:01:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C61AC8E0E8; Wed, 19 Oct 2022 01:55: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 8EA13617E8; Wed, 19 Oct 2022 08:54:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A164FC433D6; Wed, 19 Oct 2022 08:54:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169656; bh=C1rwG8z2GfL29LvFgqELgKitE9ciVJlqDiNdRtp24lY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uskLR9PpRwBmdDUryxzBYZrn1AgMU2WmV2Ly73iF9bFE4BeedQ9yDKkBayLBZ4ZqH 75Ngbqi+reJWgWbThZhOUdmOf/gkASwFIfKVjpW4gfs2LCV4Hi/pU5Q65ZfAik2aLg nxTcRKQCoPNkwyJhlouwad8wVycDPN+UXv4aNOcw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Simon Ser , Lyude Paul , Benjamin Gaignard , Jani Nikula , Sasha Levin Subject: [PATCH 6.0 358/862] drm/dp_mst: fix drm_dp_dpcd_read return value checks Date: Wed, 19 Oct 2022 10:27:25 +0200 Message-Id: <20221019083305.822247722@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106429426952796?= X-GMAIL-MSGID: =?utf-8?q?1747106429426952796?= From: Simon Ser [ Upstream commit 2ac6cdd581f48c8f68747156fde5868486a44985 ] drm_dp_dpcd_read returns the number of bytes read. The previous code would print garbage on DPCD error, and would exit with on error on success. Signed-off-by: Simon Ser Fixes: cb897542c6d2 ("drm/dp_mst: Fix W=1 warnings") Cc: Lyude Paul Cc: Benjamin Gaignard Reviewed-by: Jani Nikula Link: https://patchwork.freedesktop.org/patch/473500/ Signed-off-by: Sasha Levin --- drivers/gpu/drm/display/drm_dp_mst_topology.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/display/drm_dp_mst_topology.c b/drivers/gpu/drm/display/drm_dp_mst_topology.c index 57e65423e50d..7a94a5288e8d 100644 --- a/drivers/gpu/drm/display/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/display/drm_dp_mst_topology.c @@ -4907,14 +4907,14 @@ void drm_dp_mst_dump_topology(struct seq_file *m, seq_printf(m, "dpcd: %*ph\n", DP_RECEIVER_CAP_SIZE, buf); ret = drm_dp_dpcd_read(mgr->aux, DP_FAUX_CAP, buf, 2); - if (ret) { + if (ret != 2) { seq_printf(m, "faux/mst read failed\n"); goto out; } seq_printf(m, "faux/mst: %*ph\n", 2, buf); ret = drm_dp_dpcd_read(mgr->aux, DP_MSTM_CTRL, buf, 1); - if (ret) { + if (ret != 1) { seq_printf(m, "mst ctrl read failed\n"); goto out; } @@ -4922,7 +4922,7 @@ void drm_dp_mst_dump_topology(struct seq_file *m, /* dump the standard OUI branch header */ ret = drm_dp_dpcd_read(mgr->aux, DP_BRANCH_OUI, buf, DP_BRANCH_OUI_HEADER_SIZE); - if (ret) { + if (ret != DP_BRANCH_OUI_HEADER_SIZE) { seq_printf(m, "branch oui read failed\n"); goto out; } From patchwork Wed Oct 19 08:27: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: 5055 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp247971wrs; Wed, 19 Oct 2022 03:42:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4f9GTKZ3VQ5ZGYFOzGsYeSNa1J87kEnnIhJU4u/uKCrLSnt4g1agQpa86HPyWqRLNAJKMU X-Received: by 2002:aa7:cd92:0:b0:456:cbb5:2027 with SMTP id x18-20020aa7cd92000000b00456cbb52027mr6802151edv.384.1666176140393; Wed, 19 Oct 2022 03:42:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176140; cv=none; d=google.com; s=arc-20160816; b=pt64xSxUPod9t0Ge1iZucQKasTAy23QA3a1HNPBRh1Mhf5oIOHPF2CKqxzbPLIKKHw ivKhx93Pcv7z2NaAA0ALDqUdWVcp5NVyI2+T6YvVJ0YZ3mHyoxllkM8zbZaX95awPlnR i5Nh2eDULcz65UI12CbLr+/rHmEh4dn4xa29k/FHpyVSyrVPRmimjkDzgrhr9NBmLoss c9HiQzYMjof2q9IneUttpIH5antOmHiKSPTY2xKsLuNvEGVlD41461sqY2WQrHGlc+XR XP3cFugntFrK2Q7ze4upY56fwwxmMOd8aMBqjo31L2ItnBx9nIpWWAeIf6PHq4EUbf8h PoCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=25iHbbcUvyHSEHlFZR4HUcoLs6DKzUBsviI7qRRHgBw=; b=zW+LZZSpVWo5Dk6XvgQu3j3QihbKfKa5MGdgMJbJsBB8U0etoXFddigaV7/dbdJ/pG 57a9jjM5wDVKmJP1Qg1i7q+QWKnHqJF67UPiO9gtnFf/PLVvg9rsWoluhX20KJh9vh6p sMzVpgq+SV2lMgD8VkzJ5iVaAQizg575E5y5UG5AhS/rN1/b5U7aWPoAOfZ+YdrXermq etNZaBqDNOcCN9Ai+1492a7jUq3OjnH7t4y3kBDBH38S7zay6PNR3IXYCIP7llA2Cay5 SBTYM9gNH7ftQPvTp/uryOKR+X6bwfxBqLzG1y5HydcY8EEAeqvB1wcJcDyeCmLOULpp VJpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ny0BWUwt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a1709073f0a00b0078a9cbab78asi15626654ejc.738.2022.10.19.03.41.54; Wed, 19 Oct 2022 03:42:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ny0BWUwt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232181AbiJSKlQ (ORCPT + 99 others); Wed, 19 Oct 2022 06:41:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232105AbiJSKkP (ORCPT ); Wed, 19 Oct 2022 06:40:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36175157455; Wed, 19 Oct 2022 03:18: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 ams.source.kernel.org (Postfix) with ESMTPS id CFB66B823BE; Wed, 19 Oct 2022 08:54:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3AE7EC433D6; Wed, 19 Oct 2022 08:54:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169658; bh=YcVYeCCWSGIsznKuEIKIJtlRsY/01E416pCnfLTIunY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ny0BWUwtYxhofzD4h00rD7/lv+wqF/QcKdYsJcd21gt1Y28II+Db/QtljQHvcEbja N47jdfMZsTfHhXldiZtPHaOkjd7N8cu98WNME+PyzlBNNLGhZjl9fZIKvqskkCUhrW BtKepSpAZLJvVit3siU0SAGQ0FXkaAGHrfcRTpXM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Rob Herring , Daniel Vetter , Sasha Levin Subject: [PATCH 6.0 359/862] drm:pl111: Add of_node_put() when breaking out of for_each_available_child_of_node() Date: Wed, 19 Oct 2022 10:27:26 +0200 Message-Id: <20221019083305.866063002@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112312523676571?= X-GMAIL-MSGID: =?utf-8?q?1747112312523676571?= From: Liang He [ Upstream commit e0686dc6f2252e009c455fe99e2ce9d62a60eb47 ] The reference 'child' in the iteration of for_each_available_child_of_node() is only escaped out into a local variable which is only used to check its value. So we still need to the of_node_put() when breaking of the for_each_available_child_of_node() which will automatically increase and decrease the refcount. Fixes: ca454bd42dc2 ("drm/pl111: Support the Versatile Express") Signed-off-by: Liang He Reviewed-by: Rob Herring Signed-off-by: Daniel Vetter Link: https://patchwork.freedesktop.org/patch/msgid/20220711131550.361350-1-windhl@126.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/pl111/pl111_versatile.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/pl111/pl111_versatile.c b/drivers/gpu/drm/pl111/pl111_versatile.c index efb01a554574..1b436b75fd39 100644 --- a/drivers/gpu/drm/pl111/pl111_versatile.c +++ b/drivers/gpu/drm/pl111/pl111_versatile.c @@ -404,6 +404,7 @@ static int pl111_vexpress_clcd_init(struct device *dev, struct device_node *np, if (of_device_is_compatible(child, "arm,pl111")) { has_coretile_clcd = true; ct_clcd = child; + of_node_put(child); break; } if (of_device_is_compatible(child, "arm,hdlcd")) { From patchwork Wed Oct 19 08:27: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: 5071 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp249062wrs; Wed, 19 Oct 2022 03:45:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5f2ZpLRIl6qAOqavvpd8zcKe6b7lZHFL9nkqye/D4t3BHBGzABjBXpmUMKMj9xcv2Hyh9R X-Received: by 2002:a17:90a:4811:b0:20a:fee1:8f69 with SMTP id a17-20020a17090a481100b0020afee18f69mr2071084pjh.0.1666176315779; Wed, 19 Oct 2022 03:45:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176315; cv=none; d=google.com; s=arc-20160816; b=XqssOKbMivPakO3OYFini9NGa4FVKMnCDsaswKufzzgmcbIS4qVOG0sayTXEzvJr9u m6+3wViczSKwNU/7nA22Y3PbSm8U0RYwKE5Go4l26b1RNbD1cslw/EbYXkH3NLpL5h4P TCSc5XpXeB5g/5R2R8tLsQdHRKvcngL9gPtr5FSaXYYv89HGHbx8BAdehcDCScpUyQyy NAWguwJ+yQ/270PbEycyio1ZNs3NhQXkWc8GhdLQAyhq/bj5slnShfICgSm1051gjTFd NYvGHk8i0gvZ0+q0eZPFnvPWPLP3MOaI0ZJdPj3YozQB91CReFl779JrYzTm/LtVe6pe KvhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+2OlzfpS5MMajXr+hZlxFbQG1yH4zv3SD1T4YaiRlB8=; b=r8MsXUIZwAKl+7Xya59oTNIKM5IytD+3eytxsUJX0E3zz6TZWBMyepVlYLrH1Pb/K7 yooZMWRJLyZhFtvINvY5KlZN/h2nNCW1XjaThy9hCG6gDfzLwingG5DT03iIMwa4nN16 p+EjQQEvxvk/AZn+leD3afMcGjdqxOu3g1fMeTkba8HdC3w+hLRg3xmSo8+LX/rGACev GVeS8tg2N34AdvX1ZN1VL7tJfow9FyR6HCQZqQ/rlWAtO9BNytrL+QZWtqHQ9MIaj0vT agO4wvQzvvT8JS+wVyXgOVmnPCY4SDnsueLJ+cQbwtZTCJ8dtMLyNYOPpDm5ISySOJ6X hw9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wKan+qX6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n26-20020a63971a000000b0043c2e57961asi17600289pge.799.2022.10.19.03.45.02; Wed, 19 Oct 2022 03:45: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=wKan+qX6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232051AbiJSKoq (ORCPT + 99 others); Wed, 19 Oct 2022 06:44:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231325AbiJSKnT (ORCPT ); Wed, 19 Oct 2022 06:43:19 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41D9D152030; Wed, 19 Oct 2022 03:20: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 6610EB823C2; Wed, 19 Oct 2022 08:54:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D009AC433C1; Wed, 19 Oct 2022 08:54:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169661; bh=juEF15GNwvV1UwXjbjTX7qGN5uH7jvIijRl/WPZIT4w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wKan+qX6woRMTeMOC8EQSRUP8KwYDC+uGIDh8teHOhq8rCQ8P8lx+6FT9E7UHkZCN qyuscseTb7VLukRikFSpTzBPuXb4z2Re/48s2CrtJI7DRId+cSxEe6ssnNPsz+5+tk Jjpqssaqrd3ajRRC7WQGZ5ZWctSaeY4zRVtxacIs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Mark Brown , Sasha Levin Subject: [PATCH 6.0 360/862] ASoC: mt6359: fix tests for platform_get_irq() failure Date: Wed, 19 Oct 2022 10:27:27 +0200 Message-Id: <20221019083305.905839342@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112496503147369?= X-GMAIL-MSGID: =?utf-8?q?1747112496503147369?= From: Dan Carpenter [ Upstream commit 51eea3a6fb4d39c2cc71824e6eee5949d7ae4d1c ] The platform_get_irq() returns negative error codes. It can't actually return zero, but if it did that should be treated as success. Fixes: eef07b9e0925 ("ASoC: mediatek: mt6359: add MT6359 accdet jack driver") Signed-off-by: Dan Carpenter Link: https://lore.kernel.org/r/YvThhr86N3qQM2EO@kili Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/mt6359-accdet.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sound/soc/codecs/mt6359-accdet.c b/sound/soc/codecs/mt6359-accdet.c index c190628e2905..7f624854948c 100644 --- a/sound/soc/codecs/mt6359-accdet.c +++ b/sound/soc/codecs/mt6359-accdet.c @@ -965,7 +965,7 @@ static int mt6359_accdet_probe(struct platform_device *pdev) mutex_init(&priv->res_lock); priv->accdet_irq = platform_get_irq(pdev, 0); - if (priv->accdet_irq) { + if (priv->accdet_irq >= 0) { ret = devm_request_threaded_irq(&pdev->dev, priv->accdet_irq, NULL, mt6359_accdet_irq, IRQF_TRIGGER_HIGH | IRQF_ONESHOT, @@ -979,7 +979,7 @@ static int mt6359_accdet_probe(struct platform_device *pdev) if (priv->caps & ACCDET_PMIC_EINT0) { priv->accdet_eint0 = platform_get_irq(pdev, 1); - if (priv->accdet_eint0) { + if (priv->accdet_eint0 >= 0) { ret = devm_request_threaded_irq(&pdev->dev, priv->accdet_eint0, NULL, mt6359_accdet_irq, @@ -994,7 +994,7 @@ static int mt6359_accdet_probe(struct platform_device *pdev) } } else if (priv->caps & ACCDET_PMIC_EINT1) { priv->accdet_eint1 = platform_get_irq(pdev, 2); - if (priv->accdet_eint1) { + if (priv->accdet_eint1 >= 0) { ret = devm_request_threaded_irq(&pdev->dev, priv->accdet_eint1, NULL, mt6359_accdet_irq, From patchwork Wed Oct 19 08:27: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: 4929 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp226040wrs; Wed, 19 Oct 2022 02:44:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7rqDdmtVFdX3e27aSF/t1H4Soh3WVewQjP1HVa93mTVGZRkALqMwj8z68NRawdJYmBW4GG X-Received: by 2002:a17:907:3206:b0:780:a882:a9ac with SMTP id xg6-20020a170907320600b00780a882a9acmr5825776ejb.765.1666172601724; Wed, 19 Oct 2022 02:43:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172601; cv=none; d=google.com; s=arc-20160816; b=T7suMCsVtyfN8NwugwpEcCtHWOy00BcBVT+/VcihjHU1juRkkYWGpbYjfrkP2fBpRr jtqCNlwhQ829GD/4cMbAjD7tdXoTGzG+OYCnGVyrrAFAMYCAnMVSbquQXHO0Ab/aEsPF FORIT/nIrsInqLo4outTsbsQ6VOzY/xZLy9DBVrUvAJ+XxQdJVO81fGtiUvsxFQClnYQ RQtsuYH7FmfQngPZHvJrwIXFJ/oNIz8QqyEjW3OlXthMb4yw6oREgqlZIHRZ6kW77uX4 uRDA54EFIYEo1xl1ijpkNg4yXF/Yb89zy9MR4ucXEzNIgQ0jYo0nQgegvmSiQ9qX0+Rc Dq6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BYRw71lY6vxY43SteU4dottjLlfRwn/LiKS4hp9BceE=; b=GbKWYWirFE6LGYM4xP0frMYVCnoOPLHVA/hnWxtykyHJxoN6V6fJ4SiAZg/3/uIOP2 CfJFsLcirR18Ga3NgTdPGEfgBzeIX5iZqQfBi8yqivroUa75XmPMYb6yDC7ZuZU6lbkX 4c89uubREGRa84ZtYlrH7aeP6kG+MdAT1fvFMvvI0Srf+w+rEXWvnP+l/68WvhO+1nvi URPt5Rurn85g4HN8cInCibSCWf0eeoMEE4JEHaycgnDVE6liwXCvNp7qaYLfyvP5Aq5i 2ZAIqK9KzGyYfE9ParNx51J+Cr3sbjTiJhGQ4DCPRpHCzWAvLO11Z6y1pgdyUjcH5Sl7 Dxxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=H0wvTzq7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u12-20020a50eacc000000b00458ff0764casi11727941edp.95.2022.10.19.02.42.56; Wed, 19 Oct 2022 02:43:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=H0wvTzq7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234048AbiJSJec (ORCPT + 99 others); Wed, 19 Oct 2022 05:34:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233801AbiJSJ33 (ORCPT ); Wed, 19 Oct 2022 05:29:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65768C4C11; Wed, 19 Oct 2022 02:13: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 83E61617F2; Wed, 19 Oct 2022 08:54:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95D19C433C1; Wed, 19 Oct 2022 08:54:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169664; bh=KNL1dvvDRYUp9Wdt2G9l0gi4OT7xq1EdMYgKn6rVOhM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H0wvTzq7pEPpNq8/JSGf8SNePjkxAKe7VTE76nkLgARyQXGJ9LwtMpZ9Mikm0XXT7 IxfDN/xtz7/NiTeLVjSxZemz6kdCZ2yPaLu3FQ3dk3BRV8+KJY4lXj77UFbuDLvle8 37lHOutaGZ9cLWsEGoO46GWN0gLsTA1fIvhpg6AU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yang Yingliang , Mark Brown , Sasha Levin Subject: [PATCH 6.0 361/862] ASoC: amd: acp: add missing platform_device_unregister() in acp_pci_probe() Date: Wed, 19 Oct 2022 10:27:28 +0200 Message-Id: <20221019083305.944183870@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108602062718944?= X-GMAIL-MSGID: =?utf-8?q?1747108602062718944?= From: Yang Yingliang [ Upstream commit 6a4ce20fd776d2fd19ffaf85cf34a53761e2c888 ] Add missing platform_device_unregister() in error path in acp_pci_probe(). Fixes: c49f5e74a11e ("ASoC: amd: acp: Add error handling cases") Signed-off-by: Yang Yingliang Link: https://lore.kernel.org/r/20220819073758.1273160-1-yangyingliang@huawei.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/amd/acp/acp-pci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/soc/amd/acp/acp-pci.c b/sound/soc/amd/acp/acp-pci.c index 2c8e960cc9a6..5bb23ebe1216 100644 --- a/sound/soc/amd/acp/acp-pci.c +++ b/sound/soc/amd/acp/acp-pci.c @@ -104,6 +104,7 @@ static int acp_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id addr = pci_resource_start(pci, 0); chip->base = devm_ioremap(&pci->dev, addr, pci_resource_len(pci, 0)); if (!chip->base) { + platform_device_unregister(dmic_dev); ret = -ENOMEM; goto release_regions; } From patchwork Wed Oct 19 08:27: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: 4936 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp226230wrs; Wed, 19 Oct 2022 02:45:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6hccaIxN6cNcU4NiEoQaOeIIsoG/Be/AShvquBlJaMEBCeeRJMmCunaDVkzTm42QkGDBgS X-Received: by 2002:a63:1b0f:0:b0:46b:910:6cd9 with SMTP id b15-20020a631b0f000000b0046b09106cd9mr6530566pgb.5.1666172720104; Wed, 19 Oct 2022 02:45:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172720; cv=none; d=google.com; s=arc-20160816; b=FBoTPg9aG4ZL5a4+zCnoVap7nvYBZtPgS34eDQsdbFd7C55BSOmiThgKrpvS0RJxcV O6KzmY4slQ1zYEJSus2fKDKJgYWWHFVBV2N18yrHFTXPQzKQ49Wxq4+dLbIwqZg5r4X4 3rlw/UAEXQThXZyx4GpJijnvthfEddjy7zFzp5urzegr/vpHBDl2MlrwGySO1tsGFwbX qr/WivWQP1wEHQorUrb8NJ2bd/iKflgBlMAFJp2aTfpsIEE1Lyub3pkLhm03cK5h/gA4 7sJ9c1fbpKTH/TcjIVE+erpjn9kSnCCieBtAf6K56noxPbm2MdpoZTeCr8FV4+wsGtbj I/wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uPKyzp3V7lhuBlEom0D9E5tGQkhFPbAUin6spJiSmeE=; b=Fhx4EnhSn7GqozToFq7cSxgEhvVu2Md9VFt4CdGgovNVnVQO/v5nsEo0BtBDapCZla MHAIXzt784/HXohTbykcnc5RpUkknPm9sbkf4wc0gCZeu8SChUdqipXnO6mLw7lSjh6b h80kJegTsxmHUJ9Vjah33KjnGogyOIEwMfPJwVEJ+KXjKMc6kjuiZh32TVJE7cLvjl4/ ySRhoTdLRftAOx95mF3aiuYs+kMwkkf6AwO65EeWgVQwuk8wTfMPEMzi+obe2mpSyNT5 L/zYcL2KwJ1ttgutR/cpTgMuAs8Ypdp9YNyXHRPnRT42EEBLOLstOsaX/fsWfGdQxNmk BQ4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lGF9bhPM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i13-20020a170902c94d00b0017bcea4e6b6si19016862pla.234.2022.10.19.02.45.04; Wed, 19 Oct 2022 02:45:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lGF9bhPM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233828AbiJSJft (ORCPT + 99 others); Wed, 19 Oct 2022 05:35:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233873AbiJSJ3n (ORCPT ); Wed, 19 Oct 2022 05:29: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 F1626EC516; Wed, 19 Oct 2022 02:13: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 34BB6617F4; Wed, 19 Oct 2022 08:54:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 460C3C433D6; Wed, 19 Oct 2022 08:54:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169666; bh=/B1Iirm5bGrNxncT1YO4thdkO5rTvekK2dvqh+QA7EI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lGF9bhPMOs3bp0W7kGwn/XEuiCFI6HFLgs4jwbI7HKIuPGRNbQtNjIE10nBRxgAws PW/yaLorV7YvuLEBLuf9Hj/K/IG/UjYBB2V2xyPAHV/hrh4sfuvPP6oUDJJp1A0t2T uf3AXqih3t8uL6Oe5ey0R+LXU+hqDBrEmAQ8kIOg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Javier Martinez Canillas , Abhinav Kumar , Sasha Levin Subject: [PATCH 6.0 362/862] drm/msm: Make .remove and .shutdown HW shutdown consistent Date: Wed, 19 Oct 2022 10:27:29 +0200 Message-Id: <20221019083305.993454192@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108725855253720?= X-GMAIL-MSGID: =?utf-8?q?1747108725855253720?= From: Javier Martinez Canillas [ Upstream commit 0a58d2ae572adaec8d046f8d35b40c2c32ac7468 ] Drivers' .remove and .shutdown callbacks are executed on different code paths. The former is called when a device is removed from the bus, while the latter is called at system shutdown time to quiesce the device. This means that some overlap exists between the two, because both have to take care of properly shutting down the hardware. But currently the logic used in these two callbacks isn't consistent in msm drivers, which could lead to kernel panic. For example, on .remove the component is deleted and its .unbind callback leads to the hardware being shutdown but only if the DRM device has been marked as registered. That check doesn't exist in the .shutdown logic and this can lead to the driver calling drm_atomic_helper_shutdown() for a DRM device that hasn't been properly initialized. A situation like this can happen if drivers for expected sub-devices fail to probe, since the .bind callback will never be executed. If that is the case, drm_atomic_helper_shutdown() will attempt to take mutexes that are only initialized if drm_mode_config_init() is called during a device bind. This bug was attempted to be fixed in commit 623f279c7781 ("drm/msm: fix shutdown hook in case GPU components failed to bind"), but unfortunately it still happens in some cases as the one mentioned above, i.e: systemd-shutdown[1]: Powering off. kvm: exiting hardware virtualization platform wifi-firmware.0: Removing from iommu group 12 platform video-firmware.0: Removing from iommu group 10 ------------[ cut here ]------------ WARNING: CPU: 6 PID: 1 at drivers/gpu/drm/drm_modeset_lock.c:317 drm_modeset_lock_all_ctx+0x3c4/0x3d0 ... Hardware name: Google CoachZ (rev3+) (DT) pstate: a0400009 (NzCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : drm_modeset_lock_all_ctx+0x3c4/0x3d0 lr : drm_modeset_lock_all_ctx+0x48/0x3d0 sp : ffff80000805bb80 x29: ffff80000805bb80 x28: ffff327c00128000 x27: 0000000000000000 x26: 0000000000000000 x25: 0000000000000001 x24: ffffc95d820ec030 x23: ffff327c00bbd090 x22: ffffc95d8215eca0 x21: ffff327c039c5800 x20: ffff327c039c5988 x19: ffff80000805bbe8 x18: 0000000000000034 x17: 000000040044ffff x16: ffffc95d80cac920 x15: 0000000000000000 x14: 0000000000000315 x13: 0000000000000315 x12: 0000000000000000 x11: 0000000000000000 x10: 0000000000000000 x9 : 0000000000000000 x8 : ffff80000805bc28 x7 : 0000000000000000 x6 : 0000000000000000 x5 : 0000000000000000 x4 : 0000000000000000 x3 : 0000000000000000 x2 : ffff327c00128000 x1 : 0000000000000000 x0 : ffff327c039c59b0 Call trace: drm_modeset_lock_all_ctx+0x3c4/0x3d0 drm_atomic_helper_shutdown+0x70/0x134 msm_drv_shutdown+0x30/0x40 platform_shutdown+0x28/0x40 device_shutdown+0x148/0x350 kernel_power_off+0x38/0x80 __do_sys_reboot+0x288/0x2c0 __arm64_sys_reboot+0x28/0x34 invoke_syscall+0x48/0x114 el0_svc_common.constprop.0+0x44/0xec do_el0_svc+0x2c/0xc0 el0_svc+0x2c/0x84 el0t_64_sync_handler+0x11c/0x150 el0t_64_sync+0x18c/0x190 ---[ end trace 0000000000000000 ]--- Unable to handle kernel NULL pointer dereference at virtual address 0000000000000018 Mem abort info: ESR = 0x0000000096000004 EC = 0x25: DABT (current EL), IL = 32 bits SET = 0, FnV = 0 EA = 0, S1PTW = 0 FSC = 0x04: level 0 translation fault Data abort info: ISV = 0, ISS = 0x00000004 CM = 0, WnR = 0 user pgtable: 4k pages, 48-bit VAs, pgdp=000000010eab1000 [0000000000000018] pgd=0000000000000000, p4d=0000000000000000 Internal error: Oops: 96000004 [#1] PREEMPT SMP ... Hardware name: Google CoachZ (rev3+) (DT) pstate: a0400009 (NzCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : ww_mutex_lock+0x28/0x32c lr : drm_modeset_lock_all_ctx+0x1b0/0x3d0 sp : ffff80000805bb50 x29: ffff80000805bb50 x28: ffff327c00128000 x27: 0000000000000000 x26: 0000000000000000 x25: 0000000000000001 x24: 0000000000000018 x23: ffff80000805bc10 x22: ffff327c039c5ad8 x21: ffff327c039c5800 x20: ffff80000805bbe8 x19: 0000000000000018 x18: 0000000000000034 x17: 000000040044ffff x16: ffffc95d80cac920 x15: 0000000000000000 x14: 0000000000000315 x13: 0000000000000315 x12: 0000000000000000 x11: 0000000000000000 x10: 0000000000000000 x9 : 0000000000000000 x8 : ffff80000805bc28 x7 : 0000000000000000 x6 : 0000000000000000 x5 : 0000000000000000 x4 : 0000000000000000 x3 : 0000000000000000 x2 : ffff327c00128000 x1 : 0000000000000000 x0 : 0000000000000018 Call trace: ww_mutex_lock+0x28/0x32c drm_modeset_lock_all_ctx+0x1b0/0x3d0 drm_atomic_helper_shutdown+0x70/0x134 msm_drv_shutdown+0x30/0x40 platform_shutdown+0x28/0x40 device_shutdown+0x148/0x350 kernel_power_off+0x38/0x80 __do_sys_reboot+0x288/0x2c0 __arm64_sys_reboot+0x28/0x34 invoke_syscall+0x48/0x114 el0_svc_common.constprop.0+0x44/0xec do_el0_svc+0x2c/0xc0 el0_svc+0x2c/0x84 el0t_64_sync_handler+0x11c/0x150 el0t_64_sync+0x18c/0x190 Code: aa0103f4 d503201f d2800001 aa0103e3 (c8e37c02) ---[ end trace 0000000000000000 ]--- Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b Kernel Offset: 0x495d77c00000 from 0xffff800008000000 PHYS_OFFSET: 0xffffcd8500000000 CPU features: 0x800,00c2a015,19801c82 Memory Limit: none ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b ]--- Fixes: 9d5cbf5fe46e ("drm/msm: add shutdown support for display platform_driver") Signed-off-by: Javier Martinez Canillas Reviewed-by: Abhinav Kumar Link: https://patchwork.freedesktop.org/patch/msgid/20220816134612.916527-1-javierm@redhat.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/msm/msm_drv.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 16884db272de..0759e2d99f59 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -1244,10 +1244,15 @@ void msm_drv_shutdown(struct platform_device *pdev) struct msm_drm_private *priv = platform_get_drvdata(pdev); struct drm_device *drm = priv ? priv->dev : NULL; - if (!priv || !priv->kms) - return; - - drm_atomic_helper_shutdown(drm); + /* + * Shutdown the hw if we're far enough along where things might be on. + * If we run this too early, we'll end up panicking in any variety of + * places. Since we don't register the drm device until late in + * msm_drm_init, drm_dev->registered is used as an indicator that the + * shutdown will be successful. + */ + if (drm && drm->registered) + drm_atomic_helper_shutdown(drm); } static struct platform_driver msm_platform_driver = { From patchwork Wed Oct 19 08:27: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: 5067 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp248604wrs; Wed, 19 Oct 2022 03:44:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM459xZvNJrSLD6SY3RPmfqTLWELkvrDyU8taDsahRwPdsh2ES4WdEODlEtByT8YE+7u5nAW X-Received: by 2002:a17:90b:380b:b0:20b:8dd:4f5f with SMTP id mq11-20020a17090b380b00b0020b08dd4f5fmr45362316pjb.158.1666176243545; Wed, 19 Oct 2022 03:44:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176243; cv=none; d=google.com; s=arc-20160816; b=Dw9rhtfikBFGyRx/WMQMQP9DhPDkR/qMOLMjCESUtc2BmoLIsJ9oYnfXNG/TROOVyK 8I5r94hS00yCtbHKqsSiJdYC7Jch2gQgpM/f1WQ5XcXsF9rFs0P4omFkfWc4hp1MQBhL hd8i1tynkth10Nxs7Rm+BRQY01JjzwcD44zSJCuKCU6DwNeWe0bHuBAjE0FE5pmJNLpr hPlpMxafgf8qlpwEEWPeu/mJhDc5J5T+UeV1dUz0cl+DVfi70kmSZZM35kA7IgS/yMyy oWRV6j43emJZVyqAiN0MfnYBzzJpjsudN2E1+93Xl33NPmHfZm7pVBhwpLz5fo7HipTj rRiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yiJsqhWZ51lv6jSigGqrq4pl8vUIDOOi4yq4AybLCTw=; b=rTx9YQFTPQDDpCXQMPho8yQUGfd5EU//y1jFmfPtDHQPLjmdENw5Fnv5Ig9xy3KOM+ AV5PaoFNUYwoA8pGlLxivahWsf8aQn3+1QoLqUvmrsXk7m//SefqJuBNRKDFMLGX1/2Z N4AuJbXlXKa+0IgyZkQuzofU6W75DZ5GJvA6f6FfiM96Tcuz1rgARZhWFkPAAKTOanbK OnS4m7z+FC0Ut7e4T2yIMMsbEB5TJByRbif6vCx6qM2Kcl9OYsgPMYk747pBpxh8zRqb upesLQuADoHOZYv3zrwDuYq3mW6V+zYI4cCOMrKcuFxZ6ZKXeuvOGcXlkYPwrWqSNxqB 9t8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RYEFj3sb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z18-20020a170902ccd200b0016da027a727si18419465ple.116.2022.10.19.03.43.50; Wed, 19 Oct 2022 03:44: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=RYEFj3sb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232450AbiJSKnh (ORCPT + 99 others); Wed, 19 Oct 2022 06:43:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232523AbiJSKmq (ORCPT ); Wed, 19 Oct 2022 06:42:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3AF8AD73D2; Wed, 19 Oct 2022 03:20:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 64D9BB82398; Wed, 19 Oct 2022 08:54:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1C6AC433D6; Wed, 19 Oct 2022 08:54:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169669; bh=fpkRYoZRvDjIHv0uj2UG4gMaTQvdCazIzAKjiv1dqaU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RYEFj3sbc4dJ1rCOOjJ8rxyownWi2gDN5dqDTgZ4d8EnsaIYkglJuSvs8cPvW8OxK MlZEj7CUw98R4BeBBkUo82NHRRWmaOM9hkSt50zyJumGhvFw4gXtHr8E/m0Fibb3qR xJVwRlR8sUMUkUDCesm3pj/7CvcyQW9o3Hi5aYcM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rustam Subkhankulov , Dmitry Torokhov , Tzung-Bi Shih , Sasha Levin Subject: [PATCH 6.0 363/862] platform/chrome: fix double-free in chromeos_laptop_prepare() Date: Wed, 19 Oct 2022 10:27:30 +0200 Message-Id: <20221019083306.044452229@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112420686097589?= X-GMAIL-MSGID: =?utf-8?q?1747112420686097589?= From: Rustam Subkhankulov [ Upstream commit 6ad4194d6a1e1d11b285989cd648ef695b4a93c0 ] If chromeos_laptop_prepare_i2c_peripherals() fails after allocating memory for 'cros_laptop->i2c_peripherals', this memory is freed at 'err_out' label and nonzero value is returned. Then chromeos_laptop_destroy() is called, resulting in double-free error. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Rustam Subkhankulov Fixes: 5020cd29d8bf ("platform/chrome: chromeos_laptop - supply properties for ACPI devices") Reviewed-by: Dmitry Torokhov Signed-off-by: Tzung-Bi Shih Link: https://lore.kernel.org/r/20220813220843.2373004-1-subkhankulov@ispras.ru Signed-off-by: Sasha Levin --- drivers/platform/chrome/chromeos_laptop.c | 24 ++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/drivers/platform/chrome/chromeos_laptop.c b/drivers/platform/chrome/chromeos_laptop.c index 4e14b4d6635d..a2cdbfbaeae6 100644 --- a/drivers/platform/chrome/chromeos_laptop.c +++ b/drivers/platform/chrome/chromeos_laptop.c @@ -740,6 +740,7 @@ static int __init chromeos_laptop_prepare_i2c_peripherals(struct chromeos_laptop *cros_laptop, const struct chromeos_laptop *src) { + struct i2c_peripheral *i2c_peripherals; struct i2c_peripheral *i2c_dev; struct i2c_board_info *info; int i; @@ -748,17 +749,15 @@ chromeos_laptop_prepare_i2c_peripherals(struct chromeos_laptop *cros_laptop, if (!src->num_i2c_peripherals) return 0; - cros_laptop->i2c_peripherals = kmemdup(src->i2c_peripherals, - src->num_i2c_peripherals * - sizeof(*src->i2c_peripherals), - GFP_KERNEL); - if (!cros_laptop->i2c_peripherals) + i2c_peripherals = kmemdup(src->i2c_peripherals, + src->num_i2c_peripherals * + sizeof(*src->i2c_peripherals), + GFP_KERNEL); + if (!i2c_peripherals) return -ENOMEM; - cros_laptop->num_i2c_peripherals = src->num_i2c_peripherals; - - for (i = 0; i < cros_laptop->num_i2c_peripherals; i++) { - i2c_dev = &cros_laptop->i2c_peripherals[i]; + for (i = 0; i < src->num_i2c_peripherals; i++) { + i2c_dev = &i2c_peripherals[i]; info = &i2c_dev->board_info; error = chromeos_laptop_setup_irq(i2c_dev); @@ -775,16 +774,19 @@ chromeos_laptop_prepare_i2c_peripherals(struct chromeos_laptop *cros_laptop, } } + cros_laptop->i2c_peripherals = i2c_peripherals; + cros_laptop->num_i2c_peripherals = src->num_i2c_peripherals; + return 0; err_out: while (--i >= 0) { - i2c_dev = &cros_laptop->i2c_peripherals[i]; + i2c_dev = &i2c_peripherals[i]; info = &i2c_dev->board_info; if (!IS_ERR_OR_NULL(info->fwnode)) fwnode_remove_software_node(info->fwnode); } - kfree(cros_laptop->i2c_peripherals); + kfree(i2c_peripherals); return error; } From patchwork Wed Oct 19 08:27: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: 4685 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212991wrs; Wed, 19 Oct 2022 02:08:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM70nrfAe5zOCzDMH0aONJyA9t8/QPQUKvGClEZFswslbFETcJDH+KQ7l7ZPYelxlu266NoJ X-Received: by 2002:a05:6402:448:b0:45c:8de5:4fc with SMTP id p8-20020a056402044800b0045c8de504fcmr6431808edw.133.1666170531921; Wed, 19 Oct 2022 02:08:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170531; cv=none; d=google.com; s=arc-20160816; b=pdzuKNGd0B2Cgb+Gw6+avRvR5sfEJPCTPkZUFh7041nWeB7oM4zbihlED9o6+Gtjuv dcLsiTX7Ty+c0YEEQwOGIVmw5DWftqBI3qnaiSkfrNZ7rtN2oeraJQh7IuK6/XbTFtLx sw7qS5Blv6eNC4k1F/358gz0gUhC2m9T5rwAvGEaARve9BwQxBq0tz+AvPG1RVwSKUG6 y7B8iD7B/vbzqnmvLmqUvm2ZvvZ/oooitpO39etbbPVKygNs2pumOtPeQ/0qObyP8dtA JzTuo52gq3SbMIgszOrirgJfZoRnvbvUEHpzHsCIGwtlgljm40X9Qwra9ljlDzQMV4GL Hnnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vvI3+VWA+2mcXN4KXlGusSzPv4NyoHHcIk3s6pIfUvg=; b=pSBBrXRY9Z4cgnIlH7/TzH/L3nTUpril3EL78nqF+x7NTn0ACR5p84c1QVOo7wVJu0 uP7AGiw1/yaG0ROHpPPFWKDA4tP8VSrjAfsKYvpNRiZOMDqfewzo0eRWLRQ7SW6N1sAx p4XJaAYaNqzYC4wJyGXW0OjcB4nI+r6T+NXbTe9c3uvt7RYc2V2I4pzxMQuQrDgF+cip CTai2C1W4gQeR1tQJbHSk9K5Q9wOawP2Hq075C765e2U3WejtXe3a0rwX/McJp/UBDwJ YwvtpQqk3RrzrzO0t18LpipwJCCeP1bnSFCmjxvrLElqT297eUWh+RN/al5UZGCNyI2k jUbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="xdb6PY/A"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v8-20020a50c408000000b0045744c3c3d8si12682511edf.515.2022.10.19.02.08.18; Wed, 19 Oct 2022 02:08: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="xdb6PY/A"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232115AbiJSJDl (ORCPT + 99 others); Wed, 19 Oct 2022 05:03:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229808AbiJSJC2 (ORCPT ); Wed, 19 Oct 2022 05:02:28 -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 60A7D95E72; Wed, 19 Oct 2022 01:55:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 531E2617D1; Wed, 19 Oct 2022 08:54:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5DC7AC433C1; Wed, 19 Oct 2022 08:54:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169671; bh=FGLUiA+nI5EoWurmpv9dwxt2Cwd9+rHSJ5m5kYCZDGs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xdb6PY/AkXp2s+ImeWD4wPj4V82RIOeHNvdEhMZBqVBeUVjL26j7u/cqZ5QyBKaPQ yX28o8T6QhxfU0byffuXGRo+wvsGtBsXDqmCOCJvelCSCXR/6i1kfnJoIHLtJSQfvg v9APonAEMdacZU/7xiTu+Uz2Ld+k5Sv0f/nj8K/g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Guenter Roeck , Tzung-Bi Shih , Sasha Levin Subject: [PATCH 6.0 364/862] platform/chrome: fix memory corruption in ioctl Date: Wed, 19 Oct 2022 10:27:31 +0200 Message-Id: <20221019083306.085879814@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106432019431519?= X-GMAIL-MSGID: =?utf-8?q?1747106432019431519?= From: Dan Carpenter [ Upstream commit 8a07b45fd3c2dda24fad43639be5335a4595196a ] If "s_mem.bytes" is larger than the buffer size it leads to memory corruption. Fixes: eda2e30c6684 ("mfd / platform: cros_ec: Miscellaneous character device to talk with the EC") Signed-off-by: Dan Carpenter Reviewed-by: Guenter Roeck Signed-off-by: Tzung-Bi Shih Link: https://lore.kernel.org/r/Yv8dpCFZJdbUT5ye@kili Signed-off-by: Sasha Levin --- drivers/platform/chrome/cros_ec_chardev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/platform/chrome/cros_ec_chardev.c b/drivers/platform/chrome/cros_ec_chardev.c index fd33de546aee..0de7c255254e 100644 --- a/drivers/platform/chrome/cros_ec_chardev.c +++ b/drivers/platform/chrome/cros_ec_chardev.c @@ -327,6 +327,9 @@ static long cros_ec_chardev_ioctl_readmem(struct cros_ec_dev *ec, if (copy_from_user(&s_mem, arg, sizeof(s_mem))) return -EFAULT; + if (s_mem.bytes > sizeof(s_mem.buffer)) + return -EINVAL; + num = ec_dev->cmd_readmem(ec_dev, s_mem.offset, s_mem.bytes, s_mem.buffer); if (num <= 0) From patchwork Wed Oct 19 08:27: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: 5282 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp280796wrs; Wed, 19 Oct 2022 05:01:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4ccYekfzFMDzJoHuDp3u4SRavQnfsWNvXZXKx7sz6feXJOntZbkPSjsHeboOpzql+HfZKQ X-Received: by 2002:a05:6402:350d:b0:45c:f5a2:348e with SMTP id b13-20020a056402350d00b0045cf5a2348emr7070765edd.398.1666180875271; Wed, 19 Oct 2022 05:01:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666180875; cv=none; d=google.com; s=arc-20160816; b=LWUwoL3Lkrzl316qce2mxPSGFIa4xaPmBXYWzs7qiCIEXU6fOracilaC3N13OihwZ2 sSNG9cbFQKgyEUUaSwfJ8hyHcYrb1S8428qecNnjCr6oeQXgDHFiyx+hRtSkypVpcohL FsDc1QmibHqX1gbXozQbY+dRkp/0zIpZ0T7sLShtVSiM+V2H8HOiDi4WclhOh86hJmuZ fY1l1UDtkprwkMjJaM1w2M2B3uvz9YUo4F+EUuqFxz31z0RaGQ2j09n2L8AH1ivcle6L tKzZr4b27juo9TtvCkPO8IjvL20J2QYMyGHA3TdvMesB47RYRNPbRN0kmofEpiNjw6kj 0B3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Aqeuz2+CUSL3W3sZmPnfs+Xb4P0Q8hvAVOd+ZcVRN2s=; b=wnidADs18Vj/kWJvNbR7zWaIS2LGi1ZHADsCZi8dOHScysiDCgmV6XBxLNpCSGnrwy U3xPOSTUlzL3RWYkRdPZ7jSPTtZ4/wCEEbaZDGcA0X5VnX0O0CDy4+kGQgazCd9TxWzm 8Tg7+jejzwU0zfe+nIs0Uf67HvHbmWZ2WsG7OqWaarfYel24x2rbsGdwd/WfkgeC98D/ if1sldYD/f9g9O+saLwVzS9UN6cmRzTuQBxu4aLoXkoKzl+bpq8qsKjWJ46EVQkM9ljo l5JFmM27DozylIVE0vlOYMYhoNbxOcS55h2SZfYNGpJhWXXCu0CASL3sr0B6Lk8QluQ/ DReQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JLjD4X9X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f19-20020a50ee93000000b0045a22920708si12236163edr.190.2022.10.19.05.00.48; Wed, 19 Oct 2022 05:01: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=JLjD4X9X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230125AbiJSLzE (ORCPT + 99 others); Wed, 19 Oct 2022 07:55:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231926AbiJSLyi (ORCPT ); Wed, 19 Oct 2022 07:54:38 -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 D99461ACA9C; Wed, 19 Oct 2022 04:33:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 82F1CB823C7; Wed, 19 Oct 2022 08:54:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02AFCC433C1; Wed, 19 Oct 2022 08:54:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169674; bh=5e45WF3i7O41wGeR2QW8m9+kfKMJUdRm0h/2qvoug8g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JLjD4X9Xb3L/iM/dfhhxw8rAi+C4hCPW+H82f0BC8gIh6rzceqNE4rN2+U6/1MAtf 6wGvr2ZaJGoX0E8CejNbd55z+1e7zh9NBBSLa8NuF32sXaONWmPQXm9YGWYCBHv9Rr qJu0MkYyRWKGFNja/nqEszQFBMsmQFvYMt9Y+SJc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stanislav Lisovskiy , Uma Shankar , Sasha Levin Subject: [PATCH 6.0 365/862] drm/i915/dg2: Bump up CDCLK for DG2 Date: Wed, 19 Oct 2022 10:27:32 +0200 Message-Id: <20221019083306.134079514@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747117277167517971?= X-GMAIL-MSGID: =?utf-8?q?1747117277167517971?= From: Stanislav Lisovskiy [ Upstream commit 859161b952a453b86362f168fadef72a8ba31a05 ] We seem to need this W/A same way as for TGL, in order to fix some of the underruns, which we currently have and those not related to PSR. Signed-off-by: Stanislav Lisovskiy Reviewed-by: Uma Shankar Link: https://patchwork.freedesktop.org/patch/msgid/20220614123049.16183-2-stanislav.lisovskiy@intel.com Stable-dep-of: 4234ea300512 ("drm/i915/display: avoid warnings when registering dual panel backlight") Signed-off-by: Sasha Levin --- drivers/gpu/drm/i915/display/intel_cdclk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_cdclk.c b/drivers/gpu/drm/i915/display/intel_cdclk.c index 6e80162632dd..86a22c3766e5 100644 --- a/drivers/gpu/drm/i915/display/intel_cdclk.c +++ b/drivers/gpu/drm/i915/display/intel_cdclk.c @@ -2300,7 +2300,7 @@ int intel_crtc_compute_min_cdclk(const struct intel_crtc_state *crtc_state) min_cdclk = max(min_cdclk, (int)crtc_state->pixel_rate); /* - * HACK. Currently for TGL platforms we calculate + * HACK. Currently for TGL/DG2 platforms we calculate * min_cdclk initially based on pixel_rate divided * by 2, accounting for also plane requirements, * however in some cases the lowest possible CDCLK @@ -2308,7 +2308,7 @@ int intel_crtc_compute_min_cdclk(const struct intel_crtc_state *crtc_state) * Explicitly stating here that this seems to be currently * rather a Hack, than final solution. */ - if (IS_TIGERLAKE(dev_priv)) { + if (IS_TIGERLAKE(dev_priv) || IS_DG2(dev_priv)) { /* * Clamp to max_cdclk_freq in case pixel rate is higher, * in order not to break an 8K, but still leave W/A at place. From patchwork Wed Oct 19 08:27: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: 4787 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp215957wrs; Wed, 19 Oct 2022 02:17:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7T2QuuN2ACf+zSzrKME80y+IPg9RLge/E30kkwdwTaeNZbhcevQg0SWUAv/dtswVqA8n2t X-Received: by 2002:a17:907:868c:b0:78d:f741:7fa7 with SMTP id qa12-20020a170907868c00b0078df7417fa7mr5892692ejc.648.1666171029481; Wed, 19 Oct 2022 02:17:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666171029; cv=none; d=google.com; s=arc-20160816; b=goXRzTVBG+vB+WjIM7wMQMiMkLu+0zDRiXoeIYdtu+/ewbq78Lo2xJ+hwlsF0x22HF 1UeM9KErisovkzaXuaPcghxYrWrTjD6dlGH1iUXxe8VdhHiT1hXsFeK8eD+vsw8WSk+d 6l55ObK6BEHM4U4L2zMt+E89N0Q0jLgpF1x5fY120gSkKCc9IPeOROrVFdbRyuTGzCT9 JCa4TLUTublmX34AJq8W7XUqzHDAVWGw5JnBO57m95z1uYRUGo7jp8G1p0jpK0be/IOe h3SUvUPlRxfqFzbGYbrkj1FDM1O4IwqaSo+QMQ2MscgP+FbTC6G0jijGwJdRTqy7I1fK xAdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jjgKJHG4vB4Rm3ZerTgQFCggJRja6GbNL/KGS0rRpyU=; b=ugulrRUODgOhRoRwV6LJdk62PA//oWBVNaPxtg87Z8+GCp32CH9bFmK+5/gyoXZsH5 coFw2QQ/W7Yo7keoTLLDdOFa5+jcVgGoziCTAagRUj3dW9xIggDm9RMqUOnG2CuD4pfV sdrGf5Sv/1pZseQkM0MgnLFQF43AH0IldyxdsTU/TKn/ogey+2WRG0GCjEkwXZXIC+B2 MVF4foqgpnCLk+MJsN+GIzaxL0uw0vYHWjZylFUwEwNPB02xBjZEagvYexhxjeZa88T9 6FbHOFE5M65+iUVZQPGBZ4Cy4nUItO6xIV6ZKzbo0Wz4nm4mn0blOBI7VQcIzV220JEk zDEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lunRCWzL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f10-20020a0564021e8a00b0045d29efdb5esi14519846edf.381.2022.10.19.02.16.44; Wed, 19 Oct 2022 02:17: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=lunRCWzL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233085AbiJSJQD (ORCPT + 99 others); Wed, 19 Oct 2022 05:16:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232707AbiJSJNC (ORCPT ); Wed, 19 Oct 2022 05:13:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 503A4CA8A5; Wed, 19 Oct 2022 02:03:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7D3AE617F1; Wed, 19 Oct 2022 08:54:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95FC2C433C1; Wed, 19 Oct 2022 08:54:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169676; bh=a9QnuAj57d0g4YM0AcqhAV4WtYyzOmeBc0b2HC4WlRs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lunRCWzLYVB2vT0runN1HkG0XOkFa7cLhfkdN3VT7ZkNrNjPEecNhuWMEcdjXcHwt eweu3aPiYJBrrJ3lbnaubLu+iGth2Z3WN+gchiOfLpfsz1R377lj1HUhd45h4BzXBt xK3eeaJzHDluXM2v1DJtd/WPllGdmZIKTzxWjXFc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rob Clark , Gerd Hoffmann , Sasha Levin Subject: [PATCH 6.0 366/862] drm/virtio: Fix same-context optimization Date: Wed, 19 Oct 2022 10:27:33 +0200 Message-Id: <20221019083306.183088706@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106953388418080?= X-GMAIL-MSGID: =?utf-8?q?1747106953388418080?= From: Rob Clark [ Upstream commit 3007dc2af6e86ac00b4daf7414142637fdf50bfa ] When VIRTGPU_EXECBUF_RING_IDX is used, we should be considering the timeline that the EB if running on rather than the global driver fence context. Fixes: 85c83ea915ed ("drm/virtio: implement context init: allocate an array of fence contexts") Signed-off-by: Rob Clark Link: http://patchwork.freedesktop.org/patch/msgid/20220812224001.2806463-1-robdclark@gmail.com Signed-off-by: Gerd Hoffmann Signed-off-by: Sasha Levin --- drivers/gpu/drm/virtio/virtgpu_ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c index 9b2702116f93..3b1701607aae 100644 --- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c +++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c @@ -168,7 +168,7 @@ static int virtio_gpu_execbuffer_ioctl(struct drm_device *dev, void *data, * array contains any fence from a foreign context. */ ret = 0; - if (!dma_fence_match_context(in_fence, vgdev->fence_drv.context)) + if (!dma_fence_match_context(in_fence, fence_ctx + ring_idx)) ret = dma_fence_wait(in_fence, true); dma_fence_put(in_fence); From patchwork Wed Oct 19 08:27: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: 5450 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp329088wrs; Wed, 19 Oct 2022 06:32:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6DmxQcPWaAkOIxHt7OS72SeqDbA+gpeIyF9JpxLVQ2gYO6xxnqmGo9/d8CJdNLPbGHv49Q X-Received: by 2002:a63:a548:0:b0:462:9d00:1835 with SMTP id r8-20020a63a548000000b004629d001835mr7167636pgu.442.1666186329440; Wed, 19 Oct 2022 06:32:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666186329; cv=none; d=google.com; s=arc-20160816; b=goMkDVDg/htCEU76ISgU+K9Tr2Q61CgX3dVlAhaRe1e6zAzSxqFwcsLsR7lBtgyhCg dpF3w4Atv6KWqj3tcUuvb1ybSAlsACF9fJxj7RLpGWuD1TKHdjqHc5VIQ1aj6aFr+X3D Xck/4uGD/UsKS0fUdiXjJnq+smjgRi2lEeUSPU0RqBnRiMntAT/8HS2K7btFzmim0nU2 KvUnc7vK762rT4Mln/nEsGysOQLNylayYvQgs0NkhsU2P2PQq2O8a+ik70QaXvy6Ci0v z+yib4iPoTfhxbH0b9SLU43FhcFtEb/rmDDWOR88NiaiNt8LGd3c4SrVc0scLt2O1vYr aOWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0KlOagNHArhGUifN6pvssoV9t+D4TWkPDyuuHBpUNKI=; b=mNFAdwWgXJJ0z09cinvkGOSI8nc1nMhVW45DQZkI2uw/tAr0MktATPShxBYlcowoNz BJh1flo9sABNzKzCmWppGEOAiBFBw3Wj78vQ6FfdhsUiER96qw+cfC/abN7aJchIxpUY +3AO+3/W6QKmqq69RoExNAbA3CGzm5sBTYhhaUEdH+HFiqd/66ptaP1RJJljJJBFzbKU dWgwE3BWJZnmlDDToscMmBFz+EpkmA1eG/inDDXk8Cv/LaykSWEG53TsTQgK4HIEaLHO X3srgH3u8GXHXKXP4yb1FZhkAQ+Agrk7Hu35xjPkzs1ZzXh5P8TYMkCR0iTaAhgHHYUv pB6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QTLWOc7W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w6-20020a170902d3c600b0017f908814c6si16932286plb.532.2022.10.19.06.31.53; Wed, 19 Oct 2022 06:32: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=QTLWOc7W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231614AbiJSNSa (ORCPT + 99 others); Wed, 19 Oct 2022 09:18:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230433AbiJSNSF (ORCPT ); Wed, 19 Oct 2022 09:18:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 706FA44CF6; Wed, 19 Oct 2022 06:03: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 40FBC617EE; Wed, 19 Oct 2022 08:54:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53078C433C1; Wed, 19 Oct 2022 08:54:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169679; bh=bjghNFUN8jBz1a4YSmN/FBTEzv7bkSZjtgRMXepanqI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QTLWOc7WyoqaDCI9HX0UQbzUyRzCAZMlCo52X2TFpmK8sFDk5yqeCu3q+YTtdr7JI tPxPrcXOKKqP0TwAHaSxQUSpUyOojKBF4kq8x7YHdO8vgs+WtbXDk+JpNokFKUhEso IfHydGhyptGPVsF/toZVKUZi6BBpVphTQrKqbHpk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai , Kuninori Morimoto , Mark Brown , Sasha Levin Subject: [PATCH 6.0 367/862] ASoC: soc-pcm.c: call __soc_pcm_close() in soc_pcm_close() Date: Wed, 19 Oct 2022 10:27:34 +0200 Message-Id: <20221019083306.218104526@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747122996459145135?= X-GMAIL-MSGID: =?utf-8?q?1747122996459145135?= From: Kuninori Morimoto [ Upstream commit 6bbabd28805f36baf6d0f3eb082db032a638f612 ] commit b7898396f4bbe16 ("ASoC: soc-pcm: Fix and cleanup DPCM locking") added __soc_pcm_close() for non-lock version of soc_pcm_close(). But soc_pcm_close() is not using it. It is no problem, but confusable. static int __soc_pcm_close(...) { => return soc_pcm_clean(rtd, substream, 0); } static int soc_pcm_close(...) { ... snd_soc_dpcm_mutex_lock(rtd); => soc_pcm_clean(rtd, substream, 0); snd_soc_dpcm_mutex_unlock(rtd); return 0; } This patch use it. Fixes: b7898396f4bbe16 ("ASoC: soc-pcm: Fix and cleanup DPCM locking") Cc: Takashi Iwai Signed-off-by: Kuninori Morimoto Link: https://lore.kernel.org/r/87czctgg3w.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/soc-pcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 4f60c0a83311..4d9b91e7e14f 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -723,7 +723,7 @@ static int soc_pcm_close(struct snd_pcm_substream *substream) struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); snd_soc_dpcm_mutex_lock(rtd); - soc_pcm_clean(rtd, substream, 0); + __soc_pcm_close(rtd, substream); snd_soc_dpcm_mutex_unlock(rtd); return 0; } From patchwork Wed Oct 19 08:27:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4686 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp213000wrs; Wed, 19 Oct 2022 02:08:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6TDMJ4scnnAUBpPHyS2Nz23345exB0Pq/HFFYEczPSBCK1Q6df7sco53kZS6u1prcD5Ww8 X-Received: by 2002:a17:906:5daa:b0:78e:2bc7:f1a3 with SMTP id n10-20020a1709065daa00b0078e2bc7f1a3mr5656021ejv.256.1666170533012; Wed, 19 Oct 2022 02:08:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170533; cv=none; d=google.com; s=arc-20160816; b=N4zXR2FnZNty/HtBIsMczMaR+6G0PQhsICJXvVwGiLP4ag7M08ugi8lX9gBCk4fPJP uW3wIDVOK4/PpabfhbDwK02mE+098+f2v3etkX5s/HR6eQT6OrT5tvAr6LJN9Hka2LAf qAM97qiJp+D1VorYd2T2vUGBpiGWj0hBpj3JPiKOUbGf2CrRpT20eysCfRYoDnbc/1Qj LgXQ97FLqXzICGkX56leFvaYS23n1t/lhmTVmofTOAq+iMrYL15ciYS7FY/qWlVaC6w6 0R7RnzgeZiVHYYCC2OhNDYd8A9prQXRVNLFKWateT4rPJw0miyi4O2FOH2FWA8vfRkN+ 6Sbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pR2wzhcesZXPkDdBykmfFeWWi3IgJqDfk7QPUj452n4=; b=dWmW4fi8L6iw65o+cetccF14F3Pv051D3IvXUQ2eLw2XLSKYNNkmZC67Ar/n+3gRuL E0XmEJxGwtfr8UhyXLfFsYSJ0+0MfG7NPThrUQd6h+KWjAjBIYCn5eRMcGQ7bVtpuPPU u1OziJytB88Tqaq5ex4V2GMxRcKFJ5y3YJMIdg+sGg6qCrWI0IKH7dgTOXJV0jokc3Sa WXSAQF8/cMwhMR/Ym4B5hWHv7tGbvKYVk1SMW4e68WYtcRrdwJC78t+joiIuJ7FCF4Pz TvTC+TXkUJXxTYWv+XUwXHdw+JjkrkYyPd3IN9DmpSEXyR3cEu5tvoNuUFTNmUEjWqEr MGEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=u15ubYZA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u26-20020aa7d99a000000b0045be16903d0si12488492eds.310.2022.10.19.02.08.27; Wed, 19 Oct 2022 02:08: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=u15ubYZA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232083AbiJSJFM (ORCPT + 99 others); Wed, 19 Oct 2022 05:05:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232266AbiJSJDf (ORCPT ); Wed, 19 Oct 2022 05:03:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 861C498CB8; Wed, 19 Oct 2022 01:56: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 5C81961800; Wed, 19 Oct 2022 08:54:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75409C433C1; Wed, 19 Oct 2022 08:54:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169684; bh=YmcAU6rlaJOa5yQk68KkohmAuWA7PzhhSpF2Ftv3GYg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u15ubYZAzC3lWWsVA85Hur+wQcIS/dho1mD0CZtOTOULAnHpuzKMDZwGPqtnQDZuC QBg0I4epZN2wy6TUmSqAJVZN8IyFkwkWYe2lYiQ6dzrV1QNCEmSNRK/bQNM8ychF/C EFvXROILnPG/GIIr+n//Vc7/dWhSuG4r68dywuWM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Martin_Povi=C5=A1er?= , Mark Brown , Sasha Levin Subject: [PATCH 6.0 368/862] ASoC: tas2764: Allow mono streams Date: Wed, 19 Oct 2022 10:27:35 +0200 Message-Id: <20221019083306.258711059@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106433151566469?= X-GMAIL-MSGID: =?utf-8?q?1747106433151566469?= From: Martin Povišer [ Upstream commit 23204d928a27146d13e11c9383632775345ecca8 ] The part is a mono speaker amp, but it can do downmix and switch between left and right channel, so the right channel range is 1 to 2. (This mirrors commit bf54d97a835d ("ASoC: tas2770: Allow mono streams") which was a fix to the tas2770 driver.) Fixes: 827ed8a0fa50 ("ASoC: tas2764: Add the driver for the TAS2764") Signed-off-by: Martin Povišer Link: https://lore.kernel.org/r/20220825140241.53963-2-povik+lin@cutebit.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/tas2764.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/codecs/tas2764.c b/sound/soc/codecs/tas2764.c index 846d9d3ecc9d..0df5d975c3c9 100644 --- a/sound/soc/codecs/tas2764.c +++ b/sound/soc/codecs/tas2764.c @@ -485,7 +485,7 @@ static struct snd_soc_dai_driver tas2764_dai_driver[] = { .id = 0, .playback = { .stream_name = "ASI1 Playback", - .channels_min = 2, + .channels_min = 1, .channels_max = 2, .rates = TAS2764_RATES, .formats = TAS2764_FORMATS, From patchwork Wed Oct 19 08:27:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4693 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp213135wrs; Wed, 19 Oct 2022 02:09:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5AZvI4WWKEKoAAa//UsPR9kJhIIaRr2dVV4UhuiXXFtWqafLmZeFuOmDsFIfIv6tCx8umT X-Received: by 2002:a05:6402:27d4:b0:45d:a69e:336d with SMTP id c20-20020a05640227d400b0045da69e336dmr6414927ede.298.1666170556382; Wed, 19 Oct 2022 02:09:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170556; cv=none; d=google.com; s=arc-20160816; b=BUP0PiZ9iz8rHtGyQdj9JUdYiy/YJdMSkZ1BVASM8ZUCDwyqlPzakzC0LNgQjUkPWb iiyQNDsmBZU1gSJqZn+ZW6hvdBSsUccdu7JbVbyyGBBab+LHfRpUsT2lzKa2nDovFEbj igzTlq4yXhLplW694SaQIGWGXFqtK5kI8cp0wNzcKh92S7i/4Zl9KxNwF0eAsmgugSLv xzdIsBIJ+fEKbdDEhOWaFYz50TZTQjpjLu0bYpVN3QFBeHwW9TV6b7y+swCg4yjZQvMh DLFEz/goR4rbPB+WD7GYRV06AJkwsuz3xZ/2wIswTyiHRrUBCc91TMif+0LILkMxsSv7 ljcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vI7s0nz1rv9pCyu39gyAepTTh8gweX5Xtdwjqi4d3qE=; b=a67lgCnPDUzrasfZS1ClesdejMBqU7VsJqPGqo46YFNH8kigVusUJEY13aXR0lx9i+ mL8Pe4PhWb+mCE7lLCrv5Jpi6wCr+rN7WtkKHuyKSruheBIiZsW8misU+B94Gp7a/Q9b gI5rd1FKG7giQuaZhoYhJicdis/ZK6n+mWQsgl6MkV4WSEM3u8VIobtWrwjiJHjxxqJ9 e3m4xNOfgh328pSmfx2XRvthpK5uuY75HlVuvbPzAvbaNenvf6DgZMGsKORnKv5dphFY UvpLLL9092iO2dPvdF+jNLoy1YrbQ2iz+LiyqnI44Rxn8L/mCebIJ0UxGBdLSwBKinnK 9pyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OaKUUM4u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d38-20020a056402402600b0045cd5902d51si12583159eda.507.2022.10.19.02.08.50; Wed, 19 Oct 2022 02:09: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=OaKUUM4u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232329AbiJSJEA (ORCPT + 99 others); Wed, 19 Oct 2022 05:04:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232248AbiJSJDI (ORCPT ); Wed, 19 Oct 2022 05:03:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B150B9AFBF; Wed, 19 Oct 2022 01:56:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E2747617E4; Wed, 19 Oct 2022 08:54:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0674EC433C1; Wed, 19 Oct 2022 08:54:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169687; bh=v2I5NFwDE412EDVLm4i5ccHXwxZyXlAQVO65ne0oE10=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OaKUUM4uMPEOLqeFE0RX8giljA49usXm+QfZz19RecbbmHbd+KcmWhPzGVvjs+zsC Czvcb+Q7xfDqpT+vKhXDa2g1RUhnSR4cMdyPJPL46WPFWqrTBr5TsGSMgFLFCt0Lg7 ZRjRQSM74rC+RPAS+4yvObily5Vh28zO0z9OFiBc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Martin_Povi=C5=A1er?= , Mark Brown , Sasha Levin Subject: [PATCH 6.0 369/862] ASoC: tas2764: Drop conflicting set_bias_level power setting Date: Wed, 19 Oct 2022 10:27:36 +0200 Message-Id: <20221019083306.297168547@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106457302163178?= X-GMAIL-MSGID: =?utf-8?q?1747106457302163178?= From: Martin Povišer [ Upstream commit 09273f38832406db19a8907a934687cc10660a6b ] The driver is setting the PWR_CTRL field in both the set_bias_level callback and on DAPM events of the DAC widget (and also in the mute_stream method). Drop the set_bias_level callback altogether as the power setting it does is in conflict with the other code paths. (This mirrors commit c8a6ae3fe1c8 ("ASoC: tas2770: Drop conflicting set_bias_level power setting") which was a fix to the tas2770 driver.) Fixes: 827ed8a0fa50 ("ASoC: tas2764: Add the driver for the TAS2764") Signed-off-by: Martin Povišer Link: https://lore.kernel.org/r/20220825140241.53963-3-povik+lin@cutebit.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/tas2764.c | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/sound/soc/codecs/tas2764.c b/sound/soc/codecs/tas2764.c index 0df5d975c3c9..f4ac6edefdc0 100644 --- a/sound/soc/codecs/tas2764.c +++ b/sound/soc/codecs/tas2764.c @@ -50,38 +50,6 @@ static void tas2764_reset(struct tas2764_priv *tas2764) usleep_range(1000, 2000); } -static int tas2764_set_bias_level(struct snd_soc_component *component, - enum snd_soc_bias_level level) -{ - struct tas2764_priv *tas2764 = snd_soc_component_get_drvdata(component); - - switch (level) { - case SND_SOC_BIAS_ON: - snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, - TAS2764_PWR_CTRL_MASK, - TAS2764_PWR_CTRL_ACTIVE); - break; - case SND_SOC_BIAS_STANDBY: - case SND_SOC_BIAS_PREPARE: - snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, - TAS2764_PWR_CTRL_MASK, - TAS2764_PWR_CTRL_MUTE); - break; - case SND_SOC_BIAS_OFF: - snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, - TAS2764_PWR_CTRL_MASK, - TAS2764_PWR_CTRL_SHUTDOWN); - break; - - default: - dev_err(tas2764->dev, - "wrong power level setting %d\n", level); - return -EINVAL; - } - - return 0; -} - #ifdef CONFIG_PM static int tas2764_codec_suspend(struct snd_soc_component *component) { @@ -549,7 +517,6 @@ static const struct snd_soc_component_driver soc_component_driver_tas2764 = { .probe = tas2764_codec_probe, .suspend = tas2764_codec_suspend, .resume = tas2764_codec_resume, - .set_bias_level = tas2764_set_bias_level, .controls = tas2764_snd_controls, .num_controls = ARRAY_SIZE(tas2764_snd_controls), .dapm_widgets = tas2764_dapm_widgets, From patchwork Wed Oct 19 08:27:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5064 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp248434wrs; Wed, 19 Oct 2022 03:43:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5GW/Zc4XIZs719/JI44ETeLZr/nC8td6k1emsV6nBU8Bot77uYXgdWV6frYNJ+MRwSe44+ X-Received: by 2002:a17:902:f647:b0:183:cb8d:40a0 with SMTP id m7-20020a170902f64700b00183cb8d40a0mr7994329plg.18.1666176214750; Wed, 19 Oct 2022 03:43:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176214; cv=none; d=google.com; s=arc-20160816; b=f56IzsHN0iK5JzrCN7kZw0Sfr/9M0Ox2H4ZwubaR6eYu7Kq4D9Hea1W5n0+aQidS7K N4mDdmtQmZ0ogBZDWDsOuh4g+1xYLjxLpgeVlGFBhZ3L/rRAh7L7TswT383UxFgV/HR8 GN8gnJ7iYvEvspM9ytn5qM7vAJdRGXqitZeLUfRwmgNne7gy3nemd/3DizUijvo36sAP uFTD2eoLDFlyLmbQYzwfSEe58VLIWW8W0hyHk5khOlAxBZsguaSgzR2m67U7LfAkYg52 C5+HVuPc+00sNYBJ+65cr0PQPpesKvAMbiUNk9kpPIGZeZNGpWYkRGZkmT/3oJnhIW8J Kwgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xQWKoGOrslMLi0F+KMF8g0Vetn5FkqGasjN5nybwUGw=; b=OYfsqc9VaMiLSOMn7xCmMqcyylDQ51UiCSSdvSU4rqYV3uawI7cwswxsP3TOH+qvQI ELJE6VryomkV59x406k01d2e1ZdbFl7mYFCjNX2Zk/rZpXT/LdwrSaEk11fZwwiEEI2h /F+jNKYMyhF1LhBdnFGEUt8uDNfWRKnNBIS3OK5Ab3f/DHY9V++I0HPgndNlVdP/364e sRKnop8Ze88uYU5KIldqoAJZLZgnUWf4kiCJYWF7vM5uxJaHKK4HpgbSWBwgAVBnaiwW Aqj0THr6E13jenNngi7F7iDuqOJ6FF+nsE48e8a0KD12n//sl0DAo85Ot+sj0xESzKx0 38Sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cQI7QJX4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 136-20020a63028e000000b004622caf9ac6si17489661pgc.781.2022.10.19.03.43.21; Wed, 19 Oct 2022 03:43:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cQI7QJX4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232562AbiJSKmy (ORCPT + 99 others); Wed, 19 Oct 2022 06:42:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232468AbiJSKmG (ORCPT ); Wed, 19 Oct 2022 06:42:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9BF342E5C; Wed, 19 Oct 2022 03:19: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 1CDC7B823C4; Wed, 19 Oct 2022 08:54:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 90784C433D7; Wed, 19 Oct 2022 08:54:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169689; bh=GSsaZEpH+o4AgtHli0o4QpxeGnOsysQIiAu1Xp/nbjM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cQI7QJX4PttgWTDPZI9BZTOe+gKC2iGKcA/odCHAjt+yVgaEmWg0ZGnCb0NC+BWB1 O2w86PEDPJmZDSL+7vDJpEE+TWqxUzFl6PYpgcK7yUXzSdyVtR9NPdjZ0upenj0IyV qhnTkVY05JAJRwrN+HDh81IY9uni+3AVfbICWH5o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Martin_Povi=C5=A1er?= , Mark Brown , Sasha Levin Subject: [PATCH 6.0 370/862] ASoC: tas2764: Fix mute/unmute Date: Wed, 19 Oct 2022 10:27:37 +0200 Message-Id: <20221019083306.346284930@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112390834802201?= X-GMAIL-MSGID: =?utf-8?q?1747112390834802201?= From: Martin Povišer [ Upstream commit f5ad67f13623548e5aff847f89700c178aaf2a98 ] Because the PWR_CTRL field is modeled as the power state of the DAC widget, and at the same time it is used to implement mute/unmute, we need some additional book-keeping to have the right end result no matter the sequence of calls. Without this fix, one permanently mutes an ongoing stream by toggling the associated speaker pin control. (This mirrors commit 1e5907bcb3a3 ("ASoC: tas2770: Fix handling of mute/unmute") which was a fix to the tas2770 driver.) Fixes: 827ed8a0fa50 ("ASoC: tas2764: Add the driver for the TAS2764") Signed-off-by: Martin Povišer Link: https://lore.kernel.org/r/20220825140241.53963-4-povik+lin@cutebit.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/tas2764.c | 57 +++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 25 deletions(-) diff --git a/sound/soc/codecs/tas2764.c b/sound/soc/codecs/tas2764.c index f4ac6edefdc0..39902f77a2e0 100644 --- a/sound/soc/codecs/tas2764.c +++ b/sound/soc/codecs/tas2764.c @@ -34,6 +34,9 @@ struct tas2764_priv { int v_sense_slot; int i_sense_slot; + + bool dac_powered; + bool unmuted; }; static void tas2764_reset(struct tas2764_priv *tas2764) @@ -50,6 +53,26 @@ static void tas2764_reset(struct tas2764_priv *tas2764) usleep_range(1000, 2000); } +static int tas2764_update_pwr_ctrl(struct tas2764_priv *tas2764) +{ + struct snd_soc_component *component = tas2764->component; + unsigned int val; + int ret; + + if (tas2764->dac_powered) + val = tas2764->unmuted ? + TAS2764_PWR_CTRL_ACTIVE : TAS2764_PWR_CTRL_MUTE; + else + val = TAS2764_PWR_CTRL_SHUTDOWN; + + ret = snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, + TAS2764_PWR_CTRL_MASK, val); + if (ret < 0) + return ret; + + return 0; +} + #ifdef CONFIG_PM static int tas2764_codec_suspend(struct snd_soc_component *component) { @@ -82,9 +105,7 @@ static int tas2764_codec_resume(struct snd_soc_component *component) usleep_range(1000, 2000); } - ret = snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, - TAS2764_PWR_CTRL_MASK, - TAS2764_PWR_CTRL_ACTIVE); + ret = tas2764_update_pwr_ctrl(tas2764); if (ret < 0) return ret; @@ -118,14 +139,12 @@ static int tas2764_dac_event(struct snd_soc_dapm_widget *w, switch (event) { case SND_SOC_DAPM_POST_PMU: - ret = snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, - TAS2764_PWR_CTRL_MASK, - TAS2764_PWR_CTRL_MUTE); + tas2764->dac_powered = true; + ret = tas2764_update_pwr_ctrl(tas2764); break; case SND_SOC_DAPM_PRE_PMD: - ret = snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, - TAS2764_PWR_CTRL_MASK, - TAS2764_PWR_CTRL_SHUTDOWN); + tas2764->dac_powered = false; + ret = tas2764_update_pwr_ctrl(tas2764); break; default: dev_err(tas2764->dev, "Unsupported event\n"); @@ -170,17 +189,11 @@ static const struct snd_soc_dapm_route tas2764_audio_map[] = { static int tas2764_mute(struct snd_soc_dai *dai, int mute, int direction) { - struct snd_soc_component *component = dai->component; - int ret; - - ret = snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, - TAS2764_PWR_CTRL_MASK, - mute ? TAS2764_PWR_CTRL_MUTE : 0); + struct tas2764_priv *tas2764 = + snd_soc_component_get_drvdata(dai->component); - if (ret < 0) - return ret; - - return 0; + tas2764->unmuted = !mute; + return tas2764_update_pwr_ctrl(tas2764); } static int tas2764_set_bitwidth(struct tas2764_priv *tas2764, int bitwidth) @@ -494,12 +507,6 @@ static int tas2764_codec_probe(struct snd_soc_component *component) if (ret < 0) return ret; - ret = snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, - TAS2764_PWR_CTRL_MASK, - TAS2764_PWR_CTRL_MUTE); - if (ret < 0) - return ret; - return 0; } From patchwork Wed Oct 19 08:27: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: 4707 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp213798wrs; Wed, 19 Oct 2022 02:11:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Z27KnpIUfkRjjgxTx6OydGvdLuwv0KvsjU3L/yB91Gv4mJuMfNkl4qPvj1KBa9AWTr2Rn X-Received: by 2002:a17:906:8b81:b0:78e:1cb:e411 with SMTP id nr1-20020a1709068b8100b0078e01cbe411mr5692825ejc.681.1666170665607; Wed, 19 Oct 2022 02:11:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170665; cv=none; d=google.com; s=arc-20160816; b=r2Q+buTg6cyCogVl/LqoCISsWZihBB9swHcahvZBHtir9gvgNCuCT1Lxd6iHhdMAYg 5rFomJjJq1J+vWP6vqnlFnOcIeG3Vk6Ct+Va8bF894N9Tmkj0QNP/GcVFgfUL7BipNLa 1ylYXuq2u3ORibGmzNqt9tmOqJ7Bbea7f4aoCr7hMQAbNX7Jn4omr/8BMfdLNltKk/m0 iJJtZjz43vbZ17Fob+CpP2hx7cvpH+9GDeiVxD2ZXrhby28VC23WfxwW0JuFCjxQHSuG fQOvE1zmAGYuUTRxx0RSUg1PKqBAL7IKiwFJ2q7GmoOdDxz0GSzaA295pkc/v67hY8xy FdFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MS4M3jPRe/eceu35UWAgoEN/5imJ9m/RGty4IwYH/v0=; b=Ii0sIRSGplWmzDrn1eZKue4rEgX5ctXSkhwjHnYs8/TSuNnUR0oAYhpvQu1g7d5RmB DvAbk+ZKiKpqgUac3EAThv6lqTz1IRagYRmP46fbnL52N3tCUnL3hEyPvUahV7BurKO8 xm7ZdWeH8+0Ymax9ybSzYNN586vSkgVMt+WiNA08ZgTAR7gllVKRpGNuEPlRY/HUr/CM Cq1nwczbwsgfvP/SDa2pC97uNliqD8rsFhVGPsorJwLh/HCQUY3Lnp3odkkZrVHWQRa2 +gnJSfPZevYSCZ70XxnRLchtMWUbxKlfJIZybngTiMnW06JwtztOUDGgdOLGOD8rPlHZ ZsIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sCCexpi0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a5-20020a056402168500b004592b993080si11503240edv.162.2022.10.19.02.10.40; Wed, 19 Oct 2022 02:11: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=sCCexpi0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232528AbiJSJGw (ORCPT + 99 others); Wed, 19 Oct 2022 05:06:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232167AbiJSJDp (ORCPT ); Wed, 19 Oct 2022 05:03:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D765EA6C14; Wed, 19 Oct 2022 01:56: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 08320617ED; Wed, 19 Oct 2022 08:54:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 210EAC433D6; Wed, 19 Oct 2022 08:54:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169692; bh=zT6MDUv1/e0ceaKhgr+62ulahZ4sloOaOytnAgt472Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sCCexpi0OJP4zhKssOV+H8IOhR11EuE4egvYrLgW9Vj0zqTDhVl21CHhZTrpJrTTq Yh+YQMwnIlvOU0bqNAFiP+NXDrBSDlDk4NAlg/PkJ/hkKkv6mLfu7T16Iubw2/Dsvd IBNaIXGNo0iybsDfJwQj98BiMMa8dZZI/adZ7Ai0= 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 6.0 371/862] platform/x86: msi-laptop: Fix old-ec check for backlight registering Date: Wed, 19 Oct 2022 10:27:38 +0200 Message-Id: <20221019083306.395280062@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106571762669946?= X-GMAIL-MSGID: =?utf-8?q?1747106571762669946?= 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 24ffc8e2d2d1..0960205ee49f 100644 --- a/drivers/platform/x86/msi-laptop.c +++ b/drivers/platform/x86/msi-laptop.c @@ -1048,8 +1048,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 Wed Oct 19 08:27: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: 4706 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp213773wrs; Wed, 19 Oct 2022 02:11:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4yRdd7NYtG+C7WBLp4HUJm5PSaaz/N98ZDKzE+jIdSxqNyYMoLzRu1y4lRQFlTXEeT2xUz X-Received: by 2002:a17:907:1dd8:b0:78d:cbdc:ff1f with SMTP id og24-20020a1709071dd800b0078dcbdcff1fmr5774498ejc.412.1666170662042; Wed, 19 Oct 2022 02:11:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170662; cv=none; d=google.com; s=arc-20160816; b=zyyyU7Y02ExGTEmZU6+nBBPwwD91v7fYSsNVpo6TDz0rOAKMEcEdng6ePBYfGTFoJs YUoZ130O6AJVWhDi9EBqSA39PVMx2ZQYci+GUd7bEZeTIIHjaWHWJnNhPOIIevG1MUUj yU8AchhaP531Y9Bi07n8YQIkFsOFPKunbOwEb1yzMfMnBehBt/k6JeOC148TmP95nmqS IOFF/KatYA0TzaaiCd/efiQcoSAQt8q9PVUs5YhmzcVC/oRnzMqLAWO1x3x5ZXjGmUHk n80RzLbm1j4TP1GifY88xeGYUiXC+CWtOz1TtQu17e1U8520Y3yIC/XubrUmoug1+vus yQ/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=vrHf8FVIz3ooUssgsspeBESZGqBVJvKQiAbgpLMHoOQ=; b=nZyJQuxLUQ1HAP434t2fXQHFUcBLBItyPsXmzx4xu6x+fOuyxut9JgbY7QQHuMK/JK gsxERb6cgfjjtM07fSKNsHZpd4sKKGhEvoGT6nmNoUKYho77jZ/6DsYd5tK2B1F5HR4k cY7UfO+Cvq4M2tKRYlxyKdQgrsZwUVeXLhlHF56Kklt6pj/CR/srzXwb9JRoRqFlJpDO Z9ERwFNoRmObePzQbcpCk5nrUKQroZohcXbuFV8lRKbN1FjtsxNWly9msbFqMD6qb5qx t7GyKdNIqwMRheEnhJTyx3ODlcANz7DO95L+wDA2hYyb38j/CscAlyipK4/mu69LRvPE kEQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RQdfVOSn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t22-20020a1709067c1600b0078a76811e33si11854798ejo.408.2022.10.19.02.10.37; Wed, 19 Oct 2022 02:11: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=RQdfVOSn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232340AbiJSJGr (ORCPT + 99 others); Wed, 19 Oct 2022 05:06:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232660AbiJSJEu (ORCPT ); Wed, 19 Oct 2022 05:04:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17ED9AEA06; Wed, 19 Oct 2022 01:58: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 CDC96617FB; Wed, 19 Oct 2022 08:54:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2319C433D6; Wed, 19 Oct 2022 08:54:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169695; bh=LMiQSmINL+WpJ+Efxa9vMNxwvWoH4bT4QVIx9zBBdls=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RQdfVOSnzluhIJDDdAQ9Yqh1293PKrci9G12Jp+mfA/lThUVOgHapc+pSXAw85/Hm cK092En9U4KXBwL78x9LX5DmGzf3YHKCGuLumVtVcdDT/hepHa/R9DV0U8t7C0flC4 n7h8lBhZYlYuCn2HavmFQoG9tUIM6RD5Jp/OPpqQ= 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 6.0 372/862] platform/x86: msi-laptop: Fix resource cleanup Date: Wed, 19 Oct 2022 10:27:39 +0200 Message-Id: <20221019083306.435244133@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106568052988451?= X-GMAIL-MSGID: =?utf-8?q?1747106568052988451?= From: Hans de Goede [ Upstream commit 5523632aa10f906dfe2eb714ee748590dc7fc6b1 ] Fix the input-device not getting free-ed on probe-errors and fix the msi_touchpad_dwork not getting cancelled on neither probe-errors nor on remove. Fixes: 143a4c0284dc ("msi-laptop: send out touchpad on/off key") Signed-off-by: Hans de Goede Link: https://lore.kernel.org/r/20220825141336.208597-3-hdegoede@redhat.com Signed-off-by: Sasha Levin --- drivers/platform/x86/msi-laptop.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/platform/x86/msi-laptop.c b/drivers/platform/x86/msi-laptop.c index 0960205ee49f..3e935303b143 100644 --- a/drivers/platform/x86/msi-laptop.c +++ b/drivers/platform/x86/msi-laptop.c @@ -1116,6 +1116,8 @@ static int __init msi_init(void) fail_create_group: if (quirks->load_scm_model) { i8042_remove_filter(msi_laptop_i8042_filter); + cancel_delayed_work_sync(&msi_touchpad_dwork); + input_unregister_device(msi_laptop_input_dev); cancel_delayed_work_sync(&msi_rfkill_dwork); cancel_work_sync(&msi_rfkill_work); rfkill_cleanup(); @@ -1136,6 +1138,7 @@ static void __exit msi_cleanup(void) { if (quirks->load_scm_model) { i8042_remove_filter(msi_laptop_i8042_filter); + cancel_delayed_work_sync(&msi_touchpad_dwork); input_unregister_device(msi_laptop_input_dev); cancel_delayed_work_sync(&msi_rfkill_dwork); cancel_work_sync(&msi_rfkill_work); From patchwork Wed Oct 19 08:27:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5313 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp284451wrs; Wed, 19 Oct 2022 05:06:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7iZBM4svkGNIJKkXI6d0+Q6TrHvI8FuZMdMVzLnbar6r31DvAeZRle7QBets6rDtfBQ4BQ X-Received: by 2002:a17:90a:f315:b0:20b:15fc:ac5c with SMTP id ca21-20020a17090af31500b0020b15fcac5cmr43969476pjb.220.1666181172330; Wed, 19 Oct 2022 05:06:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666181172; cv=none; d=google.com; s=arc-20160816; b=izADYTt+aJMww+IiscD7CKyc/4rjCNxPI0WIELXJXzUZZFtiYsOJy2iVImhebixXnt rN4ysFq+bEj1n58V/VmIVhAiiM2qBeamKQ+uOEr4/XXHFQieH5HIjeFGjhTLpz/96TlY H1yjo/CnvYJU91QQnpWeM2sYwvV6JoUQ4JkYl03XsbvqwlwDrPZoib/1uGvOydBO0+Dp Thjfmc6Jr0IAtU6f/yn2HpZpR53ri1N87nN2n7fpZpetWIllXCMkboKSam1RJB42kBNf H7kz0W/+aYJGg4KZuqOraAHDAa6ZLsRYiUwXP0urYw6pWYHnSKaWB3XNxdGv86ZFjRaf Q/OA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=IAKV6axovdessbv/9mtCw5Y5M57WMdHHlGhnNuTEUnE=; b=TooQrplUUpDwfhgmXrnLToHr31hUp1GrMHTCGF3pjbSa7uYGlCM3RrIS9siT4klAPl Axe3SgBTIBVv1dzx5jgTjMlNgIM+OtM8QQ0ESv4NinB5rBI5Ohr/nP/i9Zz5m/vcBn32 TCQtwciZRCnQf6NMBrK94c3CfuMt783PHqUH4USagLwtTwt6DbHUjF+PDJE2hoET/JIN hI0XL9/dr3QgQu8v2tjEVoMi7V30spsDbn8iqKXxWX+iDLXqlA/4bolnHMVrH6zTXstr 54FX6bAZrJkwDtPuvGHaFXXm5kELgiQqpWuiRzD61MLMVq3XlAmzDOSCgKNF13KTKAwn dMZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="gZ+QEZ/W"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a38-20020a056a001d2600b00538147a4b3csi18968438pfx.318.2022.10.19.05.05.55; Wed, 19 Oct 2022 05:06: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="gZ+QEZ/W"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232109AbiJSMA0 (ORCPT + 99 others); Wed, 19 Oct 2022 08:00:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231908AbiJSL7V (ORCPT ); Wed, 19 Oct 2022 07:59:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A8E01BB960; Wed, 19 Oct 2022 04:37:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1E388B823C6; Wed, 19 Oct 2022 08:54:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4ABABC433C1; Wed, 19 Oct 2022 08:54:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169697; bh=UX8Cs3Mm3tSWVe+7/xzWvQqmQ5T7ga5ab7VqL2bSUis=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gZ+QEZ/WHmbDj7KqZuweukyTD7UpC2dFb+nNYVa6LQX603ui4qpZ31QH15cNiDc/u 8ZlrvJczBqnL/tB8P6tGk8ZM+Ld8l+jv4T1ZJlWRt12M7CszelIA+CMgLFr8SDulNA 9eedJ0yGIcmWHGhh9B1F9UTe0kLnFKw3elxHOOw8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Randy Dunlap , Dillon Min , Linus Walleij , Sam Ravnborg , =?utf-8?q?Noralf_Tr=C3=B8nnes?= , Thomas Zimmermann , Thierry Reding , dri-devel@lists.freedesktop.org, David Airlie , Daniel Vetter , Sasha Levin Subject: [PATCH 6.0 373/862] drm/panel: use select for Ili9341 panel driver helpers Date: Wed, 19 Oct 2022 10:27:40 +0200 Message-Id: <20221019083306.471257645@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747117589159569723?= X-GMAIL-MSGID: =?utf-8?q?1747117589159569723?= From: Randy Dunlap [ Upstream commit 84dfc46594b0167e5d3736273b0e0e05365da641 ] Use 'select' instead of 'depends on' for DRM helpers for the Ilitek ILI9341 panel driver. This is what is done in the vast majority of other cases and this makes it possible to fix a build error with drm_mipi_dbi. Fixes: 5a04227326b0 ("drm/panel: Add ilitek ili9341 panel driver") Signed-off-by: Randy Dunlap Cc: Dillon Min Cc: Linus Walleij Cc: Sam Ravnborg Cc: Noralf Trønnes Cc: Thomas Zimmermann Cc: Thierry Reding Cc: dri-devel@lists.freedesktop.org Cc: David Airlie Cc: Daniel Vetter Signed-off-by: Linus Walleij Link: https://patchwork.freedesktop.org/patch/msgid/20220823004227.10820-1-rdunlap@infradead.org Signed-off-by: Sasha Levin --- drivers/gpu/drm/panel/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig index a9043eacce97..a582ddd583c2 100644 --- a/drivers/gpu/drm/panel/Kconfig +++ b/drivers/gpu/drm/panel/Kconfig @@ -165,8 +165,8 @@ config DRM_PANEL_ILITEK_IL9322 config DRM_PANEL_ILITEK_ILI9341 tristate "Ilitek ILI9341 240x320 QVGA panels" depends on OF && SPI - depends on DRM_KMS_HELPER - depends on DRM_GEM_CMA_HELPER + select DRM_KMS_HELPER + select DRM_GEM_DMA_HELPER depends on BACKLIGHT_CLASS_DEVICE select DRM_MIPI_DBI help From patchwork Wed Oct 19 08:27:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4701 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp213752wrs; Wed, 19 Oct 2022 02:11:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6OOw3uQLMLq3IOrykYWRSEe4Vxf8ELBTNV9SOVZN9PibviliOzKUjHI9/MY4rF1m/DIrir X-Received: by 2002:a05:6402:b5a:b0:458:f4c6:8039 with SMTP id bx26-20020a0564020b5a00b00458f4c68039mr6478410edb.349.1666170660014; Wed, 19 Oct 2022 02:11:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170660; cv=none; d=google.com; s=arc-20160816; b=AeZMcL2wNgVpEMykN7XUqAjdFYecFjcA1AunnqEleIK4wqgpGxjwwLVjo/N/6ItFr2 miMAhgX9Va9/bFtv5E955a8QGTPlVCkELVkzE+pupMOZDFhUUsZfPurtqNZhJiZN9lMZ Fmkce9rm2GzLHPZynH/lURxL6A6wcppKEy7sauPw0UNYltYa3RBc/hcQW29In9AY7Tbj jmDEcySaxwgKDRvbIsdnsqRCJGz3JvvKeJClGkVIPYg5AatZDveeXqVPohXUvyAEgvPo jW0ti0FPbvAoSWEf5IApy0zVrePety/7Y/Vuo14jUN6/W1qrvSMYUOiFj03hzgkYqkmt B8Gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dngH5w8po/Wb+7ouUa1joggG2WycXl7uVPq/FK7CrZE=; b=ux2IbZ98prQjkbUTjx6p95zPtdrJOq9y3ARDQ4vjkLXLN4RjcMklXVpuC9Nlps+1US UuqxFnNGCbcPKu/XNMIGkthf+SyaQzA/QUVb3RiUX9kXS66xoMZDp4w9eb1NfkCeit8D oKPKd+n3m15KiFRLhiJJarCSSrRmqFjyQ8cSQqQ3qZtctVIXZU+r/DDDbT2RWNhxNzad BQaoK0I39PFHdR9SFO9uD+4B/Dub36bYAq2k3EK2WrfOoraR0jJIB7CJkQLZIxMgDq9C cVAX5LyQ0mwVhq46A6m8Da5dinkDWXwuylWwHMgdyj4UwTsJYGP/BnQUBOOtMLNEvgqv 11ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1IL9dqqi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id he38-20020a1709073da600b0073d6b849d4fsi13955518ejc.731.2022.10.19.02.10.33; Wed, 19 Oct 2022 02:10: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=1IL9dqqi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232494AbiJSJGk (ORCPT + 99 others); Wed, 19 Oct 2022 05:06:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232611AbiJSJEo (ORCPT ); Wed, 19 Oct 2022 05:04:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFA62EE28; Wed, 19 Oct 2022 01:58: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 D8A076174B; Wed, 19 Oct 2022 08:56:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C63C7C433C1; Wed, 19 Oct 2022 08:56:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169808; bh=nm6Fk68lTXLToM7w7rO0akGlkXWx4flW07EYl2/lIzY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1IL9dqqiM9wCKopoehh9+4J8UF0ofA0Eg1wwR08q/TOLxzIKwjhqBbS5zPoxBXPZU qazA73ea6TW0aXyl+qRVofoKEiadnDeO19o7oU9RxyGGsFALignDTYwEoxt11EeAwZ lgJEL7mJaYUuU7RQVRcG7OnWHcY2tjHxRx/3A+Lg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Randy Dunlap , kernel test robot , Dillon Min , Linus Walleij , Sam Ravnborg , =?utf-8?q?Noralf_Tr=C3=B8nnes?= , Thomas Zimmermann , Thierry Reding , dri-devel@lists.freedesktop.org, David Airlie , Daniel Vetter , Sasha Levin Subject: [PATCH 6.0 374/862] drm: fix drm_mipi_dbi build errors Date: Wed, 19 Oct 2022 10:27:41 +0200 Message-Id: <20221019083306.505648663@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106565927417764?= X-GMAIL-MSGID: =?utf-8?q?1747106565927417764?= From: Randy Dunlap [ Upstream commit eb7de496451bd969e203f02f66585131228ba4ae ] drm_mipi_dbi needs lots of DRM_KMS_HELPER support, so select that Kconfig symbol like it is done is most other uses, and the way that it was before MIPS_DBI was moved from tinydrm to its core location. Fixes these build errors: ld: drivers/gpu/drm/drm_mipi_dbi.o: in function `mipi_dbi_buf_copy': drivers/gpu/drm/drm_mipi_dbi.c:205: undefined reference to `drm_gem_fb_get_obj' ld: drivers/gpu/drm/drm_mipi_dbi.c:211: undefined reference to `drm_gem_fb_begin_cpu_access' ld: drivers/gpu/drm/drm_mipi_dbi.c:215: undefined reference to `drm_gem_fb_vmap' ld: drivers/gpu/drm/drm_mipi_dbi.c:222: undefined reference to `drm_fb_swab' ld: drivers/gpu/drm/drm_mipi_dbi.c:224: undefined reference to `drm_fb_memcpy' ld: drivers/gpu/drm/drm_mipi_dbi.c:227: undefined reference to `drm_fb_xrgb8888_to_rgb565' ld: drivers/gpu/drm/drm_mipi_dbi.c:235: undefined reference to `drm_gem_fb_vunmap' ld: drivers/gpu/drm/drm_mipi_dbi.c:237: undefined reference to `drm_gem_fb_end_cpu_access' ld: drivers/gpu/drm/drm_mipi_dbi.o: in function `mipi_dbi_dev_init_with_formats': ld: drivers/gpu/drm/drm_mipi_dbi.o:/X64/../drivers/gpu/drm/drm_mipi_dbi.c:469: undefined reference to `drm_gem_fb_create_with_dirty' Fixes: 174102f4de23 ("drm/tinydrm: Move mipi-dbi") Signed-off-by: Randy Dunlap Reported-by: kernel test robot Cc: Dillon Min Cc: Linus Walleij Cc: Sam Ravnborg Cc: Noralf Trønnes Cc: Thomas Zimmermann Cc: Thierry Reding Cc: dri-devel@lists.freedesktop.org Cc: David Airlie Cc: Daniel Vetter Signed-off-by: Linus Walleij Link: https://patchwork.freedesktop.org/patch/msgid/20220823004243.11596-1-rdunlap@infradead.org Signed-off-by: Sasha Levin --- drivers/gpu/drm/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index 6c2256e8474b..679ad054ea4b 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig @@ -31,6 +31,7 @@ menuconfig DRM config DRM_MIPI_DBI tristate depends on DRM + select DRM_KMS_HELPER config DRM_MIPI_DSI bool From patchwork Wed Oct 19 08:27: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: 5026 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp246412wrs; Wed, 19 Oct 2022 03:38:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM71QtOJpLK5vXvAlisNNMKOuc1ePQ+oWOCAH4fQwKtCToPX/e0DAbv0r7DlxrNQTsGuZmU2 X-Received: by 2002:aa7:cd10:0:b0:45c:2c83:1208 with SMTP id b16-20020aa7cd10000000b0045c2c831208mr6593908edw.81.1666175889997; Wed, 19 Oct 2022 03:38:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666175889; cv=none; d=google.com; s=arc-20160816; b=mo6hJSSTx85YTnukQbhNCyZBnhFQch4oKB8uR82j/xapQe8SIZwkhYTgAL1ndU5XZ9 dEZ+7UcMyQ6WqH50P0Vy0zwufE28x6SP43qWDjso0qLdSL5huzYP7vS32buw/W3toMY3 /9Iw3W535WVzZkwE6xFvUVtm0C7Pk/XsdTDS7iItL0Rb4yfLTioBer2+us3cYQSBI6dG M8msm/VEEy5jTD8Rxk/kuCuzCCKN4tUxYbbnC0tdH4HwNI38ob4VWzZGNAaplMBve6s3 Qr+kQSgCt0GwGkNNeYrzPxqVXzcAXsxgBwEC5tGg0NbYNZIKU92MRhOEkE1FvTNrrCen uzMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yID6JSI9c4qrMGNkiKcqQFRuZTTAvLig/b/+WBaipYs=; b=V24GnNTuYmh8F9AEE0Ko9zrMWweWQ8Ldc4bRuee/9zHm5UumaT69HpsXvgRUFtDmoa 15xogitFOMnzBbtl44X7AloOY0FVKs2RDNAvOTHVAYHuQPFSGY/RCW7kcGAo6o7pif+C OyqdfTu7Mx1knm1qm+ggLkrsEPXgz17RCOlSPwxEz4VrEqEtHey0V9KdawWyqv7Vg9Ml x4t5GsmRzVW1SqoTSXS2m0ZPgQ5jif8onYIAWedHC0NvlnFEpbhVECPHhT8LwYuSfckK JTNj9fY1tmChnPkR8LsbE3tL8NqnEwzEvnZIu3qMzKut52+ru5hf9F/uc1aP6rs72GvB KEGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=px2hEt6L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a056402248b00b0044e8fe826a0si12475344eda.156.2022.10.19.03.37.43; Wed, 19 Oct 2022 03:38: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=px2hEt6L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231747AbiJSKgo (ORCPT + 99 others); Wed, 19 Oct 2022 06:36:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231771AbiJSKgT (ORCPT ); Wed, 19 Oct 2022 06:36:19 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 782B1647E2; Wed, 19 Oct 2022 03:15:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5F36BB823C9; Wed, 19 Oct 2022 08:55:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 983D6C433D7; Wed, 19 Oct 2022 08:55:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169719; bh=HXWLNBSYweesCtmqEF+DBW6DuBS8+yAnyMRGdDnJ0Lo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=px2hEt6LsBLrjF/QZItAz4Ri3R9y4kZWfgMwUX9K/78xuEkId69mfvpQHyEifc+0R S8NL/P+ERgpw1NoKbpAZW4h99LiE5i42AhVurZ/lQ2bTTc1Eu3gAuMNuaQs96MwMBv xtT4vmq3NErhBL9g9gRxUFf259xIKWJUEX+bLfZY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Prashant Malani , Heikki Krogerus , Tzung-Bi Shih , Sasha Levin Subject: [PATCH 6.0 375/862] platform/chrome: cros_ec_typec: Add bit offset for DP VDO Date: Wed, 19 Oct 2022 10:27:42 +0200 Message-Id: <20221019083306.548843142@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112050399654980?= X-GMAIL-MSGID: =?utf-8?q?1747112050399654980?= From: Prashant Malani [ Upstream commit 1903adae0464c1e1c36b132db474cb3aff7bc727 ] Use the right macro while constructing the DP_PORT_VDO to ensure the Pin Assignment offsets are correct. Fixes: 1ff5d97f070c ("platform/chrome: cros_ec_typec: Register port altmodes") Signed-off-by: Prashant Malani Acked-by: Heikki Krogerus Reviewed-by: Tzung-Bi Shih Link: https://lore.kernel.org/r/20220819190807.1275937-2-pmalani@chromium.org Signed-off-by: Sasha Levin --- drivers/platform/chrome/cros_ec_typec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c index de6ee0f926a6..4d81d8d45b73 100644 --- a/drivers/platform/chrome/cros_ec_typec.c +++ b/drivers/platform/chrome/cros_ec_typec.c @@ -25,7 +25,8 @@ #define DRV_NAME "cros-ec-typec" -#define DP_PORT_VDO (BIT(DP_PIN_ASSIGN_C) | BIT(DP_PIN_ASSIGN_D) | DP_CAP_DFP_D) +#define DP_PORT_VDO (DP_CONF_SET_PIN_ASSIGN(BIT(DP_PIN_ASSIGN_C) | BIT(DP_PIN_ASSIGN_D)) | \ + DP_CAP_DFP_D) /* Supported alt modes. */ enum { From patchwork Wed Oct 19 08:27: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: 4699 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp213748wrs; Wed, 19 Oct 2022 02:10:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5JlCVWweqflVh1/AuCfMUSx5Dvh3L1raR8S4HoFMV0g4Y2AylL2CZASTB8YZBh8l+yC7SI X-Received: by 2002:a17:906:3287:b0:78d:8877:d50f with SMTP id 7-20020a170906328700b0078d8877d50fmr5894079ejw.486.1666170659674; Wed, 19 Oct 2022 02:10:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170659; cv=none; d=google.com; s=arc-20160816; b=C8zx5Ef0odjS4heLBvowcSKYaMHpcl5mA9hgtw+oamjB4P5y4bnvj0AxGFsgfkw7WW PKuEzVgeqeauPiDVjD7LZgiQ7zmq1b35DGOl8O9SRICX5Z1VFPcidw0D2nDMe6hkqHlb 9odPjBdC87ctuT68IzrLGGCLf4uj1czWBoLKBVN/Hg4zoIFktp+2EH/f8K6gBF9Jy6Gy IQ98RKhiudlTzQ6iVAUuMUoHlMEEZvoYR3cTvrPniW6JfIEbD9VADzvZ+k8vLT/4m97W QyGr2u/+0J7lr+krixX1tdKRKdrlMQwkRMxwAc7hKNC9bplUo9EFZxeF5/8t4PqNr0sI aGLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/FwD+DyVZnA/iggt0gVDgpVAayGoG0kwpeZTnWyARRY=; b=MIzKXFobgK/SidCpkSt6YZPnIzvaC5n9Jw5og5Qoh1bbmKU9xMzqgre+Qxs3aDSSDl yY0mEYGJ/aJ9fbfFijmfooVvyRHxNZNYhtK1Foqy4L9on2VoqIfDmIuNE+4aj0/455OW 5CycVS7wNxaU1wkXICe/9Z9GQDnE/NYJ+ODUjQ3D8WtfYj3yg3B5NVpksRSvKWcldUnX QlgSGLEzJuzNxiMknnz6UE00fCwVBtPWBHg6zM2J7tNxzemOXxXyEctqQGQXGpsHEnaX huNOBO2Y7/i6QIvIVvZn03Nbsu0Y6jIoXjINwpx3J6hC96ANJaQkH89RsWw2pBHZK9sh nLIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pu1KDnag; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id st11-20020a170907c08b00b007806c7c3fc1si10841149ejc.975.2022.10.19.02.10.33; Wed, 19 Oct 2022 02:10: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=pu1KDnag; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232365AbiJSJF6 (ORCPT + 99 others); Wed, 19 Oct 2022 05:05:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232445AbiJSJER (ORCPT ); Wed, 19 Oct 2022 05:04: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 B2871AC3A8; Wed, 19 Oct 2022 01:57: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 B1C9761840; Wed, 19 Oct 2022 08:55:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BFBABC433D6; Wed, 19 Oct 2022 08:55:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169748; bh=BUoZSVtnJYKGm7Y4/4qkfKMhQWKbZhy/Miz88YbtnhU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pu1KDnagm5Y+OLIB9G6lmDOL99vSlRYRQK/iQDqsh03mztqwu0zFsrFd2QX/oiucd /EMVy9YWXu2rgrit9NS6yAKrOJvw0J6mx4D41kVULQVmJ6vOGSHYPsg3dk6TNnaCeV NsOTSQlPVMepoyXKF7abCC16/blKyhs6isBw+7sI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Prashant Malani , Heikki Krogerus , Tzung-Bi Shih , Sasha Levin Subject: [PATCH 6.0 376/862] platform/chrome: cros_ec_typec: Correct alt mode index Date: Wed, 19 Oct 2022 10:27:43 +0200 Message-Id: <20221019083306.598780576@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106565569555308?= X-GMAIL-MSGID: =?utf-8?q?1747106565569555308?= From: Prashant Malani [ Upstream commit 4e477663e396f48c5cfc5f2d75d4b514f409516a ] Alt mode indices used by USB PD (Power Delivery) start with 1, not 0. Update the alt mdoe registration code to factor this in to the alt mode descriptor. Fixes: de0f49487db3 ("platform/chrome: cros_ec_typec: Register partner altmodes") Signed-off-by: Prashant Malani Acked-by: Heikki Krogerus Reviewed-by: Tzung-Bi Shih Link: https://lore.kernel.org/r/20220819190807.1275937-3-pmalani@chromium.org Signed-off-by: Sasha Levin --- drivers/platform/chrome/cros_ec_typec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c index 4d81d8d45b73..dc5722db2066 100644 --- a/drivers/platform/chrome/cros_ec_typec.c +++ b/drivers/platform/chrome/cros_ec_typec.c @@ -698,7 +698,7 @@ static int cros_typec_register_altmodes(struct cros_typec_data *typec, int port_ for (j = 0; j < sop_disc->svids[i].mode_count; j++) { memset(&desc, 0, sizeof(desc)); desc.svid = sop_disc->svids[i].svid; - desc.mode = j; + desc.mode = j + 1; desc.vdo = sop_disc->svids[i].mode_vdo[j]; if (is_partner) From patchwork Wed Oct 19 08:27: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: 5548 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp349172wrs; Wed, 19 Oct 2022 07:11:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5MzkeXD0V6GbgxE03/v/8DmuirjVFSQrQNudwlMDd4oceehh0wN/eWTm/wv8eaY5JtP9sX X-Received: by 2002:a17:906:5daa:b0:791:8933:f9f0 with SMTP id n10-20020a1709065daa00b007918933f9f0mr6917905ejv.335.1666188688433; Wed, 19 Oct 2022 07:11:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666188688; cv=none; d=google.com; s=arc-20160816; b=vnCfaDq+rzD/lNF/EFWDI2eEVbYatgA047LzqCLC+pvn7fajmYX+77Nok/YsFIgBWo HD1KSFrbhHfrjwn+hkN1IVzKSLuvA1bJUqPpW8ZXwePnZVhe/yRFHGNvR0j+b4GnaImr Xo+0wRB+8QZ3tEVrav3VSdEayUlpalmwGmzVeh66N79SKcy6IDIjjSBaaQc7mlG7rHF+ +ifBgZxxH2fHjpE4H0HE8gQzeCoVD2Uhw+RaEozBcjrXQMuDJZymBIJhi8g/mQsDvmyE tjFct9w6VlDialrShT4X96+jWSRSmUs+w2lV/84SIYmRisVdBjXtg83Yr5HMJC8DaDnW x8mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=X9uiL9EXdNu5qNs5Z0I5RipBrKxA0xPOkyDlOc8yStI=; b=b0O6PAXJUH03Fh+rh4gn0uZ1gUghxt/uSoIek7P+4eMFJBJGz5RUkfMiurb5UwiFxP Q+8x+mhNk8fQ1LLN/nWLwtgTCoVacCmt4zDn1mG/JhmJP6JddTeHdbqSBT+vNcpiiAGh BsVMurC5rGoRHzaDRtW2TjyQOS/pH6l5r4TI4wc9nKyB/1BzTcocE8LVvKNuScC1FZYE RrRm9rPHTKBRnORiokRmwoPw2t0JIq8qwfgc0DOoKkNq68sAlSHI9q8cOL6j8iZQqsXM XciVuGcOjAwsgSmq2WpvioCg1//LaGcdHgljHfTB3xr9BQkUxg8tpT0evdtMEUJYjdUu 8uOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="W8frYP/u"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z9-20020a1709063a0900b00769d94690fesi12627534eje.326.2022.10.19.07.10.43; Wed, 19 Oct 2022 07:11: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="W8frYP/u"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233655AbiJSN4S (ORCPT + 99 others); Wed, 19 Oct 2022 09:56:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233847AbiJSNyK (ORCPT ); Wed, 19 Oct 2022 09:54:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1A5A1D52EF; Wed, 19 Oct 2022 06:36: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 ams.source.kernel.org (Postfix) with ESMTPS id 0F014B822ED; Wed, 19 Oct 2022 08:56:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A149C433D6; Wed, 19 Oct 2022 08:56:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169776; bh=jjZFb/3xxXBTdxZlxFA5QPA8Bp9bYyu1DPgojX1INGs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W8frYP/u/55cWo6ZeHayBsHBjGS9RkUZBk98l16ANtps1YKn6/7/P4tZuexhQoLyH u4BWzHjp6Bvq7vfZIF9NlHIMD7N/Fcbpr3YSlAmhFKDah//BKIPLzXRIG2lWkRP7if dq+gM5soqPNfrB94eBXNEKVUdkkiynVmtRyMA2x0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yang Yingliang , Alex Deucher , Sasha Levin Subject: [PATCH 6.0 377/862] drm/amdgpu: add missing pci_disable_device() in amdgpu_pmops_runtime_resume() Date: Wed, 19 Oct 2022 10:27:44 +0200 Message-Id: <20221019083306.650323864@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747125470504838839?= X-GMAIL-MSGID: =?utf-8?q?1747125470504838839?= From: Yang Yingliang [ Upstream commit 6b11af6d1c8f5d4135332bb932baaa06e511173d ] Add missing pci_disable_device() if amdgpu_device_resume() fails. Fixes: 8e4d5d43cc6c ("drm/amdgpu: Handling of amdgpu_device_resume return value for graceful teardown") Signed-off-by: Yang Yingliang Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index 429fcdf28836..de7144b06e93 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -2563,8 +2563,11 @@ static int amdgpu_pmops_runtime_resume(struct device *dev) amdgpu_device_baco_exit(drm_dev); } ret = amdgpu_device_resume(drm_dev, false); - if (ret) + if (ret) { + if (amdgpu_device_supports_px(drm_dev)) + pci_disable_device(pdev); return ret; + } if (amdgpu_device_supports_px(drm_dev)) drm_dev->switch_power_state = DRM_SWITCH_POWER_ON; From patchwork Wed Oct 19 08:27: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: 4857 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223891wrs; Wed, 19 Oct 2022 02:38:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7AkT1DuoXITewwXl5ebkF0LRPYWg1eBPaVAQlUQshociQ/NrRLcJ+stcciPaNdcbtDPFwq X-Received: by 2002:a17:907:969e:b0:791:9ba2:497f with SMTP id hd30-20020a170907969e00b007919ba2497fmr6017807ejc.8.1666172325827; Wed, 19 Oct 2022 02:38:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172325; cv=none; d=google.com; s=arc-20160816; b=SeOzKUdYH9IgGgXH78dFGuRQ/Fnp83075a50ZSmxQIEjXhktgbFS6WvYf7LH8NdoGw cIS05GP1RZTOX/DlASyhhLXeZIXYTZuGLKhy1TTVKirLMry9AJDmVLGxnVQwjz6dPf/m TvSZJ6SeZXyoCxZYwyAkojS0RuFMnerpgAUIAfxX1VH9zbJJUAnRLwiW2zFvNMQFbRVv yjt8A/u3LDZnPwmUC8zJ/5U8iX2sOF3RONbR7SmzenlcUZeecGU4Lcy+5LHwLVm/M1vS /IOGB3NyLiRJ7rPxD8Q+YWi79/iOzEDWVVcMjg7cnhsXiaATrPi4nt1v2VLO7HTmMBVM xqEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+MXc/a5oFlvsgTc572ro7Oq3bWVBVE0/rriL/owB27s=; b=lAAigZThcNzduISDyByZmUJ5RmhzG7dONBl36Gew2dOWpp/YTe/dKk59PI6s4vHwY6 384am8xPBOaaQqlXSk+Tz23kRdeBbymHwkpZhjQ/aUqiTdb5Zfefoo/AP22ViPngg2k1 V1fPPboxpsu3tIzdC0RrKulT7QYWAVz+qPSz+m+DJ+mdb0kiTT5aN6csOAAnH6XEqMP6 bL++9AYPq3lm0wQkEPzHw7fYyIHn/c1VZY0RKv7y7BpOF1b7JuTIZn6ggdpbm8KrREm/ eGISNS/iuwtDNx3+3GGn/PQElpiULYBi6Pj2sB9s9EN9SMxu7M9W8W/4d6AI3UikTh31 JR9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BdYmqAWE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a05640205cb00b0045d03c18e5bsi17050987edx.560.2022.10.19.02.38.20; Wed, 19 Oct 2022 02:38: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=BdYmqAWE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233628AbiJSJ2G (ORCPT + 99 others); Wed, 19 Oct 2022 05:28:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233257AbiJSJ0i (ORCPT ); Wed, 19 Oct 2022 05:26: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 4C892E5ED6; Wed, 19 Oct 2022 02:11: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 1548761820; Wed, 19 Oct 2022 08:56:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 29F08C433D6; Wed, 19 Oct 2022 08:56:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169792; bh=OzLtw84/qExOO0VigNtqfN9GRq/sTIKWBf6EPPnoyMA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BdYmqAWEjrWOIA3A8jC/Z6pdqwblNDkk6+1FtpoRUcMjZa9SOaJEhuZyJSB2KBAiC dx3yA5NSZngKd3iA5BZG7jynSiX3n7b3xIbVQ0Ifj+4YmZtlrDX6+7UDB5ZL3S7jCF qCz1WztmXxtQ6H+n1HcY2UdHbHPPOTW0PbampecA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheyu Ma , Robert Foss , Sasha Levin Subject: [PATCH 6.0 378/862] drm/bridge: megachips: Fix a null pointer dereference bug Date: Wed, 19 Oct 2022 10:27:45 +0200 Message-Id: <20221019083306.681697756@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108312337569762?= X-GMAIL-MSGID: =?utf-8?q?1747108312337569762?= From: Zheyu Ma [ Upstream commit 1ff673333d46d2c1b053ebd0c1c7c7c79e36943e ] When removing the module we will get the following warning: [ 31.911505] i2c-core: driver [stdp2690-ge-b850v3-fw] unregistered [ 31.912484] general protection fault, probably for non-canonical address 0xdffffc0000000001: 0000 [#1] PREEMPT SMP KASAN PTI [ 31.913338] KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f] [ 31.915280] RIP: 0010:drm_bridge_remove+0x97/0x130 [ 31.921825] Call Trace: [ 31.922533] stdp4028_ge_b850v3_fw_remove+0x34/0x60 [megachips_stdpxxxx_ge_b850v3_fw] [ 31.923139] i2c_device_remove+0x181/0x1f0 The two bridges (stdp2690, stdp4028) do not probe at the same time, so the driver does not call ge_b850v3_resgiter() when probing, causing the driver to try to remove the object that has not been initialized. Fix this by checking whether both the bridges are probed. Fixes: 11632d4aa2b3 ("drm/bridge: megachips: Ensure both bridges are probed before registration") Signed-off-by: Zheyu Ma Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20220830073450.1897020-1-zheyuma97@gmail.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c b/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c index cce98bf2a4e7..72248a565579 100644 --- a/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c +++ b/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c @@ -296,7 +296,9 @@ static void ge_b850v3_lvds_remove(void) * This check is to avoid both the drivers * removing the bridge in their remove() function */ - if (!ge_b850v3_lvds_ptr) + if (!ge_b850v3_lvds_ptr || + !ge_b850v3_lvds_ptr->stdp2690_i2c || + !ge_b850v3_lvds_ptr->stdp4028_i2c) goto out; drm_bridge_remove(&ge_b850v3_lvds_ptr->bridge); From patchwork Wed Oct 19 08:27: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: 4703 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp213757wrs; Wed, 19 Oct 2022 02:11:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ZE7BzxudUQGaW12rYhn4JoPuZXD4WV5kd3n/RFF1mqQiJPRDdZ3c5iynKu/AYdjyeOMBP X-Received: by 2002:a05:6402:3988:b0:44e:6f08:ddfb with SMTP id fk8-20020a056402398800b0044e6f08ddfbmr6393702edb.89.1666170660280; Wed, 19 Oct 2022 02:11:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170660; cv=none; d=google.com; s=arc-20160816; b=hvtdwBimkRcSS3rmksbzKc9DaJxkNEEbN6vwy7GE7m7vTJxZcg8nmcWG4D3xYve2bG 7FOjQsRuYYEz4Uo9zg+CXovS761vZbc7TGiwGUsDIai+QmeAIdNyIS3aNkCIkLAsXr/f wyIvRKu8w443vbYl8vReKU3nPHwPaeLPwX7J+Gn9S8EMfpI9QSYXeQc9gG6tW0NkK4qa WK6rKRpuWVGKatSYH+YcjAvi6oR2M+r4MMvgI8hKp/vkAnPJivUCxxjsC0C55Z6/Ba7m UznroIoFEjjWpalfxzfnZrLaMOLsHq/DeyaOb/IaiNIVdaqnCr9MC5+n4jjU31zVcnMX K1ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fhpuDQ2nH0LSgh8M6dGSNDvkPRO2mW78msTpYQRkbhg=; b=WQnbJ1RZn4P3xJiuv5KXh4oqP8+sCeJzDONTRA7TuGbe7N7SdDoo7gBb/yEmaM3EaB ZRIYI5hxPNt2IvE4Ao+/RLg9XrG/lDwpKbG8P8DEheJ+AdUVmw/T7YhW6l4CQNnwruZA zsppyC0y/58BViSEYGPp8r6RizCYdRFrmxpsxxeSNXQJVYYdR+1S+1VDdEuO/6Irwn93 Vie3rsGfEBxHhMWM7o/+q8VUDrawlDz9sMNxecJrCXxK32x+887PTdNo7nmkYovuuEeU bFmYRt+dy2BhV6JEFW1tw3CwqPMbO3+1H+zYmlVUW3+AwFAudWAK4wg9aX8ic3NjlZAq wRSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YcKERcxL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n19-20020a170906165300b0077c5ec87ec2si9685932ejd.297.2022.10.19.02.10.34; Wed, 19 Oct 2022 02:11: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=YcKERcxL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232186AbiJSJGX (ORCPT + 99 others); Wed, 19 Oct 2022 05:06:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232568AbiJSJEg (ORCPT ); Wed, 19 Oct 2022 05:04:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F190B03E6; Wed, 19 Oct 2022 01:57:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BEFE0617E4; Wed, 19 Oct 2022 08:56:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF3E7C433D6; Wed, 19 Oct 2022 08:56:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169795; bh=CKtuwDOYPsb0DMnuLbGcnbkAajbl8yEKG+j15wLGQfA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YcKERcxLYLXpMghenyV6GXX2eaLVYJ91YPcOHTItha1JgdyjFwSUA3upkUWENBvc8 cHsYg/7QYN+SSzpTg2pKgAB3fAekuJRyIrJsat1LdGi53ggWG/b7XLHMDAxnq193l6 QD0g43NXPCVAGcdIKZeTym3FwMc9ln+xId5E+X78= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pin-yen Lin , Robert Foss , Sasha Levin Subject: [PATCH 6.0 379/862] drm/bridge: it6505: Fix the order of DP_SET_POWER commands Date: Wed, 19 Oct 2022 10:27:46 +0200 Message-Id: <20221019083306.719583623@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106566309353105?= X-GMAIL-MSGID: =?utf-8?q?1747106566309353105?= From: Pin-yen Lin [ Upstream commit 7c1dceaffd99247bf443606730515b54d6285969 ] Send DP_SET_POWER_D3 command to the downstream before stopping DP, so the suspend process will not be interrupted by the HPD interrupt. Also modify the order in .atomic_enable callback to make the callbacks symmetric. Fixes: 46ca7da7f1e8 ("drm/bridge: it6505: Send DPCD SET_POWER to downstream") Signed-off-by: Pin-yen Lin Reviewed-by: Robert Foss Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20220830045756.1655954-1-treapking@chromium.org Signed-off-by: Sasha Levin --- drivers/gpu/drm/bridge/ite-it6505.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c index e5626035f311..a09d1a39ab0a 100644 --- a/drivers/gpu/drm/bridge/ite-it6505.c +++ b/drivers/gpu/drm/bridge/ite-it6505.c @@ -2945,9 +2945,6 @@ static void it6505_bridge_atomic_enable(struct drm_bridge *bridge, if (ret) dev_err(dev, "Failed to setup AVI infoframe: %d", ret); - it6505_drm_dp_link_set_power(&it6505->aux, &it6505->link, - DP_SET_POWER_D0); - it6505_update_video_parameter(it6505, mode); ret = it6505_send_video_infoframe(it6505, &frame); @@ -2957,6 +2954,9 @@ static void it6505_bridge_atomic_enable(struct drm_bridge *bridge, it6505_int_mask_enable(it6505); it6505_video_reset(it6505); + + it6505_drm_dp_link_set_power(&it6505->aux, &it6505->link, + DP_SET_POWER_D0); } static void it6505_bridge_atomic_disable(struct drm_bridge *bridge, @@ -2968,9 +2968,9 @@ static void it6505_bridge_atomic_disable(struct drm_bridge *bridge, DRM_DEV_DEBUG_DRIVER(dev, "start"); if (it6505->powered) { - it6505_video_disable(it6505); it6505_drm_dp_link_set_power(&it6505->aux, &it6505->link, DP_SET_POWER_D3); + it6505_video_disable(it6505); } } From patchwork Wed Oct 19 08:27: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: 5552 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp349443wrs; Wed, 19 Oct 2022 07:11:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4uA25tlwmhfkBpd+zPXu9iFSnKJT1uiLg64Wnz2Q7F5ShmbyiCLHxm9kcKDDljmKbLxxz5 X-Received: by 2002:aa7:c509:0:b0:458:cb1f:b9e1 with SMTP id o9-20020aa7c509000000b00458cb1fb9e1mr7627833edq.369.1666188717828; Wed, 19 Oct 2022 07:11:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666188717; cv=none; d=google.com; s=arc-20160816; b=u0riBR1Q5gGvGxziDijToeuLtBREdvQKNSUCpZBd8usjgz52jSIMG63DMulAPr81xE cgCtGPQ+dGFaSBBso5BMLV2gO7nsgXHUMDI1w9UIM2y1cQ4VaHCC+n2uMVzdig7wsGQE Tvu8EStpQ894NLYQkqe5dSZQGSw74TNbxWz3IjhGzrdmOR/6K1ZinXCOc+BP2u9+1ojZ GRToAc0ENPgjFFfrBa/FdhxCgeqOkX1HXsA2ppEJ3+hoQxCbdhh3/eS7875D9B22lE+k 3GBQwYwBHeN/+uClJf/vQscfkQbyevSk6KbxiH0ejBVuHDKTIuHffCjnq/8LmalUO3sn YAig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=d0WDyIyQA8uDUrNU7usXAgtk1xz5lkGM09fFgR+BrTk=; b=jtqrh1Bf6eKY9oQ7iwBWRYHXNOvKOPSQfLQv8Sj13PW7EyyONhnioJfWatOtM6kML2 fSwW0J+Ptx5t91RDTDN6Gr/lbTub4qt9apLA7pG1WEon7p8Xx1RlF8ZK01WvyXW8rInr Li0k9RsN1bhUgIoDL+Doo8BXVZej0w4E12C/KLmwo0hK+cB7ol465+7LyOw3kl1R0cwH 6XwvCdJVim/KQlAZI8J6xkxTszZCt9K+PKcJPMCb6iZdbXWMyMEi4WsNbAWmFHHg0Pua +t3CRyPths+sScydBmYDf8j+QlRNQVMlUkD9730JK7uNdMr8jCOviwiXyF0RLpjfiJDi unSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LfEawwtU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ti5-20020a170907c20500b0078266dc4b97si10680586ejc.735.2022.10.19.07.11.22; Wed, 19 Oct 2022 07:11: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=LfEawwtU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233771AbiJSN4y (ORCPT + 99 others); Wed, 19 Oct 2022 09:56:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233642AbiJSNxl (ORCPT ); Wed, 19 Oct 2022 09:53:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE85734994; Wed, 19 Oct 2022 06:36: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 08AAAB82418; Wed, 19 Oct 2022 08:56:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66F92C433C1; Wed, 19 Oct 2022 08:56:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169797; bh=0M6ldLkPIHOA6wq73aLHiYig4mC6FQqYwNyvlLZ3uo0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LfEawwtUz4Brh4yjHOvpNGbEcpC1CaINUqA35vy3t6FrR8J3HJA//XFygg4BcuUzk dw6Z6zLVt6ydqBfcADrJZnrcc+mnbDPAJ0YXBG6dlza6O/1P6OrueGiLSNp2B+yEzD kihrw1VwIutH5QLLoxvot5V1R2n0WND8ziFO9kyg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Kuninori Morimoto , Mark Brown , Sasha Levin Subject: [PATCH 6.0 380/862] ASoC: rsnd: Add check for rsnd_mod_power_on Date: Wed, 19 Oct 2022 10:27:47 +0200 Message-Id: <20221019083306.762362511@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747125500723344966?= X-GMAIL-MSGID: =?utf-8?q?1747125500723344966?= From: Jiasheng Jiang [ Upstream commit 376be51caf8871419bbcbb755e1e615d30dc3153 ] As rsnd_mod_power_on() can return negative numbers, it should be better to check the return value and deal with the exception. Fixes: e7d850dd10f4 ("ASoC: rsnd: use mod base common method on SSI-parent") Signed-off-by: Jiasheng Jiang Acked-by: Kuninori Morimoto Link: https://lore.kernel.org/r/20220902013030.3691266-1-jiasheng@iscas.ac.cn Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/sh/rcar/ctu.c | 6 +++++- sound/soc/sh/rcar/dvc.c | 6 +++++- sound/soc/sh/rcar/mix.c | 6 +++++- sound/soc/sh/rcar/src.c | 5 ++++- sound/soc/sh/rcar/ssi.c | 4 +++- 5 files changed, 22 insertions(+), 5 deletions(-) diff --git a/sound/soc/sh/rcar/ctu.c b/sound/soc/sh/rcar/ctu.c index 6156445bcb69..e39eb2ac7e95 100644 --- a/sound/soc/sh/rcar/ctu.c +++ b/sound/soc/sh/rcar/ctu.c @@ -171,7 +171,11 @@ static int rsnd_ctu_init(struct rsnd_mod *mod, struct rsnd_dai_stream *io, struct rsnd_priv *priv) { - rsnd_mod_power_on(mod); + int ret; + + ret = rsnd_mod_power_on(mod); + if (ret < 0) + return ret; rsnd_ctu_activation(mod); diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c index 5137e03a9d7c..16befcbc312c 100644 --- a/sound/soc/sh/rcar/dvc.c +++ b/sound/soc/sh/rcar/dvc.c @@ -186,7 +186,11 @@ static int rsnd_dvc_init(struct rsnd_mod *mod, struct rsnd_dai_stream *io, struct rsnd_priv *priv) { - rsnd_mod_power_on(mod); + int ret; + + ret = rsnd_mod_power_on(mod); + if (ret < 0) + return ret; rsnd_dvc_activation(mod); diff --git a/sound/soc/sh/rcar/mix.c b/sound/soc/sh/rcar/mix.c index 3572c2c5686c..1de0e085804c 100644 --- a/sound/soc/sh/rcar/mix.c +++ b/sound/soc/sh/rcar/mix.c @@ -146,7 +146,11 @@ static int rsnd_mix_init(struct rsnd_mod *mod, struct rsnd_dai_stream *io, struct rsnd_priv *priv) { - rsnd_mod_power_on(mod); + int ret; + + ret = rsnd_mod_power_on(mod); + if (ret < 0) + return ret; rsnd_mix_activation(mod); diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c index 0ea84ae57c6a..f832165e46bc 100644 --- a/sound/soc/sh/rcar/src.c +++ b/sound/soc/sh/rcar/src.c @@ -463,11 +463,14 @@ static int rsnd_src_init(struct rsnd_mod *mod, struct rsnd_priv *priv) { struct rsnd_src *src = rsnd_mod_to_src(mod); + int ret; /* reset sync convert_rate */ src->sync.val = 0; - rsnd_mod_power_on(mod); + ret = rsnd_mod_power_on(mod); + if (ret < 0) + return ret; rsnd_src_activation(mod); diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c index 43c5e27dc5c8..7ade6c5ed96f 100644 --- a/sound/soc/sh/rcar/ssi.c +++ b/sound/soc/sh/rcar/ssi.c @@ -480,7 +480,9 @@ static int rsnd_ssi_init(struct rsnd_mod *mod, ssi->usrcnt++; - rsnd_mod_power_on(mod); + ret = rsnd_mod_power_on(mod); + if (ret < 0) + return ret; rsnd_ssi_config_init(mod, io); From patchwork Wed Oct 19 08:27: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: 5557 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp349908wrs; Wed, 19 Oct 2022 07:12:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5lSswKVBIR3C9rcgmTeEIzDGuIbn0kaS6fpLz3d0t9u4rAEhFs+PaQOUtyQc0cXA6NKwP9 X-Received: by 2002:a17:907:3f1e:b0:78d:f198:fd00 with SMTP id hq30-20020a1709073f1e00b0078df198fd00mr6724854ejc.730.1666188762472; Wed, 19 Oct 2022 07:12:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666188762; cv=none; d=google.com; s=arc-20160816; b=n+JTZ1fHVA1WpTtTIRFSQEnOB7BUl+/QqZfR20fwKh4lRBm/qg0M7shPTdwZOJ24Zh iromXtUYR+yBlMDTQD5wrtHI20oCY1fa94u0lhEZG1eOHHPCXKUERZ6u1q7tBbH+O2Lo X9ltuc0abqUnS4+PxoXlSNU3BASWq/foBLbgVEyXcvfcDcj9VNKRtN5MhEjtmjJCQGYH CbRBED+7zqFi6DN1m4q2kgXyeaOexTAR/1+zcIMAexksAPl2wLeTXDVafeewhMB2dsCh kvXtBbm5pZi4oWJCS6v+6w62OMZfFzlml/L8RxJDQNm8Z4W2RR3BuYgLeyz4jZzzy5ID hQVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dmi7DpQ/urD9/pj/Am7j6RrvXnOOJ370FPfJD3f+AWA=; b=uqNx+WolQrvUvdEw0DMR9ww8lv1xTrhJRidj6++PE2+/FU6wZ5rfvhod83zyD1/zNV E53ZejT5jnItx2SqH+IRtMXurcT8RR+sZ46rRzoLXYCtJ0s5VUXjilVx4IHuQeooacEr fJerTRK1QXLsuJRgdhkie6QkwQ+B6Fc4HW5jk9RFB+7vinLeXavqHb+TOoWTSQ3d1WtQ RqCm9nqX4qNXVeH6qW/9CgMrgWiynobujJL6CcQKAqF88P7AVOwVbiP11bpImuPEXV5S 1nx6pypxG8Cz1RX9/zcqYQCQBUYVtuQebLQXOG7GRUj4W3xyIFlm5nq0ctdNQsUBPy+U 5zjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LKgmsxpU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id di8-20020a170906730800b00783de095de7si15135902ejc.847.2022.10.19.07.11.56; Wed, 19 Oct 2022 07:12: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=LKgmsxpU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231139AbiJSN5d (ORCPT + 99 others); Wed, 19 Oct 2022 09:57:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233014AbiJSNw7 (ORCPT ); Wed, 19 Oct 2022 09:52: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 6D61731ECE; Wed, 19 Oct 2022 06:36: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 7FA17B823DB; Wed, 19 Oct 2022 08:56:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F4121C433D7; Wed, 19 Oct 2022 08:56:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169800; bh=EbACe5qacps0SV0GIDnIuKU9lBFLNTXwJE3mpAJw9sE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LKgmsxpU3rVnOhUfky4eqUsXkkd9jGaG0A9JhF3ycWLh8l62SEaps0TEonYTmXkFE qupCFsmrDbEZPH//CclTTg6q0BN0dfa4PsiuDEksqeutgFiuMMjon4PcYNi0KbICfU TsAzOKhEthu9jEbAJ44m8GjYvBTyEvugirVEu/hc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Cristian Ciocaltea , Charles Keepax , Mark Brown , Sasha Levin Subject: [PATCH 6.0 381/862] ASoC: wm_adsp: Handle optional legacy support Date: Wed, 19 Oct 2022 10:27:48 +0200 Message-Id: <20221019083306.807821695@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747125547451050093?= X-GMAIL-MSGID: =?utf-8?q?1747125547451050093?= From: Cristian Ciocaltea [ Upstream commit 35c8ae25c4fdeabf490e005692795a3be17ca5f6 ] The tracing capabilities for the speaker protection fw enabled via commit c55b3e46cb99 ("ASoC: wm_adsp: Add trace caps to speaker protection FW") are not be available on all platforms, such as the Valve's Steam Deck which is based on the Halo Core DSP. As a consequence, whenever the firmware is loaded, a rather misleading 'Failed to parse legacy: -19' error message is written to the kernel ring buffer: [ 288.977412] steamdeck kernel: cs35l41 spi-VLV1776:01: DSP1: Firmware version: 3 [ 288.978002] steamdeck kernel: cs35l41 spi-VLV1776:01: DSP1: cs35l41-dsp1-spk-prot.wmfw: Fri 02 Apr 2021 21:03:50 W. Europe Daylight Time [ 289.094065] steamdeck kernel: cs35l41 spi-VLV1776:01: DSP1: Firmware: 400a4 vendor: 0x2 v0.33.0, 2 algorithms [ 289.095073] steamdeck kernel: cs35l41 spi-VLV1776:01: DSP1: 0: ID cd v29.53.0 XM@94 YM@e [ 289.095665] steamdeck kernel: cs35l41 spi-VLV1776:01: DSP1: 1: ID f20b v0.0.1 XM@170 YM@0 [ 289.096275] steamdeck kernel: cs35l41 spi-VLV1776:01: DSP1: Protection: C:\Users\ocanavan\Desktop\cirrusTune_july2021.bin [ 291.172383] steamdeck kernel: cs35l41 spi-VLV1776:01: DSP1: Failed to parse legacy: -19 Update wm_adsp_buffer_init() to print a more descriptive info message when wm_adsp_buffer_parse_legacy() returns -ENODEV. Fixes: c55b3e46cb99 ("ASoC: wm_adsp: Add trace caps to speaker protection FW") Signed-off-by: Cristian Ciocaltea Acked-by: Charles Keepax Link: https://lore.kernel.org/r/20220825220530.1205141-1-cristian.ciocaltea@collabora.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/wm_adsp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c index cfaa45ede916..8a2e9771bb50 100644 --- a/sound/soc/codecs/wm_adsp.c +++ b/sound/soc/codecs/wm_adsp.c @@ -1602,7 +1602,9 @@ static int wm_adsp_buffer_init(struct wm_adsp *dsp) if (list_empty(&dsp->buffer_list)) { /* Fall back to legacy support */ ret = wm_adsp_buffer_parse_legacy(dsp); - if (ret) + if (ret == -ENODEV) + adsp_info(dsp, "Legacy support not available\n"); + else if (ret) adsp_warn(dsp, "Failed to parse legacy: %d\n", ret); } From patchwork Wed Oct 19 08:27: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: 5571 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp350750wrs; Wed, 19 Oct 2022 07:14:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM64b+IszRglh62O5bhggXAVUV0z65ZYph7AoBTU4UFBmNrwHniOdkdynRSno2sW7T3/uoF9 X-Received: by 2002:a17:907:a06d:b0:78d:ceae:ba5a with SMTP id ia13-20020a170907a06d00b0078dceaeba5amr7046540ejc.586.1666188853798; Wed, 19 Oct 2022 07:14:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666188853; cv=none; d=google.com; s=arc-20160816; b=MIuaqbBGnbhIl/4UF0zZmx1jQuZHiCoQE8jqxzguvFAZ+JjAG9Aa6FlKHKvFojsmjh IcEI8xat+eAPPUpPe3kWoNcPrO6/g3aLknrVImXutjU/OMSEmw9wOPBwB5Y4lbO4s7G+ 7p6giA6U+WgNxfk/Y59C+/7NkT44sYvfuL7V4RwML10onp9JKX92rlQG64sNSw8ZCysz F5lF9drhhxEfM5unBAyaJQ/2ytwybjTEkm2HcdP0TbCSMTSqgME1RIko38AQ/bcoGQZO +vBcGHFygq5SHIfIuABF3we2qw9KGfR2un0K5ZiIP9mhC1k/rmxgXi6YrgTG2SJc187f srGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Ta+1BC9ZUnNgE3sAI6+eKH47hxlQU90YhiP24MOf16Q=; b=Im82hpwPqRfRorzqSWlgqAPgYQqfgipeflOvUsqXzI+RsO7czUsyfvtJR7hhI/V/wQ ARP/TinauFJeChcUk93gFEdIwOaEYZyxhlPfJATxQluL+wtdX5kyNVEWauNN9gNSNAfB yqg/8Rm55xmDYC1iaXmk+gY3dHfeXYnmAGb9xHqvHiUEKsubMa/YfvARK9IN6ZFn3RgP kBjP4H+cs9amWw+WKkyTe8IKaQhIpKFNn0+BSUR+CbKSKKM5iJ/+CsxZdpvoiuzxqj6P 7UZPUCPEu/hUO3iTrH1d1Ay5MEhltsjzv+8rC3KyiLY0TpSv2xohchUekMi43xRjJpqe PjiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OwKvzjgA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e9-20020a056402190900b0045d9ceae633si9045855edz.55.2022.10.19.07.13.36; Wed, 19 Oct 2022 07:14:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OwKvzjgA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233957AbiJSN7F (ORCPT + 99 others); Wed, 19 Oct 2022 09:59:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233675AbiJSNxM (ORCPT ); Wed, 19 Oct 2022 09:53: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 331C714EC51; Wed, 19 Oct 2022 06:36:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 43F15B82420; Wed, 19 Oct 2022 08:56:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AD5ABC433B5; Wed, 19 Oct 2022 08:56:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169803; bh=uLP/v4pPCuxso/vuU6PoxkZFMFw+IoE4hCq+BrnMAP0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OwKvzjgAHCtNSYLJCCPbwrnCGztonVPf/LF1RsawlNTiKW/e1EFV1Dhykqvki/cev Xc4KUnaMPu/IY7jAjUvQlS2tCSPw88982Xfybr2S/19GuUd3A1q4n17+osZeBogUE2 3MzS0657/ERPKj3RTLcPinlGhJryiGnL5CsB0Y4g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai , Sasha Levin Subject: [PATCH 6.0 382/862] ALSA: hda: beep: Simplify keep-power-at-enable behavior Date: Wed, 19 Oct 2022 10:27:49 +0200 Message-Id: <20221019083306.839571567@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747125643747980956?= X-GMAIL-MSGID: =?utf-8?q?1747125643747980956?= From: Takashi Iwai [ Upstream commit 4c8d695cb9bc5f6fd298a586602947b2fc099a64 ] The recent fix for IDT codecs to keep the power up while the beep is enabled can be better integrated into the beep helper code. This patch cleans up the code with refactoring. Fixes: 414d38ba8710 ("ALSA: hda/sigmatel: Keep power up while beep is enabled") Link: https://lore.kernel.org/r/20220906092306.26183-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/pci/hda/hda_beep.c | 15 +++++++++++++-- sound/pci/hda/hda_beep.h | 1 + sound/pci/hda/patch_sigmatel.c | 25 ++----------------------- 3 files changed, 16 insertions(+), 25 deletions(-) diff --git a/sound/pci/hda/hda_beep.c b/sound/pci/hda/hda_beep.c index 53a2b89f8983..e63621bcb214 100644 --- a/sound/pci/hda/hda_beep.c +++ b/sound/pci/hda/hda_beep.c @@ -118,6 +118,12 @@ static int snd_hda_beep_event(struct input_dev *dev, unsigned int type, return 0; } +static void turn_on_beep(struct hda_beep *beep) +{ + if (beep->keep_power_at_enable) + snd_hda_power_up_pm(beep->codec); +} + static void turn_off_beep(struct hda_beep *beep) { cancel_work_sync(&beep->beep_work); @@ -125,6 +131,8 @@ static void turn_off_beep(struct hda_beep *beep) /* turn off beep */ generate_tone(beep, 0); } + if (beep->keep_power_at_enable) + snd_hda_power_down_pm(beep->codec); } /** @@ -140,7 +148,9 @@ int snd_hda_enable_beep_device(struct hda_codec *codec, int enable) enable = !!enable; if (beep->enabled != enable) { beep->enabled = enable; - if (!enable) + if (enable) + turn_on_beep(beep); + else turn_off_beep(beep); return 1; } @@ -167,7 +177,8 @@ static int beep_dev_disconnect(struct snd_device *device) input_unregister_device(beep->dev); else input_free_device(beep->dev); - turn_off_beep(beep); + if (beep->enabled) + turn_off_beep(beep); return 0; } diff --git a/sound/pci/hda/hda_beep.h b/sound/pci/hda/hda_beep.h index a25358a4807a..db76e3ddba65 100644 --- a/sound/pci/hda/hda_beep.h +++ b/sound/pci/hda/hda_beep.h @@ -25,6 +25,7 @@ struct hda_beep { unsigned int enabled:1; unsigned int linear_tone:1; /* linear tone for IDT/STAC codec */ unsigned int playing:1; + unsigned int keep_power_at_enable:1; /* set by driver */ struct work_struct beep_work; /* scheduled task for beep event */ struct mutex mutex; void (*power_hook)(struct hda_beep *beep, bool on); diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 7f340f18599c..a794a01a68ca 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -4311,6 +4311,8 @@ static int stac_parse_auto_config(struct hda_codec *codec) if (codec->beep) { /* IDT/STAC codecs have linear beep tone parameter */ codec->beep->linear_tone = spec->linear_tone_beep; + /* keep power up while beep is enabled */ + codec->beep->keep_power_at_enable = 1; /* if no beep switch is available, make its own one */ caps = query_amp_caps(codec, nid, HDA_OUTPUT); if (!(caps & AC_AMPCAP_MUTE)) { @@ -4444,28 +4446,6 @@ static int stac_suspend(struct hda_codec *codec) return 0; } - -static int stac_check_power_status(struct hda_codec *codec, hda_nid_t nid) -{ -#ifdef CONFIG_SND_HDA_INPUT_BEEP - struct sigmatel_spec *spec = codec->spec; -#endif - int ret = snd_hda_gen_check_power_status(codec, nid); - -#ifdef CONFIG_SND_HDA_INPUT_BEEP - if (nid == spec->gen.beep_nid && codec->beep) { - if (codec->beep->enabled != spec->beep_power_on) { - spec->beep_power_on = codec->beep->enabled; - if (spec->beep_power_on) - snd_hda_power_up_pm(codec); - else - snd_hda_power_down_pm(codec); - } - ret |= spec->beep_power_on; - } -#endif - return ret; -} #else #define stac_suspend NULL #endif /* CONFIG_PM */ @@ -4478,7 +4458,6 @@ static const struct hda_codec_ops stac_patch_ops = { .unsol_event = snd_hda_jack_unsol_event, #ifdef CONFIG_PM .suspend = stac_suspend, - .check_power_status = stac_check_power_status, #endif }; From patchwork Wed Oct 19 08:27: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: 5564 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp350426wrs; Wed, 19 Oct 2022 07:13:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7RfdSkhiWct0IqmlWV82OQXBsrk4b2BKyi4ZaiqU5r/U6ehOHT0SifDJGe0ZQi91NU9IN8 X-Received: by 2002:a63:5b16:0:b0:439:ac9b:34b5 with SMTP id p22-20020a635b16000000b00439ac9b34b5mr7409283pgb.144.1666188818199; Wed, 19 Oct 2022 07:13:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666188818; cv=none; d=google.com; s=arc-20160816; b=JZPD6crohNx4asRoLkhMbGN9pGtink8TRlTFxLNDN2z2O197D0CahB5X8OKigRsfEc m3fjI9tYqO+RFEJnWIBGWsjuYOJHD9JqRWdVG+VGPzcsmuLDf0ynsNVFdLVe6GmYhnes ixuk79hR5kGPMinVMtNtUgktjwGskjC3jJc5BYyTv1/ZuQp5tnvcAaAjmyVtFhGdrXOB gcAJhr+vFf38nHlu+tQkDFte32g7H/q0hXyoa2lbzBx1DbXv7h3wsrL2nOcNAM9pOTRf GEQomn3T616Z9NVds42joESumEAXQE1ybkC2ojoAgrpAfPhjrTiUFObM+23UODX6ESMJ bVEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rHs9slV/GImFoBtRd71/vNDhv5IKg65k+hcXfdsWq20=; b=MEr1YwOa62Oxg+vWIncf21zn22Kmuig/vGzXiXCAoS0I9jNpzINA6tMypITqyA3Tzi Ib+JN7DA6HObqlN/LuxWklgnxAzLVhDTca3KfGm4BMAl1VxkNrSeZku+9kx04T5WkDXv Rryb94+iJwwHr22Ro5p5hmArhV7PSBvEvPAEMwpD/pcrbpYpYHOAE6+YQ2deNkRlHpDW zp+pRu5hM27AHvdVnl0t3VxN3D7UoCbscbwVm4qFGELirvM1aPTl2WA95b/hUb7ODZWN yarzJUqhq5rcrSSvoOZkJmzAVPZsjXfcXVG4+bTG7x0gMTLt2O/+WH9o5OavxN2EMFqE CAVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YjGzP9x5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a6557c6000000b00453f9620c4dsi19033504pgr.503.2022.10.19.07.13.09; Wed, 19 Oct 2022 07:13: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=YjGzP9x5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232351AbiJSN5T (ORCPT + 99 others); Wed, 19 Oct 2022 09:57:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233860AbiJSNyN (ORCPT ); Wed, 19 Oct 2022 09:54: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 E8DC816551B; Wed, 19 Oct 2022 06:36: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 EC667B82419; Wed, 19 Oct 2022 08:56:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45A82C433B5; Wed, 19 Oct 2022 08:56:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169805; bh=nvtaYVSKFDDYUb6/1fBbU9SEqDqsjhxHoNRXYfa+jfw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YjGzP9x5i0SA3Opuad1SSF0HeGbI50iuAMAftq9MRJRLNmz7GK7FQbxqPPEDA55Au rkzbhyzIIDsYLxj0lTecpc+YyKUiBTejPm4CymSg8DQ+i1nr0Rj79zOAlghN8Mnae9 TUEmZfwDZNjFDiwZdy/R21bmu4ZbfaPuOTyL2P8Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shao-Chuan Lee , Chia-I Wu , Gerd Hoffmann , Sasha Levin Subject: [PATCH 6.0 383/862] drm/virtio: set fb_modifiers_not_supported Date: Wed, 19 Oct 2022 10:27:50 +0200 Message-Id: <20221019083306.878330786@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747125605576863547?= X-GMAIL-MSGID: =?utf-8?q?1747125605576863547?= From: Chia-I Wu [ Upstream commit 85faca8ca0f659263b5fb2385e4c231cc075bd84 ] Without this, the drm core advertises LINEAR modifier which is incorrect. Also userspace virgl does not support modifiers. For example, it causes chrome on ozone/drm to fail with "Failed to create scanout buffer". Fixes: 2af104290da5 ("drm: introduce fb_modifiers_not_supported flag in mode_config") Suggested-by: Shao-Chuan Lee Signed-off-by: Chia-I Wu Link: http://patchwork.freedesktop.org/patch/msgid/20220831190601.1295129-1-olvaffe@gmail.com Signed-off-by: Gerd Hoffmann Signed-off-by: Sasha Levin --- drivers/gpu/drm/virtio/virtgpu_display.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c index 5c7f198c0712..9ea7611a9e0f 100644 --- a/drivers/gpu/drm/virtio/virtgpu_display.c +++ b/drivers/gpu/drm/virtio/virtgpu_display.c @@ -349,6 +349,8 @@ int virtio_gpu_modeset_init(struct virtio_gpu_device *vgdev) vgdev->ddev->mode_config.max_width = XRES_MAX; vgdev->ddev->mode_config.max_height = YRES_MAX; + vgdev->ddev->mode_config.fb_modifiers_not_supported = true; + for (i = 0 ; i < vgdev->num_scanouts; ++i) vgdev_output_init(vgdev, i); From patchwork Wed Oct 19 08:27: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: 4691 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp213115wrs; Wed, 19 Oct 2022 02:09:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5KqyCYT/Lfv0Wouymhab/1ZIx1h9pJaFqiUbuqyReS0O8UsuSerGOcRoLwG8OSHdi5ZK+I X-Received: by 2002:a17:902:a408:b0:184:cb7e:67d4 with SMTP id p8-20020a170902a40800b00184cb7e67d4mr7533339plq.90.1666170553738; Wed, 19 Oct 2022 02:09:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170553; cv=none; d=google.com; s=arc-20160816; b=GoPH9qP10xcsImcIZdUzq0BKalPRFkUU8FL+MitBBjNHfczo83zeSTC9lzyAbC7zuU HPAIMrrLK8gcqVYNGBkeZyYoHwtDB18zl9oEtLjrmhOyXL2eiF9bIEfkNv4o2dovzlsA d+tkfgPNS4qz2/42uQAdUS5diNgdt6Zh2VWQBwifIHD5YqzEewfKuutkMmhlVXfKgLZn 7qthjUSB+Bo8OYZAqtGkcVMvNDs12stnl3MPviNU27Dwiu55X4SaiVksBsVjTec/k+jY ASEoeCA2Cgsf18GbOmzIlbIA0yuqYoqYXp/EKIigOIod3ztJoDMQWMAYSgjJF/k4iUJw jxPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZOuFQqp/eAoerOV/pNHE2o3G3NiKkXqY8JPBhEmSRuI=; b=d9bRjhx+bqu/hcFuUJmNsnYf41HvbvwkcUGbxNbtRR174bCKc9ZaRkeenPKGbk/Bku mWwRQrm0PccaJG21qyaowGORf53Jd2Z6kdZlWmd+NRGwchkBJdJlEgNpa5Dy0ODszOb8 CwnC0PncNCFvYl1a9nc/GBIMK2OxAOlVc0bHkR5m2CkSPLMeE5QDfMqsi3f2e+7e117r xCfUvE8xA8JoTMsPLACFHPEwZJH68htxFcZPRztKwUfkycTZNtW+hVBzIWhOLAqLT5v+ ts3am2bRSaSgqX6PpyQ7ygxhSFvL7kXF8uc+FU/C4xnFD11WmJQpBM/rz1AHe6qu2NLT Y4Ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ys8Yign3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e16-20020a056a001a9000b0053f6f9b00b7si17588605pfv.81.2022.10.19.02.08.58; Wed, 19 Oct 2022 02:09:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ys8Yign3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232327AbiJSJFf (ORCPT + 99 others); Wed, 19 Oct 2022 05:05:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232357AbiJSJED (ORCPT ); Wed, 19 Oct 2022 05:04: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 7F9BF178AE; Wed, 19 Oct 2022 01:57:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5E2DB617E2; Wed, 19 Oct 2022 08:55:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6FF75C433C1; Wed, 19 Oct 2022 08:55:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169721; bh=nG8OzVzXN71yzbquDRImDzzcUiikGUcadds2QAZTzD0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ys8Yign3WC7rOeETlJShKxjMINcoD/UlBRV7oSq90MqU81AzpEmnT1FWlynpqu8bH W5Xh7EvbCDDZueackhlc9B2VMKx84OIkpOGfLlD3j9/mkugI6HUMI1L6cibfZvUpuL BoiFv0hrfJtOFxorun8VRQMezMPENqUfZPdkSbm4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gerd Hoffmann , Thomas Zimmermann , Sasha Levin Subject: [PATCH 6.0 384/862] drm/bochs: fix blanking Date: Wed, 19 Oct 2022 10:27:51 +0200 Message-Id: <20221019083306.919427450@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106454171444398?= X-GMAIL-MSGID: =?utf-8?q?1747106454171444398?= From: Gerd Hoffmann [ Upstream commit e740ceb53e4579a7a4063712cebecac3c343b189 ] VGA_IS1_RC is the color mode register (VGA_IS1_RM the one for monochrome mode, note C vs. M at the end). So when using VGA_IS1_RC make sure the vga device is actually in color mode and set the corresponding bit in the misc register. Reproducible when booting VMs in UEFI mode with some edk2 versions (edk2 fix is on the way too). Doesn't happen in BIOS mode because in that case the vgabios already flips the bit. Fixes: 250e743915d4 ("drm/bochs: Add screen blanking support") Signed-off-by: Gerd Hoffmann Acked-by: Thomas Zimmermann Link: http://patchwork.freedesktop.org/patch/msgid/20220906142957.2763577-1-kraxel@redhat.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/tiny/bochs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/tiny/bochs.c b/drivers/gpu/drm/tiny/bochs.c index 82364a0a7b18..490fa92a4dce 100644 --- a/drivers/gpu/drm/tiny/bochs.c +++ b/drivers/gpu/drm/tiny/bochs.c @@ -309,6 +309,8 @@ static void bochs_hw_fini(struct drm_device *dev) static void bochs_hw_blank(struct bochs_device *bochs, bool blank) { DRM_DEBUG_DRIVER("hw_blank %d\n", blank); + /* enable color bit (so VGA_IS1_RC access works) */ + bochs_vga_writeb(bochs, VGA_MIS_W, VGA_MIS_COLOR); /* discard ar_flip_flop */ (void)bochs_vga_readb(bochs, VGA_IS1_RC); /* blank or unblank; we need only update index and set 0x20 */ From patchwork Wed Oct 19 08:27: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: 4692 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp213119wrs; Wed, 19 Oct 2022 02:09:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7ZDLIts03qY+1RhlEH9HxjosVQv26QxQL5ubZNOrY8Mrajj6THljp3kRwizA4S+9PJCXNd X-Received: by 2002:a17:907:6288:b0:78d:ab30:c374 with SMTP id nd8-20020a170907628800b0078dab30c374mr5928144ejc.266.1666170554151; Wed, 19 Oct 2022 02:09:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170554; cv=none; d=google.com; s=arc-20160816; b=FCmAAl70a21fyto1SaI4Kk7E8FMLLmgLypSj/sSa89EyVT9irxWlMACI6xtY/3MwVP 6nWMn7Wxh2/Uos4YVwGDy36LKbzCWEnZCHOcl/RIGOSlsFaNcQPlapb7N/GgBf/pmEiX hwqZb/t15mOgJrICk66ATtiWdiS83CJqXRXhvIy+tcdyfGWo2aUmshGFZJN0HZOsVE0S rshG8E70kJcZlQXTOtYzj9MdcwMuHVgWe7EGRfOPnbHSqGXWW3MKwuqzhVp2ZER/Ts/T 5O1zkxpwnC/G7Df8jYbGWVe2ud3d5yjbnsyQpGbP+M/HIwz+JA9QzK8VMV3tXlqj0bs7 RjwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Bx+gVl9G8CLTUbn8ez1G2zqGSmu1HBhpGKAX6h3AONc=; b=sL6itoH7t/we5tfR2AfgViG7RBnhFA1VyzLZjdHN6SzyyLYiEij3VD3mIg8tcDL2MH dJAoH09vuT3bBoGd7H03cxgjC0XVTZflKX4Q5g/qm1ymXJvHtkuxv+fTPYpNbJnU8q/4 b3Y6sMdsebvtT5lAiUEtWUJd6CKc9RwDL7tHZUH6DdlXCW5KHN5Zw+xlU2zVzWor3QDf hd8I1WQQYj6qtm5irHR3VFJOF+5ykKO6qLByvWNlfdxQOnbJ7+YVBPMv1uyRyNiHuuHc zai7I1ZovtSnlWpN7BqpxXtYD0CrUDXL7xjeaf88Q3bk0i4TYi0/7X6Fpsq8soeGyVvK DbYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uIDRrTBr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z5-20020a056402274500b0045c13366de4si15580948edd.572.2022.10.19.02.08.48; Wed, 19 Oct 2022 02:09: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=uIDRrTBr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232347AbiJSJFg (ORCPT + 99 others); Wed, 19 Oct 2022 05:05:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232353AbiJSJEC (ORCPT ); Wed, 19 Oct 2022 05:04:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF98FA6C00; Wed, 19 Oct 2022 01:57: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 EF49F61834; Wed, 19 Oct 2022 08:55:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E6CBC433D7; Wed, 19 Oct 2022 08:55:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169724; bh=hvGvUU9CEjWIrKx8lFqFQJsfFIqXXtdKrx+cM1+mxxM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uIDRrTBrWFdGav36awmYBbuhyUrBKHga2rkzBH6Zu72WB1ymOnym7KhFcktL9iTmt 78tTQjokZpchU6+i1AfnLsnsSCJV16TDNEU38NHF8dCs22coJvpkM//HLrQxdlHSJc F0TqUn4/lqPoOCTyRtJehqTKPRTsatvbquh4YI4o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, AngeloGioacchino Del Regno , Mark Brown , Sasha Levin Subject: [PATCH 6.0 385/862] ASoC: mediatek: mt8195-mt6359: Properly register sound card for SOF Date: Wed, 19 Oct 2022 10:27:52 +0200 Message-Id: <20221019083306.967386159@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106454860758276?= X-GMAIL-MSGID: =?utf-8?q?1747106454860758276?= From: AngeloGioacchino Del Regno [ Upstream commit 64ec924c781ee846bd469be8d1d6bbed78c0f439 ] Adding a probe callback on this snd_soc_card is required when Sound Open Firmware support is desired, as we need to appropriately populate the stream_name for SOF to be able to bind widgets. Failing to do so will produce errors when applying the SOF topology leading to card registration failure (so, no sound). While at it, also make sure to fill the topology_shortname as required. Fixes: 0caf1120c583 ("ASoC: mediatek: mt8195: extract SOF common code") Signed-off-by: AngeloGioacchino Del Regno Link: https://lore.kernel.org/r/20220906092727.37324-2-angelogioacchino.delregno@collabora.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/mediatek/mt8195/mt8195-mt6359.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sound/soc/mediatek/mt8195/mt8195-mt6359.c b/sound/soc/mediatek/mt8195/mt8195-mt6359.c index c530e3fc27e4..961e769602d6 100644 --- a/sound/soc/mediatek/mt8195/mt8195-mt6359.c +++ b/sound/soc/mediatek/mt8195/mt8195-mt6359.c @@ -1383,7 +1383,13 @@ static int mt8195_mt6359_dev_probe(struct platform_device *pdev) sof_priv->num_streams = ARRAY_SIZE(g_sof_conn_streams); sof_priv->sof_dai_link_fixup = mt8195_dai_link_fixup; soc_card_data->sof_priv = sof_priv; + card->probe = mtk_sof_card_probe; card->late_probe = mtk_sof_card_late_probe; + if (!card->topology_shortname_created) { + snprintf(card->topology_shortname, 32, "sof-%s", card->name); + card->topology_shortname_created = true; + } + card->name = card->topology_shortname; sof_on = 1; } From patchwork Wed Oct 19 08:27: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: 5079 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp249367wrs; Wed, 19 Oct 2022 03:46:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5YtplilVYJVeCcOAM3fcUu5uNnsoJIroPcOrSbYhRmpYGveitvwe4zeUgk7ncM9jV5n7x7 X-Received: by 2002:a63:e544:0:b0:462:2c80:f521 with SMTP id z4-20020a63e544000000b004622c80f521mr6348793pgj.549.1666176360880; Wed, 19 Oct 2022 03:46:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176360; cv=none; d=google.com; s=arc-20160816; b=JsAD+nhx+jber69Y8YG4czxpOYaQw9N5MNZkdOhkfgV6iP/hDu25p0/EnG1D7eI5Xk JnfI4I/vcPbWJo9xRR9Ef+kZQKaj4eg0koJAKfjopZorxv2rMG3ATd7fudbIYn0iXKBU QV82LvzrZyla807eTVUfrhmFSgMoD33KIBd0/vt0mg9/yIwdSDbAaQkut4dYyGrSoAgI ndpDAsmAGxYsvNJv8E/kC51wxWkdai7pHpB+fjI4j+q8ZH3EYzkEf6x+DuuEjO8y1awa rxP0Wws3skgfIt6PxaaYU6U772/LbevW55uPIPuTNRvWlJBdnVzRDiof+9gNS2vr9Cvx SfHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3D1vLl8BYMp6lxegwhuA11AYT1ZH5+OSaVryJJZA8b4=; b=uZdBKHF0+rNObj3i5N9492s+YLt+/m1Gegy356qxu6Z/Xq1UoByMgULkLpjT+4+Ll8 45IFjjdyFhaDYj0QcBpCc00agbNgXkN9E4BLiodtHj8qOu4V40kKHgEyG9OCnzWqqDED ws0UeXDJKwcLNoyjfxUMxmmLlfYbu5WOdIquFxYEXr+J6c8Xsdqbpt2phXLR/w2jhIpK uq+tCix/Kob1LIZGNK488aujJ3Ma0gB95369xxIQKrO8Xm6tP4mgPv7pQHnSH/hLgA2g vA33E+/neKRlTGQlzqKUy9Lu0h2Zspt22Ac+SYa+rQIe6tdM4fQiu7Qf0gJJ+5ZBkhe+ VKsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=y4lV0eDm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pm16-20020a17090b3c5000b0020d887ded6esi16338983pjb.120.2022.10.19.03.45.43; Wed, 19 Oct 2022 03:46: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=y4lV0eDm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232795AbiJSKp2 (ORCPT + 99 others); Wed, 19 Oct 2022 06:45:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232556AbiJSKno (ORCPT ); Wed, 19 Oct 2022 06:43:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99FCB1EC75; Wed, 19 Oct 2022 03:20:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2F1EFB823C5; Wed, 19 Oct 2022 08:55:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A122AC433D7; Wed, 19 Oct 2022 08:55:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169727; bh=T1lHPrYrwyqqpQ7QyucnPPp8EabRh658GuwlWjh8TFo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y4lV0eDm5/HWtJDgKq+sC0AYJATWPH7757m+RZuDfWuM6jldErDSfoZLs5MENlt9j OBtPROUJV6+VD+j2Oy8vzlXVCKtejJ3/a4eJ6Jpc7n41G2lY+japcnpb0KlUQXOc3G CDj0jBfphAs2UWKwtkfPsqlrL+p0Ppt16cCleqtU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, AngeloGioacchino Del Regno , Mark Brown , Sasha Levin Subject: [PATCH 6.0 386/862] ASoC: SOF: mediatek: mt8195: Import namespace SND_SOC_SOF_MTK_COMMON Date: Wed, 19 Oct 2022 10:27:53 +0200 Message-Id: <20221019083307.011781861@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112543343690726?= X-GMAIL-MSGID: =?utf-8?q?1747112543343690726?= From: AngeloGioacchino Del Regno [ Upstream commit 404bec4c8f6c38ae5fa208344f1086d38026e93d ] Here we're using function mtk_adsp_dump() from mtk-adsp-common: explicitly import its namespace. Fixes: 3a054f90e955 ("ASoC: SOF: mediatek: Add mt8195 debug dump") Signed-off-by: AngeloGioacchino Del Regno Link: https://lore.kernel.org/r/20220906092727.37324-3-angelogioacchino.delregno@collabora.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/sof/mediatek/mt8195/mt8195.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/soc/sof/mediatek/mt8195/mt8195.c b/sound/soc/sof/mediatek/mt8195/mt8195.c index 9c146015cd1b..ff575de7e46a 100644 --- a/sound/soc/sof/mediatek/mt8195/mt8195.c +++ b/sound/soc/sof/mediatek/mt8195/mt8195.c @@ -652,4 +652,5 @@ static struct platform_driver snd_sof_of_mt8195_driver = { module_platform_driver(snd_sof_of_mt8195_driver); MODULE_IMPORT_NS(SND_SOC_SOF_XTENSA); +MODULE_IMPORT_NS(SND_SOC_SOF_MTK_COMMON); MODULE_LICENSE("Dual BSD/GPL"); From patchwork Wed Oct 19 08:27: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: 4727 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214068wrs; Wed, 19 Oct 2022 02:11:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7LwNzXfSuhNlvYUT1pv1l4JEaudhWjeWFh5u5/Kno+y6eEmNXlliMV/huVZPtiBWEddp2V X-Received: by 2002:a05:6402:c4d:b0:457:99ec:1837 with SMTP id cs13-20020a0564020c4d00b0045799ec1837mr6392593edb.86.1666170709597; Wed, 19 Oct 2022 02:11:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170709; cv=none; d=google.com; s=arc-20160816; b=PXJHcU9cCcbaMI+6MYOaXHyJ5SoYxJG/B/q9uh3IHcP5K0RDp6JwncwUCH3LuDBbLv LKnAYh6NWpueMSdlxT4EFJR6HC6ldLMcfKOBR1F156gxMimhLkixp7PvBidRmmSFsm3H 5NoM8sR43ucee75dM3GnPP7rygbiLiQtdP4Db34RCXeBzoxUDm3PaJ2o4n1oA8wXqdbA ovPCOziEmbMIuZ96zgOXoDk/QEb+g9viY/FziU6VU1HS2ANh+3KHdxZuvw5XykDpTDfV /ItdKpkTEFV5hMwedxb72dvx5rKi/sgQB8I7KqWn5aQuqNzcwRcQ4YXOt1paQfSVDevp 5KsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UC5xUnD5vN2q0wJSEAC9uPW+rEyu7hJbWyi7VoOERw0=; b=Uu1DZa3aeGb3kMpz2UGn4b25AIrN/HeUxufO9gy4Q6U+D+92nYFVLeZ/85oJxrzE9J TRF38RJKJkBcbc728Kj8fQWOaAzZr9m+di429eBKPrzprC+IqkevZ507J04oAwuH+hO/ +7vEU7QOqWOw1f742eBZrwlLlaN4aBBeSRDIAH/uLoug9BgDoPEPsGcDaJBI63unI86E tuKquzK/pW1sBtbV7vaSOwZDlU8Ee17km4rehqdRCi6Cmsj8kD4TSuK10Ixe57fsph/i Ii+zTVN/nVTQVAXJ8Yo1KoRXjxnvJYykLyqYEUtcv6Ggv9JrkCUwv7LY8jI8328vjG62 CQQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JuZjoa4z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y102-20020a50bb6f000000b00459aa5aafaesi13389488ede.429.2022.10.19.02.11.23; Wed, 19 Oct 2022 02:11:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JuZjoa4z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232334AbiJSJIR (ORCPT + 99 others); Wed, 19 Oct 2022 05:08:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232318AbiJSJFb (ORCPT ); Wed, 19 Oct 2022 05:05:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADA63F02E; Wed, 19 Oct 2022 01:59: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 227C86183D; Wed, 19 Oct 2022 08:55:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35D80C433C1; Wed, 19 Oct 2022 08:55:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169729; bh=Qx7YqYDAslYo7Yv+XWnm5lJu4CbNEUcbSjGorjTbQ7k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JuZjoa4zuAWdGBvIRWugUeMDTR9iIBtHE+HPFbfdjn/bqk3t6y+dfVAt33H0W5nQ9 fQRyyp5sU7H0Nwe+z+qaI1If9EMThw76sEvRMe9tbbGJD596k2Qasjpxo6qXrtnlBs bUH0ev1w/pJQxKIqvh6QDpSo4MpoPBjejJ4w3tRI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Tomi Valkeinen , Sasha Levin Subject: [PATCH 6.0 387/862] drm/omap: dss: Fix refcount leak bugs Date: Wed, 19 Oct 2022 10:27:54 +0200 Message-Id: <20221019083307.050938061@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106618189367812?= X-GMAIL-MSGID: =?utf-8?q?1747106618189367812?= From: Liang He [ Upstream commit 8b42057e62120813ebe9274f508fa785b7cab33a ] In dss_init_ports() and __dss_uninit_ports(), we should call of_node_put() for the reference returned by of_graph_get_port_by_id() in fail path or when it is not used anymore. Fixes: 09bffa6e5192 ("drm: omap: use common OF graph helpers") Signed-off-by: Liang He Signed-off-by: Tomi Valkeinen Link: https://patchwork.freedesktop.org/patch/msgid/20220722144348.1306569-1-windhl@126.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/omapdrm/dss/dss.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c b/drivers/gpu/drm/omapdrm/dss/dss.c index 0399f3390a0a..c4febb861910 100644 --- a/drivers/gpu/drm/omapdrm/dss/dss.c +++ b/drivers/gpu/drm/omapdrm/dss/dss.c @@ -1176,6 +1176,7 @@ static void __dss_uninit_ports(struct dss_device *dss, unsigned int num_ports) default: break; } + of_node_put(port); } } @@ -1208,11 +1209,13 @@ static int dss_init_ports(struct dss_device *dss) default: break; } + of_node_put(port); } return 0; error: + of_node_put(port); __dss_uninit_ports(dss, i); return r; } From patchwork Wed Oct 19 08:27: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: 5410 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp314031wrs; Wed, 19 Oct 2022 06:03:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5hE4TnUUp9iP7qbNlIaTCgtpFym7R7pEjui2b71vRCMUHwrcHlPz1UpPfBviMaJTnOIcs7 X-Received: by 2002:a17:902:ea03:b0:180:b53f:6da with SMTP id s3-20020a170902ea0300b00180b53f06damr8174969plg.69.1666184635643; Wed, 19 Oct 2022 06:03:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666184635; cv=none; d=google.com; s=arc-20160816; b=DPeZqJWR3TjmyFSf9pQlP4hKuS2ie2kZ4eHT1sVJCtXi0UPzmsi2PZu5TxgH/7N0N2 KAp/Urk4B7vdOqC5D0m2RT/X3QEzF++UTcB2Xl/qrtlgBtl0gWXO1pIUPpbqLmMh/YXf HQ1q8YMgYi+7dT7Wmry9DqCL5kdh/3+PD52eZ56K300oICJb+m8wO29bed09APP5iQD2 nkE94zv5pXzcwa6PuwuvEvzMenxe5VjAtkH99jnqIKDLviECtTPuusG3J1CZ6x2/bBWP aWl03kJncT+WSomrJvutq72A6jMMmyRsxUL0YhpT4fY+DHjHv5z+0SJYY8TX2cxcsbdA 53Jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1YonGDuxTykbpBZw6O+8s4iU2LYS4Uoi+w2jdXPEw38=; b=NN84Bg6OT/u3+m1ciCK+i5cjUAJz58soesjsx2cg/wYMqYCFIn2dQ5zN1Na9dLUx8X PNF9dhuWO8VYHQ9ZoEZSXLFQQos99CaiyuWWYmpTB0jC5SvyxMDX8A4rJopZndQC+mJx C+BD94gHHsH7QU4d4QHDjb/AZ6n8GDudTA/I2urYL7NyDenuNb+ZsUSXNrUVSdbaqSG3 a87JDqNI52RvRTuQ2U+o7nzufqwzgVhg9VlhsAiBd2ioqO+tgeaO2t0n0l6QlIB5SXtT m+pvi9whqUcy8E25jmEuvgpaaK9jLxeDwDoeoSN1B73Es1Wm0+pN5riW6a/bhoSO1k9b mkEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Kf84WDqf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c8-20020a170902d48800b00177e5c1d5d0si19175612plg.347.2022.10.19.06.03.21; Wed, 19 Oct 2022 06:03: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=Kf84WDqf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229956AbiJSMyc (ORCPT + 99 others); Wed, 19 Oct 2022 08:54:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233670AbiJSMyN (ORCPT ); Wed, 19 Oct 2022 08:54: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 E1E4AF9854; Wed, 19 Oct 2022 05:37: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 A4457B823CD; Wed, 19 Oct 2022 08:55:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD429C433C1; Wed, 19 Oct 2022 08:55:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169732; bh=qv9KGEdx0BBKOTuqWLd9oCsaYDbi4aharn99WByuFE8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Kf84WDqfvjt2ZtidE0P+ae1Be+ftOCyBPc6q3JX/KP3mODg89FBFtZ/GdeneyW798 yzWLMyGLxrI9aPeem6iylEutj/p2AnQoiXVNdxT8RsIOmVEG7fpO7+Z1QDWpIfcMuN IeEBlgruF27ZYYfnBZO0gqdeyQlrZkcn4bFjgi7g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rafael Mendonca , Alex Deucher , Sasha Levin Subject: [PATCH 6.0 388/862] drm/amdgpu: Fix memory leak in hpd_rx_irq_create_workqueue() Date: Wed, 19 Oct 2022 10:27:55 +0200 Message-Id: <20221019083307.092290866@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747121220355136352?= X-GMAIL-MSGID: =?utf-8?q?1747121220355136352?= From: Rafael Mendonca [ Upstream commit 7136f956c73c4ba50bfeb61653dfd6a9669ea915 ] If construction of the array of work queues to handle hpd_rx_irq offload work fails, we need to unwind. Destroy all the created workqueues and the allocated memory for the hpd_rx_irq_offload_work_queue struct array. Fixes: 8e794421bc98 ("drm/amd/display: Fork thread to offload work of hpd_rx_irq") Signed-off-by: Rafael Mendonca Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 6e36427aab46..194142c581c8 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -1296,13 +1296,21 @@ static struct hpd_rx_irq_offload_work_queue *hpd_rx_irq_create_workqueue(struct if (hpd_rx_offload_wq[i].wq == NULL) { DRM_ERROR("create amdgpu_dm_hpd_rx_offload_wq fail!"); - return NULL; + goto out_err; } spin_lock_init(&hpd_rx_offload_wq[i].offload_lock); } return hpd_rx_offload_wq; + +out_err: + for (i = 0; i < max_caps; i++) { + if (hpd_rx_offload_wq[i].wq) + destroy_workqueue(hpd_rx_offload_wq[i].wq); + } + kfree(hpd_rx_offload_wq); + return NULL; } struct amdgpu_stutter_quirk { From patchwork Wed Oct 19 08:27: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: 4709 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp213823wrs; Wed, 19 Oct 2022 02:11:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5OufTeTD2tJzRdldsUPo0PsSxqeTHWqF7x6g05uujeB16X+IOKC81V+QIH6NkqztpVL3ln X-Received: by 2002:a17:906:8a55:b0:78d:b6db:a2d4 with SMTP id gx21-20020a1709068a5500b0078db6dba2d4mr5903336ejc.82.1666170659576; Wed, 19 Oct 2022 02:10:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170659; cv=none; d=google.com; s=arc-20160816; b=IdY0tlJE5srDeNAaL8H+zlZI7AOGXyNsG5kszdOWCAtF8YOtZnkP+edJibf/8TMFVW iC7M4lvq/RKmrj5eYTP7b/blxqhSBlg8zqEfRA6DOMxOTySSAfxmllw7Ve75GV9KU67h k5WWiJgc/tvsRWIQGLc0aULHUJtivUJekQj8eYKn+HHp6KLIod1zXefp3u/xE1cPku8K lRu2fDj9VhQ3YhmAXxbyfcpPwKlocuSMdJyExhDRuBlzq2KuHnC0kEUFKcpsqC2k1Q27 xxw3ncb9y9fwhH+nABrkInkDsJPObYNXNvqh6FzzsPPkQA6AfUFRhv7wkpmP6+ijkfUS EQmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bZ6WRl8TTvWfqx1TSSuyhFXXQNe2esm+8LhrQ7zciA0=; b=GXS99gT7atUtSw5FMozYTlM9f5cpBJA+syGttX0gJMQ1YAFz+oUdjeP8xF31M0Tp0c 7KdO54LyfKJT7RtWnboIzBjs/VuOz7rdd/4lxHTuaQrWgXxLT//YzYpt+6H03n/IOWfK Tmi4/BFGb3AI5nYYPlRMVCRUhC3ZUxkxhQaFYgpbxHfR607NZPIZDrIj4tJK6mtRACt/ A01rE7andAsLbUphEFdBA4GcE3n6Pd6FD+nMNKGmUzPfSDQGDXrc+khf3yZlpGb2TqU/ hyIWtAM9b6kMRFYW/oV9qKK5SIq23rW9dwSD3z4eNxptmfCI7m8q0H3ewnVZAADmpGws ngYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aJFgXf7O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gs8-20020a1709072d0800b007825337afeesi16059954ejc.273.2022.10.19.02.10.33; Wed, 19 Oct 2022 02:10: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=aJFgXf7O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232382AbiJSJFv (ORCPT + 99 others); Wed, 19 Oct 2022 05:05:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232416AbiJSJEN (ORCPT ); Wed, 19 Oct 2022 05:04:13 -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 DBA15A8352; Wed, 19 Oct 2022 01:57:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 904FF61851; Wed, 19 Oct 2022 08:55:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A13DDC433C1; Wed, 19 Oct 2022 08:55:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169735; bh=goNWUmtCyQy3LmAC5CpO9eeEFfx49WATQu4/du69dXg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aJFgXf7OQHapWD5XcM5TNpKGH4ozFCHsbkmvIgTxJEvytG+6Zkau0uF5qqLHAP53S /OwPER1Y+icsXwbHhB3En84b0sN8CGh0q3w0TqBoHF68CPihS1vHYqTXl9jfFRAmeB DaP4hwpYsosMlcYVPLnXYK9fe6y13z6LsMEFETyQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Judy Hsiao , Brian Norris , Mark Brown , Sasha Levin Subject: [PATCH 6.0 389/862] ASoC: rockchip: i2s: use regmap_read_poll_timeout to poll I2S_CLR Date: Wed, 19 Oct 2022 10:27:56 +0200 Message-Id: <20221019083307.129986122@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106565750330474?= X-GMAIL-MSGID: =?utf-8?q?1747106565750330474?= From: Judy Hsiao [ Upstream commit fbb0ec656ee5ee43b4b3022fd8290707265c52df ] Use regmap_read_poll_timeout to poll I2S_CLR. It also fixes the 'rockchip-i2s ff070000.i2s; fail to clear' when the read of I2S_CLR exceeds the retry limit. Fixes: 0ff9f8b9f592 ("ASoC: rockchip: i2s: Fix error code when fail to read I2S_CLR") Signed-off-by: Judy Hsiao Reviewed-by: Brian Norris Link: https://lore.kernel.org/r/20220914031234.2250298-1-judyhsiao@chromium.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/rockchip/rockchip_i2s.c | 41 ++++++++++++------------------- 1 file changed, 16 insertions(+), 25 deletions(-) diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c index f5f3540a9e18..28c86f5e435e 100644 --- a/sound/soc/rockchip/rockchip_i2s.c +++ b/sound/soc/rockchip/rockchip_i2s.c @@ -126,7 +126,6 @@ static inline struct rk_i2s_dev *to_info(struct snd_soc_dai *dai) static int rockchip_snd_txctrl(struct rk_i2s_dev *i2s, int on) { unsigned int val = 0; - int retry = 10; int ret = 0; spin_lock(&i2s->lock); @@ -163,18 +162,14 @@ static int rockchip_snd_txctrl(struct rk_i2s_dev *i2s, int on) I2S_CLR_TXC | I2S_CLR_RXC); if (ret < 0) goto end; - regmap_read(i2s->regmap, I2S_CLR, &val); - - /* Should wait for clear operation to finish */ - while (val) { - regmap_read(i2s->regmap, I2S_CLR, &val); - retry--; - if (!retry) { - dev_warn(i2s->dev, "fail to clear\n"); - ret = -EBUSY; - break; - } - } + ret = regmap_read_poll_timeout(i2s->regmap, + I2S_CLR, + val, + val != 0, + 20, + 200); + if (ret < 0) + dev_warn(i2s->dev, "fail to clear: %d\n", ret); } } end: @@ -188,7 +183,6 @@ static int rockchip_snd_txctrl(struct rk_i2s_dev *i2s, int on) static int rockchip_snd_rxctrl(struct rk_i2s_dev *i2s, int on) { unsigned int val = 0; - int retry = 10; int ret = 0; spin_lock(&i2s->lock); @@ -226,17 +220,14 @@ static int rockchip_snd_rxctrl(struct rk_i2s_dev *i2s, int on) I2S_CLR_TXC | I2S_CLR_RXC); if (ret < 0) goto end; - regmap_read(i2s->regmap, I2S_CLR, &val); - /* Should wait for clear operation to finish */ - while (val) { - regmap_read(i2s->regmap, I2S_CLR, &val); - retry--; - if (!retry) { - dev_warn(i2s->dev, "fail to clear\n"); - ret = -EBUSY; - break; - } - } + ret = regmap_read_poll_timeout(i2s->regmap, + I2S_CLR, + val, + val != 0, + 20, + 200); + if (ret < 0) + dev_warn(i2s->dev, "fail to clear: %d\n", ret); } } end: From patchwork Wed Oct 19 08:27: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: 5035 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp246778wrs; Wed, 19 Oct 2022 03:39:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4YWRLXrNZ0rKrt4nOXoC3PWCSCmCmeP9AcyNKUUCV4Ayoyoownxf2uJZfxorJWhGnRiSbw X-Received: by 2002:a05:6402:400d:b0:45c:9a5c:444a with SMTP id d13-20020a056402400d00b0045c9a5c444amr6679000eda.283.1666175947971; Wed, 19 Oct 2022 03:39:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666175947; cv=none; d=google.com; s=arc-20160816; b=Bzd20BrpvTHtOJhOoOYkSmxIiAuIux3YjJOdJ7s750DJ2jY80q2kzHz3ToUDu6PVRd a2gMLd/QkqktrVT6KEeRbjVlhnLXtigbORVVhiSsRwvHfRXpDtHaCaEPVhbFPygQtoOu 8z9kzrZZ8DZZCAz4HV0vfEenPmXiZtrzti8+Yr29dGIRUyGgz43bVy7++wzZoA/B3odS wS/xq/+rj5+TAsgzZC0E5Lb5gev4UYwwxEwnHPb31pR6FYm95DW7cSuDVJzOloncN0ce lG9i5ah0FxPLbKfr4nf6NjxT1F5QJ8MW9PzahTlTlwecS5q9TTp/jDn/3td2C53xYL6n AlgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=U6nWnqz9KWoXfskAhzpsF2EhfEB0Sft67m14RPU65sg=; b=fPr55BRekXfiD1efLUDxZNJKwpENmuqeimpUBgQmKGqrjDYK7/ttwyVaVASKzmfvzt 5gzYyTBea2XUW8Hd5HNOwA4XKcdc9wFYm7sdF1RdJSw71f5tD7t3tAnxKoGu9uN8/Kha 6YcqWv5e5cySGAvnev9YxL7nhGlQTOY/IBYzbo1a4XNgZJu7q2KNHv8deTbnET0GVZL0 pVh+WSSkl0qglEb3GFnxnFSosc1Y25YOZ95n3qyPtdPWtlzj9CYEEeD+k8yd4mWVLfw2 0Cx16uvH34yO9Mu4oEkAYvtPp1uErKjseXBmTJ0vwhaFsog3UV7PllSf/DEI+fx/pc/j QDcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="HO+5ne/a"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w23-20020a50fa97000000b0045853b3a802si12738258edr.605.2022.10.19.03.38.43; Wed, 19 Oct 2022 03:39: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="HO+5ne/a"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229508AbiJSKhs (ORCPT + 99 others); Wed, 19 Oct 2022 06:37:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231401AbiJSKg6 (ORCPT ); Wed, 19 Oct 2022 06:36:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2067D616F; Wed, 19 Oct 2022 03:15: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 DC579B823DF; Wed, 19 Oct 2022 08:55:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3EEAAC433C1; Wed, 19 Oct 2022 08:55:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169737; bh=CUPY4O+CKLsV9H/zO+hL/T9LV5w7NgSzOSfvf/6/Fb4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HO+5ne/aJePTmAcme+hgr9D8YnqsLcX3s+yTxx+q6I/syTNxZks4jvJnXHEdraJvK HpKXfOcrtiCyhIJn150znpqsgJZj2lkT9lR9ZY/IGqQjL3y4GiYnsNfsk+c4MhLSBt AWuAbuMO0yf7dyuf8WIZKWPQqA8tf/R5ktE5Mclk= 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 6.0 390/862] mmc: au1xmmc: Fix an error handling path in au1xmmc_probe() Date: Wed, 19 Oct 2022 10:27:57 +0200 Message-Id: <20221019083307.178846774@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112111134856995?= X-GMAIL-MSGID: =?utf-8?q?1747112111134856995?= 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 a9a0837153d8..c88b039dc9fb 100644 --- a/drivers/mmc/host/au1xmmc.c +++ b/drivers/mmc/host/au1xmmc.c @@ -1097,8 +1097,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 Wed Oct 19 08:27: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: 4836 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223685wrs; Wed, 19 Oct 2022 02:38:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4b84cEek3ybaXocujUfrTZJMDh1Hb/S9GfMlTcmQSt9Gf+2qNZuICy+wBUeNI/Kwo7lpSD X-Received: by 2002:a17:907:3e01:b0:730:a690:a211 with SMTP id hp1-20020a1709073e0100b00730a690a211mr5922653ejc.596.1666172291347; Wed, 19 Oct 2022 02:38:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172291; cv=none; d=google.com; s=arc-20160816; b=dAqaKsFyBsxhhJ0sZHY0y5TiZGaZ/+FlSJUAiIfVrCNO5bVON9au5yi0Rf/sdytQb/ tFQhYS/Qle5Q1ke92qW7CZQ/fSY6ppd/QVbfe8yLtVvpGaXtcWgcgmokfC7Nko14F3fj yNv52PJlm/F8CqVMjuhcovxAPAzWXhtZwHQCqFNUziBWO2JdqUQbqIy0BcNoguh/HVkf WvDip0jt7JOIBhvRY6KAhXbAUkxef+KHofdjpO8wdIlsuEnQE1FDtk/1pkwcmESu3Ahl YUyhvQdTcinavgAfet7ydYo2/XRzadO2kk7IDcJHqghJZLVLaNe+uN0fxmqraC5vF0Qq gdhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZeIJKrwyPc0cOIgWlTV2wtQrElNlHhj6dlq4k//Eb3E=; b=sxOVfW3OOYlrHFp/3hRY0qR7oFsNDMVWW28wMCNGdRMsWPEUseAcsezyPR+dl/NyPw 8i5DwhSaAVCRrFQoGO0w6nBiOq+KlWTx2VIBnGUgh2EiUujbcGRUxpNPHv49E6DJdBJY T69ACFFhXxFtDukYxBT4FPtht2kqCufn/DHzMe3vj/leKwQMKql0JBtJFiYTgcLo9SEI 4/PJBk4R0X+Li4lGFs6NPD/lXUX1GjNQnGgs8uUYT5V+ABOLPR9AbZOmE5cfUw8y+QD7 OGZF/0j5346nXKr+dcdzRg5loUV87bmbAoiKcgkRjMCVYqKXOL4vYPwgJgmHLxqcKz38 9D5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rMcApPyN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f13-20020a0564021e8d00b0045d4a88c735si12811214edf.220.2022.10.19.02.37.43; Wed, 19 Oct 2022 02:38: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=rMcApPyN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233386AbiJSJVI (ORCPT + 99 others); Wed, 19 Oct 2022 05:21:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233655AbiJSJTu (ORCPT ); Wed, 19 Oct 2022 05:19:50 -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 1670EDEF0D; Wed, 19 Oct 2022 02:09: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 E041D6174E; Wed, 19 Oct 2022 08:55:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C67FAC433C1; Wed, 19 Oct 2022 08:55:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169740; bh=dNMunzMMumve21E4L5a/WJb3XjIry962Cna+gvU05lc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rMcApPyNEP9J1t6y4WeQmsji6DiNXW1DDnVkXGcfPNAGAtN5jF1nsrPKWyKB4NOX8 CEagxIW5zvg66zC1NN2vHJxizX1mXOMkJ6VlIKaEqdRuAHij8VpqhWLdSWr8CvKFqM 6k1597u6Jz9V/vdv1J5eAYyaOohEN7dgrjcSU7tI= 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 6.0 391/862] ASoC: eureka-tlv320: Hold reference returned from of_find_xxx API Date: Wed, 19 Oct 2022 10:27:58 +0200 Message-Id: <20221019083307.220188469@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108276636788258?= X-GMAIL-MSGID: =?utf-8?q?1747108276636788258?= 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 8b61582753c8..9af4c4a35eb1 100644 --- a/sound/soc/fsl/eukrea-tlv320.c +++ b/sound/soc/fsl/eukrea-tlv320.c @@ -86,7 +86,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) { @@ -143,7 +143,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 | @@ -158,10 +158,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; @@ -178,6 +179,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 Wed Oct 19 08:27: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: 4694 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp213184wrs; Wed, 19 Oct 2022 02:09:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5C4edI257+8oybEr/MsIKJ6HVNQOsk485L2fG3KP8NuvXwmXf/hKM5xMGEF198rGLz2moK X-Received: by 2002:a17:906:4fc3:b0:72e:eab4:d9d7 with SMTP id i3-20020a1709064fc300b0072eeab4d9d7mr5778232ejw.599.1666170564306; Wed, 19 Oct 2022 02:09:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170564; cv=none; d=google.com; s=arc-20160816; b=EPGETMUlNI78tzdQDDXVsAxMNJo5PzzTcZx0+4rb1tFDBSLE0C5IKRjw/AfKhU/hAY pK82I/oLMycnoLR7tH8JN4cnnnCeO7sfUwK3zOWAnY76gXFNjWUJ6qhtsn7g29iCSUcn fe0VlTw5ISJaPhKI4Y5p+zJxVZGNMdVMXKDpVlwF4xitTck47lVK/LzADCgx4scy//nI AAm3vex7dxzXpDS5Gw4YmYm9yWGRCmOnPSADkuVJOd2JJfunjJKNA4YBFueWDqA+cNjr uy83uuyIHr9jRjzbsVMnHTAvNUWBene61Z8PcxIAtOzXYCYRFzhvrj32XlvfuVdIfhuc pEiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0MLVJ2ke6JnGVr1poqmLYNzDxeQNPOGtSN4yvFsFyQs=; b=rmIL63QVfQgeVBdzKmBfqNwfJE9wqkY2c3EL2DdnI90rUID2AVoI9/cTSYDHSINnEi hqp3W4t6gAefUp4Z+BJDNml6DwkbKJmQMCspCjXORyVBRdfCYqjSWP597kP1BUowufMy s8QcwDfW14sWtqfm4b+G5kzhkG7upUzlhqEk7gHFBvFDpbxLx3m6yy/EAI3gM4tJdy5N XxWTKxxpbiTKlFK0JSK0PyO8fKeUtv7TuDJSxIORCufN2KVOOUaLMfL5CD6yDaV4KtAJ W9zwWAfG6uRXK9dbWmzlVwmB8WMUy13EpxCwI56dvczYx5se9gTnWMJfuyMZoFOVNeIr XHkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=N4TDzIjn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i4-20020a170906698400b00783d969f318si12387963ejr.253.2022.10.19.02.08.56; Wed, 19 Oct 2022 02:09: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=N4TDzIjn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232366AbiJSJFt (ORCPT + 99 others); Wed, 19 Oct 2022 05:05:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232418AbiJSJEN (ORCPT ); Wed, 19 Oct 2022 05:04:13 -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 4AE89A8363; Wed, 19 Oct 2022 01:57: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 6F70F617F0; Wed, 19 Oct 2022 08:55:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 899C5C433C1; Wed, 19 Oct 2022 08:55:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169742; bh=qyVRrzAnXyhHl+vIjBS7KPOElJGxhzljzoyLixtMap8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N4TDzIjnuBlvjU3LpuUQbwlstsc2FPs4OU/b6+sQzMXkal+8Anm1Yb4HDjqGp5WZB iQGb3fbtSdc11viVDQmQ7PZMMyGV/NkG7Di20ofcAkmtKXHYDKAt4aqI9zemlZWW8F 5fT4r+3S6lBESan56CkEHqLuLct5ZW3UrHaUR77E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marijn Suijten , Yassine Oudjana , Dmitry Baryshkov , Rob Clark , Sasha Levin Subject: [PATCH 6.0 392/862] drm/msm: lookup the ICC paths in both mdp5/dpu and mdss devices Date: Wed, 19 Oct 2022 10:27:59 +0200 Message-Id: <20221019083307.267294416@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106465877856892?= X-GMAIL-MSGID: =?utf-8?q?1747106465877856892?= From: Dmitry Baryshkov [ Upstream commit 5ccdcecaf8f732f593e359ebfb65de96b11bae66 ] The commit 6874f48bb8b0 ("drm/msm: make mdp5/dpu devices master components") changed the MDP5 driver to look for the interconnect paths in the MDSS device rather than in the MDP5 device itself. This was left unnoticed since on my testing devices the interconnects probably didn't reach the sync state. Rather than just using the MDP5 device for ICC path lookups for the MDP5 devices, introduce an additional helper to check both MDP5/DPU and MDSS nodes. This will be helpful for the MDP5->DPU conversion, since the driver will have to check both nodes. Fixes: 6874f48bb8b0 ("drm/msm: make mdp5/dpu devices master components") Reported-by: Marijn Suijten Reported-by: Yassine Oudjana Signed-off-by: Dmitry Baryshkov Tested-by: Marijn Suijten # On sdm630 Tested-by: Yassine Oudjana # msm8996 Patchwork: https://patchwork.freedesktop.org/patch/496488/ Link: https://lore.kernel.org/r/20220805115630.506391-1-dmitry.baryshkov@linaro.org Signed-off-by: Dmitry Baryshkov Signed-off-by: Rob Clark Signed-off-by: Sasha Levin --- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 7 ++----- drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 9 +++------ drivers/gpu/drm/msm/msm_drv.h | 2 ++ drivers/gpu/drm/msm/msm_io_utils.c | 22 ++++++++++++++++++++++ 4 files changed, 29 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index 008e1420e6e5..8646fd0603cb 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -384,12 +384,9 @@ static int dpu_kms_parse_data_bus_icc_path(struct dpu_kms *dpu_kms) struct icc_path *path1; struct drm_device *dev = dpu_kms->dev; struct device *dpu_dev = dev->dev; - struct device *mdss_dev = dpu_dev->parent; - /* Interconnects are a part of MDSS device tree binding, not the - * MDP/DPU device. */ - path0 = of_icc_get(mdss_dev, "mdp0-mem"); - path1 = of_icc_get(mdss_dev, "mdp1-mem"); + path0 = msm_icc_get(dpu_dev, "mdp0-mem"); + path1 = msm_icc_get(dpu_dev, "mdp1-mem"); if (IS_ERR_OR_NULL(path0)) return PTR_ERR_OR_ZERO(path0); diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c index d2a48caf9d27..b0d21838a134 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c @@ -902,12 +902,9 @@ static int mdp5_init(struct platform_device *pdev, struct drm_device *dev) static int mdp5_setup_interconnect(struct platform_device *pdev) { - /* Interconnects are a part of MDSS device tree binding, not the - * MDP5 device. */ - struct device *mdss_dev = pdev->dev.parent; - struct icc_path *path0 = of_icc_get(mdss_dev, "mdp0-mem"); - struct icc_path *path1 = of_icc_get(mdss_dev, "mdp1-mem"); - struct icc_path *path_rot = of_icc_get(mdss_dev, "rotator-mem"); + struct icc_path *path0 = msm_icc_get(&pdev->dev, "mdp0-mem"); + struct icc_path *path1 = msm_icc_get(&pdev->dev, "mdp1-mem"); + struct icc_path *path_rot = msm_icc_get(&pdev->dev, "rotator-mem"); if (IS_ERR(path0)) return PTR_ERR(path0); diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h index b3689a2d27d7..80da0d3cfdc1 100644 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h @@ -433,6 +433,8 @@ void __iomem *msm_ioremap_size(struct platform_device *pdev, const char *name, phys_addr_t *size); void __iomem *msm_ioremap_quiet(struct platform_device *pdev, const char *name); +struct icc_path *msm_icc_get(struct device *dev, const char *name); + #define msm_writel(data, addr) writel((data), (addr)) #define msm_readl(addr) readl((addr)) diff --git a/drivers/gpu/drm/msm/msm_io_utils.c b/drivers/gpu/drm/msm/msm_io_utils.c index 7b504617833a..d02cd29ce829 100644 --- a/drivers/gpu/drm/msm/msm_io_utils.c +++ b/drivers/gpu/drm/msm/msm_io_utils.c @@ -5,6 +5,8 @@ * Author: Rob Clark */ +#include + #include "msm_drv.h" /* @@ -124,3 +126,23 @@ void msm_hrtimer_work_init(struct msm_hrtimer_work *work, work->worker = worker; kthread_init_work(&work->work, fn); } + +struct icc_path *msm_icc_get(struct device *dev, const char *name) +{ + struct device *mdss_dev = dev->parent; + struct icc_path *path; + + path = of_icc_get(dev, name); + if (path) + return path; + + /* + * If there are no interconnects attached to the corresponding device + * node, of_icc_get() will return NULL. + * + * If the MDP5/DPU device node doesn't have interconnects, lookup the + * path in the parent (MDSS) device. + */ + return of_icc_get(mdss_dev, name); + +} From patchwork Wed Oct 19 08:28: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: 5414 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp315333wrs; Wed, 19 Oct 2022 06:05:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7rdkLMC6vdyAf9gyA7H/NUBxq97+YiZpPWCZSQUyNN5AWLDsV8b7tW/2rohW1Z0IJ8e415 X-Received: by 2002:a17:90a:f315:b0:20b:15fc:ac5c with SMTP id ca21-20020a17090af31500b0020b15fcac5cmr44267306pjb.220.1666184752392; Wed, 19 Oct 2022 06:05:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666184752; cv=none; d=google.com; s=arc-20160816; b=WXGc6FeLqGjxR0loYejZ86O3sbcTJtkzfvDrIt/bzTXuuNheanYPk+2f2YZ1jbS957 D2OUCDvbuuI0IW2Ser1W2O4jkiG+ZFkgmWaFBkyddwG6Z1RkDJJM+Bf0yOsr0cn/cIje ZhBouOnv4f5V4SIJ5rATaLFJOwDJLUmJNfswNGcJaisk1bZQeH5KChiigk6Aj522J66f 5jh22vMJTOxInm2ewhO/N0BVpM5mtAVXEqU7mPrx3uUElpVmFRJNBljkwvcZMq3+1p+S z117Fzko3eRE/p7joJDL3jHtm1LeQTIHxdlqyf80iLG8Ns4rr11LET5CBVw4qtpsFUiH KKLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=AbqdWby9O5r9mdnjSk+BvhiZL58Y1DoehYjf4TLvGb8=; b=Xvkw00+x1Ym/yZhgN6Hk+ozvb0m6+5hwTUAw+S2VPRaHpd0B50dpySOlGaC8eePvgw KLWmWxPbk5LAhyEtoW+Vp9vZv69uSuQvb5Dx84jjlz7ASwcRuI/GFsy3uzCuyQk7dgpi VWfBZBSnbFpucJhmmBEQBQOsPzn6MC8M/LwyoMzyC335L0pUqI3tH6QHG97f5H1ITP4h kIry4IqrUhsP2q1EcnMWchI85Xug3CaHgssrh/ih6YdCUHeRSMqV5fcb30wgJDbyW0E8 Q4bG2Y+Y7zfa/wYXtM7jLmOJagAN4oMcAHN+bKJ6T1VBZR4ktlnRNxpwmuoASVI37asa ORlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=enbPNp6Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j10-20020a170902da8a00b0017f97fe778dsi20425036plx.126.2022.10.19.06.05.31; Wed, 19 Oct 2022 06:05: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=enbPNp6Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232431AbiJSMyg (ORCPT + 99 others); Wed, 19 Oct 2022 08:54:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233671AbiJSMyN (ORCPT ); Wed, 19 Oct 2022 08:54: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 C2C936340; Wed, 19 Oct 2022 05:37: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 AE3DCB82416; Wed, 19 Oct 2022 08:55:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 222F3C433D6; Wed, 19 Oct 2022 08:55:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169745; bh=uM2NC5UsHz2vBrH+/2GhArvjUIIqt+D87Yyqw6/16Oc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=enbPNp6Q/ajnXp+SHwg6b8tYp/v2NwRDroTxWV9YO//5uGgpR6FCkkjdBiqX+jQM2 ItA1UcCAx2W91uw2uP/CEXJHVgCQACYE2gYivztcp1vAhxGH7R0Xju3nVlxNNsZw/y ZJ6+djDnuhpOVfcWFEK/bhZOo9ZfXwteQEzO7x9M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Baryshkov , Abhinav Kumar , Rob Clark , Sasha Levin Subject: [PATCH 6.0 393/862] drm/msm/dpu: index dpu_kms->hw_vbif using vbif_idx Date: Wed, 19 Oct 2022 10:28:00 +0200 Message-Id: <20221019083307.308963743@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747121342931393339?= X-GMAIL-MSGID: =?utf-8?q?1747121342931393339?= From: Dmitry Baryshkov [ Upstream commit 7538f80ae0d98bf51eb89eee5344aec219902d42 ] Remove loops over hw_vbif. Instead always VBIF's idx as an index in the array. This fixes an error in dpu_kms_hw_init(), where we fill dpu_kms->hw_vbif[i], but check for an error pointer at dpu_kms->hw_vbif[vbif_idx]. Fixes: 25fdd5933e4c ("drm/msm: Add SDM845 DPU support") Signed-off-by: Dmitry Baryshkov Reviewed-by: Abhinav Kumar Patchwork: https://patchwork.freedesktop.org/patch/489569/ Link: https://lore.kernel.org/r/20220615125703.24647-1-dmitry.baryshkov@linaro.org Signed-off-by: Dmitry Baryshkov Signed-off-by: Rob Clark Signed-off-by: Sasha Levin --- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 12 ++++------ drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c | 29 +++++++++++------------- 2 files changed, 18 insertions(+), 23 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index 8646fd0603cb..c99c7a218ddb 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -823,12 +823,10 @@ static void _dpu_kms_hw_destroy(struct dpu_kms *dpu_kms) _dpu_kms_mmu_destroy(dpu_kms); if (dpu_kms->catalog) { - for (i = 0; i < dpu_kms->catalog->vbif_count; i++) { - u32 vbif_idx = dpu_kms->catalog->vbif[i].id; - - if ((vbif_idx < VBIF_MAX) && dpu_kms->hw_vbif[vbif_idx]) { - dpu_hw_vbif_destroy(dpu_kms->hw_vbif[vbif_idx]); - dpu_kms->hw_vbif[vbif_idx] = NULL; + for (i = 0; i < ARRAY_SIZE(dpu_kms->hw_vbif); i++) { + if (dpu_kms->hw_vbif[i]) { + dpu_hw_vbif_destroy(dpu_kms->hw_vbif[i]); + dpu_kms->hw_vbif[i] = NULL; } } } @@ -1110,7 +1108,7 @@ static int dpu_kms_hw_init(struct msm_kms *kms) for (i = 0; i < dpu_kms->catalog->vbif_count; i++) { u32 vbif_idx = dpu_kms->catalog->vbif[i].id; - dpu_kms->hw_vbif[i] = dpu_hw_vbif_init(vbif_idx, + dpu_kms->hw_vbif[vbif_idx] = dpu_hw_vbif_init(vbif_idx, dpu_kms->vbif[vbif_idx], dpu_kms->catalog); if (IS_ERR_OR_NULL(dpu_kms->hw_vbif[vbif_idx])) { rc = PTR_ERR(dpu_kms->hw_vbif[vbif_idx]); diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c index 21d20373eb8b..a18fb649301c 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c @@ -11,6 +11,14 @@ #include "dpu_hw_vbif.h" #include "dpu_trace.h" +static struct dpu_hw_vbif *dpu_get_vbif(struct dpu_kms *dpu_kms, enum dpu_vbif vbif_idx) +{ + if (vbif_idx < ARRAY_SIZE(dpu_kms->hw_vbif)) + return dpu_kms->hw_vbif[vbif_idx]; + + return NULL; +} + /** * _dpu_vbif_wait_for_xin_halt - wait for the xin to halt * @vbif: Pointer to hardware vbif driver @@ -148,20 +156,15 @@ static u32 _dpu_vbif_get_ot_limit(struct dpu_hw_vbif *vbif, void dpu_vbif_set_ot_limit(struct dpu_kms *dpu_kms, struct dpu_vbif_set_ot_params *params) { - struct dpu_hw_vbif *vbif = NULL; + struct dpu_hw_vbif *vbif; struct dpu_hw_mdp *mdp; bool forced_on = false; u32 ot_lim; - int ret, i; + int ret; mdp = dpu_kms->hw_mdp; - for (i = 0; i < ARRAY_SIZE(dpu_kms->hw_vbif); i++) { - if (dpu_kms->hw_vbif[i] && - dpu_kms->hw_vbif[i]->idx == params->vbif_idx) - vbif = dpu_kms->hw_vbif[i]; - } - + vbif = dpu_get_vbif(dpu_kms, params->vbif_idx); if (!vbif || !mdp) { DRM_DEBUG_ATOMIC("invalid arguments vbif %d mdp %d\n", vbif != NULL, mdp != NULL); @@ -204,7 +207,7 @@ void dpu_vbif_set_ot_limit(struct dpu_kms *dpu_kms, void dpu_vbif_set_qos_remap(struct dpu_kms *dpu_kms, struct dpu_vbif_set_qos_params *params) { - struct dpu_hw_vbif *vbif = NULL; + struct dpu_hw_vbif *vbif; struct dpu_hw_mdp *mdp; bool forced_on = false; const struct dpu_vbif_qos_tbl *qos_tbl; @@ -216,13 +219,7 @@ void dpu_vbif_set_qos_remap(struct dpu_kms *dpu_kms, } mdp = dpu_kms->hw_mdp; - for (i = 0; i < ARRAY_SIZE(dpu_kms->hw_vbif); i++) { - if (dpu_kms->hw_vbif[i] && - dpu_kms->hw_vbif[i]->idx == params->vbif_idx) { - vbif = dpu_kms->hw_vbif[i]; - break; - } - } + vbif = dpu_get_vbif(dpu_kms, params->vbif_idx); if (!vbif || !vbif->cap) { DPU_ERROR("invalid vbif %d\n", params->vbif_idx); From patchwork Wed Oct 19 08:28: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: 5289 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp281394wrs; Wed, 19 Oct 2022 05:02:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4SU7RXao8dAGb7/hqNnF7sLLLcbsRD29wOmCHoZ4GetSi0V8wPB35q7vM+7mUDmKS3b1/k X-Received: by 2002:a50:fe99:0:b0:45c:329a:40f6 with SMTP id d25-20020a50fe99000000b0045c329a40f6mr7142424edt.425.1666180920117; Wed, 19 Oct 2022 05:02:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666180920; cv=none; d=google.com; s=arc-20160816; b=atP4Evoguzcq5wSR+0rPTzsvZagg8x35nnHQdQrS1c+r9bGMFWoYL3qntciz9faWfO 7dteBRlzh4e/oHB32qbIn2KOOaLMHjnX/gKbXsz41qQQl6/W1qV0DzTW43v0bQhne0jp c2ojeqo5t8umM7BZwJPfvprdBUbNoRp0yBrWASufYM7hlgHriSjJAJ344SE2KQ0wakFG t5N+wTwUz97h3pXAHJGOyRTD2JmPrIYEX5q0vkPxyY6P7V7lIlcaMUzFYVe896Zjgr0+ E3vLgcZD0hfZfFXSWhRQJMk1Kf5wzZkLGQpT1kQ4S7K0MTJ8n7xAqa+qEEGOOh/mIzc4 ddsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fM0FVpQuZrBDu9a2iRTZRTCMebAGXTHC3H5gOPUHqJA=; b=hp+DIHUUQGkGHy8JpnN27TSZO3jdTsrfbcs4r3cIiXaghhayv5RRSSl1gllE7EZt+b p0MLJO/RsigMYXCudGSZACxO1cLqeB0kckFmlMv9nQ7EV79oxe3umen+bN3agDrF7fBj I9dupBZ09TH34MJqBejr9ilp0QUIm+BCVFPAYfUu+6JJw93efFxVeiuIBJrillrDKhPH PtbuI0RqvxhobO3oEG0mkzpJtJixN1HiN/rEOhUKUNtBjWV5wFN17czCTJEkRR4+cpFv 7/kzzrXveIeLsM9a9HSyPDXjF9SkkTg9YF8XlJGFCwByN4AG9XYp7/SjPnFClIEkwR7v fxFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KJOlCNVc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g8-20020a056402320800b0045ccd1715d5si13826249eda.435.2022.10.19.05.01.32; Wed, 19 Oct 2022 05:02: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=KJOlCNVc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231557AbiJSL5K (ORCPT + 99 others); Wed, 19 Oct 2022 07:57:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232402AbiJSL40 (ORCPT ); Wed, 19 Oct 2022 07:56:26 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4FBF176513; Wed, 19 Oct 2022 04:35: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 ams.source.kernel.org (Postfix) with ESMTPS id E9B2DB82417; Wed, 19 Oct 2022 08:55:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50F53C433D6; Wed, 19 Oct 2022 08:55:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169750; bh=iHwbAIKGTFm2iePSccsgJpuXwAdrLKOvAqCJRJ1QZhE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KJOlCNVcfE/ycLSFdC/gVYtZm9GCIcN5nInCthQIeRa7DZxD9+to34yaaUiktI28y HpQ7Z6E0Df4GjIj6vRmQqI9o91toQN7jYCtAqTxyWenyb2C49HRyn5vAi4INqabOpn oTTf+phWW/L+9Kq/XEVpLZs3jm9awwnaHjlkm7ZE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuogee Hsieh , Stephen Boyd , Abhinav Kumar , Dmitry Baryshkov , Rob Clark , Sasha Levin Subject: [PATCH 6.0 394/862] drm/msm/dp: correct 1.62G link rate at dp_catalog_ctrl_config_msa() Date: Wed, 19 Oct 2022 10:28:01 +0200 Message-Id: <20221019083307.344399744@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747117324261765242?= X-GMAIL-MSGID: =?utf-8?q?1747117324261765242?= From: Kuogee Hsieh [ Upstream commit aa0bff10af1c4b92e6b56e3e1b7f81c660d3ba78 ] At current implementation there is an extra 0 at 1.62G link rate which cause no correct pixel_div selected for 1.62G link rate to calculate mvid and nvid. This patch delete the extra 0 to have mvid and nvid be calculated correctly. Changes in v2: -- fix Fixes tag's text Changes in v3: -- fix misspelling of "Reviewed-by" Fixes: 937f941ca06f ("drm/msm/dp: Use qmp phy for DP PLL and PHY") Signed-off-by: Kuogee Hsieh Reviewed-by: Stephen Boyd Reviewed-by: Abhinav Kumar Patchwork: https://patchwork.freedesktop.org/patch/499328/ Link: https://lore.kernel.org/r/1661372150-3764-1-git-send-email-quic_khsieh@quicinc.com [DB: rewrapped commit message] Signed-off-by: Dmitry Baryshkov Signed-off-by: Rob Clark Signed-off-by: Sasha Levin --- drivers/gpu/drm/msm/dp/dp_catalog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/dp/dp_catalog.c b/drivers/gpu/drm/msm/dp/dp_catalog.c index 7257515871a9..676279d0ca8d 100644 --- a/drivers/gpu/drm/msm/dp/dp_catalog.c +++ b/drivers/gpu/drm/msm/dp/dp_catalog.c @@ -431,7 +431,7 @@ void dp_catalog_ctrl_config_msa(struct dp_catalog *dp_catalog, if (rate == link_rate_hbr3) pixel_div = 6; - else if (rate == 1620000 || rate == 270000) + else if (rate == 162000 || rate == 270000) pixel_div = 2; else if (rate == link_rate_hbr2) pixel_div = 4; From patchwork Wed Oct 19 08:28: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: 4723 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp213957wrs; Wed, 19 Oct 2022 02:11:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5au24fxxe0YKqYc7q3+UjO1RXQ/Fy/Iix2ZdtjEdvFS+psqD23zj+LpqdYQUF205p0fS2u X-Received: by 2002:a17:907:7d8f:b0:78e:2cba:560f with SMTP id oz15-20020a1709077d8f00b0078e2cba560fmr5913995ejc.173.1666170691900; Wed, 19 Oct 2022 02:11:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170691; cv=none; d=google.com; s=arc-20160816; b=f5Wf0JgTIcLQiIguEhx/FDwvrc6ZrQy93JORin9Mu4uc+Z+QVLbqigtliYwXI+MU06 2qTT5++rSyT46WUHZOZeaSyPYMCA63YHcER/pe/OZSXwqETJe677RZ0Lm+klNfgiDE7o WouqvGcPyNcs25NtFrx7O8m06yGVaEFvxB2csPUnc1x6uZoJHm59b60nO8TmPGh7Noow BzbnQ/EfjcPqxjjdVZc27YI5EAW0GLRRG8QhUMIbTsPuxJpGarAM3F1srpiMGWpWR18Q bNZoEkbkYBYIiC2G3ndfXMK/OtvpKQE4+AAaLVqC/vURshktgfKZS1zxa/P2GYha1xkM x9sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NSoDhEnMJUEIZB4Bw/rZKyB9bBuPUBQEjF6Kx5CKHGQ=; b=smqDD0t2f8YYr+95DnOu/s96Z5Uf4etv4Ehd3u1XmrfeDA15cHz3wUApomVsH1YVIE N5aCY545JBGthBrxEFXCgQEgUBs4k/dROBzUi+yk+gq6lSPvG2L0ugfZHAfZzeXxTwem 9HmVG4g6HROpwOMyZUEvhpMZLJLQwHb1M6qiV2TN9GORZ4iR6VuvDx5grazYUcb7jG46 u2lOi+VktPuAp8vX7OlMtm5gAdlilZBS9r5LaWhrsD9YNsZdY8L2OiOmxZKRC16sTRXb 257BoNu1/N4jmBQhOQaJ1miDlRpiA4PJQjIYMKsKeEbsPb/q6eg9eV4PXm29Gyd6nHVH F5JA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BuBtc6lJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h6-20020a056402280600b0044f3b9ef98bsi17066244ede.27.2022.10.19.02.11.05; Wed, 19 Oct 2022 02:11: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=BuBtc6lJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232614AbiJSJHz (ORCPT + 99 others); Wed, 19 Oct 2022 05:07:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232243AbiJSJFZ (ORCPT ); Wed, 19 Oct 2022 05:05:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB002A02C2; Wed, 19 Oct 2022 01:59:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D2C5461811; Wed, 19 Oct 2022 08:55:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6C34C433D6; Wed, 19 Oct 2022 08:55:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169753; bh=z4eMTWqcnGs3mvdT0lsKNRiWvcTHVC0wRPyGnsThfYs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BuBtc6lJb19m61pheBKaire+LeNpxlZpYaqLw1bXbGpcjEJBpEwqm4p7W7zNoxuhf OntVfGAG92sLkKXMPznqCIscfNZEd0fCRkKPUrrsytra6qqptz1vmytgzyOQelY3fA NQygZDFSmfTkQzr+nuHDprbihcGe/CgRV3cBG/JU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jaroslav Kysela , Takashi Iwai , Sasha Levin Subject: [PATCH 6.0 395/862] ALSA: hda/hdmi: change type for the assigned variable Date: Wed, 19 Oct 2022 10:28:02 +0200 Message-Id: <20221019083307.392603524@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106599578226386?= X-GMAIL-MSGID: =?utf-8?q?1747106599578226386?= From: Jaroslav Kysela [ Upstream commit 4053a41282f8aae290d3fe7b8daef4c8c53a4ab8 ] This change converts the assigned value from int type to the bool type to retain consistency with other structure members like 'setup', 'non_pcm' etc. Signed-off-by: Jaroslav Kysela Link: https://lore.kernel.org/r/20220913070307.3234038-1-perex@perex.cz Signed-off-by: Takashi Iwai Stable-dep-of: fc6f923ecfa2 ("ALSA: hda/hdmi: Fix the converter allocation for the silent stream") Signed-off-by: Sasha Levin --- sound/pci/hda/patch_hdmi.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index c239d9dbbaef..69afea67bf3e 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -53,7 +53,7 @@ MODULE_PARM_DESC(enable_all_pins, "Forcibly enable all pins"); struct hdmi_spec_per_cvt { hda_nid_t cvt_nid; - int assigned; + bool assigned; /* the stream has been assigned */ unsigned int channels_min; unsigned int channels_max; u32 rates; @@ -1204,7 +1204,7 @@ static int hdmi_pcm_open_no_pin(struct hda_pcm_stream *hinfo, return err; per_cvt = get_cvt(spec, cvt_idx); - per_cvt->assigned = 1; + per_cvt->assigned = true; hinfo->nid = per_cvt->cvt_nid; pin_cvt_fixup(codec, NULL, per_cvt->cvt_nid); @@ -1273,7 +1273,7 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo, per_cvt = get_cvt(spec, cvt_idx); /* Claim converter */ - per_cvt->assigned = 1; + per_cvt->assigned = true; set_bit(pcm_idx, &spec->pcm_in_use); per_pin = get_pin(spec, pin_idx); @@ -1308,7 +1308,7 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo, snd_hdmi_eld_update_pcm_info(&eld->info, hinfo); if (hinfo->channels_min > hinfo->channels_max || !hinfo->rates || !hinfo->formats) { - per_cvt->assigned = 0; + per_cvt->assigned = false; hinfo->nid = 0; snd_hda_spdif_ctls_unassign(codec, pcm_idx); err = -ENODEV; @@ -1767,7 +1767,7 @@ static void silent_stream_enable(struct hda_codec *codec, } per_cvt = get_cvt(spec, cvt_idx); - per_cvt->assigned = 1; + per_cvt->assigned = true; per_pin->cvt_nid = per_cvt->cvt_nid; per_pin->silent_stream = true; @@ -1827,7 +1827,7 @@ static void silent_stream_disable(struct hda_codec *codec, cvt_idx = cvt_nid_to_cvt_index(codec, per_pin->cvt_nid); if (cvt_idx >= 0 && cvt_idx < spec->num_cvts) { per_cvt = get_cvt(spec, cvt_idx); - per_cvt->assigned = 0; + per_cvt->assigned = false; } if (spec->silent_stream_type == SILENT_STREAM_I915) { @@ -2223,7 +2223,7 @@ static int hdmi_pcm_close(struct hda_pcm_stream *hinfo, goto unlock; } per_cvt = get_cvt(spec, cvt_idx); - per_cvt->assigned = 0; + per_cvt->assigned = false; hinfo->nid = 0; azx_stream(get_azx_dev(substream))->stripe = 0; From patchwork Wed Oct 19 08:28: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: 5061 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp248276wrs; Wed, 19 Oct 2022 03:43:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM75svy7sKN3ZxRCOMXOZnwYMoofRHO5gsrXLbGZoxhu68XPGIpUQKeZiGjQP7m+0v3VWM/Q X-Received: by 2002:a17:902:ecc5:b0:184:ee98:4d79 with SMTP id a5-20020a170902ecc500b00184ee984d79mr7794840plh.112.1666176186118; Wed, 19 Oct 2022 03:43:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176186; cv=none; d=google.com; s=arc-20160816; b=I8ciNy86uQpm3gFl72OhOJ5p4bNuI31B+1thEklaMsAwX3SI2RUTU2ZbOXFkbeu82H FyRHywsk5WUhiaORvI+Azrw/38gNaKm8Svh0RRvtRdWobaPjzFb0tjwre4DgoUCahy9r gDP1LKAbe21n91R/mYqESLUZjuOKncwAnqdp0s1feWsjMAQogzFhryjkYD9MLihPtoeU sgnW6y48NqjcnB8szUpwaamp9m8uo/2Z9j/BuOFF/O7eE7dlaQeVbxrgoseJ6z0t6yxb NL2eWARRGQ8+vEpMWt68/enERv8EIMBDQ/ptf5Y7HcE2+KZJcjHIQVGxvrfXh+ugTQ+s akWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rU2igrlOF2QOyZKSHZSl7m39FEqwUKcClzsVsPrb0vc=; b=zqnn7kIXCY30NrxtGjnP2yz3TKnuFfghT5Af9BJcN2lHNaLPP9FkmTABlkWhOOJCyN 6RFIv+SyJmD6gM+nlfCx+Y+57euQI8dPtJfmJ4O2qPs7uNGwbENiI7jlnkcfx5MPNVXJ Tql2CkDxlk41l6WChN8AgtcAPhxV+ZqUt3oYtEc9tVEsQ7cDD4wojhVygLCfpdvTNcVh wTU/d5y68x4UrcNhcInL7iaVHV5yOi8fc5HpefvhHj6Au/ApHs/PAF0vXjdxEHYz+l7U k0pSAX/3HOPP/decbQLZ/oJSPfC1C9UvR0G/zZEr71GsI6pNkHEVVpbguAIsUb8hdqoH CTaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yzlX3Vgs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170902ec8c00b00177ee2efd41si7245289plg.265.2022.10.19.03.42.51; Wed, 19 Oct 2022 03:43: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=yzlX3Vgs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232503AbiJSKm3 (ORCPT + 99 others); Wed, 19 Oct 2022 06:42:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232297AbiJSKli (ORCPT ); Wed, 19 Oct 2022 06:41:38 -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 2D05C38B3; Wed, 19 Oct 2022 03:19: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 18F5DB8241E; Wed, 19 Oct 2022 08:55:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89A2CC433D6; Wed, 19 Oct 2022 08:55:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169755; bh=GT2VMBbT8oyd3xN+8SDhxONqhXZD0SajvrZKEinfg3w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yzlX3Vgs2AIzYlRP0bHRzexNFlv3pYnPo1kU1T8HMzbLIytE6PZTOnFkNpZRymiSO f4o+JOqjJimK8s3f2iYTlS/UF41PMNNtcD0Fgpe9kmevgt7ecg+4yUZj4cROcU39iY CuB+Vg0aLBvFQ3GfioWCa9uRN2ngULt1dY1xCmsU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jaroslav Kysela , Kai Vehmanen , Takashi Iwai , Sasha Levin Subject: [PATCH 6.0 396/862] ALSA: hda/hdmi: Fix the converter allocation for the silent stream Date: Wed, 19 Oct 2022 10:28:03 +0200 Message-Id: <20221019083307.428832707@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112360564813762?= X-GMAIL-MSGID: =?utf-8?q?1747112360564813762?= From: Jaroslav Kysela [ Upstream commit fc6f923ecfa2fafd0600f1b7e2de09baf29865e2 ] Track the converters handling the silent stream using a new variable to avoid mixing of the open/close and silent stream use. This change ensures the proper allocation of the converters. Fixes: 5f80d6bd2b01 ("ALSA: hda/hdmi: Fix the converter reuse for the silent stream") Signed-off-by: Jaroslav Kysela Reviewed-by: Kai Vehmanen Link: https://lore.kernel.org/r/20220919135444.3554982-1-perex@perex.cz Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/pci/hda/patch_hdmi.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index 69afea67bf3e..d463c968b3a4 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -54,6 +54,7 @@ MODULE_PARM_DESC(enable_all_pins, "Forcibly enable all pins"); struct hdmi_spec_per_cvt { hda_nid_t cvt_nid; bool assigned; /* the stream has been assigned */ + bool silent_stream; /* silent stream activated */ unsigned int channels_min; unsigned int channels_max; u32 rates; @@ -988,7 +989,8 @@ static int hdmi_setup_stream(struct hda_codec *codec, hda_nid_t cvt_nid, * of the pin. */ static int hdmi_choose_cvt(struct hda_codec *codec, - int pin_idx, int *cvt_id) + int pin_idx, int *cvt_id, + bool silent) { struct hdmi_spec *spec = codec->spec; struct hdmi_spec_per_pin *per_pin; @@ -1003,6 +1005,9 @@ static int hdmi_choose_cvt(struct hda_codec *codec, if (per_pin && per_pin->silent_stream) { cvt_idx = cvt_nid_to_cvt_index(codec, per_pin->cvt_nid); + per_cvt = get_cvt(spec, cvt_idx); + if (per_cvt->assigned && !silent) + return -EBUSY; if (cvt_id) *cvt_id = cvt_idx; return 0; @@ -1013,7 +1018,7 @@ static int hdmi_choose_cvt(struct hda_codec *codec, per_cvt = get_cvt(spec, cvt_idx); /* Must not already be assigned */ - if (per_cvt->assigned) + if (per_cvt->assigned || per_cvt->silent_stream) continue; if (per_pin == NULL) break; @@ -1199,7 +1204,7 @@ static int hdmi_pcm_open_no_pin(struct hda_pcm_stream *hinfo, if (pcm_idx < 0) return -EINVAL; - err = hdmi_choose_cvt(codec, -1, &cvt_idx); + err = hdmi_choose_cvt(codec, -1, &cvt_idx, false); if (err) return err; @@ -1267,7 +1272,7 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo, } } - err = hdmi_choose_cvt(codec, pin_idx, &cvt_idx); + err = hdmi_choose_cvt(codec, pin_idx, &cvt_idx, false); if (err < 0) goto unlock; @@ -1278,7 +1283,6 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo, set_bit(pcm_idx, &spec->pcm_in_use); per_pin = get_pin(spec, pin_idx); per_pin->cvt_nid = per_cvt->cvt_nid; - per_pin->silent_stream = false; hinfo->nid = per_cvt->cvt_nid; /* flip stripe flag for the assigned stream if supported */ @@ -1760,14 +1764,14 @@ static void silent_stream_enable(struct hda_codec *codec, } pin_idx = pin_id_to_pin_index(codec, per_pin->pin_nid, per_pin->dev_id); - err = hdmi_choose_cvt(codec, pin_idx, &cvt_idx); + err = hdmi_choose_cvt(codec, pin_idx, &cvt_idx, true); if (err) { codec_err(codec, "hdmi: no free converter to enable silent mode\n"); goto unlock_out; } per_cvt = get_cvt(spec, cvt_idx); - per_cvt->assigned = true; + per_cvt->silent_stream = true; per_pin->cvt_nid = per_cvt->cvt_nid; per_pin->silent_stream = true; @@ -1827,7 +1831,7 @@ static void silent_stream_disable(struct hda_codec *codec, cvt_idx = cvt_nid_to_cvt_index(codec, per_pin->cvt_nid); if (cvt_idx >= 0 && cvt_idx < spec->num_cvts) { per_cvt = get_cvt(spec, cvt_idx); - per_cvt->assigned = false; + per_cvt->silent_stream = false; } if (spec->silent_stream_type == SILENT_STREAM_I915) { From patchwork Wed Oct 19 08:28: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: 4702 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp213753wrs; Wed, 19 Oct 2022 02:11:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6t0TQus6mJ0w4HKtT5kPDPYFDrQRiX2KuN6D9OIb6FLzgLqiqgS68vaB1q1efJCfqBDiOi X-Received: by 2002:a17:907:6e22:b0:78d:cce6:c29b with SMTP id sd34-20020a1709076e2200b0078dcce6c29bmr5785819ejc.300.1666170659981; Wed, 19 Oct 2022 02:10:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170659; cv=none; d=google.com; s=arc-20160816; b=cXLpqYESzBz0jcZPtjxtMHs/9rJ3PdKKY+Il8cBTOzbg6G420S6BO8fcyplRIp4EkL aaljm1QDAQTq327dreNTIWryI83Oiemgg+TFb/F/egy6bkKpcUM3w2fDaVBKbE1e5RMm xqpwoV8gb4QJlS3b55cQHkVlh2yMPpMUSxyilbXRWY6RleQj++Je3HvjIC0IIw9CRBQY Y0ZoKNlFwsTAC5+PBE1frUPQAwhPB124lTINASq3L6Eg8pxH/rxAfdCZbKtdlN3T52dL lySlAJtHw+r+y5RePj/3kd/oNeU79UhKqSGV67nM9SRPWE7zd8eK2mCZ/3gj37xs2X+P 7DHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=p84jcEu+Qzl5MCFY6lj5JtqZFoFBXeuOPa10FMEQLBU=; b=ol/fW9/TZfYGXIDqDQLRhvHg8j7kRWgfrIvWr9SklTQgdBGH58SxkHtk/3STdm0xwt 3h9fhNKD/VlevSs015e+vUaDsk0VTF9lzFr+o35/u4NzfK9/vTph41AiMBzjznJ9fW60 GbAW0N4Vz4lavcuzEpo+8kPcYgYymN1GWxq4Nx/A2+/KVuoV/ElvqOi5MBBp0vMKumoq H/mNH0zsKIh1wwEJakKvL91xeMLw1ajA/7zy4KTeSsPyK5GmabuNaVXEgmoN82OkhAw0 OP5v8euJLSxMsJtei705hjcD6gbxEjkNVK/3mOxrECRO9YJW+mzscffxZlQIkJywV9NM YXhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hA2GAtk5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m7-20020a056402510700b0045935adb5b1si15588596edd.395.2022.10.19.02.10.33; Wed, 19 Oct 2022 02:10: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=hA2GAtk5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232399AbiJSJGE (ORCPT + 99 others); Wed, 19 Oct 2022 05:06:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232470AbiJSJEV (ORCPT ); Wed, 19 Oct 2022 05:04: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 5B59A175A2; Wed, 19 Oct 2022 01:57:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 10A77617E1; Wed, 19 Oct 2022 08:55:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 248F9C433C1; Wed, 19 Oct 2022 08:55:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169758; bh=mVlXKDyloWHczG4w8BODEuzPi+MoNX5tHp/3T8IM120=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hA2GAtk56ZECZtxKMh8abaJKz324C/BK7rFfZC1iAcnCkNeUnUlm8iKLaIW+5jxPg 7QtODXMUlUAPUMRa7bkhCCOECsPVuGuedUMd7a33KRxGDh0GdvZdTT8TXyK4xeHWxW JYwXXJdfSx2SKz81UNxvkQKbij9C5XHSYRjnlZX8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai , Sasha Levin Subject: [PATCH 6.0 397/862] ALSA: usb-audio: Properly refcounting clock rate Date: Wed, 19 Oct 2022 10:28:04 +0200 Message-Id: <20221019083307.475460304@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106566312670169?= X-GMAIL-MSGID: =?utf-8?q?1747106566312670169?= From: Takashi Iwai [ Upstream commit 9a737e7f8b371e97eb649904276407cee2c9cf30 ] We fixed the bug introduced by the patch for managing the shared clocks at the commit 809f44a0cc5a ("ALSA: usb-audio: Clear fixed clock rate at closing EP"), but it was merely a workaround. By this change, the clock reference rate is cleared at each EP close, hence the still remaining EP may need a re-setup of rate unnecessarily. This patch introduces the proper refcounting for the clock reference object so that the clock setup is done only when needed. Fixes: 809f44a0cc5a ("ALSA: usb-audio: Clear fixed clock rate at closing EP") Fixes: c11117b634f4 ("ALSA: usb-audio: Refcount multiple accesses on the single clock") Link: https://lore.kernel.org/r/20220920181126.4912-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/usb/endpoint.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) --- a/sound/usb/endpoint.c +++ b/sound/usb/endpoint.c @@ -39,6 +39,7 @@ struct snd_usb_iface_ref { struct snd_usb_clock_ref { unsigned char clock; atomic_t locked; + int opened; int rate; struct list_head list; }; @@ -802,6 +803,7 @@ snd_usb_endpoint_open(struct snd_usb_aud ep = NULL; goto unlock; } + ep->clock_ref->opened++; } ep->cur_audiofmt = fp; @@ -925,8 +927,10 @@ void snd_usb_endpoint_close(struct snd_u endpoint_set_interface(chip, ep, false); if (!--ep->opened) { - if (ep->clock_ref && !atomic_read(&ep->clock_ref->locked)) - ep->clock_ref->rate = 0; + if (ep->clock_ref) { + if (!--ep->clock_ref->opened) + ep->clock_ref->rate = 0; + } ep->iface = 0; ep->altsetting = 0; ep->cur_audiofmt = NULL; @@ -1633,8 +1637,7 @@ void snd_usb_endpoint_stop(struct snd_us WRITE_ONCE(ep->sync_source->sync_sink, NULL); stop_urbs(ep, false, keep_pending); if (ep->clock_ref) - if (!atomic_dec_return(&ep->clock_ref->locked)) - ep->clock_ref->rate = 0; + atomic_dec(&ep->clock_ref->locked); } } From patchwork Wed Oct 19 08:28: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: 5042 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp247178wrs; Wed, 19 Oct 2022 03:40:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5nMIztu1HNt0QOYpgt/ebkDr+n5fF1HbUdQ1bhQZvHyLbQHWCHLUszkW+V3ljQlnNpX0Nq X-Received: by 2002:a05:6402:350f:b0:45d:1d86:9ec9 with SMTP id b15-20020a056402350f00b0045d1d869ec9mr6894952edd.266.1666176010638; Wed, 19 Oct 2022 03:40:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176010; cv=none; d=google.com; s=arc-20160816; b=csMfxLk5FGmHwT9ibnP5GfVYG9kPaDErWjEqYf/FY5DNjZF9+orD1ZhBjlaX9M2bwF fowHJW+OJEQHswUuGuXeKoLvLrih/S7IFNV+CHbmnqA6QQ+no0w5muO5jm3k1OTGsWGZ Vn6vl/8BGgoFRcRAONk2fE4nDdsj/wEsmcZwR+4mhTVHxTsQugvF4ksDeeaWWs/ySPtQ zSRrN+wP9dNNtMUx/OG7xCRRspPIqTrYsRoNdofCLeLLdCtcPuS0lk75OaeEMlZGUHcw J5cji5ssjNu2KgJaFQK2pqsjBsJ2CrMKXalELcgEyxfV/DizA41VNr6nUcnQJ3bfS94T voyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=alo9Z7aJSVpsPSGvybDZF2OpjX4E3VHyuzefJYokAJc=; b=gjgpoOUqdP7Z0Vzo2lOymyXVr9pq6a7lQCNN7L3xk7SM2NpMvN5vgFNuR71/hli8aC QtkGDlQsHlVFeRcXlzLBIuo+14iZFv0iCj6DIp1gjzub53pyRWrUKv6xXiniE7mE/Yc5 JJ6yPyJgp12hcIcmVdP2p2Br9oJUK+opE2YEZMy26DIpnUwh7R9fmCW0oXMh7IUmRCfR 2anW+MMS1m/G2TUNqtP5jyprtQ4iJEwltAVVcNmio9TI0gZDH804uCuJ3BmsvME7PGTK glzjviDdas5IeNhAHQnogaMYKRNSJiI+180birf7U6NFq5XI0GwGgIpYx+weH4FrTTA5 EeEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1vPAX6LP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j30-20020a508a9e000000b0044dbb9afe1fsi12722738edj.467.2022.10.19.03.39.45; Wed, 19 Oct 2022 03:40: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=1vPAX6LP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231931AbiJSKiP (ORCPT + 99 others); Wed, 19 Oct 2022 06:38:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231919AbiJSKhq (ORCPT ); Wed, 19 Oct 2022 06:37:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B752152C51; Wed, 19 Oct 2022 03:16: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 70799B82423; Wed, 19 Oct 2022 08:56:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA2FBC4314C; Wed, 19 Oct 2022 08:56:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169761; bh=F1JXg42jhGfBnXQLzlro4hM3EZNVZO8juWCR9Pai+GE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1vPAX6LPzq7ksEAq05MpmOKaCU426zAiYwfC+EhuY9crPnQlyZfCWzBqymG5KCcTw WlO3snSaD2C1TEFo2Siy9UiEouokQxqMpBtBPfuzmE91mzyKNlVJpBdG3UEb1krLvJ rZbCqFASfsS46fW4ef/qFtWEYu+vk667YNtjKJGI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Ujfalusi , Ranjani Sridharan , Bard Liao , Pierre-Louis Bossart , Mark Brown , Sasha Levin Subject: [PATCH 6.0 398/862] ASoC: SOF: ipc4-topology: Free the ida when IPC fails in sof_ipc4_widget_setup() Date: Wed, 19 Oct 2022 10:28:05 +0200 Message-Id: <20221019083307.525506018@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112176452028109?= X-GMAIL-MSGID: =?utf-8?q?1747112176452028109?= From: Peter Ujfalusi [ Upstream commit 61eb0add28023119773d6aab8f402e149473920c ] The allocated ida needs to be freed up if the IPC message fails since next time when we try again to set up the widget we are going to try to allocate another ID and given enough tries, we are going to run out of unique IDs. Fixes: 711d0427c713 ("ASoC: SOF: ipc4-topology: move ida allocate/free to widget_setup/free") Signed-off-by: Peter Ujfalusi Reviewed-by: Ranjani Sridharan Reviewed-by: Bard Liao Reviewed-by: Pierre-Louis Bossart Link: https://lore.kernel.org/r/20220921112751.9253-1-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/sof/ipc4-topology.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sound/soc/sof/ipc4-topology.c b/sound/soc/sof/ipc4-topology.c index 64929dc9af39..340d92452d7c 100644 --- a/sound/soc/sof/ipc4-topology.c +++ b/sound/soc/sof/ipc4-topology.c @@ -1544,9 +1544,16 @@ static int sof_ipc4_widget_setup(struct snd_sof_dev *sdev, struct snd_sof_widget msg->data_ptr = ipc_data; ret = sof_ipc_tx_message(sdev->ipc, msg, ipc_size, NULL, 0); - if (ret < 0) + if (ret < 0) { dev_err(sdev->dev, "failed to create module %s\n", swidget->widget->name); + if (swidget->id != snd_soc_dapm_scheduler) { + struct sof_ipc4_fw_module *fw_module = swidget->module_info; + + ida_free(&fw_module->m_ida, swidget->instance_id); + } + } + return ret; } From patchwork Wed Oct 19 08:28: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: 5553 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp349458wrs; Wed, 19 Oct 2022 07:11:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6BAK6wX7h/QgGZL19wcel4kAFLwCwbENsgkRF/WMS6Ni07qN5dWNLaQS/ga0LQcDjYt5bF X-Received: by 2002:aa7:9212:0:b0:562:b5f6:f7d7 with SMTP id 18-20020aa79212000000b00562b5f6f7d7mr9044361pfo.70.1666188718843; Wed, 19 Oct 2022 07:11:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666188718; cv=none; d=google.com; s=arc-20160816; b=zFvu/TzK5qa93Et2rt2zubdes4vfnsIxocUzW8bfjOG6+65x6LnxXeYtmQrN0fFK7h 0DcGNJJ6Sr44KuirsdLQGtxocOUOpNhcVebFT2YwllNzlMN0apeWqqWuISaOnORxroEj DU78tFpVZ1n8idij4Qw9DL9w9H1RhCw8VotmO7PmBHdidGLSDfaSPc5fdVcnSJfl98qs dICJCC+MD5MYwmSxHl/sh30B8WLqKUDJ2yOFR3WmjA3bKc+QFFSXHcCg8xl5aNgU5XMY /zPYUNrBUCd/CS6t5dYEQ5XyK0aSMfs4UXNNM+F80eFFBaWnwVbsJLIJfJoKC2DJWnp6 ZXCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DOuvRinasGs+eBIL69O1zy47APGnMPHF0l9YuIdI0kk=; b=xCOtRhyrOaRz3C/U/b9UnrjEOo9egQgdvr8EqqEf16LO1YaDpnvYBKzKyKjkVRAIey IGCgtYVXa1/BDK8cD5N7ZRz0kW1TDZQ3YdNdTkUnSGviUrFhtC52r78GMemi8uMcyNXu 3xHkGkeveU6lfrrdeXE4E8FqZLMmenRmrAix+hcRlj/e+fUuSKJTjJ4/d8NOtslv6ye6 NCzIy2c6QW02Jsb7PE8+7UhtXlw7VTCNo7rra3AkgpdhwfCNIjMMIUyBMC48JcamyjAg NRHFIrq9HWAbsjZMq+uvc0OsnCkvbtV1QBWqD3T2T9qblJx3YOkVQKzoqmFwfH5CF0vV 9y9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sShcR+JJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h191-20020a6383c8000000b0046ade103856si17674337pge.308.2022.10.19.07.11.36; Wed, 19 Oct 2022 07:11: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=sShcR+JJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233787AbiJSN5K (ORCPT + 99 others); Wed, 19 Oct 2022 09:57:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233846AbiJSNyK (ORCPT ); Wed, 19 Oct 2022 09:54:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6C531BBECA; Wed, 19 Oct 2022 06:36: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 07F01B823EC; Wed, 19 Oct 2022 08:56:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74014C433D6; Wed, 19 Oct 2022 08:56:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169763; bh=xvO8OBdejBy1K8qqYfbWb8o0/2MXHQoNgGR1UEb5JqQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sShcR+JJdMI3GxmYK8scbbpnx8ukmbZXXfXPZn7DEKBFxtc10r+MzwhUNVfn5TDcU FY1VPthc9dwX4y1qDV9cgHC0uTrEtj6RrmZKsmrUQH8ULpk7s8wbTWcbXwh/seqGi4 Hacw84s10Yrz9M/dNaxCTyEliI5L9GQZkNgloAPg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rafael Mendonca , Martin Krastev , Zack Rusin , Sasha Levin Subject: [PATCH 6.0 399/862] drm/vmwgfx: Fix memory leak in vmw_mksstat_add_ioctl() Date: Wed, 19 Oct 2022 10:28:06 +0200 Message-Id: <20221019083307.564646588@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747125502077101005?= X-GMAIL-MSGID: =?utf-8?q?1747125502077101005?= From: Rafael Mendonca [ Upstream commit a40c7f61d12fbd1e785e59140b9efd57127c0c33 ] If the copy of the description string from userspace fails, then the page for the instance descriptor doesn't get freed before returning -EFAULT, which leads to a memleak. Fixes: 7a7a933edd6c ("drm/vmwgfx: Introduce VMware mks-guest-stats") Signed-off-by: Rafael Mendonca Reviewed-by: Martin Krastev Signed-off-by: Zack Rusin Link: https://patchwork.freedesktop.org/patch/msgid/20220916204751.720716-1-rafaelmendsr@gmail.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/vmwgfx/vmwgfx_msg.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c index 2aceac7856e2..089046fa21be 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c @@ -1076,6 +1076,7 @@ int vmw_mksstat_add_ioctl(struct drm_device *dev, void *data, if (desc_len < 0) { atomic_set(&dev_priv->mksstat_user_pids[slot], 0); + __free_page(page); return -EFAULT; } From patchwork Wed Oct 19 08:28: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: 4716 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp213907wrs; Wed, 19 Oct 2022 02:11:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM44oCHQqkB3UVy0TeO36HoajdVG3z4hUtFkAfGX/b749lKMyUtwQceoEF5rFOU7bc4yHbQ7 X-Received: by 2002:aa7:c919:0:b0:459:55b:57e7 with SMTP id b25-20020aa7c919000000b00459055b57e7mr6595845edt.20.1666170684637; Wed, 19 Oct 2022 02:11:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170684; cv=none; d=google.com; s=arc-20160816; b=G4z2eLuhfQ6qAO+WDv4b7IkpEOQRdSCygsNlHKhrCYfOAiahz8ncIoGxF14pBeNQLf jG4q1IkShPc4IFo4wpx+fum3KFIIiY66KRiBanycN8lEMlgMl8bXK7hjLObNH2bqRihg MymhwMVOnK/rgpfxEvWHehuqzrZKh/SwFvrLl/rotGWP34P14JQFCyF01tuuC9b/5cgo RwqoMQB3vVeyXcAPoP6Rg+kY2kO3b8ln4GcTcaYUHWn2ymWWZgR8kSxcjJGDzuMrhLUL KK2ULzYpoIvmseDcBlKINE2DLHKQNXrBsFe4/cRLOx4oQOCLal3XocRpHZx1XuqCJvWM 4ZYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kKssT54iXdTw+sGEw/GYDLI/l88X8MfuNzcPo5RXrI4=; b=H/zXe8jBvACZUP1gxHuUCkjrQZh02XmiYH5eewkX2wIV5JySg++QU+FLoBPoFDNYhq q3FI/AJXmU4WwpdA19yEFNkLrOeAYfi/y5/YUldwbB4HjhwHPcxhKhLuokiTb3iLAR9+ Z6bu1xqvhmQisIfJr8dI6NKrVtrSuN6AL5p5q1nAeCtDUyK3e0lMKm4p9RFf8jMHud8b Pjme+81mteAPpsgdnoON/XWAGyBIIlc324GaA7iFyBHVRRrpoTz/pvFAPH5H6WA9HieB ZV99hG0//ZKZNEbwWQP0LMNE9gl9dJ2Rf6DJwz6kqsQBANgzjiAQtUjomToGocIBCm7w RgPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tXcpx7py; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ga29-20020a1709070c1d00b00772fe97b31esi13839716ejc.901.2022.10.19.02.10.58; Wed, 19 Oct 2022 02:11: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=tXcpx7py; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232477AbiJSJG3 (ORCPT + 99 others); Wed, 19 Oct 2022 05:06:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232561AbiJSJEf (ORCPT ); Wed, 19 Oct 2022 05:04:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 202CBAD992; Wed, 19 Oct 2022 01:57:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2568F61866; Wed, 19 Oct 2022 08:56:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 37B9BC433C1; Wed, 19 Oct 2022 08:56:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169766; bh=t9a02up3UmCRf+tLpcInPigc4BFh75HEwd8CGe1RyE4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tXcpx7pyg75ZzoT7VTji7YbPPS/CaOzkbW1PdFaOM3bL/cjqsaAT+zsELiKgq4Xbu Gvq5Uj1/W6l28d+DI6rfJbyLJ+hABj9S/B/eDZkETFNgGbT2UJRrVv5nIhnG3YE2sz hulWqaGCURat3SBXgFF4mYbX2PVDgpJ+cHXmHeHQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Chia-I Wu , Gerd Hoffmann , Sasha Levin Subject: [PATCH 6.0 400/862] virtio-gpu: fix shift wrapping bug in virtio_gpu_fence_event_create() Date: Wed, 19 Oct 2022 10:28:07 +0200 Message-Id: <20221019083307.607796677@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106591634771224?= X-GMAIL-MSGID: =?utf-8?q?1747106591634771224?= From: Dan Carpenter [ Upstream commit 37a78445763a5921bb54e9bad01937d0dfa521c1 ] The ->ring_idx_mask variable is a u64 so static checkers, Smatch in this case, complain if the BIT() is not also a u64. drivers/gpu/drm/virtio/virtgpu_ioctl.c:50 virtio_gpu_fence_event_create() warn: should '(1 << ring_idx)' be a 64 bit type? Fixes: cd7f5ca33585 ("drm/virtio: implement context init: add virtio_gpu_fence_event") Signed-off-by: Dan Carpenter Reviewed-by: Chia-I Wu Link: http://patchwork.freedesktop.org/patch/msgid/YygN7jY0GdUSQSy0@kili Signed-off-by: Gerd Hoffmann Signed-off-by: Sasha Levin --- drivers/gpu/drm/virtio/virtgpu_ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c index 3b1701607aae..5d05093014ac 100644 --- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c +++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c @@ -47,7 +47,7 @@ static int virtio_gpu_fence_event_create(struct drm_device *dev, struct virtio_gpu_fence_event *e = NULL; int ret; - if (!(vfpriv->ring_idx_mask & (1 << ring_idx))) + if (!(vfpriv->ring_idx_mask & BIT_ULL(ring_idx))) return 0; e = kzalloc(sizeof(*e), GFP_KERNEL); From patchwork Wed Oct 19 08:28: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: 4697 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp213744wrs; Wed, 19 Oct 2022 02:10:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5PxC81xQxilNSi3DIAZx1Ajgl/YOB7YNbDWUZIxHxdvg8PBE/GjJsorMMzY1fV2rzUh0c/ X-Received: by 2002:a05:6402:14ce:b0:45c:2c81:e144 with SMTP id f14-20020a05640214ce00b0045c2c81e144mr6394109edx.90.1666170659572; Wed, 19 Oct 2022 02:10:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170659; cv=none; d=google.com; s=arc-20160816; b=VUUoLaAswYNhMQ3HFWBTpLAV2nQTlnjyQKUGytnpb41PPH2iU0z3yp9TaG51EcUcZL 2qsqBTbSsLGe8NZT38QFIA8uoaXGaOMgpJZd+qJdzyyJRe3/OrpW6JRJKAP+2eYp5XRA Y4OId5S/jV1sZUtIZGs22QW7k1PUr2VmvExgwk6794DnPIfzLXWTbB8Iuyp9hyODwW6V Vx4j01SayaVOil6wcFjc/8I0kdf+xIO5aOJiCabVN5slRrwy4qpaPuHABpu2Yhm7Wpdc xsg9CFTQ0isLtsmNi2hTDYYqMuOrriF7QKkghbZEr4+yIjJWYOjuC6YqHuIrjm523iez +M0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ehuRqQuKzxhFY64W3JO9dYQ512+WDi9UkwTt2cPdiAo=; b=j+Wz7CaNiT22z7BRwpJ+3KoIq9d87fWFzs0S6OqZdExPB2f1d4twnHZjLtxnTXASuB tsfhPvGaRpKiMaZkg2cnjhtrRFLX0LEy3c1TucM/V8DIWNUmfeqS7H4cnx92U8hy4vEz 8qnG0vSJ9jLM0u8bIqazplanUCR4M4A0rzb/BmlUDw4OCv2D3gMBNRfbKqD/xt/meqH0 XZ9Dd9xcEHczrSBa8NNQx3X8yb3NLA93/MFYXith5q2wtVFyIlvTBvRSY8GzVfSkoBOr LSUJFe/3AAavv2mZngC0PauBi6ihu4EMgeVe3v2/DVGgS9Sb+QovfwwqVZ3vfy761fVI fGuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QfD59p59; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a50cc87000000b00457594320f5si14419500edi.107.2022.10.19.02.10.33; Wed, 19 Oct 2022 02:10: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=QfD59p59; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232409AbiJSJGG (ORCPT + 99 others); Wed, 19 Oct 2022 05:06:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232499AbiJSJEY (ORCPT ); Wed, 19 Oct 2022 05:04: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 65AB49D528; Wed, 19 Oct 2022 01:57: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 BB47261867; Wed, 19 Oct 2022 08:56:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BEEE5C433C1; Wed, 19 Oct 2022 08:56:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169769; bh=/KXZ6TtpDb4MRpdGoI3eHmCgdlt22zSQ2OvKcABdU/c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QfD59p59AfhoJSwUW4XT3tCcA4y6K3wb9k8KnRQGGjwLHblvDPaRGdCPIp/7Otanz yyNvXfgZ0yapSVqsMpPC9S+Bpn0InhccIBTHvSR069E67CPNXJmZWWnGeaDOdikeNG ZEFhFqWRJGk7bIOFjYxqMVkJ4hK6URMoHd0Z2ghc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Srinivas Kandagatla , Mark Brown , Sasha Levin Subject: [PATCH 6.0 401/862] ASoC: codecs: tx-macro: fix kcontrol put Date: Wed, 19 Oct 2022 10:28:08 +0200 Message-Id: <20221019083307.651568697@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106565310137787?= X-GMAIL-MSGID: =?utf-8?q?1747106565310137787?= From: Srinivas Kandagatla [ Upstream commit c1057a08af438e0cf5450c1d977a3011198ed2f8 ] tx_macro_tx_mixer_put() and tx_macro_dec_mode_put() currently returns zero eventhough it changes the value. Fix this, so that change notifications are sent correctly. Fixes: d207bdea0ca9 ("ASoC: codecs: lpass-tx-macro: add dapm widgets and route") Signed-off-by: Srinivas Kandagatla Link: https://lore.kernel.org/r/20220906170112.1984-6-srinivas.kandagatla@linaro.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/lpass-tx-macro.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/lpass-tx-macro.c b/sound/soc/codecs/lpass-tx-macro.c index 55503ba480bb..e162a08d9945 100644 --- a/sound/soc/codecs/lpass-tx-macro.c +++ b/sound/soc/codecs/lpass-tx-macro.c @@ -823,17 +823,23 @@ static int tx_macro_tx_mixer_put(struct snd_kcontrol *kcontrol, struct tx_macro *tx = snd_soc_component_get_drvdata(component); if (enable) { + if (tx->active_decimator[dai_id] == dec_id) + return 0; + set_bit(dec_id, &tx->active_ch_mask[dai_id]); tx->active_ch_cnt[dai_id]++; tx->active_decimator[dai_id] = dec_id; } else { + if (tx->active_decimator[dai_id] == -1) + return 0; + tx->active_ch_cnt[dai_id]--; clear_bit(dec_id, &tx->active_ch_mask[dai_id]); tx->active_decimator[dai_id] = -1; } snd_soc_dapm_mixer_update_power(widget->dapm, kcontrol, enable, update); - return 0; + return 1; } static int tx_macro_enable_dec(struct snd_soc_dapm_widget *w, @@ -1019,9 +1025,12 @@ static int tx_macro_dec_mode_put(struct snd_kcontrol *kcontrol, int path = e->shift_l; struct tx_macro *tx = snd_soc_component_get_drvdata(component); + if (tx->dec_mode[path] == value) + return 0; + tx->dec_mode[path] = value; - return 0; + return 1; } static int tx_macro_get_bcs(struct snd_kcontrol *kcontrol, From patchwork Wed Oct 19 08:28: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: 4704 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp213760wrs; Wed, 19 Oct 2022 02:11:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6h0XwAI26x+dbTk1k5zvqhcptlE99Fs/5zZ9+JDKDl7J5paHveU2Y1kcL+cve0DnhLWlVe X-Received: by 2002:a17:907:2711:b0:78e:c2a:a3fb with SMTP id w17-20020a170907271100b0078e0c2aa3fbmr5809467ejk.556.1666170660533; Wed, 19 Oct 2022 02:11:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170660; cv=none; d=google.com; s=arc-20160816; b=kCVZBdaxPqEj0e5qabobPwu+E45VKKtS/GLMb9uQWSLBWyAMsBOSMO2m9we378gLML fuihonh1ries0FxOnNusCbnk9UicuR4+ydcL4JErVW1bu5shAxa0zZ9cKJpMfo+YZDiC xGOID/WkmJmw4lAIk3F9MF0xCHlFowTz/Ox+Tm6KeF90JJ9DvptQ4Z/YLjMtS88kcmXm ea4EIoa+8NM/VYsOtZRnjEkxn8CDdG4Rvpx4ioG2XaqL1dgiHcqqtcAz7HKZIkcmrkip 6wylFcFk48zO8exADhEgNuH4K1hmotJJQblvFRSWBpMBfI6v2KC3YdWRWNklnVxc7CdE uYGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YK+T+Rs4gq61ULEwA1OLY48M2PfAG9R7yj1D1IAm108=; b=xUXMPr+9C/y2Sf06fdTe8yd1/YjAJxcSDoE6AbscTpW2w7fSFAoiQt5dd8f9Es9ScL kzYrm6RnPMEu8XcSLSdCyvAMOho0SU3mvy/y7vDK2PNMPRMbqoXVJzoBaChH6q4qYV0D Tn9IlY8DQf+gLQptI0V5mHBqW6TZibPf3eRtBAKG4gUIwzrpwN6Xy9hEDst0ngR+vLTz jCdCqOyZQuyAbk4FMPuvzTfEifCpuQDLeDJG5SmZDsOeNVXRbQRl03Zf6D6GAMBJ1xTY oDOlcYslgcSGGWD1pG0P2jZvacQNBWGJOhp5v0Vwe/iEQwlu/yn5H/VQQM6zzkbG7PfV 7cqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xA2M8yJf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l22-20020a056402125600b0044f441d2372si12937834edw.88.2022.10.19.02.10.33; Wed, 19 Oct 2022 02:11: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=xA2M8yJf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232369AbiJSJGL (ORCPT + 99 others); Wed, 19 Oct 2022 05:06:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232504AbiJSJE0 (ORCPT ); Wed, 19 Oct 2022 05:04:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6251AC3B0; Wed, 19 Oct 2022 01:57: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 43AE5617D1; Wed, 19 Oct 2022 08:56:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F65CC433D6; Wed, 19 Oct 2022 08:56:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169771; bh=4VSYuPSAObcReK/9L0QMwHxCF101x1ZYOeGQCscVZRU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xA2M8yJfsxEoruSqLaTlbOoIKhz62Lqk3e6YAvnghseeGA4a/W93OBLJL3KwgIAjd 6/aUUuIU5KiO7jEp3WaF28Hf9ryNl9nzEMaB+4nWABl6ePGBqOv1hI9wHubKcIEODW TGyqmv1YPrAGS1GFBe7c2qfy9FbHv010bJkMPdlg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Christophe JAILLET , Mark Brown , Sasha Levin Subject: [PATCH 6.0 402/862] ASoC: da7219: Fix an error handling path in da7219_register_dai_clks() Date: Wed, 19 Oct 2022 10:28:09 +0200 Message-Id: <20221019083307.703059785@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106566536880879?= X-GMAIL-MSGID: =?utf-8?q?1747106566536880879?= From: Christophe JAILLET [ Upstream commit abb4e4349afe7eecdb0499582f1c777031e3a7c8 ] If clk_hw_register() fails, the corresponding clk should not be unregistered. To handle errors from loops, clean up partial iterations before doing the goto. So add a clk_hw_unregister(). Then use a while (--i >= 0) loop in the unwind section. Fixes: 78013a1cf297 ("ASoC: da7219: Fix clock handling around codec level probe") Reported-by: Dan Carpenter Signed-off-by: Christophe JAILLET Reviewed-by: Dan Carpenter Link: https://lore.kernel.org/r/e4acceab57a0d9e477a8d5890a45c5309e553e7c.1663875789.git.christophe.jaillet@wanadoo.fr Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/da7219.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/da7219.c b/sound/soc/codecs/da7219.c index 50ecf30e6136..4746c8700451 100644 --- a/sound/soc/codecs/da7219.c +++ b/sound/soc/codecs/da7219.c @@ -2196,6 +2196,7 @@ static int da7219_register_dai_clks(struct snd_soc_component *component) dai_clk_lookup = clkdev_hw_create(dai_clk_hw, init.name, "%s", dev_name(dev)); if (!dai_clk_lookup) { + clk_hw_unregister(dai_clk_hw); ret = -ENOMEM; goto err; } else { @@ -2217,12 +2218,12 @@ static int da7219_register_dai_clks(struct snd_soc_component *component) return 0; err: - do { + while (--i >= 0) { if (da7219->dai_clks_lookup[i]) clkdev_drop(da7219->dai_clks_lookup[i]); clk_hw_unregister(&da7219->dai_clks_hw[i]); - } while (i-- > 0); + } if (np) kfree(da7219->clk_hw_data); From patchwork Wed Oct 19 08:28: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: 5519 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp337077wrs; Wed, 19 Oct 2022 06:48:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7k03WHbn2GSRqfcQtMM8as//LIAd7MKx3O6S6UhmC2CQUTCxlbXO3Jza2t8ycpzd9NVpbc X-Received: by 2002:a63:8a42:0:b0:45f:f0f0:148f with SMTP id y63-20020a638a42000000b0045ff0f0148fmr7487458pgd.93.1666187306290; Wed, 19 Oct 2022 06:48:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666187306; cv=none; d=google.com; s=arc-20160816; b=NER9CsrfJGwTA1UuAaoU8mrWptgqCBLzaJyZ7aFnFnevJ6w5JMm9yGrx8hoRdONff6 W1jOtDQjfuNjQqUhbHU/M43tsjIDO4YkK8Vn/8EmXXKjCPEMpP04tNXJUkeZVDMGSyr3 XnheyLsev8JgO8lQwrb70HtYQGtsAhjt93GIvxVC79D/ClVteqljRatFpBrhJEvLbjbr sRilM8aZqB6+1aBJds/V+W5dKG1+vzbv1UEgaJglawmMRWan5ZC0FV/vLdiU3B+obaHQ JOu5CN2I5EjSaj3QwoSjFinHr8eg2o9bBdCfN9a6DZ5K3lReG2t0L5LKuFpBYer0A5Lv BiFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YMkMpSpySSxc43BYa6DFfK55cI67/0AlyjA3EPWY6O0=; b=UKeV8Tnoxa2bvKpqCrb2WGlgoQuKxe+98m/kxxp3pSVwu1IZpJnBchfXvmQswkyptS +rHVoR9ptxuiAoU/jRi8NUU7xGUK+dLJWEmvlaD5T7zk8LQsbr/SbCpshROb5qQYlJt6 k7yqGT6RicoFu7LLyqrjIM+yCbceW5kIKNkunY8t2ZKIvESoGqQtduANxSsqiClKre8C DPQrSsjGawspAF3LRtzCZE5hD+vjHnUO4ed0OzaA9bv636RytCxSkLqEuYfAFHWlWTwz hc8wAtByzVDGy6qE9f+A8HuFgzi1waX0g7qC7pFer8r/0RDfPUenKwRH1ziKhuo9HsDb j8Dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TnG5ABJn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u8-20020a654c08000000b0043c9d3b9c83si18695196pgq.140.2022.10.19.06.48.12; Wed, 19 Oct 2022 06:48: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=TnG5ABJn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233553AbiJSNrr (ORCPT + 99 others); Wed, 19 Oct 2022 09:47:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233038AbiJSNqT (ORCPT ); Wed, 19 Oct 2022 09:46:19 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B1341C8D5F; Wed, 19 Oct 2022 06:32: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 84954B8238E; Wed, 19 Oct 2022 08:56:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D6613C433C1; Wed, 19 Oct 2022 08:56:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169774; bh=auWKAyOEcstI5M0Up/N11Wg8er7p4yNk4AWhb3Gv2v4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TnG5ABJnUqeT0HZMIFowigIm/rbydeqM1wHl7SFcZjppex9hDPgpvKqPqDzJJDupB fjgyueYdP8YyCZr6806z2vHd14F3jEYLtRkmrfzm1tuyMDnlSwLub9jZ1+BkduTmnR EpHrHFD2v3xd4qzPNuN3Lf9Ss/nQY1cAo+4L3Su4= 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 6.0 403/862] ALSA: dmaengine: increment buffer pointer atomically Date: Wed, 19 Oct 2022 10:28:10 +0200 Message-Id: <20221019083307.739428529@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747124020893987408?= X-GMAIL-MSGID: =?utf-8?q?1747124020893987408?= 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 5b2ca028f5aa..494ec0c207fa 100644 --- a/sound/core/pcm_dmaengine.c +++ b/sound/core/pcm_dmaengine.c @@ -133,12 +133,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 Wed Oct 19 08:28: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: 5577 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp352190wrs; Wed, 19 Oct 2022 07:16:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4CtK2XGN98q6/xj40ooAToG5iXT5R+9ScyIMjyWZONJuhSthpCr88Mlcf58nlqCLV5vHdR X-Received: by 2002:a05:6402:169a:b0:458:fe61:d3b4 with SMTP id a26-20020a056402169a00b00458fe61d3b4mr7572387edv.140.1666188987431; Wed, 19 Oct 2022 07:16:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666188987; cv=none; d=google.com; s=arc-20160816; b=APJDeZCw4XbtoigDQ3u+in1UJ7oNSPIpmnXFVNF1fRPj7kjO39K59j1aHINq6ALQ3Y Hgj6Ep8QbYAdko0FPCqkwSOvo938bfasPIaG8YvyY3yarpIWyotNDlPOD9aHUtT4VgrI u7gTSpNFL6NwS5ZR+aNaaiEry4DIgVKgN5sX0DfXmhYkX0hfckOBLB2pONyWl27CGqes 71eGJbxa+mcCK8r80+qCUJiYCGD8aQ2pqeO27LzYl9Ta+mYLfG9Ief45D+s3fkNKe6df mZtQ4wkGTchk9QDRQL9eYLdVeLEC9EaVQW1zy6kylavyU8kJ3MlJxFS81yFpF8k7pjJo rAbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QJQp++MzUms/1JVp2+81Qm4114iR+ppLOFcZgdXVtis=; b=e9lNr+H1z+TBY4qPt9flhsBUy54Qfh7ytYkFhy/TOBPvEW2s6uyzu5hBpbjdNjCzvU WX5Tmxg/VyhHdnvrdPl3tWHsX3MXnsnjm+ZluyhgtKe53SLBofttilgh0iYORnzZbqBo lnVs30OdoyfqNpn0WjaUzTj1oH5sH1gU7ZhIZQKovvmsgPNMhyCqbuCDyqkYWe8H2nYn CIqFQboBgjBv/9xXAs0iW2Du6I/HhPuHcuhYOIxshR9wtFSMkG/xbTD/hqOWiuPoxaIL 5PH2J2FBoPMZ5Bh19mSxcXOJgiP20opGZhQgEljpYn/QCO9ryHbN9jBtt2WZZeWuxdaB bYtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=L3jvUQLp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g14-20020a1709065d0e00b0078219af8361si13662319ejt.883.2022.10.19.07.15.50; Wed, 19 Oct 2022 07:16:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=L3jvUQLp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231844AbiJSN6i (ORCPT + 99 others); Wed, 19 Oct 2022 09:58:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234044AbiJSNyk (ORCPT ); Wed, 19 Oct 2022 09:54:40 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E433F132DD5; Wed, 19 Oct 2022 06:37: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 9C427B823FB; Wed, 19 Oct 2022 08:56:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F5CFC433C1; Wed, 19 Oct 2022 08:56:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169779; bh=HHebO/JQrjiVOVr4n+bmDjcuNofUzDO5209bu/y3qb8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L3jvUQLpR7Xl54flkM3dZjrg4z8itK7c2CJ4K+JzVJd+At7v4CFN2HV+qgf6U4tzI 2mN9avwKmbmuWMZvVVQOf/SUZFN4EcWNL40Z3H47ldEv6PsYcc4tinVX+MUbLwHeLB jlap0cgdDVsrNvd/bRBrGC/mFBOlL1ppq0otGoyA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Dan Carpenter , Ulf Hansson , Sasha Levin Subject: [PATCH 6.0 404/862] mmc: wmt-sdmmc: Fix an error handling path in wmt_mci_probe() Date: Wed, 19 Oct 2022 10:28:11 +0200 Message-Id: <20221019083307.789744074@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747125784115074514?= X-GMAIL-MSGID: =?utf-8?q?1747125784115074514?= From: Christophe JAILLET [ Upstream commit cb58188ad90a61784a56a64f5107faaf2ad323e7 ] A dma_free_coherent() call is missing in the error handling path of the probe, as already done in the remove function. Fixes: 3a96dff0f828 ("mmc: SD/MMC Host Controller for Wondermedia WM8505/WM8650") Signed-off-by: Christophe JAILLET Reviewed-by: Dan Carpenter Link: https://lore.kernel.org/r/53fc6ffa5d1c428fefeae7d313cf4a669c3a1e98.1663873255.git.christophe.jaillet@wanadoo.fr Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin --- drivers/mmc/host/wmt-sdmmc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/wmt-sdmmc.c b/drivers/mmc/host/wmt-sdmmc.c index 163ac9df8cca..9b5c503e3a3f 100644 --- a/drivers/mmc/host/wmt-sdmmc.c +++ b/drivers/mmc/host/wmt-sdmmc.c @@ -846,7 +846,7 @@ static int wmt_mci_probe(struct platform_device *pdev) if (IS_ERR(priv->clk_sdmmc)) { dev_err(&pdev->dev, "Error getting clock\n"); ret = PTR_ERR(priv->clk_sdmmc); - goto fail5; + goto fail5_and_a_half; } ret = clk_prepare_enable(priv->clk_sdmmc); @@ -863,6 +863,9 @@ static int wmt_mci_probe(struct platform_device *pdev) return 0; fail6: clk_put(priv->clk_sdmmc); +fail5_and_a_half: + dma_free_coherent(&pdev->dev, mmc->max_blk_count * 16, + priv->dma_desc_buffer, priv->dma_desc_device_addr); fail5: free_irq(dma_irq, priv); fail4: From patchwork Wed Oct 19 08:28: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: 4700 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp213751wrs; Wed, 19 Oct 2022 02:11:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7dEYVqtsz3+OnUVURqLigosC5xcONDMq871ffygGskG2xWNEpZI7T9vVX4T8t7gi4xaQl8 X-Received: by 2002:aa7:d454:0:b0:459:9ae7:725b with SMTP id q20-20020aa7d454000000b004599ae7725bmr6461527edr.165.1666170659982; Wed, 19 Oct 2022 02:10:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170659; cv=none; d=google.com; s=arc-20160816; b=i4bmjGkvbdu97EDNNGh/1Q3hIz2RbwvQ4Zo3sGUNvpikIlwlGjMjUOuDL/skvS3zgr Fzzh7cfCVtpYwdRwpiW7X+qn9f9ydJT28ySTSpCFgSWg33PVVgSHZeEVutct6DfhHEof /ZS5MaaiUB1378QKeFCsRojl4//oF5MS71jK2fff/FuKi8KK/nGgjFpS4Qlohzce5Puc O95eAFQ0oLVCbKm0EGvhXEuRk77l6/gx3sfNwxDOLRRt1CxIyZaL+moXbtqkf0PF5+eJ 1agScFOp4DoEEDDe1jASCoC+R+yNsRv6nbVY/hAf4xRQ0jv2xcjsqLTGEPLMB+6cK7Ae MGFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TsxYWpYrcpl7P6t3WX6++nUH623cHdMDnHdO2bFlZxs=; b=vo5qHeTDmJTISAYRVOm+/rKa8zbiJ/4JJqQot4pY5GxF8Ht8acc6wvZlcoTNrUG39U XC2nXM2KGNc6OeJkHaumE84lCLELhUyeRKEIciNqadJDN4qHhyJfxjNhk0cvPP904NZe 6JVmileB9BYItytvs/RfJdebBpad0Whijcpw04Ul0GTNyotOTVEzZ5RIJvtvyqPrG03w +kY5s8MpyhY33i6vYR5DSvUffWc+ssLEDWlCUW/Fscu8T9Rbb+Kf0SRPOvRLVgkQuBFe GuPpfLaqmojOWZNVy90w0fePt0pkEzeqDe0cipyGyfKqXDcNw0CJF6tB1VU0dQAYkURi FcDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aX3Cx31B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m4-20020a056402430400b0045ca15afe1csi14286912edc.553.2022.10.19.02.10.33; Wed, 19 Oct 2022 02:10: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=aX3Cx31B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232456AbiJSJGS (ORCPT + 99 others); Wed, 19 Oct 2022 05:06:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232528AbiJSJEa (ORCPT ); Wed, 19 Oct 2022 05:04: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 CEF78AE87D; Wed, 19 Oct 2022 01:57: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 dfw.source.kernel.org (Postfix) with ESMTPS id A394161876; Wed, 19 Oct 2022 08:56:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3F21C43142; Wed, 19 Oct 2022 08:56:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169782; bh=sByEGu5DwWG/ZQcSeCd52zZmd43PIsJ/HeVT8zR41nk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aX3Cx31B2PUM5CUtZriCaIYs94GevP2Vz0PcHj8DOWRNhCcGrWRPiaDziUc730q7X z5rqfpQ8LjNJSSX8nyvLViDbGe47MnNn+h1FaOw83GtptMhkA1PrQUJyi6ywzmRuGK KTTUG4+eHr10lgJESizbcJ0z4rGSMqIRHrOYL2wM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Qilong , Olivier Moysan , Mark Brown , Sasha Levin Subject: [PATCH 6.0 405/862] ASoC: stm32: dfsdm: Fix PM disable depth imbalance in stm32_adfsdm_probe Date: Wed, 19 Oct 2022 10:28:12 +0200 Message-Id: <20221019083307.843102826@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106566311690536?= X-GMAIL-MSGID: =?utf-8?q?1747106566311690536?= From: Zhang Qilong [ Upstream commit b9a0da5b2edcae2a901b85c8cc42efc5bec4bd7b ] 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. We fix it by moving pm_runtime_enable to the endding of stm32_adfsdm_probe. Fixes:98e500a12f934 ("ASoC: stm32: dfsdm: add pm_runtime support for audio") Signed-off-by: Zhang Qilong Reviewed-by: Olivier Moysan Link: https://lore.kernel.org/r/20220927142601.64266-2-zhangqilong3@huawei.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/stm/stm32_adfsdm.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sound/soc/stm/stm32_adfsdm.c b/sound/soc/stm/stm32_adfsdm.c index 04f2912e1418..643fc8a17018 100644 --- a/sound/soc/stm/stm32_adfsdm.c +++ b/sound/soc/stm/stm32_adfsdm.c @@ -335,8 +335,6 @@ static int stm32_adfsdm_probe(struct platform_device *pdev) dev_set_drvdata(&pdev->dev, priv); - pm_runtime_enable(&pdev->dev); - ret = devm_snd_soc_register_component(&pdev->dev, &stm32_adfsdm_dai_component, &priv->dai_drv, 1); @@ -366,9 +364,13 @@ static int stm32_adfsdm_probe(struct platform_device *pdev) #endif ret = snd_soc_add_component(component, NULL, 0); - if (ret < 0) + if (ret < 0) { dev_err(&pdev->dev, "%s: Failed to register PCM platform\n", __func__); + return ret; + } + + pm_runtime_enable(&pdev->dev); return ret; } From patchwork Wed Oct 19 08:28: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: 4698 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp213747wrs; Wed, 19 Oct 2022 02:10:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5luYXEgaOZ+3HZ5jvYPnTyHiQ6Hh9vWpnVPNb6P6dWd7V0N1tnO+giGT82tR8bPkOTmYB1 X-Received: by 2002:a17:907:16a7:b0:78d:f5d4:a74e with SMTP id hc39-20020a17090716a700b0078df5d4a74emr5886892ejc.9.1666170659570; Wed, 19 Oct 2022 02:10:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170659; cv=none; d=google.com; s=arc-20160816; b=QkJWo2/iERz6HNGj2z3Rhxs5fP8TtV6luvGxeBI4lS8w/XqzTQ8kEIVLWOd2h88A1A +T4vzwZrl0n0soh6VHVS0Io1dZijsg/Zojlo7wzJc8o0KViAy3mqQuoqkdF+tybs/Aya tWoWMB4OQWXEtLTIjLRmT9sSTjhLd6htYGBoDilEJ4M25yj2EcuB4kM6zOwUTvyB9pcD +UZ9okCMfN+F5CFyKnfmnCF9BCmIiPbon4I4nckbJU6DAoGk5MhdeWGS3tChLbWxZKOB DRWeMlBgiiq360A8avnRq3W/8rzwq+c2L+oXhsjW2IgfqLLstwRyZXxe0vew/WI9/+rU DdBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Sm2iJfXdhF//l5M5YvQrQ/xmTrFfVkZIKoWgDb4byGM=; b=njQkNQXF0CJ1fYpAm8aF8KH727zEjRqAyb/BRNb3vyA4sOmyIuTaclZz6mqP1yTrye vdRCjn4PuwSoghc+IF2iPkmIpcgqSdOcimDKOMws0a63B9d2K4PU4X3ktkpplkrTMrMx dW+e5lqWAb6MGuYueyf9qPK+3x9nY2cP+9AREoxR52B7CC1Co06mjmm3mmQPLUgTPPWT 5ex8T+MtwES3cY+Qu1MSqoXoTD/3nbCnOetA+AKcbpdF5k4jGYcMf+fUOSjEqmGBizdo /pVL91KAwEEnffSH0USXbXK4rklC3J+qyphaQodFBEgVIzf5tx28Q6ksG+E96iuKhEa+ +NCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FJTgDp1k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c37-20020a509fa8000000b00459fd8d90d0si13042515edf.244.2022.10.19.02.10.33; Wed, 19 Oct 2022 02:10: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=FJTgDp1k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232406AbiJSJGQ (ORCPT + 99 others); Wed, 19 Oct 2022 05:06:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232515AbiJSJE2 (ORCPT ); Wed, 19 Oct 2022 05:04:28 -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 7CC1FAF1A6; Wed, 19 Oct 2022 01:57: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 3E91061802; Wed, 19 Oct 2022 08:56:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C4C3C433D6; Wed, 19 Oct 2022 08:56:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169784; bh=tCpDlL40jrwntMcVjsOyaiSsrTNTevG/xosowBF2D0Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FJTgDp1kHoUl9MP8hF5ivh6SlaSfJjgD/iE/CUNTJhcqiVzlm0cpZurc62Pd+qX4M 0Z/mVXc3VVy1nuhqXlJ26+uz86MBJU+xVhXfa/RydNnskPRyQWWTAb41cCFAbOZowf KL1IMb5zveihAdBsnP6UIUpoly8nqqtripu3/9OQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Qilong , Olivier Moysan , Mark Brown , Sasha Levin Subject: [PATCH 6.0 406/862] ASoC: stm32: spdifrx: Fix PM disable depth imbalance in stm32_spdifrx_probe Date: Wed, 19 Oct 2022 10:28:13 +0200 Message-Id: <20221019083307.893761182@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106565671606469?= X-GMAIL-MSGID: =?utf-8?q?1747106565671606469?= From: Zhang Qilong [ Upstream commit 0325cc0ac7980e1c7b744aab8df59afab6daeb43 ] 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. We fix it by moving pm_runtime_enable to the endding of stm32_spdifrx_probe. Fixes:ac5e3efd55868 ("ASoC: stm32: spdifrx: add pm_runtime support") Signed-off-by: Zhang Qilong Reviewed-by: Olivier Moysan Link: https://lore.kernel.org/r/20220927142601.64266-3-zhangqilong3@huawei.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/stm/stm32_spdifrx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/stm/stm32_spdifrx.c b/sound/soc/stm/stm32_spdifrx.c index 0f7146756717..d399c906bb92 100644 --- a/sound/soc/stm/stm32_spdifrx.c +++ b/sound/soc/stm/stm32_spdifrx.c @@ -1002,8 +1002,6 @@ static int stm32_spdifrx_probe(struct platform_device *pdev) udelay(2); reset_control_deassert(rst); - pm_runtime_enable(&pdev->dev); - pcm_config = &stm32_spdifrx_pcm_config; ret = snd_dmaengine_pcm_register(&pdev->dev, pcm_config, 0); if (ret) @@ -1036,6 +1034,8 @@ static int stm32_spdifrx_probe(struct platform_device *pdev) FIELD_GET(SPDIFRX_VERR_MIN_MASK, ver)); } + pm_runtime_enable(&pdev->dev); + return ret; error: From patchwork Wed Oct 19 08:28: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: 5502 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp336227wrs; Wed, 19 Oct 2022 06:46:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM42mKS96Ayczoc5sZmfVzUPkpfg05Q4u/3S2vFoP8iVfoVi2jCR7OMZg5nv0B38FYuLqoNE X-Received: by 2002:a17:902:e952:b0:17c:7aaa:c679 with SMTP id b18-20020a170902e95200b0017c7aaac679mr8845259pll.74.1666187198634; Wed, 19 Oct 2022 06:46:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666187198; cv=none; d=google.com; s=arc-20160816; b=iPHc5JDk2XK5NoGPXduU5RkPCX212etUNHwbgaR+XHWIOLSasY+8iEpWlq9TdLBa/t pNtyCxvdw22nargWUVdgyP1gEGRVbs7CliSVHwDOEr6eKF4FXeU8BOLsUIhbJD5LReMX YSF1ptJwNFv75xHFEx89mTfz5lQzxGsGITlsw3zegDoFbNn4V5RPPWrPDi1LOIkZJZFO PKvH53ZH2j70m55GbQn3sG7HwhhRUK8h7ohTdQ/yDYIn5eXQokudd7iI5tys9eomopoH b6VVnA9KooCB9VxmklAUk4KdLqWoB4t6rURYxc5/JW1sYXHxn6gJiEzNPsy8tzv9rsk7 1iEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=78fNF2frlMch9gnhmTGEjgbTP4Ptqnvl0QatZ9VZq4k=; b=zKhBNxWenByBiKxxhxKqD27I/jAhcQg2C1G6qQWIEEs9q6zthT6ZwGGQrAtt7J1w6E Qsc5R+cQYCfQ7uB5TvnWwvrk6wokJMz8Y321Tt/wNwFCxt/WrYaSFw34ZwX8AgRxKeCl +KZIsujoWHOfxiYcNbEUc8d6tvhNRhsG8KnV4Y4onyMjxRuRSXozg847ChV6k/CLAzXo x7+/7EgqgwsY5UdWcBlqPc5dNg3z8FcqQ9SzhyQrubMifQ4NZ3VTAy17QL8JZiOV8KUy Q9U2pyQW0I0Apxjb9sokYGUopjhzqA7Bbb4vLBqVvsPJMnhD84fDORuzqfXuGBvPiGam peUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eIcNm3x0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l1-20020a170902f68100b00179d2e2e690si21690834plg.332.2022.10.19.06.46.26; Wed, 19 Oct 2022 06:46: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=eIcNm3x0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232227AbiJSNpw (ORCPT + 99 others); Wed, 19 Oct 2022 09:45:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230346AbiJSNoe (ORCPT ); Wed, 19 Oct 2022 09:44:34 -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 0659AD8B; Wed, 19 Oct 2022 06:31: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 843E3B8241C; Wed, 19 Oct 2022 08:56:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD26FC433D6; Wed, 19 Oct 2022 08:56:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169787; bh=mHHiX2Vds7w034Q/10+IvKu6BhX3WEG6qDXMWNVsef8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eIcNm3x04mz+6L+fwf3zcZEzC5J37pUA4zgEcxrJX7ujP6wKuQ/WgYF4iwa55PHCc +2O7EBJ2o2A7kAXQTfT9u3ce52QS8hm225guwQbRWKhFj2u2lZPmfykjn/FVR+2Eub LiBgzOO63/j11GQypFc1vjowgNpUg5RQZD4n/YBI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Qilong , Olivier Moysan , Mark Brown , Sasha Levin Subject: [PATCH 6.0 407/862] ASoC: stm: Fix PM disable depth imbalance in stm32_i2s_probe Date: Wed, 19 Oct 2022 10:28:14 +0200 Message-Id: <20221019083307.934299755@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123908022730675?= X-GMAIL-MSGID: =?utf-8?q?1747123908022730675?= From: Zhang Qilong [ Upstream commit 93618e5e05a3ce4aa6750268c5025bdb4cb7dc6e ] 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. We fix it by moving pm_runtime_enable to the endding of stm32_i2s_probe. Fixes:32a956a1fadf ("ASoC: stm32: i2s: add pm_runtime support") Signed-off-by: Zhang Qilong Reviewed-by: Olivier Moysan Link: https://lore.kernel.org/r/20220927142640.64647-1-zhangqilong3@huawei.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/stm/stm32_i2s.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/stm/stm32_i2s.c b/sound/soc/stm/stm32_i2s.c index 6aafe793eec4..ce7f6942308f 100644 --- a/sound/soc/stm/stm32_i2s.c +++ b/sound/soc/stm/stm32_i2s.c @@ -1136,8 +1136,6 @@ static int stm32_i2s_probe(struct platform_device *pdev) return dev_err_probe(&pdev->dev, PTR_ERR(i2s->regmap), "Regmap init error\n"); - pm_runtime_enable(&pdev->dev); - ret = snd_dmaengine_pcm_register(&pdev->dev, &stm32_i2s_pcm_config, 0); if (ret) return dev_err_probe(&pdev->dev, ret, "PCM DMA register error\n"); @@ -1180,6 +1178,8 @@ static int stm32_i2s_probe(struct platform_device *pdev) FIELD_GET(I2S_VERR_MIN_MASK, val)); } + pm_runtime_enable(&pdev->dev); + return ret; error: From patchwork Wed Oct 19 08:28: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: 5575 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp351862wrs; Wed, 19 Oct 2022 07:15:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5gF4uqcNzSQJcThNTdTfi1TyhSKtJFuYOYoWZ8qpbv/3ZtwCYa8uSzCsYYsuLyUllE0Hdz X-Received: by 2002:a63:234b:0:b0:46b:208f:1e72 with SMTP id u11-20020a63234b000000b0046b208f1e72mr7103455pgm.581.1666188956638; Wed, 19 Oct 2022 07:15:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666188956; cv=none; d=google.com; s=arc-20160816; b=fns4jvNqX8qRSoDQG3lKhdPh/ZohT9Et8ywoMzmfy9SU37vKR2RBqUSIsIj9+73WtN FPvBd1XZeqSi2VYLSNLTPjWiOZmXcbeoO47L/KVpyEDXNm/N1qB+dUIFLDPeUCeyBzXO Q0rJzbz8sbMl4LF830KeuvT8i2voeBoZw06Bgl8SSfpjrS445Skzb3j2FzEctQezNEVs QocxkJHpgbDb49pAgz/kijfYrIJQPwArFudOaZURe5uLXHdUMUm8k8xXYyN6X+t672WG aJOOF6xzshJ1ZsR7p3SvGnZO8bhpgEtSJ+mB1rUlsmN1XKGS1FXC30LnidWrIQFgjrrc Gu6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=V4CPTEPQBs6TBJGplhkwwspz/7rsSKCCeWzQbGy7k5o=; b=gbHKVtoWaNNL7y+LSOBW0lANFL8QMlTdZNjnL7IIJvMDAtbzFbV79wK9My0mprgYHY 3yqqzruKq24rf56FPFeLpyOTBz0eAq3A61O6ALFIjD7rQQoKLrf7QiuW36zP8zqcoLhC 78MIC6l/zw9reqZPDiGkPvsODL/8cxYGBRh47slr0h4mM7w2RqVlwOXurc0NzxW1fqiw Sn2oWxgYIDAYu2zDLmKH4/BfJ1nTijPqAcmIO6A40XMqWZtmqUm5rBcE+0/u/olmIUwM Rbg8zDrBRwb+DsOu/O1VxgWnEqAyJLnvSgKq0g9Jdj2d13ssKM9NWlSZcPyRb3BL2I7W 7wKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aFcB1uTe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 202-20020a6305d3000000b00460b109a025si18238387pgf.232.2022.10.19.07.15.33; Wed, 19 Oct 2022 07:15:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aFcB1uTe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230293AbiJSN7l (ORCPT + 99 others); Wed, 19 Oct 2022 09:59:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234401AbiJSNzw (ORCPT ); Wed, 19 Oct 2022 09:55:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA34819E938; Wed, 19 Oct 2022 06:38: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 2BFACB8241B; Wed, 19 Oct 2022 08:56:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80E2BC433C1; Wed, 19 Oct 2022 08:56:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169789; bh=G8xADkDPYcWBWUslQAaiMJUF6p8+GO7B2dJtWPf4nTU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aFcB1uTeve38IFckh1KxMeEfYwJKccu2+s1hUmV6k9AYEGV0saVzcieGeEf48KnPn yIM17KzX2HRXAseqF9Sx2rBglMiuwTueUefBLlLUVYRJyl/sAyJ16GAWp2s1TuZGOv DC//5rV3wKxtCx4YLrnUccn2xqB+LxdzeU4djDkk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Mark Brown , Sasha Levin Subject: [PATCH 6.0 408/862] ASoC: wcd-mbhc-v2: Revert "ASoC: wcd-mbhc-v2: use pm_runtime_resume_and_get()" Date: Wed, 19 Oct 2022 10:28:15 +0200 Message-Id: <20221019083307.983393057@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747125751179024829?= X-GMAIL-MSGID: =?utf-8?q?1747125751179024829?= From: Krzysztof Kozlowski [ Upstream commit e18f6bcf8e864ea0e9690691d0d749c662b6a2c7 ] This reverts commit ddea4bbf287b6028eaa15a185d0693856956ecf2 ("ASoC: wcd-mbhc-v2: use pm_runtime_resume_and_get()"), because it introduced double runtime PM put if pm_runtime_get_sync() returns -EACCES: wcd934x-codec wcd934x-codec.3.auto: WCD934X Minor:0x1 Version:0x401 wcd934x-codec wcd934x-codec.3.auto: Runtime PM usage count underflow! The commit claimed no changes in functionality except dropping the reference on -EACCESS. This is exactly the change introducing bug because function calls unconditionally pm_runtime_put_autosuspend() at the end. Fixes: ddea4bbf287b ("ASoC: wcd-mbhc-v2: use pm_runtime_resume_and_get()") Signed-off-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20220929131528.217502-1-krzysztof.kozlowski@linaro.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/wcd-mbhc-v2.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sound/soc/codecs/wcd-mbhc-v2.c b/sound/soc/codecs/wcd-mbhc-v2.c index 98baef594bf3..31009283e7d4 100644 --- a/sound/soc/codecs/wcd-mbhc-v2.c +++ b/sound/soc/codecs/wcd-mbhc-v2.c @@ -714,11 +714,12 @@ static int wcd_mbhc_initialise(struct wcd_mbhc *mbhc) struct snd_soc_component *component = mbhc->component; int ret; - ret = pm_runtime_resume_and_get(component->dev); + ret = pm_runtime_get_sync(component->dev); if (ret < 0 && ret != -EACCES) { dev_err_ratelimited(component->dev, - "pm_runtime_resume_and_get failed in %s, ret %d\n", + "pm_runtime_get_sync failed in %s, ret %d\n", __func__, ret); + pm_runtime_put_noidle(component->dev); return ret; } @@ -1096,11 +1097,12 @@ static void wcd_correct_swch_plug(struct work_struct *work) mbhc = container_of(work, struct wcd_mbhc, correct_plug_swch); component = mbhc->component; - ret = pm_runtime_resume_and_get(component->dev); + ret = pm_runtime_get_sync(component->dev); if (ret < 0 && ret != -EACCES) { dev_err_ratelimited(component->dev, - "pm_runtime_resume_and_get failed in %s, ret %d\n", + "pm_runtime_get_sync failed in %s, ret %d\n", __func__, ret); + pm_runtime_put_noidle(component->dev); return; } micbias_mv = wcd_mbhc_get_micbias(mbhc); From patchwork Wed Oct 19 08:28: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: 4745 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214517wrs; Wed, 19 Oct 2022 02:13:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM53RXUA7wBQ74TR5tcj9w7/EcJRlJ7xX/Po7/qqoU5hQlA6YvDGQbsIusD6j6KUw3pjTR/m X-Received: by 2002:a17:907:70a:b0:750:bf91:caa3 with SMTP id xb10-20020a170907070a00b00750bf91caa3mr5698293ejb.711.1666170782207; Wed, 19 Oct 2022 02:13:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170782; cv=none; d=google.com; s=arc-20160816; b=VmyMkV+ESoUD0DLUzkOxf/+ityOGlMmTN7Q7ORvjEUq/CN/fAZRU/Fg19u+OXKn8Uz /vOq+wdOf3e/5P91Ektx1GG8g8CH6/ixcX49aVEHoGIIg/xKZ0e12r1b89+to8xbIphh gzVH0PA2LJQvGAdP8RRXXQ+t/mQeoELjuI5lJQgC2vRxJ8JyExFM7QFiCciX0429YKKn QKaFs7gQkPbQ+P8vRzcTTRdn6ijeFvfKN0RRH6HKw14k8fXPL28TCnQuWPyK2sUn0cPS V/d3raRMOwy37MmhDSB2xKt9hLErBuTuX9wPpe9lbPe2FScGuBuKOatg/26x2onmmiUp VfiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5LY1TBJ92AoAUaZ9F6o9IomwhUtkNEKZBWpz8HDN9n8=; b=bLNYiirEsT1C6b+XNjDs/AdSX3bl8Pi7hmfvUIvJO00CU2W7cLzM/gLTwuveU16FZz tjQmAMrrd3eBw5acajZmHCqsxSCw38nGBT+boIr1DbkkdhDOBVVIoPoNlh6jRE2ZDN1R IVA6MMbnrZNIQSSKgo4YINMtoNhd+UgqYASzVW7lQHu2b00fgto07lRLEh3cxFFZSllY LvLinKo8NG3Knp8kqbZurpSi4sw3mkqRKbGBevvyn0gCoIJSeHC/SNIQ481e8W9Z/nO7 NzoAs5Q5FGjyaHCLpp+1eEoaTiZdlzxupKZm/KBG1jVLY4+SYSZATjGjmvyD6UIrqXMD 4vxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZQzeNqKo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a50f696000000b00459fc3fcf0bsi12798697edn.101.2022.10.19.02.12.35; Wed, 19 Oct 2022 02:13: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=ZQzeNqKo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232635AbiJSJK5 (ORCPT + 99 others); Wed, 19 Oct 2022 05:10:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232616AbiJSJHz (ORCPT ); Wed, 19 Oct 2022 05:07:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08E7D37190; Wed, 19 Oct 2022 01:59: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 9E1E161834; Wed, 19 Oct 2022 08:58:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6420C433C1; Wed, 19 Oct 2022 08:58:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169904; bh=8W+/NxM68L/g8fN9dQL5KTSadQlgiAONnvY1bNitC18=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZQzeNqKokc5C6+Qts2dgd3Dxj+R9/DZtZjXqpuTGPsUHfYRY2HgCEvA+q0mWuASWL DZMAggyXX0ARRIRRloIxaC4lYUrv9xsdjKu2eJWRmtKyM5XrNZMMdIA05+B21OWpYv 5+xGx5yFQC080qtaGW7T7CtTTOex7TW8vaFFT1mQ= 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 6.0 409/862] ASoC: wm8997: Fix PM disable depth imbalance in wm8997_probe Date: Wed, 19 Oct 2022 10:28:16 +0200 Message-Id: <20221019083308.028299921@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106694024490966?= X-GMAIL-MSGID: =?utf-8?q?1747106694024490966?= From: Zhang Qilong [ Upstream commit 41a736ac20602f64773e80f0f5b32cde1830a44a ] 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. We fix it by moving pm_runtime_enable to the endding of wm8997_probe Fixes:40843aea5a9bd ("ASoC: wm8997: Initial CODEC driver") Signed-off-by: Zhang Qilong Link: https://lore.kernel.org/r/20220928160116.125020-2-zhangqilong3@huawei.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/wm8997.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sound/soc/codecs/wm8997.c b/sound/soc/codecs/wm8997.c index 210ad662fc26..77136a521605 100644 --- a/sound/soc/codecs/wm8997.c +++ b/sound/soc/codecs/wm8997.c @@ -1161,9 +1161,6 @@ static int wm8997_probe(struct platform_device *pdev) regmap_update_bits(arizona->regmap, wm8997_digital_vu[i], WM8997_DIG_VU, WM8997_DIG_VU); - pm_runtime_enable(&pdev->dev); - pm_runtime_idle(&pdev->dev); - arizona_init_common(arizona); ret = arizona_init_vol_limit(arizona); @@ -1182,6 +1179,9 @@ static int wm8997_probe(struct platform_device *pdev) goto err_spk_irqs; } + pm_runtime_enable(&pdev->dev); + pm_runtime_idle(&pdev->dev); + return ret; err_spk_irqs: From patchwork Wed Oct 19 08:28: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: 4721 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp213941wrs; Wed, 19 Oct 2022 02:11:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5/v37y/Sa8K0Mxwf7toY5CMJ8gGF8JV7cPpNOXw7Jt6yYrpAZhh0vjccYHjlrqRfOr6DWh X-Received: by 2002:a17:907:3e1b:b0:78d:ccd0:c9f8 with SMTP id hp27-20020a1709073e1b00b0078dccd0c9f8mr5963311ejc.705.1666170689852; Wed, 19 Oct 2022 02:11:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170689; cv=none; d=google.com; s=arc-20160816; b=em259b9oxYBsDpiCssRC1QlCrUuJsa97SCwX8dFdU88+3v65YclmTswtoIDREfvvb+ /a2EKOwp9XRvYQEQTV8qcFShsWKwcmLEnyijYfB+UEOD9GEY8r8CNZFyQVrgjGIUxaKy 1ILLOwpLmr6Q2LvOixyMRDtLhq+3NlmykjgFBVZfC6Rhvg5a/+hesBkaU8FhFuZsy7bK jmE8wIyIN8SnLcF88NBP9VT5gR3teldhA0XEqHXHTy1yrO+QDcajoctVURca20Lz2B/C hSPVdXQRopJak4Rxi8yIc5K65TemZFDWO4KJaK559nl0u+Jv3OdbU4WrL1KBiCuzbxmX gYCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Pqsi/oSEHdPrbSUguBdD5ZSFo4p/pDJIQ6PYEa+UnRI=; b=sWTsrGJjVThQq/Dv5hpLr/X10Z0KFMCQTPAZGVESO3yipcjpB2hYMJQnPpc3OdC1Y+ jqfNndHfhAdT8WGF0yZxDPccfKTa3DVchdbw/HvRyF55WUHTJNGsfNu6kmsz13ga1UVJ 28mqZ+9wl7Bze2kWc72Hzm14dil9mJ5f/My4sKkPngrI4TQ/xmi0D5e8MBJ8Kf9/JThC IhNq1oBn0pr4CYQ1WMLGgxm0kOlDMPKOSvxN0t5m2f221dmJxh2gkZVhDGbz553lPd8S QWsSf/bh4H8NUFFVqGECHurEnf8pBi+nLaN9thEEI7Z6YvdJuJWuaiMu5lHs23Uh0H8m gfyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dSmCtjGE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y12-20020a056402270c00b0045d636ca148si10995551edd.575.2022.10.19.02.11.03; Wed, 19 Oct 2022 02:11: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=dSmCtjGE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232488AbiJSJGh (ORCPT + 99 others); Wed, 19 Oct 2022 05:06:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232583AbiJSJEj (ORCPT ); Wed, 19 Oct 2022 05:04:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C308AE85E; Wed, 19 Oct 2022 01:58: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 812516185F; Wed, 19 Oct 2022 08:56:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8DB34C433C1; Wed, 19 Oct 2022 08:56:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169810; bh=2WooE8D/cUxVBYIfx9GZFm20L3hz0GRqkr2akxT6PkE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dSmCtjGE4VOc53QQuDuwGZcD4W+dk5HnghslZoWu2ccz7zGu95u21xOEZOsDCqv6a K7UkOrwElV7smAlULo/fOE2G10cU7t1/paTYgJzc4prjT44HWNNij0RlNkrcU9n+jU 72WZ5/JLxcGX2sO6VyHJ608XH8FoTwO0QYedjV4Q= 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 6.0 410/862] ASoC: wm5110: Fix PM disable depth imbalance in wm5110_probe Date: Wed, 19 Oct 2022 10:28:17 +0200 Message-Id: <20221019083308.076858442@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106597007741846?= X-GMAIL-MSGID: =?utf-8?q?1747106597007741846?= From: Zhang Qilong [ Upstream commit 86b46bf1feb83898d89a2b4a8d08d21e9ea277a7 ] 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. We fix it by moving pm_runtime_enable to the endding of wm5110_probe. Fixes:5c6af635fd772 ("ASoC: wm5110: Add audio CODEC driver") Signed-off-by: Zhang Qilong Link: https://lore.kernel.org/r/20220928160116.125020-3-zhangqilong3@huawei.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/wm5110.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sound/soc/codecs/wm5110.c b/sound/soc/codecs/wm5110.c index f3f4a10bf0f7..fc634c995834 100644 --- a/sound/soc/codecs/wm5110.c +++ b/sound/soc/codecs/wm5110.c @@ -2457,9 +2457,6 @@ static int wm5110_probe(struct platform_device *pdev) regmap_update_bits(arizona->regmap, wm5110_digital_vu[i], WM5110_DIG_VU, WM5110_DIG_VU); - pm_runtime_enable(&pdev->dev); - pm_runtime_idle(&pdev->dev); - ret = arizona_request_irq(arizona, ARIZONA_IRQ_DSP_IRQ1, "ADSP2 Compressed IRQ", wm5110_adsp2_irq, wm5110); @@ -2492,6 +2489,9 @@ static int wm5110_probe(struct platform_device *pdev) goto err_spk_irqs; } + pm_runtime_enable(&pdev->dev); + pm_runtime_idle(&pdev->dev); + return ret; err_spk_irqs: From patchwork Wed Oct 19 08:28: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: 5516 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp336915wrs; Wed, 19 Oct 2022 06:48:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7i81VaJpZiNYRrKk8cGyb5ZrCdkoU6UmO9Xb0oXkUhS0XKOPXSCjTgt4w16vHXi0TGZLy5 X-Received: by 2002:a65:5886:0:b0:439:8dd3:18d4 with SMTP id d6-20020a655886000000b004398dd318d4mr7302115pgu.430.1666187283517; Wed, 19 Oct 2022 06:48:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666187283; cv=none; d=google.com; s=arc-20160816; b=a+/HfzQtCfSNkgWPurRRAz7Eb+r+DALkwZtGuWUNf+wZQxPaxIJ3WgPR3WGey5BHHU PI+HiH8m67L9EtAU8VJRbQTyHruOPLJ2I/wctANXaXTGL7bd2HKQY/ef/mKnS1MV8TEt aGAsUMRRaeXRf2h4Ofyk0G05LKthkRy9r88SOwP1MLez+Qa+pAC3MNc0RmQi5dFBHWgE /jqr6EorlbMgAgMPLgCwWhJmVB8/4Ea/JH1tMb1IQuQNpsM5sdyNutf0iBwMC4rTIJDo nf9/ScCtUZsuZN/Vy72pbSA+U1L0rfoel0eNfPPCgzGMUJa2wqT8jKgC1u1UyA+4bYsp LnlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gCqDLxCWDnbm7o3xud6Kk3H9sqnuTU4nATxEAIdAl1o=; b=jRXkG+JUs5bm+gLsDwwvqKJx0hgpr6ztAWf3aCDK4Xzvi18loMhn+gRYXa730Sloas aZW2tjNY05pW3ccUXXxAJYBxhbcuPns8135sU2G40eynd5hoZpMA2E5yJlaItLmtprqF 1d0dl17ZOtzkvEyPeSW29DRgpxWtZJa0TaA1YWGQRP/0DVtT0pzc0ver2TtIHPM76X8o r+F8sRmHTZ3bP7QpqMaDjfBtw04dJXELbFNr+s3b69ItIzcX9QeLFL/2SImqeCahcBT0 se8bnBQSTa2Fpld5izXtLaJ8eOwCjNhjgwbt2k+HQI9GOOIE1J0DZ8LlsxmeazemiNvc 9yjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="NsIsPX/B"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 129-20020a630087000000b0045ff2a2f56csi17888953pga.546.2022.10.19.06.47.50; Wed, 19 Oct 2022 06:48: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="NsIsPX/B"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231496AbiJSNrU (ORCPT + 99 others); Wed, 19 Oct 2022 09:47:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232627AbiJSNqH (ORCPT ); Wed, 19 Oct 2022 09:46:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1EDA17251F; Wed, 19 Oct 2022 06:32:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D9098B8242F; Wed, 19 Oct 2022 08:57:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2DE70C433D6; Wed, 19 Oct 2022 08:57:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169839; bh=AkyAu0v2j0W7eNhRoo3d/AmvDM+tLyRjv53VS/uc3LE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NsIsPX/BsdinMtfZ02r91UANbrEo0KJsfFR5hPuG3qF3hH8QlKK1GpGxOiTpenHwq R2nQ1T+rqhN7WzaSioPSgCZZEsRwGU1J33F9EOUnj7FwR8KzDwnUX+lU8BKIwT2dFZ sjGptK7Tp59CzesjpeD/kpzCKVLBOmyrmdwOuNdE= 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 6.0 411/862] ASoC: wm5102: Fix PM disable depth imbalance in wm5102_probe Date: Wed, 19 Oct 2022 10:28:18 +0200 Message-Id: <20221019083308.124021930@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123997417906287?= X-GMAIL-MSGID: =?utf-8?q?1747123997417906287?= From: Zhang Qilong [ Upstream commit fcbb60820cd3008bb44334a0395e5e57ccb77329 ] 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. We fix it by moving pm_runtime_enable to the endding of wm5102_probe. Fixes:93e8791dd34ca ("ASoC: wm5102: Initial driver") Signed-off-by: Zhang Qilong Link: https://lore.kernel.org/r/20220928160116.125020-4-zhangqilong3@huawei.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/wm5102.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sound/soc/codecs/wm5102.c b/sound/soc/codecs/wm5102.c index af7d324e3352..c09c9ac51b3e 100644 --- a/sound/soc/codecs/wm5102.c +++ b/sound/soc/codecs/wm5102.c @@ -2099,9 +2099,6 @@ static int wm5102_probe(struct platform_device *pdev) regmap_update_bits(arizona->regmap, wm5102_digital_vu[i], WM5102_DIG_VU, WM5102_DIG_VU); - pm_runtime_enable(&pdev->dev); - pm_runtime_idle(&pdev->dev); - ret = arizona_request_irq(arizona, ARIZONA_IRQ_DSP_IRQ1, "ADSP2 Compressed IRQ", wm5102_adsp2_irq, wm5102); @@ -2134,6 +2131,9 @@ static int wm5102_probe(struct platform_device *pdev) goto err_spk_irqs; } + pm_runtime_enable(&pdev->dev); + pm_runtime_idle(&pdev->dev); + return ret; err_spk_irqs: From patchwork Wed Oct 19 08:28: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: 5534 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp337928wrs; Wed, 19 Oct 2022 06:50:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM77kDVzsGoKyACHXi6lviBJvtGMvT2Q9Afui+vivnfQadOovC9JmRsQMFcfHUIsPugEi0ea X-Received: by 2002:a17:902:b598:b0:184:e49d:3042 with SMTP id a24-20020a170902b59800b00184e49d3042mr8867863pls.16.1666187435003; Wed, 19 Oct 2022 06:50:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666187434; cv=none; d=google.com; s=arc-20160816; b=fCTMpuMtkmQRrSSpu5Rf4zdQ07K9rIvQjhS7Pa7TwkmrpqpTGf9okX9SkDDyd4CkPu ecWxclgh3eL1pJMyAISJfuAi5FLGLRyLSPGobcDyBzdiyNn2u5tU7KyNU9eLUnrmTBDu cFRzC/vKkEb9WkRToLgfqMW0jqxzeu2nZCm1LWPpEDpJ2K4Vzw+e0BBuwdW5DZXQCyQq 8IE3WE12kWlIZP7bH+/EVtpZbhvWrjTqSq5qwuxFLu4B5dhuLyAQkl38Vm6LOA6rUCWa BeO0dRt1rAXNGWcWXXRHrA9GtwlQysypCHrqKP7iVlHw1EmhGouIzjOt/7UDSGR5v/AZ r3bQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=mgctZY9hovJ7vSONoeOa0q44K80Wcy4UrpkPL70jZXo=; b=kza9MF2DoaABOjeRqiWoEaKlg1f2FR5PkzlTypvLQs2j/FBhddF9/uBz1umCWXAkWq ud0MkFwaf4zTEe6AKW0JwodsTfQLJvwE8XJsK2zBlHZOo8cVvxc102Xdvxqk9msULpke dWv+Vji/qkrcD7+8SwxXxzD7QtYe2uevgtsfwEE10r8zwbvg8hK6tfwZjVowaRcuVmQd YQeVva+gH4OW6LK2RrCPsRW6hveFIiXtKtycW6M3LX7yG3aixNhXfXQx1qgXnn5czGuL XDhJHMwOFirU0ruSLP0ZpN0pZppGgtEbbgzwXkQ+qwGyt3RycahE5223jkPirorr9wPM LDiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ngoY4gRp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d9-20020a170903230900b00179dfc0e3a9si21101704plh.193.2022.10.19.06.50.21; Wed, 19 Oct 2022 06:50:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ngoY4gRp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233394AbiJSNtq (ORCPT + 99 others); Wed, 19 Oct 2022 09:49:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233020AbiJSNrl (ORCPT ); Wed, 19 Oct 2022 09:47:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2EDDDED11; Wed, 19 Oct 2022 06:32: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 3791DB82433; Wed, 19 Oct 2022 08:57:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3ACFC433C1; Wed, 19 Oct 2022 08:57:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169869; bh=/DO/MJLKGlxxqHVavgVn6SazxotEdrvId6km3FQ0/N8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ngoY4gRpv1imChIHVLSGYKYSm83F9QLCJgiIH/Oye8OaGzvuuqd0YcsEcUPGioNdW Vp54NJjd9vaO14WtsM98Y/Xa3Z8thFFVIKDDriHE7fwEnS2I2HP4SshFl0MDW0r3cl Yh5yDRGoqgCwp3gvg9IZrwzPinmiJRfmX7su67xA= 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 6.0 412/862] ASoC: mt6660: Fix PM disable depth imbalance in mt6660_i2c_probe Date: Wed, 19 Oct 2022 10:28:19 +0200 Message-Id: <20221019083308.168101481@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747124155588277114?= X-GMAIL-MSGID: =?utf-8?q?1747124155588277114?= From: Zhang Qilong [ Upstream commit b73f11e895e140537e7f8c7251211ccd3ce0782b ] 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. We fix it by moving pm_runtime_enable to the endding of mt6660_i2c_probe. Fixes:f289e55c6eeb4 ("ASoC: Add MediaTek MT6660 Speaker Amp Driver") Signed-off-by: Zhang Qilong Link: https://lore.kernel.org/r/20220928160116.125020-5-zhangqilong3@huawei.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/mt6660.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/mt6660.c b/sound/soc/codecs/mt6660.c index ba11555796ad..45e0df13afb9 100644 --- a/sound/soc/codecs/mt6660.c +++ b/sound/soc/codecs/mt6660.c @@ -503,13 +503,17 @@ static int mt6660_i2c_probe(struct i2c_client *client) dev_err(chip->dev, "read chip revision fail\n"); goto probe_fail; } - pm_runtime_set_active(chip->dev); - pm_runtime_enable(chip->dev); ret = devm_snd_soc_register_component(chip->dev, &mt6660_component_driver, &mt6660_codec_dai, 1); + if (!ret) { + pm_runtime_set_active(chip->dev); + pm_runtime_enable(chip->dev); + } + return ret; + probe_fail: _mt6660_chip_power_on(chip, 0); mutex_destroy(&chip->io_lock); From patchwork Wed Oct 19 08:28: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: 5056 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp247974wrs; Wed, 19 Oct 2022 03:42:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4HE/o2fbsQpuf1lI4GlNkFHaYM70AJC74Nbr0pmuIdyToYmDhcCSsnWMNqolYd13B7SRWq X-Received: by 2002:a17:906:4bd3:b0:731:3bdf:b95c with SMTP id x19-20020a1709064bd300b007313bdfb95cmr6154629ejv.677.1666176140703; Wed, 19 Oct 2022 03:42:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176140; cv=none; d=google.com; s=arc-20160816; b=pH90D40Lvo7e94I5VcXy5nUW8VWlVGWFOPS/L9eICv6LiuvhJsu8OrlZU+nQZQUNL6 O7nzGontthrQsoxo272q5b/08qdsNYS9UxXTmEQKtjJOzb5XlfXGeu8xf46Mh60HRyUY 5ZsV/T7BLsqM+11DmMkNEzVvS19q3TF4eRDjrez/gSASaWqvvuBmz4q/bIR/4Tj1BZl5 PnGjtoBL/24YBKpvDTFJIiP/Ew0r2Ajky9XaYu3OQND1trpim3/ToKQW/sSFFVBcxMJv 0cZ9aQhru8wp9o4/2lHMke2EsCSepo66c+UMOCRiIIiq08q6bNOhpZaqPm0rV1pRWrui VsxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tH5GmHApAvRchikH6lu7ImE58Vw5jDglsZ5aZ7flZOU=; b=dW+r+mCS2a2qPIqgxW5z0MdrpH4VypZjEk09uYoyllKWZ0p0z3X23U5GrEPMrvi/Zt 6thV6mtzgTe7B7SXZsoMaEuvwlFZgtMBjJ7RSG/zJtJyOfTrlU3o5DCr4FU2RNlreRkf K+cNjU/+hyAPbdEeSzE783LBCJBdMFLRWyUan6fHwte6iEzsGxYECtFnM0Vw4S+4kTGd El+63w6pPSJ6kLqls+3IiEYdfzgqvDo6R0lYM8Re2htRStDYmcq5kC22OG393XdcCVV8 TnmzGPaxKP99RtHkLRqKif1gfvB/agzqsExgV9fo+nkS2+BPJOAm56fl6a/MVdUqB2TH Q3Rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wA8m9s7b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sc12-20020a1709078a0c00b0077fadd74307si15145892ejc.128.2022.10.19.03.41.56; Wed, 19 Oct 2022 03:42:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wA8m9s7b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232355AbiJSKlX (ORCPT + 99 others); Wed, 19 Oct 2022 06:41:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232147AbiJSKkQ (ORCPT ); Wed, 19 Oct 2022 06:40:16 -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 534F810DE5C; Wed, 19 Oct 2022 03:19: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 18F9A61876; Wed, 19 Oct 2022 08:58:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E25AC433D6; Wed, 19 Oct 2022 08:58:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169887; bh=S2q4dLCv0wB5dsVQ0gf1Cc97ul+nQ3BJKl3LWuEVW5U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wA8m9s7bCpfD9BEafwlW+aQSR7q0VQ1g6YOmUDDw7TLmktn5PGOGPbGQ0IRnSl1Vu P/9GrMmvS20d0jgSkndbLfMbPfwu9Vjhra6Ds2QDt5zo9L7cfu1S5oMl9y5dp+r5Tc QmDCKPkRxMM66wyRho4UzDTutwNCtLfs5Ds64GFo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Judy Hsiao , Mark Brown , Sasha Levin Subject: [PATCH 6.0 413/862] ASoC: rockchip: i2s: use regmap_read_poll_timeout_atomic to poll I2S_CLR Date: Wed, 19 Oct 2022 10:28:20 +0200 Message-Id: <20221019083308.208444995@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112312634147857?= X-GMAIL-MSGID: =?utf-8?q?1747112312634147857?= From: Judy Hsiao [ Upstream commit f0c8d7468af0001b80b0c86802ee28063f800987 ] 1. Uses regmap_read_poll_timeout_atomic to poll I2S_CLR as it is called within a spin lock. 2. Fixes the typo of break condition in regmap_read_poll_timeout_atomic. Fixes: fbb0ec656ee5 ("ASoC: rockchip: i2s: use regmap_read_poll_timeout to poll I2S_CLR") Signed-off-by: Judy Hsiao Link: https://lore.kernel.org/r/20220930151546.2017667-1-judyhsiao@chromium.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/rockchip/rockchip_i2s.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c index 28c86f5e435e..a8758ad68442 100644 --- a/sound/soc/rockchip/rockchip_i2s.c +++ b/sound/soc/rockchip/rockchip_i2s.c @@ -162,12 +162,12 @@ static int rockchip_snd_txctrl(struct rk_i2s_dev *i2s, int on) I2S_CLR_TXC | I2S_CLR_RXC); if (ret < 0) goto end; - ret = regmap_read_poll_timeout(i2s->regmap, - I2S_CLR, - val, - val != 0, - 20, - 200); + ret = regmap_read_poll_timeout_atomic(i2s->regmap, + I2S_CLR, + val, + val == 0, + 20, + 200); if (ret < 0) dev_warn(i2s->dev, "fail to clear: %d\n", ret); } @@ -220,12 +220,12 @@ static int rockchip_snd_rxctrl(struct rk_i2s_dev *i2s, int on) I2S_CLR_TXC | I2S_CLR_RXC); if (ret < 0) goto end; - ret = regmap_read_poll_timeout(i2s->regmap, - I2S_CLR, - val, - val != 0, - 20, - 200); + ret = regmap_read_poll_timeout_atomic(i2s->regmap, + I2S_CLR, + val, + val == 0, + 20, + 200); if (ret < 0) dev_warn(i2s->dev, "fail to clear: %d\n", ret); } From patchwork Wed Oct 19 08:28: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: 4739 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214312wrs; Wed, 19 Oct 2022 02:12:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7a1Ws/q5D1Vbc0+GjTlcxw8AmI/Dqj/XeyU8MAdQcCIiV+gMU+2DiGTp19YiILz6KA6k0H X-Received: by 2002:a17:906:8461:b0:78d:dd76:5695 with SMTP id hx1-20020a170906846100b0078ddd765695mr5743287ejc.583.1666170748999; Wed, 19 Oct 2022 02:12:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170748; cv=none; d=google.com; s=arc-20160816; b=royVAj78o3w7IXpyEpv1D6pSOzBqaomGrmtJblTxN0qm/p1xMcSkDn4vOEaRhO8F6D dF3wj23u8hYICXWtzIhFuZuP5QfIw1JuH3n2uFnjTfE1VpmZs7KVmg1eJh+DrkA2eznq rCWTCFEJHcg28bPKm4soRBMsfyxCEKjiBBokp90+oAjHYj3FL8NZ2fxzNKGRx2m0OO8U 3W5ZRATTTQM5J8zT4gLoTSKUu9oy62rl4OYcqIOZf7namQHrkgfYe6O/yPsHVacqddWV 8/8MUA3429ah2I496EyoCoFQEd+2D3MJKeShBJXmrpzv0Io0uFC7xaO15j9/0kjs/B/7 WdxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PMMdCHAoT0czUjCnxTxnOGcTweB7+sNTwVhuDXHYlk0=; b=DWoeiFk2mFtK0BoREYVjX/TcyBnArINb1qK16Y8dzy/KsiAPC3pIEa1M/uufp7x/1k x5W+JNYiD7a0dLSWVGT71QaYf/BZjy9wMYCiEln1MJuO9oLEtXQ+FfBAUli0ZpSuT1Er Dr0r7VlViI9Wh2WxR0TF829laF1kM3Hq5n6yv1v2+XAjKlrCzXrkmRlqG6qXno+EZHjt 2M8gSwEB4QXyE3rx9fdY9yaNUinlgavDQAOadQL1kwKPAGX3tEDr/FnIBioBxYKAwnJY KZAl5ydmCp7NfHhq++KieuuUidK+7lErDHBrZ+hFPIZGPfof3Qj+V69uBcLwFDI4ugnG /sVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Zlka5w8n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t8-20020a1709066bc800b0073d61f9a7b6si10847303ejs.263.2022.10.19.02.12.04; Wed, 19 Oct 2022 02:12: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=Zlka5w8n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232847AbiJSJJ0 (ORCPT + 99 others); Wed, 19 Oct 2022 05:09:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232517AbiJSJGr (ORCPT ); Wed, 19 Oct 2022 05:06: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 171C132BA0; Wed, 19 Oct 2022 01:59: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 A608661851; Wed, 19 Oct 2022 08:58:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B9CF0C433D6; Wed, 19 Oct 2022 08:58:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169890; bh=KZLGDxq2b8YQuHM9xefCYyopnh+ZS8Ky+2C9f3m/ckE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zlka5w8nTdL8knV9ELHneZZ6Yecbm+MOnox3I5PT0x/KR+vbvxPyuxJmbm7hu2g3C G80b3bBOIbuYp8bW5QDJ5bzI6Xo9bHf+OCPasoTzwRmHfhHHwajgoeq/XaGQQeuX/2 ggA1OUW5u61qO4wsoDlxFCagGUvyuFHtFgq14QUQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brent Lu , Takashi Iwai , Sasha Levin Subject: [PATCH 6.0 414/862] ALSA: hda/hdmi: Dont skip notification handling during PM operation Date: Wed, 19 Oct 2022 10:28:21 +0200 Message-Id: <20221019083308.256727435@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106659470132593?= X-GMAIL-MSGID: =?utf-8?q?1747106659470132593?= From: Takashi Iwai [ Upstream commit 5226c7b9784eee215e3914f440b3c2e1764f67a8 ] The HDMI driver skips the notification handling from the graphics driver when the codec driver is being in the PM operation. This behavior was introduced by the commit eb399d3c99d8 ("ALSA: hda - Skip ELD notification during PM process"). This skip may cause a problem, as we may miss the ELD update when the connection/disconnection happens right at the runtime-PM operation of the audio codec. Although this workaround was valid at that time, it's no longer true; the fix was required just because the ELD update procedure needed to wake up the audio codec, which had lead to a runtime-resume during a runtime-suspend. Meanwhile, the ELD update procedure doesn't need a codec wake up any longer since the commit 788d441a164c ("ALSA: hda - Use component ops for i915 HDMI/DP audio jack handling"); i.e. there is no much reason for skipping the notification. Let's drop those checks for addressing the missing notification. Fixes: 788d441a164c ("ALSA: hda - Use component ops for i915 HDMI/DP audio jack handling") Reported-by: Brent Lu Link: https://lore.kernel.org/r/20220927135807.4097052-1-brent.lu@intel.com Link: https://lore.kernel.org/r/20221001074809.7461-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/pci/hda/patch_hdmi.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index d463c968b3a4..287f4f78e7b1 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -2751,9 +2751,6 @@ static void generic_acomp_pin_eld_notify(void *audio_ptr, int port, int dev_id) */ if (codec->core.dev.power.power_state.event == PM_EVENT_SUSPEND) return; - /* ditto during suspend/resume process itself */ - if (snd_hdac_is_in_pm(&codec->core)) - return; check_presence_and_report(codec, pin_nid, dev_id); } @@ -2937,9 +2934,6 @@ static void intel_pin_eld_notify(void *audio_ptr, int port, int pipe) */ if (codec->core.dev.power.power_state.event == PM_EVENT_SUSPEND) return; - /* ditto during suspend/resume process itself */ - if (snd_hdac_is_in_pm(&codec->core)) - return; snd_hdac_i915_set_bclk(&codec->bus->core); check_presence_and_report(codec, pin_nid, dev_id); From patchwork Wed Oct 19 08:28: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: 5387 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp303916wrs; Wed, 19 Oct 2022 05:42:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM53iNmvGt/tnLPimFqxt1PNLpLwsCg/YTB+Ls6dG2kbR8rkglto4yuYUtzRl0yK2sjRNwE9 X-Received: by 2002:a17:902:db0b:b0:185:51cc:8113 with SMTP id m11-20020a170902db0b00b0018551cc8113mr7984333plx.64.1666183321267; Wed, 19 Oct 2022 05:42:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666183321; cv=none; d=google.com; s=arc-20160816; b=e/Adx6x7oOei2MjdMOBmGLbktyY+9/kl9gIfMkhdjMZmYafGFP/mvPGTeqqM7vn0ks ovLLA2Ks4m9oPdHRhhErwaU/K10wglW0jE2G2PfzRmRZreeFBKL5YYr38pJBC+QxMdJT KMD7YHbRZ2T4A+XLvR2PqgfUjykoJPy+i5AHF0hDRln61WnTEp8/Rxtd+x5exc1hd8SO OmhEzPxshDjAn/DblGFd16VTjAMyMTfsweyA/Esj5WRzcTJ8uYsbYJ6GRIcHgQBaDRK9 Sy9iiW4tCQxFS9YZ3UCTDxuOwwvS+nO0JQWZ3gJnA3XavZaSzHSg6GT2QmgHsJTzf++l FiRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bmMYGpE/OttY3f+exiH2AeqASrzonovclRl1wXdDvKw=; b=GKy3nvQGVB8FqnB5HlR+NgDSCgWzOpSehc8qApPCgXr9k1IWqxzfc5Qvjsn7knDoN1 pq6lSC9n0zyvhVqOm1SDv97LYRzAk4R3UqWptVlDqiDrA/7H8xR09ZTf82PJhnxIbfXo AsPGnHA8UPcAM+iYuQ8xu4tRhXJwASM1e46/FYoLiaJ8jDviCLXMzquX8DjGO3gdrhrP SdQ+hMRypSuHrj6CPtE/io383PZcC/WXYK/OLaM4x/WeS26K78vttbTFaw5HGnd2YkZy Xw2jVvSbFgIUm2ow/kpWvq5CHLxQQZKsRDgc5pVHO97+MlDs3gVsxLI+6Z5K/zYkyyIe fz4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XVY7cvAL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e16-20020a170902ef5000b00176e05275d1si18182929plx.423.2022.10.19.05.41.48; Wed, 19 Oct 2022 05:42: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=XVY7cvAL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232542AbiJSMhf (ORCPT + 99 others); Wed, 19 Oct 2022 08:37:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230274AbiJSMhO (ORCPT ); Wed, 19 Oct 2022 08:37:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5107989828; Wed, 19 Oct 2022 05:17: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 DFC31B8242B; Wed, 19 Oct 2022 08:58:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F361C433D6; Wed, 19 Oct 2022 08:58:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169892; bh=Vq582+ZZfZeJ50akCNDAGdJDlR6WOX/d4TZ2XfKNEBA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XVY7cvALCQEFHCTbIh7abZi8hB6y6U5v/OtIdjILuLX5s4VxRfD3itB+FRfqIDBs5 HoN0Ht+d/A/+Y2j09TIjdi9gECuM9H3UoVBMbnfCOIQvupWjpdZae9U8s0Nn3aVKin m42/TDsKj6MKcM6WH7tq94LGRuvjaLq3AST6tJLA= 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 6.0 415/862] memory: pl353-smc: Fix refcount leak bug in pl353_smc_probe() Date: Wed, 19 Oct 2022 10:28:22 +0200 Message-Id: <20221019083308.294964073@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747119842146546946?= X-GMAIL-MSGID: =?utf-8?q?1747119842146546946?= From: Liang He [ Upstream commit 61b3c876c1cbdb1efd1f52a1f348580e6e14efb6 ] The break of for_each_available_child_of_node() needs a corresponding of_node_put() when the reference 'child' is not used anymore. Here we do not need to call of_node_put() in fail path as '!match' means no break. While the of_platform_device_create() will created a new reference by 'child' but it has considered the refcounting. Fixes: fee10bd22678 ("memory: pl353: Add driver for arm pl353 static memory controller") Signed-off-by: Liang He Signed-off-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20220716031324.447680-1-windhl@126.com Signed-off-by: Sasha Levin --- drivers/memory/pl353-smc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/memory/pl353-smc.c b/drivers/memory/pl353-smc.c index f84b98278745..d39ee7d06665 100644 --- a/drivers/memory/pl353-smc.c +++ b/drivers/memory/pl353-smc.c @@ -122,6 +122,7 @@ static int pl353_smc_probe(struct amba_device *adev, const struct amba_id *id) } of_platform_device_create(child, NULL, &adev->dev); + of_node_put(child); return 0; From patchwork Wed Oct 19 08:28: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: 5514 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp336779wrs; Wed, 19 Oct 2022 06:47:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM77UhPaQSE65mQRwbz/9IIbBZf6cSL4C7ARlTJIPoKKuohuwsCtotSUEdKFmtBkUwmdbD1v X-Received: by 2002:a62:174a:0:b0:563:69ac:562f with SMTP id 71-20020a62174a000000b0056369ac562fmr8748323pfx.68.1666187265666; Wed, 19 Oct 2022 06:47:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666187265; cv=none; d=google.com; s=arc-20160816; b=OAughSWnY0X5S+dLpwcU2x03x8QFagHthhIgeOEjU2uf7Ch0MN0yMI9BzCZlxXx9+6 PYBS/dvZClbFx0rP0lpSifGKEwXZaGKyYnl9m1fWovqs7iQnRbFzdmoAnHUaNfw8FiiN pK72JKnZ86hiaFyo/6S3ZAtrYc7JZxY7OzIpr5NVt+a28+ITqBqhamQLcCL16MID8NPU q6AeHFDxr1XS4NponggjvYKo+v6syvI/v4mSGdYXtSKYQM4tL9AKqssXwlVcgpCgLOzo oIVYL0PLexvIn2diNYSb63e+/U5gWe7aPCZjP5tn5qXfvTGfEmSlDBlWRP7tYGLf4Gfb CX/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=/xAzDuWRkkCz2MxtJs9KWWASaDi6g7o7uywWNFAWqGs=; b=u1K0hDlj6NoV3x6eOTw1PVkDnu78o6DY0iktqZQ70FAKzH2iTaIuxstM7GtJ4I+mQB tspjECPX4/HzldKEd//rHQaPwFC1Pl8fsMQWXQ3NxSxGNbV1R2LeMFNj27NQ+GuRD7ov XstI7JpNJZUe/Bkd/EH5v+GY+8Ff1JIFo2n2+zZP0Worq2vk0ycYyG3LIktlQiW/p0IQ 2kjEVqNnjpFTDNi+q9+yCnCqipIKgYPWkdhmc/pV1gtwzFZuQL0YUJpSw8tcmlj5Ug4a cSFbMm3e95xkGKbMx4o3EYTII5L68sdF4zJzhDYLuYcFClDCOtsI9Tg2rfAcSujXTUiq 6dKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EBJT0Xse; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x11-20020a056a000bcb00b0055733fb2ed4si16195128pfu.212.2022.10.19.06.47.32; Wed, 19 Oct 2022 06:47: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=EBJT0Xse; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233488AbiJSNrQ (ORCPT + 99 others); Wed, 19 Oct 2022 09:47:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233255AbiJSNqH (ORCPT ); Wed, 19 Oct 2022 09:46: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 CF68417252E; Wed, 19 Oct 2022 06:32:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 29861B82426; Wed, 19 Oct 2022 08:58:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 209A6C433C1; Wed, 19 Oct 2022 08:58:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169895; bh=VDRe/5Hbi95puk/YwoQKy5coXP8NgEp+rB9ALswaBwg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EBJT0Xse5jFX3YpfBDtthT07Gf53DyLmZAwH9QKx/GsRxmvqs++/HFIa16ZRFY6U2 BO0DAs0ZHS0dG6k2ibTpIuATRlipyQ1M7qCpqnojtqdyndPpvpCw+cTLHUfix6sc77 P9uAL10Kzs0G7rbW0q6F0n9zON3nvrMYuNXmgQ2g= 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 6.0 416/862] memory: of: Fix refcount leak bug in of_get_ddr_timings() Date: Wed, 19 Oct 2022 10:28:23 +0200 Message-Id: <20221019083308.335779787@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123978195857296?= X-GMAIL-MSGID: =?utf-8?q?1747123978195857296?= 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 dbdf87bc0b78..8e2ef4bf6b17 100644 --- a/drivers/memory/of_memory.c +++ b/drivers/memory/of_memory.c @@ -134,6 +134,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 Wed Oct 19 08:28: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: 4756 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214707wrs; Wed, 19 Oct 2022 02:13:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7MbnEBQA2km/+w64Pf+ziDHB6fYIko6nnAJdegvHtikv+6C9MB3MhEBWnze5iKPAvhS4a+ X-Received: by 2002:a17:907:c18:b0:78d:8577:7c30 with SMTP id ga24-20020a1709070c1800b0078d85777c30mr5556958ejc.413.1666170813519; Wed, 19 Oct 2022 02:13:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170813; cv=none; d=google.com; s=arc-20160816; b=nAfKCmGJvNR/nnYuQt9EZXgAL8SwV/C/m2VwfMD8m6QeQpgjKDD3nFFqaXABKCXUar noOgPmBvJ0nYPPPk+BcWrg9Qm4/ZMnxlQocQaNHGWLACTBRx7GToUGKOgUN6/JVhQD4d MoZWwAe+T27S7XuaBAj+OTdwRSlWYmiO2jmtyYqe/wRLsPn0ObxA3CFNzNZSpqSwmLWw y+ggUUWxFYkm+EcIqL4yrYRiKvL4y5caU8whvkVjDXED9eAf1+QsdfzfsIywF+hPMIaT 0XA09vcROp2OJtTwknEfwX+izPFLMcUERTLoRuMSgCl6L2ZeAPSl5o1VKDWHb7VsDmg2 Ybyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6qBwUb7thyirpD9KqnPUESV5l109RMeTAv2/wp4CRD0=; b=q/7Mx/PN8wYcvFpPB7QA+ux8aEnIIud2HAL1WFJYzEkVTnO8Z8OiUYQMg5ENVhToUU 0Eg3MsOu1nwJD9RWUEFLZPu1wkkBX5XviEBGjWBktlhiY2TKTPvRjCeHzNAeWRTtJWFc ae+0VgWg+TtDBUDVOVp12Z817tKnCOuxX86qDjH9Xym9BKHwNI79NBrS8PUqadVXZydj f+H4AOf2NqAnCZUcQbdJnFPtYBxe9O3uOo9aMZP93oadThwmLSwd8n7tHeDjwt2lNgI6 Zo+tM2RECwBjAY5A7FWyuZ9pG8mg+bCnPt8Qg/CYj4mM7abW8t+kzbzmwDW0qmfiV/Ci 3nLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=J7TdHC0W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i5-20020a17090639c500b007824786a7easi11490204eje.724.2022.10.19.02.13.09; Wed, 19 Oct 2022 02:13: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=J7TdHC0W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232754AbiJSJLE (ORCPT + 99 others); Wed, 19 Oct 2022 05:11:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232626AbiJSJH5 (ORCPT ); Wed, 19 Oct 2022 05:07:57 -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 097AC2C127; Wed, 19 Oct 2022 01:59: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 354BB61800; Wed, 19 Oct 2022 08:58:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49CA5C433C1; Wed, 19 Oct 2022 08:58:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169898; bh=EDcfOZ9GiROdzrYcCV/i2Qx1Q4cPalUM4Bdj4HFS6+A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J7TdHC0W+cUH7BNMadeWc3MOhtgNrgRsVvWAcIvxSCN5XMLGWOg5qgDfCtnY9+2XA 9TlmNCwZXWWgf/QUx6v1DaCllpRpg1w0dSorEWpe8G0gQ5JjTEgXEQa05tvmDOclvz kFWHRaRx8oPgKmf/vJJCbiKyAdleSw++NKGj9anc= 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 6.0 417/862] memory: of: Fix refcount leak bug in of_lpddr3_get_ddr_timings() Date: Wed, 19 Oct 2022 10:28:24 +0200 Message-Id: <20221019083308.384611759@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106727284782950?= X-GMAIL-MSGID: =?utf-8?q?1747106727284782950?= From: Liang He [ Upstream commit 48af14fb0eaa63d9aa68f59fb0b205ec55a95636 ] 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: 976897dd96db ("memory: Extend of_memory with LPDDR3 support") Signed-off-by: Liang He Signed-off-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20220719085640.1210583-2-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 8e2ef4bf6b17..fcd20d85d385 100644 --- a/drivers/memory/of_memory.c +++ b/drivers/memory/of_memory.c @@ -285,6 +285,7 @@ const struct lpddr3_timings if (of_device_is_compatible(np_tim, tim_compat)) { if (of_lpddr3_do_get_timings(np_tim, &timings[i])) { devm_kfree(dev, timings); + of_node_put(np_tim); goto default_timings; } i++; From patchwork Wed Oct 19 08:28: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: 5530 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp337680wrs; Wed, 19 Oct 2022 06:49:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7piAUutvaep/3hBzOh3vkVxSpHjqybRx6JeoKB1zjF5wqoMjdZbVy1gb+n3BS12MGoi1a0 X-Received: by 2002:a17:90b:1184:b0:20c:c0f:7c43 with SMTP id gk4-20020a17090b118400b0020c0c0f7c43mr46037319pjb.236.1666187399546; Wed, 19 Oct 2022 06:49:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666187399; cv=none; d=google.com; s=arc-20160816; b=MxOURxpWMWx7Wl0xLD7DU1u0fdzrk2kxwicTaCfjSnTZtSZRcjUwzF4JqeW1Wj9rYH c8EimTn6SYxZm9JDA9QLZGJZTEgkI9oBRve0BF/Ba08RzpMuUHfOtOTDdvW4u5PgLa+v uMmad4yr1k+qitRtENsqrv2aDJnBvvV5aXMgdYwWUF1poPq8mtFTLEf1goWj1rYptjKg C7xC7PGulR0LJbzeOGyOHBXc+NNHiVmBjL5SIeJqaaRJWnFHzIRE7dSEyrdRcdW5A+D+ 5Q9MHK2/2Qpzt0P2U694iqxVJccKb+RE9EpCl18OI4KI6mjzhB8ZO/dpot98JD4SMLNM rpuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6cXHkunxXmRYDzQya4ffmvx8btfUedOsKu1sSQVHKqA=; b=R+KjH1ClKXRUTs9x2BLmCVzWrJ/sejS0eu8WjFotp1g0n7ewRocWWUA3I0FFz8FCwA 0pIEOjJEM91Ypt8pnMsSX6u9XXi4Tbsn1/GaPlo1/17rXLU81RDdNqS7d17E+yyIJ5gk 8XJUgDwo62WaRFrn9xTrGMdyHmSmQnnGtyOi4dCATcAgK1LlbtSwlkO/WwOJ4xsAmi77 o4DgOOFs8J83YS3bzKATbbjpjvkut1+gdycQwbpvL5oN1Zo//+9F5u3l4CHzOsOpTbz/ 52UpIIBCNtO97PTYxeUIbPXDZzopR/GB09njd8khJlRJP1EXsiJocuftTZS8iwh4sB6T /hNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=be11nvRY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w2-20020a170902904200b00183a85a9b54si17221682plz.279.2022.10.19.06.49.46; Wed, 19 Oct 2022 06: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=be11nvRY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233564AbiJSNsw (ORCPT + 99 others); Wed, 19 Oct 2022 09:48:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233492AbiJSNrT (ORCPT ); Wed, 19 Oct 2022 09:47:19 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F85C172503; Wed, 19 Oct 2022 06:32:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9DE8DB82435; Wed, 19 Oct 2022 08:58:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1897CC433C1; Wed, 19 Oct 2022 08:58:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169901; bh=436goTtGP7cjA/vtXH88LMq5NRFPoKFfaJ/IZ4MBkUI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=be11nvRYUcNMJPsB9UbrpBGdmgfmxhCb441+vyBSU9vxoM2gIK8TYuZpa9uQoEYO2 wSxG0oeukW9iFp8X1TILnYRLDJoUpX/JgJySYZ24cHj+SOmLhxVnvd8pSsM22xlyvT ZQ2Nh0jStRNB4tmeimFdkI1XCGolbFFs4dLddFW8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeff Layton , Amir Goldstein , Al Viro , Sasha Levin Subject: [PATCH 6.0 418/862] locks: fix TOCTOU race when granting write lease Date: Wed, 19 Oct 2022 10:28:25 +0200 Message-Id: <20221019083308.434615073@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747124118753199982?= X-GMAIL-MSGID: =?utf-8?q?1747124118753199982?= From: Amir Goldstein [ Upstream commit d6da19c9cace63290ccfccb1fc35151ffefc0bec ] Thread A trying to acquire a write lease checks the value of i_readcount and i_writecount in check_conflicting_open() to verify that its own fd is the only fd referencing the file. Thread B trying to open the file for read will call break_lease() in do_dentry_open() before incrementing i_readcount, which leaves a small window where thread A can acquire the write lease and then thread B completes the open of the file for read without breaking the write lease that was acquired by thread A. Fix this race by incrementing i_readcount before checking for existing leases, same as the case with i_writecount. Use a helper put_file_access() to decrement i_readcount or i_writecount in do_dentry_open() and __fput(). Fixes: 387e3746d01c ("locks: eliminate false positive conflicts for write lease") Reviewed-by: Jeff Layton Signed-off-by: Amir Goldstein Signed-off-by: Al Viro Signed-off-by: Sasha Levin --- fs/file_table.c | 7 +------ fs/internal.h | 10 ++++++++++ fs/open.c | 11 ++++------- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/fs/file_table.c b/fs/file_table.c index 99c6796c9f28..dd88701e54a9 100644 --- a/fs/file_table.c +++ b/fs/file_table.c @@ -324,12 +324,7 @@ static void __fput(struct file *file) } fops_put(file->f_op); put_pid(file->f_owner.pid); - if ((mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ) - i_readcount_dec(inode); - if (mode & FMODE_WRITER) { - put_write_access(inode); - __mnt_drop_write(mnt); - } + put_file_access(file); dput(dentry); if (unlikely(mode & FMODE_NEED_UNMOUNT)) dissolve_on_fput(mnt); diff --git a/fs/internal.h b/fs/internal.h index 3e206d3e317c..4372d67a3753 100644 --- a/fs/internal.h +++ b/fs/internal.h @@ -102,6 +102,16 @@ extern void chroot_fs_refs(const struct path *, const struct path *); extern struct file *alloc_empty_file(int, const struct cred *); extern struct file *alloc_empty_file_noaccount(int, const struct cred *); +static inline void put_file_access(struct file *file) +{ + if ((file->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ) { + i_readcount_dec(file->f_inode); + } else if (file->f_mode & FMODE_WRITER) { + put_write_access(file->f_inode); + __mnt_drop_write(file->f_path.mnt); + } +} + /* * super.c */ diff --git a/fs/open.c b/fs/open.c index cf7e5c350a54..a81319b6177f 100644 --- a/fs/open.c +++ b/fs/open.c @@ -842,7 +842,9 @@ static int do_dentry_open(struct file *f, return 0; } - if (f->f_mode & FMODE_WRITE && !special_file(inode->i_mode)) { + if ((f->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ) { + i_readcount_inc(inode); + } else if (f->f_mode & FMODE_WRITE && !special_file(inode->i_mode)) { error = get_write_access(inode); if (unlikely(error)) goto cleanup_file; @@ -882,8 +884,6 @@ static int do_dentry_open(struct file *f, goto cleanup_all; } f->f_mode |= FMODE_OPENED; - if ((f->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ) - i_readcount_inc(inode); if ((f->f_mode & FMODE_READ) && likely(f->f_op->read || f->f_op->read_iter)) f->f_mode |= FMODE_CAN_READ; @@ -937,10 +937,7 @@ static int do_dentry_open(struct file *f, if (WARN_ON_ONCE(error > 0)) error = -EINVAL; fops_put(f->f_op); - if (f->f_mode & FMODE_WRITER) { - put_write_access(inode); - __mnt_drop_write(f->f_path.mnt); - } + put_file_access(f); cleanup_file: path_put(&f->f_path); f->f_path.mnt = NULL; From patchwork Wed Oct 19 08:28: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: 4774 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp215656wrs; Wed, 19 Oct 2022 02:16:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6/anby/TMMUuQocnTTkitQ//t7IAsltySIKjg68fn6M9Zlc8dlKKe5oAcnXORmj2FzG+A2 X-Received: by 2002:a05:6402:350d:b0:45c:f5a2:348e with SMTP id b13-20020a056402350d00b0045cf5a2348emr6451406edd.398.1666170976654; Wed, 19 Oct 2022 02:16:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170976; cv=none; d=google.com; s=arc-20160816; b=nf5FE7sjF082nzKtrR4t23Q4Gpe6FYTFKvjl/jzNrKiAr1uCKf+ljihNQ+qKyyRCX/ dwP7GjKmZOTYOxLmizqcIko/Hg0V5AEahZAR3Vx66To8o76oa1BuoiYBJwKiAw7kKb2B 4+X395Z9DDFrK6tQOseRz3r1BRde+p0WFfen9/ZlAoVHbIN6b5C5WWyh8/ZiY6B1Pk9w CZAKBXEbPqholS/iy4qUhXXrdzyFUc6arxVd/Wh9aua2cmSENEy79z2MnPiMUyVl12CC mnQqERxKM/+EVFR4nccjvZE4BxoFB19frl9900lVQFXMSdnaijDZiBf9but4mAZrOH+R GLzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FzmyfoUN3jOwm5ugmT9vrDIPu7CJRmVoV+4TDNIdZg4=; b=tv0J/trl16N9vuxBqKXtmSjg8dPWmj9z36ibYUUEOfVVPn5rM6xYXUJQtRgYx+Bovz v7lRUMYnHe0SCh4QbH6fHFwaZXpo1lCryUydiZIbVJ88hgoaUn2J7Keaq62hlFrl8NzP htgNYwy14vHwIRJvuFpL4klBpW5Oza4UX51S4zFbWB+uJg19GzmBZ9PGB0N7TSO0OvsQ PlWONdT0OszHXv0PjyJT2Wfdt7qJJEDI6YvDojkKmMXnQNuWbAlyTAY8aLZ6ZCbGO7Ib 2d6OF+WcuuHg4exAuhNtk+y7q6O4eXHdBPM0UXCyu6pz+u/Rz5kJ48FGldnovDwvms3H 34Mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ySkbGR6T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l4-20020a170906938400b0078e03186703si10824692ejx.207.2022.10.19.02.15.48; Wed, 19 Oct 2022 02:16: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=ySkbGR6T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232978AbiJSJM4 (ORCPT + 99 others); Wed, 19 Oct 2022 05:12:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232243AbiJSJH6 (ORCPT ); Wed, 19 Oct 2022 05:07:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FCC45053B; Wed, 19 Oct 2022 02:00: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 1134B617ED; Wed, 19 Oct 2022 08:56:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2352EC433D6; Wed, 19 Oct 2022 08:56:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169813; bh=XQAYMWo06//zIHjMBtnXreMiMDYguIyBbLd57r3zYXE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ySkbGR6TqpwS+u+qlSBNT2RN4y8U5i8BgsUbLG+QBkZe4wW0p59cX5L2qvPwyxtPP J0KqZgZ1yfYoyF+hU4vp71w/VIsglijsGgUsHPPU0GM3Jf8d6MnmDioMFR/X7Qe5L2 v0CdSBT4tG/NHS3rMfdXYv1kXXM50z7O2isPiqKE= 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 6.0 419/862] soc: qcom: smsm: Fix refcount leak bugs in qcom_smsm_probe() Date: Wed, 19 Oct 2022 10:28:26 +0200 Message-Id: <20221019083308.475167546@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106897677353499?= X-GMAIL-MSGID: =?utf-8?q?1747106897677353499?= 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 9df9bba242f3..3e8994d6110e 100644 --- a/drivers/soc/qcom/smsm.c +++ b/drivers/soc/qcom/smsm.c @@ -526,7 +526,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 */ @@ -534,13 +534,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 */ @@ -548,13 +549,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 */ @@ -565,7 +567,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. */ @@ -595,16 +598,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 Wed Oct 19 08:28: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: 5254 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp273885wrs; Wed, 19 Oct 2022 04:43:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5JCqjVSjBy4XyUpVQ/0Ipg0BtP8BeHLQ+dImt3ZcnBv/wt29jYvdyjF7AqKYQiMRE1xeMe X-Received: by 2002:a65:6042:0:b0:440:56aa:d5cf with SMTP id a2-20020a656042000000b0044056aad5cfmr6836421pgp.81.1666179795968; Wed, 19 Oct 2022 04:43:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666179795; cv=none; d=google.com; s=arc-20160816; b=Utke0X16qirxDctp9RM5sdF+DIwSSLBJCEaPGxJB5sNcOgMDPorYOjuCOHGcZiJx15 SBZTbZK9YR+HMgKK8mYd1zORFNGeXrpuB6m0pL6+7f0d5foOflZsX0c4wray2eMkIz5j olHnapOSCBWFy6WWX5uo4BEvRx0HcBRg+ky7jVQ1z+ETgwH54fXqqrgofbNFWhrRxKYK 8evemdtvI2Uwe5hOSCshJ2vB1OhMLe7H2YgHarZ3DJYQyHbZqekhJtm6S8nwB20yW6NT impWeQl1daUdnrYi1TzcBR3qVDaAbYYjph2AWNW+OCukCa5F8mj33pV5h+RHGjmjzgTa hXFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=k3PzK0abBm+JtQPkVhDNc9iNsk/dPFRF72EgCCjLfK0=; b=IQFuyPf3lFN5jpdHdZfSSyLBKMcm0CJemmnEYRX0iuLspaiYZppxbZSka+Xbbx6KyR f2pUIHt9jwkJtrO4Q657JUZ+iKoFKyTe4G8YJZtI2nYqIzdp9ih42pdzZZQ8Ww4iXhGt 2SZiSRc7LikOfz2z9xycdWjX7ZfedTsTp9K0APmWEkaejdNw+1dhm5UOZsTpwuhi6MPc dsLZ6817gJbzwjhZteyEftj2sIblOCAbGsHRCx/ONefl0kwFMImcZWN+gvOvpjw1XyTi 9b/qIRptudb9RtXZTLraadvZPoz8Q66wGCurE18z7XXlztVrPoKqSpwemOcYW+3QE6ss MdUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="1/bnvQQ1"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nl5-20020a17090b384500b00205dfd2c794si25431209pjb.167.2022.10.19.04.43.01; Wed, 19 Oct 2022 04:43: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="1/bnvQQ1"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231531AbiJSLgR (ORCPT + 99 others); Wed, 19 Oct 2022 07:36:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231510AbiJSLfx (ORCPT ); Wed, 19 Oct 2022 07:35: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 0F439DF9C; Wed, 19 Oct 2022 04:13: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 54974B82429; Wed, 19 Oct 2022 08:56:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0035C433C1; Wed, 19 Oct 2022 08:56:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169816; bh=OIyPrmQIsCOKB3WtDB3t9YMhRPWseYg73YUNm3OcaiI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1/bnvQQ1JTeuq02twOXIb6iiWRJFKeB2bYfLpoLzxxsi0u2DGyCY1H1yN+JJGdu1x KTjk7dVBftJHpIf8c2J/v/vmds6PDQBMgFkUkdpKB/SvXw4PsFfoVo7KA+NKmUc47l ignQnY4iaixRzhfZt6YUHe8qRBDEOZlIjMWLrIKw= 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 6.0 420/862] soc: qcom: smem_state: Add refcounting for the state->of_node Date: Wed, 19 Oct 2022 10:28:27 +0200 Message-Id: <20221019083308.525235431@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747116145542472448?= X-GMAIL-MSGID: =?utf-8?q?1747116145542472448?= 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 31faf4aa868e..e848cc9a3cf8 100644 --- a/drivers/soc/qcom/smem_state.c +++ b/drivers/soc/qcom/smem_state.c @@ -136,6 +136,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); } @@ -205,7 +206,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 Wed Oct 19 08:28: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: 4720 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp213940wrs; Wed, 19 Oct 2022 02:11:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4nTdQ4pEicSq5wHPaEucPsWKdGmLEBm5RDB0XoAdP2d30HLsXgs7reWDfbN55zKH4g+YcQ X-Received: by 2002:a17:907:6095:b0:78d:bb0b:c34d with SMTP id ht21-20020a170907609500b0078dbb0bc34dmr5775462ejc.662.1666170689591; Wed, 19 Oct 2022 02:11:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170689; cv=none; d=google.com; s=arc-20160816; b=ZAYPBwwmWO5l4Q3uPA8y/QbQKYqv0LfU0y8xPZdS2vzRZkaTso15Z4lGiMRkNQMWca Vw/kOlHYwxN5YzJrBZ13dzu7I76K31yUGP7XBrccPi4cN1maczs4z7ubygnGDKxHUI7X 6v1++5Zuz6XrUQEQfZDNkdzVy2PLiIWvRHJ3GHsjMaUg9gqEmaQ9fyX/SRzLrVbxVLiU vPAUkwQphaRNnP1PH2HJ4mRYuzRycB/CGKF9E1QRAD7YBGLIfn58MOFOxBgU77m0lDYF 8H4dU8dd7cAP70rjspqgpbxRjm8J0v+RR/+tLQu4RLF9f+yAdwh1MEaRiRcObiCHHRYs ZjjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NrBL3ENCTdOxN6ol3CHSaDZRBXkk++eqee14V63mAqs=; b=aPTuTzylwXVWFHlzzwopSHFbbAQu7tczDnTSv7gXexDMaQkM1ylZovuBYGQP+TYMz8 WZKlHz235NmOkj8YUWfG9vf4pe8a+nrx62DEYa6J0KE4MUMj/Nffta44rkxNw3kkz87m wa6fVzQzCGO104kg+u89g4sxngHdTh0QQUsevH9opX5UoVDBOFzCMPDKReipI+uI56JM B23Y2ZjKATdxTMUkulhI4RonbBlUlJSQi+6kMvlxpRQfF+WtF8BiFALqvuroBGH9W++w zFa7eJlUu4OGhx9iYLbygV9bk5r5vg5rL7zrhjnCDLQIp58PuhwOTe+/eXg9rxeiPa4A ZLQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KMzOMVwb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hw9-20020a170907a0c900b00791a3dd01b1si2265535ejc.865.2022.10.19.02.11.04; Wed, 19 Oct 2022 02:11: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=KMzOMVwb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232482AbiJSJGd (ORCPT + 99 others); Wed, 19 Oct 2022 05:06:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232587AbiJSJEj (ORCPT ); Wed, 19 Oct 2022 05:04:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91CE3B03DA; Wed, 19 Oct 2022 01:58:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4695B61800; Wed, 19 Oct 2022 08:56:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F5DFC433C1; Wed, 19 Oct 2022 08:56:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169818; bh=886F7+QHCEAnDMEkfjueOSSJcarr3O9tSlES4/xq6vE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KMzOMVwb2GFzoYgq//y72Soanf2z0PBZc7S+XbHc/Bpr+5cGorpCoc2JQ9nnygjyl 82qhpxhUQi21NeFq94XppA4uTunASilEicTps49BR/oySvghM/uLxk1jb3TKLgauD8 ieszuDOUpL7HxehgszCS7/aHQMO35uJOcRbuQDwo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lucas Stach , Marco Felsch , Shawn Guo , Sasha Levin Subject: [PATCH 6.0 421/862] ARM: dts: imx6qdl-kontron-samx6i: hook up DDC i2c bus Date: Wed, 19 Oct 2022 10:28:28 +0200 Message-Id: <20221019083308.565428913@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106597416933101?= X-GMAIL-MSGID: =?utf-8?q?1747106597416933101?= From: Lucas Stach [ Upstream commit afd8f77957e3e83adf21d9229c61ff37f44a177a ] i2c2 is routed to the pins dedicated as DDC in the module standard. Reduce clock rate to 100kHz to be in line with VESA standard and hook this bus up to the HDMI node. Fixes: 708ed2649ad8 ("ARM: dts: imx6qdl-kontron-samx6i: increase i2c-frequency") Signed-off-by: Lucas Stach [m.felsch@pengutronix.de: add fixes line] Signed-off-by: Marco Felsch Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin --- arch/arm/boot/dts/imx6qdl-kontron-samx6i.dtsi | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/imx6qdl-kontron-samx6i.dtsi b/arch/arm/boot/dts/imx6qdl-kontron-samx6i.dtsi index 6b791d515e29..683f6e58ab23 100644 --- a/arch/arm/boot/dts/imx6qdl-kontron-samx6i.dtsi +++ b/arch/arm/boot/dts/imx6qdl-kontron-samx6i.dtsi @@ -263,6 +263,10 @@ phy-reset-gpios = <&gpio1 25 GPIO_ACTIVE_LOW>; }; +&hdmi { + ddc-i2c-bus = <&i2c2>; +}; + &i2c_intern { pmic@8 { compatible = "fsl,pfuze100"; @@ -387,7 +391,7 @@ /* HDMI_CTRL */ &i2c2 { - clock-frequency = <375000>; + clock-frequency = <100000>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_i2c2>; }; From patchwork Wed Oct 19 08:28: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: 4696 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp213746wrs; Wed, 19 Oct 2022 02:10:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM78+UD2flgwEMutsadMlF0Gwvs9ti1on9fFd2AB+GalQZMmHkkxvVdT1XId078A0QAS3Fp8 X-Received: by 2002:a17:907:a04a:b0:78d:cef2:b219 with SMTP id gz10-20020a170907a04a00b0078dcef2b219mr5791339ejc.735.1666170659578; Wed, 19 Oct 2022 02:10:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170659; cv=none; d=google.com; s=arc-20160816; b=RYLUH9L3GaCuitGGGrK2sxayJ8Zxb2pdsIE2YnRHfzq8mjPA2aSJGp3yiWPrkfPbDP fXgED+CxhZkOALOkBeTlHuU2xgIdBmgnyLSqNFQ8onWZ39GVbRUcR9a7NSjonz1od4+W VpFXIiT+KN61bRR8oGQp7gK564nLxfU12VIPUftBFafuBTOa9Tle01jC8J6yVOQDXUXR +qRUrt3ErHbtJzJfSInKhugbTEQ+SgipMD4oHiA8bfVovNRm3WHu+akNA0VEGhyzZ8/L C2fUyUBidLiWtkpPfVAR24m/SyvBfJuLO3qrRvgbwn3kp0dgghbMwDueL25Pt4ZasBsF MJ2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=D4s/+2ZInGn0yzmeTsgVfFd9MJGcANUTJ7EWXecoe7s=; b=ZYC9WDVRHrpBbIxMk0Dm4d+rgJq31HEiXA15fJYt6Sw8+DfkfY0+gizVSB+So0kNrC qI3IDj2RUdjbkhQAlfcjy1mmRdoDzIKkYA+89E/2T95rqEpv9H826iIg4/CTDBowoBJR qHc5JZjc5cWQnlnXIjKZmYYAc+mojBBPWPl1Lu/yGMxIlQ7GCG39pQPUnhO0pUvvI7Hw t2hALMbOUR2uFnC5kme1Y230R4zwCvBhuFljkiMJPfXVXVHlgAnnZtoHdASpe5pcITGo XUpYl9yct6jzQpwy4PNe1dNYWSs0Lg0KGqRA1sGYO6aSvmG2llUbl64vWMh97tOeKGX9 AhyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1l5ETCvy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hs40-20020a1709073ea800b0078df2f22f80si14598932ejc.647.2022.10.19.02.10.34; Wed, 19 Oct 2022 02:10: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=1l5ETCvy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232299AbiJSJGo (ORCPT + 99 others); Wed, 19 Oct 2022 05:06:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232634AbiJSJEr (ORCPT ); Wed, 19 Oct 2022 05:04: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 B7248B03E5; Wed, 19 Oct 2022 01:58:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CF65761861; Wed, 19 Oct 2022 08:57:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3D37C433C1; Wed, 19 Oct 2022 08:57:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169821; bh=0W0DPC96UQVJK7c3z8nHQBdkuOIdZZVm8tIXy8mpT1w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1l5ETCvyP7PQcrFxD8kIV94bmlqSrSN7Yj5e8EoJmBj2k5cfcud30Xgycf+EkdnOW oUyCJwwGU3zs8X3oxR51d8n6G/1AaAjEqhsZDIvyhlrniq2mv8ZudTtpqOewSSVtOu Lb2JJ08PxDd3xAc7pk50/KfDn70JoIQvK8VlQ5SI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Biju Das , Geert Uytterhoeven , Sasha Levin Subject: [PATCH 6.0 422/862] arm64: dts: renesas: r9a07g044: Fix SCI{Rx,Tx} interrupt types Date: Wed, 19 Oct 2022 10:28:29 +0200 Message-Id: <20221019083308.616809251@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106565423976648?= X-GMAIL-MSGID: =?utf-8?q?1747106565423976648?= From: Biju Das [ Upstream commit f3b7bc89c97b98aa6f157d5f296695af8940a5ac ] As per the latest RZ/G2L Hardware User's Manual (Rev.1.10 Apr, 2022), the interrupt type of SCI{Rx,Tx} is edge triggered. Signed-off-by: Biju Das Fixes: f9a2adcc9e908907 ("arm64: dts: renesas: r9a07g044: Add SCI[0-1] nodes") Link: https://lore.kernel.org/r/20220802101534.1401342-1-biju.das.jz@bp.renesas.com Signed-off-by: Geert Uytterhoeven Signed-off-by: Sasha Levin --- arch/arm64/boot/dts/renesas/r9a07g044.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm64/boot/dts/renesas/r9a07g044.dtsi b/arch/arm64/boot/dts/renesas/r9a07g044.dtsi index 3652e511160f..265140b20dad 100644 --- a/arch/arm64/boot/dts/renesas/r9a07g044.dtsi +++ b/arch/arm64/boot/dts/renesas/r9a07g044.dtsi @@ -394,8 +394,8 @@ compatible = "renesas,r9a07g044-sci", "renesas,sci"; reg = <0 0x1004d000 0 0x400>; interrupts = , - , - , + , + , ; interrupt-names = "eri", "rxi", "txi", "tei"; clocks = <&cpg CPG_MOD R9A07G044_SCI0_CLKP>; @@ -409,8 +409,8 @@ compatible = "renesas,r9a07g044-sci", "renesas,sci"; reg = <0 0x1004d400 0 0x400>; interrupts = , - , - , + , + , ; interrupt-names = "eri", "rxi", "txi", "tei"; clocks = <&cpg CPG_MOD R9A07G044_SCI1_CLKP>; From patchwork Wed Oct 19 08:28: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: 5512 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp336726wrs; Wed, 19 Oct 2022 06:47:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM48BsdhvI5l0tJRijf4gYlZjNaWs8zXBLrlmUw+TsWH6jhRHcdiyg+CrctIfhRHCumDMKRA X-Received: by 2002:a17:902:e748:b0:185:3e6d:6146 with SMTP id p8-20020a170902e74800b001853e6d6146mr8821777plf.128.1666187258646; Wed, 19 Oct 2022 06:47:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666187258; cv=none; d=google.com; s=arc-20160816; b=t5HME3nuPizvCrfWhWWahD5vSjoqxzK1DEthKUlwjK7340IAeF8YVULGJ9HAFy5DOL QpGbv7SF4ap2OGLD8eGCbcIlkxyVlP5h2A4djf+rCW3nZx3jtOAzjubBd4IS9V39bmKk mL99PrlIHoVpWrFFSiCCz9rvN5mez6z6q56m/u4IoV/6n/DGq/wW/17UargzfPziCsK3 qli/TJ1iLKCM7vmf/6XA5ruq2OuzeFRoL/ssGOw6OC0qa8L9ppf8xtMj+vW0GyGNYJg1 Qw4OYtzk6LzwHzcxbMSP57WUut3JSc5bWAKlNHCOhCBdEi4Z13aIpBXTqJo993KzIVLU pCjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tT/5BeCtmidUnrCLzSkGCK4eSqYfyK43qBEGpDqPELE=; b=bRkA/K8mezWRnv9+1wPg4oBVOzKPuLsH69wwpTHCPT87DPAyxX1UFv0tr6mQV1vcjU L1E+BFTOofAlB5YiVPu/RKjTnY0TbukMySKCg6Tz9sCEj7KNDElL9YamyBI+idt/d1Hj xLP7PVwYJm0yTed9w3461oC2UlD8uBhziETC2GVXS3e4D3gj+2HBTzIS1C+q+CZLbPKT NL2BX4XQaBprwpbJHL2t3htbs4gm96WXeNBlffPQ+ghu/vgZS1R4oNoBZVU/n8UxLPNi ubTuASXZxfm5nrkil2ES7zZL/nVvfOQ39QiEXhmNi4sz2oRdNMRVBTwatcVME1z2H/ki 3uzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KK0l1oRP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v10-20020a63b64a000000b00438e839828bsi18211966pgt.72.2022.10.19.06.47.25; Wed, 19 Oct 2022 06:47: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=KK0l1oRP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232621AbiJSNrG (ORCPT + 99 others); Wed, 19 Oct 2022 09:47:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233221AbiJSNpw (ORCPT ); Wed, 19 Oct 2022 09:45: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 E6E671DED71; Wed, 19 Oct 2022 06:32: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 48BA8B82425; Wed, 19 Oct 2022 08:57:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BDBD8C433D6; Wed, 19 Oct 2022 08:57:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169824; bh=c1xY/qMcHNGfQqyM08AF1PaqbOnjTpK1gy3WE9ZEijM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KK0l1oRPFV8b4w/j33wk9Ttt5iwX4p9N3lfKbvmRrh7PVHk1EHujXGB/t9ffE8n18 izTQ4CwdSLhwfzblKHRSg2yHE9SNpz3RF5aD3YvHFLUGPOwBFE4MSOwlbhDU4//26a MMCpW2O8qCxdaFJgeEUerfuPVm63zOlwMbXjBk2I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Biju Das , Geert Uytterhoeven , Sasha Levin Subject: [PATCH 6.0 423/862] arm64: dts: renesas: r9a07g054: Fix SCI{Rx,Tx} interrupt types Date: Wed, 19 Oct 2022 10:28:30 +0200 Message-Id: <20221019083308.655929151@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123970761138310?= X-GMAIL-MSGID: =?utf-8?q?1747123970761138310?= From: Biju Das [ Upstream commit 13dec051c7f139eef345c55a60941843e72128f1 ] As per the RZ/V2L Hardware User's Manual (Rev.1.00 Nov, 2021), the interrupt type of SCI{Rx,Tx} is edge triggered. Signed-off-by: Biju Das Fixes: 7c2b8198f4f321df ("arm64: dts: renesas: Add initial DTSI for RZ/V2L SoC") Link: https://lore.kernel.org/r/20220802101534.1401342-2-biju.das.jz@bp.renesas.com Signed-off-by: Geert Uytterhoeven Signed-off-by: Sasha Levin --- arch/arm64/boot/dts/renesas/r9a07g054.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm64/boot/dts/renesas/r9a07g054.dtsi b/arch/arm64/boot/dts/renesas/r9a07g054.dtsi index 4d6b9d7684c9..d0eeca4f6aa1 100644 --- a/arch/arm64/boot/dts/renesas/r9a07g054.dtsi +++ b/arch/arm64/boot/dts/renesas/r9a07g054.dtsi @@ -399,8 +399,8 @@ compatible = "renesas,r9a07g054-sci", "renesas,sci"; reg = <0 0x1004d000 0 0x400>; interrupts = , - , - , + , + , ; interrupt-names = "eri", "rxi", "txi", "tei"; clocks = <&cpg CPG_MOD R9A07G054_SCI0_CLKP>; @@ -414,8 +414,8 @@ compatible = "renesas,r9a07g054-sci", "renesas,sci"; reg = <0 0x1004d400 0 0x400>; interrupts = , - , - , + , + , ; interrupt-names = "eri", "rxi", "txi", "tei"; clocks = <&cpg CPG_MOD R9A07G054_SCI1_CLKP>; From patchwork Wed Oct 19 08:28: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: 4710 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp213858wrs; Wed, 19 Oct 2022 02:11:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5fCgYbOTQamp20V3jfYGcuoKj8p3DghfTkDtm8q77nAxA6VrwUrhxgYo3ANXUoJ//2pYnY X-Received: by 2002:a05:6402:d06:b0:45a:3ac6:ad26 with SMTP id eb6-20020a0564020d0600b0045a3ac6ad26mr6517571edb.195.1666170675190; Wed, 19 Oct 2022 02:11:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170675; cv=none; d=google.com; s=arc-20160816; b=oU2oRRhX1IDVmTjbVDb8xcA7VevBWmAwDCeqap190Hwx5seafMrLAwlvdJ/1T9ubXd Na6BEXuIYlU6O0Va5Se47NO7MCw8WXIn9O+S5/fVoThMC3GNgDvZAgFpppsl/KoAMdvz IZ+tbU4yy2GZv3rvSZ2z7MRgXRDmc+lv4XQkSkStYg+nuyBiVZESKBN3ZR45bOiiAEV4 N5GzZAjwbAZtrG23yYz9sr60rcCVxvjqOQy+7sOr5vEiBesoakhkHwy1ONIWyn+4F0Tr yw8aqfd/GNHnIIhA55UcAyds+mNLusCR3EjJQLnDjTdvM+Qyw3dts/MVmsTC4HSQ5xMc HIOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JvVPjTzAwNELBfEAM3EQtgg7VaR5P+oMt1BDiU4rhHk=; b=SytJaIULXauwb2spFB8VyrKzm7JxhwDXX6c9K9zZg99KXm3zeJWLgvKreAhOMQNga/ s7DM0xeFLXlhqKIezsMIVKDkHrSPu71qt99PkhxBbLI2nJlEu+0XNkfMwtQE/Nmegy3m cvORZ0WtycsgpyLM/gHndVUR9Kzz30f9U+622ShDjI16KmiUKEHIkzLZU4Z0RbNGIuO1 bPXEnBs8Bz+GCFouIrZBoMtpjjW5fF7LMvw+5nvQwNM4xBRMhQOf+J+XxIFLz2XqB0Bu m0NsSMGyB6SjCoT4gUM3iZgy2CnaBwv8zhtDdaNXeYEeYYtNEtbiyoZekyRIQ/nXw5KZ A1Bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UJRaX8QJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gm1-20020a1709073d0100b0073da19d0cdasi406733ejc.973.2022.10.19.02.10.48; Wed, 19 Oct 2022 02:11: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=UJRaX8QJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232546AbiJSJHL (ORCPT + 99 others); Wed, 19 Oct 2022 05:07:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232683AbiJSJEx (ORCPT ); Wed, 19 Oct 2022 05:04:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAA0CAE220; Wed, 19 Oct 2022 01: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 39DC461880; Wed, 19 Oct 2022 08:57:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C88BC433B5; Wed, 19 Oct 2022 08:57:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169826; bh=Ua6YMqnfkbM15JLdu3O+bToQBX7HwM46++QEcvORw5w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UJRaX8QJ6CfIArrfAT8fawR+I0IkpL+GP457r7qeaK+9HtajJ341jBI01n9HAsDk+ JwEm9wwtEzE3OSj8F1DkvnP9znE8jadUg/vpd/BYstzVbGfhgQBTF2iB+Np4VV8w3+ psZZRZtEArUgSJKJBmWKrdSm8dBDDuOsH5S3v/os= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Biju Das , Geert Uytterhoeven , Sasha Levin Subject: [PATCH 6.0 424/862] arm64: dts: renesas: r9a07g043: Fix SCI{Rx,Tx} interrupt types Date: Wed, 19 Oct 2022 10:28:31 +0200 Message-Id: <20221019083308.693908158@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106581691088050?= X-GMAIL-MSGID: =?utf-8?q?1747106581691088050?= From: Biju Das [ Upstream commit 72a482dbaec4b9e4d54b81be6bdb8c016fd2f4bd ] As per the RZ/G2UL Hardware User's Manual (Rev.1.00 Apr, 2022), the interrupt type of SCI{Rx,Tx} is edge triggered. Signed-off-by: Biju Das Fixes: cf40c9689e5109bf ("arm64: dts: renesas: Add initial DTSI for RZ/G2UL SoC") Link: https://lore.kernel.org/r/20220802101534.1401342-3-biju.das.jz@bp.renesas.com Signed-off-by: Geert Uytterhoeven Signed-off-by: Sasha Levin --- arch/arm64/boot/dts/renesas/r9a07g043.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm64/boot/dts/renesas/r9a07g043.dtsi b/arch/arm64/boot/dts/renesas/r9a07g043.dtsi index 40201a16d653..af84d4797972 100644 --- a/arch/arm64/boot/dts/renesas/r9a07g043.dtsi +++ b/arch/arm64/boot/dts/renesas/r9a07g043.dtsi @@ -334,8 +334,8 @@ compatible = "renesas,r9a07g043-sci", "renesas,sci"; reg = <0 0x1004d000 0 0x400>; interrupts = , - , - , + , + , ; interrupt-names = "eri", "rxi", "txi", "tei"; clocks = <&cpg CPG_MOD R9A07G043_SCI0_CLKP>; @@ -349,8 +349,8 @@ compatible = "renesas,r9a07g043-sci", "renesas,sci"; reg = <0 0x1004d400 0 0x400>; interrupts = , - , - , + , + , ; interrupt-names = "eri", "rxi", "txi", "tei"; clocks = <&cpg CPG_MOD R9A07G043_SCI1_CLKP>; From patchwork Wed Oct 19 08:28: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: 4820 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223376wrs; Wed, 19 Oct 2022 02:37:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4TDIAd0XJrt2imMkFHNu9FHeYVYHHlBuBEp2ZDRjt5xT9Ykw89wblD3fzQ0PQ/YAhYVkGN X-Received: by 2002:a05:6a00:174c:b0:565:c73a:9117 with SMTP id j12-20020a056a00174c00b00565c73a9117mr7579614pfc.23.1666172242520; Wed, 19 Oct 2022 02:37:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172242; cv=none; d=google.com; s=arc-20160816; b=mif3vrHVAy/uyEEkrwuFtUgqI//GsxRna+HGWXkTN9uWPya7bVMTquLFZ0xuiT9RPx AQVsmdvkeNf0YmLz9NvEOxj9F8tbCGo5Kk5IjuSqhxEIr+1OCE5pHd9dgWTFceb/MPyh Cvf1pKbzo52tfqtaRYIAlcvnxRRUJRGxpKTqwv2HIl/GrwHd+uC7qU8A/OoWsHMmq+3V 4vD5+iz7WMWAewaTHZCNgtCrVYR6CyeAJe0962RY3MixUTiwtx80IYmSAYEq4GwwRzrq MK3dYcXKCnM+dseQ89LUTeh8N/29VUtM9j/dYHxQ5lfxZYxjiBhWy15sVcgSXtVRMEK3 17kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ftP7/47bL4D3cZB7ZTG0EdUYxGIF2/OGMuJXTM8t8hs=; b=ErMou36ZkgodC/NeR3j0WztRJsgeh69HhIjcZ2yc0ANZkWq73RMKyU+FLo37nKQ1nL Uk5aamNLFmiYCYdGPR9OU/vPYuO9ir9vVCtmcPkgvYa45ZsHGXjXKJKd2s+QqD3beMT9 Z3QVzPGJO8nyw+Hk+MYZnQvwhne0BId4+fgkm/+w1N6bl6294KtsHP7Vi9Teet3BXy2T LhZc2izcOylz2qRNFN0ZgWVt8jfFm22qmbIgfP0XeqS4UrquS7QRXVxTtpp7hhr7f3St UciXxxkuzJXr2pNYEc4Nr0V1bY+KYDOlZIqNAGW1VcPmyFGEYXES24v1HTfA8cEQZdTO W2hQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BXmbCpw7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f10-20020a056a00238a00b0051bbbc5f0aasi18309661pfc.261.2022.10.19.02.37.09; Wed, 19 Oct 2022 02:37: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=BXmbCpw7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233354AbiJSJUq (ORCPT + 99 others); Wed, 19 Oct 2022 05:20:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233588AbiJSJTn (ORCPT ); Wed, 19 Oct 2022 05:19:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54ACBD77F6; Wed, 19 Oct 2022 02:08:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DA47D61831; Wed, 19 Oct 2022 08:57:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EDB15C433D6; Wed, 19 Oct 2022 08:57:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169829; bh=av6IIo9dQWWrz+gy2p6l7x7pffWvKphYgpbV9re8afE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BXmbCpw72ooq+kWjSSlEc8g/2YPars2u5nKpdEtgI55HeMQq5mpUtYvsossm2xqbZ 3ioJzu8ntwoRTJmgRjx1MHTBYOg8gq9ddv0kgn4P12M0zorIbZzAKoKUVroKuCaeD+ UF7HAZ3e2Mx/FoSAcCZ+45CV9jnrLdDG0CUY09JE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chanho Park , Krzysztof Kozlowski , Chanwoo Choi , Sasha Levin Subject: [PATCH 6.0 425/862] dt-bindings: clock: exynosautov9: correct clock numbering of peric0/c1 Date: Wed, 19 Oct 2022 10:28:32 +0200 Message-Id: <20221019083308.741152907@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108225811604613?= X-GMAIL-MSGID: =?utf-8?q?1747108225811604613?= From: Chanho Park [ Upstream commit b6740089b740b842d5e6ff55b4b2c3bf5961c69a ] There are duplicated definitions of peric0 and peric1 cmu blocks. Thus, they should be defined correctly as numerical order. Fixes: 680e1c8370a2 ("dt-bindings: clock: add clock binding definitions for Exynos Auto v9") Signed-off-by: Chanho Park Reviewed-by: Krzysztof Kozlowski Acked-by: Chanwoo Choi Signed-off-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20220727021357.152421-2-chanho61.park@samsung.com Signed-off-by: Sasha Levin --- .../dt-bindings/clock/samsung,exynosautov9.h | 56 +++++++++---------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/include/dt-bindings/clock/samsung,exynosautov9.h b/include/dt-bindings/clock/samsung,exynosautov9.h index ea9f91b4eb1a..a7db6516593f 100644 --- a/include/dt-bindings/clock/samsung,exynosautov9.h +++ b/include/dt-bindings/clock/samsung,exynosautov9.h @@ -226,21 +226,21 @@ #define CLK_GOUT_PERIC0_IPCLK_8 28 #define CLK_GOUT_PERIC0_IPCLK_9 29 #define CLK_GOUT_PERIC0_IPCLK_10 30 -#define CLK_GOUT_PERIC0_IPCLK_11 30 -#define CLK_GOUT_PERIC0_PCLK_0 31 -#define CLK_GOUT_PERIC0_PCLK_1 32 -#define CLK_GOUT_PERIC0_PCLK_2 33 -#define CLK_GOUT_PERIC0_PCLK_3 34 -#define CLK_GOUT_PERIC0_PCLK_4 35 -#define CLK_GOUT_PERIC0_PCLK_5 36 -#define CLK_GOUT_PERIC0_PCLK_6 37 -#define CLK_GOUT_PERIC0_PCLK_7 38 -#define CLK_GOUT_PERIC0_PCLK_8 39 -#define CLK_GOUT_PERIC0_PCLK_9 40 -#define CLK_GOUT_PERIC0_PCLK_10 41 -#define CLK_GOUT_PERIC0_PCLK_11 42 +#define CLK_GOUT_PERIC0_IPCLK_11 31 +#define CLK_GOUT_PERIC0_PCLK_0 32 +#define CLK_GOUT_PERIC0_PCLK_1 33 +#define CLK_GOUT_PERIC0_PCLK_2 34 +#define CLK_GOUT_PERIC0_PCLK_3 35 +#define CLK_GOUT_PERIC0_PCLK_4 36 +#define CLK_GOUT_PERIC0_PCLK_5 37 +#define CLK_GOUT_PERIC0_PCLK_6 38 +#define CLK_GOUT_PERIC0_PCLK_7 39 +#define CLK_GOUT_PERIC0_PCLK_8 40 +#define CLK_GOUT_PERIC0_PCLK_9 41 +#define CLK_GOUT_PERIC0_PCLK_10 42 +#define CLK_GOUT_PERIC0_PCLK_11 43 -#define PERIC0_NR_CLK 43 +#define PERIC0_NR_CLK 44 /* CMU_PERIC1 */ #define CLK_MOUT_PERIC1_BUS_USER 1 @@ -272,21 +272,21 @@ #define CLK_GOUT_PERIC1_IPCLK_8 28 #define CLK_GOUT_PERIC1_IPCLK_9 29 #define CLK_GOUT_PERIC1_IPCLK_10 30 -#define CLK_GOUT_PERIC1_IPCLK_11 30 -#define CLK_GOUT_PERIC1_PCLK_0 31 -#define CLK_GOUT_PERIC1_PCLK_1 32 -#define CLK_GOUT_PERIC1_PCLK_2 33 -#define CLK_GOUT_PERIC1_PCLK_3 34 -#define CLK_GOUT_PERIC1_PCLK_4 35 -#define CLK_GOUT_PERIC1_PCLK_5 36 -#define CLK_GOUT_PERIC1_PCLK_6 37 -#define CLK_GOUT_PERIC1_PCLK_7 38 -#define CLK_GOUT_PERIC1_PCLK_8 39 -#define CLK_GOUT_PERIC1_PCLK_9 40 -#define CLK_GOUT_PERIC1_PCLK_10 41 -#define CLK_GOUT_PERIC1_PCLK_11 42 +#define CLK_GOUT_PERIC1_IPCLK_11 31 +#define CLK_GOUT_PERIC1_PCLK_0 32 +#define CLK_GOUT_PERIC1_PCLK_1 33 +#define CLK_GOUT_PERIC1_PCLK_2 34 +#define CLK_GOUT_PERIC1_PCLK_3 35 +#define CLK_GOUT_PERIC1_PCLK_4 36 +#define CLK_GOUT_PERIC1_PCLK_5 37 +#define CLK_GOUT_PERIC1_PCLK_6 38 +#define CLK_GOUT_PERIC1_PCLK_7 39 +#define CLK_GOUT_PERIC1_PCLK_8 40 +#define CLK_GOUT_PERIC1_PCLK_9 41 +#define CLK_GOUT_PERIC1_PCLK_10 42 +#define CLK_GOUT_PERIC1_PCLK_11 43 -#define PERIC1_NR_CLK 43 +#define PERIC1_NR_CLK 44 /* CMU_PERIS */ #define CLK_MOUT_PERIS_BUS_USER 1 From patchwork Wed Oct 19 08:28: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: 4722 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp213944wrs; Wed, 19 Oct 2022 02:11:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4dzDqYdsWjJymV5euktU1lIEJLx14mT9uaLgoYVPXQTGPd3IpYBY2KwGryHtgL7O3UyNSR X-Received: by 2002:a17:907:7f91:b0:78e:2eb4:1fac with SMTP id qk17-20020a1709077f9100b0078e2eb41facmr5836949ejc.126.1666170690293; Wed, 19 Oct 2022 02:11:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170690; cv=none; d=google.com; s=arc-20160816; b=lBiAJubIhwMbs0lPzA31XwZudJtsSKwtpvhBFPChPppfDn1Bap3wAtIyOjqP8byluX lgAzD+Qr5r7q72ZzuR+VAkeCgU7XBhwOSk4DITzQN9TSirW3AEPnt56KTSe8tuql8Ie2 Tw0PnxiImjOatizqBDr6HxzWUHJ3YqdsNiX5zVaK+3FIctma3DbxjtGK/Etf9NxauHrs OnBU61aEIk7JdKeRoJmLcC30zLgb2JjYiWXwQlwYyZRmewLrk6S08y6+WJ4NfvjE3YUR AKyhxghoga0LNbKdap7KZWvQshIVs5AJaR53tpHIMD5jjCK4wq4+oWretR7HjwwOr3Wv OR1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1W3WXOULrYox4qyNKyOeZ6EerT4jJq2omGAE6aLXuI8=; b=eUBHYw1logVm6Mn0fhtkAn051IlBLGbKzBrS7jhsu+fiVSfwCe7ZUxibCQyrNFMvC3 tOMK9m5UeSAiV3JZIYGOqdulPDTpSVUa6AnIh0WCo8NRqUlzUb9A6dfaxps71I4Dy/zV CjOJ9J0+xgUrONf0WEt/evvRq57UOhTuy7oQENe5pmaFUrh9Pc0zxpXUOs8178kuEryG /rW8SjfTOEKltHJT+oYbPGRVQQjQRS3Ytxlve/vkWBUxZetkZcSz8RbHPEY3fBWWfMnU Zv17sXgbg3tHALTwKTu6tQHCKYw7AdYlZbsMRrmc58Co9ZtJieo7qBYcmHC/zkNnNDy9 thIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Eu591wkL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o7-20020a056402038700b004592ebc28a9si11758307edv.59.2022.10.19.02.11.04; Wed, 19 Oct 2022 02:11: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=Eu591wkL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232448AbiJSJHu (ORCPT + 99 others); Wed, 19 Oct 2022 05:07:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232241AbiJSJFZ (ORCPT ); Wed, 19 Oct 2022 05:05:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAE98B1DD4; Wed, 19 Oct 2022 01: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 7A60E61812; Wed, 19 Oct 2022 08:57:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 917F5C433D6; Wed, 19 Oct 2022 08:57:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169831; bh=vIO8+0zIbWy8XC0Cc4AMXbfc1zpvWXoPw75Iug1V1jc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Eu591wkLWY5FSUaCKxMGWreIhz0YpEUX1RcBKinkJnY6ps0CfzZOfUZvt0r6n/2xD e36LGQ5NDmNoyIQV5yYS01u1osSg2LrZex1sSfZBE6KyVmdET7XalPYr/062Y3BNYM 7NYDDD6tHGe4Ly/fsSviT2zbMUycGJuASxvi5Zmw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geert Uytterhoeven , Caleb Connolly , Bjorn Andersson , Sasha Levin Subject: [PATCH 6.0 426/862] arm64: dts: qcom: sdm845-xiaomi-polaris: Fix sde_dsi_active pinctrl Date: Wed, 19 Oct 2022 10:28:33 +0200 Message-Id: <20221019083308.786429481@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106597816717481?= X-GMAIL-MSGID: =?utf-8?q?1747106597816717481?= From: Geert Uytterhoeven [ Upstream commit 5a0504945878b4af7534c1ce668a5678dc0201cf ] "make dtbs_check" says: bias-disable: boolean property with value b'\x00\x00\x00\x00' Fix this by dropping the offending value. Fixes: be497abe19bf08fb ("arm64: dts: qcom: Add support for Xiaomi Mi Mix2s") Signed-off-by: Geert Uytterhoeven Reviewed-by: Caleb Connolly Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/629afd26008c2b1ba5822799ea7ea5b5271895e8.1660903997.git.geert+renesas@glider.be Signed-off-by: Sasha Levin --- arch/arm64/boot/dts/qcom/sdm845-xiaomi-polaris.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/qcom/sdm845-xiaomi-polaris.dts b/arch/arm64/boot/dts/qcom/sdm845-xiaomi-polaris.dts index 7747081b9887..dba7c2693ff5 100644 --- a/arch/arm64/boot/dts/qcom/sdm845-xiaomi-polaris.dts +++ b/arch/arm64/boot/dts/qcom/sdm845-xiaomi-polaris.dts @@ -617,7 +617,7 @@ pins = "gpio6", "gpio10"; function = "gpio"; drive-strength = <8>; - bias-disable = <0>; + bias-disable; }; sde_dsi_suspend: sde-dsi-suspend { From patchwork Wed Oct 19 08:28: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: 5504 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp336292wrs; Wed, 19 Oct 2022 06:46:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5XoSXRbttBmiq/V725eRQ6ijqLq6xI6Y/a2G1ODoz8O9eHSonNnpqmZQAwVjzON/qM9n8E X-Received: by 2002:a17:90a:a088:b0:20d:67b7:546d with SMTP id r8-20020a17090aa08800b0020d67b7546dmr10370180pjp.6.1666187206422; Wed, 19 Oct 2022 06:46:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666187206; cv=none; d=google.com; s=arc-20160816; b=CMQpENKsP28JgaGpo4ipLcy7ogHu2GXbe/YJzYTezA/gOOWDl1y6UiimWXTNQt15Dt qj1tyry4NiD8lwrFdvTxNQBC4+PKBIecsQhpeRkjsKeJUqL9dVV5wTD1U6ZvEFTpFVR2 z6mjeMd6OGzs5/q+ccVhA7oeD2nyxrdUkKa/p6QbjvfQHrakVED88/ttiLGqchr8WAGJ jm1nLDa/rMgxcK7Odsl+8xKwuiLDtBHmGkJhgfhKkSxuvvqCQfgZhNCnDMmHBEhEm/LO 6c//+Ss96SriXCC/qMP1PgZk/bM6yfwXqxC6kdl6UpmB72qMxgpQZX0gqG0l74MTLXXf cgLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rAbr9GrXT7NsdLA1StL8g7U9glsY3brU+xqNCkiKhkY=; b=tj5Q8shMaYCwv0B7u+4u7Dj1r704VSYBX6jASyqunuvlTCTMcCoztYMzEozaN6RaCR UO4lY1e7f+ReTL8kAcKodUrelOzDkBpZ55WmHXApFIenBXMU2FEOcg7RGZvTmVApOb6b ZomHkvJ8ZJd1a8bcZjJtKi0o2yefjm+toQCdtG9hQHwYYykM5RbrLjMBMDYQ5o4MuAOv cwH/oa7KMgO3IPfnHz2/nyBeX0V76qFb4/u2xbUPkch2HpfCXIKQ3faBNh5eGZU23pQ2 fd85ZQV+OTNx3ePfMGrocncuEQoNcnNIqHi2rNudbhQ3S18tqHiUr5a0s2OYQYaqpNdI 7MvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AVh9vrmL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u184-20020a6279c1000000b00565d37ee1casi18116943pfc.166.2022.10.19.06.46.33; Wed, 19 Oct 2022 06:46: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=AVh9vrmL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233328AbiJSNqT (ORCPT + 99 others); Wed, 19 Oct 2022 09:46:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233009AbiJSNpX (ORCPT ); Wed, 19 Oct 2022 09:45:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA42D19422D; Wed, 19 Oct 2022 06:31: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 BC0D7B8242A; Wed, 19 Oct 2022 08:57:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2802BC43143; Wed, 19 Oct 2022 08:57:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169834; bh=YrszN6eVicWhmXjqMk37JK1ZOS4B/sC3cR7rdsIqFvI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AVh9vrmLZW3N2fmQ7i6gQUUTJ+8u3O9j7U4faC9ue9SaSIStiSd9vxdM6H6aeot/7 Aqm8vgraXI002RaEX/hwQ+i4qFmSwd3Go0OrWmleIMKP1k27zT/VI5DrJeI5Rao32J tm04Ot6NvT4QC6B4fl57NpXgTsD56t241fFbBrdM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Satya Priya , Taniya Das , Stephen Boyd , Bjorn Andersson , Sasha Levin Subject: [PATCH 6.0 427/862] arm64: dts: qcom: sc7280: Cleanup the lpasscc node Date: Wed, 19 Oct 2022 10:28:34 +0200 Message-Id: <20221019083308.834812892@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123915927264527?= X-GMAIL-MSGID: =?utf-8?q?1747123915927264527?= From: Satya Priya [ Upstream commit 8c7ebabd2e3f33ef24378d3cac00d3e59886cecb ] Remove "cc" regmap from lpasscc node which is overlapping with the lpass_aon regmap. Fixes: 422a295221bb ("arm64: dts: qcom: sc7280: Add clock controller nodes") Signed-off-by: Satya Priya Signed-off-by: Taniya Das Reviewed-by: Stephen Boyd Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/1660107909-27947-2-git-send-email-quic_c_skakit@quicinc.com Signed-off-by: Sasha Levin --- arch/arm64/boot/dts/qcom/sc7280.dtsi | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/sc7280.dtsi b/arch/arm64/boot/dts/qcom/sc7280.dtsi index dac3b69e314f..1d48f92a2982 100644 --- a/arch/arm64/boot/dts/qcom/sc7280.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7280.dtsi @@ -2168,9 +2168,8 @@ lpasscc: lpasscc@3000000 { compatible = "qcom,sc7280-lpasscc"; reg = <0 0x03000000 0 0x40>, - <0 0x03c04000 0 0x4>, - <0 0x03389000 0 0x24>; - reg-names = "qdsp6ss", "top_cc", "cc"; + <0 0x03c04000 0 0x4>; + reg-names = "qdsp6ss", "top_cc"; clocks = <&gcc GCC_CFG_NOC_LPASS_CLK>; clock-names = "iface"; #clock-cells = <1>; From patchwork Wed Oct 19 08:28: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: 5511 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp336687wrs; Wed, 19 Oct 2022 06:47:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7NLeuz7LSKzDwf5nNgEIDhwmJU7vtCoYMOyPlQtESHMFeI+Q73fsr2uDMuLshrvQzfck7S X-Received: by 2002:aa7:8687:0:b0:560:3299:a6c0 with SMTP id d7-20020aa78687000000b005603299a6c0mr8801005pfo.81.1666187254215; Wed, 19 Oct 2022 06:47:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666187254; cv=none; d=google.com; s=arc-20160816; b=OeRzmdgqmb5YGn7iKzFvJp37KNkfq/ZE3RIhpDnAiNT2a3NWEKwrjUjbszDVqf5e3M FyuWyzDIeKK46z0Mu07CGp2bza7yrMpdTbuHNiYeeoMwt9AYJ2ZPMU4s6aq5W8MLwl8g HwZNT71lAEachontv2+FO60KaySwAKaVYLrUzTTNJivfSAqCeMAzCcGDOrsEWewsBEVB pCj40cnByxC9wL/oFv+iWr1CgRwu+v4/tPP6cBs81YcSUk26AlD6oUAh3hO3XGaGPkd6 7FizC5E2J1Gr8dGIP+CZjYplSCAWNZePE+qLrGchCtutcoDY+DFLreVPEkjITGxXO00D YEKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VtQSXYRL1guBvuxPYY3NpO4KMJGkFIVU/lJ6OpryGDQ=; b=wi5GiQzrzo9SQpnlvGAXT6f7D9qjusKTNGKGwnPPgU2sGGnXaywOJZWXNd2lwps0nl bGRas9VUnwAwcF/RhcuFhtjBoNXMTgRLvGVdEt+zUXAR73ch81GQoyiOXDiP1+rp/FHx 0UEJ4bNhwf+G83pePL6cQVIpuzT0VxCz7z4rTqvsKFWCbFhE78QEluYJsMth8r9yd7EF zv0vWEyhhONM6MWpCmtzPx003CaXshLP3qzG3xOEWl+QQCO/2BmKMUQaMHRqZeuQDUok 9p7dXArTeiKmOK6noLnbQe88sfHLSzx79npt/2m4nCp1rsGw6dvCekXpmoA8GW1Oreos KRqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=l1JS7WIi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o23-20020a639217000000b00434d4a0be40si19536584pgd.589.2022.10.19.06.47.20; Wed, 19 Oct 2022 06:47:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=l1JS7WIi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232533AbiJSNrC (ORCPT + 99 others); Wed, 19 Oct 2022 09:47:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233212AbiJSNpv (ORCPT ); Wed, 19 Oct 2022 09:45:51 -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 C06B21DED5F; Wed, 19 Oct 2022 06:32:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4CF83B8242D; Wed, 19 Oct 2022 08:57:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9BFACC433C1; Wed, 19 Oct 2022 08:57:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169837; bh=PYvTOfK5/ovQoOBElMYI9WPaPBV5gZLqnys7E0w5Q0k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l1JS7WIiulMo/GcZnRTN5NkpwNMQScKvW9UXeIYFHehp7j5dpUo9xR5yDtJ0nnVgp sCu87T8xHd4Xty3Cm8IJOX/sNGxH8pkqkAZlucWe+ip24ls2znQyWhmX/iqUCSUieG d5mhoxJ4/ynToAfiSthyLYy9EDkQirgjXTJULdyg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Taniya Das , Satya Priya , Stephen Boyd , Bjorn Andersson , Sasha Levin Subject: [PATCH 6.0 428/862] arm64: dts: qcom: sc7280: Update lpasscore node Date: Wed, 19 Oct 2022 10:28:35 +0200 Message-Id: <20221019083308.876840938@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123965835530704?= X-GMAIL-MSGID: =?utf-8?q?1747123965835530704?= From: Satya Priya [ Upstream commit d9a1e922730389afc425f2250de361b7f07acdbc ] To maintain consistency with other lpass nodes(lpass_audiocc, lpass_aon and lpass_hm), update lpasscore to lpass_core. Fixes: 9499240d15f2 ("arm64: dts: qcom: sc7280: Add lpasscore & lpassaudio clock controllers") Signed-off-by: Taniya Das Signed-off-by: Satya Priya Reviewed-by: Stephen Boyd Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/1660107909-27947-4-git-send-email-quic_c_skakit@quicinc.com Signed-off-by: Sasha Levin --- arch/arm64/boot/dts/qcom/sc7280.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/sc7280.dtsi b/arch/arm64/boot/dts/qcom/sc7280.dtsi index 1d48f92a2982..51ed691075ad 100644 --- a/arch/arm64/boot/dts/qcom/sc7280.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7280.dtsi @@ -2191,13 +2191,13 @@ reg = <0 0x03380000 0 0x30000>; clocks = <&rpmhcc RPMH_CXO_CLK>, <&rpmhcc RPMH_CXO_CLK_A>, - <&lpasscore LPASS_CORE_CC_CORE_CLK>; + <&lpass_core LPASS_CORE_CC_CORE_CLK>; clock-names = "bi_tcxo", "bi_tcxo_ao", "iface"; #clock-cells = <1>; #power-domain-cells = <1>; }; - lpasscore: clock-controller@3900000 { + lpass_core: clock-controller@3900000 { compatible = "qcom,sc7280-lpasscorecc"; reg = <0 0x03900000 0 0x50000>; clocks = <&rpmhcc RPMH_CXO_CLK>; From patchwork Wed Oct 19 08:28: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: 4708 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp213815wrs; Wed, 19 Oct 2022 02:11:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5/7IB/hi0T0oZk4qWj5DfmQK19uC2MxHtjLQw1U54vEcOYzedYKlor3Q6B/IAzTj0a11KY X-Received: by 2002:a17:906:6791:b0:78d:4051:969f with SMTP id q17-20020a170906679100b0078d4051969fmr5941834ejp.171.1666170668860; Wed, 19 Oct 2022 02:11:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170668; cv=none; d=google.com; s=arc-20160816; b=iT7/wtPRTytObsrIskfvDT6r9/L3tv+VmVnYGdJLWBKEVSJt1wzmj/s9mGOy6n9R3b jOdLU1xjVcNhqUC6wIVgp8RlBShB1bPouaam4ELUgV3CBnT8BFlEACk+WzDWWCHrjBl8 JpsRvbxg4nDdEV+X3cT1RA2xCiz1aqD9QiLl8KkB3xYaL4b7RPnSLO3uRDxFTciwPzU7 +JhLvocjepMRmAl4HMoeQLh09VoaN6MX9QKu4v8tenYoiR/pnx45cWaby4Ay/XZZwSXY wPhX4HF22FLBc9hpUN7GmQdrLmX8sohvhhkqo2DiUbYLH3HY4DJjdZYxKUsKyvdZLPYd 306A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OyVUl6aIDu0TxLixFT5aVbs2IOvMixynq9fJ0P5Nms0=; b=rn2IR36OvBIhIJMQZb5MloxNEy3ybAEcvdBFRiN0lQr0B68P8uh6zXYk9faW6UQrw+ 0vzl0w0LO8HPkRlTbcUI9o+Ryvb4CU5673h2emENeGy+Y6VZCK+azem4JGfl/VaZV4nW vWZWWOCULEZoSlKmjnw4yQeKMrnYPNZzUOe381UoVzLCAstC78H9R84GVqB6KOe+PKQ9 jaqSeWQh6oaH+oWp3Z/2VoW633PlTU7f//G0xdCK3/bVGfHqOEooTwTpbEkT/wJgAOW9 QXeJ27eOdICrKpcckfnx3lJ3hd+P7mP8H57KVY6KjU+O3x4QPV+FAwBU33mWZdfN4rIa iKug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=peZXepM0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dt18-20020a170907729200b0078e19037657si13502211ejc.803.2022.10.19.02.10.42; Wed, 19 Oct 2022 02:11: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=peZXepM0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232533AbiJSJG6 (ORCPT + 99 others); Wed, 19 Oct 2022 05:06:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232677AbiJSJEw (ORCPT ); Wed, 19 Oct 2022 05:04: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 BB166B1BA5; Wed, 19 Oct 2022 01:58: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 CBB726187C; Wed, 19 Oct 2022 08:57:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E12BAC433D7; Wed, 19 Oct 2022 08:57:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169842; bh=FMAZfIb4uv/rO5UtN9FlRGMqA84nATFrimSYhJ6tUdI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=peZXepM0WCigoEmPpTMMn/8ot3TrQlKVKnHnmrnExOFnVgpbpREQP0wCBCiD6XiPY Ko+Wm5RRfXG3QvGfEl0XzsOAXQhqOU6NLQp7bTKCNEynIs59EXZNl3WNTsRvouIwuv 8BC8TjcpPufisn9DFUsw2sSWCO1HqGkIQFQit0Mg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Manivannan Sadhasivam , Bjorn Andersson , Sasha Levin Subject: [PATCH 6.0 429/862] arm64: dts: qcom: sc8280xp-crd: disallow regulator mode switches Date: Wed, 19 Oct 2022 10:28:36 +0200 Message-Id: <20221019083308.916196759@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106575130703084?= X-GMAIL-MSGID: =?utf-8?q?1747106575130703084?= From: Johan Hovold [ Upstream commit 412737a60c846a6adb7f7571905c200da036815e ] Do not allow the RPMh regulators to switch to low-power mode with an exception for the UFS regulators (l7c and l3d) as UFS supports an idle mode. This specifically avoids having regulators be but in low-power mode when only some consumers specify loads while the actual total load really warrants high-power mode. Fixes: ccd3517faf18 ("arm64: dts: qcom: sc8280xp: Add reference device") Link: https://lore.kernel.org/all/YtkrDcjTGhpaU1e0@hovoldconsulting.com Signed-off-by: Johan Hovold Reviewed-by: Manivannan Sadhasivam Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220803121942.30236-2-johan+linaro@kernel.org Signed-off-by: Sasha Levin --- arch/arm64/boot/dts/qcom/sc8280xp-crd.dts | 9 --------- 1 file changed, 9 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/sc8280xp-crd.dts b/arch/arm64/boot/dts/qcom/sc8280xp-crd.dts index 45058ad0a1c8..6792e88b2c6c 100644 --- a/arch/arm64/boot/dts/qcom/sc8280xp-crd.dts +++ b/arch/arm64/boot/dts/qcom/sc8280xp-crd.dts @@ -87,7 +87,6 @@ regulator-min-microvolt = <1200000>; regulator-max-microvolt = <1200000>; regulator-initial-mode = ; - regulator-allow-set-load; regulator-boot-on; regulator-always-on; }; @@ -97,7 +96,6 @@ regulator-min-microvolt = <912000>; regulator-max-microvolt = <912000>; regulator-initial-mode = ; - regulator-allow-set-load; }; vreg_l6b: ldo6 { @@ -105,7 +103,6 @@ regulator-min-microvolt = <880000>; regulator-max-microvolt = <880000>; regulator-initial-mode = ; - regulator-allow-set-load; regulator-boot-on; }; }; @@ -119,7 +116,6 @@ regulator-min-microvolt = <1800000>; regulator-max-microvolt = <1800000>; regulator-initial-mode = ; - regulator-allow-set-load; }; vreg_l7c: ldo7 { @@ -135,7 +131,6 @@ regulator-min-microvolt = <3072000>; regulator-max-microvolt = <3072000>; regulator-initial-mode = ; - regulator-allow-set-load; }; }; @@ -158,7 +153,6 @@ regulator-min-microvolt = <1200000>; regulator-max-microvolt = <1200000>; regulator-initial-mode = ; - regulator-allow-set-load; }; vreg_l6d: ldo6 { @@ -166,7 +160,6 @@ regulator-min-microvolt = <880000>; regulator-max-microvolt = <880000>; regulator-initial-mode = ; - regulator-allow-set-load; }; vreg_l7d: ldo7 { @@ -174,7 +167,6 @@ regulator-min-microvolt = <3072000>; regulator-max-microvolt = <3072000>; regulator-initial-mode = ; - regulator-allow-set-load; }; vreg_l9d: ldo9 { @@ -182,7 +174,6 @@ regulator-min-microvolt = <912000>; regulator-max-microvolt = <912000>; regulator-initial-mode = ; - regulator-allow-set-load; }; }; }; From patchwork Wed Oct 19 08:28: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: 4712 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp213870wrs; Wed, 19 Oct 2022 02:11:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM44wUSM1zCeUEOmluYH877vIPLeg+4L4JlA6InFlG7PFqEVtSq7eNPVXuSjRqoOfhsZBwf/ X-Received: by 2002:a17:907:7f91:b0:78e:2eb4:1fac with SMTP id qk17-20020a1709077f9100b0078e2eb41facmr5836390ejc.126.1666170678558; Wed, 19 Oct 2022 02:11:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170678; cv=none; d=google.com; s=arc-20160816; b=My2eckukH31z7rfdFy1YhoUC1cVtQSoPbknw5RpHpHEvGMI75p1qrFGiOH/BFa5Kgj f/7vJtiKpFaJ3mILS84MxpfuqjoV2rNs7KBxCcesCtK5q9CnQ5pzyRYumCKE7Bey7vvp R9T2xVqwFE6WjVW0aaTvuzwRp2IA0xL8NZsTibM0/cbZ8uLzTx9XcxTwd/ZfuCv7RFtp fDHZZOrJWln01owoC2VjmY2dLkaLIqOTTyDkznKdsVJHi0e5Tn26GpN1yLHqVRDRUa2C N8DWuFF2My4tbwHfN5IEYAecctQzdDOBZDxDvT5/jaRvz5TA1GS3xzfKvh/twldbRE1n Culw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=eYZ/R65mCukP6iplCvlMPZ/5XGDZMP8Exm/Ao8vpSak=; b=cywohBayUP3GJe1SSIZNpvn48tokR2lbKBtceU0aqX7w0IdbrvyeZvbYKRXp1rrZgN jm24CCKZaYYFxf9+Ha19PfBLpN1shLFQUFMaygpfd1WT7M8IE+CWWjdQHt4jhDasGITr oMHxrVfcTiJj9HkTJx2wTzzTFrS+cnSJCbUhxj2drOjX9snboivchtGEBrB34TisVzmd 4g3ao5ew/QuFe8WIxt8fhLer1dXqUhpM9AI+cF+DwdIsU09ZJe8v+2lLQ0WrIR3EIdzp U5N6Cj54I1j7kaVnrlB2z4wB/NI4Km+HStyexzeL3LPILxRI9qUOaz19ciRnzgVx1dFz 7rlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Hm2dhtt7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e5-20020a170906844500b00783757c8e5esi11566959ejy.931.2022.10.19.02.10.53; Wed, 19 Oct 2022 02:11: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=Hm2dhtt7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232555AbiJSJHQ (ORCPT + 99 others); Wed, 19 Oct 2022 05:07:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232698AbiJSJE4 (ORCPT ); Wed, 19 Oct 2022 05:04:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EA5C9D524; Wed, 19 Oct 2022 01:58: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 7B91A6187A; Wed, 19 Oct 2022 08:57:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F71BC433C1; Wed, 19 Oct 2022 08:57:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169844; bh=zOZ2firPIdKUk4Q7exJqITm3SiQV9LMuvdIex9NVwOw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hm2dhtt7KLgVw9FoJhuxch48CEHE2nXQLsLURALEkpAgnb8PdtgIwH7hbC9gvYzdq qQYI6j6MpC67rSOnd4hD0PdqVWbqdKqH6mpUX58D7hh554JIu6N90/5z/v7b0PgRZA zKE98pDkN+pRIwKvZhJl9p1iFJWSroGLjUDhLt94= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Manivannan Sadhasivam , Bjorn Andersson , Sasha Levin Subject: [PATCH 6.0 430/862] arm64: dts: qcom: sc8280xp-lenovo-thinkpad-x13s: disallow regulator mode switches Date: Wed, 19 Oct 2022 10:28:37 +0200 Message-Id: <20221019083308.963357767@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106585247504025?= X-GMAIL-MSGID: =?utf-8?q?1747106585247504025?= From: Johan Hovold [ Upstream commit 648ec2f2ddc05346287e308fbc31a6b8117a1edd ] Do not allow the RPMh regulators to switch to low-power mode. This specifically avoids having regulators be but in low-power mode when only some consumers specify loads while the actual total load really warrants high-power mode. Fixes: 32c231385ed4 ("arm64: dts: qcom: sc8280xp: add Lenovo Thinkpad X13s devicetree") Link: https://lore.kernel.org/all/YtkrDcjTGhpaU1e0@hovoldconsulting.com Signed-off-by: Johan Hovold Reviewed-by: Manivannan Sadhasivam Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220803121942.30236-3-johan+linaro@kernel.org Signed-off-by: Sasha Levin --- .../boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts index 4c404e2eafba..f0ab207cc8e9 100644 --- a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts +++ b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts @@ -79,7 +79,6 @@ regulator-min-microvolt = <1200000>; regulator-max-microvolt = <1200000>; regulator-initial-mode = ; - regulator-allow-set-load; regulator-boot-on; }; @@ -88,7 +87,6 @@ regulator-min-microvolt = <912000>; regulator-max-microvolt = <912000>; regulator-initial-mode = ; - regulator-allow-set-load; }; vreg_l6b: ldo6 { @@ -96,7 +94,6 @@ regulator-min-microvolt = <880000>; regulator-max-microvolt = <880000>; regulator-initial-mode = ; - regulator-allow-set-load; regulator-boot-on; regulator-always-on; // FIXME: VDD_A_EDP_0_0P9 }; @@ -111,7 +108,6 @@ regulator-min-microvolt = <1800000>; regulator-max-microvolt = <1800000>; regulator-initial-mode = ; - regulator-allow-set-load; }; vreg_l12c: ldo12 { @@ -119,7 +115,6 @@ regulator-min-microvolt = <1800000>; regulator-max-microvolt = <1800000>; regulator-initial-mode = ; - regulator-allow-set-load; }; vreg_l13c: ldo13 { @@ -127,7 +122,6 @@ regulator-min-microvolt = <3072000>; regulator-max-microvolt = <3072000>; regulator-initial-mode = ; - regulator-allow-set-load; }; }; @@ -142,7 +136,6 @@ regulator-min-microvolt = <1200000>; regulator-max-microvolt = <1200000>; regulator-initial-mode = ; - regulator-allow-set-load; }; vreg_l4d: ldo4 { @@ -150,7 +143,6 @@ regulator-min-microvolt = <1200000>; regulator-max-microvolt = <1200000>; regulator-initial-mode = ; - regulator-allow-set-load; }; vreg_l7d: ldo7 { @@ -158,7 +150,6 @@ regulator-min-microvolt = <3072000>; regulator-max-microvolt = <3072000>; regulator-initial-mode = ; - regulator-allow-set-load; }; vreg_l9d: ldo9 { @@ -166,7 +157,6 @@ regulator-min-microvolt = <912000>; regulator-max-microvolt = <912000>; regulator-initial-mode = ; - regulator-allow-set-load; }; }; }; From patchwork Wed Oct 19 08:28: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: 5528 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp337655wrs; Wed, 19 Oct 2022 06:49:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4DbA/5D6TLyZqw1XW/aVlbtoBrDpJhmkJh6UkPuB7UqlR9g7GmC3WiPsgCmBybC/CtHA51 X-Received: by 2002:a05:6a00:804:b0:563:264a:f5e5 with SMTP id m4-20020a056a00080400b00563264af5e5mr8806843pfk.62.1666187396184; Wed, 19 Oct 2022 06:49:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666187396; cv=none; d=google.com; s=arc-20160816; b=yQCLW21mvGZ5oxgsVZdYGG+sGaVVJV/7Q9CM2QucE/pWjMVb1cnibrEdOFmZKTX4xl ac81Hxhf4tifOkCaV/mjiCNTZJdSQ2JWFPztP4q4GbUWYJsHXzmILzzaiTisZOqulEH9 lCKZm6oLuFMRrypKE2ouhuJrFrkJjeLlZzWUKrHWGsqMFX8q4XdpeMw88BDt7eSXCkd8 MLOwPLFzf+CjXRY1iLGgRNVGzZxzDzF4+yFzfYwn+GpoypZly/DEV+0Jhv7Ho7Ytg7A5 rYeYhSSK0z3jIa+vi0IGQ2n1/YPhkOy94EIVWS0WZ+vwhMzwXtPzmTjQXyXioWlgjbtq HEtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0EKhw3Kb3yx5lkpaShWvlv3OqGdcYTcW50js7mrNnms=; b=EIrm24XE5ECAOH1aQ16Zh+h7jDy+HxM4Vg3gks/5IfoIYy3pEZuRBpENuJSA6HRSt+ i7LlEzqvmtSKKcomNGeZjF2v0PUJsNV/wnxLYir8TSREBitbK32UUHV6whRM5jwL3CSe C/cnhK5pJTi+67/eQiuO+pWwhpkHKxK7JG8PV+JszgSPG/pIpW3859KYvdAWT11nEvL9 x5UklW3kuuUQL6VDiJVUaPDDZJjkrrn6FD6syKSOXnZsF0R0QawhMC21xfza5nOGDE++ JqfGvZcNJMbPVKTj8CN8JJvrU/7OnozPIlI51bHI2oUG1XO1TjFCP5w8M9TBZuLXPIo2 bATA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=V3oVgBI3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 17-20020a630f51000000b00450200a1087si17202476pgp.61.2022.10.19.06.49.41; Wed, 19 Oct 2022 06:49: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=V3oVgBI3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233646AbiJSNsn (ORCPT + 99 others); Wed, 19 Oct 2022 09:48:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233486AbiJSNrQ (ORCPT ); Wed, 19 Oct 2022 09:47:16 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03153895D6; Wed, 19 Oct 2022 06:32: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 ACAC2B8241F; Wed, 19 Oct 2022 08:57:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 218C6C433D6; Wed, 19 Oct 2022 08:57:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169847; bh=bYETwzBYvYBK+ZkJLVh9pj7tY31tMnUd7N/uOtigN4c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V3oVgBI3Ic0y9JZDTtu7fQG9zbjbOPyMSMdHckY0WMSsAnk4wVdIzgUJaowpkViX8 upc3I56yd2Zjn8FPYPipZPHO929bhs4+i1B6/gjcxKNae4ipYuxlzU6JZhblu0HThP iKfyrtO4Qc568NepeBvvkWolXInwE7WQcvzST4t0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Manivannan Sadhasivam , Bjorn Andersson , Sasha Levin Subject: [PATCH 6.0 431/862] arm64: dts: qcom: sa8295p-adp: disallow regulator mode switches Date: Wed, 19 Oct 2022 10:28:38 +0200 Message-Id: <20221019083309.012193920@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747124115466494299?= X-GMAIL-MSGID: =?utf-8?q?1747124115466494299?= From: Johan Hovold [ Upstream commit 2a6164cef63cae77edbd9deef844b1774886fcb7 ] Do not allow the RPMh regulators to switch to low-power mode with an exception for the UFS regulators (l3c, l6c, l10c and l17c) as UFS supports an idle mode. This specifically avoids having regulators be but in low-power mode when only some consumers specify loads while the actual total load really warrants high-power mode. Fixes: 519183af39b2 ("arm64: dts: qcom: add SA8540P and ADP") Link: https://lore.kernel.org/all/YtkrDcjTGhpaU1e0@hovoldconsulting.com Signed-off-by: Johan Hovold Reviewed-by: Manivannan Sadhasivam Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220803121942.30236-4-johan+linaro@kernel.org Signed-off-by: Sasha Levin --- arch/arm64/boot/dts/qcom/sa8295p-adp.dts | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/sa8295p-adp.dts b/arch/arm64/boot/dts/qcom/sa8295p-adp.dts index 9398f0349944..ca5f5ad32ce5 100644 --- a/arch/arm64/boot/dts/qcom/sa8295p-adp.dts +++ b/arch/arm64/boot/dts/qcom/sa8295p-adp.dts @@ -35,7 +35,6 @@ regulator-min-microvolt = <1200000>; regulator-max-microvolt = <1208000>; regulator-initial-mode = ; - regulator-allow-set-load; }; vreg_l5a: ldo5 { @@ -43,7 +42,6 @@ regulator-min-microvolt = <912000>; regulator-max-microvolt = <912000>; regulator-initial-mode = ; - regulator-allow-set-load; }; vreg_l7a: ldo7 { @@ -51,7 +49,6 @@ regulator-min-microvolt = <1800000>; regulator-max-microvolt = <1800000>; regulator-initial-mode = ; - regulator-allow-set-load; }; vreg_l13a: ldo13 { @@ -59,7 +56,6 @@ regulator-min-microvolt = <3072000>; regulator-max-microvolt = <3072000>; regulator-initial-mode = ; - regulator-allow-set-load; }; }; @@ -72,7 +68,6 @@ regulator-min-microvolt = <912000>; regulator-max-microvolt = <912000>; regulator-initial-mode = ; - regulator-allow-set-load; }; vreg_l2c: ldo2 { @@ -80,7 +75,6 @@ regulator-min-microvolt = <3072000>; regulator-max-microvolt = <3072000>; regulator-initial-mode = ; - regulator-allow-set-load; }; vreg_l3c: ldo3 { @@ -96,7 +90,6 @@ regulator-min-microvolt = <1200000>; regulator-max-microvolt = <1208000>; regulator-initial-mode = ; - regulator-allow-set-load; }; vreg_l6c: ldo6 { @@ -112,7 +105,6 @@ regulator-min-microvolt = <1800000>; regulator-max-microvolt = <1800000>; regulator-initial-mode = ; - regulator-allow-set-load; }; vreg_l10c: ldo10 { @@ -141,7 +133,6 @@ regulator-min-microvolt = <1200000>; regulator-max-microvolt = <1200000>; regulator-initial-mode = ; - regulator-allow-set-load; }; vreg_l7g: ldo7 { @@ -149,7 +140,6 @@ regulator-min-microvolt = <1800000>; regulator-max-microvolt = <1800000>; regulator-initial-mode = ; - regulator-allow-set-load; }; vreg_l8g: ldo8 { @@ -157,7 +147,6 @@ regulator-min-microvolt = <880000>; regulator-max-microvolt = <880000>; regulator-initial-mode = ; - regulator-allow-set-load; }; }; }; From patchwork Wed Oct 19 08:28:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5531 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp337788wrs; Wed, 19 Oct 2022 06:50:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5yimDqYh26ExTcyuMtGpFnJowKFcwXac3du5YecHOltEMopGOGo3zin92Xhb3fZUvb5UgS X-Received: by 2002:a65:6e9a:0:b0:44c:2476:12e0 with SMTP id bm26-20020a656e9a000000b0044c247612e0mr7475573pgb.159.1666187414273; Wed, 19 Oct 2022 06:50:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666187414; cv=none; d=google.com; s=arc-20160816; b=vV/6QSs0YchWKXfu6A8v7gGq1qTenDzndLo7ee2hECoaAh1kFROM16tzc1JGjZdOpx mHrOIioc1C6VZvoXfuRkho1iiZBltD4ln/0YSwlYy5EbR/Pj4DIUxXpMi2xzBM9rmgug 3BDoX4lIidnawiBjzAuScjBc1tUeN/5joJNKrIGdfhPObkbr5R93iIjoRGF1CxlztNG/ rLtowyN8swSmeLmXHwG3mCFD2g0S7R58lLmBG9HVmfVfKERgoVPhaNGcNeTP7nkzqdx2 4oEYt0hgGGZx4vLxN1EhGu/k/dZJpPfuObi+Th6VbVaxDjYIwhqlFzjMMgivt/yLY1qu Jiow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YLv4UjmLWrT/2st+eKrTHvYVFErXQ0jw9qdK94nkUi8=; b=I9Rx6j7QRyONBuSOvtiGDHD0STxvjBqyG5YfkZ9pFDpCWns/TmF8eAbKshWQ53JS0N Pq4mqPFSeB2DxFQS3AgU/xXm+k/k44erri2y08aDYazGXyoSBuKtn2OO1ISq1bistK8p n9eMlh6fdViskgkmuTVBXdzNeoPxKrwANiKQTkFzc0fDDHgkq+1Xfccv+APjWkmOcbOq iH2KihNounzWtaVgEP9wmfTikH272sFAMPJU0nuce9NYTqQQkpbQYilThfPO92HIsW0z tfsjsQQQq/y9jXkbPBYcc/zZncQgylQgzvSEdj6pxxggidFEzcbAiSEvxCo0s9yjdcdB h/Sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bySEsqoO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170903310c00b0017808c0aa8bsi15968884plc.115.2022.10.19.06.49.59; Wed, 19 Oct 2022 06: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=bySEsqoO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232252AbiJSNtl (ORCPT + 99 others); Wed, 19 Oct 2022 09:49:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233538AbiJSNrl (ORCPT ); Wed, 19 Oct 2022 09:47:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1C8EC3564; Wed, 19 Oct 2022 06:32: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 43D35B82424; Wed, 19 Oct 2022 08:57:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B25DEC433D6; Wed, 19 Oct 2022 08:57:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169850; bh=byYn4hlexYU9ll25yQ+O1Xv+YNlrWSdQs/8nM/fstBM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bySEsqoOa2IbopnsF5PB5PPZ+ttU55VOg8GnoaDfruY3ydDRUB/IDHtVbM6Y7FiS4 TK6512y5CDf+qsdikWVtuvkWaB3A2nXlvZb+/FH2C1VnUo0acWOBwEwKP3FoFyRGJv /KRcSvBngnI71jwBS1B4jWMwIxNlxs5DQRx4hIg0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Bryan ODonoghue , Bjorn Andersson , Sasha Levin Subject: [PATCH 6.0 432/862] arm64: dts: qcom: pm8350c: Drop PWM reg declaration Date: Wed, 19 Oct 2022 10:28:39 +0200 Message-Id: <20221019083309.063570347@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747124134347283353?= X-GMAIL-MSGID: =?utf-8?q?1747124134347283353?= From: Bryan O'Donoghue [ Upstream commit eeca7d46217ccfe9289530e959c0fb29190af0d6 ] The PWM is a part of the SPMI PMIC block and maps several different addresses within the SPMI block. It is not accurate to describe as pwm@reg as a result. Fixes: 5be66d2dc887 ("arm64: dts: qcom: pm8350c: Add pwm support") Reviewed-by: Krzysztof Kozlowski Signed-off-by: Bryan O'Donoghue Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220828132648.3624126-3-bryan.odonoghue@linaro.org Signed-off-by: Sasha Levin --- arch/arm64/boot/dts/qcom/pm8350c.dtsi | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/pm8350c.dtsi b/arch/arm64/boot/dts/qcom/pm8350c.dtsi index e0bbb67717fe..f28e71487d5c 100644 --- a/arch/arm64/boot/dts/qcom/pm8350c.dtsi +++ b/arch/arm64/boot/dts/qcom/pm8350c.dtsi @@ -30,9 +30,8 @@ #interrupt-cells = <2>; }; - pm8350c_pwm: pwm@e800 { + pm8350c_pwm: pwm { compatible = "qcom,pm8350c-pwm"; - reg = <0xe800>; #pwm-cells = <2>; status = "disabled"; }; From patchwork Wed Oct 19 08:28:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4859 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223896wrs; Wed, 19 Oct 2022 02:38:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6mR0lBQQSjnhO+CTKo5CmfhONRKBfc+Vk0VWE3HGfX53RvnxcWtCGglxIhwCnjJ02BrQ4J X-Received: by 2002:a17:90b:3912:b0:20d:4151:1b65 with SMTP id ob18-20020a17090b391200b0020d41511b65mr45003229pjb.233.1666172326348; Wed, 19 Oct 2022 02:38:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172326; cv=none; d=google.com; s=arc-20160816; b=FxDqS622WomuWW65VumJHMAYmspqWptRlydh6mTb7xwH3ncIEoHiK/e13L3UGRLkC6 UR/KW5rQgx5cbWBn61vAHz2JbebibEiJPAS0+At21Y39iSAJjvuoqNfe6BhNSCCR/UgQ 6PwLs213mfadzVezyMoE9REL+3/0f36p8QZewUb9ygpSRwb9OyFq+S/zWte5SBZrOg5o +NLnqxDwrY63QpEQUolnOvkc905D6D6ydHB9pUkcIfyGmOHhKzpN3Vhphgf87iYYQp5n NiKKcgsnSQNiiVJo/AxvYtjtLWDXre6770fkYaTYg/4hTiDrmH+jHUnb8/mjkPT1QBiX KuwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=N3VrGUAzY/octMyFqwA1wBfYcQb63pqp1GywAhKn+Bo=; b=KDguDlkXyPBsvmkZGKpQvzgvvLHIBQfNEbKo/3pZqYmKc2Irn2PP1Nx6X0dvDMdfjE Vly7azMyhxShlB1k0LkqMAUSZKurcX7g6S/6MeGmZiXitcDxLTSNg0LcHPLgac6y+8QX 9KXLzzISQSU4LToOL0AvvQpCuGR6sBXbiduuAlnRTnnqDOVj+bu4IH6SMWXB8tmwdXZS 7gxf9fU6z5Op53Nadhlicbg2cv0Mtrb0DJpzlLk4CUBSbv/5FP7sUSpKpWQ67GfxLqsh DghKwNncbJiWy6wY/QunZ9V/fn4QS8vEyG2sgJnmwkLNCJleTxPaFiBAQc8cqpvz8uC9 zL/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iJLc9EuU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 125-20020a630583000000b0043ac3ec9d9esi17583030pgf.595.2022.10.19.02.38.33; Wed, 19 Oct 2022 02:38: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=iJLc9EuU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233395AbiJSJWT (ORCPT + 99 others); Wed, 19 Oct 2022 05:22:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230348AbiJSJUd (ORCPT ); Wed, 19 Oct 2022 05:20:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19DC91C41E; Wed, 19 Oct 2022 02:09: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 563F96186E; Wed, 19 Oct 2022 08:57:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 554EBC433D7; Wed, 19 Oct 2022 08:57:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169852; bh=ydGjh0C3/rjhYKtzdIX5zVrzBYzbNRasu01fnkBC9AA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iJLc9EuUoJjcGqY3dACCxIjOFhgxcPi5LpGXdhgNDc/HvRbFLpxSNv4gOyLbNgDuo LhLTS6m1tOMHXh2P7W/ajCLMKLoa3zNvVjBF6ksuwP4gk45mQEJ2XeOYxHcT+aQcmx BNBs3zpTetdXcNiFUf0LyPOigVnn9dv+ARwENWCw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Matthias Kaehlcke , Stephen Boyd , Bjorn Andersson , Sasha Levin Subject: [PATCH 6.0 433/862] arm64: dts: qcom: sc7180-trogdor: Keep pm6150_adc enabled for TZ Date: Wed, 19 Oct 2022 10:28:40 +0200 Message-Id: <20221019083309.103905831@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108313039323258?= X-GMAIL-MSGID: =?utf-8?q?1747108313039323258?= From: Stephen Boyd [ Upstream commit 144fbd028fdec2deeb3b99d5e60dbf3167950ebe ] There's still a thermal zone using pm6150_adc in the pm6150.dtsi file, pm6150_thermal. It's not super obvious because it indirectly uses the adc through an iio channel in pm6150_temp. Let's keep this enabled on lazor and coachz so that reading the temperature of the pm6150_thermal zone continues to work. Otherwise we get -EINVAL when reading the zone, and I suspect the PMIC temperature trip doesn't work properly so we don't shutdown when the PMIC overheats. Cc: Matthias Kaehlcke Fixes: b8d1e3d33487 ("arm64: dts: qcom: sc7180-trogdor: Delete ADC config for unused thermistors") Signed-off-by: Stephen Boyd Reviewed-by: Matthias Kaehlcke Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220827004901.511543-1-swboyd@chromium.org Signed-off-by: Sasha Levin --- arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r1.dts | 2 -- arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi | 2 -- 2 files changed, 4 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r1.dts b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r1.dts index 8290d036044a..edfcd47e1a00 100644 --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r1.dts +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r1.dts @@ -24,8 +24,6 @@ }; &pm6150_adc { - status = "disabled"; - /delete-node/ skin-temp-thermistor@4e; /delete-node/ charger-thermistor@4f; }; diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi index 2cf7d5212c61..002663d752da 100644 --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi @@ -55,8 +55,6 @@ ap_ts_pen_1v8: &i2c4 { }; &pm6150_adc { - status = "disabled"; - /delete-node/ charger-thermistor@4f; }; From patchwork Wed Oct 19 08:28:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5492 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp334943wrs; Wed, 19 Oct 2022 06:43:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7hVI8inDhUOn4VG5d3msN1pLkdWuvcWTtmM7hL9auY8O+nzIwxd1y3F8iKgZSseM84nKQH X-Received: by 2002:a05:6402:357:b0:458:5cb6:f587 with SMTP id r23-20020a056402035700b004585cb6f587mr7612557edw.183.1666187038612; Wed, 19 Oct 2022 06:43:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666187038; cv=none; d=google.com; s=arc-20160816; b=RB8nGNF3cPYM/DxrJ2FWpgy+YrIFWkr5yJq3ZEtO7d4iHBpe74yRNxvsIay/tbw3nl C2q9XH15np7pex4+MYnp8hj9VW0fW+bwgPUHpIr7/viwArPeqk2oDOtd0iIOShZZpjCT 92/UQZ4wImvporb/80Bj5UZC5GacjA2DDXwh1V2w1+wyF7On3L4D8xb/dGPfpJ7uqq5j 3ZQrW5eGKwsnuErGWzi/tGFf/riHZXj2zJY5pt17X2Oge9zffhL4FwHI4N7woXkYRd5y m1BCyOmEbZTC4nStN/VCINJHVWlhALskLaUs1tNXNl7ExTEnDAV01RjnawR754s4Jaru YSKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kKrmdbXN8++sv+oZyT/qiEU2U7VGcWRidcEyi/oSLZ8=; b=RTydbm1oujQU6RHYTFh6scMkQ514jkZUOtWMg3FurzipnEFDdZl0y4y7PX7wUUJCfm BtH7eg8QP/u81yT5cRPohimod7KrLJBnFZooUMcPCVI7Z4J3n6inKNROY0j2SfqEsPNA 4yDWiQokApm77oaB9UHbmj0+qdVKYMKA6p6ZtS4m+kDiz8WaRIaQaJAbVtBQPxwKsQhW 8D9vjOhK+MRFtphl4RMwDMu/LYP0Mc9AmfSuET1FODRubGwG59QOvm8wyDAN4vKGPCqJ 3X2m6P7sfI7YM8oTM0P6Jzu9OSYaPkYRjXVNSCDc9iRcTsJD1jCTvdPw25KWZnYVHTeA 6wlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WHLoCBf8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sg35-20020a170907a42300b0078234266a78si14765226ejc.894.2022.10.19.06.43.32; Wed, 19 Oct 2022 06:43: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=WHLoCBf8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232825AbiJSNkx (ORCPT + 99 others); Wed, 19 Oct 2022 09:40:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232565AbiJSNiy (ORCPT ); Wed, 19 Oct 2022 09:38:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB8DEC8950; Wed, 19 Oct 2022 06:26: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 BF738B82428; Wed, 19 Oct 2022 08:57:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F91EC433C1; Wed, 19 Oct 2022 08:57:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169855; bh=QE29W445skf+b67eNF58++sy3X82ljVGxWpQJ0ChOqc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WHLoCBf8JsZaosJNlvfI/JjDw0OwuXN7PYBonePMavyPOJRfo1DfotgDfwPb+r2Qx oBtMk1YtAkgp0hXbAIEoRwlgLvnC+HvavPjEuXRgHwvaVeU81X7dkIZuBPRANxG2ET Cv94GYp35myXiztKsxIwgOQJVy2DyaopLyUjs1HY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Marek_Beh=C3=BAn?= , Gregory CLEMENT , Sasha Levin Subject: [PATCH 6.0 434/862] ARM: dts: turris-omnia: Fix mpp26 pin name and comment Date: Wed, 19 Oct 2022 10:28:41 +0200 Message-Id: <20221019083309.154357076@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123739892727673?= X-GMAIL-MSGID: =?utf-8?q?1747123739892727673?= From: Marek Behún [ Upstream commit 49e93898f0dc177e645c22d0664813567fd9ec00 ] There is a bug in Turris Omnia's schematics, whereupon the MPP[26] pin, which is routed to CN11 pin header, is documented as SPI CS1, but MPP[26] pin does not support this function. Instead it controls chip select 2 if in "spi0" mode. Fix the name of the pin node in pinctrl node and fix the comment in SPI node. Fixes: 26ca8b52d6e1 ("ARM: dts: add support for Turris Omnia") Signed-off-by: Marek Behún Signed-off-by: Gregory CLEMENT Signed-off-by: Sasha Levin --- arch/arm/boot/dts/armada-385-turris-omnia.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/boot/dts/armada-385-turris-omnia.dts b/arch/arm/boot/dts/armada-385-turris-omnia.dts index d1e0db6e5730..a41902e3815c 100644 --- a/arch/arm/boot/dts/armada-385-turris-omnia.dts +++ b/arch/arm/boot/dts/armada-385-turris-omnia.dts @@ -476,7 +476,7 @@ marvell,function = "spi0"; }; - spi0cs1_pins: spi0cs1-pins { + spi0cs2_pins: spi0cs2-pins { marvell,pins = "mpp26"; marvell,function = "spi0"; }; @@ -511,7 +511,7 @@ }; }; - /* MISO, MOSI, SCLK and CS1 are routed to pin header CN11 */ + /* MISO, MOSI, SCLK and CS2 are routed to pin header CN11 */ }; &uart0 { From patchwork Wed Oct 19 08:28:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4732 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214172wrs; Wed, 19 Oct 2022 02:12:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7c8Qpr8Et9hOuDYPC6yNdOVz3LHC73KgfHJg16U4YhFWWb08qfaOOTsI5t8NQu7by4CuRA X-Received: by 2002:a05:6402:1f06:b0:457:149d:beaa with SMTP id b6-20020a0564021f0600b00457149dbeaamr6386285edb.238.1666170724642; Wed, 19 Oct 2022 02:12:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170724; cv=none; d=google.com; s=arc-20160816; b=I5rZTCXLzgSqtEooT4/KYAcgb9lZz227eNqOmOuC0xhbF13OxQSV0wEt/bxVh+J8yY UrXDTt5K6PK+AuBG6RjTZdHk1W5a5jXHHu9WPRd81XHzwGYjMR3VOk+dcyXbvyGkjZg/ cHJKmE3hUHY87fzuRk99n2H3maOKC6nJ05vkjv3HtXRWoZWPRIV9sDeVTo6GTkX/3gHV wW9qIM3ozBumwqC7M58AKKc5WTRTVlp3xDmA3KGQo0AfRmUADJAkjKtnKQBmU5kRUoM7 T5UQYnc+RR+DwatNmRIG/a4jtXPoRWAA0ggoZb851djBdukq7qFrPN5if1269SYOfDDE 62tA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RHN2Ske92yvWhsHoCz4tAmIpOnu73nVOxi2Cc3hoDoI=; b=nuwVYcXmGPIjfSysa9t/u6UvjHWNjfr7Je0YlqmUENI2gMidSnBoswiIW9fTqu4ZZR Zu69OfHcaeOyJn8nR1MBFwfZYtaZVbA8mXLwzYYg7y6Vpdkd4iK+dLDUZNabYtmxJm8U xR5Afo1+3hxKSUoKpJ8GsabfC/wzZISeS1ahY5pI5sASm/QTEmqP/aOCcrucnaByzMMa HOZO5d49oVEUbO4a/W27KQmRhgqlGo0G/1qQ3zGvRZ8bpQMfKXM2b4YbViP7HtBrXaLT N8eBH5djdg2RD9rsBd3jReDvna4/+kNnJRHDQsmj73ev6h4bkuugcutK3qz8Ii7939n5 Ydyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=O410CZe0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qa14-20020a170907868e00b0073d7ad9607bsi12948098ejc.551.2022.10.19.02.11.39; Wed, 19 Oct 2022 02:12: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=O410CZe0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232693AbiJSJIu (ORCPT + 99 others); Wed, 19 Oct 2022 05:08:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232454AbiJSJGS (ORCPT ); Wed, 19 Oct 2022 05:06: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 2DE05CE2C; Wed, 19 Oct 2022 01:59: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 D1C49617F0; Wed, 19 Oct 2022 08:57:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ECB20C433C1; Wed, 19 Oct 2022 08:57:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169858; bh=BBEZSL/kEaLKT0nn3CDJDaoaCe8MaFX+1kU7JZ+z9Ck=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O410CZe06OIXmwUzCDYg0VM2tlDDP1eCwhy6brQMXDxLOswsWhM4/bGokeQaDiwQK 5cYLhFy9JkXTDU8vhm+JR2uMTfppMA1yXCaUJMhHGs4MAm68XGCYB6jWBCnjadczQ6 /cs/+cpDfFfvKU08uKG0gksXNBfq9WwpHVSpYoJM= 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 6.0 435/862] ARM: dts: kirkwood: lsxl: fix serial line Date: Wed, 19 Oct 2022 10:28:42 +0200 Message-Id: <20221019083309.196961234@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106633729066427?= X-GMAIL-MSGID: =?utf-8?q?1747106633729066427?= From: Michael Walle [ Upstream commit 04eabc6ac10fda9424606d9a7ab6ab9a5d95350a ] Commit 327e15428977 ("ARM: dts: kirkwood: consolidate common pinctrl settings") unknowingly broke the serial output on this board. Before this commit, the pinmux was still configured by the bootloader and the kernel didn't reconfigured it again. This was an oversight by the initial board support where the pinmux for the serial line was never configured by the kernel. But with this commit, the serial line will be reconfigured to the wrong pins. This is especially confusing, because the output still works, but the input doesn't. Presumingly, the input is reconfigured to MPP10, but the output is connected to both MPP11 and MPP5. Override the pinmux in the board device tree. Fixes: 327e15428977 ("ARM: dts: kirkwood: consolidate common pinctrl settings") Signed-off-by: Michael Walle Reviewed-by: Andrew Lunn Signed-off-by: Gregory CLEMENT Signed-off-by: Sasha Levin --- arch/arm/boot/dts/kirkwood-lsxl.dtsi | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm/boot/dts/kirkwood-lsxl.dtsi b/arch/arm/boot/dts/kirkwood-lsxl.dtsi index 7b151acb9984..321a40a98ed2 100644 --- a/arch/arm/boot/dts/kirkwood-lsxl.dtsi +++ b/arch/arm/boot/dts/kirkwood-lsxl.dtsi @@ -10,6 +10,11 @@ ocp@f1000000 { pinctrl: pin-controller@10000 { + /* Non-default UART pins */ + pmx_uart0: pmx-uart0 { + marvell,pins = "mpp4", "mpp5"; + }; + pmx_power_hdd: pmx-power-hdd { marvell,pins = "mpp10"; marvell,function = "gpo"; From patchwork Wed Oct 19 08:28:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4741 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214342wrs; Wed, 19 Oct 2022 02:12:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7+l4zdp9e3HxX23FBZwTKaocMKeeRuqby6z8SP7IaIJqBHEklICpLMeIovUBsJfpsgVdMf X-Received: by 2002:a17:907:70b:b0:740:ef93:2ffb with SMTP id xb11-20020a170907070b00b00740ef932ffbmr5770292ejb.93.1666170752302; Wed, 19 Oct 2022 02:12:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170752; cv=none; d=google.com; s=arc-20160816; b=cE/t2kBW/Q/M+ZC5wRhpGggHcy8IVs1N2qrT9YxbYAChm9OcZYoqjq2ZH39ng+ocp0 isAojjZtv/DXGS0ddej4d9MMbV2Hk73AaLaPtXz0ue5x+PK+EhdElUbnKiIOJ47UQ4Vp UbGO5LleWkLR2Dx4YdqcfBKL5T+jB5/c0yAPRpY9fEIE12i1oNPrdmYuG5zLz5oWmkMN ogMrk1JlKQ3uJm+TANpYFPa0yvhb0S3D93oR9/8VOcDHPfVww68rdvyKtCevmH+NQWfy isvvjWFXgsa7KMsEdVqy63sCy4KZPVJYNpqKA1/v/XP2r+QB+F5y5No/9dKmo3jIZIEI YlEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bZCjyF/awsLX2FZMnkU85emi6uW8YxgWuqdmAKdv8W8=; b=xjt5SsgtL/8P9PhiUMZfeprpi3YYEklFuO6xUSuEyKlmgNiJNRU0LkjeSym1gg4ElA leNnjMU+dk9H6p727e+3Ar6VMzzlV3eALh4HdF7ROUpwz87rdQsXXACkJdf3oc4e0Hfl nJ8BDPy+9P53JzbFILaosBrfvCIX5GLQJeSDTUmPv+M7bjuza7PFRi7Q2ajS4Zpyipsi 13Kh26ximQ9IO/Tk8C/rkJvawQgvKzXngsk6jcqYwQ+6YONzhdwNokj8Oheie/fAzXLV TPnoDcImJc6OqbqPLWERO/IEqUjHqEW15Y0HIqyYECtFxY8QUgPRtjfrNvTFj1iKATFe DYSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OgqINgEE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a13-20020a170906684d00b00788a4c018b5si11026512ejs.806.2022.10.19.02.12.07; Wed, 19 Oct 2022 02:12: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=OgqINgEE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232701AbiJSJIz (ORCPT + 99 others); Wed, 19 Oct 2022 05:08:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232457AbiJSJGS (ORCPT ); Wed, 19 Oct 2022 05:06: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 2DFCC12D03; Wed, 19 Oct 2022 01:59: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 BA53E6181D; Wed, 19 Oct 2022 08:57:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9602C433C1; Wed, 19 Oct 2022 08:57:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169861; bh=RLkQdPDMRCOU/IECOAC2hHaLhoeqjEyfi9vzRWGTaUE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OgqINgEEKis9fm7HMhS5F9N6H9u97gUbWGkMYleSBtyFgoj0Rrh76xD8lb+DRwYKo RXsh/a8MGeK6sgherQZkUnBr+c8yyrj4BJxWmi/y5Cr7BxWEmyQMD7I6dbdoh3eEui WItrI6VCO07JaU3JS6zzAgdzDoRW3ev+hH78/Y8I= 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 6.0 436/862] ARM: dts: kirkwood: lsxl: remove first ethernet port Date: Wed, 19 Oct 2022 10:28:43 +0200 Message-Id: <20221019083309.247812811@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106662887413812?= X-GMAIL-MSGID: =?utf-8?q?1747106662887413812?= From: Michael Walle [ Upstream commit 2d528eda7c96ce5c70f895854ecd5684bd5d80b9 ] Both the Linkstation LS-CHLv2 and the LS-XHL have only one ethernet port. This has always been wrong, i.e. the board code used to set up both ports, but the driver will play nice and return -ENODEV if the assiciated PHY is not found. Nevertheless, it is wrong. Remove it. Fixes: 876e23333511 ("ARM: kirkwood: add gigabit ethernet and mvmdio device tree nodes") Signed-off-by: Michael Walle Reviewed-by: Andrew Lunn Signed-off-by: Gregory CLEMENT Signed-off-by: Sasha Levin --- arch/arm/boot/dts/kirkwood-lsxl.dtsi | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/arch/arm/boot/dts/kirkwood-lsxl.dtsi b/arch/arm/boot/dts/kirkwood-lsxl.dtsi index 321a40a98ed2..88b70ba1c8fe 100644 --- a/arch/arm/boot/dts/kirkwood-lsxl.dtsi +++ b/arch/arm/boot/dts/kirkwood-lsxl.dtsi @@ -218,22 +218,11 @@ &mdio { status = "okay"; - ethphy0: ethernet-phy@0 { - reg = <0>; - }; - ethphy1: ethernet-phy@8 { reg = <8>; }; }; -ð0 { - status = "okay"; - ethernet0-port@0 { - phy-handle = <ðphy0>; - }; -}; - ð1 { status = "okay"; ethernet1-port@0 { From patchwork Wed Oct 19 08:28:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5518 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp337067wrs; Wed, 19 Oct 2022 06:48:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7+l/ZMToR3JsRdqxNPeS6JqpCfT1wZ4l+CASwY1FAf4BcJOnaI+JK6LTMDKSBK0E3X7qSW X-Received: by 2002:a17:903:110f:b0:178:a07e:e643 with SMTP id n15-20020a170903110f00b00178a07ee643mr8341660plh.41.1666187303655; Wed, 19 Oct 2022 06:48:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666187303; cv=none; d=google.com; s=arc-20160816; b=nLpEp4SvfrE7Usaal2d0kQTyyUJoGhZLF9HReImaSgdYIhqBy158A3CeResnQdcT2I U1+yuopJEavKNdPSkaEkXwTaZDPIsgrp0pgsFSLjd4+uvd32F6nYgkfwteKASTigcjZH seIQrbIIcCOpNJGeokNM5C6Repl8XvB8UU3nAY/xrUDp9cNNgLm7M/tWcpJwswfS3KOx r6+YO8OQphr8JrIDORTwMdKEkkcSyAFv5pSBwwpIRRHY6+vTLLY9S4Kzc5ivjfOulU5j X5P7CHPSfXi/DjBaYHiFGz0SihbgCLrL+K3q8WdIEATQGBMZ2lVYQp1vrTgJnahrTIik WP0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=SlBkhGpRba6TMwXcLRazv9gVKrhVY015jiIAxYeTUWs=; b=p5+VZVl+tfFDpVJntK0d7nUR5zQ6NZypXjMOj1UyWPBtIC0nsGLZ1/lCTZsxZw8r6G sZjsGzDq02F4+V8oOAOVAm97XAc3lPaXGkMDVQQrpvcnCs25vCCaXpVqXKd6FuKQtKmT xplfueofRjaY7e60bPfUHG4S2lpTbI6UBOztzNakNhtqr03cebEJuOT7XMZR/RNNEUv5 5Lnp7c71o0X3t0/NRIXz/jZ44Rv6bGdkWzcvS9ilPGSgvezLamYsKRiVQfmB5UJKPmmq 4MIQSgalqsshspVBslyk1uRgbhfDEYGp4Zzq/MVusRpzGSSkrWKCi8vP4m0reQ9h0VNB 09yA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rfazNRBn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v9-20020a63b949000000b0045a2b6e1192si18665980pgo.233.2022.10.19.06.48.09; Wed, 19 Oct 2022 06: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=rfazNRBn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233548AbiJSNrm (ORCPT + 99 others); Wed, 19 Oct 2022 09:47:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233032AbiJSNqS (ORCPT ); Wed, 19 Oct 2022 09:46: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 DF44113D7F; Wed, 19 Oct 2022 06:32: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 EE0E8B82432; Wed, 19 Oct 2022 08:57:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6508DC433D6; Wed, 19 Oct 2022 08:57:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169863; bh=3xApLsiBrtBLdrTTC/e7moWt4ozJ/XaI6HBikH3qPtI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rfazNRBnjV7mIAOs7QkD8sgANFpmJtDsQXB0utz/NdlKaw6B5qiqysaIWtPQD96yl bRwxHf51kLeFpUUl1yIaEbHrZfixi+fmXP7V/tvY9iNobB7XfFSOsraVlVpO7G8/bv PR9QYevtcFg7DYWM37bY/PGsdUCxdIJgJ2xnO2GY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chris Packham , Gregory CLEMENT , Sasha Levin Subject: [PATCH 6.0 437/862] arm64: dts: marvell: 98dx25xx: use correct property for i2c gpios Date: Wed, 19 Oct 2022 10:28:44 +0200 Message-Id: <20221019083309.295930262@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747124018185979479?= X-GMAIL-MSGID: =?utf-8?q?1747124018185979479?= From: Chris Packham [ Upstream commit 2b14d382ec97ca5b420239ee6e16da390fab476c ] Use the correct names for scl-gpios and sda-gpios so that the generic i2c recovery code will find them. While we're here set the GPIO_OPEN_DRAIN flag on the gpios. Fixes: b795fadfc46b ("arm64: dts: marvell: Add Armada 98DX2530 SoC and RD-AC5X board") Signed-off-by: Chris Packham Signed-off-by: Gregory CLEMENT Signed-off-by: Sasha Levin --- arch/arm64/boot/dts/marvell/ac5-98dx25xx.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm64/boot/dts/marvell/ac5-98dx25xx.dtsi b/arch/arm64/boot/dts/marvell/ac5-98dx25xx.dtsi index 80b44c7df56a..881bf948d1df 100644 --- a/arch/arm64/boot/dts/marvell/ac5-98dx25xx.dtsi +++ b/arch/arm64/boot/dts/marvell/ac5-98dx25xx.dtsi @@ -117,8 +117,8 @@ pinctrl-names = "default", "gpio"; pinctrl-0 = <&i2c0_pins>; pinctrl-1 = <&i2c0_gpio>; - scl_gpio = <&gpio0 26 GPIO_ACTIVE_HIGH>; - sda_gpio = <&gpio0 27 GPIO_ACTIVE_HIGH>; + scl-gpios = <&gpio0 26 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + sda-gpios = <&gpio0 27 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; status = "disabled"; }; @@ -136,8 +136,8 @@ pinctrl-names = "default", "gpio"; pinctrl-0 = <&i2c1_pins>; pinctrl-1 = <&i2c1_gpio>; - scl_gpio = <&gpio0 20 GPIO_ACTIVE_HIGH>; - sda_gpio = <&gpio0 21 GPIO_ACTIVE_HIGH>; + scl-gpios = <&gpio0 20 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + sda-gpios = <&gpio0 21 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; status = "disabled"; }; From patchwork Wed Oct 19 08:28:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5413 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp315076wrs; Wed, 19 Oct 2022 06:05:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6PwPYzSXpksD5AgiShUWjfrzhd243wWxVs/KWWlg3tfNaPM8DwwlnfoA/Fh4pv11VzrTai X-Received: by 2002:a05:6a00:88f:b0:558:8186:3ec3 with SMTP id q15-20020a056a00088f00b0055881863ec3mr8250197pfj.83.1666184719015; Wed, 19 Oct 2022 06:05:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666184719; cv=none; d=google.com; s=arc-20160816; b=exvbhU+XDX+LZ26mI8C0u+8Vbu/rpC7OXMyPOvnOGRWB7Drge9yIeTGn+EzMb1kgLo wCeWAqJXIfWEmP+GlaCbIUcAhFfbx08tLwTUvCrrxoRzjmWE6+9zGpRf2OSzIh+jgbwk 3kSCseJwwpySfEBseN0/Fr4SUCrFcOGPIRSclDPvnaEibfjN20Bl7aCze0K0TpXAtuv4 vZ9vpjiYXYikPrPyFfvPznINk/3cGS7VjZBSFwCTVy8YP7n7iSpMf2cIe9VoJWaXNBle 6C7lk8Y8NP+X8UbW5Su8bPmXpo4zB/yI9rFbR5oDqZnCdaK4A/rWUR+QrDjLmhLR+Tgn 07KA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=C1he/iDNL/Hn+r5qMhAYowMT2AGKgB7+8iE8e3VDB+0=; b=oxtYLotbg6+EXpq0u7Qc3UQnE2XnylQGYLxjPssnrvtylfYTZKbqU5wHkajwq8PtuT ymNCEkqENuYFrI+Iu2X/LE47A9Wj1dVi3MMbXvKdHVYiv5OiGlwF7jr8WsZrycF4Ax3r ggwU2V2R7ZCOGjYijR/EoXAvnpxhbcsp15Esc7qKvPhbVy+PlsZYQNEDefMUa20khI0F FGB9S6n3zxFhPCJzXB9aGbBrvAffLkztNfTxI0ajUsuOmvpTv7YnfhWpDLQvqL5vh+/r gHQjSgtRUicQE0vzhjIV3KjzaLwrh/QgzW1GoDBOIOKCWUNAWbrUkWr0fHiorB6ytXqG Mh9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fB0Aj54D; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s140-20020a632c92000000b0042b5035d717si19070417pgs.44.2022.10.19.06.04.41; Wed, 19 Oct 2022 06:05: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=fB0Aj54D; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230467AbiJSM4l (ORCPT + 99 others); Wed, 19 Oct 2022 08:56:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232233AbiJSM4N (ORCPT ); Wed, 19 Oct 2022 08:56:13 -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 1328019012; Wed, 19 Oct 2022 05:39: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 0AEB7617E7; Wed, 19 Oct 2022 08:57:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E7EAC433D7; Wed, 19 Oct 2022 08:57:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169866; bh=rudtTfZlwgBE07+jDbwNDqaJOfzIvla8xFjDraZ2q+Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fB0Aj54D3jouhrm0c1nXzZFVR+9TI/4WiE3Uv1i2tBeH87FFnw8HD0jIuqbpJKqcc gWNpcu96av3mTEG3nkcGDlD1MLkuv/FxYKe7hcjIzFivooHIvT5j+qYPufFwRWRJQ8 U/3U1HPVieUNNG0zZvMvlQWxp77WzaLq9ayuq3zU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Bryan ODonoghue , Bjorn Andersson , Bhupesh Sharma , Sasha Levin Subject: [PATCH 6.0 438/862] arm64: dts: qcom: sc8280xp-pmics: Remove reg entry & use correct node name for pmc8280c_lpg node Date: Wed, 19 Oct 2022 10:28:45 +0200 Message-Id: <20221019083309.338035619@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747121308119264653?= X-GMAIL-MSGID: =?utf-8?q?1747121308119264653?= From: Bhupesh Sharma [ Upstream commit 7dac7991408f77b0b33ee5e6b729baa683889277 ] Commit eeca7d46217c ("arm64: dts: qcom: pm8350c: Drop PWM reg declaration") dropped PWM reg declaration for pm8350c pwm(s), but there is a leftover 'reg' entry inside the lpg/pwm node in sc8280xp dts file. Remove the same. While at it, also remove the unused unit address in the node label. Also, since dt-bindings expect LPG/PWM node name to be "pwm", use correct node name as well, to fix the following error reported by 'make dtbs_check': 'lpg' does not match any of the regexes Fixes: eeca7d46217c ("arm64: dts: qcom: pm8350c: Drop PWM reg declaration") Cc: Krzysztof Kozlowski Cc: Bryan O'Donoghue Cc: Bjorn Andersson Signed-off-by: Bhupesh Sharma Reviewed-by: Bryan O'Donoghue Reviewed-by: Krzysztof Kozlowski Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220905070240.1634997-1-bhupesh.sharma@linaro.org Signed-off-by: Sasha Levin --- arch/arm64/boot/dts/qcom/sc8280xp-pmics.dtsi | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/sc8280xp-pmics.dtsi b/arch/arm64/boot/dts/qcom/sc8280xp-pmics.dtsi index ae90b97aecb8..24836b6b9bbc 100644 --- a/arch/arm64/boot/dts/qcom/sc8280xp-pmics.dtsi +++ b/arch/arm64/boot/dts/qcom/sc8280xp-pmics.dtsi @@ -60,9 +60,8 @@ #interrupt-cells = <2>; }; - pmc8280c_lpg: lpg@e800 { + pmc8280c_lpg: pwm { compatible = "qcom,pm8350c-pwm"; - reg = <0xe800>; #address-cells = <1>; #size-cells = <0>; From patchwork Wed Oct 19 08:28:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4733 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214222wrs; Wed, 19 Oct 2022 02:12:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5nkxA/yIRxFr9jGAXvr5ux1D6dbtVukaX9xV7IBFEGf+eiYSP//DCsMmx0EwmM08h/bRfZ X-Received: by 2002:a05:6402:1205:b0:458:c1b2:e428 with SMTP id c5-20020a056402120500b00458c1b2e428mr6418923edw.94.1666170731725; Wed, 19 Oct 2022 02:12:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170731; cv=none; d=google.com; s=arc-20160816; b=sFJI2yPlTbjFR//P36G/DV0r9WVlcdp3w/kPB43BueIb6t8QFf5KWdF/osk6kRhJed PU/nXhV5bwBXVqswGwQI49s/ouKacVP3us4yNpyr0GwU7c9A6Ap/xMlM/x4dBbAy4GJK Tj/iEQhpcghEL3F37MepnohCAvTHPjdo/gVm6BA35Jte3iQk3rDev7IzI37Upme/NZ33 lendMdB8KB4gNtJbf84eAg6Ofr1j7nrlVyLuFc68Fquj5UaX1S+545JXFc6Jz+BPu1lT CW8ZLpTNRZCQhTD1bCCHczDqE0eDfXoaz7wZcZjpTaUbQfqAV2zBCHjN4okNo07a5hp3 P1Kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pkrMs2rdLhuQgKq4b+2NrXu9jWtiCntCVFsB62B/Fvs=; b=QKT2G7OQHpyCFXa3Up8km9APcJOxsXhjIYRBWz4O1WjLbkeRHQvlH6JnrBBgkDYDiy 9dfdiKF1TXh9mo9CIBZoqIEk97RfElHMifNgI4RSbZ0fHq6PqRzIyTc7pqfBIwcD9dfV c4vt/oOsQOjsQo6O8PyViD5GMhf4uG4v9r5FjRkGXz07cdNbENLPetJkUP4xKEGKkReV vKWrM+9QmqLvmKUhZ+NPVXtxkoe1rgwpNrzJRFpGLpf6mRdBRn8B6FwPf7jqrIgIscNu vwEVIA9uYDxFZAAQt6BpPQ/ZtBHzOpzUnKWz2bjUAzGSuqz0nGRrlAR6TjW/D/uHRT2T +lWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UNaXIP+C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qk30-20020a1709077f9e00b0077a19529760si14128331ejc.65.2022.10.19.02.11.47; Wed, 19 Oct 2022 02:12: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=UNaXIP+C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232713AbiJSJJC (ORCPT + 99 others); Wed, 19 Oct 2022 05:09:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232458AbiJSJGS (ORCPT ); Wed, 19 Oct 2022 05:06: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 1562119C0B; Wed, 19 Oct 2022 01:59:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2D125617F7; Wed, 19 Oct 2022 08:57:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17D0EC433C1; Wed, 19 Oct 2022 08:57:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169871; bh=3i1Ed3bk0XkELjKa8ysuyW1Wad/0dMDZaLkwWHH547Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UNaXIP+CiqqI/k8s2stZ9GFmjYaFVF2xfUbUs7Z2jtS6H8tGMVBaYUgQO85RoyuW6 M3+mrq59Rs4D00+/rLOLZyV9v1FFTGRhq2NWGBrq5uwgG72SHocSE8at7L7jnq+H4m qDaXB6htg2JuwseSBUKuhWHVUga8DKAKu1Nj/q3g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Randy Dunlap , Dan Williams , Ben Widawsky , Jonathan Cameron , linux-ia64@vger.kernel.org, Arnd Bergmann , Keith Mannthey , Andrew Morton , Sasha Levin Subject: [PATCH 6.0 439/862] ia64: export memory_add_physaddr_to_nid to fix cxl build error Date: Wed, 19 Oct 2022 10:28:46 +0200 Message-Id: <20221019083309.387354722@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106641156646884?= X-GMAIL-MSGID: =?utf-8?q?1747106641156646884?= From: Randy Dunlap [ Upstream commit 97c318bfbe84efded246e80428054f300042f110 ] cxl_pmem.ko uses memory_add_physaddr_to_nid() but ia64 does not export it, so this causes a build error: ERROR: modpost: "memory_add_physaddr_to_nid" [drivers/cxl/cxl_pmem.ko] undefined! Fix this by exporting that function. Fixes: 8c2676a5870a ("hot-add-mem x86_64: memory_add_physaddr_to_nid node fixup") Reported-by: kernel test robot Signed-off-by: Randy Dunlap Cc: Dan Williams Cc: Ben Widawsky Cc: Jonathan Cameron Cc: linux-ia64@vger.kernel.org Cc: Arnd Bergmann Cc: Keith Mannthey Cc: Andrew Morton Signed-off-by: Arnd Bergmann Signed-off-by: Sasha Levin --- arch/ia64/mm/numa.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/ia64/mm/numa.c b/arch/ia64/mm/numa.c index d6579ec3ea32..4c7b1f50e3b7 100644 --- a/arch/ia64/mm/numa.c +++ b/arch/ia64/mm/numa.c @@ -75,5 +75,6 @@ int memory_add_physaddr_to_nid(u64 addr) return 0; return nid; } +EXPORT_SYMBOL(memory_add_physaddr_to_nid); #endif #endif From patchwork Wed Oct 19 08:28:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5488 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp334320wrs; Wed, 19 Oct 2022 06:42:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Vb+XO8R/pw7WLC3QDgnrsuneETc5sWZHLj9T1xHt2J/ull8+CWmCA/CanFrsKZu23QkNk X-Received: by 2002:a05:6402:2706:b0:45d:aaae:e74a with SMTP id y6-20020a056402270600b0045daaaee74amr7409259edd.72.1666186957245; Wed, 19 Oct 2022 06:42:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666186957; cv=none; d=google.com; s=arc-20160816; b=BNdw9+wemJulH187Mv8EbM578BEtWs/IKxhdIbzf+kCyFNGc4Nf4j/Ksjd5ySS+pSj MgTUJUcwsCURR/TbLJcppzQzpxf9iUaMJ9pqK1pCuMWvyre46fe3FKedjC6J9o+oioYy qxQodHAUf9C11de+azDuUMuQ8llChunLs4gfqQl4wTTwVZW4+qkZdvbd0585AaKoP01C hbS4D9Hf7mIWiYVjT/d1i/hw9ARc1p5HVtWnbrE0ocqAAXlLTT/QrqA6j9ti/PIuAYUk /weFUqjEuPhOcFc0cayVeJErPBILVFNUU0u2qlXo6wWok0xhl4YNztUE8LLBNdL14Xhp ixrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hYhIrFFcbaKDJmThwUI6R8lYfuwlt3k4N7ZDn0W/45M=; b=hCkz9Py5jNO6KBVexM25knmkgA7K4URJVPoito0fXM4SNwjDnsO7wP1862ShYbvp4a pS0LfWeAadJ/iiCy6QWYL19RmTlFcyJm2J+ecgwvuIFoa0jSuTqZ2rBVSh18N/PuM00g lwnHj6TioaAEBjI/nMjjwgYMD5uGy5EKYRQ8HkfnYuAEHcHvCaS6Y+/gb6IqgCKR7RcA w7Ow+3fExBFfDLvJOLtXGuMLurOUrHKXw41Qbc3qclY9V3CIHQcrvsK/0C4bnTF2TNTS rSmnEKgiqbBuENuAztX2EJxc7z/3CvAj7DZDwacgi6r2ROA4sQ5/Oc1fmnk9q5xpFjB9 VrKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="BMb/ERtv"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id vj23-20020a170907131700b0078789399a48si10674437ejb.870.2022.10.19.06.42.11; Wed, 19 Oct 2022 06:42: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="BMb/ERtv"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231802AbiJSNjT (ORCPT + 99 others); Wed, 19 Oct 2022 09:39:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232692AbiJSNip (ORCPT ); Wed, 19 Oct 2022 09:38:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8087B1CBAB7; Wed, 19 Oct 2022 06:26: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 7BE38B82434; Wed, 19 Oct 2022 08:57:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA78BC433C1; Wed, 19 Oct 2022 08:57:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169874; bh=J1MCvCXOtGGb8z1wLkUoQIgFojNwqWNgKhhvWtfryGs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BMb/ERtvdR7071bxtmagZoyjexHEZeosvYKe9Wxq3LNGxEEB31xWE5BS8+A8nIGHK nc+tJAaqHIaixKwAl83FtpvHda5q6z2OxJiHnIxMbYrSMN55jxjim7Kw8kjpvNYMv1 YKaF2wR91fuW7u6WNJ9lxSNzrQk6C9d6Tj3C3i4w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Bjorn Andersson , Sasha Levin Subject: [PATCH 6.0 440/862] arm64: dts: qcom: sm8350-sagami: correct TS pin property Date: Wed, 19 Oct 2022 10:28:47 +0200 Message-Id: <20221019083309.431805724@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123654916127339?= X-GMAIL-MSGID: =?utf-8?q?1747123654916127339?= From: Krzysztof Kozlowski [ Upstream commit c9c53d1f4329564f98ed0decfe3c377c6639ec5d ] The pin configuration is selected with "pins", not "pin" property. Fixes: 1209e9246632 ("arm64: dts: qcom: sm8350-sagami: Enable and populate I2C/SPI nodes") Signed-off-by: Krzysztof Kozlowski Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220912061746.6311-37-krzysztof.kozlowski@linaro.org Signed-off-by: Sasha Levin --- arch/arm64/boot/dts/qcom/sm8350-sony-xperia-sagami.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/qcom/sm8350-sony-xperia-sagami.dtsi b/arch/arm64/boot/dts/qcom/sm8350-sony-xperia-sagami.dtsi index cb9bbd234b7b..b702ab1605bb 100644 --- a/arch/arm64/boot/dts/qcom/sm8350-sony-xperia-sagami.dtsi +++ b/arch/arm64/boot/dts/qcom/sm8350-sony-xperia-sagami.dtsi @@ -223,7 +223,7 @@ gpio-reserved-ranges = <44 4>; ts_int_default: ts-int-default { - pin = "gpio23"; + pins = "gpio23"; function = "gpio"; drive-strength = <2>; bias-disable; From patchwork Wed Oct 19 08:28:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5522 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp337162wrs; Wed, 19 Oct 2022 06:48:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM52Mx+95WTg55XjGfD0dBsgWkBCvXF0uxh2xI45EndGKODISeF5Saaut8eBlK0niTm6Po3y X-Received: by 2002:a05:6a00:1410:b0:528:5a5a:d846 with SMTP id l16-20020a056a00141000b005285a5ad846mr8867983pfu.9.1666187318406; Wed, 19 Oct 2022 06:48:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666187318; cv=none; d=google.com; s=arc-20160816; b=bjXSYXF+rwfVTIOwh7xykZfHrP9xROO4B7130tWbsTh7CRGNT1CxrN1qjygNuUoTaN Ddj0aACOx9LBl2Rp/zhskUwGQMyNVcUiVwvra1TrbohW8ASTmQBtc/2WIj6tJUaHWBb7 Gn6NFeXYbHHkgPSsok1Ate79Pxv2Q40ne6gNo/Q89Q5HoSET/ukqJuHQ2fHfXF7FxHCD DO8R3jfRgxfszFIWgEVnxbplrwL2rJun87ceh3BCZl3o+jjBl2tZVv30oF4admUWi3WU 6M/YVANM1GLbS7QdFfxyx4D15kPx6ngU03ehder0JJwI0SlIYvcM2/MWQMsYBgF4JRgq vrCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ghhPgWhpB5qzyNp92A5X2vZG2E23PEABcHj3qWxEJ0M=; b=ahZbDe+ioCR90SU48aK7kpj09A4hKJn5kY2IwOpDrgzJIKZjohOrgfuGcMN+MzHXcz AY2lCqM7TYEsIAkcskiX4p5HDIuiPK05r2aPGD/bKjzF99b2/h62JvlcnlasLXRlgLfz 0fvZPkRO8fLHvqRxUWp0/i6dnde9Z5eGp0ymAmxB3CB8Kw8OaWngrDQZXJ0ZGBrTNRBI 6PACgSKx6Rylby17m1DhGPbsGgKMoAx4BnIVlKrf0xqrYBIkRGuHJjSQC+Rcf4If03As 7jwG43qW8Dynht73/76pWivY3nBazzlWn2QLyF5ySwZwa59Vehxiivbz9+trrj4d81yX 7Z/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DtxdAufg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b1-20020a170903228100b00176a0d8780csi22807774plh.285.2022.10.19.06.48.25; Wed, 19 Oct 2022 06: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=DtxdAufg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233591AbiJSNsK (ORCPT + 99 others); Wed, 19 Oct 2022 09:48:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233095AbiJSNqp (ORCPT ); Wed, 19 Oct 2022 09:46:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08CECDDE; Wed, 19 Oct 2022 06:32: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 02F59B82437; Wed, 19 Oct 2022 08:57:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62CE1C433C1; Wed, 19 Oct 2022 08:57:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169876; bh=pW7ZV2htvWXgiyX1QUvqOjs93tLozdPizpyCV7uPREA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DtxdAufgr86HGQERGGCMVFZB7gN/FvrkQ2YoGVGrUGovQKLjoMznn2eLnflyCNwjt xAjYKcGtcSui0nQw+NK0Xe5Hl58Qb7MCfk+hM7vJocO1Qle7lYOZLNX24Z0PeBI3Uu u+Q09MWYxjyadqzEcAT8PDWo2GaWBNqMKskb6SRs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Thierry Reding , Sasha Levin Subject: [PATCH 6.0 441/862] soc/tegra: fuse: Add missing of_node_put() in tegra_init_fuse() Date: Wed, 19 Oct 2022 10:28:48 +0200 Message-Id: <20221019083309.480396516@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747124033817829963?= X-GMAIL-MSGID: =?utf-8?q?1747124033817829963?= From: Liang He [ Upstream commit e941712cccab8a96f03b5d3274159c1ed338efee ] In this function, of_find_matching_node() will return a node pointer with refcount incremented. We should use of_node_put() when the "np" pointer is not used anymore. Signed-off-by: Liang He Signed-off-by: Thierry Reding Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/soc/tegra/fuse/fuse-tegra.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/soc/tegra/fuse/fuse-tegra.c +++ b/drivers/soc/tegra/fuse/fuse-tegra.c @@ -568,6 +568,7 @@ static int __init tegra_init_fuse(void) np = of_find_matching_node(NULL, car_match); if (np) { void __iomem *base = of_iomap(np, 0); + of_node_put(np); if (base) { tegra_enable_fuse_clk(base); iounmap(base); From patchwork Wed Oct 19 08:28:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4734 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214232wrs; Wed, 19 Oct 2022 02:12:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7uE5lBfE7xWdUPTezN3eZ7woQZFlKOBsYKw5neaa1oPCYQWcD5oBDUwpdHfa6k1Eub7kYu X-Received: by 2002:a17:907:a073:b0:78d:9e06:8ba9 with SMTP id ia19-20020a170907a07300b0078d9e068ba9mr5869152ejc.338.1666170733749; Wed, 19 Oct 2022 02:12:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170733; cv=none; d=google.com; s=arc-20160816; b=Pf6tJ+q6fPrh5HLXweqTQG4o9H6iiMdNz0PZ+5hKMkcpwTpiTIv/VWrSIuH2PzsfyL 7v2xnfvO5x08+nUrkR+o5lRDUXXIpCSrm0VpwhRN/BIOZvk9lSJEOgsWMaulyG+YM7Zm qy3posBnjJQQKoKIqlQsA8uhsHec/VYsLJ1ccqMz+muN6qXzhY3CZVT0g9jQlZSsrQT1 fbwHw+2rI3N80zqXR3oGT+z/+fJpD0sCvhQZS8DCXdHC2MbcYneGrCPY8Z92UWRJ0Y57 azUHvXcayD9I+OOINt1uoZzg8xi+vgpKYxvCnI69h8sOdqY0u+PdRbLZ2/GhhpcKnAMG ShwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=cZ7RgpCuSZ5qwstItwTGUw/LkawfrvTGgQvyyWQhkjU=; b=GsO8gIVfIcyGFWyZQHDb0xWiPqUPtqAOnUBgy4W+i0LWmyQe4QRg5hHK2FnPog30f/ cy4saiUyvycQsxmS6yNNZl1GWIW745hIE3IxI9juLy+D6bTrHHozGx/Ax6S9sqKKjkr0 Q48xktHNM1qBxaBoR/h4DoAWn3Q4s/FIHvNrieMwesmLADyI5J+Co9c51stHaR1bs8RY tgnqRkYYnP2hFr6aEYkZt5k4dVVts8I38Q5FKM1Pp+dbekt9tF3A0ZjRj0cDaEgW6np0 cZb2VvAdGossAXPHpfb5rs3Wy/5UgGHWiir5icR7j3PH4ylJL+IXVlj6YGNtg+yuxILq am7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0cbDMOqP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n29-20020a50935d000000b0045725a5b76csi12717232eda.294.2022.10.19.02.11.49; Wed, 19 Oct 2022 02:12:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0cbDMOqP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232727AbiJSJJI (ORCPT + 99 others); Wed, 19 Oct 2022 05:09:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232371AbiJSJGT (ORCPT ); Wed, 19 Oct 2022 05:06:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A2151A83B; Wed, 19 Oct 2022 01:59: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 F1C7A61805; Wed, 19 Oct 2022 08:57:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 111A5C433D6; Wed, 19 Oct 2022 08:57:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169879; bh=L07KiKZDECLETthVLMJmTtvE8NKrJZSQVDnbc0zkDzs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0cbDMOqPgCHC1iuyPukpsTRgWbxRGlvRNUgc+c2nhaiTeXuybPInkvMRCENeFeUmG anKnDDPBHUftexIfS8qjVZ5v84oAYwFTGwDMpiKKdWd7rtfBmOf+AJF4ZGocB35kIl solkwI4s4Xb5XwZ1+bfyh8eKlmoJI5OJZ7JwHwYU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Necip Fazil Yildiran , Dmitry Osipenko , Sasha Levin Subject: [PATCH 6.0 442/862] soc/tegra: fuse: Drop Kconfig dependency on TEGRA20_APB_DMA Date: Wed, 19 Oct 2022 10:28:49 +0200 Message-Id: <20221019083309.526792843@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106643164466170?= X-GMAIL-MSGID: =?utf-8?q?1747106643164466170?= From: Dmitry Osipenko [ Upstream commit 2254182807fc09ba9dec9a42ef239e373796f1b2 ] The DMA subsystem could be entirely disabled in Kconfig and then the TEGRA20_APB_DMA option isn't available too. Hence kernel configuration fails if DMADEVICES Kconfig option is disabled due to the unsatisfiable dependency. The FUSE driver isn't a critical driver and currently it only provides NVMEM interface to userspace which isn't known to be widely used, and thus, it's fine if FUSE driver fails to load. Let's remove the erroneous Kconfig dependency and let the FUSE driver to fail the probing if DMA is unavailable. Fixes: 19d41e5e9c68 ("soc/tegra: fuse: Add APB DMA dependency for Tegra20") Reported-by: Necip Fazil Yildiran Link: https://bugzilla.kernel.org/show_bug.cgi?id=209301 Signed-off-by: Dmitry Osipenko Signed-off-by: Sasha Levin --- drivers/soc/tegra/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/soc/tegra/Kconfig b/drivers/soc/tegra/Kconfig index 5725c8ef0406..6f601227da3c 100644 --- a/drivers/soc/tegra/Kconfig +++ b/drivers/soc/tegra/Kconfig @@ -136,7 +136,6 @@ config SOC_TEGRA_FUSE def_bool y depends on ARCH_TEGRA select SOC_BUS - select TEGRA20_APB_DMA if ARCH_TEGRA_2x_SOC config SOC_TEGRA_FLOWCTRL bool From patchwork Wed Oct 19 08:28:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4737 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214272wrs; Wed, 19 Oct 2022 02:12:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ELl6RUeLqZQSi7lIRr/jJ0U9ACawp/bavJYuKLceymG/0Umym9pQ3hwAWO8J2Fnb21GQI X-Received: by 2002:a17:906:5dac:b0:78d:fa65:a4a9 with SMTP id n12-20020a1709065dac00b0078dfa65a4a9mr5689141ejv.223.1666170741646; Wed, 19 Oct 2022 02:12:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170741; cv=none; d=google.com; s=arc-20160816; b=zRWYeauJj0A6fRnUy+WhX/Zs96x49FXC/CfbZ0h9OICY7ld0GbPq+dEhzE9XC3bBo9 SpbjdSd5jjM5s6k2p/EmfSsQkZQ2bKF6DY8+Ik2+EZkcZ5zZ1+Rvy/T1njtPkyy1gAXw VxT+EFykyzVySHCl9GT0I+FTQJc0LhMVP7OK7TIoK6sgqKwUv/upvMJSpkqLC3HSKlIZ iugNZNTxNinbn9W67ZVKN3PlnMzU2sstJHF22LR2IFxdgHmBL3T71NWzys7eOzq041TA in/yhMwCU5mcSkDoaL0Mmam/Ft09Vq+VKfJdfd/+yvhKXWDia6iBp+5ChqizKJdXdU5R cTrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ld017ytwPgSVyBJW4GieYbUWUNIBl0LMaYT59psDgjI=; b=DyAQqdQCHc+eilz1Ov93ISuZqIH+KTztgEfFWDaiYtZlR1AdEEZ+Bsf+sgfwnzh/Qg 8ZO5pMj5tqxjlgvSmNWGR+YBS48pbcPU0+HuwfJqc/dvwmrjTVD1h5E3PdngavWq1J+z QF29YtIKorRmwGXfCNXrXmV1TH0F9D/pKdpHRSQefFNueNYbBeFA0ykDFzH9o7vv+d4/ 6VE738x8HGzBcd44NL9mVl6CdjzDBDQqtOAS/9ME5IExzeOsicgilgWcKLgIdUJh8S7h Cfkn1A6B9zbUaGJnWqN7ZpWimwlYKih1H5UyyBf4BZyyjPa2LLZCpNV733eRFNgHxxm+ oKaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Hxzj7kUL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b16-20020a1709063f9000b0078d44c5da0esi12173834ejj.667.2022.10.19.02.11.56; Wed, 19 Oct 2022 02:12:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Hxzj7kUL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232788AbiJSJJT (ORCPT + 99 others); Wed, 19 Oct 2022 05:09:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232502AbiJSJGn (ORCPT ); Wed, 19 Oct 2022 05:06: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 27D171F9F7; Wed, 19 Oct 2022 01:59: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 AF970617E2; Wed, 19 Oct 2022 08:58:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C2AB9C433D6; Wed, 19 Oct 2022 08:58:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169882; bh=JUHCKRw/LOwcFZAH2fX78Tz8qm9qTdilt9DPlDz6z38=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hxzj7kUL+fhc9HzeMhrKXAvPythYYD32lHB3G7zqFHz/wcv0mJAR+UkuIzBdG4rpq i/kAsc18K6xU0fhI7sm2JUwEitg6EXNmKCgdyYDgK4hM/3xHqc6Ww5nsbQAaEsuBak qVEnRc6NnOA86qyt3ZQzMC++lbwnDkW2e6K6qGpg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Bjorn Andersson , Sasha Levin Subject: [PATCH 6.0 443/862] arm64: dts: qcom: ipq8074: fix PCIe PHY serdes size Date: Wed, 19 Oct 2022 10:28:50 +0200 Message-Id: <20221019083309.565373422@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106651484502458?= X-GMAIL-MSGID: =?utf-8?q?1747106651484502458?= From: Johan Hovold [ Upstream commit ed22cc93abae68f9d3fc4957c20a1d902cf28882 ] The size of the PCIe PHY serdes register region is 0x1c4 and the corresponding 'reg' property should specifically not include the adjacent regions that are defined in the child node (e.g. tx and rx). Fixes: 33057e1672fe ("ARM: dts: ipq8074: Add pcie nodes") Signed-off-by: Johan Hovold Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220915143431.19842-1-johan+linaro@kernel.org Signed-off-by: Sasha Levin --- arch/arm64/boot/dts/qcom/ipq8074.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/ipq8074.dtsi b/arch/arm64/boot/dts/qcom/ipq8074.dtsi index d53675fc1595..b9bf43215ada 100644 --- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi +++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi @@ -199,7 +199,7 @@ pcie_qmp0: phy@86000 { compatible = "qcom,ipq8074-qmp-pcie-phy"; - reg = <0x00086000 0x1000>; + reg = <0x00086000 0x1c4>; #address-cells = <1>; #size-cells = <1>; ranges; @@ -227,7 +227,7 @@ pcie_qmp1: phy@8e000 { compatible = "qcom,ipq8074-qmp-pcie-phy"; - reg = <0x0008e000 0x1000>; + reg = <0x0008e000 0x1c4>; #address-cells = <1>; #size-cells = <1>; ranges; From patchwork Wed Oct 19 08:28:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4743 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214449wrs; Wed, 19 Oct 2022 02:12:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5t1f8qBgvXLQkn0Ve7lGe8n2qLhwQVJRIZzbMMoxmp/8Qgn6wm5UnwRdoicLET/kYDpPyl X-Received: by 2002:a17:906:db02:b0:780:24e:cf9 with SMTP id xj2-20020a170906db0200b00780024e0cf9mr5853434ejb.460.1666170769488; Wed, 19 Oct 2022 02:12:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170769; cv=none; d=google.com; s=arc-20160816; b=lT7wgCg2dA+OnCDXXPGxYd7g48WWGqEM/MKtU+Ge5qgvhP1bpbNf+5OQ71jAIHnjHY Nzt6AMUTsZJcdt1oe1QxmPAx8uCdy44PaHM1sMXrN67jjmGZHi+36mjIU0PQOtM8F+HY jUzVHAfrb04qJOkBkvunI5jAsDfyfET4acmLubRyzS5tcNzMcJEmT3Zuae4wJJjsJbS2 RY4VllSEMGQpAEgsosFFmTMtQ8b95MpgyNHiw1gN+SJGiUVJA79kLk+hff8AJ85Lmd32 v2iu5qFLlo6uxgjyXRX/bFJnBRqsZjb9HU7ZMufpUHYzLMlsRHk1vdJ7GAkeZsevdufs sP+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=1P3Ehh8IOhmdS9vxfwPMNt/HOCwUiXRc8W+ZNELWlWs=; b=Q/F4JpuTi9WKby+qA1msxRDovIED00HWotSpGmmHHqM0tC1Vn8jgcqG8c7p5Mpr7hB Nr1iVw1r7ar4eMKwtYGinrWimtnwQmjOmGWceE3yNJnOyBHnMu4V2OtOQ+7VyGiiYS5R 2RefWbbU2J31GW7OxTWrIF2Vm1pSKMUKHkIN4Tl2Ad+B7sAQ+3LdGsiCOll17c47nS+X Be4sfUNXx6A4oqd1ZyxbKnRDzQGEVamPjjX4PC2IS+C3d8A2NAMY/7Dj5n/a0FLA+hwF UUEvji/T3vgkYZkW74WsJW4Qtuzs9FsAOhKF4MSWOo72GZJa/aQYLmMrSV68xzyxfL/F krUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=igVAhM8+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h10-20020a056402280a00b00453bc1fda81si13680223ede.556.2022.10.19.02.12.24; Wed, 19 Oct 2022 02:12: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=igVAhM8+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232818AbiJSJJW (ORCPT + 99 others); Wed, 19 Oct 2022 05:09:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232514AbiJSJGr (ORCPT ); Wed, 19 Oct 2022 05:06: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 0A84C2F645; Wed, 19 Oct 2022 01:59: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 6274E617D1; Wed, 19 Oct 2022 08:58:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 740D1C433D6; Wed, 19 Oct 2022 08:58:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169884; bh=Tm2qu+N8WFURkvMJXaa0/13FmECmvYAehdJnJvvGuSw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=igVAhM8+l99eORsUqF+BoPK+EWO8F1gd8S8usUujMpMW7PKOWnmwzjURban0pFXEf FnKtUmmLfdC/vPIYguIVg7uUhwj17bJtt+HpaLvQmwgKg5xdQMsQ2gI0CrNmNEXGtF iWEHTknjYh2uHZSxD22wEX117U96nX8yktpKXqnc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Bjorn Andersson , Sasha Levin Subject: [PATCH 6.0 444/862] arm64: dts: qcom: sm8450: fix UFS PHY serdes size Date: Wed, 19 Oct 2022 10:28:51 +0200 Message-Id: <20221019083309.603059518@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106681163498748?= X-GMAIL-MSGID: =?utf-8?q?1747106681163498748?= From: Johan Hovold [ Upstream commit 677920072e9d757ae158d66b8fdb695992bb3f1a ] The size of the UFS PHY serdes register region is 0x1c4 and the corresponding 'reg' property should specifically not include the adjacent regions that are defined in the child node (e.g. tx and rx). Fixes: 07fa917a335e ("arm64: dts: qcom: sm8450: add ufs nodes") Signed-off-by: Johan Hovold Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220915143431.19842-2-johan+linaro@kernel.org Signed-off-by: Sasha Levin --- arch/arm64/boot/dts/qcom/sm8450.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/qcom/sm8450.dtsi b/arch/arm64/boot/dts/qcom/sm8450.dtsi index 4978c5ba5dd0..8a6c0f3e7bb7 100644 --- a/arch/arm64/boot/dts/qcom/sm8450.dtsi +++ b/arch/arm64/boot/dts/qcom/sm8450.dtsi @@ -3117,7 +3117,7 @@ ufs_mem_phy: phy@1d87000 { compatible = "qcom,sm8450-qmp-ufs-phy"; - reg = <0 0x01d87000 0 0xe10>; + reg = <0 0x01d87000 0 0x1c4>; #address-cells = <2>; #size-cells = <2>; ranges; From patchwork Wed Oct 19 08:28:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4754 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214677wrs; Wed, 19 Oct 2022 02:13:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6aNx6ojy+zQlVascgJXx0mfQ4iKQV6Cb2XL5JqXONbCtQmUHDCOHdCLOqtCpNPXMQSiAdE X-Received: by 2002:a17:907:2bef:b0:78d:8b6c:a20b with SMTP id gv47-20020a1709072bef00b0078d8b6ca20bmr6005733ejc.674.1666170809615; Wed, 19 Oct 2022 02:13:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170809; cv=none; d=google.com; s=arc-20160816; b=oMdpzYlfwxw38U2PJU3YRlAzKyJIhJeoRs1i09+udjbdTnNO279qp17k7FCA4BNScx ysdm3oeqlndLA66rbxEdAe220E6dtt1WtYHJRp6YYAvo3+X+7J/I9dYeEod3VXZUD1uG jtqCsS4PLBOkl7/lB66TKInb4mityDS/ktpPqX4jlC4bhwO4E+nfMPLeYpyDLZIlsxuB 6/k0MAtFTrm6JcPE1xbETJMd+rznff7ZEKXeJoOvHzR+7sZMMiE6bTNBrr4TGOkmN/jI zVtsyOOyvDMT+Jq1PCfbi3GUrn/XCbnEpKi6GLegagfWU608OJlgYBEEwAyi+VKwYsZo oxTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uJqiSsJwzkO5urx1UieP6vufcgUH8giwbC32mgqCAAk=; b=WfPROpJas6wcpFTxS2MuZ1Ig5EGKv0bbyVLiW+XDpZPKHCV0oFj5ix/RlUaYRezKMx B85SFqQHUWaFvFVpqNankcIGkv6TIYiTZOJFZqHg7VN361Rz7vCAallWe2V8J6muvnmI o3kbAgwHCQfdQYSp87aP8PlHmP/HRbyC7UUaFCmndMBY51YAv2mBoeeljxVuc6aZpt5R CvZL7TKi1gZE8eNpIF2ez+yAPGnRn+OnUDJfJWOS79Dl7npQUejD+E8EPkV4ItzswASH uHZI+jl31mwN608pCbSBm0Q7+JU6X0VW7A1TFZ3Aiicg+1meDwGoMKIqqy8rLLkFc49G NNjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="NSegxU5/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o18-20020a50fd92000000b004599de51c9csi11472214edt.527.2022.10.19.02.13.05; Wed, 19 Oct 2022 02:13: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="NSegxU5/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232874AbiJSJL4 (ORCPT + 99 others); Wed, 19 Oct 2022 05:11:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232812AbiJSJJV (ORCPT ); Wed, 19 Oct 2022 05:09: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 0767A726BE; Wed, 19 Oct 2022 02:00:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 995F061802; Wed, 19 Oct 2022 08:59:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A952CC433C1; Wed, 19 Oct 2022 08:59:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169996; bh=k/0uoSHWawpsg9nFOcifCvqikP2Riu3JdAP2ZeH8ki8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NSegxU5/BFp0Jxb41u4tuer+UgROAX+A3+Lv/I7UlFbe9SxpNM1vYOqUkZ/cBXYEv 7HT8JRnP90OwkCBhJW+LofacqAbljGSvXDUJAfjHCT0cyeVOBGv/rGsESheSCFetcb BNE4f9YK9I37JQENjxdvQ0lPUVP0tBa/AiAE1Ttk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Matt Ranostay , Vignesh Raghavendra , Vaishnav Achath , Sasha Levin Subject: [PATCH 6.0 445/862] arm64: dts: ti: k3-j7200: fix main pinmux range Date: Wed, 19 Oct 2022 10:28:52 +0200 Message-Id: <20221019083309.648815864@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106722991229915?= X-GMAIL-MSGID: =?utf-8?q?1747106722991229915?= From: Matt Ranostay [ Upstream commit 0d0a0b4413460383331088b2203ba09a6971bc3a ] Range size of 0x2b4 was incorrect since there isn't 173 configurable pins for muxing. Additionally there is a non-addressable region in the mapping which requires splitting into two ranges. main_pmx0 -> 67 pins main_pmx1 -> 3 pins Fixes: d361ed88455f ("arm64: dts: ti: Add support for J7200 SoC") Signed-off-by: Matt Ranostay Signed-off-by: Vignesh Raghavendra Tested-by: Vaishnav Achath Link: https://lore.kernel.org/r/20220919205723.8342-1-mranostay@ti.com Signed-off-by: Sasha Levin --- arch/arm64/boot/dts/ti/k3-j7200-common-proc-board.dts | 10 ++++++---- arch/arm64/boot/dts/ti/k3-j7200-main.dtsi | 11 ++++++++++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/arch/arm64/boot/dts/ti/k3-j7200-common-proc-board.dts b/arch/arm64/boot/dts/ti/k3-j7200-common-proc-board.dts index 121975dc8239..7e8552fd2b6a 100644 --- a/arch/arm64/boot/dts/ti/k3-j7200-common-proc-board.dts +++ b/arch/arm64/boot/dts/ti/k3-j7200-common-proc-board.dts @@ -134,15 +134,17 @@ >; }; - main_usbss0_pins_default: main-usbss0-pins-default { + vdd_sd_dv_pins_default: vdd-sd-dv-pins-default { pinctrl-single,pins = < - J721E_IOPAD(0x120, PIN_OUTPUT, 0) /* (T4) USB0_DRVVBUS */ + J721E_IOPAD(0xd0, PIN_OUTPUT, 7) /* (T5) SPI0_D1.GPIO0_55 */ >; }; +}; - vdd_sd_dv_pins_default: vdd-sd-dv-pins-default { +&main_pmx1 { + main_usbss0_pins_default: main-usbss0-pins-default { pinctrl-single,pins = < - J721E_IOPAD(0xd0, PIN_OUTPUT, 7) /* (T5) SPI0_D1.GPIO0_55 */ + J721E_IOPAD(0x04, PIN_OUTPUT, 0) /* (T4) USB0_DRVVBUS */ >; }; }; diff --git a/arch/arm64/boot/dts/ti/k3-j7200-main.dtsi b/arch/arm64/boot/dts/ti/k3-j7200-main.dtsi index 16684a2f054d..e12a53f1857f 100644 --- a/arch/arm64/boot/dts/ti/k3-j7200-main.dtsi +++ b/arch/arm64/boot/dts/ti/k3-j7200-main.dtsi @@ -295,7 +295,16 @@ main_pmx0: pinctrl@11c000 { compatible = "pinctrl-single"; /* Proxy 0 addressing */ - reg = <0x00 0x11c000 0x00 0x2b4>; + reg = <0x00 0x11c000 0x00 0x10c>; + #pinctrl-cells = <1>; + pinctrl-single,register-width = <32>; + pinctrl-single,function-mask = <0xffffffff>; + }; + + main_pmx1: pinctrl@11c11c { + compatible = "pinctrl-single"; + /* Proxy 0 addressing */ + reg = <0x00 0x11c11c 0x00 0xc>; #pinctrl-cells = <1>; pinctrl-single,register-width = <32>; pinctrl-single,function-mask = <0xffffffff>; From patchwork Wed Oct 19 08:28:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5095 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp249933wrs; Wed, 19 Oct 2022 03:47:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Y6H3M1Vgkd9YEnMFzXSsGNByM6CcprOURCsAM7eGPsTBiFnFHV3R3bgQ7hHKUUf/+sTge X-Received: by 2002:a05:6402:1e8e:b0:45c:af84:63dd with SMTP id f14-20020a0564021e8e00b0045caf8463ddmr6865849edf.190.1666176455483; Wed, 19 Oct 2022 03:47:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176455; cv=none; d=google.com; s=arc-20160816; b=eLKJaWat4eijgY3QCXQ4itCoE3lR8AtswnORU2rP/bDXthDcCFoX6tKnJFJPhwNLpz mHNOmzMQ4BzFfDxocBJINwVmaCzJYyi3owrBjIMGEu3ippNqqve/5u5r/5sbuv/GmFQP eEmUwG0qS8QWQPIL/JWvucqhx9BZDFiRpzTgZHaQ+uwMPU5woOHRtS9kXdf/Zo9K0ug/ ObKMt4a7uz3GW6rdt7QjJyRLpE5AQX+L/4pecFQeOoG2TrbqXjAHP+Odd2OhQUZdBuk7 +EcH3v2H32R5srWCSpmPyzQKZDzoSK5/MEHjuSeyyzrWFQwIcdl+E9YlYjn1KX1bKL54 9ROA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jJZfJK01600mIP04gdio50jitDwPXeKvLHZBuBPi8aY=; b=vJlNKGiEk+66hsiu+Qdb74eT+YoA/32PTjnXZ6t/9AZYN0QMfG4EN4IG3POIVrNoq3 b+m/H+dxe1WzhDCl5mQqZQvmfEYaNJOu30uqNz93bVieSilU61gLn3DgIvAMQunKuaZK N2BfH95Hf1QZz/PRf33GJoovCWuSNC7F2NdPDyeloo9yHbDWZqGbLSVukUbJsyNsTfsP Fofn/2fnMZz1d/5hcEHLtVZPl9+fuhalWaYTDlxTgDZ/TehLfS2HvKwcsvZ0frmzPNYg zkjuRvVK+zJO++ZL9Czpsc6A9qAdlPLf63IBcB+8s3fM9r8uklls1onu4Z9nUIYudOFN NEAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Sy/CDk5r"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dm21-20020a170907949500b007417e9a2c71si14309747ejc.352.2022.10.19.03.47.10; Wed, 19 Oct 2022 03: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="Sy/CDk5r"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232075AbiJSKqu (ORCPT + 99 others); Wed, 19 Oct 2022 06:46:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233335AbiJSKoj (ORCPT ); Wed, 19 Oct 2022 06:44: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 D135810C4CE; Wed, 19 Oct 2022 03:21:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D9179B82430; Wed, 19 Oct 2022 08:58:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 502CAC433C1; Wed, 19 Oct 2022 08:58:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169906; bh=kg9vWgfgfLhzwfynnPlfjczJJacU8XNUQYPZLuLW2uc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Sy/CDk5r/WiXbpW44md1m7N8UgrerGJukRgfVQS4zs44dQio+Cf3mW5g7RUynxwFb Qk/iQqnE5+rvf11VYNqKA9F5/HDg6ZK+mKOxVLMdmtpJtRPa9ivY2l3QMs9NoDDn7A CfcOrP0KQ1sazEXRvokKP5rlK3b2vK72wiHtc2/Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Torokhov , Krzysztof Kozlowski , Linus Walleij , Arnd Bergmann , Sasha Levin Subject: [PATCH 6.0 446/862] ARM: dts: exynos: correct s5k6a3 reset polarity on Midas family Date: Wed, 19 Oct 2022 10:28:53 +0200 Message-Id: <20221019083309.679779365@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112642944514228?= X-GMAIL-MSGID: =?utf-8?q?1747112642944514228?= From: Dmitry Torokhov [ Upstream commit 3ba2d4bb9592bf7a6a3fe3dbe711ecfc3d004bab ] According to s5k6a3 driver code, the reset line for the chip appears to be active low. This also matches the typical polarity of reset lines in general. Let's fix it up as having correct polarity in DTS is important when the driver will be switched over to gpiod API. Fixes: b4fec64758ab ("ARM: dts: Add camera device nodes for Exynos4412 TRATS2 board") Signed-off-by: Dmitry Torokhov Signed-off-by: Krzysztof Kozlowski Reviewed-by: Linus Walleij Link: https://lore.kernel.org/r/20220913164104.203957-1-dmitry.torokhov@gmail.com Link: https://lore.kernel.org/r/20220926104354.118578-2-krzysztof.kozlowski@linaro.org' Signed-off-by: Arnd Bergmann Signed-off-by: Sasha Levin --- arch/arm/boot/dts/exynos4412-midas.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/exynos4412-midas.dtsi b/arch/arm/boot/dts/exynos4412-midas.dtsi index b967397a46c5..8e1c19a8ad06 100644 --- a/arch/arm/boot/dts/exynos4412-midas.dtsi +++ b/arch/arm/boot/dts/exynos4412-midas.dtsi @@ -586,7 +586,7 @@ clocks = <&camera 1>; clock-names = "extclk"; samsung,camclk-out = <1>; - gpios = <&gpm1 6 GPIO_ACTIVE_HIGH>; + gpios = <&gpm1 6 GPIO_ACTIVE_LOW>; port { is_s5k6a3_ep: endpoint { From patchwork Wed Oct 19 08:28:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5082 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp249433wrs; Wed, 19 Oct 2022 03:46:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7WK4UqNMmRV6uf1++Sp++XtX1FqwLn8WN+qZup+QR+ry+zTLvpWpbd8I7HtHEiYEvLoJzR X-Received: by 2002:a63:2c8b:0:b0:41c:5f9e:a1d6 with SMTP id s133-20020a632c8b000000b0041c5f9ea1d6mr6531604pgs.601.1666176372536; Wed, 19 Oct 2022 03:46:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176372; cv=none; d=google.com; s=arc-20160816; b=nk1gYkMqVV5DkilKH1Eo6nQQgoq7IwRN6xyEcdEXeoNh9WxTYGPmpLAiUCtBfE7Nyd vi9OqNt19z6Bne/PU3BBZBlIfeP0vyIxf63R7VAb1Ka/6n4jyYGr2rXp7a4DteVF2zvU XIfJqDkZBzkFXqvePDbw9XT4xDypXyqN2Cdu4CbmUL7aIEv3s1BzkFaA34fGphb8M11z EU0RGUikMv5gn+xqUS8wn+xDMmOubm7vZw/UzX4BOmbnjMi/0h5s1vO5hqYB+iSA/8vv 1dioAEjY/8TqKr9713Hxrfmo43MlVCyZ8Seb7Ez2StFYHJxdq0V9ED1zd40HYvvS3TEI 0yCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jnEpAWdxJ9c4E9Tk4sOmtH6iY7VymqI6bZKr5pPtSsc=; b=UTNO5lEc4hWcTxgVYoy7mOB/CH8xoURFrEuA76EuTwSgg04NAhIDeC7IrZl6yznoTB leRDdNxjh4WwBcvsJnWsnoh0FWkYLHp8G1yArFtbDlN5jIVuzs2NhpVu5cI4BP2Lq0uL v3x8Vybmpv+JWrqJUXh3YSywNSHImcBYyAHZhxcGPIIJ5GRfdjubuU0Xph/WCe8yCInm rMAyizKZbntRbPK8/DT4Pr7qYBY1M6DCAQoSMTkR4Yaah9WKK/YDR8fAsGjH4FAn9zAV U688eJ+2Ba1rlMUcXUVNP9rCUvHvfjikw/evje+0N8Z2N6TNEliUv/fTrDpXybsoKT8D 63lA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2Qe9AFgH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y2-20020a1709027c8200b0017d8a86e524si16657861pll.506.2022.10.19.03.45.54; Wed, 19 Oct 2022 03:46: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=2Qe9AFgH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232738AbiJSKpf (ORCPT + 99 others); Wed, 19 Oct 2022 06:45:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232709AbiJSKoD (ORCPT ); Wed, 19 Oct 2022 06:44: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 D010D8E99B; Wed, 19 Oct 2022 03:20: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 87FDBB82421; Wed, 19 Oct 2022 08:58:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09411C433D7; Wed, 19 Oct 2022 08:58:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169935; bh=nI9/PSB8ZlgVgtKWfWyJ/67XC9L26+kGdNPFlTXnO0g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2Qe9AFgHCjzwnb4DaBeQlrVa0VJba+5gpRvScuDOkBhuw4tulr4/avHW765sIGmVE YLp1BAiw7wZWSrwfxNs8kSHu2Xw18DPp08edPqLXC3mk4V8PhoxOpTzrDxw/SrXcDt N/u0ksJGhaDEA7Sm7kIy+ji1kMl4Ow7VSgXpkkW4= 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 6.0 447/862] ARM: Drop CMDLINE_* dependency on ATAGS Date: Wed, 19 Oct 2022 10:28:54 +0200 Message-Id: <20221019083309.720138618@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112555691067848?= X-GMAIL-MSGID: =?utf-8?q?1747112555691067848?= 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 87badeae3181..11ecf09aadc8 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1671,7 +1671,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 Wed Oct 19 08:28:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4760 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214738wrs; Wed, 19 Oct 2022 02:13:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM63aLjRFIodP3qar6xBf4lr9N+ZcK07n92zna8VBVmejoX0IvbqXSIuGjlEujAERo/8H4jx X-Received: by 2002:a17:906:974f:b0:791:98b8:c7d1 with SMTP id o15-20020a170906974f00b0079198b8c7d1mr5846537ejy.559.1666170819233; Wed, 19 Oct 2022 02:13:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170819; cv=none; d=google.com; s=arc-20160816; b=Kz8p6W/zGEG+LosonOL9aGHmIdwoRfWu7xZC44Bg0d3xym9xCHVm3UbKpf021zJLKl 2CIu79GvMtBg2hK/mtBM7Kk08ig7BIu0WDN55Mq0oL58vTPU6b9O7Odtk4ZmNtLkJbE/ svsaGiFoDxTsv5/pDW2fNxLlOF+TjDobe49mKolJyKFLADIkYcPgm0YoGoDG1zsoQeO5 WrZTom/0Z1lRcj+TikkNbUWCCMT7GEeceUa/QttLH2Q0V6pWqJBAabRxtIW16/hbx2QI ZYOAzmuD3qaFNXCh91nc5YZamV2dDPu/zjhMNXtAT/5xA1Dx8U+9BYM/n4UI9iJoVtU8 fdNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=050frssq81jcYpF8xXmQu2pfNH8fWlcaxVA965g3LDE=; b=Id897IT3E3nqWvxIweCxTfhfz3BGVqr+o+k1lLad6MN9fLGdMMUytmKtFyGxbgtNJP 7YTE4QSHDLuEYybZIu6v89MBlOh9Zzv0QMp4IkW+IQ9yWIb91Npx8xB0qBnnFnN3iIDa xke0GWhRAUe0TIC5RdeMZ9ER5MtDGD9+eTY7aEtx2ghK+wHFKn9owwoKUDrX0Mp8WPIk DruvyihDdUhV9uI9/7zXyae4wKD8DhVF3EGJLKkiivn6sv/gTdNm8Zn412uAxHZVpkbz t/nWZFujklGUCXmbxYTMB13GuhlRAzKfZE7yvBX4Z3povZI8PFtO+MjYon9S/qxCOHY6 Wuvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=igIpOlMe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f30-20020a170906739e00b007829f6fed9dsi4351542ejl.232.2022.10.19.02.13.14; Wed, 19 Oct 2022 02:13: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=igIpOlMe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232805AbiJSJLW (ORCPT + 99 others); Wed, 19 Oct 2022 05:11:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232557AbiJSJIi (ORCPT ); Wed, 19 Oct 2022 05:08:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 488F02EF5E; Wed, 19 Oct 2022 02:00: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 D130661838; Wed, 19 Oct 2022 08:59:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA91AC433C1; Wed, 19 Oct 2022 08:59:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169964; bh=HJDN//PAUPr5qeuWQTD76jRmZZf65242mBt/Nyf+xQ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=igIpOlMeGRXbBSPlHCpi293vR/qkKFdrLrGgW8pH5xFGMmhWcVc2ynQlqsaqNnpDX pDYLx9jM/7mFIxLNrlPLyzhhBhRdmbyJ56IBEYXrCME++mVbJ7tQlPE/y5Ge8eLrTT wKrmZnoo44NTrE1FC6BHvK+pcCQG1YlrunLvgX/U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jerry Lee , Theodore Tso Subject: [PATCH 6.0 448/862] ext4: continue to expand file system when the target size doesnt reach Date: Wed, 19 Oct 2022 10:28:55 +0200 Message-Id: <20221019083309.767133515@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106733143252943?= X-GMAIL-MSGID: =?utf-8?q?1747106733143252943?= 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 @@ -2122,7 +2122,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 Wed Oct 19 08:28: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: 5089 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp249674wrs; Wed, 19 Oct 2022 03:46:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7uoddvCzPv75B8OkV9vq2iu3kbD4lI2TM5UxD3yAmi7t4eBYra3aHkKP+K3R9eaRXezwZa X-Received: by 2002:a17:90a:b00a:b0:203:87a3:9e70 with SMTP id x10-20020a17090ab00a00b0020387a39e70mr8937978pjq.218.1666176411744; Wed, 19 Oct 2022 03:46:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176411; cv=none; d=google.com; s=arc-20160816; b=Ybstu3d11QW7s4Iv9X87PcLo0+Jud7LdRBHitjO2LPmOc0mBQCOeRiLErJRQAMdvxE ZKtfMV0MT6boSzG9IAg4TkEF4fnk8S/eO3QUfg0EOJp85JbDaNCxGyR96JGCEBZbh+YX L//b9tEKDjcIIKLW9c321VV+hfle0F9NvbTj494PzawSO0AS6cS4GZUlrEIsa1QXDeV4 TJZX/oa6jbwoZRnLM7khIPeU6z0l4hcyi92sPenSVl8k6UsRSb2N4n7ts7WCn2Yf6B9f 9DnvCA26oQuHIY5s9VyelOHiOyRTscQWJNc292ZEXtUVmlEu8yZmxSbmDdAq5FBuBdh8 klFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9daVrU25IW2QpB6wjlBp/YRrdYCBcO5Xn22j+0flm3k=; b=TyjUF/UyXPwrn9GKlBMnpYdIz8CQbLeMbd8HNdw9FSqh5HPhQUJdJuhyypAHU4N8h8 vJuShXvu5wqTpox3zNC2oKGTdR+9KZrc+kcqqHL9fv8CitfJN6Luafmrg/H4Y3DRttgf pcOoMcpx/paoiL/pCDCs9o9yhZxJ3pzR3ajVafk6NVQWwvU4JeOJshikweN+Hecf0nwN XUNnLs5+wWta+coMomBEGmxYahKwKF1PfLDntMqUrC6W8W5B7M7Y1Sz2CxOrRpUaCS0r jiNbbe40wekSUupVhTc/xD3nSjOiJKiVWpoUKgK5b/S3VpMj7+OhEo7p3OoJQ+rFPOMR c4mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fqHoEAJ0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q197-20020a632ace000000b004276c7b2253si18666778pgq.584.2022.10.19.03.46.37; Wed, 19 Oct 2022 03:46: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=fqHoEAJ0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231328AbiJSKqO (ORCPT + 99 others); Wed, 19 Oct 2022 06:46:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233089AbiJSKo2 (ORCPT ); Wed, 19 Oct 2022 06:44: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 3CBA5FF252; Wed, 19 Oct 2022 03:21:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 880CBB8244B; Wed, 19 Oct 2022 08:59:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA4F8C433D6; Wed, 19 Oct 2022 08:59:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169980; bh=lngLkwhkCFJkeSEPKAQ6CC6D23gJ44NNGtDeFpeiMj4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fqHoEAJ0zo9zQzy9jp4RcGSe/qDMcJFKQ11wRO7Kj80fDcNX4Gf02ySR1IfWaZ6G4 /pWmegeYpbvJkHIrrIZZaX1FjsUNUc/3xFpl2C7CjieLE3x9vC/8B+mWTqDwRd0dT/ sv3+cYdSMjMINmIgaOflHnl2FA/mfOtB4gZdVLhM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Josh Triplett , Lukas Czerner , Theodore Tso , Sasha Levin Subject: [PATCH 6.0 449/862] ext4: dont run ext4lazyinit for read-only filesystems Date: Wed, 19 Oct 2022 10:28:56 +0200 Message-Id: <20221019083309.812535519@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112597545823688?= X-GMAIL-MSGID: =?utf-8?q?1747112597545823688?= From: Josh Triplett [ Upstream commit 426d15ad11419066f7042ffa8fbf1b5c21a1ecbe ] On a read-only filesystem, we won't invoke the block allocator, so we don't need to prefetch the block bitmaps. This avoids starting and running the ext4lazyinit thread at all on a system with no read-write ext4 filesystems (for instance, a container VM with read-only filesystems underneath an overlayfs). Fixes: 21175ca434c5 ("ext4: make prefetch_block_bitmaps default") Signed-off-by: Josh Triplett Reviewed-by: Lukas Czerner Link: https://lore.kernel.org/r/48b41da1498fcac3287e2e06b660680646c1c050.1659323972.git.josh@joshtriplett.org Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin --- fs/ext4/super.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 323dbcfd285c..091db733834e 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -3962,9 +3962,9 @@ int ext4_register_li_request(struct super_block *sb, goto out; } - if (test_opt(sb, NO_PREFETCH_BLOCK_BITMAPS) && - (first_not_zeroed == ngroups || sb_rdonly(sb) || - !test_opt(sb, INIT_INODE_TABLE))) + if (sb_rdonly(sb) || + (test_opt(sb, NO_PREFETCH_BLOCK_BITMAPS) && + (first_not_zeroed == ngroups || !test_opt(sb, INIT_INODE_TABLE)))) goto out; elr = ext4_li_request_new(sb, first_not_zeroed); From patchwork Wed Oct 19 08:28:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4746 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214524wrs; Wed, 19 Oct 2022 02:13:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5KpyyU4xtCydMkbVwMRh/864pD4uQcQ/ZOpQJlrMPd/ydEYgG1eD/QRdtsWxrsQ3MoUML1 X-Received: by 2002:a17:907:2c67:b0:78d:49d2:6297 with SMTP id ib7-20020a1709072c6700b0078d49d26297mr6010160ejc.21.1666170784742; Wed, 19 Oct 2022 02:13:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170784; cv=none; d=google.com; s=arc-20160816; b=lPo/ytRSeUjMePOhEzTIcRzIadC7Gt93g9VNvcV7cbXnUd1ewdLSuB1UE/edLLvDu0 mcBrssZUlgImj2Fyo/i5YfMsU1Q8RMhrYgr0FnAsZ+nRtG0S2Qd5yifjhykdGdfuoNtH YnvTQ+4RHi7rf0JtWXQgoeRu3H7oUIRd29BlfCPWrJj3uP+7pIPp0Re/jMrdOsopj2vi YVJlrNIrlhzIQ1E2a9gSnhKVTcTa2909A+7g7ssDGbdvm8hlWLxYa65RjSBpw4b7Jo+i E6g4W+lVJWFG61lvkL8ITivS9lVg7FyF0ryHJldZj168G2TjNS6d6kBT4ODJozETy3EN Adgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=KFROSJJjFgccw96HrbeDZh6Dpxva2ic22JeceO98VCM=; b=TpbGFLGGLXcGPNLS6oaG2I6AOhAt4IurMh4NkgoAf/5LXTYdoGW/Darud/9IwTczkk CW7sgKg05F2CT3Ck0Gad0Crqq3+iniSSMXGVm0BbLLlfgcNLjKgMuJkK40iGYhd5qxL8 Hxdz0+exWb7OYrsGYKT1z3vbCCjdCrWqYEymBPp7c1riLcs1MqZZht6ccTX/+mTybxBh 9jNK4gU17oHsDs/v46jn+EGopbHRLbsOOfITIsGrMQuteHxm0CDh1SoNC2hU4hb2U6xW 7GG4N6clBv0955PVVjU5tVXNZpSy9cXfOmtdSnDQsmLHEFLSkjcnsTMJfTyM6bOOzVzl ImMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wzYHY1fK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ds1-20020a170907724100b0078e18bd3073si14317417ejc.820.2022.10.19.02.12.40; Wed, 19 Oct 2022 02:13: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=wzYHY1fK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232677AbiJSJLA (ORCPT + 99 others); Wed, 19 Oct 2022 05:11:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232641AbiJSJIA (ORCPT ); Wed, 19 Oct 2022 05:08: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 B5B256A4B0; Wed, 19 Oct 2022 02:00:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6609E61750; Wed, 19 Oct 2022 08:59:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79E8FC433C1; Wed, 19 Oct 2022 08:59:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169982; bh=MMAtz0tiIEGxwOeY5liGyCLMqd2w/HCwnE9fieN4BrI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wzYHY1fKA5LhznjeC6Eg4N5AQOGmWiHahOHj3yYxwIu+7pLUCcYUIOm4dwprvIto7 y9XQGvq60MhXDGrWvDIFqbetCaEqafkhQ523HwFNIseb+zt/zY02yKN3oNfCFz9xZx VIrSKCWCJfNO+g0TkvLyOfm7DD1hSmCwnI2Byzh0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Rutland , Li Huafei , Ard Biesheuvel , Will Deacon , Catalin Marinas , Sasha Levin Subject: [PATCH 6.0 450/862] arm64: ftrace: fix module PLTs with mcount Date: Wed, 19 Oct 2022 10:28:57 +0200 Message-Id: <20221019083309.856979002@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106696290524275?= X-GMAIL-MSGID: =?utf-8?q?1747106696290524275?= From: Mark Rutland [ Upstream commit 8cfb08575c6d4585f1ce0deeb189e5c824776b04 ] Li Huafei reports that mcount-based ftrace with module PLTs was broken by commit: a6253579977e4c6f ("arm64: ftrace: consistently handle PLTs.") When a module PLTs are used and a module is loaded sufficiently far away from the kernel, we'll create PLTs for any branches which are out-of-range. These are separate from the special ftrace trampoline PLTs, which the module PLT code doesn't directly manipulate. When mcount is in use this is a problem, as each mcount callsite in a module will be initialized to point to a module PLT, but since commit a6253579977e4c6f ftrace_make_nop() will assume that the callsite has been initialized to point to the special ftrace trampoline PLT, and ftrace_find_callable_addr() rejects other cases. This means that when ftrace tries to initialize a callsite via ftrace_make_nop(), the call to ftrace_find_callable_addr() will find that the `_mcount` stub is out-of-range and is not handled by the ftrace PLT, resulting in a splat: | ftrace_test: loading out-of-tree module taints kernel. | ftrace: no module PLT for _mcount | ------------[ ftrace bug ]------------ | ftrace failed to modify | [] 0xffff800029180014 | actual: 44:00:00:94 | Initializing ftrace call sites | ftrace record flags: 2000000 | (0) | expected tramp: ffff80000802eb3c | ------------[ cut here ]------------ | WARNING: CPU: 3 PID: 157 at kernel/trace/ftrace.c:2120 ftrace_bug+0x94/0x270 | Modules linked in: | CPU: 3 PID: 157 Comm: insmod Tainted: G O 6.0.0-rc6-00151-gcd722513a189-dirty #22 | Hardware name: linux,dummy-virt (DT) | pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) | pc : ftrace_bug+0x94/0x270 | lr : ftrace_bug+0x21c/0x270 | sp : ffff80000b2bbaf0 | x29: ffff80000b2bbaf0 x28: 0000000000000000 x27: ffff0000c4d38000 | x26: 0000000000000001 x25: ffff800009d7e000 x24: ffff0000c4d86e00 | x23: 0000000002000000 x22: ffff80000a62b000 x21: ffff8000098ebea8 | x20: ffff0000c4d38000 x19: ffff80000aa24158 x18: ffffffffffffffff | x17: 0000000000000000 x16: 0a0d2d2d2d2d2d2d x15: ffff800009aa9118 | x14: 0000000000000000 x13: 6333626532303830 x12: 3030303866666666 | x11: 203a706d61727420 x10: 6465746365707865 x9 : 3362653230383030 | x8 : c0000000ffffefff x7 : 0000000000017fe8 x6 : 000000000000bff4 | x5 : 0000000000057fa8 x4 : 0000000000000000 x3 : 0000000000000001 | x2 : ad2cb14bb5438900 x1 : 0000000000000000 x0 : 0000000000000022 | Call trace: | ftrace_bug+0x94/0x270 | ftrace_process_locs+0x308/0x430 | ftrace_module_init+0x44/0x60 | load_module+0x15b4/0x1ce8 | __do_sys_init_module+0x1ec/0x238 | __arm64_sys_init_module+0x24/0x30 | invoke_syscall+0x54/0x118 | el0_svc_common.constprop.4+0x84/0x100 | do_el0_svc+0x3c/0xd0 | el0_svc+0x1c/0x50 | el0t_64_sync_handler+0x90/0xb8 | el0t_64_sync+0x15c/0x160 | ---[ end trace 0000000000000000 ]--- | ---------test_init----------- Fix this by reverting to the old behaviour of ignoring the old instruction when initialising an mcount callsite in a module, which was the behaviour prior to commit a6253579977e4c6f. Signed-off-by: Mark Rutland Fixes: a6253579977e ("arm64: ftrace: consistently handle PLTs.") Reported-by: Li Huafei Link: https://lore.kernel.org/linux-arm-kernel/20220929094134.99512-1-lihuafei1@huawei.com Cc: Ard Biesheuvel Cc: Will Deacon Link: https://lore.kernel.org/r/20220929134525.798593-1-mark.rutland@arm.com Signed-off-by: Catalin Marinas Signed-off-by: Sasha Levin --- arch/arm64/kernel/ftrace.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kernel/ftrace.c b/arch/arm64/kernel/ftrace.c index ea5dc7c90f46..b49ba9a24bcc 100644 --- a/arch/arm64/kernel/ftrace.c +++ b/arch/arm64/kernel/ftrace.c @@ -217,11 +217,26 @@ int ftrace_make_nop(struct module *mod, struct dyn_ftrace *rec, unsigned long pc = rec->ip; u32 old = 0, new; + new = aarch64_insn_gen_nop(); + + /* + * When using mcount, callsites in modules may have been initalized to + * call an arbitrary module PLT (which redirects to the _mcount stub) + * rather than the ftrace PLT we'll use at runtime (which redirects to + * the ftrace trampoline). We can ignore the old PLT when initializing + * the callsite. + * + * Note: 'mod' is only set at module load time. + */ + if (!IS_ENABLED(CONFIG_DYNAMIC_FTRACE_WITH_REGS) && + IS_ENABLED(CONFIG_ARM64_MODULE_PLTS) && mod) { + return aarch64_insn_patch_text_nosync((void *)pc, new); + } + if (!ftrace_find_callable_addr(rec, mod, &addr)) return -EINVAL; old = aarch64_insn_gen_branch_imm(pc, addr, AARCH64_INSN_BRANCH_LINK); - new = aarch64_insn_gen_nop(); return ftrace_modify_code(pc, old, new, true); } From patchwork Wed Oct 19 08:28: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: 4750 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214595wrs; Wed, 19 Oct 2022 02:13:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM69UzGKVTFh3a+aKRjXOnR6aKaspPcZGgd9+2D+h1JA7I97NOOhQk2+dml5YrvChJ/U1jY6 X-Received: by 2002:a05:6402:254b:b0:45d:b117:90f0 with SMTP id l11-20020a056402254b00b0045db11790f0mr6348251edb.57.1666170799466; Wed, 19 Oct 2022 02:13:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170799; cv=none; d=google.com; s=arc-20160816; b=sv1q+mkCKX0hv8szC3WiPHdU4VJz8Oykfqv/Czn1B4OH58jmiuGLp124VKasAupgL8 poH7WlwSoNe21ia+3FJtSL8x+SyUAEGSFNyuKepbhOycOGW8UNvs6EdMEvZ9P6824XeN 6O5kuaH+ax9rRng4I7GwpiTdQb+36TtDx53GMO68DHlLbwNNvn8iqSolUmNMJEnWs3Mo JvGIvjtVZ18fl1+e3ObHPCCqKYlhALOZ5PGb1sKFhLpNE5nGxARoRNcxVrTcjBDxL6HF jiGQ6S6OCx9WkTVQb+oaI//n7hRJK5d5xOKyT4CvYKnZoBicJbgeSp73QgGYK1Bj8yyD Lpfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Jv1T7ZnjqNAB8Le6Ls2kHiwvbq/gUHLRk0R1dH++2mM=; b=QiDuPRopZw7GJcjvdDCt5jsesSrB736hp4XtqZZp1/Qjt7VlefOSm2TzzF05zE1dLk EVPN7H3fckLX0ytsqGOe+DRWuRMEN/dz4MjFQRXm4RMNkJchDTqSq+ik+H/uoU35jelS DfG7xmg/wqJGDt5gZYVy0UR+Wqr0YD4wMecZMbMz/7Mm50FAPTWOE4YI9MCq6dgbE87F hEVN+cmlPLb4jMwtFBJS6rfDEqWN5W8fE3SRLn/1DrfyTXeTa94ZG03KkG+sLNUMz9oo ArU6oiZThLdaAHSNhWp3JVsYWN2G31EvrRba7qSd4lnxshxDElcZWuX7reetic7gT4DH PCVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OYzl9gJM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y3-20020a170906448300b0078d288ddfc9si12072644ejo.143.2022.10.19.02.12.54; Wed, 19 Oct 2022 02:13:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OYzl9gJM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232841AbiJSJLc (ORCPT + 99 others); Wed, 19 Oct 2022 05:11:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232596AbiJSJIy (ORCPT ); Wed, 19 Oct 2022 05:08:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B581F6A49F; Wed, 19 Oct 2022 02:00:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 03E7961807; Wed, 19 Oct 2022 08:59:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17AA8C433C1; Wed, 19 Oct 2022 08:59:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169985; bh=0aJmXsHy28if5uuppSC/9legPQw0PyWIgSfVD8RR20k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OYzl9gJM0RA+FKx6neBLU66/I97t/VEG/leygw+gXWSIcliV+SAO3ziKvRq54fCVu 555/fP8WquK28e8/WYBuREcQljhJ+Ib942MOFygCx/CyJmGvDtPhkd5Mrv6L0sAv7n VwTW+iMfKdyU35B1INzjKhwkF+9Im9haBGS9vMPI= 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 6.0 451/862] arm64: dts: exynos: fix polarity of "enable" line of NFC chip in TM2 Date: Wed, 19 Oct 2022 10:28:58 +0200 Message-Id: <20221019083309.901695365@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106711897615604?= X-GMAIL-MSGID: =?utf-8?q?1747106711897615604?= From: Dmitry Torokhov [ Upstream commit bd1a665a01b4d65fd8dc6fece4b376fa5c8c55bb ] According to s3fwrn5 driver code the "enable" GPIO line is driven "high" when chip is not in use (mode is S3FWRN5_MODE_COLD), and is driven "low" when chip is in use. s3fwrn5_phy_power_ctrl(): ... gpio_set_value(phy->gpio_en, 1); ... if (mode != S3FWRN5_MODE_COLD) { msleep(S3FWRN5_EN_WAIT_TIME); gpio_set_value(phy->gpio_en, 0); msleep(S3FWRN5_EN_WAIT_TIME); } Therefore the line described by "en-gpios" property should be annotated as "active low". The wakeup gpio appears to have correct polarity (active high). Signed-off-by: Dmitry Torokhov Link: https://lore.kernel.org/r/20220929011557.4165216-1-dmitry.torokhov@gmail.com Signed-off-by: Krzysztof Kozlowski Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi +++ b/arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi @@ -795,7 +795,7 @@ reg = <0x27>; interrupt-parent = <&gpa1>; interrupts = <3 IRQ_TYPE_EDGE_RISING>; - en-gpios = <&gpf1 4 GPIO_ACTIVE_HIGH>; + en-gpios = <&gpf1 4 GPIO_ACTIVE_LOW>; wake-gpios = <&gpj0 2 GPIO_ACTIVE_HIGH>; }; }; From patchwork Wed Oct 19 08:28:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5086 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp249544wrs; Wed, 19 Oct 2022 03:46:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7zB95ml1sB7rXv5BA6GXlYGsn9FkAVbsBscG9tyWyNA6X5h13S7ROJ4vQbwnnp4+3QDqy4 X-Received: by 2002:a17:903:1211:b0:178:9353:9e42 with SMTP id l17-20020a170903121100b0017893539e42mr7845200plh.45.1666176392988; Wed, 19 Oct 2022 03:46:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176392; cv=none; d=google.com; s=arc-20160816; b=Wj2z3hRNXRQ6u2zSrDuvS2l/pbeyLmVSxb50Ni3TqrZ9aH+53E2+iAZzGtvl8otFM1 brZlYEaN5IqsSoikZTt/j80SXFnjn5JZ8elbS1YeK0vpOxHUmb86R6RatcGjCfAh8MYm 0+Idz3G365f7L27QQEeRpSRBApi9ujjq0/CBQaGqyf1kszopiA/MOcf92SCzNUUFW+X6 AHWC+qs1HewdRi6yPQe6YRFbHr6ry38Mt1LbpRnRbMw410RscUdmjmHpV7ThqQPMo16a KgyqjkW+sKctiUkFF0Ud+PMTml+Z5PlOGt/Q8l5Y05oc+U3UJSsPTtgCcqwTf4PPhUdh PZ7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1UWyL/yx1wbXJMjZrYIK+febCbR2ELpYgE4BwE+cpXk=; b=QoylNxjvLIvvIrFEtni/gJV79WSOzFZ6XrQDU7WpDtTVUpF0XtdNBcrDyzjABYRmyW 3Lh/Kj/6c54whSCFE54cYDk9esTCbxxDVwynAWTqn0Hv33MdQq01hJB7xQ8ReDd4hqmY X7mzD7t1s3C4g0z4E2cX+yib0UfT2lVgGMHzBqwtaNheG5ie7lsyKYi0/VvIMXHA4zgC 4vYx7tlefhemnD0I7BQgtf1BjsJ+cI9NOblWu4MzRffJZPwyChkj6bGzuS1O72gbq5Wn qiNNifLFJFjIGo4Z8pCRlUBQTWDZqMf7ckuJ5Cbpa6z2mV7WD4lqa2f+bDWw/R+ojRNO O5dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gQze8Gv3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m10-20020a1709026bca00b00171311470f7si16485464plt.3.2022.10.19.03.46.20; Wed, 19 Oct 2022 03:46: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=gQze8Gv3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233008AbiJSKp7 (ORCPT + 99 others); Wed, 19 Oct 2022 06:45:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232923AbiJSKoV (ORCPT ); Wed, 19 Oct 2022 06:44:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B77E51CFF1; Wed, 19 Oct 2022 03:21:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 51319B82450; Wed, 19 Oct 2022 08:59:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA99AC433B5; Wed, 19 Oct 2022 08:59:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169988; bh=ai7WfVWVVq/rsQxbxqD2P3T55B+WLzqUqFD0GQQ004k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gQze8Gv3fK472mMiTL7e3+Nh3BQCJbHTWtOWtMFqNj5jZzzt94il27qSdlKef+OJD kSteYQbpjPzTuk2XM77ERrn1Hw+ihhInPAJ0aKWfmI7sGK5DYI4STGB4tNMEAOf+7x k3e368AvvVy4BcVOovVhT5mhpX7Nd5hqNveCTa34= 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 6.0 452/862] ARM: dts: exynos: fix polarity of VBUS GPIO of Origen Date: Wed, 19 Oct 2022 10:28:59 +0200 Message-Id: <20221019083309.946966609@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112577200902017?= X-GMAIL-MSGID: =?utf-8?q?1747112577200902017?= 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 6db09dba07ff..a3905e27b9cd 100644 --- a/arch/arm/boot/dts/exynos4412-origen.dts +++ b/arch/arm/boot/dts/exynos4412-origen.dts @@ -95,7 +95,7 @@ }; &ehci { - samsung,vbus-gpio = <&gpx3 5 1>; + samsung,vbus-gpio = <&gpx3 5 GPIO_ACTIVE_HIGH>; status = "okay"; phys = <&exynos_usbphy 2>, <&exynos_usbphy 3>; phy-names = "hsic0", "hsic1"; From patchwork Wed Oct 19 08:29: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: 4763 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214816wrs; Wed, 19 Oct 2022 02:13:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7nwy8cdSKU93axTrdTti5bMvwxNWdU01Z0voX4ys/j0bIO2OlUly93xAlDSvixRgcEdcXz X-Received: by 2002:a17:906:4786:b0:78d:b793:5bf6 with SMTP id cw6-20020a170906478600b0078db7935bf6mr5954459ejc.222.1666170830591; Wed, 19 Oct 2022 02:13:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170830; cv=none; d=google.com; s=arc-20160816; b=FXVcPoj7Upvh3n8neM/JqE8wH42lYT/hoZVeZhHzX8QQck+CN9M5cvsPjTvCdMgS8r Em4AwOMSkQXpxh9BZxltde8Bowa9KRW193HPsr9sS75ZWeoZo8OCErTonvXBJ4eMJMlq hT88dAL01q+l66vUa0HzlA5KGhkgpd64njffFFul4AaxnEGBTcpMjQ6FNVXYUki3s+XO 7f37UaXVTTQdbm82hWNt0pB4tLUp6O1Gba9jJdQyvstXHWx3bnB6wli0o7SuBd0sDjV5 CBhOFNrh3HQaahHhThiV/XwT4JIqUIm6zwHTCnTs5QkN8BeJUkTvjmJJpQh4uX6PFaoP Z+1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wrSA+/5qvK9HKm5pm7BJUInlcb6lBltuqUb2nyLOOs8=; b=PEW7oTYIJxwBxoAwcRKF7NAu9YX+hJepgHUuwLURmobdVtu2TSN3kKl7l3/VoFR4/L kQ1FmWIKlhTo/OD+ZQhNiRm1DYg5fxOeP1aQo08YEkM+tHFy0BurJY7roH/UYj0zZt1j Cnv2T6heMzgfKWg1oi+twtW6gBScZ6nNkkg3AFPed/zFCvK7nuybI/vQ+1Eib0BieunK MsSgT9swU2qrtQeGpV6c6E91nk0qRz3m9J0YRvUEfEaKuchwaZpRV6t/IWgouaCSNbsZ EcPRqv36Pi+g0KS/u4UzlhB6E8KCqNkobDNO2C8XW9+g6ZlUAmdpBnxJWxT8hMMqiUDO 4qhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=C9dNHCIP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l23-20020a170907915700b0078dec48d442si11266460ejs.680.2022.10.19.02.13.25; Wed, 19 Oct 2022 02:13:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=C9dNHCIP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232856AbiJSJLq (ORCPT + 99 others); Wed, 19 Oct 2022 05:11:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232779AbiJSJJS (ORCPT ); Wed, 19 Oct 2022 05:09: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 4C8DF4A813; Wed, 19 Oct 2022 02:00: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 4DF30617F7; Wed, 19 Oct 2022 08:59:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C5A8C433D7; Wed, 19 Oct 2022 08:59:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169990; bh=a0L7keHdvAWF9HVxePOwqz6MqpGe3xrOsmsrwS+8eyE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C9dNHCIP8sdesRKJd69UGShImCCdBClztz6NPZychWkL4O5jb8CDac4hPhBAfkrda rLMwKvZ/jLGDNbIZSuJewsxef1n5XCEg2S49n9XIQ20Y+LBeUU8vSeKtaS7MD6NAYb eTKuevTv5S7SKF9hPMphuJqlxPIaIy5EeG5otKZ0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Darrick J. Wong" , "Matthew Wilcox (Oracle)" , Sasha Levin Subject: [PATCH 6.0 453/862] iomap: iomap: fix memory corruption when recording errors during writeback Date: Wed, 19 Oct 2022 10:29:00 +0200 Message-Id: <20221019083309.986921531@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106744947159985?= X-GMAIL-MSGID: =?utf-8?q?1747106744947159985?= From: Darrick J. Wong [ Upstream commit 3d5f3ba1ac28059bdf7000cae2403e4e984308d2 ] Every now and then I see this crash on arm64: Unable to handle kernel NULL pointer dereference at virtual address 00000000000000f8 Buffer I/O error on dev dm-0, logical block 8733687, async page read Mem abort info: ESR = 0x0000000096000006 EC = 0x25: DABT (current EL), IL = 32 bits SET = 0, FnV = 0 EA = 0, S1PTW = 0 FSC = 0x06: level 2 translation fault Data abort info: ISV = 0, ISS = 0x00000006 CM = 0, WnR = 0 user pgtable: 64k pages, 42-bit VAs, pgdp=0000000139750000 [00000000000000f8] pgd=0000000000000000, p4d=0000000000000000, pud=0000000000000000, pmd=0000000000000000 Internal error: Oops: 96000006 [#1] PREEMPT SMP Buffer I/O error on dev dm-0, logical block 8733688, async page read Dumping ftrace buffer: Buffer I/O error on dev dm-0, logical block 8733689, async page read (ftrace buffer empty) XFS (dm-0): log I/O error -5 Modules linked in: dm_thin_pool dm_persistent_data XFS (dm-0): Metadata I/O Error (0x1) detected at xfs_trans_read_buf_map+0x1ec/0x590 [xfs] (fs/xfs/xfs_trans_buf.c:296). dm_bio_prison XFS (dm-0): Please unmount the filesystem and rectify the problem(s) XFS (dm-0): xfs_imap_lookup: xfs_ialloc_read_agi() returned error -5, agno 0 dm_bufio dm_log_writes xfs nft_chain_nat xt_REDIRECT nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 ip6t_REJECT potentially unexpected fatal signal 6. nf_reject_ipv6 potentially unexpected fatal signal 6. ipt_REJECT nf_reject_ipv4 CPU: 1 PID: 122166 Comm: fsstress Tainted: G W 6.0.0-rc5-djwa #rc5 3004c9f1de887ebae86015f2677638ce51ee7 rpcsec_gss_krb5 auth_rpcgss xt_tcpudp ip_set_hash_ip ip_set_hash_net xt_set nft_compat ip_set_hash_mac ip_set nf_tables Hardware name: QEMU KVM Virtual Machine, BIOS 1.5.1 06/16/2021 pstate: 60001000 (nZCv daif -PAN -UAO -TCO -DIT +SSBS BTYPE=--) ip_tables pc : 000003fd6d7df200 x_tables lr : 000003fd6d7df1ec overlay nfsv4 CPU: 0 PID: 54031 Comm: u4:3 Tainted: G W 6.0.0-rc5-djwa #rc5 3004c9f1de887ebae86015f2677638ce51ee7405 Hardware name: QEMU KVM Virtual Machine, BIOS 1.5.1 06/16/2021 Workqueue: writeback wb_workfn sp : 000003ffd9522fd0 (flush-253:0) pstate: 60401005 (nZCv daif +PAN -UAO -TCO -DIT +SSBS BTYPE=--) pc : errseq_set+0x1c/0x100 x29: 000003ffd9522fd0 x28: 0000000000000023 x27: 000002acefeb6780 x26: 0000000000000005 x25: 0000000000000001 x24: 0000000000000000 x23: 00000000ffffffff x22: 0000000000000005 lr : __filemap_set_wb_err+0x24/0xe0 x21: 0000000000000006 sp : fffffe000f80f760 x29: fffffe000f80f760 x28: 0000000000000003 x27: fffffe000f80f9f8 x26: 0000000002523000 x25: 00000000fffffffb x24: fffffe000f80f868 x23: fffffe000f80fbb0 x22: fffffc0180c26a78 x21: 0000000002530000 x20: 0000000000000000 x19: 0000000000000000 x18: 0000000000000000 x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000 x14: 0000000000000001 x13: 0000000000470af3 x12: fffffc0058f70000 x11: 0000000000000040 x10: 0000000000001b20 x9 : fffffe000836b288 x8 : fffffc00eb9fd480 x7 : 0000000000f83659 x6 : 0000000000000000 x5 : 0000000000000869 x4 : 0000000000000005 x3 : 00000000000000f8 x20: 000003fd6d740020 x19: 000000000001dd36 x18: 0000000000000001 x17: 000003fd6d78704c x16: 0000000000000001 x15: 000002acfac87668 x2 : 0000000000000ffa x1 : 00000000fffffffb x0 : 00000000000000f8 Call trace: errseq_set+0x1c/0x100 __filemap_set_wb_err+0x24/0xe0 iomap_do_writepage+0x5e4/0xd5c write_cache_pages+0x208/0x674 iomap_writepages+0x34/0x60 xfs_vm_writepages+0x8c/0xcc [xfs 7a861f39c43631f15d3a5884246ba5035d4ca78b] x14: 0000000000000000 x13: 2064656e72757465 x12: 0000000000002180 x11: 000003fd6d8a82d0 x10: 0000000000000000 x9 : 000003fd6d8ae288 x8 : 0000000000000083 x7 : 00000000ffffffff x6 : 00000000ffffffee x5 : 00000000fbad2887 x4 : 000003fd6d9abb58 x3 : 000003fd6d740020 x2 : 0000000000000006 x1 : 000000000001dd36 x0 : 0000000000000000 CPU: 1 PID: 122167 Comm: fsstress Tainted: G W 6.0.0-rc5-djwa #rc5 3004c9f1de887ebae86015f2677638ce51ee7 do_writepages+0x90/0x1c4 __writeback_single_inode+0x4c/0x4ac Hardware name: QEMU KVM Virtual Machine, BIOS 1.5.1 06/16/2021 writeback_sb_inodes+0x214/0x4ac wb_writeback+0xf4/0x3b0 pstate: 60001000 (nZCv daif -PAN -UAO -TCO -DIT +SSBS BTYPE=--) wb_workfn+0xfc/0x580 process_one_work+0x1e8/0x480 pc : 000003fd6d7df200 worker_thread+0x78/0x430 This crash is a result of iomap_writepage_map encountering some sort of error during writeback and wanting to set that error code in the file mapping so that fsync will report it. Unfortunately, the code dereferences folio->mapping after unlocking the folio, which means that another thread could have removed the page from the page cache (writeback doesn't hold the invalidation lock) and give it to somebody else. At best we crash the system like above; at worst, we corrupt memory or set an error on some other unsuspecting file while failing to record the problems with *this* file. Regardless, fix the problem by reporting the error to the inode mapping. NOTE: Commit 598ecfbaa742 lifted the XFS writeback code to iomap, so this fix should be backported to XFS in the 4.6-5.4 kernels in addition to iomap in the 5.5-5.19 kernels. Fixes: e735c0079465 ("iomap: Convert iomap_add_to_ioend() to take a folio") # 5.17 onward Fixes: 598ecfbaa742 ("iomap: lift the xfs writeback code to iomap") # 5.5-5.16, needs backporting Fixes: 150d5be09ce4 ("xfs: remove xfs_cancel_ioend") # 4.6-5.4, needs backporting Signed-off-by: Darrick J. Wong Reviewed-by: Matthew Wilcox (Oracle) Signed-off-by: Sasha Levin --- fs/iomap/buffered-io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index ca5c62901541..77d59c159248 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -1421,7 +1421,7 @@ iomap_writepage_map(struct iomap_writepage_ctx *wpc, if (!count) folio_end_writeback(folio); done: - mapping_set_error(folio->mapping, error); + mapping_set_error(inode->i_mapping, error); return error; } From patchwork Wed Oct 19 08:29:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5286 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp281074wrs; Wed, 19 Oct 2022 05:01:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4wwLbSHLhqlgU2EbhalZYArkKerF1Buh9O+uFI/keScNcgYg1r19zyWHB4rZ2CIfHK3fBb X-Received: by 2002:a17:907:6e11:b0:78e:3057:f631 with SMTP id sd17-20020a1709076e1100b0078e3057f631mr6304556ejc.333.1666180896812; Wed, 19 Oct 2022 05:01:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666180896; cv=none; d=google.com; s=arc-20160816; b=APwz/T5YeTjSkJHHn+itCKQXTTtHro4zWvDAnCNi+hN9pDScskxkeTD+9eS0GqA5Rr 7BJQ0RUj0uE2qO2LKfN3MthJ3wJDOJH2L813L0qAEEezBYChhF2tiYUlKMG8uCpcUsF5 w/uc9CCtjXh8btLCYSohW9PdErPTsqxZJxfK7zReQ7/GnwS7T4WQ2+G9/xgwd7DkaRKb AyIFC9Hde1qiVDS7ePvuIugMooss1one9Nbog5XNmEyr8NAdz9OG1ea8Rja8ChkkgRUY PX5TTAhCGAmUgU99JOR4TOIvprT2YtsgN8+p6lninJAHGiBWuA3rW0W8d/oNR9iAaIMu 6N/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=y70JzDOolKy/GxrA5KTQDDrQE6WV0cW/8gtS4opIXYc=; b=OaGN2OSWPKqxV0RapPTV0Yz+uLPThY0tbg+gzU8wsGQSlAh5yuYZhPdNMnx+v3z+4c 782NsuQFh1b7OOUsnfLngvV55d+kBluPMsIMjcLZAJuHDLwgcq6cwK7Wa+IeTygH3BLu R55Wb0PpPZQL+jP2izeF+B1lC/RMVfqzmPtlvn9cElf1EK1s94cqNSFob82kjzgp9qgw ifiR50GADtB7MK9JEpLYrrwumlI8QT+/xNaKpcrucZ7sz9K/fjSXhjTzSqpZUJRGdBoq 4aVVTRihgggdTCZo/3HT5q0WhcLigg5tDd1B4Csmu4jKpG8q6DlD9NySegVYl9IPmCEN volQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BdJW+BnB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fi18-20020a056402551200b0045a3b951e8bsi13537551edb.194.2022.10.19.05.01.09; Wed, 19 Oct 2022 05:01: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=BdJW+BnB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232399AbiJSL40 (ORCPT + 99 others); Wed, 19 Oct 2022 07:56:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232663AbiJSLyy (ORCPT ); Wed, 19 Oct 2022 07:54:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E7851B864F; Wed, 19 Oct 2022 04:34:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 906D8B8244F; Wed, 19 Oct 2022 08:59:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07288C433D6; Wed, 19 Oct 2022 08:59:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169993; bh=coQ3Q/Ae05f07tSDbuwVfPnSEuQZI1GqMFwqyzL101s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BdJW+BnBV/j+1hQVaJcsIwW8zeywOHUTcglyGgWrs7/81ga126WBy+OibzF1E9n83 8vMk+bKCRVZ2PWlgfdv9aIUj8se7AaaX+cBuCq5GuGwcuyc5oef20hiupK96rJxkvt Qy/SY8KDHvVp20UFNLtyabmQxIOWC77SqbyMk0l8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhao Gongyi , Shuah Khan , Sasha Levin Subject: [PATCH 6.0 454/862] selftests/cpu-hotplug: Use return instead of exit Date: Wed, 19 Oct 2022 10:29:01 +0200 Message-Id: <20221019083310.034366440@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747117300130066730?= X-GMAIL-MSGID: =?utf-8?q?1747117300130066730?= From: Zhao Gongyi [ Upstream commit 972cf4ce51ef5532d56822af17defb148aac0ccb ] Some cpus will be left in offline state when online function exits in some error conditions. Use return instead of exit to fix it. Signed-off-by: Zhao Gongyi Signed-off-by: Shuah Khan Stable-dep-of: 51d4c851465c ("selftests/cpu-hotplug: Reserve one cpu online at least") Signed-off-by: Sasha Levin --- .../selftests/cpu-hotplug/cpu-on-off-test.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh b/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh index 0d26b5e3f966..940b68c940bb 100755 --- a/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh +++ b/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh @@ -4,6 +4,7 @@ SYSFS= # Kselftest framework requirement - SKIP code is 4. ksft_skip=4 +retval=0 prerequisite() { @@ -102,10 +103,10 @@ online_cpu_expect_success() if ! online_cpu $cpu; then echo $FUNCNAME $cpu: unexpected fail >&2 - exit 1 + retval=1 elif ! cpu_is_online $cpu; then echo $FUNCNAME $cpu: unexpected offline >&2 - exit 1 + retval=1 fi } @@ -128,10 +129,10 @@ offline_cpu_expect_success() if ! offline_cpu $cpu; then echo $FUNCNAME $cpu: unexpected fail >&2 - exit 1 + retval=1 elif ! cpu_is_offline $cpu; then echo $FUNCNAME $cpu: unexpected offline >&2 - exit 1 + retval=1 fi } @@ -201,7 +202,7 @@ if [ $allcpus -eq 0 ]; then offline_cpu_expect_success $present_max online_cpu $present_max fi - exit 0 + exit $retval else echo "Full scope test: all hotplug cpus" echo -e "\t online all offline cpus" @@ -291,3 +292,5 @@ done echo 0 > $NOTIFIER_ERR_INJECT_DIR/actions/CPU_DOWN_PREPARE/error /sbin/modprobe -q -r cpu-notifier-error-inject + +exit $retval From patchwork Wed Oct 19 08:29:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4775 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp215653wrs; Wed, 19 Oct 2022 02:16:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6XzpcrUVp0F4zN4+ForK+bQ9zjt0xe+eKcW9+wwh8DrTVbQ1BoSsXPvyEU05LDoQlNs2yl X-Received: by 2002:a17:906:8474:b0:78d:ce9c:284e with SMTP id hx20-20020a170906847400b0078dce9c284emr6121340ejc.702.1666170976651; Wed, 19 Oct 2022 02:16:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170976; cv=none; d=google.com; s=arc-20160816; b=abdsLhctjq2N8vdRozRVJntogVdh5NucEi6/E30926mEMh27SqZZtKE1GTN5wEUr+r RnyHtr63aHoTeFpknwkuxQaC3xjO8KvmMBTvNcXurXs4jHPo3OTmQnIvA0pxW5cQXT9Y CPO/zlwRzislkivDwh57vJFqLF6pNQ9fShsAlWBWpwkpv/NBsZd8nkp/aw/LbR+SJBPZ WKhkYgipJ/xLHqPzMbwXGw74vcfL5s0KPjUsHjmREZ+DfnM1FuBVbwyWp57vi7bULRhW 8U9BMZW98C3qJ92FtH1psStSwnaYTgYZBigjqHOJ9Ktc9wGeAUBI3rKtMBdg6fyM3aB5 thfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=r9SuD5+FyeVEZZuxrqZPVzvGNU6XCWuhUSdE4Cy7Ls0=; b=agNgLzhfwRwdPV9MG+xHQCTgE8eMeemJ7MXhvroLeumgHagXKKgysVTwngtxP+QWiF itJTFOGeperC3jhyoe8/M6pueakcyGJqbK/v60FSejjKayJejDNp7edPUBO82ZE0oJ+k ROhHFbo5o56/M4Z92cQQfiuxPjFdlHQsqKSRc/jA0DHjm4iZ36LNruc2/0NqyDAHvji1 GjmdXP20mv73QOVhh7HWGmuxX44zwoFGCoVDI4XW4GW4C0hRr8oYMCrH3U9QQLu0cdyT Sx7uufcy8z/+1kEwXDjUvkHSoQKVUKK9BYWHsI7iFmOSR/E6mCtdc4nAuBxNGKsscDKj 7B7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VHpsCX5G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o19-20020a170906975300b0079330b37fb6si591742ejy.880.2022.10.19.02.15.49; Wed, 19 Oct 2022 02:16: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=VHpsCX5G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232987AbiJSJM7 (ORCPT + 99 others); Wed, 19 Oct 2022 05:12:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232684AbiJSJIl (ORCPT ); Wed, 19 Oct 2022 05:08:41 -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 09C963AB32; Wed, 19 Oct 2022 01:59: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 D07766174B; Wed, 19 Oct 2022 08:58:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1CDFC433D6; Wed, 19 Oct 2022 08:58:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169909; bh=VCVhEPhtSbllVj8a+QGysUU1wTphg1WLChqnpby9OoI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VHpsCX5GQcDG84arHUoB0gNpl17c8fqjWvDvJwFOO4/eFsKX76uA+r+x/btxfVv0U QyeVrA2jFFW2SXq0aklXL54iigvToYjEq4IBZpskjDzaMj8DFjjRtJ4cNIP/LBjE29 Fbd7vemBGDyikdtcgvS70I3Np4Hu1GrVT3FxfpQM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhao Gongyi , Shuah Khan , Sasha Levin Subject: [PATCH 6.0 455/862] selftests/cpu-hotplug: Delete fault injection related code Date: Wed, 19 Oct 2022 10:29:02 +0200 Message-Id: <20221019083310.083958104@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106897980289010?= X-GMAIL-MSGID: =?utf-8?q?1747106897980289010?= From: Zhao Gongyi [ Upstream commit 195d74be717af14e5991f818f73f067367bfc1ed ] Delete fault injection related code since the module has been deleted. Signed-off-by: Zhao Gongyi Signed-off-by: Shuah Khan Stable-dep-of: 51d4c851465c ("selftests/cpu-hotplug: Reserve one cpu online at least") Signed-off-by: Sasha Levin --- tools/testing/selftests/cpu-hotplug/config | 1 - .../selftests/cpu-hotplug/cpu-on-off-test.sh | 87 ++----------------- 2 files changed, 6 insertions(+), 82 deletions(-) delete mode 100644 tools/testing/selftests/cpu-hotplug/config diff --git a/tools/testing/selftests/cpu-hotplug/config b/tools/testing/selftests/cpu-hotplug/config deleted file mode 100644 index d4aca2ad5069..000000000000 --- a/tools/testing/selftests/cpu-hotplug/config +++ /dev/null @@ -1 +0,0 @@ -CONFIG_NOTIFIER_ERROR_INJECTION=y diff --git a/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh b/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh index 940b68c940bb..32ec7e4489ee 100755 --- a/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh +++ b/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh @@ -116,10 +116,10 @@ online_cpu_expect_fail() if online_cpu $cpu 2> /dev/null; then echo $FUNCNAME $cpu: unexpected success >&2 - exit 1 + retval=1 elif ! cpu_is_offline $cpu; then echo $FUNCNAME $cpu: unexpected online >&2 - exit 1 + retval=1 fi } @@ -142,16 +142,14 @@ offline_cpu_expect_fail() if offline_cpu $cpu 2> /dev/null; then echo $FUNCNAME $cpu: unexpected success >&2 - exit 1 + retval=1 elif ! cpu_is_online $cpu; then echo $FUNCNAME $cpu: unexpected offline >&2 - exit 1 + retval=1 fi } -error=-12 allcpus=0 -priority=0 online_cpus=0 online_max=0 offline_cpus=0 @@ -159,31 +157,20 @@ offline_max=0 present_cpus=0 present_max=0 -while getopts e:ahp: opt; do +while getopts ah opt; do case $opt in - e) - error=$OPTARG - ;; a) allcpus=1 ;; h) - echo "Usage $0 [ -a ] [ -e errno ] [ -p notifier-priority ]" + echo "Usage $0 [ -a ]" echo -e "\t default offline one cpu" echo -e "\t run with -a option to offline all cpus" exit ;; - p) - priority=$OPTARG - ;; esac done -if ! [ "$error" -ge -4095 -a "$error" -lt 0 ]; then - echo "error code must be -4095 <= errno < 0" >&2 - exit 1 -fi - prerequisite # @@ -231,66 +218,4 @@ for cpu in `hotplaggable_offline_cpus`; do online_cpu_expect_success $cpu done -# -# Test with cpu notifier error injection -# - -DEBUGFS=`mount -t debugfs | head -1 | awk '{ print $3 }'` -NOTIFIER_ERR_INJECT_DIR=$DEBUGFS/notifier-error-inject/cpu - -prerequisite_extra() -{ - msg="skip extra tests:" - - /sbin/modprobe -q -r cpu-notifier-error-inject - /sbin/modprobe -q cpu-notifier-error-inject priority=$priority - - if [ ! -d "$DEBUGFS" ]; then - echo $msg debugfs is not mounted >&2 - exit $ksft_skip - fi - - if [ ! -d $NOTIFIER_ERR_INJECT_DIR ]; then - echo $msg cpu-notifier-error-inject module is not available >&2 - exit $ksft_skip - fi -} - -prerequisite_extra - -# -# Offline all hot-pluggable CPUs -# -echo 0 > $NOTIFIER_ERR_INJECT_DIR/actions/CPU_DOWN_PREPARE/error -for cpu in `hotpluggable_online_cpus`; do - offline_cpu_expect_success $cpu -done - -# -# Test CPU hot-add error handling (offline => online) -# -echo $error > $NOTIFIER_ERR_INJECT_DIR/actions/CPU_UP_PREPARE/error -for cpu in `hotplaggable_offline_cpus`; do - online_cpu_expect_fail $cpu -done - -# -# Online all hot-pluggable CPUs -# -echo 0 > $NOTIFIER_ERR_INJECT_DIR/actions/CPU_UP_PREPARE/error -for cpu in `hotplaggable_offline_cpus`; do - online_cpu_expect_success $cpu -done - -# -# Test CPU hot-remove error handling (online => offline) -# -echo $error > $NOTIFIER_ERR_INJECT_DIR/actions/CPU_DOWN_PREPARE/error -for cpu in `hotpluggable_online_cpus`; do - offline_cpu_expect_fail $cpu -done - -echo 0 > $NOTIFIER_ERR_INJECT_DIR/actions/CPU_DOWN_PREPARE/error -/sbin/modprobe -q -r cpu-notifier-error-inject - exit $retval From patchwork Wed Oct 19 08:29:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5119 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp251130wrs; Wed, 19 Oct 2022 03:50:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6IzGz2X0KgzhdDUruku6UFewvqyJYNjYPiyUL2NHN+RyR36Ck4ZLByk5Qwadtx+CpI/dgt X-Received: by 2002:a05:6402:1e8d:b0:454:79a9:201f with SMTP id f13-20020a0564021e8d00b0045479a9201fmr6917755edf.176.1666176656378; Wed, 19 Oct 2022 03:50:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176656; cv=none; d=google.com; s=arc-20160816; b=TFWv3Nuv36aQGQVlnmt5lrHDlA4YdTaE58yWF3n8Awr42rYo/e7GWCicctxPRC4v2x ibdm1xnMp+szQzDFCgH0GipUyU2YGWyNK/YqvmJyzV8JEIRo+amZFatJGJxfWlYI6LkJ E92TeN3cM0YgIpZJDK7r333lfXB3B4Vko7SpMnVRNqypawXGXuI5XydtlQqI6h6oeqhK XjlHbMfwuXOwXzZKCf5K/u1o51TmzO/6+z3KBpqm3goWfu8R6ddRs7Dmce00Ceq5dSWg SLLD2/+efAcVehkM9QmdyjRcYmIWjqNw9L/tpesdqfQgjSL4LFU5/b1dg9OCnHOtHwMT l5tA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=LWUgJhCifC6EHhFaRZfYsi42jCxM/QqW0NZr3mUESYg=; b=sdDMlNpkLV9VuyxQ5MpZagelofQjBPW5HEf3ICoFlbgEOV2M0t1fNBqXx/UYe4cGJi SkAEwB9WVMRbaxGL8TwcHcXxGheAPTVBaGPW99sL4VZFW6hYZeV0JEuB16j/tdaPWT0V gF/7GoecWyXrdZECLEGHdJwvbV5T31XqHlmu1iSQJJhKGlmAX3ffmj6xhb1YJ6SRnf7N R3P9B7/WJuR4H/TaSuyvIuGU82fE2rDtqwVcCmuzCqXajhFKJSlJccGbJcSrbjczvXpl r/pcutaAkN509lncBB+TDGg98GblEn3wHFpMtfQ6FD+dBLB71myn27JE7OHDDdl+6fZ2 FXDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="M8iy/iiG"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a17090716a000b0078ddd8656d9si14919060ejc.9.2022.10.19.03.50.31; Wed, 19 Oct 2022 03: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="M8iy/iiG"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232817AbiJSKuA (ORCPT + 99 others); Wed, 19 Oct 2022 06:50:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231977AbiJSKrF (ORCPT ); Wed, 19 Oct 2022 06:47:05 -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 1F0DA15B122; Wed, 19 Oct 2022 03:21: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 14B5CB82436; Wed, 19 Oct 2022 08:58:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 872F1C433C1; Wed, 19 Oct 2022 08:58:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169911; bh=4D97w+ZQu+bU7Fk+WX+tUrif/4N620Eec9wOqEqA3S8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M8iy/iiGFAuGS+5fJrG5hJMpQbdSwdRiXD/ZJ8aDnpPEHUZda4yyX9C3BdEH2fAN3 4GRrPJ9xUg1ILJPmV0+Qq3UCOBIXnbmDIlubtMstxhvh3CrymCvs5Zboknz73oDAld yj8c/6ABV75bSVChNp+b3YO334H83BhpAxzAs6kI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhao Gongyi , Shuah Khan , Sasha Levin Subject: [PATCH 6.0 456/862] selftests/cpu-hotplug: Reserve one cpu online at least Date: Wed, 19 Oct 2022 10:29:03 +0200 Message-Id: <20221019083310.133101348@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112853365635462?= X-GMAIL-MSGID: =?utf-8?q?1747112853365635462?= From: Zhao Gongyi [ Upstream commit 51d4c851465c32143d9c7b1cfb46fc581922b116 ] Considering that we can not offline all cpus in any cases, we need to reserve one cpu online when the test offline all hotpluggable online cpus, otherwise the test will fail forever. Fixes: d89dffa976bc ("fault-injection: add selftests for cpu and memory hotplug") Signed-off-by: Zhao Gongyi Signed-off-by: Shuah Khan Signed-off-by: Sasha Levin --- .../selftests/cpu-hotplug/cpu-on-off-test.sh | 40 ++++++++++--------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh b/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh index 32ec7e4489ee..4c1d6d9abecc 100755 --- a/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh +++ b/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh @@ -149,6 +149,25 @@ offline_cpu_expect_fail() fi } +online_all_hot_pluggable_cpus() +{ + for cpu in `hotplaggable_offline_cpus`; do + online_cpu_expect_success $cpu + done +} + +offline_all_hot_pluggable_cpus() +{ + local reserve_cpu=$online_max + for cpu in `hotpluggable_online_cpus`; do + # Reserve one cpu oneline at least. + if [ $cpu -eq $reserve_cpu ];then + continue + fi + offline_cpu_expect_success $cpu + done +} + allcpus=0 online_cpus=0 online_max=0 @@ -197,25 +216,10 @@ else echo -e "\t online all offline cpus" fi -# -# Online all hot-pluggable CPUs -# -for cpu in `hotplaggable_offline_cpus`; do - online_cpu_expect_success $cpu -done +online_all_hot_pluggable_cpus -# -# Offline all hot-pluggable CPUs -# -for cpu in `hotpluggable_online_cpus`; do - offline_cpu_expect_success $cpu -done +offline_all_hot_pluggable_cpus -# -# Online all hot-pluggable CPUs again -# -for cpu in `hotplaggable_offline_cpus`; do - online_cpu_expect_success $cpu -done +online_all_hot_pluggable_cpus exit $retval From patchwork Wed Oct 19 08:29:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4742 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214370wrs; Wed, 19 Oct 2022 02:12:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7q3K54oQb0uob3ero2kwQyGRLCmiR9AHYVkVGW3yuL9b4wDttqh5OhKwRt/zwTpwLpHWvd X-Received: by 2002:a17:906:a4a:b0:782:686d:a1b6 with SMTP id x10-20020a1709060a4a00b00782686da1b6mr5789565ejf.232.1666170757037; Wed, 19 Oct 2022 02:12:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170757; cv=none; d=google.com; s=arc-20160816; b=S4PsT+caEwIhivuEdjlvKyZf2C/UKMNlqCW0KD8uAoaeoRuRadrouRaxSKwtGIqv1C YPwwoWQfNxS9v+tN1xVigOGtpQI0bS39WNiY5tZukgnqjYhJh3FmpR+EDhc026LJSUeW v98D5KzA4kO5/5qvpCEopSa7H+H3JhbAclED/Tesbs59hha8j1pzKAa7UBkDVdMqkIHO /FH5eFqlaNzGSAQbw0OFuYrVO23Egi5jP7/TiZJHlvN10bUt0HriN6moTvo9hemp2sss QHxPuGW6Jqa6ap3/oEsPVFNbxjUKbf5vADAUPOZY3VEmVf40CEXqci/HnJxUeA2J+Wlg Ip1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JJZrkz89+qo7+c8sLxkDzb+cl2r46kvB7ioa0ELUSeg=; b=tsjnyz/EdkJ3rjr559d5CZTBmQph+0YLRlQOeOyI+G75aEVpzxBd/2loQWahyeqCwk vC7Cne3Y/gN9e+mI0JmQVgXMOC9r3aBT0YBNOIY7b3SI+8JB7chmfhOaJGhpiwP/2CA7 0BHskf2/pYsqhv17Hbzk9Z/WdA2jqkqlaiBO2Qle0SUAfYNbTMI/HMVZSCuqmdmLs2F0 VTIXAYirJV7lpxLYQM9ky09vyWQrYhc/1of4dov8zSejuY207OzgQsJKOCWyr/GlhkXC mv1t4q1xhOLbTowiDcj1jY3CodAHwytDp2VragSr+kICdfr3zvlT8PBVfwG6nrHDVPUt m2qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BZ+vBfLS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dm10-20020a170907948a00b0078de8d119d8si1172530ejc.853.2022.10.19.02.12.12; Wed, 19 Oct 2022 02:12:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BZ+vBfLS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232284AbiJSJKf (ORCPT + 99 others); Wed, 19 Oct 2022 05:10:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232415AbiJSJHQ (ORCPT ); Wed, 19 Oct 2022 05:07:16 -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 2965D3B9A7; Wed, 19 Oct 2022 01:59: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 357EF6185F; Wed, 19 Oct 2022 08:58:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41F49C433D6; Wed, 19 Oct 2022 08:58:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169914; bh=3ajESlv4+6Ko2mnHLGQYwrzZxL4zpE5YzF667e3vUp4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BZ+vBfLSKF+ZLS5nuFKZ/GZId0sNkDmRO0o7h0DXN7xuzl99PuisqsPGTtpkLbSMV Sb3XCSlwnLc11TSxqoFIoNwh4sbx37GnKZGrUr3z4ItaSvvU+AqUBbkCEhEVmWwNYw t+g1GXE5WInKmHdbLgMKo9fSJcIh0HsMs02/SsSc= 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 6.0 457/862] iio: adc: at91-sama5d2_adc: fix AT91_SAMA5D2_MR_TRACKTIM_MAX Date: Wed, 19 Oct 2022 10:29:04 +0200 Message-Id: <20221019083310.175512156@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106667580063637?= X-GMAIL-MSGID: =?utf-8?q?1747106667580063637?= 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 279430c1d88c..ac9ef89fba17 100644 --- a/drivers/iio/adc/at91-sama5d2_adc.c +++ b/drivers/iio/adc/at91-sama5d2_adc.c @@ -77,7 +77,7 @@ struct at91_adc_reg_layout { #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 Wed Oct 19 08:29:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5099 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp250129wrs; Wed, 19 Oct 2022 03:48:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5I65rtVdp8jYo06CN7iFx/dk2ymFTu3It++Nrwy805g9dCmLexTJxdI4MTnPYdp96bkQ6z X-Received: by 2002:a17:907:60d5:b0:78d:f741:7f9b with SMTP id hv21-20020a17090760d500b0078df7417f9bmr6071542ejc.314.1666176493816; Wed, 19 Oct 2022 03:48:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176493; cv=none; d=google.com; s=arc-20160816; b=qiQKyA5dujAZsCB0dOzYvyTXQjPWRYWRvsI1CQnHYQs7aHrYv13TTL4Dt9S2QYkINV 1x0a3NN61Rg5m8eM12m7d3AaG8fawtmRaY2Yt/Kv6EF4V9lFnEUlYFdGMtAj1OC/INfg xgILtK6G/8UKAA7vtNQAyDMIt9/eQUkurO6Q2uSui/TqIgpIMg7AiSPaEaVBoafKK+iZ Jdu5/1hHYg8s1iHcyYr+fdRvcL7C5hwUjvEcIR999qjBHnq/hHcyxbW7DYgvmFfpeHz+ JiLMcfwGrKfYc1Yu4vTSpM1WfJq05U6mMp4Me+9OczAhaeraMCUaxwnGpMPCAhTNuVlR Nu0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=M2XBoYlPyw0tMtZtA98+fnxbXIJaSCC3fwC/B5jtNk0=; b=eQYq3pqoLUYAR14RqX9HKkqz+6SOhTydLgxf8s5TFXOghkvERAP49xsPMDmdpVOXLy aCmcYwDScGAhnrRGkAqGdKDG2wMYgDxpyZR5jAaquoCnIUlPfWxhQRqRNlC0zjo6HIw6 L7k549DfwLFjtsz8kbhxypum2eFwhBrhNJp+56p4gotAH6SyiSXrYeCSPSD+mZdyQuEf xpnb1Tw41T1js54Ipbye7wbtQoQER/N6pdN/RES2DTKFbkYM1cQVEOoI0GfklAT6fswP UvSfTSBHSLYaqVj9WD/lUpzEwtZBE4dyuVBAkNz7KOhy4vmQKrNyFd624nevicSiWugh UuYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PNgXNbgl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a1709062ad600b0078e11e9286csi11124669eje.195.2022.10.19.03.47.48; Wed, 19 Oct 2022 03:48:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PNgXNbgl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232948AbiJSKrV (ORCPT + 99 others); Wed, 19 Oct 2022 06:47:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232371AbiJSKoz (ORCPT ); Wed, 19 Oct 2022 06: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 35F1411A960; Wed, 19 Oct 2022 03:21: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 7C97DB8243C; Wed, 19 Oct 2022 08:58:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CCDBFC433C1; Wed, 19 Oct 2022 08:58:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169917; bh=6XTF//5sVQnIk1y2riU7wOGu4n69UIB2ssUQRpMAKnA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PNgXNbglldMQP/OYChoNcwrxL2V0Rj3aOYGSJng6n/5estxDKEtTZSApksuF/Dhtt gjF0QpnNSyBBhBYd+F0l+iUH+E+wogfbAPXsRLUvRPA7TktkwKAPXkAaKPtCpBd9x0 FHFSzdVglVVLH2CCNivbLaui0EDD5elZVzrJ9YxQ= 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 6.0 458/862] iio: adc: at91-sama5d2_adc: check return status for pressure and touch Date: Wed, 19 Oct 2022 10:29:05 +0200 Message-Id: <20221019083310.224242008@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112682954025530?= X-GMAIL-MSGID: =?utf-8?q?1747112682954025530?= From: Claudiu Beznea [ Upstream commit d84ace944a3b24529798dbae1340dea098473155 ] Check return status of at91_adc_read_position() and at91_adc_read_pressure() in at91_adc_read_info_raw(). Fixes: 6794e23fa3fe ("iio: adc: at91-sama5d2_adc: add support for oversampling resolution") Signed-off-by: Claudiu Beznea Link: https://lore.kernel.org/r/20220803102855.2191070-3-claudiu.beznea@microchip.com Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin --- drivers/iio/adc/at91-sama5d2_adc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c index ac9ef89fba17..08d1f806c839 100644 --- a/drivers/iio/adc/at91-sama5d2_adc.c +++ b/drivers/iio/adc/at91-sama5d2_adc.c @@ -1544,8 +1544,10 @@ static int at91_adc_read_info_raw(struct iio_dev *indio_dev, *val = tmp_val; mutex_unlock(&st->lock); iio_device_release_direct_mode(indio_dev); + if (ret > 0) + ret = at91_adc_adjust_val_osr(st, val); - return at91_adc_adjust_val_osr(st, val); + return ret; } if (chan->type == IIO_PRESSURE) { ret = iio_device_claim_direct_mode(indio_dev); @@ -1558,8 +1560,10 @@ static int at91_adc_read_info_raw(struct iio_dev *indio_dev, *val = tmp_val; mutex_unlock(&st->lock); iio_device_release_direct_mode(indio_dev); + if (ret > 0) + ret = at91_adc_adjust_val_osr(st, val); - return at91_adc_adjust_val_osr(st, val); + return ret; } /* in this case we have a voltage channel */ From patchwork Wed Oct 19 08:29:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4747 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214554wrs; Wed, 19 Oct 2022 02:13:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6x0HuPxx4I3wVynY0BvMcX3JNjprN89Y65DO05R5f2lTAwrmtzETzy5+Lf6DgCoQRHtEeJ X-Received: by 2002:aa7:c751:0:b0:459:b0e1:4ad7 with SMTP id c17-20020aa7c751000000b00459b0e14ad7mr6454466eds.193.1666170789142; Wed, 19 Oct 2022 02:13:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170789; cv=none; d=google.com; s=arc-20160816; b=b6ePgb+z8kt7iXYxE/Z+yzkfP4EnZl3zaq9EJbujsRw+1eB0+7TCo5Jmkrw8q5PjEo 3kLWS40RiJtR0YzhSfPXOP0pMzUTm2V7XOhxtGJTuwAkyQ5/dt1VT0zgEDxg0tyg0mt8 ldq1U9039Q2VHHiK9H4TK/TF/RqjP16KHSRopfLe1HFx3/Pbek10OrSa1VpS/RWBZuxn MbyBiGUN6wl88NmTA+fpK+it+UqLDSJWafrH25blD3W7irQ2IuqSlsjMVekca+t3qwKl 4beQbxHgAzXR6Jbn3Zzbgu13CHGKUdGov6pOU3JCUytGLg88gl2tCUqg4YJXIcH85xqw hIPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=CJfo40uAJFoFUsTMnQqudgvlfD7j7e3H7H/cKCjgq+8=; b=FpboWU7scXRnc8LhJaAUJhHY8yiO10Ex241UsLDtXOzrcwFD1K0PLwiAcQOfJy/fxa hXPeScVKUovPvngO6CjFv3sGOjCrp6FE0MFjlsFoWKk64hSD7rBl1ieLuLpB+4936cgl mv3gs8dQCoKO9PnlpPYDQ75JO9g98CDVGUNAuEmok6t3vgBt6NMObTR3lVqZ7Cpk+jhZ 08NB11prbCbFKKTF5ViKSnExyFpwHdjNIjCshKHI1wf1pkhwB6uJvVij+In+PHFt0xII rceL7TC0ctFU+3dV/L+xC+gGM4bKSe63LgFVk6BdXHb8QMaPnlry+xbwe6my66lTk3R1 REOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nNLulaaa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hh6-20020a170906a94600b00781b67df7f6si13569065ejb.167.2022.10.19.02.12.23; Wed, 19 Oct 2022 02:13: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=nNLulaaa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232460AbiJSJKk (ORCPT + 99 others); Wed, 19 Oct 2022 05:10:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232427AbiJSJH2 (ORCPT ); Wed, 19 Oct 2022 05:07:28 -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 3EFC23C8E7; Wed, 19 Oct 2022 01:59: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 5933C61866; Wed, 19 Oct 2022 08:58:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6800EC433D6; Wed, 19 Oct 2022 08:58:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169919; bh=L322BFkuLIvqiR/Get1l0XbzU8LuDpj1WX+7zRzp758=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nNLulaaacM0rT4Q2dJ9lH5LwiAdrzgT/sb/0WCR35c/5RvVPtWt1SFMwB8nRNV+4Y FLl5xYm4NcKKcRz248VSdrhAzlMxN1Sqh3Y5MKrUBpqj6x0A7b1I71UtQe3QU6VZZL e9cK4NzdPT6iQYn9n17qwEFcL4/yf6ZvwlyBZWHM= 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 6.0 459/862] iio: adc: at91-sama5d2_adc: lock around oversampling and sample freq Date: Wed, 19 Oct 2022 10:29:06 +0200 Message-Id: <20221019083310.272084498@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106701405253691?= X-GMAIL-MSGID: =?utf-8?q?1747106701405253691?= From: Claudiu Beznea [ Upstream commit 9780a23ed5a0a0a63683e078f576719a98d4fb70 ] .read_raw()/.write_raw() could be called asynchronously from user space or other in kernel drivers. Without locking on st->lock these could be called asynchronously while there is a conversion in progress. Read will be harmless but changing registers while conversion is in progress may lead to inconsistent results. Thus, to avoid this lock st->lock. Fixes: 27e177190891 ("iio:adc:at91_adc8xx: introduce new atmel adc driver") Fixes: 6794e23fa3fe ("iio: adc: at91-sama5d2_adc: add support for oversampling resolution") Signed-off-by: Claudiu Beznea Link: https://lore.kernel.org/r/20220803102855.2191070-4-claudiu.beznea@microchip.com Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin --- drivers/iio/adc/at91-sama5d2_adc.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c index 08d1f806c839..3734ddc82952 100644 --- a/drivers/iio/adc/at91-sama5d2_adc.c +++ b/drivers/iio/adc/at91-sama5d2_adc.c @@ -1542,10 +1542,10 @@ static int at91_adc_read_info_raw(struct iio_dev *indio_dev, ret = at91_adc_read_position(st, chan->channel, &tmp_val); *val = tmp_val; - mutex_unlock(&st->lock); - iio_device_release_direct_mode(indio_dev); if (ret > 0) ret = at91_adc_adjust_val_osr(st, val); + mutex_unlock(&st->lock); + iio_device_release_direct_mode(indio_dev); return ret; } @@ -1558,10 +1558,10 @@ static int at91_adc_read_info_raw(struct iio_dev *indio_dev, ret = at91_adc_read_pressure(st, chan->channel, &tmp_val); *val = tmp_val; - mutex_unlock(&st->lock); - iio_device_release_direct_mode(indio_dev); if (ret > 0) ret = at91_adc_adjust_val_osr(st, val); + mutex_unlock(&st->lock); + iio_device_release_direct_mode(indio_dev); return ret; } @@ -1650,16 +1650,20 @@ static int at91_adc_write_raw(struct iio_dev *indio_dev, /* if no change, optimize out */ if (val == st->oversampling_ratio) return 0; + mutex_lock(&st->lock); st->oversampling_ratio = val; /* update ratio */ at91_adc_config_emr(st); + mutex_unlock(&st->lock); return 0; case IIO_CHAN_INFO_SAMP_FREQ: if (val < st->soc_info.min_sample_rate || val > st->soc_info.max_sample_rate) return -EINVAL; + mutex_lock(&st->lock); at91_adc_setup_samp_freq(indio_dev, val); + mutex_unlock(&st->lock); return 0; default: return -EINVAL; From patchwork Wed Oct 19 08:29:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5105 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp250316wrs; Wed, 19 Oct 2022 03:48:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5J+JsrjUWAtcrOI/9B8KF7ye5fsjJNfXxifAhD1CZlcmMQsE34JPjukh7mI8PINYauE4kp X-Received: by 2002:a17:906:5a4b:b0:78d:8790:d4a1 with SMTP id my11-20020a1709065a4b00b0078d8790d4a1mr6159430ejc.329.1666176524817; Wed, 19 Oct 2022 03:48:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176524; cv=none; d=google.com; s=arc-20160816; b=RWmPjQbFQXjEgtKe5G59QmprsRc1U0XcXIlGUiihNdTSP7UggRGWZ86PU0L+9fwYU2 Js6rpdZrl2AEj+nzeUnn53eUn8i9sx5upfNoJrwn2kFhp6G+UpACCxglJ8gDkbPuKPWf nksPp40ZuG/Boe/NKQvyJpffnJbmPcDGRLY9EW2N4mCiL2D6atTT1KUTKom5O/82Jlqp goysIWcaZ7YNG0/38z7nZyLsE6dnmlFS32GJ5yraq3wazIofujMwsQbycbN+UJX0/uZZ MPiVTGb/3hzFYfrtxQan5Tw90g4JmwIvnt66noMLVyM95rSbc96GS8uvA9A9Qd6tbEjB 5dng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=u9235LgammonpNzlTu2A8Bx71BAV3JabSmqGYYMCjuQ=; b=yZXj6bLlPcgquWxcZbpHBQHC1s7T4WYB+aaMrjCcoef3vZmpocgXj/ad/AHMzkyaB2 IGXRaav0eYnLXivDWvNkvE81aMxXduNGEg0wELEsmeobN/eHTg6aDJppElx3132uULxR 67O+DKp0cfSyqv0VydTjFyAf3W/ogQfZO+FhUmZw77xmkC85uuoFMMohvn5GXSb8n/Tx FsmE5wINRAWyXG0nsR6FmZ1efueP2AVOF4SwCv1GV+SBNwrBUtLNKH7pzx1WtrsZqK0k 3pfc3XPn2cS+epO7M9SU1geZJOR3cQp9CsOILQ3IVujEWwW+vlbdvUai3vjUT/V4VvwH ohwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sJeYFNO6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s10-20020a056402036a00b0045cb1420292si12226462edw.306.2022.10.19.03.48.17; Wed, 19 Oct 2022 03:48: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=sJeYFNO6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233936AbiJSKrv (ORCPT + 99 others); Wed, 19 Oct 2022 06:47:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232921AbiJSKpa (ORCPT ); Wed, 19 Oct 2022 06:45:30 -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 94FE715A30E; Wed, 19 Oct 2022 03:21: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 7C759B8243A; Wed, 19 Oct 2022 08:58:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB7C1C433D6; Wed, 19 Oct 2022 08:58:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169922; bh=42i1W62ybqHhLkB5AsmTWMLUg+3p/yCokCwXsmtb4sE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sJeYFNO6F3tabxFfDvX7DoGqbKE5GIxESn3PqEk78VOaoCveDW8eAyA4+OSiZ3YVn TTA9dvBGfPS9pwLpl7Ua4sZDliRiIfZY9ZYp605lDoZo3xXNZB+D1ZpZk5mKzYDBuS q7lb7LxGe3yNmB+pBZeEUYehDlwD4f/3E4RU42ow= 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 6.0 460/862] iio: adc: at91-sama5d2_adc: disable/prepare buffer on suspend/resume Date: Wed, 19 Oct 2022 10:29:07 +0200 Message-Id: <20221019083310.321198621@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112715846039046?= X-GMAIL-MSGID: =?utf-8?q?1747112715846039046?= From: Claudiu Beznea [ Upstream commit 808175e21d9b7f866eda742e8970f27b78afe5db ] In case triggered buffers are enabled while system is suspended they will not work anymore after resume. For this call at91_adc_buffer_postdisable() on suspend and at91_adc_buffer_prepare() on resume. On tests it has been seen that at91_adc_buffer_postdisable() call is not necessary but it has been kept because it also does the book keeping for DMA. On resume path there is no need to call at91_adc_configure_touch() as it is embedded in at91_adc_buffer_prepare(). Fixes: 073c662017f2f ("iio: adc: at91-sama5d2_adc: add support for DMA") Signed-off-by: Claudiu Beznea Link: https://lore.kernel.org/r/20220803102855.2191070-5-claudiu.beznea@microchip.com Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin --- drivers/iio/adc/at91-sama5d2_adc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c index 3734ddc82952..e2c82c5a2fac 100644 --- a/drivers/iio/adc/at91-sama5d2_adc.c +++ b/drivers/iio/adc/at91-sama5d2_adc.c @@ -2116,6 +2116,9 @@ static int at91_adc_suspend(struct device *dev) struct iio_dev *indio_dev = dev_get_drvdata(dev); struct at91_adc_state *st = iio_priv(indio_dev); + if (iio_buffer_enabled(indio_dev)) + at91_adc_buffer_postdisable(indio_dev); + /* * Do a sofware reset of the ADC before we go to suspend. * this will ensure that all pins are free from being muxed by the ADC @@ -2159,14 +2162,11 @@ static int at91_adc_resume(struct device *dev) if (!iio_buffer_enabled(indio_dev)) return 0; - /* check if we are enabling triggered buffer or the touchscreen */ - if (at91_adc_current_chan_is_touch(indio_dev)) - return at91_adc_configure_touch(st, true); - else - return at91_adc_configure_trigger(st->trig, true); + ret = at91_adc_buffer_prepare(indio_dev); + if (ret) + goto vref_disable_resume; - /* not needed but more explicit */ - return 0; + return at91_adc_configure_trigger(st->trig, true); vref_disable_resume: regulator_disable(st->vref); From patchwork Wed Oct 19 08:29:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5118 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp251052wrs; Wed, 19 Oct 2022 03:50:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5T5/WEIsP5GZZ0N/UIkHhinyNN0yDzKF07qNiLQfXaX4nvXwWp5OH+9p/cA+Mz5qPgub79 X-Received: by 2002:a05:6402:3594:b0:45d:acf9:c782 with SMTP id y20-20020a056402359400b0045dacf9c782mr7043877edc.63.1666176642636; Wed, 19 Oct 2022 03:50:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176642; cv=none; d=google.com; s=arc-20160816; b=o20d+FmSVjrQVvpWrX9M0dblBrHhBo/LygRoxKGmxkMRavzUstZJfUkn94Fl0bQmxX 424IrrLANp8JbfxVXLCzgP/MyvEehj6hmLqpTy6ZUTuOjuNkWgwuIb772tBt96tIiiZY e9CBeEW5h/0R8tyC6LLKzM/6+PLNVWWcgjtybJjkXVqJAwU8D5UHhgTmop9IB+9LtTIe IHY91FU1Fy8ZTY9YV4nfVyssQSFQyTxXEbrGL0mk6CtJDu3uH0n9ffcI6/x9NTGdXsil oJptQcKdHkpQc7K4WIqz0AdK1JCGS+zzjgg8Gco6NbzGoDUn0A6bqIc0sriPlBgUoSDY Z36Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+oE0JZb+KeUDsBGWPQnlpL7ruZ/m6k8pTnDTqBWtrX4=; b=yOuCfMSKjSxVdpGu3RaZwMcMF/H44vx1u5koZsUMqx8jufkQt2lhAdynl645iGd/DH WoY0o015SQdkFgLO9vlByO2iQeC0/xi4NCaifMAIGd8ltBmpyWje/jKVoEJMS55swo5K ejvyDjsn4achQEZMyoHucXOGo1hEyyYhelcJt2ZY45I3Hgeqer3HvCrnDUy4GoDGh6r9 LUoohR3VG2BaYCJ/oU4uplfVUylRmxmeZJOBwMMRMC/zrrQJqVjNznPSAKsrJQg08tbH b5GOKR8tm4Xk1K/eNdAJAJa5ZB3pFyynfYyHZOTQf1VvL8BLf7qRfTk4uvMyQrQSSgXZ iQuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Xy/xkDbQ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q18-20020a056402519200b004597671e0ddsi13413675edd.338.2022.10.19.03.50.16; Wed, 19 Oct 2022 03: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="Xy/xkDbQ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234446AbiJSKtH (ORCPT + 99 others); Wed, 19 Oct 2022 06:49:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232505AbiJSKrC (ORCPT ); Wed, 19 Oct 2022 06:47: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 240FB56B8C; Wed, 19 Oct 2022 03:21: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 3C3BBB8243D; Wed, 19 Oct 2022 08:58:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9824FC433D7; Wed, 19 Oct 2022 08:58:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169925; bh=c/IdW/mBpyQMgYTrCHuboL6q7PPhJdh3DFEoIvN0a1c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xy/xkDbQhApQTknTYeA29fYf8X5Wj+QnGRvGW79+Pp/kF3JMKAx1UIqCDvCXpe9I7 p+yeShW2ZJeYifDi9Ve9GIZtFWrkq+ZbBh0IZVun+vK9YfnpzqrB7Zu2eJyjZ9YLaM pqEtEiczSXsKJfQHCX40ECITd1VzbIIPG7Xg1pDg= 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 6.0 461/862] iio: inkern: only release the device node when done with it Date: Wed, 19 Oct 2022 10:29:08 +0200 Message-Id: <20221019083310.368297100@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112839535363629?= X-GMAIL-MSGID: =?utf-8?q?1747112839535363629?= 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 df74765d33dc..9d87057794fc 100644 --- a/drivers/iio/inkern.c +++ b/drivers/iio/inkern.c @@ -165,9 +165,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; @@ -175,6 +176,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 Wed Oct 19 08:29:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4740 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214343wrs; Wed, 19 Oct 2022 02:12:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7zWCL+OmEizcWQT05dfY31ZFLYXI8Al6dY5zUHc4hOtjqjetQ3D7ePw4uJZ4DVNQdwOV+Z X-Received: by 2002:a17:907:6e09:b0:78d:a326:49c6 with SMTP id sd9-20020a1709076e0900b0078da32649c6mr5832553ejc.507.1666170752304; Wed, 19 Oct 2022 02:12:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170752; cv=none; d=google.com; s=arc-20160816; b=r/kVvXjtkLKMGa+/yOSe7lz4ACqNlx9w52I16m79fFDoPpM/MykeBrg03FtuHhP9RB j9oSkA9wIGuPmhenwx5CEShPx1N41Xq9KAO0+oAoWSv5HMVn9wC6866+JZSWDseMZkNc btuLg6xUUUDx6tF4SInatgiBCdUfm5/Y3k+e9WfZZfMQ+zSGhXDpsy8+YK/eQ/CIu1U+ oJKTfuFJjWl6yvHaO+3sJcQnFESO6FnBQ6pL7dVz6a+v53p6bhhIVrADzUxCryfEbx0/ ZFspDSGu/tgYRePN64ubCMOuoo2mjPIDhFQuLduEoGzcS4xaJI2uMMIyq2hGpTgYnj3Z WdHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MGz/Ny3qnn4Iw68vhpXp4rtzdB/NBnC/zXgaZPyC/wo=; b=E+CKUtMxBB8tZafhwBRviOB2fSZKf0KR7won1NSNrxOcAbKAmfFOQwAWyoq151ACQ1 +UnDTLzoJFVZEw79gCG1o3CgJArz9zPQ/plwng75gCvkYZ8x5fa0ASyhrayV+58fJB2Z zcl1wvDpqelEJlrKDw6+qevDST04A5ugi/rb+gsE5tDGTxA0yAgciZF8/Oku3Xb8Qqc7 h8EZDzTcL1t8mKCiKJD10U2FW3KvZGH28gzyKMlfe6+W+mlef4uzvO1IEXIdegifEEs7 K5Cb4EvejStRyXxdmIPckq1eiGpO6oVo0Qy0Wgd8XJIoGFGN+oyvh8aj21ZEwwpkMnza UOYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XWlX7WMM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a3-20020a50e703000000b00458d2bdcb30si12945608edn.96.2022.10.19.02.12.07; Wed, 19 Oct 2022 02:12: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=XWlX7WMM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232873AbiJSJJa (ORCPT + 99 others); Wed, 19 Oct 2022 05:09:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232524AbiJSJGs (ORCPT ); Wed, 19 Oct 2022 05:06:48 -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 84E0042E74; Wed, 19 Oct 2022 01:59:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 290FC61840; Wed, 19 Oct 2022 08:58:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A1A0C433D6; Wed, 19 Oct 2022 08:58:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169927; bh=daM7vcIsZKr7FdXlFX6dxhQkjn98nSSipw3bhrJuVxY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XWlX7WMMh27L49mHRolEqZ3/ljOJnWJrjvPYjZt30yN6SraTP9Utgxa17vuiBwhjf WmFqUWXcaXJ6Nv8qiBtxM4VTLQ47VPrM6WNCb3ZphYVzmKSpEyeFJ5FSV0TR+4zZ0e bBg+RcRMbArFfkT85sSU79kWnALAjVADv0MQfqOk= 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?= , Andy Shevchenko , Jonathan Cameron , Sasha Levin Subject: [PATCH 6.0 462/862] iio: inkern: fix return value in devm_of_iio_channel_get_by_name() Date: Wed, 19 Oct 2022 10:29:09 +0200 Message-Id: <20221019083310.416092950@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106662703908700?= X-GMAIL-MSGID: =?utf-8?q?1747106662703908700?= From: Nuno Sá [ Upstream commit 9e878dbc0e8322f8b2f5ab0093c1e89926362dbe ] of_iio_channel_get_by_name() can either return NULL or an error pointer so that only doing IS_ERR() is not enough. Fix it by checking the NULL pointer case and return -ENODEV in that case. Note this is done like this so that users of the function (which only check for error pointers) do not need to be changed. This is not ideal since we are losing error codes and as such, in a follow up change, things will be unified so that of_iio_channel_get_by_name() only returns error codes. Fixes: 6e39b145cef7 ("iio: provide of_iio_channel_get_by_name() and devm_ version it") Signed-off-by: Nuno Sá Reviewed-by: Andy Shevchenko Link: https://lore.kernel.org/r/20220715122903.332535-3-nuno.sa@analog.com Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin --- drivers/iio/inkern.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c index 9d87057794fc..87fd2a0d44f2 100644 --- a/drivers/iio/inkern.c +++ b/drivers/iio/inkern.c @@ -412,6 +412,8 @@ struct iio_channel *devm_of_iio_channel_get_by_name(struct device *dev, channel = of_iio_channel_get_by_name(np, channel_name); if (IS_ERR(channel)) return channel; + if (!channel) + return ERR_PTR(-ENODEV); ret = devm_add_action_or_reset(dev, devm_iio_channel_free, channel); if (ret) From patchwork Wed Oct 19 08:29:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4771 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214931wrs; Wed, 19 Oct 2022 02:14:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5vpSULmMFbg7DKP2++e3iRjVCVwNeFu5KIdqlQiJI5FZa9ia60WGATaeWFU4X8XA3JpCah X-Received: by 2002:a17:907:7fa9:b0:791:a5c2:e25 with SMTP id qk41-20020a1709077fa900b00791a5c20e25mr2980645ejc.444.1666170850002; Wed, 19 Oct 2022 02:14:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170849; cv=none; d=google.com; s=arc-20160816; b=RS0HfRDYE9duvC67OurugUAgwnlyF95FVOPj9YyWELmSGDvVbaS8X8pbBnZFsaUiQY xUy+0D1ftb7yrjI8jgrSzx6+22xgUTeb3rlAtKEC2oGoO2Th5HdTfotoS5oFYswQ5rV7 UuNnusouZBDA/bmQRkQcU7KBE5EX6/x/Yhyu9HjvHvLHMTGvStlrOcBphwysojFiRrtO z4o5gXHsB7I5xvi4cyu34oqfe5QDgKtzk1cfAVVTCk2b03XhlbSJbuH2IoJr7QBA8AFn u92stuuNfjNki+ANwTNluiTd9wBaHRm6V9ZFm/AHwK8Ts7Wb1HegBOTw/U2Hx/JIdSFq KbhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HjO2LHN/6hT1ExYbz+ajfWcKIBWSOWReLKdZjkQOKQI=; b=oOahFrMoSEgiwfOMKSAMCtnLj978B9nFcoaUgvdXZDihMOdvg72KM3ycdMn794/ASs mCpAJHKI4OZVZum8Og8qDXVCBWQcFcVm9LYswmljVUm/uRRSOzNzSejS6yOLMqlsELeJ N13fVx1Ofm4Kg1Mxb28hlX8bYNQhVrFXoSqQGDcrl5IJ5yw9Asw0o8s3Oy1xZNobvL6S Wa68sy5++xzlQNCwWtH/P3CKYvfAn025JJiskbUgMRi5PfgfZ64dIujaAorSIZSgKXju K6hh7pfMF6VuIj5PTK/e/0kqM0CS2tiYq4Z93QuVzkb3RPMA85Lmki8GQIZnkN5wqhPG 7KVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EFGNC0ji; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z5-20020a05640240c500b00457541c5a46si10232017edb.569.2022.10.19.02.13.45; Wed, 19 Oct 2022 02:14:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EFGNC0ji; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232634AbiJSJMt (ORCPT + 99 others); Wed, 19 Oct 2022 05:12:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233130AbiJSJKN (ORCPT ); Wed, 19 Oct 2022 05:10:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F2AAB48AF; Wed, 19 Oct 2022 02:01: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 BF2DA6182C; Wed, 19 Oct 2022 08:58:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CDAF4C433D6; Wed, 19 Oct 2022 08:58:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169930; bh=JpCuy34NgQIBPH4nCmhFfOaWkoGI7rF0t6tv8fWfAnQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EFGNC0ji3Wv0NTi9DPG5IVH4WbUycdpOjcFwZp5BlA1qi1uWnZJuuT1OHdXnbGbFe RwuyTArl+7NqAUpcFOfvgjVmdQ/ClchakZ01SjE1vFcKlq6vuu5Ir56TnDZ4Kfy15Y BLIkyCkEfDjnmbVeOtk8hKY5Ab02SUdra9MMDm6A= 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 6.0 463/862] iio: ABI: Fix wrong format of differential capacitance channel ABI. Date: Wed, 19 Oct 2022 10:29:10 +0200 Message-Id: <20221019083310.453771826@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106765001570196?= X-GMAIL-MSGID: =?utf-8?q?1747106765001570196?= 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 e81ba6f5e1c8..6e1b925f30bf 100644 --- a/Documentation/ABI/testing/sysfs-bus-iio +++ b/Documentation/ABI/testing/sysfs-bus-iio @@ -196,7 +196,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 Wed Oct 19 08:29: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: 4772 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214969wrs; Wed, 19 Oct 2022 02:14:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5tp4vvmX1Nt/cElcv3fA3GmsTLqmSb4LfekRUErXhBjPpz3xSHmkJdil3Qu3srXigdswqH X-Received: by 2002:a17:907:9816:b0:787:4350:3a19 with SMTP id ji22-20020a170907981600b0078743503a19mr5530204ejc.627.1666170855311; Wed, 19 Oct 2022 02:14:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170855; cv=none; d=google.com; s=arc-20160816; b=NNQZNrVOVmXWMXGxmrtf6g3BKireMdsHmmneZV5XAwzvXP7QZ3Uyv0H9SuFRv283Xp nKErLadPQzm6PvOCQg6rUqPOcawMhD3A2pjYKnnHBtyByL2W6n4iXJ6xAM7unesuC7fQ PMDdPVXNw1afC2kBYSHzDtbzjxSUI/enoAsuXxE4zvjizIim4xRgT0iv4KA4Ta+BU/wz T8HgK+AAFsGKmdi2AjCpGBHtAJCKRyHUHb15Fn9kuJJeFu0gXVeRMZtPgLSCGDIZ8cGg Kv/FygTINwcemD46I6bQqDFhHaPPqniYx/h7i6ZjllwbXHqiTecdwUe8uUnUAtxL4gZS mXqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hQPRO9t9lGXC58fFDvsEdi4BnJVOkmKk0E9tgfX8bFw=; b=KoL3QnM7PBFBTVMExEBEyqvwFSVTtu0AXdYY0wMiga+dSEVgHTdOow6wxwZxG/w78j wcQ+gd83tutsvOULA6uuJVk+5/dwWRGjWWwKErgcdxn0CGhVXDI+D3N/C175wSHLVJjf 64rgpLFw3s3HT5BBSWbxaLCsPzdLX9You7gzvSIrRLkCl2eFp1UjmVvnAdfXecEExyqK kdQrBB5cSE2kUTCtizoMDkhutffSQ1jVZwPSb4C632maFg3GzPjo1QhG18hTEyNU2Yak /AwI3qo8HoFHOTFKEsbTB3iHuEfNbM1qld4bUNrX2rQ76/oogcolzyon8gVpq2dsfdU1 /28A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=r5Rsczci; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sh40-20020a1709076ea800b0078d288c1047si14289406ejc.841.2022.10.19.02.13.50; Wed, 19 Oct 2022 02:14: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=r5Rsczci; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232973AbiJSJMx (ORCPT + 99 others); Wed, 19 Oct 2022 05:12:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232387AbiJSJH6 (ORCPT ); Wed, 19 Oct 2022 05:07:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3E771ADBD; Wed, 19 Oct 2022 02:00: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 59AD5617FB; Wed, 19 Oct 2022 08:58:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6CAC5C433C1; Wed, 19 Oct 2022 08:58:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169932; bh=9PXW0jD/9VCb+BHX7rIhISiFRilpbAWDGc1l+7xT2L4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r5Rsczci9CaitFDER9yY5r1Ma62xlL2GGOzWn5gd0yIAuR9t5zcUMLONduQ1XtN2Z 6k43CbhY9KypdBLg/ax1voZ/A5aDlaYnaDzM/OJyJs0V76Hyai4bWOqTrelVMfef+9 2QsiuL/eIQoVOudjDcKOMEGRIaYr2/fvLkyAAF1U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jakob Hauser , Linus Walleij , Andy Shevchenko , Jonathan Cameron , Sasha Levin Subject: [PATCH 6.0 464/862] iio: magnetometer: yas530: Change data type of hard_offsets to signed Date: Wed, 19 Oct 2022 10:29:11 +0200 Message-Id: <20221019083310.493893259@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106770604016963?= X-GMAIL-MSGID: =?utf-8?q?1747106770604016963?= From: Jakob Hauser [ Upstream commit e137fafc8985cf152a4bb6f18ae83ebb06816df1 ] The "hard_offsets" are currently unsigned u8 but they should be signed as they can get negative. They are signed in function yas5xx_meaure_offsets() and in the Yamaha drivers [1][2]. [1] https://github.com/NovaFusion/android_kernel_samsung_golden/blob/cm-12.1/drivers/sensor/compass/yas.h#L156 [2] https://github.com/msm8916-mainline/android_kernel_qcom_msm8916/blob/GT-I9195I/drivers/iio/magnetometer/yas_mag_drv-yas532.c#L91 Fixes: de8860b1ed47 ("iio: magnetometer: Add driver for Yamaha YAS530") Signed-off-by: Jakob Hauser Reviewed-by: Linus Walleij Reviewed-by: Andy Shevchenko Link: https://lore.kernel.org/r/40f052bf6491457d0c5c0ed4c3534dc6fa251c3c.1660337264.git.jahau@rocketmail.com Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin --- drivers/iio/magnetometer/yamaha-yas530.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/magnetometer/yamaha-yas530.c b/drivers/iio/magnetometer/yamaha-yas530.c index aeaa4da6923b..d1f16729c60e 100644 --- a/drivers/iio/magnetometer/yamaha-yas530.c +++ b/drivers/iio/magnetometer/yamaha-yas530.c @@ -132,7 +132,7 @@ struct yas5xx { unsigned int version; char name[16]; struct yas5xx_calibration calibration; - u8 hard_offsets[3]; + s8 hard_offsets[3]; struct iio_mount_matrix orientation; struct regmap *map; struct regulator_bulk_data regs[2]; From patchwork Wed Oct 19 08:29:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5130 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp251618wrs; Wed, 19 Oct 2022 03:52:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5/xqd6sOlR33qiFd500T00qUfi/1QWQpojp2vhq8tc+xRyI6d3Cs3WCRjXkTcqtVJo/QsA X-Received: by 2002:a05:6402:5406:b0:452:1560:f9d4 with SMTP id ev6-20020a056402540600b004521560f9d4mr6900907edb.333.1666176730538; Wed, 19 Oct 2022 03:52:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176730; cv=none; d=google.com; s=arc-20160816; b=PW10aDetUTVw7Ju8gYQ3/i9xWLQo4BL+EwHrR4LhIJsSjjRqGjkiQehVfN2NiklfdA 5Mc2BzcZCOQE+9GYB7kXewTZGk5Yqb/aA9zyEecYa9tl5pDidOdZQEA/m8wQRgTjW7Cm V3cVGw5fMI7W+Uyc8noNaHyBpR61QbsMZS2Fw/QeAyQB8q99xlyc0pPl4GdEcpfKBfsy TTTX3UYKpY3v5TpJfWnJmONZzjMsR5yb1OYgjORwcZTVcAvZnCZ8ylQ4wl2+70nBHvGE OFzSnoXXmwGrGwq1hyzEhzUZq+yU1gFqGEOEphLh03pdIaiFojPSVnz88YGSdZpAMfCz 56FA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QpBxL/BHkTdvh4CjjUJNm4ZsTA0raCJhPy1j82bGQDg=; b=IAfO/jgEaiJ+aXZV/hEfM+drNxTSrdG4ezYdnTTP1rLBedjaBqwCIALrO/BL9029mW Z1i+p8P6+W4rKGxb3iJa9LC9BrHB+2LYMCYwXuNhyfkD2/CrIPQyxAFZbKEQnrVsXmu8 9TMjWJYjj7IrTOzMXFItvy+zIu/bxp+fmyLG/NO6NBvQjTIpfXP5c5H8xemhBb9Bz1qp qk10RRH2tOfOw2sLTfNnWXvlrK1VkFb5fTgVPJBfpBOZk7DOUPRxwyPvVkkWKnf1tZF2 yEWtnjOQkZrbWWryNIUDVTCcfHRNOZgnLIAEIWlRusVgcKPEkDuhd4M906rDCnpnlG/2 8PmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=o4RN9MTz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id du3-20020a17090772c300b00734be0d7167si13951818ejc.825.2022.10.19.03.51.46; Wed, 19 Oct 2022 03:52: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=o4RN9MTz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234499AbiJSKvE (ORCPT + 99 others); Wed, 19 Oct 2022 06:51:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234461AbiJSKtI (ORCPT ); Wed, 19 Oct 2022 06: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 7301D15B10E; Wed, 19 Oct 2022 03:22: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 26AF8B8243B; Wed, 19 Oct 2022 08:58:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89504C433C1; Wed, 19 Oct 2022 08:58:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169937; bh=0K8Eh27XHKqAs98g3zdjIXZsn+TFmlDapxIa+Nv0jCU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o4RN9MTzWj4/pgCiWC+kJ1wvYtoVcHzCpPG3DO18FNTzLQKXn4GD56FvaYhBAroLj el7TSG+mz9cLd8JtTV8nnWRl4YvdfBgqKp5aCiyMAnafHUYUy5V0k6ZJWk/Qk06b24 1Is607h0xs1w1AiqLiNfDRI6s1f+RQwfOEvRcZdo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aharon Landau , Leon Romanovsky , Sasha Levin Subject: [PATCH 6.0 465/862] RDMA/mlx5: Dont compare mkey tags in DEVX indirect mkey Date: Wed, 19 Oct 2022 10:29:12 +0200 Message-Id: <20221019083310.526227733@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112931275277848?= X-GMAIL-MSGID: =?utf-8?q?1747112931275277848?= From: Aharon Landau [ Upstream commit 13ad1125b941a5f257d9d3ae70485773abd34792 ] According to the ib spec: If the CI supports the Base Memory Management Extensions defined in this specification, the L_Key format must consist of: 24 bit index in the most significant bits of the R_Key, and 8 bit key in the least significant bits of the R_Key Through a successful Allocate L_Key verb invocation, the CI must let the consumer own the key portion of the returned R_Key Therefore, when creating a mkey using DEVX, the consumer is allowed to change the key part. The kernel should compare only the index part of a R_Key to determine equality with another R_Key. Adding capability in order not to break backward compatibility. Fixes: 534fd7aac56a ("IB/mlx5: Manage indirection mkey upon DEVX flow for ODP") Link: https://lore.kernel.org/r/3d669aacea85a3a15c3b3b953b3eaba3f80ef9be.1659255945.git.leonro@nvidia.com Signed-off-by: Aharon Landau Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin --- drivers/infiniband/hw/mlx5/main.c | 3 +++ drivers/infiniband/hw/mlx5/odp.c | 3 ++- include/uapi/rdma/mlx5-abi.h | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c index 883d7c60143e..1aa0c772b44d 100644 --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c @@ -1826,6 +1826,9 @@ static int set_ucontext_resp(struct ib_ucontext *uctx, if (MLX5_CAP_GEN(dev->mdev, drain_sigerr)) resp->comp_mask |= MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_SQD2RTS; + resp->comp_mask |= + MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_MKEY_UPDATE_TAG; + return 0; } diff --git a/drivers/infiniband/hw/mlx5/odp.c b/drivers/infiniband/hw/mlx5/odp.c index e305bf1dc6c2..901a8b030236 100644 --- a/drivers/infiniband/hw/mlx5/odp.c +++ b/drivers/infiniband/hw/mlx5/odp.c @@ -795,7 +795,8 @@ static bool mkey_is_eq(struct mlx5_ib_mkey *mmkey, u32 key) { if (!mmkey) return false; - if (mmkey->type == MLX5_MKEY_MW) + if (mmkey->type == MLX5_MKEY_MW || + mmkey->type == MLX5_MKEY_INDIRECT_DEVX) return mlx5_base_mkey(mmkey->key) == mlx5_base_mkey(key); return mmkey->key == key; } diff --git a/include/uapi/rdma/mlx5-abi.h b/include/uapi/rdma/mlx5-abi.h index 86be4a92b67b..a96b7d2770e1 100644 --- a/include/uapi/rdma/mlx5-abi.h +++ b/include/uapi/rdma/mlx5-abi.h @@ -104,6 +104,7 @@ enum mlx5_ib_alloc_ucontext_resp_mask { MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_ECE = 1UL << 2, MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_SQD2RTS = 1UL << 3, MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_REAL_TIME_TS = 1UL << 4, + MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_MKEY_UPDATE_TAG = 1UL << 5, }; enum mlx5_user_cmds_supp_uhw { From patchwork Wed Oct 19 08:29:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4749 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214581wrs; Wed, 19 Oct 2022 02:13:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM41Ilp+dKHtDP0RJVf5A04Hd7pa4x2f1gUz/FOaK1OvhxgyroE9bkSR32zHoKajquhWeL41 X-Received: by 2002:a17:907:9707:b0:78d:45d1:487e with SMTP id jg7-20020a170907970700b0078d45d1487emr5840524ejc.566.1666170795658; Wed, 19 Oct 2022 02:13:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170795; cv=none; d=google.com; s=arc-20160816; b=WdjhsgpJa9ZNOlc5S8IiGv5yUm3w+A4aW+nFlYcjLIHO5L+jTsFZvINCzCc9u3H853 OS7ad4Jcgfh3E+xyVIV9AMpeinMuFsadbG5MuuO8wlhjZrFhRIya6bc4IpPFbpAc74/L p/SMkqfd8FicaNeKtSgnG16ewrjYuPsZUnr6fQ1c3iPVUJWYnmhy8d5+vPoCS3iWgZNH tXRy/fwrjA0OXJFHdwP4tKWg3fqe7zVo8EpUHmNnsfAyY5jVYiL0kDMQ/LEOccohkNj/ DqxIuMf9reaeGOHLojX4vl+Lfm5gn80CAY/KQ25fBtkUU0K74IjUGQymcLkg4lWPQuHf oIVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jdZiBaCeF9mCiki6kMeIA0wm870tuHE/M0LywtC3ZDU=; b=N73qCA/+yREMcd0hMH56RKODlWPD+iGjmel6epgL9f8kiNuB0+0mBpo95aqlTdy9R7 F3niEQwg/X1NGgZ+qD28mMQ1twCX8A55XvCEdjOKos5XtNpxFLEcE2Zg1qE4sGccAUnw kYBAaE0qJAoUpmTlNSQSF6Cdzt5kOQgWBhambwk9l7cz2BZSgZlLKqp2thismoarWTCP B/76hmlWsGgquZ5DYT6AZrnh9ZTujubOsXbg12/wDZiq3BJlvVPDZuAWSM7veJ3nspWD NSiNzjDPJ7G3jh9s+w5wO6xcY9SZ9ndFdqxLdR74XYopbxA5uJJNW9sRNuCI4Y35kdlL uWRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PN11t2Ir; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a1709063a1100b0078dcbd7d244si12090958eje.376.2022.10.19.02.12.50; Wed, 19 Oct 2022 02:13: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=PN11t2Ir; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232828AbiJSJL3 (ORCPT + 99 others); Wed, 19 Oct 2022 05:11:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232698AbiJSJIx (ORCPT ); Wed, 19 Oct 2022 05:08:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C31232124C; Wed, 19 Oct 2022 02:00: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 196336186A; Wed, 19 Oct 2022 08:59:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2B4EDC433D6; Wed, 19 Oct 2022 08:59:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169940; bh=JzLGeM6MnEL8NtCa+37sOxVlXwkKAQTWwUnH0CUDFaE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PN11t2IrZSkKqsGSImnrX3SNXe4m0HJhZDQohGpj37xA2C2g45BSIaDWlYSkoC1Au hK8oqcpajz5UHKyHJltWU7BzAcoGpnHihaf3TiB2/kbaH6kd0bznhyIlDmiGuYcWb6 r+7eyUkHe9Mt/HYxwBsphqXAoPEn3dcFScC64E3s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chunfeng Yun , Christophe JAILLET , Sasha Levin Subject: [PATCH 6.0 466/862] usb: common: usb-conn-gpio: Simplify some error message Date: Wed, 19 Oct 2022 10:29:13 +0200 Message-Id: <20221019083310.563809290@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106708171397089?= X-GMAIL-MSGID: =?utf-8?q?1747106708171397089?= From: Christophe JAILLET [ Upstream commit d80f4ecb95270d0ecd6646aca44f4c180d3140b0 ] dev_err_probe() already prints the error code in a human readable way, so there is no need to duplicate it as a numerical value at the end of the message. Reviewed-by: Chunfeng Yun Signed-off-by: Christophe JAILLET Link: https://lore.kernel.org/r/7505a9dfa1e097070c492d6f6f84afa2a490b040.1659763173.git.christophe.jaillet@wanadoo.fr Signed-off-by: Greg Kroah-Hartman Stable-dep-of: b6155eaf6b05 ("usb: common: debug: Check non-standard control requests") Signed-off-by: Sasha Levin --- drivers/usb/common/usb-conn-gpio.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/usb/common/usb-conn-gpio.c b/drivers/usb/common/usb-conn-gpio.c index b39c9f1c375d..e20874caba36 100644 --- a/drivers/usb/common/usb-conn-gpio.c +++ b/drivers/usb/common/usb-conn-gpio.c @@ -208,10 +208,8 @@ static int usb_conn_probe(struct platform_device *pdev) if (PTR_ERR(info->vbus) == -ENODEV) info->vbus = NULL; - if (IS_ERR(info->vbus)) { - ret = PTR_ERR(info->vbus); - return dev_err_probe(dev, ret, "failed to get vbus :%d\n", ret); - } + if (IS_ERR(info->vbus)) + return dev_err_probe(dev, PTR_ERR(info->vbus), "failed to get vbus\n"); info->role_sw = usb_role_switch_get(dev); if (IS_ERR(info->role_sw)) From patchwork Wed Oct 19 08:29:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5123 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp251336wrs; Wed, 19 Oct 2022 03:51:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4detufSOIrJYkgUKpgk6vn/v9OJTmOaVOtFK+7NY8R/kYpmjyhpo2jzV4+TujfT6JGEZDn X-Received: by 2002:a17:907:802:b0:781:8017:b2df with SMTP id wv2-20020a170907080200b007818017b2dfmr6159882ejb.606.1666176689907; Wed, 19 Oct 2022 03:51:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176689; cv=none; d=google.com; s=arc-20160816; b=HuS6j3vzFBQ6LN3DPdAsqE6rnvQabzwDV3PVjAcvzuRA7bba6ShbdcJhzEDhBEBzTQ ZjpfXIP8jW7ixWlALEiEwiPAgSO0GS6pfwmbTvE3Uwn+ZiPTEx1AVJRhia7mPnFKgR++ 3mdZqHmPyqk/FkHoICEy+NfC84zz44KtCIA2VHlrAs5FqkktcSDj5ckznuXfaUDc/C2O INwEUXZSkYtWu5v4pVVWwWSO34UQebDWHBQqx7LsHHRhCLfCIa4pyPxKuuwooyBk5SDz sA3pS6/dH1g25imYHWb37joP56VxheVY+1pex79R3oktGZS9WeWhhprHSkMgI6nudP21 xVSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=a6OXrutsy4iiEAR4LZgS+vLZK2oF+SHofZwrfhghfjY=; b=oLfCLAngly2PIhPCDX3zChayyP8yUhLMR5IjOVl6GkdKAv/SSWj3jmbsqZ777yDNRS bUTKARwt0i/+9guj0CMsDLh4zAzgcQq99DT5Tr5Rq+C4F6aEyF+U05N+f7goMCkkIWW4 mTBOnIFA/jawHrNu5Fal+jKbYTGey/edIUe8xW3oIOTFTZKx0reeNQDdqX9hkvvLEFwK MRcugJAYhpmHQp+bgFAwL7VnzmHszBaqZTn/LJ09ntIx3YxpE6xGoTw/P4S9nwgaBYWO z8XZnoWM1fuRNKieTA+ZovqjKc/4WaFbciITdJTh8mjAxhX1AIQ9MVqTORGZnKGxiuHH SVaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Wu5wWAaP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t8-20020a1709066bc800b0073d61f9a7b6si10975261ejs.263.2022.10.19.03.51.05; Wed, 19 Oct 2022 03: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=Wu5wWAaP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234028AbiJSKuT (ORCPT + 99 others); Wed, 19 Oct 2022 06:50:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233935AbiJSKru (ORCPT ); Wed, 19 Oct 2022 06:47: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 1150D11D9AA; Wed, 19 Oct 2022 03:21: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 63599B82431; Wed, 19 Oct 2022 08:59:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CBD6FC433D6; Wed, 19 Oct 2022 08:59:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169943; bh=qI6XQaN06IuKoof2ZGO7xbX8GPjKLgwHHsphrLlDk3M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wu5wWAaPjS2AhIGiAhQbkkd25qbqU43dydHTYMMEWDQOU9IiUlfGJWXBVUN6LRUFt PU/JYpGbm14piAmEMkWd0I2+PfoY6Sp1/gO8TMfUbzYWpD+LsV3Bd/Vzm48OKjW3Nt vkZitIqe8Fsw11hJ7t1NCEcXku33X2nECFoCvUqU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thinh Nguyen , Sasha Levin Subject: [PATCH 6.0 467/862] usb: common: debug: Check non-standard control requests Date: Wed, 19 Oct 2022 10:29:14 +0200 Message-Id: <20221019083310.617014892@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112888772501397?= X-GMAIL-MSGID: =?utf-8?q?1747112888772501397?= From: Thinh Nguyen [ Upstream commit b6155eaf6b05e558218b44b88a6cad03f15a586c ] Previously usb_decode_ctrl() only decodes standard control requests, but it was used for non-standard requests also. If it's non-standard or unknown standard bRequest, print the Setup data values. Fixes: af32423a2d86 ("usb: dwc3: trace: decode ctrl request") Signed-off-by: Thinh Nguyen Link: https://lore.kernel.org/r/8d6a30f2f2f953eff833a5bc5aac640a4cc2fc9f.1658971571.git.Thinh.Nguyen@synopsys.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/common/debug.c | 96 +++++++++++++++++++++++++------------- 1 file changed, 64 insertions(+), 32 deletions(-) diff --git a/drivers/usb/common/debug.c b/drivers/usb/common/debug.c index 075f6b1b2a1a..f204cec8d380 100644 --- a/drivers/usb/common/debug.c +++ b/drivers/usb/common/debug.c @@ -208,30 +208,28 @@ static void usb_decode_set_isoch_delay(__u8 wValue, char *str, size_t size) snprintf(str, size, "Set Isochronous Delay(Delay = %d ns)", wValue); } -/** - * usb_decode_ctrl - Returns human readable representation of control request. - * @str: buffer to return a human-readable representation of control request. - * This buffer should have about 200 bytes. - * @size: size of str buffer. - * @bRequestType: matches the USB bmRequestType field - * @bRequest: matches the USB bRequest field - * @wValue: matches the USB wValue field (CPU byte order) - * @wIndex: matches the USB wIndex field (CPU byte order) - * @wLength: matches the USB wLength field (CPU byte order) - * - * Function returns decoded, formatted and human-readable description of - * control request packet. - * - * The usage scenario for this is for tracepoints, so function as a return - * use the same value as in parameters. This approach allows to use this - * function in TP_printk - * - * Important: wValue, wIndex, wLength parameters before invoking this function - * should be processed by le16_to_cpu macro. - */ -const char *usb_decode_ctrl(char *str, size_t size, __u8 bRequestType, - __u8 bRequest, __u16 wValue, __u16 wIndex, - __u16 wLength) +static void usb_decode_ctrl_generic(char *str, size_t size, __u8 bRequestType, + __u8 bRequest, __u16 wValue, __u16 wIndex, + __u16 wLength) +{ + u8 recip = bRequestType & USB_RECIP_MASK; + u8 type = bRequestType & USB_TYPE_MASK; + + snprintf(str, size, + "Type=%s Recipient=%s Dir=%s bRequest=%u wValue=%u wIndex=%u wLength=%u", + (type == USB_TYPE_STANDARD) ? "Standard" : + (type == USB_TYPE_VENDOR) ? "Vendor" : + (type == USB_TYPE_CLASS) ? "Class" : "Unknown", + (recip == USB_RECIP_DEVICE) ? "Device" : + (recip == USB_RECIP_INTERFACE) ? "Interface" : + (recip == USB_RECIP_ENDPOINT) ? "Endpoint" : "Unknown", + (bRequestType & USB_DIR_IN) ? "IN" : "OUT", + bRequest, wValue, wIndex, wLength); +} + +static void usb_decode_ctrl_standard(char *str, size_t size, __u8 bRequestType, + __u8 bRequest, __u16 wValue, __u16 wIndex, + __u16 wLength) { switch (bRequest) { case USB_REQ_GET_STATUS: @@ -272,14 +270,48 @@ const char *usb_decode_ctrl(char *str, size_t size, __u8 bRequestType, usb_decode_set_isoch_delay(wValue, str, size); break; default: - snprintf(str, size, "%02x %02x %02x %02x %02x %02x %02x %02x", - bRequestType, bRequest, - (u8)(cpu_to_le16(wValue) & 0xff), - (u8)(cpu_to_le16(wValue) >> 8), - (u8)(cpu_to_le16(wIndex) & 0xff), - (u8)(cpu_to_le16(wIndex) >> 8), - (u8)(cpu_to_le16(wLength) & 0xff), - (u8)(cpu_to_le16(wLength) >> 8)); + usb_decode_ctrl_generic(str, size, bRequestType, bRequest, + wValue, wIndex, wLength); + break; + } +} + +/** + * usb_decode_ctrl - Returns human readable representation of control request. + * @str: buffer to return a human-readable representation of control request. + * This buffer should have about 200 bytes. + * @size: size of str buffer. + * @bRequestType: matches the USB bmRequestType field + * @bRequest: matches the USB bRequest field + * @wValue: matches the USB wValue field (CPU byte order) + * @wIndex: matches the USB wIndex field (CPU byte order) + * @wLength: matches the USB wLength field (CPU byte order) + * + * Function returns decoded, formatted and human-readable description of + * control request packet. + * + * The usage scenario for this is for tracepoints, so function as a return + * use the same value as in parameters. This approach allows to use this + * function in TP_printk + * + * Important: wValue, wIndex, wLength parameters before invoking this function + * should be processed by le16_to_cpu macro. + */ +const char *usb_decode_ctrl(char *str, size_t size, __u8 bRequestType, + __u8 bRequest, __u16 wValue, __u16 wIndex, + __u16 wLength) +{ + switch (bRequestType & USB_TYPE_MASK) { + case USB_TYPE_STANDARD: + usb_decode_ctrl_standard(str, size, bRequestType, bRequest, + wValue, wIndex, wLength); + break; + case USB_TYPE_VENDOR: + case USB_TYPE_CLASS: + default: + usb_decode_ctrl_generic(str, size, bRequestType, bRequest, + wValue, wIndex, wLength); + break; } return str; From patchwork Wed Oct 19 08:29:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4744 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214472wrs; Wed, 19 Oct 2022 02:12:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM560sadVnGpm5Ii85xmNgSB8U07fSjllnXdVslRL0eqIVlzZjGp8kQY/ETMnLBNa1dRGkSJ X-Received: by 2002:a05:6402:3641:b0:45c:4231:ddcc with SMTP id em1-20020a056402364100b0045c4231ddccmr6423345edb.224.1666170775013; Wed, 19 Oct 2022 02:12:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170775; cv=none; d=google.com; s=arc-20160816; b=NC90qAUKISAq9VAHeV579J3OZIs9Z+6Hy/Fdz6LIs3PnhG/XeGr6UKc3GQ3tSJinev 3YCKCsbvcZdj8WR+sT/ToTLUcuCY4oN0Y1zRC9GGAFR0EIhvE/FV2fhNJPlu2qqWEMvI 012jCaZREbevutQDCXUALsXXuCmogYChbdFXh/RS7q8BfSvwWqAnF4YPV80Qw001AjOd N2nSRtOxFea6JeeI8smVlLclID6JdGOXo1U3sLTJOTGeYyhgENMX8CgaOGfx1+7j/wNa qiP5oApr96G7Xmg9SSQb62RH6uH++FmJNnNsVHqvGGpxoW9+tKdrmdr7Rmo+P29Hx8pl w2cA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YepjPZ/t+MCEPPZTFgrI/o/66+Pt4E1x6AtaHKSGv6o=; b=DNWjzibIbDdQCwakVC3B0diayoLonMupBUKwjG8yZiHKTZg4vcNdjgfhnGgNO/8BrI /OeItrRxhiIMY42ScgKypTM5b0zzeWrBbSusaOyW2IpIgdeX8a9VINkGpccOUFTCGE6h vfvSwt5GjuuFv3o2EqECtKa7+mdsEasMe6Yq+8yLpR/OFM9OtL8bqFPWcq06J34+shYG fIKAwCLw51Tngz5Jhi5TCFgubcBcJrVnlSMYzxYke+1hDZRa1mS4SS2Oai2t3dQtnbQJ //c9kR+W3VNdbRYKGygCWu/SQQ5f4/kWZBMMQOXgV+4BCSttGOUJAeYFMcDK06r+T541 YK+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="2E+IRnR/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ay17-20020a170906d29100b00782b261ea21si11136442ejb.729.2022.10.19.02.12.30; Wed, 19 Oct 2022 02:12:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="2E+IRnR/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232600AbiJSJKs (ORCPT + 99 others); Wed, 19 Oct 2022 05:10:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232607AbiJSJHs (ORCPT ); Wed, 19 Oct 2022 05:07:48 -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 EA3A565240; Wed, 19 Oct 2022 02:00:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6264261825; Wed, 19 Oct 2022 08:59:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74CFCC433D6; Wed, 19 Oct 2022 08:59:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169945; bh=iyKhAeS+fL/4paGpY198m4bprWGcYWFl+THorYYK8i8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2E+IRnR/Z3C6WciJO1lT+otRiR+gPJrTO/jinnvZQE0Mls3RbUAqxunEtkGtjfKFP gKqKRE9/oZmNVW5dzNsKurI3NvCSg/bIN8LK3ydmkaeoWDLEsHiIbmmp0yUlvvIO1e 6siISnCvCg2N3bXRhymb9ZumFn0PTi8wdhZcc8rQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Neil Armstrong , Martin Blumenstingl , Stephen Boyd , Sasha Levin Subject: [PATCH 6.0 468/862] clk: meson: Hold reference returned by of_get_parent() Date: Wed, 19 Oct 2022 10:29:15 +0200 Message-Id: <20221019083310.661781345@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106686145206728?= X-GMAIL-MSGID: =?utf-8?q?1747106686145206728?= From: Liang He [ Upstream commit 89ab396d712f7c91fe94f55cff23460426f5fc81 ] We should hold the reference returned by of_get_parent() and use it to call of_node_put() for refcount balance. Fixes: 88e2da81241e ("clk: meson: aoclk: refactor common code into dedicated file") Fixes: 6682bd4d443f ("clk: meson: factorise meson64 peripheral clock controller drivers") Fixes: bb6eddd1d28c ("clk: meson: meson8b: use the HHI syscon if available") Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220628141038.168383-1-windhl@126.com Reviewed-by: Neil Armstrong Reviewed-by: Martin Blumenstingl Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/meson/meson-aoclk.c | 5 ++++- drivers/clk/meson/meson-eeclk.c | 5 ++++- drivers/clk/meson/meson8b.c | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/clk/meson/meson-aoclk.c b/drivers/clk/meson/meson-aoclk.c index 27cd2c1f3f61..434cd8f9de82 100644 --- a/drivers/clk/meson/meson-aoclk.c +++ b/drivers/clk/meson/meson-aoclk.c @@ -38,6 +38,7 @@ int meson_aoclkc_probe(struct platform_device *pdev) struct meson_aoclk_reset_controller *rstc; struct meson_aoclk_data *data; struct device *dev = &pdev->dev; + struct device_node *np; struct regmap *regmap; int ret, clkid; @@ -49,7 +50,9 @@ int meson_aoclkc_probe(struct platform_device *pdev) if (!rstc) return -ENOMEM; - regmap = syscon_node_to_regmap(of_get_parent(dev->of_node)); + np = of_get_parent(dev->of_node); + regmap = syscon_node_to_regmap(np); + of_node_put(np); if (IS_ERR(regmap)) { dev_err(dev, "failed to get regmap\n"); return PTR_ERR(regmap); diff --git a/drivers/clk/meson/meson-eeclk.c b/drivers/clk/meson/meson-eeclk.c index 8d5a5dab955a..0e5e6b57eb20 100644 --- a/drivers/clk/meson/meson-eeclk.c +++ b/drivers/clk/meson/meson-eeclk.c @@ -18,6 +18,7 @@ int meson_eeclkc_probe(struct platform_device *pdev) { const struct meson_eeclkc_data *data; struct device *dev = &pdev->dev; + struct device_node *np; struct regmap *map; int ret, i; @@ -26,7 +27,9 @@ int meson_eeclkc_probe(struct platform_device *pdev) return -EINVAL; /* Get the hhi system controller node */ - map = syscon_node_to_regmap(of_get_parent(dev->of_node)); + np = of_get_parent(dev->of_node); + map = syscon_node_to_regmap(np); + of_node_put(np); if (IS_ERR(map)) { dev_err(dev, "failed to get HHI regmap\n"); diff --git a/drivers/clk/meson/meson8b.c b/drivers/clk/meson/meson8b.c index 8f3b7a94a667..827e78fb16a8 100644 --- a/drivers/clk/meson/meson8b.c +++ b/drivers/clk/meson/meson8b.c @@ -3792,12 +3792,15 @@ static void __init meson8b_clkc_init_common(struct device_node *np, struct clk_hw_onecell_data *clk_hw_onecell_data) { struct meson8b_clk_reset *rstc; + struct device_node *parent_np; const char *notifier_clk_name; struct clk *notifier_clk; struct regmap *map; int i, ret; - map = syscon_node_to_regmap(of_get_parent(np)); + parent_np = of_get_parent(np); + map = syscon_node_to_regmap(parent_np); + of_node_put(parent_np); if (IS_ERR(map)) { pr_err("failed to get HHI regmap - Trying obsolete regs\n"); return; From patchwork Wed Oct 19 08: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: 5114 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp250934wrs; Wed, 19 Oct 2022 03:50:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6spxHnFDG+ry6Z7TXBafyLTTG1Mw4e5C1m4ltRRFVFpxZRl2dYBL0SKby9GYnD8iXc+0bX X-Received: by 2002:a17:906:fe45:b0:791:9624:9ea4 with SMTP id wz5-20020a170906fe4500b0079196249ea4mr6071675ejb.147.1666176624203; Wed, 19 Oct 2022 03:50:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176624; cv=none; d=google.com; s=arc-20160816; b=djmK+jge66g8rzf2UKo/4w54MJtMpt276+gJi1fKB3IzdVUqfeoR3OM6vcv3IZbkKp XQXXtDXdhvk7BpLlNzGHvFkTZsEjAxORauDBZM1HzYV0P9ocvV2KBLlEwGggq0ajL4Y0 8y5OFRoTR/k3DNfSPLuNsD5sGFVja95u1Csx6jI2fDoOPNv2pkwXvzEWXf7WgVZUBiav jErmw1eDPDUBWvw9M/PAQhJ+8wuospZ5u+GEZ0GpJJIdVgwEepqRRx5/C0eMh1QzZL1/ oceAUwAbNmfcUtdbq/eF8zYQO7BhKVhBY+hZHoq+liun7Gn4eHhcPCvFtWabXBFuvjPQ kqPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MK5VI+3GBq8LdKsjE6o7xvZVfSAcQ8o/y+v9hNNFJts=; b=MG9cuf6q/yE/IadoTO3ZffK3BoFzgpLnwFRUI+jP9ag+n6qT2u1JNLKCZ1uMwEKF4L 8ZtaPFI4KGI67dR8e4nm6tOA/MaHJbGMgzXYMaePld4LRt0tDLnla1Sh/jZk2kb9Er4C KI22mDxKOFGcnm1EsqA8d6FRSwzROe/R8u1jUnzme35eTrGdG6cje8aOcnkavgLQVuHi Ke9my0jW07TpOwMR6jCp+moetoqTMZqfNci7nFQCFnnH/2pISa0Aa62FpTaG9hid4rgD kL5PZC8NlkPbtjcNYHh0BMwUAR9UYrZxUEXDLJSsduiFTYknhEv0svCSF7/RoJjAemqw K9zQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OerNXwzj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id da3-20020a056402176300b004582354990bsi11727114edb.454.2022.10.19.03.49.57; Wed, 19 Oct 2022 03:50: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=OerNXwzj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234354AbiJSKsr (ORCPT + 99 others); Wed, 19 Oct 2022 06:48:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233412AbiJSKqp (ORCPT ); Wed, 19 Oct 2022 06:46:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40EC311F48B; Wed, 19 Oct 2022 03:21: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 9F253B82440; Wed, 19 Oct 2022 08:59:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E29CC433C1; Wed, 19 Oct 2022 08:59:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169948; bh=mgfxMUrqtSlUZHIjEaaKuLvZ8O/qKzLSst2rHPmyHgE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OerNXwzjif7td4HsVbOdtW9klXGaOhtdyMt40EkYj8JURINlew1rTajrh6Y15Iv9T wlWUsdsLly+Kxoh50TsqmtXlrwwl+0XmjcrwtjwBtsgL0L2+zRbzCqyuGWza87lPAY RLn73Cku1iSegNyryoIEaBKpmK/D5lpvTfkf4hD0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Stephen Boyd , Sasha Levin Subject: [PATCH 6.0 469/862] clk: st: Hold reference returned by of_get_parent() Date: Wed, 19 Oct 2022 10:29:16 +0200 Message-Id: <20221019083310.695992944@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112820307416850?= X-GMAIL-MSGID: =?utf-8?q?1747112820307416850?= From: Liang He [ Upstream commit 429973306f860470cbbb8402c8c53143b450faba ] We should hold the reference returned by of_get_parent() and use it to call of_node_put() for refcount balance. Fixes: 3efe64ef5186 ("clk: st: clkgen-fsyn: search reg within node or parent") Fixes: 810251b0d36a ("clk: st: clkgen-mux: search reg within node or parent") Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220628142416.169808-1-windhl@126.com Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/st/clkgen-fsyn.c | 5 ++++- drivers/clk/st/clkgen-mux.c | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/clk/st/clkgen-fsyn.c b/drivers/clk/st/clkgen-fsyn.c index 582a22c04919..d820292a381d 100644 --- a/drivers/clk/st/clkgen-fsyn.c +++ b/drivers/clk/st/clkgen-fsyn.c @@ -987,6 +987,7 @@ static void __init st_of_quadfs_setup(struct device_node *np, const char *pll_name, *clk_parent_name; void __iomem *reg; spinlock_t *lock; + struct device_node *parent_np; /* * First check for reg property within the node to keep backward @@ -994,7 +995,9 @@ static void __init st_of_quadfs_setup(struct device_node *np, */ reg = of_iomap(np, 0); if (!reg) { - reg = of_iomap(of_get_parent(np), 0); + parent_np = of_get_parent(np); + reg = of_iomap(parent_np, 0); + of_node_put(parent_np); if (!reg) { pr_err("%s: Failed to get base address\n", __func__); return; diff --git a/drivers/clk/st/clkgen-mux.c b/drivers/clk/st/clkgen-mux.c index ee39af7a0b72..596e939ad905 100644 --- a/drivers/clk/st/clkgen-mux.c +++ b/drivers/clk/st/clkgen-mux.c @@ -56,6 +56,7 @@ static void __init st_of_clkgen_mux_setup(struct device_node *np, void __iomem *reg; const char **parents; int num_parents = 0; + struct device_node *parent_np; /* * First check for reg property within the node to keep backward @@ -63,7 +64,9 @@ static void __init st_of_clkgen_mux_setup(struct device_node *np, */ reg = of_iomap(np, 0); if (!reg) { - reg = of_iomap(of_get_parent(np), 0); + parent_np = of_get_parent(np); + reg = of_iomap(parent_np, 0); + of_node_put(parent_np); if (!reg) { pr_err("%s: Failed to get base address\n", __func__); return; From patchwork Wed Oct 19 08: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: 4757 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214715wrs; Wed, 19 Oct 2022 02:13:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5c2OaYzuQiiRGLNofOoHEI0PpMdXd4UOwU0ObM1Y3h3wD7mfSYa6xL+weeGmdgzS4yd6Pd X-Received: by 2002:aa7:c509:0:b0:458:cb1f:b9e1 with SMTP id o9-20020aa7c509000000b00458cb1fb9e1mr6417896edq.369.1666170814490; Wed, 19 Oct 2022 02:13:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170814; cv=none; d=google.com; s=arc-20160816; b=oHKkP2dsmIVVSjIuGonp1O89ioYi9FJDsWWI5ky5PcJ0cG8uXnEoUmxv9II37KWF6D vMaZrEzpnNnG3U6a05hDEOqCRROXOcJqFP5PxgcvGS7qUjUrogC7DbpWjUGCgPLfD6UA f/P2krLYd/53xSqqEFkokhutIX4+J3Rvkh8FCFmN/REgr6fKZ77dKKXtjE0VKxojvzhf nH9rmRHoO8xVukPI2Gv5uykwZam77KGse8m75Tjqk5BMQ27un/ZtiYtyV4wqfsx7bzue T5wqkKQb/uxwe+X1ndKosvKR2bj9iXI1F4JRfeFZi0jjsvpFbl8HCq3S2VXvQaXmPZL5 Wyyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=67YBjDUrOaqwwQhvLBhano/hvSZAX1/tbJxeOYqhBM4=; b=YEQe+CQQegNoIEfX/cxn8g0zXOCSGNlVmmfB5kx+/xP//NmmU3M0k156JCmOXwtjx3 M8Hjo1tHPy7xZV4MahUhiUrxjst3PLULumQeAz3mFxjbwXbzOx3Y8uPdKvp9luoUcok1 +0wND9Vp8EvIn8vJIWE9FoqvLehc1RouYJ1vjv5lNoNxPSd8Ukyf40kO6on0XrxAOkbY Vru2abX/uiux9ICLgWv9SqB05C/94dg+5Sf0CfLnhenrQGKBnX3uTh3hwCu8lfUp2INV YK6wJhijMpiKOugidwLfYMfdWqsceZqAl+DiSj0RPmWEMg5TqCidon+Hucjv3GATxrTF idZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aPNOvDMf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f14-20020a056402354e00b00457dcfa56cbsi15945674edd.343.2022.10.19.02.13.10; Wed, 19 Oct 2022 02:13:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aPNOvDMf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232771AbiJSJLL (ORCPT + 99 others); Wed, 19 Oct 2022 05:11:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232649AbiJSJIP (ORCPT ); Wed, 19 Oct 2022 05:08:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE93C6705D; Wed, 19 Oct 2022 02:00: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 D95516186B; Wed, 19 Oct 2022 08:59:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5FCCC433C1; Wed, 19 Oct 2022 08:59:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169951; bh=YJMbba9RS1wYiGgs1JTsRQFq9wLF0YY2JGinQe5+YHA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aPNOvDMfhBlFzGtHQNDLmzb8rdxG1QNoFMVnMKhaEk698kmTpniTxO6YXdA/v6q+b gumrBHG1/nE3J0bwzPZVGRlEe5gdQ7YbVVEV2uodgg9+vTblFiPcKdrXgz25HrAJnF gFNEjLS0XfcSAmbXeLsTPj7ufDmA8Nwg6MsMfN2I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Stephen Boyd , Sasha Levin Subject: [PATCH 6.0 470/862] clk: oxnas: Hold reference returned by of_get_parent() Date: Wed, 19 Oct 2022 10:29:17 +0200 Message-Id: <20221019083310.736073687@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106728329505977?= X-GMAIL-MSGID: =?utf-8?q?1747106728329505977?= From: Liang He [ Upstream commit 1d6aa08c54cd0e005210ab8e3b1e92ede70f8a4f ] In oxnas_stdclk_probe(), we need to hold the reference returned by of_get_parent() and use it to call of_node_put() for refcount balance. Fixes: 0bbd72b4c64f ("clk: Add Oxford Semiconductor OXNAS Standard Clocks") Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220628143155.170550-1-windhl@126.com Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/clk-oxnas.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/clk/clk-oxnas.c b/drivers/clk/clk-oxnas.c index cda5e258355b..584e293156ad 100644 --- a/drivers/clk/clk-oxnas.c +++ b/drivers/clk/clk-oxnas.c @@ -207,7 +207,7 @@ static const struct of_device_id oxnas_stdclk_dt_ids[] = { static int oxnas_stdclk_probe(struct platform_device *pdev) { - struct device_node *np = pdev->dev.of_node; + struct device_node *np = pdev->dev.of_node, *parent_np; const struct oxnas_stdclk_data *data; struct regmap *regmap; int ret; @@ -215,7 +215,9 @@ static int oxnas_stdclk_probe(struct platform_device *pdev) data = of_device_get_match_data(&pdev->dev); - regmap = syscon_node_to_regmap(of_get_parent(np)); + parent_np = of_get_parent(np); + regmap = syscon_node_to_regmap(parent_np); + of_node_put(parent_np); if (IS_ERR(regmap)) { dev_err(&pdev->dev, "failed to have parent regmap\n"); return PTR_ERR(regmap); From patchwork Wed Oct 19 08:29:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5122 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp251303wrs; Wed, 19 Oct 2022 03:51:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM79Y5P+TTJKtUIpB2+N3mOB31BBY9U9OpE0BhyYs892bDVRth+hzTmOStKq4AgHAXjiAsOr X-Received: by 2002:a50:fb0f:0:b0:458:df03:c3aa with SMTP id d15-20020a50fb0f000000b00458df03c3aamr6678500edq.83.1666176684502; Wed, 19 Oct 2022 03:51:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176684; cv=none; d=google.com; s=arc-20160816; b=AGN1jFceK5bYFNbu/CnuMGRPoOnl57vqFrojjsgZ14FSZGnF8oDrlEZg00m989Qh9S NMyo3BWnl7ZWlHFgFM8d0DkChYokKtHAwS++faT48r6/hQn0zJqf2uAA4gMDF1u4kQhD ETJqZJo1q9KOarLQXIpmsyfjqBPCOp8TSpL0pDwLWTWECfiqyuVAImJEh8MDhG6xuZKF NzmZJOeJq+Q5Y0LcSIWTAtId7F0lRVa2XD472nyRcRyi5JTaksDgHfEGeK5u2c8PF2Yo KCSVpzHwnJhDrXYrzLJGk7M7QLDP5h3uJWCwKCsU38+KgoSOzfRAr4XjN2Y1EadeaI+h vQig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sa80NSPQSaH4bfWbBGrqekGf6W5J0b4651s/9jV0G48=; b=umbq8TUxny/EKw5TNgkGnKw+4mKwTPyI/W0ffaevrN7MqiBHh1aj/Z+NMo2Ug2L4MF FwicU9clSHpX5oBj5Uyp4WG0GGzm7iWpA9/f/KqpWfJzfLKJLnqK2n1IJzSvAc+8hM8Q keEk5NRni9VTLjjGaw0y0O6CPz+Ddsf4sLfT2et1EodH72KMplibRVmAvD9wRWGKj+cW Pc6uJ/u9xeQYF4wBq1zVEKa+RcRvet191DWpxzFwWj4ve9QzHbdb8vsZKo+60vQ0VYRe OFOp+UkhUfb5Vejafv1oiUJnBqmH77yg/0j0/LY+o1ITrcvylRKvvcprMPYOyHldzL5/ FWiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wVvvzOBN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u3-20020a50eac3000000b0045166555fddsi11747368edp.481.2022.10.19.03.50.59; Wed, 19 Oct 2022 03:51: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=wVvvzOBN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233707AbiJSKuL (ORCPT + 99 others); Wed, 19 Oct 2022 06:50:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233864AbiJSKrq (ORCPT ); Wed, 19 Oct 2022 06:47:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AD651187A5; Wed, 19 Oct 2022 03:21: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 ams.source.kernel.org (Postfix) with ESMTPS id 36879B8243F; Wed, 19 Oct 2022 08:59:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8EEA3C433C1; Wed, 19 Oct 2022 08:59:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169953; bh=OIJs8jEJDlE4X49d2dwxy8tysOIHP5M9KVrpH9pEbiM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wVvvzOBNQSnweW58/cFx7Ld1eHYn7++Sjjtg1rVrT1fONVjfaftoYXEUOP4iGqOfC cDBGMhzADzShvmAQ/kkuQ/OXva0wQLDjhu8Ez2GJ6GHQbPQR/rVneXRCU2fLpAeu7p Y8Korr/5I4dkaY/ce4lyNeOmk62hd8/bX/D+kgGQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Stephen Boyd , Sasha Levin Subject: [PATCH 6.0 471/862] clk: qoriq: Hold reference returned by of_get_parent() Date: Wed, 19 Oct 2022 10:29:18 +0200 Message-Id: <20221019083310.780397939@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112882949382197?= X-GMAIL-MSGID: =?utf-8?q?1747112882949382197?= From: Liang He [ Upstream commit a8ea4273bc26256ce3cce83164f0f51c5bf6e127 ] In legacy_init_clockgen(), we need to hold the reference returned by of_get_parent() and use it to call of_node_put() for refcount balance. Beside, in create_sysclk(), we need to call of_node_put() on 'sysclk' also for refcount balance. Fixes: 0dfc86b3173f ("clk: qoriq: Move chip-specific knowledge into driver") Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220628143851.171299-1-windhl@126.com Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/clk-qoriq.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/clk/clk-qoriq.c b/drivers/clk/clk-qoriq.c index 88898b97a443..5eddb9f0d6bd 100644 --- a/drivers/clk/clk-qoriq.c +++ b/drivers/clk/clk-qoriq.c @@ -1063,8 +1063,13 @@ static void __init _clockgen_init(struct device_node *np, bool legacy); */ static void __init legacy_init_clockgen(struct device_node *np) { - if (!clockgen.node) - _clockgen_init(of_get_parent(np), true); + if (!clockgen.node) { + struct device_node *parent_np; + + parent_np = of_get_parent(np); + _clockgen_init(parent_np, true); + of_node_put(parent_np); + } } /* Legacy node */ @@ -1159,6 +1164,7 @@ static struct clk * __init create_sysclk(const char *name) sysclk = of_get_child_by_name(clockgen.node, "sysclk"); if (sysclk) { clk = sysclk_from_fixed(sysclk, name); + of_node_put(sysclk); if (!IS_ERR(clk)) return clk; } From patchwork Wed Oct 19 08: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: 5134 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp251814wrs; Wed, 19 Oct 2022 03:52:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4+Lh1qDHCoueSJiG5NcNEEO5AVbwDkW8ecpp7Ucef1As1LtmG8QEb/3xORzlsF06XAtyP3 X-Received: by 2002:a17:906:5dae:b0:78e:3109:36d1 with SMTP id n14-20020a1709065dae00b0078e310936d1mr6234045ejv.470.1666176764935; Wed, 19 Oct 2022 03:52:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176764; cv=none; d=google.com; s=arc-20160816; b=KRQVDaJ3KBPwKfKhZONfG5EDBgLJTUzAgbfUN5AkGrA1hzXe5v2hOoA+/CN0IZzqqs kGNGrnLr3pjHXmP9PX2OVeGkVmpbCTQH81IoOYm/mVWnhH1C76L9EU2hKrVazDICOcgP 8hYwR++35TfeB39hGDQ+e8EGAGKE58hF59lFUKvBpje0xFD7rkarj3prEEz9ZttqPMxz wA+RdBZs4gHWWNDc64kmijvO8Jp+kPxYbpMUNCBRvLxHb+pT2FTIQ9VrCnP3THlA3qHC UpTraWoK2KW+q6CDMnJuwJvyyVIBVWYgq4MLW1eHCqt8oZH+l2EA70kltkZwCfTzprAV 3e5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=eUkHvBttQaI6RxRBPfjIsjMYp6pz05z4rUI/rZUDaCc=; b=q0h0XGt1O0XQC/sZYtX1T9KrMxBfVGKvJh//q0BTOXfY1t+rZK1kzwkaXPxHT7qCbq wW8ga4PkpcMi6mCB41ELUCoWwIp6T0z2YyuqRaokN40lVtOQRsAlGVXaM6Tvf8/p1f55 mPSCEyd4MQ/F9KqYhzN+Xn4SIrHAlqGs9iax0zWfi81FXW7rVo7ay/BgKWL5vljiPKgV sGRrSNjV9GSx+34jBcKr29spRH3Wp35wvkB8eMs6pVjhJh81bEBPOzVEwT5pWiy3YIKH B54BB2SKDKUB5GhGzgIerfn1bUrzZ1YegwMl9gyITHpfJfbmIcRIvLwy6gGQgwBM9FVr AxfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KFOwIjuT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dv1-20020a170906b80100b0073c14b6560bsi12536016ejb.177.2022.10.19.03.52.20; Wed, 19 Oct 2022 03:52: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=KFOwIjuT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234470AbiJSKtK (ORCPT + 99 others); Wed, 19 Oct 2022 06:49:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233512AbiJSKrE (ORCPT ); Wed, 19 Oct 2022 06:47: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 7CD12A6C1D; Wed, 19 Oct 2022 03:21: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 C8F64B82443; Wed, 19 Oct 2022 08:59:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2DD30C433D6; Wed, 19 Oct 2022 08:59:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169956; bh=aMhgMqMGgRl1+zscEHQn3kdfGb1OaQRYRmBXmXDblFE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KFOwIjuTKfgVtPU+CDIhcZexDqs9QTNfH79T5s+eelDTrY33bZWTIr+I7Oy2caTVM nQa7si5xwc2b1ZORTpKxyQ8c+QJEAbAeS/BWBJHqxECnLfwvN5TbaCPN3GBGS+z1oe u6uAm3T0fFChHVCDXDA/1CUFl4uN8pUqto+vfPPo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Stephen Boyd , Sasha Levin Subject: [PATCH 6.0 472/862] clk: berlin: Add of_node_put() for of_get_parent() Date: Wed, 19 Oct 2022 10:29:19 +0200 Message-Id: <20221019083310.820792702@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112967330496324?= X-GMAIL-MSGID: =?utf-8?q?1747112967330496324?= From: Liang He [ Upstream commit 37c381b812dcbfde9c3f1f3d3e75fdfc1b40d5bc ] In berlin2_clock_setup() and berlin2q_clock_setup(), we need to call of_node_put() for the reference returned by of_get_parent() which has increased the refcount. We should call *_put() in fail path or when it is not used anymore. Fixes: 26b3b6b959b2 ("clk: berlin: prepare simple-mfd conversion") Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220708084900.311684-1-windhl@126.com Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/berlin/bg2.c | 5 ++++- drivers/clk/berlin/bg2q.c | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/clk/berlin/bg2.c b/drivers/clk/berlin/bg2.c index bccdfa00fd37..67a9edbba29c 100644 --- a/drivers/clk/berlin/bg2.c +++ b/drivers/clk/berlin/bg2.c @@ -500,12 +500,15 @@ static void __init berlin2_clock_setup(struct device_node *np) int n, ret; clk_data = kzalloc(struct_size(clk_data, hws, MAX_CLKS), GFP_KERNEL); - if (!clk_data) + if (!clk_data) { + of_node_put(parent_np); return; + } clk_data->num = MAX_CLKS; hws = clk_data->hws; gbase = of_iomap(parent_np, 0); + of_node_put(parent_np); if (!gbase) return; diff --git a/drivers/clk/berlin/bg2q.c b/drivers/clk/berlin/bg2q.c index e9518d35f262..dd2784bb75b6 100644 --- a/drivers/clk/berlin/bg2q.c +++ b/drivers/clk/berlin/bg2q.c @@ -286,19 +286,23 @@ static void __init berlin2q_clock_setup(struct device_node *np) int n, ret; clk_data = kzalloc(struct_size(clk_data, hws, MAX_CLKS), GFP_KERNEL); - if (!clk_data) + if (!clk_data) { + of_node_put(parent_np); return; + } clk_data->num = MAX_CLKS; hws = clk_data->hws; gbase = of_iomap(parent_np, 0); if (!gbase) { + of_node_put(parent_np); pr_err("%pOF: Unable to map global base\n", np); return; } /* BG2Q CPU PLL is not part of global registers */ cpupll_base = of_iomap(parent_np, 1); + of_node_put(parent_np); if (!cpupll_base) { pr_err("%pOF: Unable to map cpupll base\n", np); iounmap(gbase); From patchwork Wed Oct 19 08: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: 4826 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223522wrs; Wed, 19 Oct 2022 02:37:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5fWNkV6+m6AvPM8Rd6VnkDJUi0bmGrHLQzYGdfa02qfOrYmqcz6dvlB0WoL1ldGM/wjqmS X-Received: by 2002:a17:907:6297:b0:72f:9aad:fcb with SMTP id nd23-20020a170907629700b0072f9aad0fcbmr5921577ejc.161.1666172263441; Wed, 19 Oct 2022 02:37:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172263; cv=none; d=google.com; s=arc-20160816; b=x3h90ETy0QXy5G0CxuXx6e0+4HPhemVwbtmXRwcXcPaH9W8SuuqiwyeCR224HoVEre MQdhoNBSW29AEKN2+jzQRg62NhcnUYRlyZx842wu3KOq3hXQ7Ju+s3uT0EdOX7Taxpvj uCGtE9j/FQQ+kPiG0LYGJhJEhAZxs8l1zsGJS9a3mneYKDMC4SQgyHg92FRAg+bNPYNR Z08wbJ9ryK8+LwEOSgovsOMgTPWq6fHh44WAFif8az64IDCviWi5jknOp7ogy0HdbFS2 EaKk+EtGyOQhsluWucr3wzDbb+ZpX2hlWHYocMSULVUF/F95IaXJ2QLK/SyTQ/7yh0/6 FwFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4BIP7yCJkEfhe91Lk7KXrUGr2g1NopchynjnoQZ5RxI=; b=j6sFoQEnXqTrab3aI8W9uIdzfdmpQuduUVhJTQvjGlOKwyy5RXDaFGWHF5Lvo2c832 1CTCEFM0I/TtWDDCI/BS5jqoqYdZWR39Q/86ST6LzkPtK31szDsPRcRfRDLm2pPflzhp MGK5jgnACFt/K0c2/6kTUgT+2CGJiCsv1sdKMMQU9ncNDy2lafPVnwGdCn4CZUuirGSC MnbouunlLLoCd7BWZt+tTFlq4P/EWiMdOw+7CD1NkM3mOvhFJXvhfdUbbOlMwq99B5Vg G04M1ryRxVHMkTuqJBaKyWO7YigVauw1pXd1zphFVLHk+DTuXe/klARMEKOHsm1yzzHX IeUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2I+iPwOB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bv24-20020a170906b1d800b0078dc3be6508si12823012ejb.192.2022.10.19.02.37.18; Wed, 19 Oct 2022 02:37: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=2I+iPwOB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233465AbiJSJVo (ORCPT + 99 others); Wed, 19 Oct 2022 05:21:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233722AbiJSJT7 (ORCPT ); Wed, 19 Oct 2022 05:19: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 34C7F62C3; Wed, 19 Oct 2022 02:09:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AC62C617E4; Wed, 19 Oct 2022 08:59:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B958AC433D6; Wed, 19 Oct 2022 08:59:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169959; bh=I0US6l38rqGsDxa7m8QNmS8D7lDmiOG+/urZP2mhyxI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2I+iPwOB50VbUaZIiQoYDHWgVXiBYqPLrl4RRS/rHMsKUUBXptpYF/18mnQkoMd6n JGQGXzPon85NHw6ODkNciYFPqaRLF0YVu7CKTysT1UFAjAeGPgcrdwufTJg5FpDlAb GcU4ITHtkOG8dvZeIa1cXaV/fRYZ16whOWOKDxzw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Orson Zhai , Stephen Boyd , Sasha Levin Subject: [PATCH 6.0 473/862] clk: sprd: Hold reference returned by of_get_parent() Date: Wed, 19 Oct 2022 10:29:20 +0200 Message-Id: <20221019083310.853928608@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108247388911103?= X-GMAIL-MSGID: =?utf-8?q?1747108247388911103?= From: Liang He [ Upstream commit 91e6455bf715fb1558a0bf8f645ec1c131254a3c ] We should hold the reference returned by of_get_parent() and use it to call of_node_put() for refcount balance. Fixes: f95e8c7923d1 ("clk: sprd: support to get regmap from parent node") Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220704004729.272481-1-windhl@126.com Reviewed-by: Orson Zhai Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/sprd/common.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/clk/sprd/common.c b/drivers/clk/sprd/common.c index d620bbbcdfc8..ce81e4087a8f 100644 --- a/drivers/clk/sprd/common.c +++ b/drivers/clk/sprd/common.c @@ -41,7 +41,7 @@ int sprd_clk_regmap_init(struct platform_device *pdev, { void __iomem *base; struct device *dev = &pdev->dev; - struct device_node *node = dev->of_node; + struct device_node *node = dev->of_node, *np; struct regmap *regmap; if (of_find_property(node, "sprd,syscon", NULL)) { @@ -50,9 +50,10 @@ int sprd_clk_regmap_init(struct platform_device *pdev, pr_err("%s: failed to get syscon regmap\n", __func__); return PTR_ERR(regmap); } - } else if (of_device_is_compatible(of_get_parent(dev->of_node), - "syscon")) { - regmap = device_node_to_regmap(of_get_parent(dev->of_node)); + } else if (of_device_is_compatible(np = of_get_parent(node), "syscon") || + (of_node_put(np), 0)) { + regmap = device_node_to_regmap(np); + of_node_put(np); if (IS_ERR(regmap)) { dev_err(dev, "failed to get regmap from its parent.\n"); return PTR_ERR(regmap); From patchwork Wed Oct 19 08: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: 4748 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214570wrs; Wed, 19 Oct 2022 02:13:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4ooY9GGUSMhd8GL+zeUZ8ViW4uzWN/TfqyR+3bEMuG9ZTu/RPfGNU0hllP4Dne4tdL3OuS X-Received: by 2002:a05:6402:496:b0:443:a5f5:d3b with SMTP id k22-20020a056402049600b00443a5f50d3bmr6625065edv.331.1666170792341; Wed, 19 Oct 2022 02:13:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170792; cv=none; d=google.com; s=arc-20160816; b=Tu4zRHzLVVXvPUMlNUn1NxEeIocm0zaTzk3ac8lbPjwvRZTHFS8/wq9khMPLTzzwdU 40A8+CfL4Q1TkRErj766OQpvECOswnx1l8P+4cr3ZG0ZDqB9Gta9qQSyhl2kLtPVMLDc P965cP4heNwpWm05No46GQxyLRNhwWD6xd0svv+rFwsZPb8x60+FD3/tQp/E+pj+LKpY uRrfa/cIQ+B+hPU1Y5vgOGmFpkB7Yo8TRl1HJqa11aIKDPyw9jP7CIfHtuQxPSbFJLtj MvzF7vqsylPQAfeIX/mLXanBXL7aFAzr/Oduv3Y5GSxvzI2tngMx2Nj5I/Z8oiUoHuev LxpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=v/ZrgqJNRCmG5gC4iXQNOPMgM43Q9m+Y/r/ZNKXg19A=; b=ozZEa568bN3n6WFo3R2KScguul965rSKxJN2Vpxx+mQU7G3kzprYbTsERuU9hOLTzO /cZnzsxLgWuAta8RRpE2AsnYe8GxRax1SDd+AvfIKauLhVLDGWdqPBc3x0mp9/Os5+QP D3ZO6k3uo/up65g5JVJXI7wxU2H8U4uLJSM1N6F6alw4BGqkBvWMS5yhSlHZRtYjRdxx pJd86DM+ChFF6Q0/g9CHj2lXQ58Ox6LHf5YT75h/24UPs2q/Q6Q+wahVFp7KHV94m3dN f2wBmlkbMHGeSv7NEtYcuXn2VRR2C9kj+gQT5MYN502cOgJLtnliqmv04p7HOpFYMcYp QU0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="rkwk/nfY"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hz1-20020a1709072ce100b007919165b065si7576381ejc.294.2022.10.19.02.12.47; Wed, 19 Oct 2022 02:13: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="rkwk/nfY"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232625AbiJSJLS (ORCPT + 99 others); Wed, 19 Oct 2022 05:11:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232671AbiJSJIb (ORCPT ); Wed, 19 Oct 2022 05:08:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B87168CC5; Wed, 19 Oct 2022 02:00: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 4A498617E1; Wed, 19 Oct 2022 08:59:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5EB84C433D6; Wed, 19 Oct 2022 08:59:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169961; bh=SyZIbY4zZI5FHErIT/jl+UCVX6Sy/rZJBz9+xeMBpEA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rkwk/nfYxsOQpXjIqDWtX4aNwQMO3FhF0Pgh+xIKU5BCEw8z313MHsZempQFdZISl FcWDdTHjrlQ4CzW44zz9+PrU5b3AHGxQBR3gyk1uOo0CvwrZE3hPQu85t71A0HirXj fnL+uyiX9Dpt5qD+ugoNZYA1bjwv50QcjHZjdHZo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , James Clark , Mathieu Poirier , Sasha Levin Subject: [PATCH 6.0 474/862] coresight: docs: Fix a broken reference Date: Wed, 19 Oct 2022 10:29:21 +0200 Message-Id: <20221019083310.894678603@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106704556044386?= X-GMAIL-MSGID: =?utf-8?q?1747106704556044386?= From: Christophe JAILLET [ Upstream commit b99ee26a1a98a8ac0d8241224c40e6c047091d4d ] Since the commit in Fixes: tag, "coresight-cpu-debug.txt" has been turned into "arm,coresight-cpu-debug.yaml". Update the doc accordingly to avoid a 'make htmldocs' warning Fixes: 66d052047ca8 ("dt-bindings: arm: Convert CoreSight CPU debug to DT schema") Signed-off-by: Christophe JAILLET Reviewed-by: James Clark Link: https://lore.kernel.org/r/c7f864854e9e03916017712017ff59132c51c338.1659251193.git.christophe.jaillet@wanadoo.fr Signed-off-by: Mathieu Poirier Signed-off-by: Sasha Levin --- Documentation/trace/coresight/coresight-cpu-debug.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Documentation/trace/coresight/coresight-cpu-debug.rst b/Documentation/trace/coresight/coresight-cpu-debug.rst index 993dd294b81b..836b35532667 100644 --- a/Documentation/trace/coresight/coresight-cpu-debug.rst +++ b/Documentation/trace/coresight/coresight-cpu-debug.rst @@ -117,7 +117,8 @@ divide into below cases: Device Tree Bindings -------------------- -See Documentation/devicetree/bindings/arm/coresight-cpu-debug.txt for details. +See Documentation/devicetree/bindings/arm/arm,coresight-cpu-debug.yaml for +details. How to use the module From patchwork Wed Oct 19 08: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: 5121 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp251274wrs; Wed, 19 Oct 2022 03:51:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM72icDidzrrH4FmCjHbk/OrM9QdaI9h5K+6hbjkCx+vjQFjpZIJLT8O5hdENq5ymWlDJjjW X-Received: by 2002:a05:6402:3887:b0:458:289e:c9cc with SMTP id fd7-20020a056402388700b00458289ec9ccmr6863935edb.101.1666176672064; Wed, 19 Oct 2022 03:51:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176672; cv=none; d=google.com; s=arc-20160816; b=fu6zBxHJPyEufNU9hyF9vUpsVEKG5CYfxj2Z2W6vO/LXZiQ+vVX9XXSa4S5NdU1JDS QsakstL2gFPjtxm4sVyfTj+t2V8LGjpI0THa8CjvbYJ4MYCDcQe5tWigqPex9j/hkX5i nl2qBr/09LAXv+ekQIrc/I3zBKUmgLcAJHjD9M/d/e54YJTI0uutmmtL2Qkugcz9OhSv qyNSzQsDQVFzCZjUGpOnSvSfRzQ2Rpre0Ua3szS0QYJshMpVrp4esKQvsAk2555eg+UP HiZ2FPb2fz8mKshavopTQt0hhEF1KffKlXfsh07pn5tT7eCP04gqG0Snzt9xSVsY1q0D ANzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jsEfyFQKirU94htMd9BNVsMLlD45vinhDMQosHu/5eY=; b=SPk1EMm4gMxuXmkmpwpLDVJyrKdJXyXgz7vJIcqWpbMy/TYJY+9juZAkYQVfyOFc5B 6FsT4elRpMaFxDGhyrXJNgA7sLmMNCxE2Ox3ICMLYacib6pVTMVOnXqiFK/e3DW0Gcoj +wEPmQlw5JHK+pEZkQ1lUv5bX+V7jW5pyhhGzYo4L6+4ExZF/Z0vlE/N17Ocn+fcwfc0 GTpHtLqXzaXlnl0dB6L95Ui0tTj+y2qTL1bcvdpc4Iz8OMueD9J62gorvYCkndKtnSuk nHduop47LSo9XhjtcUcvtY5fPlAzEpybUdm/vQxXC8jMWwjr7S5H4RJzMIQVpsxC/Sia AlYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yMnP96cb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ka3-20020a170907990300b0078db376206esi11178294ejc.783.2022.10.19.03.50.47; Wed, 19 Oct 2022 03: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=yMnP96cb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231959AbiJSKtx (ORCPT + 99 others); Wed, 19 Oct 2022 06:49:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233513AbiJSKrE (ORCPT ); Wed, 19 Oct 2022 06:47: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 59C3E18380; Wed, 19 Oct 2022 03:21: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 3F991B82444; Wed, 19 Oct 2022 08:59:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC3FFC433C1; Wed, 19 Oct 2022 08:59:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169967; bh=I9d031I2SDmf36pt9nJFhqyJf4Vp12w30552pTi83wQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yMnP96cbx7bvaR2UOr8P5eIw/VszF8L4QhuCtYZeK0cSPH4teg5ShgiYh9+Aya/nn aBqKnrxG8tDkqE4tZcd3A9dPq3fNvqm/LjmVUmkzM4PFNd+2us2kquJ4fASE26Safn 2j40yUIvlfzzmbmb+4ix9JXYfNI1CS9x3djVtSRk= 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 6.0 475/862] clk: tegra: Fix refcount leak in tegra210_clock_init Date: Wed, 19 Oct 2022 10:29:22 +0200 Message-Id: <20221019083310.941218380@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112870035289579?= X-GMAIL-MSGID: =?utf-8?q?1747112870035289579?= 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 b9099012dc7b..499f999e91e1 100644 --- a/drivers/clk/tegra/clk-tegra210.c +++ b/drivers/clk/tegra/clk-tegra210.c @@ -3748,6 +3748,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 Wed Oct 19 08: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: 5127 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp251513wrs; Wed, 19 Oct 2022 03:51:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6WzHDKWwGPHgpmK/Usc+Pji2RBVNvCwm1yvJrJyUSB3bo4ts6WZEOwT4T2Uru0h6R2hiU/ X-Received: by 2002:a05:6402:448:b0:45c:8de5:4fc with SMTP id p8-20020a056402044800b0045c8de504fcmr6799871edw.133.1666176713943; Wed, 19 Oct 2022 03:51:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176713; cv=none; d=google.com; s=arc-20160816; b=BYEyi0rJl2XtXntWB8WFYWwk/Jt3xdU/twpxAePHehiIFxWWj86aYuqR74X7/QPTTB csm3GYeXHzrTTVtiDdtybtJRpzdFEq37TbGcG70u7lQHGejMVpqP8YWHUqcou+2+F89V i+8uiNO5lAAmng3cOzk/ujKlKxEb1SZE+vNhE1J8wsNwDHKGN6+7SFDNP8GB1Jo2+0Fb /8RnhEs0xpAwxhVXIc1azW7URGebltaijf4LlY1bTI5z2hrs+h8w3uMV68i5V7nO1VAK u8VIMhh7sFNxtFlAP7jUoBOQYC7u5tJbURWnSqT5O1sxPAF50x7aKDY9pk4ngO3roRaj ou/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=ZGWNBlpJ/VY/Xf7CXYrOhZ4mFqAF0xjOiYVXc81WScI=; b=VI06y8jZShmZXL5PFRPMv4xhQu19LsfjxvOk/kk/6TVUNtLGrd7HTAOkRmX/vEZ/CA QTK36ytxcx80TSJwxtCC/MF2YfTSsXNYMFCM8FR9igwfsFq1YMhXA+4v/PNkzbrauaWy lWFzXAZJeDSuewVVQA8cX92lMWOiW0TFQcSsatt0qGkn+OwdcS4m4NcT1vuFteVnRFkX V/JRY2eMdS7T8H59rNvSTuY5TLO1nyA1tOF9NXLpxxsD5QkNpQUA8f9G9NDu7dJjGK3m 4IMiU7VQXtQDbfmD9WntbdkddQ908LzpXKgdMcDXetw4AcHGODKkJtd0l/ndPAmgcl/c QeWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=B+OTD5h3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z72-20020a509e4e000000b004596db363c4si14129918ede.264.2022.10.19.03.51.27; Wed, 19 Oct 2022 03:51: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=B+OTD5h3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234426AbiJSKur (ORCPT + 99 others); Wed, 19 Oct 2022 06:50:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233395AbiJSKr5 (ORCPT ); Wed, 19 Oct 2022 06:47:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39A6D159D65; Wed, 19 Oct 2022 03:21: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 ams.source.kernel.org (Postfix) with ESMTPS id C8D1BB82439; Wed, 19 Oct 2022 08:59:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43902C433C1; Wed, 19 Oct 2022 08:59:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169969; bh=r+FwyI0dw6wnWyUmx0/wuU+uiVosvkZ0FGImdLGy/tQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B+OTD5h3a2MV2jmvzMctVPNQgjjjTVCoNUiwgcIQurW99BjXgY4p7OqGWG2Zp9Oi0 naZc1+/jSIZehPwVFT3E3B+OJbmcuHnMKtztY53OhGrcbolE2bio/EfVJE6Nz/tVwY lXEwTF9XU5qHozoInF+BcSgIQ9ucGZH9z3+fp0WU= 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 6.0 476/862] clk: tegra: Fix refcount leak in tegra114_clock_init Date: Wed, 19 Oct 2022 10:29:23 +0200 Message-Id: <20221019083310.992544277@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112913969274248?= X-GMAIL-MSGID: =?utf-8?q?1747112913969274248?= 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 ef718c4b3826..f7405a58877e 100644 --- a/drivers/clk/tegra/clk-tegra114.c +++ b/drivers/clk/tegra/clk-tegra114.c @@ -1317,6 +1317,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 Wed Oct 19 08: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: 5220 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp265452wrs; Wed, 19 Oct 2022 04:22:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6rz1l9tAP2BgiD9WR50H9bnYlTfg2SpeDy0sUU8EUevxFRShv4MOYskWn4KL8uUAdWWPyS X-Received: by 2002:a05:6402:298e:b0:451:129e:1b35 with SMTP id eq14-20020a056402298e00b00451129e1b35mr6867779edb.79.1666178545771; Wed, 19 Oct 2022 04:22:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178545; cv=none; d=google.com; s=arc-20160816; b=iDTP1EC3SJmawhpG17ZYKvkpIweilOntDAq/ArIJ1vt5ajm9DodrcJxP28FgkBzJDb CP6EdNNXqCV8v1YTWDi9PECGSg/VhHwfBDDAmW+b+MRXfEhz92r5rX4vj88wLbTQZjNP Ufc7klcIJcZyePVFNcfbiwGfaycHWz7D5B2EcnbYGDBEW1hwpaw2nBh3A7jhvGY8k0pS uVWbL6weUW5Jj3nyHS5y2rh3BWKa9I9FBaAzYAIyzWLFTuDhOmfrIr0nsknWuPxthUnS PlDBSPDr2X8eTM6iRE3SlIeBj4OFXTkWO7jGvf1hIgb27//GvLi+WcQZzDGBEetk4T0a RxzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TCifrgbVIhF6IG3IN/+rWiGab9iYhQuo/bM3ZkfqbCs=; b=PsgTGmz8ivlk1d6fPH6+sbTMpMFoACBGppCaTzRfZjnrWTRwQOo4+PG+fCYYOubqPc 3KeAByBizloG0gxcmlGBTMViZ/lUpEjALygDel4n9drDMf4zM8t7CuGvY8imDnS4Nkrs 9vUHB6iAWLG2eTOd+oVuXmq1eCoARWzF6xhscoYgCAEj/9UeQXB1j740n/oFQyvPf9Le C/xJZV8j2EypKblSm5wPS7naA/kfo7pUeXpaa1owkk+Y3+jJRzXc8RLbH1pej66tC0Tt UmE9Mbngl99L9EGN7sxkHgk7c2vh27eMG+FO9fFHVD6lxXBaypsnYYZ43ivk9pm63njL AyJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=U6qLd305; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sc11-20020a1709078a0b00b0078de51e1c3dsi13857622ejc.840.2022.10.19.04.21.51; Wed, 19 Oct 2022 04:22:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=U6qLd305; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233979AbiJSLJB (ORCPT + 99 others); Wed, 19 Oct 2022 07:09:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232405AbiJSLI2 (ORCPT ); Wed, 19 Oct 2022 07:08: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 BA2BDF5CE8; Wed, 19 Oct 2022 03:37:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8B6D9B82448; Wed, 19 Oct 2022 08:59:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E10A1C433D6; Wed, 19 Oct 2022 08:59:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169972; bh=jY5QCfw7xTXd3ZKXFT3BA0Dy8YBjTPowLa9k7IVWMjg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U6qLd305VxxzEhr+1OUpWVItms4d04DaUTeDHkUdNlMVdgnMzp2m8qircqERZzZYy wgZyQiueTFuX9//NpY35XDc9T5N3pX/dOZL9WA+XWboQEGWuHQVMSHg+IpTi+Sv/Lt S7gMVJ05eJyfXQRe/aJnZDSur2/QkCMWnfCsx2+4= 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 6.0 477/862] clk: tegra20: Fix refcount leak in tegra20_clock_init Date: Wed, 19 Oct 2022 10:29:24 +0200 Message-Id: <20221019083311.026012365@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114834946596856?= X-GMAIL-MSGID: =?utf-8?q?1747114834946596856?= 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 be3c33441cfc..8a4514f6d503 100644 --- a/drivers/clk/tegra/clk-tegra20.c +++ b/drivers/clk/tegra/clk-tegra20.c @@ -1131,6 +1131,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 Wed Oct 19 08: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: 5124 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp251374wrs; Wed, 19 Oct 2022 03:51:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4sykkBlMqb0JlAUCTZogwCV3gT9Wjk1NCRYqMIc2Hj6cHQX4wrB/SBJyeBXYa6Q5xHruRE X-Received: by 2002:a05:6402:1cc1:b0:453:1517:94e4 with SMTP id ds1-20020a0564021cc100b00453151794e4mr6758321edb.399.1666176694379; Wed, 19 Oct 2022 03:51:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176694; cv=none; d=google.com; s=arc-20160816; b=dqN8pA+TzlxAjS0p4U1w7WDFhHKxCmFPf3MVN/8DeKtiamGHIlCSRxlo/KQQxm1BVc FLBxLiDXU+2YdBxBdGn0rdStcl0A06U8X5NUvU2QPGxeKhvkpM0kTaseu0SjuHnFIzE8 wgKm3vpitXwJw4Kp9AsuRgUWMp7tbqmaTlSRdqce2SF7cISjX9n6eBMrtZSNhr5pd41v RTG580vQSJVzct7kxjhB1dTQ5mPqHZuWyKK03zHzevrEKgnol2LwNx2+TahNZi2x2sVi +fsKly9Iqg0gU7eTvmEw61fIdgvMtO7aDRq6pSBhrCiG6UfA04niiIX0/kNtmyudE+Lo FrPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vn07Zkh87WBT0/WvegA0YM5axsg7u8Oxnd7ijTj0+Ys=; b=Ne4N0Zxa+PdS20Z1vQZ7gBGXSZNo8ip3Q0hDJA8XMbUZUrneeZHzXyEmn/orfIvdsu J6acW2jMZ06N7A6W+/pTAZVfUROLMu7u+q4FhhvZ9cI3o6gnrnhJzF9nqTd18H3cJWJr v0ogu5MndFQdNGNFbmn48DG47t8vEpVZNY3osP7J/zj0Up/y6ljVw4ve0F+vDSEXVy7R G10qjqHoiHAXqekTSc2y3nw2Vu6Bc5txwCpgjRsiGawmLGtl2f+zVnpwsAuQyCv/aeQL I5KPl/pLTW6JIuByJjMXRywwoaqC3X9u8JLA7UwDJkd3V3q9N2NYY+6sjoIos60G3mve u/9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qFsNMpDm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l11-20020a056402254b00b0045902845795si15432045edb.557.2022.10.19.03.51.10; Wed, 19 Oct 2022 03:51:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qFsNMpDm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229991AbiJSKuf (ORCPT + 99 others); Wed, 19 Oct 2022 06:50:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234025AbiJSKrx (ORCPT ); Wed, 19 Oct 2022 06: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 384AB120EDF; Wed, 19 Oct 2022 03:21: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 05EADB82447; Wed, 19 Oct 2022 08:59:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7177AC433C1; Wed, 19 Oct 2022 08:59:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169974; bh=nVPF//z9VOfbszAt81xC8YMEOhgGA/XDispQHBKGje8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qFsNMpDm3sYJgXM5z52fVREhEiIYG0+s+MK8JhulvN3XysUEBB6Nseha6hSZ21nnr FLrEfAp0VQ9vaAbTrAHZv5DQoCtZ49yWaIYcg04SQAsBvMa3ScE9/Q1PnUdDL4glE8 Rebsy3jaOjph7ERcF8gHS2yKoQtyooambT7uHgAc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chanho Park , Krzysztof Kozlowski , Chanwoo Choi , Sasha Levin Subject: [PATCH 6.0 478/862] clk: samsung: exynosautov9: correct register offsets of peric0/c1 Date: Wed, 19 Oct 2022 10:29:25 +0200 Message-Id: <20221019083311.073339354@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,UPPERCASE_50_75 autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112893428453762?= X-GMAIL-MSGID: =?utf-8?q?1747112893428453762?= From: Chanho Park [ Upstream commit 67d98943408bce835185688cb75ebbb45b91e572 ] Some register offsets of peric0 and peric1 cmu blocks need to be corrected and re-ordered by numerical order. Fixes: f2dd366992d0 ("clk: samsung: exynosautov9: add cmu_peric0 clock support") Fixes: b35f27fe73d8 ("clk: samsung: exynosautov9: add cmu_peric1 clock support") Signed-off-by: Chanho Park Reviewed-by: Krzysztof Kozlowski Acked-by: Chanwoo Choi Signed-off-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20220727021357.152421-4-chanho61.park@samsung.com Signed-off-by: Sasha Levin --- drivers/clk/samsung/clk-exynosautov9.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/clk/samsung/clk-exynosautov9.c b/drivers/clk/samsung/clk-exynosautov9.c index d9e1f8e4a7b4..487a71b32a00 100644 --- a/drivers/clk/samsung/clk-exynosautov9.c +++ b/drivers/clk/samsung/clk-exynosautov9.c @@ -1170,9 +1170,9 @@ static const struct samsung_cmu_info fsys2_cmu_info __initconst = { #define CLK_CON_GAT_GOUT_BLK_PERIC0_UID_PERIC0_TOP0_IPCLKPORT_PCLK_2 0x2058 #define CLK_CON_GAT_GOUT_BLK_PERIC0_UID_PERIC0_TOP0_IPCLKPORT_PCLK_3 0x205c #define CLK_CON_GAT_GOUT_BLK_PERIC0_UID_PERIC0_TOP0_IPCLKPORT_PCLK_4 0x2060 -#define CLK_CON_GAT_GOUT_BLK_PERIC0_UID_PERIC0_TOP0_IPCLKPORT_PCLK_7 0x206c #define CLK_CON_GAT_GOUT_BLK_PERIC0_UID_PERIC0_TOP0_IPCLKPORT_PCLK_5 0x2064 #define CLK_CON_GAT_GOUT_BLK_PERIC0_UID_PERIC0_TOP0_IPCLKPORT_PCLK_6 0x2068 +#define CLK_CON_GAT_GOUT_BLK_PERIC0_UID_PERIC0_TOP0_IPCLKPORT_PCLK_7 0x206c #define CLK_CON_GAT_GOUT_BLK_PERIC0_UID_PERIC0_TOP0_IPCLKPORT_PCLK_8 0x2070 #define CLK_CON_GAT_GOUT_BLK_PERIC0_UID_PERIC0_TOP0_IPCLKPORT_PCLK_9 0x2074 #define CLK_CON_GAT_GOUT_BLK_PERIC0_UID_PERIC0_TOP0_IPCLKPORT_PCLK_10 0x204c @@ -1418,14 +1418,14 @@ static const struct samsung_cmu_info peric0_cmu_info __initconst = { #define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_IPCLK_11 0x2020 #define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_0 0x2044 #define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_1 0x2048 -#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_2 0x2058 -#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_3 0x205c -#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_4 0x2060 -#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_7 0x206c -#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_5 0x2064 -#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_6 0x2068 -#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_8 0x2070 -#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_9 0x2074 +#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_2 0x2054 +#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_3 0x2058 +#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_4 0x205c +#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_5 0x2060 +#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_6 0x2064 +#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_7 0x2068 +#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_8 0x206c +#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_9 0x2070 #define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_10 0x204c #define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_11 0x2050 @@ -1463,9 +1463,9 @@ static const unsigned long peric1_clk_regs[] __initconst = { CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_2, CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_3, CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_4, - CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_7, CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_5, CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_6, + CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_7, CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_8, CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_9, CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_10, From patchwork Wed Oct 19 08: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: 4751 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214603wrs; Wed, 19 Oct 2022 02:13:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Hl1sUOGuYHuvsqa4FQrGtMcQxcqLQDiIi3e2kMvkrVle+LnqgPoMeE1APKmIxXKmwfJc9 X-Received: by 2002:a17:906:15ca:b0:78d:b7b3:2afa with SMTP id l10-20020a17090615ca00b0078db7b32afamr5872784ejd.69.1666170800743; Wed, 19 Oct 2022 02:13:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170800; cv=none; d=google.com; s=arc-20160816; b=cejuCGLGckQ6oxq8CFOGVdsVrO5OziEtMw6MXDU32H4tuU5kzRRAD5hCvH6QbrSqcy 2MeJar9SnJKz/njzjNzamSYTeHVtt/e135GBhfQtb0c1W1jx+SIj7G0iGMx6NeW8jgAz M5Y850Wo5epHsqKRtcIsnWz3EnEgiHUSg2R7Qs6RVHzJDdRR395d3HmQZswdGojX8/74 aNlAGZWqkpQi3EhxYfj+pQzQXlAU9+gYlOnuqAClr/WcxKtqZ4RGqUr/r+py4Bop1WyW zyRREFqUxE59+PRbqXnDaks1v3SfOLSuojFxLn7w3HPnQZ4QxPRMLawVOzJSMjaMS2zd 9d2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=P1UThJrpiqPlHcKOiSvX6luEsGxQ1ZlnDqx2Yg1YLnw=; b=BtC5I3iS1wY34SHsCNI2mGUfqGVY0bG3wkQjcwBqpVIa4obhkpPcjoQgsTWVO9DrrS iaDhYxrkbjSJ7qQSJt1zAUpaJiWI+DzZ4Im7vDS7Y9qZXhYrsj1Nx8lal8xWVssLvzLf le/zu6L1GqHKK7sECo3JHtwtVGuSux1WC8Nm+8BxNJ/Jwa1VUjBKW0Mz209byrH/aPye +ctuCozRIy8Tujl/mTvJAqMb2ssSD2OynOVFT5vT17cwclCqiZl7hEsqCB9LgEsXZ8fA fIt3k8Sckv/Zn8MSu9a4+LURhlw1OXAr2lBGC5P7ybUOxNGiWf71IqyDxmsb3kMPUHq8 eEvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Zu+MSE9t; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dn2-20020a17090794c200b0072b40bc7412si15287220ejc.223.2022.10.19.02.12.55; Wed, 19 Oct 2022 02:13: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=Zu+MSE9t; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232738AbiJSJLi (ORCPT + 99 others); Wed, 19 Oct 2022 05:11:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232704AbiJSJI6 (ORCPT ); Wed, 19 Oct 2022 05:08:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B574769F62; Wed, 19 Oct 2022 02:00:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2AB3C61753; Wed, 19 Oct 2022 08:59:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26A3AC433D6; Wed, 19 Oct 2022 08:59:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169977; bh=Z8z7NmhwuLQmvcvxN30n/bAav7tobujWdMIlqIkzE8w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zu+MSE9t6viVtG2fuKe+8cHfN4+JMrM3PPaZDXUAj/Bj77JFMmC6ybhaSq3R7gsYH XGpqClr3QU1YHXtjd/rNxJbjrZ2Hbr5WAj5AlXRi1S5FmzLl/kroH0amTbL3dSnBVo EPfxSNJ+glbHNwYootMSjrsxeHdbX/+NQTDiOYKw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yu Kuai , Jan Kara , Jens Axboe , Sasha Levin Subject: [PATCH 6.0 479/862] sbitmap: fix possible io hung due to lost wakeup Date: Wed, 19 Oct 2022 10:29:26 +0200 Message-Id: <20221019083311.114449669@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106713737740477?= X-GMAIL-MSGID: =?utf-8?q?1747106713737740477?= From: Yu Kuai [ Upstream commit 040b83fcecfb86f3225d3a5de7fd9b3fbccf83b4 ] There are two problems can lead to lost wakeup: 1) invalid wakeup on the wrong waitqueue: For example, 2 * wake_batch tags are put, while only wake_batch threads are woken: __sbq_wake_up atomic_cmpxchg -> reset wait_cnt __sbq_wake_up -> decrease wait_cnt ... __sbq_wake_up -> wait_cnt is decreased to 0 again atomic_cmpxchg sbq_index_atomic_inc -> increase wake_index wake_up_nr -> wake up and waitqueue might be empty sbq_index_atomic_inc -> increase again, one waitqueue is skipped wake_up_nr -> invalid wake up because old wakequeue might be empty To fix the problem, increasing 'wake_index' before resetting 'wait_cnt'. 2) 'wait_cnt' can be decreased while waitqueue is empty As pointed out by Jan Kara, following race is possible: CPU1 CPU2 __sbq_wake_up __sbq_wake_up sbq_wake_ptr() sbq_wake_ptr() -> the same wait_cnt = atomic_dec_return() /* decreased to 0 */ sbq_index_atomic_inc() /* move to next waitqueue */ atomic_set() /* reset wait_cnt */ wake_up_nr() /* wake up on the old waitqueue */ wait_cnt = atomic_dec_return() /* * decrease wait_cnt in the old * waitqueue, while it can be * empty. */ Fix the problem by waking up before updating 'wake_index' and 'wait_cnt'. With this patch, noted that 'wait_cnt' is still decreased in the old empty waitqueue, however, the wakeup is redirected to a active waitqueue, and the extra decrement on the old empty waitqueue is not handled. Fixes: 88459642cba4 ("blk-mq: abstract tag allocation out into sbitmap library") Signed-off-by: Yu Kuai Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220803121504.212071-1-yukuai1@huaweicloud.com Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- lib/sbitmap.c | 55 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 22 deletions(-) diff --git a/lib/sbitmap.c b/lib/sbitmap.c index 29eb0484215a..1f31147872e6 100644 --- a/lib/sbitmap.c +++ b/lib/sbitmap.c @@ -611,32 +611,43 @@ static bool __sbq_wake_up(struct sbitmap_queue *sbq) return false; wait_cnt = atomic_dec_return(&ws->wait_cnt); - if (wait_cnt <= 0) { - int ret; + /* + * For concurrent callers of this, callers should call this function + * again to wakeup a new batch on a different 'ws'. + */ + if (wait_cnt < 0 || !waitqueue_active(&ws->wait)) + return true; - wake_batch = READ_ONCE(sbq->wake_batch); + if (wait_cnt > 0) + return false; - /* - * Pairs with the memory barrier in sbitmap_queue_resize() to - * ensure that we see the batch size update before the wait - * count is reset. - */ - smp_mb__before_atomic(); + wake_batch = READ_ONCE(sbq->wake_batch); - /* - * For concurrent callers of this, the one that failed the - * atomic_cmpxhcg() race should call this function again - * to wakeup a new batch on a different 'ws'. - */ - ret = atomic_cmpxchg(&ws->wait_cnt, wait_cnt, wake_batch); - if (ret == wait_cnt) { - sbq_index_atomic_inc(&sbq->wake_index); - wake_up_nr(&ws->wait, wake_batch); - return false; - } + /* + * Wake up first in case that concurrent callers decrease wait_cnt + * while waitqueue is empty. + */ + wake_up_nr(&ws->wait, wake_batch); - return true; - } + /* + * Pairs with the memory barrier in sbitmap_queue_resize() to + * ensure that we see the batch size update before the wait + * count is reset. + * + * Also pairs with the implicit barrier between decrementing wait_cnt + * and checking for waitqueue_active() to make sure waitqueue_active() + * sees result of the wakeup if atomic_dec_return() has seen the result + * of atomic_set(). + */ + smp_mb__before_atomic(); + + /* + * Increase wake_index before updating wait_cnt, otherwise concurrent + * callers can see valid wait_cnt in old waitqueue, which can cause + * invalid wakeup on the old waitqueue. + */ + sbq_index_atomic_inc(&sbq->wake_index); + atomic_set(&ws->wait_cnt, wake_batch); return false; } From patchwork Wed Oct 19 08:29:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5508 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp336533wrs; Wed, 19 Oct 2022 06:47:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4LREkTvxIHJE8AwahscXqz4NG4kaSmFOy675ica0vbXHAN5HF9Hv/SCTTX5Hy+k512JfbK X-Received: by 2002:a17:902:b417:b0:181:d0e4:3310 with SMTP id x23-20020a170902b41700b00181d0e43310mr8601564plr.134.1666187232676; Wed, 19 Oct 2022 06:47:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666187232; cv=none; d=google.com; s=arc-20160816; b=S1BhmFJ0UNNQdAcpI0L/taicIvk2JIsyUvV9GI6RUqZTPyDlM6yyVrRu1KnONyANL/ VqU/3fnfU4m1jufDwCahpDa+X/N7xnC0SEqLx1XqcIbOcdUZPGLas3eF6LmUoofs5iRB zdX9DajpWPKU662lwXB+0FlU6ScUktIxv6X8EQAWrwGEuMQB7GAxdIhnsiN12WRaxOvZ 6HXrAYnpinzqWZMg8hDwWB1yg3iK8H0VAXtGuucuqjzM/dgu6F3VGkupn6zYOJErsEyg ZN4fDQDh2NFGwOjoMbe4aUvaKjQvHxEdvm4nmVaMCVejHmqd4jHrn+VkymHyt5iVQzio 6x8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JhGRPzV2jvcOIpGd5mdVOQUzXcbqUGxYfojZUvHwrj8=; b=d0rVrmIGLzBWemHYqo4P9CfCUY+QP1xibigJb8sjTfKyULYxUFghLSCQhqwF6c7EWO 4C6+LsKAGYy0uSfRtGNbP/3XgQZImnija4Z8i3d8thOp2qSRj5Zr28QK0uSfbJKx0wap tuG9bzmopkjgi1AD+qh3hsEn5hisB2YbIUkOXUBem16YWE7AOrv1GmZB+vu0eUHyEf+g p3lxEoyufECn/32777dMRNmmpEFRm7ph7dTdlbVV73JNND/UGlnobrQsGki07Deo9+I2 RroZgyyeGXu9S891aY4D/O85FI5c6TicsxYODxSNGhG8uHblwNBISKE6bLEh2V9VE4dg d7Mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=E3IVwkHp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a8-20020a170902710800b0018658e3864asi1083324pll.61.2022.10.19.06.46.59; Wed, 19 Oct 2022 06:47: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=E3IVwkHp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233060AbiJSNqb (ORCPT + 99 others); Wed, 19 Oct 2022 09:46:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233050AbiJSNpa (ORCPT ); Wed, 19 Oct 2022 09:45:30 -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 F2D911382E1; Wed, 19 Oct 2022 06:32: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 5DA6EB82399; Wed, 19 Oct 2022 09:01:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B366CC433D6; Wed, 19 Oct 2022 09:01:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170099; bh=PrK2p4fymt8fUSfP4C7APe5C2pVVTGHBBgmiexJTfSY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E3IVwkHpH+7VmMp0kVWmWwCrcziy6tyaiTMQ6aKod5VYlfKt9hbL4LvG4ym83p+t/ mLe+drfJDH+Mtwj7u0dKHyvnFJ7PwjU+sCgjzLlC5nNelyzqdOxZraEXmAkrc++K9N MOm674OJYURydO+UcVUsd96wYVjqYsHT2DBXFGng= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= , Jiri Kosina , Sasha Levin Subject: [PATCH 6.0 480/862] HID: uclogic: Add missing suffix for digitalizers Date: Wed, 19 Oct 2022 10:29:27 +0200 Message-Id: <20221019083311.156155236@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123943587048712?= X-GMAIL-MSGID: =?utf-8?q?1747123943587048712?= From: José Expósito [ Upstream commit 0977fda0587cbc5403651ba169e264aa01e8a026 ] The Pen (0x02) application usage was changed to Digitalizer (0x01) in commit f7d8e387d9ae ("HID: uclogic: Switch to Digitizer usage for styluses"). However, a suffix was not selected for the new usage. Handle the digitalizer application usage in uclogic_input_configured() and add the required suffix. Signed-off-by: José Expósito Signed-off-by: Jiri Kosina Fixes: f7d8e387d9ae ("HID: uclogic: Switch to Digitizer usage for styluses") Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/hid/hid-uclogic-core.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/hid/hid-uclogic-core.c +++ b/drivers/hid/hid-uclogic-core.c @@ -153,6 +153,7 @@ static int uclogic_input_configured(stru suffix = "Pad"; break; case HID_DG_PEN: + case HID_DG_DIGITIZER: suffix = "Pen"; break; case HID_CP_CONSUMER_CONTROL: From patchwork Wed Oct 19 08:29:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4753 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214658wrs; Wed, 19 Oct 2022 02:13:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7PkJqC5BEteotVBXzjjxZumc6+IQIgGRHiq0iuLJ+x6OD8FPcxj4Th0MgD/ufD/T4dxj3U X-Received: by 2002:a17:907:2c59:b0:78d:8e03:134 with SMTP id hf25-20020a1709072c5900b0078d8e030134mr5728258ejc.310.1666170806703; Wed, 19 Oct 2022 02:13:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170806; cv=none; d=google.com; s=arc-20160816; b=fJn1NZjL+PO1UNz3nD4+Ojm/u31Ha2hFlTCy5MQRTyVKuSJ3I+uJEm3MmywPLi0AIj 1i+/vvOYC0U1EQoDff/1cZtW5fDzoN5qCzeVlnzU0jB83PBqaAbPTb+O2mIu8RK32v5w Ab/wsKL8kij4tv5x9tANi1j1nvKscUN7bSza4dX9dadxWYo+qAZJrkMp4shkDRX39deU J6ghAMFXuHSzBqVr3If654Y1t/zLwfQ6jtko9hITCMRrPuq9poQlFt09zJYAkS+reKbi oyoHIDvNDGMosodTAWPh1pKn1CeDFQbjM60L1tzJMuWqEK3AFKs7iw70RktiZ92Y9xr/ rA/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=kkLzfVHFAGpMTs+caxTPkzUQP1bVuZK5bK6VPQuWbwA=; b=kp5HN+D+/5VzpXSlztXvTEqm0TieHa6Bp3c/7i0Pf3tAfmcwFFf05BYJqdPYneUQBk +SuyHOJq+zoNXXm8Noj1HpbfMeu1cNLf+YDmutHeHfWCd2UncKNVvwREYwCZOmeOqvIQ vhhhOZwFk5UR4lp7IvOWkeJvw/ISWXTb5fyX4IVpypQIZIVX1LJtW52c+14C43FU/E4Q RWD5YcFrN2SlGcbDif9DbEUA6HC4uKDBpvAmbXVxkorluQ5pi303LkJUnTit17K7bvu0 SIYHVa7sYfUu0bOIHsJS6AdmwkLwkDtJ/JzuJcsDqblVgzW7d2Pe2HLxJ38ayipcd38J kuqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=t4IMHnwy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dz10-20020a0564021d4a00b00457fb8f2a64si15818592edb.563.2022.10.19.02.13.00; Wed, 19 Oct 2022 02:13: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=t4IMHnwy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232862AbiJSJLx (ORCPT + 99 others); Wed, 19 Oct 2022 05:11:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232813AbiJSJJV (ORCPT ); Wed, 19 Oct 2022 05:09: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 D3BA472940; Wed, 19 Oct 2022 02:00: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 4C768617E2; Wed, 19 Oct 2022 08:59:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62347C433C1; Wed, 19 Oct 2022 08:59:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169998; bh=TTsckvmflagtafRn2JFd/70xMuypHyk4u8pTivsTen4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t4IMHnwylJXpW35T21gq5yAFOz0GMf5A6z65o1lA16sR01U8SIirNYxT/8hWkuov8 f/9bQ0FKHICykahHDV6Hwuwn2nXNcP3oZGGoQOc57XiXfE7q/K0oli5595oQEothQ0 Kt7+7ZSWkec9vFxnpLn4oZCkHgcLtIMtjISbMGjk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= , Jiri Kosina , Sasha Levin Subject: [PATCH 6.0 481/862] HID: uclogic: Fix warning in uclogic_rdesc_template_apply Date: Wed, 19 Oct 2022 10:29:28 +0200 Message-Id: <20221019083311.204721778@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106719727518973?= X-GMAIL-MSGID: =?utf-8?q?1747106719727518973?= From: José Expósito [ Upstream commit 609174edeb758d1e2d713e7ab4e09ea8d45aa4f7 ] Building with Sparse enabled prints this warning: warning: incorrect type in assignment (different base types) expected signed int x got restricted __le32 [usertype] Cast the return value of cpu_to_le32() to fix the warning. Fixes: 08177f4 ("HID: uclogic: merge hid-huion driver in hid-uclogic") Signed-off-by: José Expósito Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin --- drivers/hid/hid-uclogic-rdesc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hid/hid-uclogic-rdesc.c b/drivers/hid/hid-uclogic-rdesc.c index 3d68e8b0784d..81ca22398ed5 100644 --- a/drivers/hid/hid-uclogic-rdesc.c +++ b/drivers/hid/hid-uclogic-rdesc.c @@ -1113,7 +1113,7 @@ __u8 *uclogic_rdesc_template_apply(const __u8 *template_ptr, memcmp(p, pen_head, sizeof(pen_head)) == 0 && p[sizeof(pen_head)] < param_num) { v = param_list[p[sizeof(pen_head)]]; - put_unaligned(cpu_to_le32(v), (s32 *)p); + put_unaligned((__force u32)cpu_to_le32(v), (s32 *)p); p += sizeof(pen_head) + 1; } else if (memcmp(p, btn_head, sizeof(btn_head)) == 0 && p[sizeof(btn_head)] < param_num) { From patchwork Wed Oct 19 08:29:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5153 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp253523wrs; Wed, 19 Oct 2022 03:57:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7t9qqaqvZpjiANJ/4klp4iZNSDSHlFKb/AHZ8VTBwRJXJ3rB63t+id8wcQ4dW+PqlUP1PU X-Received: by 2002:a17:907:3f27:b0:78d:ad42:f733 with SMTP id hq39-20020a1709073f2700b0078dad42f733mr6413396ejc.320.1666177044990; Wed, 19 Oct 2022 03:57:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666177044; cv=none; d=google.com; s=arc-20160816; b=TPwTKxthBFpWZNgTZkp857oLx8z5lwAEVdUo2VHBQ7iigST/ah4WjlN0aCWM3Rz6QE G3M5VCx/8yokhxBl3GXZbVeoCvFrUnt7T9SYBsXttdyqYAqoS7pvH6LAmvENQ68ybvro mZjEWPyKO/8jiaOFrNax3aRzz5LEZPMcPBjQbUR6YhWobTK4iSolRXQOsgGYcqlKblq7 GhcIgXJbi1y1+brYIzELcL/Ci0cZiI0dwkBKghjhmDNA9IVkMvg4dEfnBUVb2ThQpeOA vggrMBUrUbdeAU1qGJnvHquS5oPMpse4sbQez0UY924pN/bxz8dI3uHoOnWMFR39qY1A V5dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lmx/nv93+kUb6SouQSoeHr3oc8jzJ7zazO2KrXqcVXI=; b=ukonq+YpjeCncc6MX2kD7jhRkrvlDr4TSTK47P3gKkeOBxZ96cYpcLAwj4MY5yaqzI fxIGO7XioFU1vZvRaZD8q1q0EQU+055qp3ysSBzY6UV5V1Td/e48xZ5d6gjaj2bVwrI2 nr2vKXXPavUomx5QbSI8yaW4Zo70gihTBr7BiAcDQJsIhMNB9BPS6w24PeyMQdFq6SWO NzqrxCmQJQwj8f9gmK95SEWtY0DXiBhFM4zbBYBGBcPwJk5jkm6TK1tWNw8Uwxrxaths oNVD+dtwpdL7HL7LuPec45XuZ2ophyk3QMcm0UIM1OhLXoC28XF8NRjQ8lqUH4h0G5n4 u/zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yc+cZRUW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a1709070d8a00b0078d4c9d77adsi17234498ejc.94.2022.10.19.03.57.00; Wed, 19 Oct 2022 03: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=yc+cZRUW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234614AbiJSK4d (ORCPT + 99 others); Wed, 19 Oct 2022 06:56:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234156AbiJSKzl (ORCPT ); Wed, 19 Oct 2022 06:55:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4171FAB81B; Wed, 19 Oct 2022 03:27: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 D34D6B82458; Wed, 19 Oct 2022 09:00:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B862C433C1; Wed, 19 Oct 2022 09:00:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170027; bh=9+NtXeXBvF4Ebv92J6wPhWRQ5nQ9JXpxZQzq7UfEEhk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yc+cZRUWczFkRLPP32r7GnpXb+RqHLewZqKn8iXpiJPS5P3wz/cNQKdy1aOOAnVVl 2iZMRu5SpRpZiIyarR8PRCR+2/yw/08l/BZ+9lO32iLSSOcWCIZLWs0ADg6ICWufBM NbRFSToMfDQS6INCbiMOiVeb8dA6X8lsun+vDY/Q= 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 6.0 482/862] HSI: omap_ssi: Fix refcount leak in ssi_probe Date: Wed, 19 Oct 2022 10:29:29 +0200 Message-Id: <20221019083311.253973912@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747113260902281410?= X-GMAIL-MSGID: =?utf-8?q?1747113260902281410?= 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 44a3f5660c10..eb9820158318 100644 --- a/drivers/hsi/controllers/omap_ssi_core.c +++ b/drivers/hsi/controllers/omap_ssi_core.c @@ -524,6 +524,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 Wed Oct 19 08: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: 4764 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214833wrs; Wed, 19 Oct 2022 02:13:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM40b5RnOdbNc+NTvvb/JlIyg97YM/4SIgFj1vnX28DYNQRkDkdx5D+/M7mo6PFklkGtUrzK X-Received: by 2002:a05:6402:1f06:b0:457:149d:beaa with SMTP id b6-20020a0564021f0600b00457149dbeaamr6392433edb.238.1666170833736; Wed, 19 Oct 2022 02:13:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170833; cv=none; d=google.com; s=arc-20160816; b=KMUO42dKYd6rZbAI4X8aqhohCFwI581s22L0JbSCq3ZiXYbeU4b3CNeW/x2TV4EnZt fbsc1UJuY7+tzIpqlhYhlyicEe34Yn2VoSYMz1Me/rGkDh+WNVFUutQ9+K3v/bdD3xDY zskNVOtSjVE5H1WNjJJuJOJXxTvIsASUqoVsdbCLINoO3Bkq2ean9hHod5Yp8VhcNQu3 7+kQbqRjLFWYSwGrn4cPbW1h9vt+3loVbFbz7DWO8MFHIbO7CoJgzX4MOABDhKQVxA/N Ar2SmS77eerOnE+jxEaP/6LPq6zK7P8yDCxIf9QPDBXkcs66NlXR+YrA4U0JJ1Wwo/r8 JPWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lVIRB4zSXTqsZ4333e2G/+ZzELZX6fWdMt5VVrtzZnc=; b=ygMQmVaV6uB3wDs3pIY4KlLKY1AxBOO2OwRxRIC7my8CdA/qptSPhkhy0kQZ6hbFcZ 6hufglccIHR1ihte31/ylV7M1AokryE1cd4kxTyDXn0baqePzvyDkRUgddmU1Os0nRbB CXwi0tCBmlABovWofYIM00ZKRLI2lv9q9rrfkIlBTuT29gcbcAuO+AeWkWRk/xhdErNy FQAQlY2Wnaz1oen/p4sSEWQCVrUdUGMKleHeWWieUEicubw3dz48slfJAdmYQ4Ir1b12 cp49YmD1Pzxg/LDvhbYWf8EFHhk9KJpmgxsyiJwvqKCY3duk9vKGnFsAPhSQhhjczMxT YL9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Pw+N8GHs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bo17-20020a0564020b3100b0045c234508e2si11544856edb.627.2022.10.19.02.13.28; Wed, 19 Oct 2022 02:13: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=Pw+N8GHs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232935AbiJSJMa (ORCPT + 99 others); Wed, 19 Oct 2022 05:12:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232951AbiJSJJp (ORCPT ); Wed, 19 Oct 2022 05:09:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17C33B56C8; Wed, 19 Oct 2022 02:00:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BF67B617E1; Wed, 19 Oct 2022 09:00:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5B8EC43142; Wed, 19 Oct 2022 09:00:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170056; bh=K4roTK2fnCmQiAynGRZx39W2zSKfyzroDBihQQeCMlI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Pw+N8GHsRqCxcGK5wXsJPGC90NdVNOEp63Am0gw3tH3dPV/FXh20AR10kycdm1whc oPu8XJG7t4/B8LXCSSiEGoC9yzOYNBaSHR1oR2icFXhDVb+UBW+Dc3xSwqroJpvxXf 6jO7bW7Vp6TMjrIGCcGK0+jOZP7BPXz+z2/XtVPc= 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 6.0 483/862] HSI: omap_ssi_port: Fix dma_map_sg error check Date: Wed, 19 Oct 2022 10:29:30 +0200 Message-Id: <20221019083311.299189675@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106748077940785?= X-GMAIL-MSGID: =?utf-8?q?1747106748077940785?= 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 a0cb5be246e1..b9495b720f1b 100644 --- a/drivers/hsi/controllers/omap_ssi_port.c +++ b/drivers/hsi/controllers/omap_ssi_port.c @@ -230,10 +230,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 | @@ -247,10 +247,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 Wed Oct 19 08: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: 4864 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223974wrs; Wed, 19 Oct 2022 02:39:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7sE4duCZpwEj1DPmR/FMR7P/ZHScyXuy1NVKY5g7WQiygio0ylyP+nsWMvVxFxN2spSFhT X-Received: by 2002:a17:90b:400c:b0:20a:bb11:a0f3 with SMTP id ie12-20020a17090b400c00b0020abb11a0f3mr43810340pjb.166.1666172329457; Wed, 19 Oct 2022 02:38:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172329; cv=none; d=google.com; s=arc-20160816; b=WMH70DnvgiY4Xfpx12HiZYJ7ljSEjMWq5uUyxIFoXMPJjixRzy3sHWe265NGIZurJk 9MI+3TkqKg1GUtiltrKpw0StuuHO8Xm7ZQnUYN/+SKljKgjzEg0myTPRy+WLUgdteljg hF4tmnHIUwLpWaRgMf0SHaaY597Mf6+rRxcCr6xt3O7CUSekk97JkCoWnkJ8NeeA29Xt SSPW506AC0IzqXHaOYq1Vuo7Z+QNauFgGcHpCYIFEkkKa/0ZpNOy11YFKp6SJjxLq7Cm 25Toy8h+lUmkg2+2sGnyBNqX67nPdYLrCqUCeqzJkQ2nvonE/kebnSRwHptZM6FkzOWW 69gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=S3B424mCGqfKzAf3lqDAeEddOod/1fhdiZV0JbxECm0=; b=z4uJCS2BFZryhrudMOGUKyOGe+s1pjj8W2TgXmvS9u5nvd+vS9f6LjnCjLKJwsDM5u UpgBcXFqqmmIvlYdS2ktdeJygXadWkSOgdaOZjJa+rNGKy1XBAh7TwTSCa1tB27x2DkO cFLH4FVFhQ9jjAZzkH39PnvYGsUmk8jZeCd2Xtux3PLEkFrA/GVoQ7GCiGZPy0tLDfBx iuIvCQbOOgluCoXHLKHBJaLtMptkTYAO9BZ1puH+uNKHYjq65KlcxVcf1LHK5UtU6SBX 8h5Q8Br+Ob2Z1zmhgFPaqF5uO+oWeYBIWNC0YVfYjv8f2rzw7rxWsxyTHzvBjqoV91Y1 LoWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CWorxAtv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 206-20020a6306d7000000b00460dd0eed0csi18748465pgg.176.2022.10.19.02.38.36; Wed, 19 Oct 2022 02:38: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=CWorxAtv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233406AbiJSJWv (ORCPT + 99 others); Wed, 19 Oct 2022 05:22:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233455AbiJSJVm (ORCPT ); Wed, 19 Oct 2022 05:21: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 BA4C63ED72; Wed, 19 Oct 2022 02:09: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 C061E61824; Wed, 19 Oct 2022 09:01:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C35A7C433C1; Wed, 19 Oct 2022 09:01:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170083; bh=0einq7fTqgMqNK76jwkzXls/v3g3vDEhp3UU2sIhUVs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CWorxAtvdBzEVHPVHtsOqXOFkqFM3a6YnKSQQu/3hvm/vjZwvarQHwr6YuyQsTs0D Uk+Jo9VgkJUH1bCToT52VJ/zLcwclx7VNLFDVrUn89TQfKCZ1VGc9XgXhGapvZk58V PCRsv7/YfwdFpu1D3q3O48mp5R6YpqML3XwCQ/og= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marijn Suijten , Alexey Minnekhanov , Stephen Boyd , Bjorn Andersson , Sasha Levin Subject: [PATCH 6.0 484/862] clk: qcom: gcc-sdm660: Use floor ops for SDCC1 clock Date: Wed, 19 Oct 2022 10:29:31 +0200 Message-Id: <20221019083311.346940026@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108316018593897?= X-GMAIL-MSGID: =?utf-8?q?1747108316018593897?= From: Marijn Suijten [ Upstream commit 6956c18f4ad9200aa945f7ea37d65a05afc49d51 ] In commit 3f905469c8ce ("clk: qcom: gcc: Use floor ops for SDCC clocks") floor ops were applied to SDCC2 only, but flooring is also required on the SDCC1 apps clock which is used by the eMMC card on Sony's Nile platform, and otherwise result in the typicial "Card appears overclocked" warnings observed on many other platforms before: mmc0: Card appears overclocked; req 52000000 Hz, actual 100000000 Hz mmc0: Card appears overclocked; req 52000000 Hz, actual 100000000 Hz mmc0: Card appears overclocked; req 104000000 Hz, actual 192000000 Hz Fixes: f2a76a2955c0 ("clk: qcom: Add Global Clock controller (GCC) driver for SDM660") Signed-off-by: Marijn Suijten Tested-by: Alexey Minnekhanov Reviewed-by: Stephen Boyd Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220714203822.186448-1-marijn.suijten@somainline.org Signed-off-by: Sasha Levin --- drivers/clk/qcom/gcc-sdm660.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/qcom/gcc-sdm660.c b/drivers/clk/qcom/gcc-sdm660.c index 9b97425008ce..db918c92a522 100644 --- a/drivers/clk/qcom/gcc-sdm660.c +++ b/drivers/clk/qcom/gcc-sdm660.c @@ -757,7 +757,7 @@ static struct clk_rcg2 sdcc1_apps_clk_src = { .name = "sdcc1_apps_clk_src", .parent_data = gcc_parent_data_xo_gpll0_gpll4_gpll0_early_div, .num_parents = ARRAY_SIZE(gcc_parent_data_xo_gpll0_gpll4_gpll0_early_div), - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_floor_ops, }, }; From patchwork Wed Oct 19 08:29:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4852 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223849wrs; Wed, 19 Oct 2022 02:38:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7FrY9wF1VjKQDPV4ULpB0QWdsSP7g3p5agwzF0l+R21yDDn35GTScWM5ZxQb2pJVk7iFTs X-Received: by 2002:a17:906:4bd3:b0:731:3bdf:b95c with SMTP id x19-20020a1709064bd300b007313bdfb95cmr5952604ejv.677.1666172320491; Wed, 19 Oct 2022 02:38:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172320; cv=none; d=google.com; s=arc-20160816; b=TENHjH1Z+Q0TckiuKNjIamuaMxShVhsSaVZPfa4HlP2zWQwifOqW7GWx3pSWuogAcA 4+0tNb24VIbCfwdwLaNxgRF3WXN4YhUk6tFGe1L42PEKWoiv0BHhU/IPNEMU3CiR3l7n PmJ6S/g+N+2EOU0FVVxM1PtVHoEXr/ivk76/PVw1RdnlqJ3T5YR2FO8vGMN6tdxTQW2C WkDHf3GnRbPbfeJF3RsNQL8W+TOifg8CnyVhTeRa6jWzpCru4NtIskhF7N5sXhHWmKyG UnGx6ERTOmXOFBoYSlJV1GLrcjQ21Bhtj5Vs1OIRTZWCZr9QFQJmQ11ub0Ch8dAGfKJx B0rA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hwwLhRUER/Hbc51qCZ2z7Lv8XVtEnEqs7MyOVIS1IQE=; b=fUZlMAk09Nx3EU4H1bPCGLPX1ItLGbczmWpZkkjPNDBgvmXkVt90DUpbWWHe2RZnF1 2X3gfp/0smv/xDFiP0MlPoh75x6u7vgnfkDlA0LQpjDZc1yxSsdl0E3Pkbn7qCGSt7dn ufRzgGvE3e1VT35mY5TSqPLVJ/VNjbkbgnzxdWeoxQ4NyRJd5JZ1YKy2jyUzsqs5unWn 7ncVH6MTCJwCtPeMeyRNriBnKEses8TsRumv4ab7VsSV1tbb8zykKzu5XwcLgS4yx5Vh ynT0e5UOvUjMI0swquVEYZaeBlYMmV7BEJvvWwVyVMCzwbPot4+wcmeGKFAxLP4mEo/7 ujBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Xj0BKNVM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m19-20020a056402511300b00458b9b7bb2fsi16839576edd.396.2022.10.19.02.38.16; Wed, 19 Oct 2022 02:38: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=Xj0BKNVM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233620AbiJSJ1u (ORCPT + 99 others); Wed, 19 Oct 2022 05:27:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233567AbiJSJ0d (ORCPT ); Wed, 19 Oct 2022 05:26:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F4133E22F6; Wed, 19 Oct 2022 02:11:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 50151617FB; Wed, 19 Oct 2022 09:01:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F4EBC433B5; Wed, 19 Oct 2022 09:01:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170085; bh=WTP5UwOckZbMbSXMx2VCri9AardoaYuqySbMaS2HOr4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xj0BKNVM/LLsrBUyqYWo74P1mlxiC8QfCkcy6ZhhmcDf83zoDMt3zcp0m7sy+C3Up nXlKV8XLtxCvwJ+bukYgKu+pKkF8+EMculhga1QFbX62I2JCw9HF2/T67bRDD+tLgR xeCkKveYr9HsSzerjqsrlzkO0aHj8jsizEi9/A9c= 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 6.0 485/862] media: exynos4-is: fimc-is: Add of_node_put() when breaking out of loop Date: Wed, 19 Oct 2022 10:29:32 +0200 Message-Id: <20221019083311.396519600@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108307058912948?= X-GMAIL-MSGID: =?utf-8?q?1747108307058912948?= 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/samsung/exynos4-is/fimc-is.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/platform/samsung/exynos4-is/fimc-is.c b/drivers/media/platform/samsung/exynos4-is/fimc-is.c index e3072d69c49f..a7704ff069d6 100644 --- a/drivers/media/platform/samsung/exynos4-is/fimc-is.c +++ b/drivers/media/platform/samsung/exynos4-is/fimc-is.c @@ -213,6 +213,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 Wed Oct 19 08: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: 4828 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223555wrs; Wed, 19 Oct 2022 02:37:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5cdH2K9MLnC7RwfYQqcVcVGW31Z+TauGdENUrj0aZr2tE7A7/n2Rw7k794wxOPjN74MVzW X-Received: by 2002:a17:907:320a:b0:741:72ee:8f3 with SMTP id xg10-20020a170907320a00b0074172ee08f3mr6010198ejb.168.1666172268718; Wed, 19 Oct 2022 02:37:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172268; cv=none; d=google.com; s=arc-20160816; b=mv3AzChFVrH3jY7bIhvoErJ+bggFs4Cml4wBHtOgE6rIfrgIg8PopAbfAvAF6XYfP3 Aad2Nu23j/jU115vH1deyURbFZcHpPJ2Hzruj2z6MhF2Dgs5N9wPGEEmVcim0UzE8y/X /bEdV/RMf7dKaJt7pG6q6AVqnY+VoNI4h6+KBqskIxUP/qumoeAnMdr4ok3HaVyGVGEb q5ibw9Fz03FNXfsPhym7wlQx6cxWhvYNeQbaJWgQzyNhSQn6k0AjkeQnPxFRBej1WCYQ 5bs3eP7miy3ICSgvGKI0/GweMbvREbJb0feJ5YA4JCToKXFOSywebtxljAybW2oJ8X6G UN2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YNz7NnOxHKZUBORmijhyZdm3/Uh52RVNGTGa7VDwnkY=; b=lRD6vKaT7vRqhMnDunWjuQoys23LjPtWd5bbGGJcVvKvMkpZDBtQ6dMRWS7Vsgx/Yn akad6Hx8PayocmIAwnPyV1Y+bUr8ySUpGD7S5KkfTD0Gc43p5p9eWdw2pdGNxH+UqIVq 5uv0T3Wob8G2J7GKDEggOG5EmOIf5mvuJOLlFlGp8RdJ3CSDpBMVl8SghUVAYcsqffBz EujVLM37jjniLfZ687g3p0Zk9AbiKf8n1Lmy3UYyVTVdq9vo/U9TxgUgtlxNdikpyJkk 39yDDqAS4eKaYjV3gGQq1zcyH46km0h4TUGxYAtmFR7zeoun8A8phlaR7AWxGIocVTba GAUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ifqvi3Te; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u19-20020a17090617d300b00711da52c6e4si12357955eje.309.2022.10.19.02.37.23; Wed, 19 Oct 2022 02:37: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=ifqvi3Te; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233444AbiJSJW1 (ORCPT + 99 others); Wed, 19 Oct 2022 05:22:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233420AbiJSJVZ (ORCPT ); Wed, 19 Oct 2022 05:21:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6D4D3C16F; Wed, 19 Oct 2022 02:09: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 F143261807; Wed, 19 Oct 2022 09:01:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12F0EC433D6; Wed, 19 Oct 2022 09:01:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170088; bh=9IY8itcj0UntKkJNFI/Iu3RvzWtyhrIob2EbC+YLLxs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ifqvi3Te3cGp3CQx6+NZ1Oao+aiG4jhHPvNmy7U44XpeLQIZnmRkgSbuKc1Wg7AW6 IBProP9Uc5CWOe9o+CEz98Pq3P0eYcxnrzzle1AH0Ec8maYyDuVtB5a0NH7ASMLV7/ ubcu2u7QzaIF+hIk3iPE41blr57xEyU2Jkoy11I0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+bb25f85e5aa482864dc0@syzkaller.appspotmail.com, Dongliang Mu , Tommaso Merciai , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 6.0 486/862] media: airspy: fix memory leak in airspy probe Date: Wed, 19 Oct 2022 10:29:33 +0200 Message-Id: <20221019083311.448540730@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108252928304231?= X-GMAIL-MSGID: =?utf-8?q?1747108252928304231?= From: Dongliang Mu [ Upstream commit 23bc5eb55f8c9607965c20d9ddcc13cb1ae59568 ] The commit ca9dc8d06ab6 ("media: airspy: respect the DMA coherency rules") moves variable buf from stack to heap, however, it only frees buf in the error handling code, missing deallocation in the success path. Fix this by freeing buf in the success path since this variable does not have any references in other code. Fixes: ca9dc8d06ab6 ("media: airspy: respect the DMA coherency rules") Reported-by: syzbot+bb25f85e5aa482864dc0@syzkaller.appspotmail.com Signed-off-by: Dongliang Mu Reviewed-by: Tommaso Merciai Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/usb/airspy/airspy.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/media/usb/airspy/airspy.c b/drivers/media/usb/airspy/airspy.c index 240a7cc56777..7b1c40132555 100644 --- a/drivers/media/usb/airspy/airspy.c +++ b/drivers/media/usb/airspy/airspy.c @@ -1070,6 +1070,10 @@ static int airspy_probe(struct usb_interface *intf, ret); goto err_free_controls; } + + /* Free buf if success*/ + kfree(buf); + dev_info(s->dev, "Registered as %s\n", video_device_node_name(&s->vdev)); dev_notice(s->dev, "SDR API is still slightly experimental and functionality changes may follow\n"); From patchwork Wed Oct 19 08: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: 4839 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223718wrs; Wed, 19 Oct 2022 02:38:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7JX8tSOIRRNgYz80lmvcLfH03dxGrqmhqLSsCeOtTqAHeYng2iEZWwhjxdM1Wc0R7OFiSY X-Received: by 2002:a17:907:94c3:b0:78e:2866:f89f with SMTP id dn3-20020a17090794c300b0078e2866f89fmr5804508ejc.617.1666172297740; Wed, 19 Oct 2022 02:38:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172297; cv=none; d=google.com; s=arc-20160816; b=nmMsT+KvDwgX3kKbVkjzx33dQuuhVR+x/ugRmgx2dyNlmmEvCed4e43RQva1UpptXe PIT95fqkFMV+R6fxmMqApthc24jCGiVGxWZ1FNi1G6zWnzBJ+4BvE9qZQER0tt/ZSTAc da6zzhLAHsNd5GN30gwMt5+dQLzwmJYHmohUkGcWmQVLwPwJLFUOqamnXs8g3KtOxJeh W7qBaliFnf/4SYLFOTeUM5uSn+WA6fauRHnfv9JJHtPhrPiZedBc4qIm85sWikmgOOx3 q5jdz3gpyfVs0jn20Tr02U3/Na+5iV2NwUGLhPivZaoZYKR5ChVxvsaPrww6psqJlJX2 EPBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zaU51cqQT+cnhauim07kT6C9uoWnky7RpVyX/olHIM4=; b=lT2xxMyjA9fA43PTI1xJUtplP4TUzA/l7rt3j8C0PzVEXVQ0O21PQhEWovS1W3JcQL zAtOQv0Hz68lKRM6LXf80PSZ3O1SHoY2uduqbH3qBYfO5QfGxThuprAStxeI9mroKmWN 2PgWZs48zq97xMX+TighVfleXbvZbaoWzKU7CbRJ+iyPuoVHz89v6P6FRHlzX3dbF2nI mPKzv4+/NVQM0toCZay0zwHcGlddikshAVF3S9NOdSAUnrw0t79edaAIzPbVFEOSrS3A D3cNA4u7XYCK+nFSkGtSguSsuY7SoAn7/d6f1OJcY3XAqQQmKtT3ZgflI7eIEcTDJaEJ +EjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=a+JaT81r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b31-20020a509f22000000b00453aa9656a3si11958500edf.466.2022.10.19.02.37.50; Wed, 19 Oct 2022 02:38: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=a+JaT81r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229891AbiJSJWd (ORCPT + 99 others); Wed, 19 Oct 2022 05:22:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233440AbiJSJVk (ORCPT ); Wed, 19 Oct 2022 05:21:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38F3E4F38E; Wed, 19 Oct 2022 02:09: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 84A34617E3; Wed, 19 Oct 2022 09:01:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A475C433D7; Wed, 19 Oct 2022 09:01:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170091; bh=c0R0Pqk7vm5nMDDXB0fP+xSWuyXvMdhOLlZ3l/PnEKA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a+JaT81rQTqEfTU1y/587uBieJf6NmrOvBRVA+30WmZBT3x3lxdwoA3JCgjPV0ZrB 8uAdrUMANFvRqr5e0wFrMgrzdRRZ/Ytb04ORuK5AHqZKXw05qWHWGoipngrNCLHj7l +ML/6gZLrwK0hxHoexLCCA2Sp0x+QwGCr4yT9RTY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shubhrajyoti Datta , Sasha Levin Subject: [PATCH 6.0 487/862] tty: xilinx_uartps: Check clk_enable return value Date: Wed, 19 Oct 2022 10:29:34 +0200 Message-Id: <20221019083311.500145609@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108283327737022?= X-GMAIL-MSGID: =?utf-8?q?1747108283327737022?= From: Shubhrajyoti Datta [ Upstream commit 957e8c047bf25bd24271ab049f06dc47f382973f ] If clocks are not enabled the register access may hang the system. Check for the clock enable return value and bail out if not enabled. Signed-off-by: Shubhrajyoti Datta Link: https://lore.kernel.org/r/20220729114748.18332-2-shubhrajyoti.datta@xilinx.com Signed-off-by: Greg Kroah-Hartman Stable-dep-of: b8a6c3b3d465 ("tty: xilinx_uartps: Fix the ignore_status") Signed-off-by: Sasha Levin --- drivers/tty/serial/xilinx_uartps.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index 9e01fe6c0ab8..51fd09e14eda 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -1329,12 +1329,20 @@ static int cdns_uart_resume(struct device *device) unsigned long flags; u32 ctrl_reg; int may_wake; + int ret; may_wake = device_may_wakeup(device); if (console_suspend_enabled && uart_console(port) && !may_wake) { - clk_enable(cdns_uart->pclk); - clk_enable(cdns_uart->uartclk); + ret = clk_enable(cdns_uart->pclk); + if (ret) + return ret; + + ret = clk_enable(cdns_uart->uartclk); + if (ret) { + clk_disable(cdns_uart->pclk); + return ret; + } spin_lock_irqsave(&port->lock, flags); From patchwork Wed Oct 19 08: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: 4769 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214895wrs; Wed, 19 Oct 2022 02:14:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6CD3NS4gCNS6W//nTAFPKxJh20NGYc0JGhX83cbEJNJow3qL3W8xrAaQcQJZbOq5A92hvM X-Received: by 2002:a05:6402:5191:b0:45c:dea0:2c7 with SMTP id q17-20020a056402519100b0045cdea002c7mr6339602edd.239.1666170843000; Wed, 19 Oct 2022 02:14:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170842; cv=none; d=google.com; s=arc-20160816; b=eybS/mZdQ80o2XsJw/+YIp8O8q0tBTbF4Kcstpf8fAE3I7DZFFAo4KLrBUz8z3PB6K 4en0sQybxJgAW2bnaOr7psfWXxSRQxBq7TnA046/xoQDH9+GBaR9M5NSA45gBKeVg5Sv R2nxhXeWOQ+DXkXR/GLrfgITCx5l13rOIhwmdvDFhWHshK71o7YeHImfZyGj29xNv0aJ ZLfZN9nrb9sPJsaMWZx/Jpp31XRvDloYZd2tGedqBM2MFE8LrTn5KveNtJfpxzfwKcbP z58jPQNaV/Qh0pXZld/no0UcbV0UGL1KlHM8qNP5atc63l9e+BUBEC96ps0Mf75hSy6Z XxVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vTOk1xQQIk8fkcD/ent6ImaHoRpVsStjGAj1GuG2Hl0=; b=Zc1CO9aBDNtYGi7wo1w52R1yKM8mE1sqyL6fbYRf9YaFgPFtjhBx+3WjW6TXKiJ2Oa 2f/N9h7erTMEzMBYtASRhcc9huti8xpefu9AvReK4hR7Qno7HB38ytPGVD/B/LbPWKZQ KsXtOD1XPh8MKRlh6HPksbB/XRhbJHwkq0+YVniz8kY+C8swQTDjbT5QU8Kz5wAhjg2Y FvOimInsupZb0LjEODiSvhnhTnpIBGcxIo0w2NbJ2lc1Ff4bXlPbEw+UBIxd72qpnQ1e jSZ7V7IzQsDCWanDtnzf1sTDxeux465H9zFtwAnQw8IqCBIUJjpGYjtmOYGjrcuA2kel 0XSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=As8ZGEpM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qw21-20020a1709066a1500b007811e006b46si13943213ejc.470.2022.10.19.02.13.38; Wed, 19 Oct 2022 02:14:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=As8ZGEpM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232956AbiJSJMp (ORCPT + 99 others); Wed, 19 Oct 2022 05:12:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233055AbiJSJKC (ORCPT ); Wed, 19 Oct 2022 05:10:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE95253001; Wed, 19 Oct 2022 02:01: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 6374A61802; Wed, 19 Oct 2022 09:01:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79CA2C433C1; Wed, 19 Oct 2022 09:01:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170093; bh=Hn4JxalTNSwTzfXzV9WoJbF8SYgGMxOueUMP+zwt/8c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=As8ZGEpMYGjEAsyuRtAbUz4QmvKeQWHuqbzejpIPWl+njk9uqKb74xsFNFTqVHrKY hodkcXJViZfBfULwfSREZfyBnMHzDWTCI+O4XhZsh0/MvQIfFT0sQa9D3aX29vF84L KUqHrRoMrrQOnqGMxeCYUlqjK2QJycvI/OoVHgSA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shubhrajyoti Datta , Sasha Levin Subject: [PATCH 6.0 488/862] tty: xilinx_uartps: Fix the ignore_status Date: Wed, 19 Oct 2022 10:29:35 +0200 Message-Id: <20221019083311.550741287@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106757718520156?= X-GMAIL-MSGID: =?utf-8?q?1747106757718520156?= 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 51fd09e14eda..769044dfe990 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -361,6 +361,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 Wed Oct 19 08: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: 4934 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp226229wrs; Wed, 19 Oct 2022 02:45:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5PYPq97DlvMYKHwt+jwMthMApe8hNGevjDhYnzuQ4NoHjCMd8ZefsJrjSFCMX1dZI7XOQb X-Received: by 2002:a62:1bd1:0:b0:562:a99e:93cd with SMTP id b200-20020a621bd1000000b00562a99e93cdmr7731361pfb.21.1666172719863; Wed, 19 Oct 2022 02:45:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172719; cv=none; d=google.com; s=arc-20160816; b=XWyftuj+UQy8BidM6MXjIZ3KgalPauOMorerDfSNA0GXQ0KiEojd+1sSSzKH4ZoTXy TV44osamOyTSpr3Mu3Zd5ZcM7k474gvGevgEoYA+6I9Fnxx8pXDWwTkvX8xcRzusq3B/ LWKW6Pa5QEmyd6+/3ApbwSawkQRGcPwNbILJyTIirppNzBUw4rI2nMjzBWxbzbtg5Fqg q/Htnjsu/1dmP7O24k1Ey5pRM59T0dBiYuJ01yCXNHVpK2nV4FHFe3vIDDQwUrm/iDjQ KMep0eMAJZNtHKEhuH3ZKe4t5+nKtvDsdV2Q13WRR/JpKarrqwLiVcu6Snmq0TQjxi9V tuPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=mjgFDvA7C+2/ZsC94puDKP9Y7VfuPVuDMyssrpge7Z4=; b=A91Auqio+w1UxhKVixdhXN2UqR9J+a9NhVPcMVYzGnN1PK9ZfaZksD5tn8L3O9hht5 36pCTmWyQwV25dhmMlL6y4z/e4whQYcjLTFEvTjuxH+bUhQPGR4MNU8CNbgXzSQdkfw0 xDscKF83rkqoOFHsHyDrMOYQOxDefVbJgMjpjURk9FrOqcgIHAyY5Q9vth1/ti5z3RXu mELkjuZYJJh0Xmjx84Y9Rxm697cPZ1KmHvhCb6JE+gfv9HZNcSg+S+3v1CktOS9nE3Q8 JDyPNjk8ZfZPQAu06qLlFfSXPjIMzHgWukjfU1h8i2GwN2PTLCyzhAhdQlgp3P9M/PMm eLiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=D5n3cPBG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a63d708000000b0044a82d20079si18443253pgg.526.2022.10.19.02.45.05; Wed, 19 Oct 2022 02:45: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=D5n3cPBG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233880AbiJSJgH (ORCPT + 99 others); Wed, 19 Oct 2022 05:36:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233904AbiJSJ3t (ORCPT ); Wed, 19 Oct 2022 05:29: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 F2873C4DB9; Wed, 19 Oct 2022 02:13: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 10E5061753; Wed, 19 Oct 2022 09:01:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14A30C433C1; Wed, 19 Oct 2022 09:01:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170096; bh=JsDx77DlKx59+hH1YurFER2oKGhdjNdket3/uH/5OJU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D5n3cPBGYmPgYdg5YUBnpKGCuMW0D604mkOTev61dKuOPx3X2JmFFeCssoTtE4jM0 FGBm6aOnS3VSHqHYbqn9Kv4Qj5Weq2sPSeVZytP4rhalG71IePTItnCZptrf55mZXR B/QrY1cBl3u4+ncyFjzqc3oUKe4CcfNzNbvQORe8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hirokazu Honda , Chen-Yu Tsai , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 6.0 489/862] media: mediatek: vcodec: Skip non CBR bitrate mode Date: Wed, 19 Oct 2022 10:29:36 +0200 Message-Id: <20221019083311.591055410@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108725800679272?= X-GMAIL-MSGID: =?utf-8?q?1747108725800679272?= From: Hirokazu Honda [ Upstream commit e7bfdf0a854037e8c0597f1f44f72651869c424d ] V4L2_MPEG_VIDEO_BITRATE_MODE_CBR is the only bitrate mode supported by the mediatek driver. The other bitrates must be skipped in QUERY_MENU. Fixes: d8e8aa866ed8 ("media: mediatek: vcodec: Report supported bitrate modes") Signed-off-by: Hirokazu Honda Reviewed-by: Chen-Yu Tsai Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc.c index 25e816863597..27c5fdaabed4 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc.c @@ -1403,7 +1403,8 @@ int mtk_vcodec_enc_ctrls_setup(struct mtk_vcodec_ctx *ctx) V4L2_MPEG_VIDEO_VP8_PROFILE_0, 0, V4L2_MPEG_VIDEO_VP8_PROFILE_0); v4l2_ctrl_new_std_menu(handler, ops, V4L2_CID_MPEG_VIDEO_BITRATE_MODE, V4L2_MPEG_VIDEO_BITRATE_MODE_CBR, - 0, V4L2_MPEG_VIDEO_BITRATE_MODE_CBR); + ~(1 << V4L2_MPEG_VIDEO_BITRATE_MODE_CBR), + V4L2_MPEG_VIDEO_BITRATE_MODE_CBR); if (handler->error) { From patchwork Wed Oct 19 08: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: 4766 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214852wrs; Wed, 19 Oct 2022 02:13:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM45Jp5gaXGe3p00JDbxIkriUDsEmlzKtMHJg3UxPcPzdVRLZZ0OT7RnSoltQMb5fOG8kclj X-Received: by 2002:a17:906:6a0b:b0:78d:b81d:c2e4 with SMTP id qw11-20020a1709066a0b00b0078db81dc2e4mr5665136ejc.218.1666170837084; Wed, 19 Oct 2022 02:13:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170837; cv=none; d=google.com; s=arc-20160816; b=cBiByaoFm50WQIDzl828ie5w/vbYYISxWvc4fsdFlmE/541MFsu0/ui+Y8kA8N2rUT FwZIAgqK4viuwzKNettu7RjO3xYOl1X8g614mmICl8mH4nYkQwjeR7LFn0w64w6Q7u5B abX5BhdBEGsEU1ho10wHk+bfrZDM1yXvrjrShINCefVbYL8AgjQQOYkWu4UX8jQP/DmR ln51g8sFbp1XWDhksOVCX6pSrnYU24281tTx2ecQmnOAHZEtPUY6cfaAx+zTRFgKmctC li/eKo+nd9SYA6vID8qbAulRgo8L2b9nsABWqEhaRscpW8bfS0vt0sOaBJhb+2XgBBan UO+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=f6Zcl8MD7r0pWX89egirs7qT6+kZRndZUD6gSOEmGFI=; b=uZ8nqHJGD1yWKRk/slUvmPrcu5fvDbRFMXy+8zNrMEdAHeg0MKX/vHxatBwR7GJGKM zCJXWPD2VHTbVzxFBYJEshr3/daCW97yW0swUpRmZvP0/L/1r1bdm7hhbV0LxOPIwJW2 nVJk+EpeoU+rYRVbolIMuIC7qh23XBD3pwIpGU/myHAoRghIwc+CDtCFcdWjPKTzPxvu twZQn1n4KjR8cKTKaGd0puZ8Dw7zxXiXkZKiIwbmBgDFWFTW/rxrY5NugFBzr/B5wbYC KrvB4Awx+SWpAFF7bQwd/20/NYHBK4PQW5zVayO420aaV1LNCvf7CpkXze5JKFv30vhr yZwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jQXSI8i9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y11-20020a056402358b00b0045d22bc81a0si13806135edc.231.2022.10.19.02.13.32; Wed, 19 Oct 2022 02:13: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=jQXSI8i9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232880AbiJSJMC (ORCPT + 99 others); Wed, 19 Oct 2022 05:12:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232821AbiJSJJW (ORCPT ); Wed, 19 Oct 2022 05:09:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A908C72947; Wed, 19 Oct 2022 02:00:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 00CCC6183C; Wed, 19 Oct 2022 09:00:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 00A9BC433D6; Wed, 19 Oct 2022 09:00:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170001; bh=Y9P6m1PbPCOui9z0QKgPu7ldnlI2rzx7ssJipzwrzGI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jQXSI8i9GY2F6EQxD1EsodiBqKX9jyT9hs8m7Jg5NN4m17QRp4LZV1FSdzSVrfYSB EMq8U1BSiaxIhafSog7RdrQ6WkzAzgIQJ4vpbQ36ov9g9yoBU/luRZbjRWdqMqJbPS lhEsye/wPspenfwRTlA27M5+VraPkiTi07YzMSo0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Qian , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 6.0 490/862] media: amphion: insert picture startcode after seek for vc1g format Date: Wed, 19 Oct 2022 10:29:37 +0200 Message-Id: <20221019083311.640131293@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106751937879945?= X-GMAIL-MSGID: =?utf-8?q?1747106751937879945?= From: Ming Qian [ Upstream commit f7fd6c318c8a5d06bf3fe611f30763d62eaaf7f0 ] For format vc1, the amphion vpu requires driver to help insert some custom startcode before sequence and frame. the startcode is different for vc1l and vc1g format. But the sequence startcode is only needed at the beginning, and it's not expected after seek. driver need to treat the codec header and the first frame after seek as a normal frame, and insert picture startcode for it. In previous patch, I just fix it for vc1l format, and should fix the similar issue for vc1g too. Fixes: e670f5d672ef (media: amphion: only insert the first sequence startcode for vc1l format) Signed-off-by: Ming Qian Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/amphion/vpu_malone.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/amphion/vpu_malone.c b/drivers/media/platform/amphion/vpu_malone.c index f4a488bf9880..51e0702f9ae1 100644 --- a/drivers/media/platform/amphion/vpu_malone.c +++ b/drivers/media/platform/amphion/vpu_malone.c @@ -1293,7 +1293,7 @@ static int vpu_malone_insert_scode_vc1_g_pic(struct malone_scode_t *scode) vbuf = to_vb2_v4l2_buffer(scode->vb); data = vb2_plane_vaddr(scode->vb, 0); - if (vbuf->sequence == 0 || vpu_vb_is_codecconfig(vbuf)) + if (scode->inst->total_input_count == 0 || vpu_vb_is_codecconfig(vbuf)) return 0; if (MALONE_VC1_CONTAIN_NAL(*data)) return 0; From patchwork Wed Oct 19 08: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: 4776 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp215689wrs; Wed, 19 Oct 2022 02:16:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM565q4pA5fCvPMr0MpnqJln2SNEQEzbqVz6aapFp7StiLH1I2cc+rAqJw021QXIGCmVXPEe X-Received: by 2002:a17:906:58d2:b0:78d:9d2f:3005 with SMTP id e18-20020a17090658d200b0078d9d2f3005mr5616343ejs.697.1666170982465; Wed, 19 Oct 2022 02:16:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170982; cv=none; d=google.com; s=arc-20160816; b=tJgBIgJbEb/vo6RIZ9qkkWPg0+OHv+TCcT7qtplV47MoOYU8qSIJGe8NlC6UlzD1OU Bm1jiKq1gmJvgGiwiH3/t4LFYimPYpIjZWAZVn6h50Dmqk+R4/0PiZMDlok1mFxpmzs0 tCkPD2KmEqAI1A7EZXaYf7KdkjBTBeterIY5iAGRcl3hG+W8AejTp2mAbxs0G68kwwPr 9S14ohUU5jUIhcJArTZfddDLhaxatz5iCGb9PAo1bB1rDdWq+CC8uFkBIDmhBejoZO4g yDyx8oNkA34qUaWPhTZ/Tsrhx+JZxRlIc9kthoWgy4FW1CcTzoAhRat8Ur6Sr58M+Dlm do4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TmlmzHVX7GCTezd0n23VtQLolnOiHokLTFDC6pDGQNU=; b=JJk0VL+WzlxnOyr0Doei6iqLsbbwkqQexBn2kbAZiDe0RVRi8dhTvxdzFnR7ueowfb KP8UffXrioQ9Z8DqnZnwOwN6sXar7G9RzrrgVKOLtwwku/17/P3smSuyLdXIHkyG4UsS 5NjmzBThcZiGgZaYk25VH+g5SauVHpMDQjxCvyOKP59ortdIPfaeW8Zc7wMfhtpG8LN7 JnHUqH3tpyZL8KLOl8/qwqWk+NoOBFVK72cYoEkHyNPk6RGvUit9yXtE/v9V7MenUGuu rbEJFRkMK/1fIi7GUUTqIOMBI7npU1bLjQbvY1oa59hrsuAknkJDI3EgckCqPuh5sva1 /1Qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FDl9e9q4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id js22-20020a17090797d600b0078dcfe6a000si15627692ejc.727.2022.10.19.02.15.55; Wed, 19 Oct 2022 02:16:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FDl9e9q4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233008AbiJSJNN (ORCPT + 99 others); Wed, 19 Oct 2022 05:13:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233231AbiJSJKa (ORCPT ); Wed, 19 Oct 2022 05:10:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C4EBBA91E; Wed, 19 Oct 2022 02:02:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8E7A3617D1; Wed, 19 Oct 2022 09:00:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A52D2C433D7; Wed, 19 Oct 2022 09:00:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170004; bh=SPlFG2GdKVscxA6rjQ8dsy9EO2LGv3Cxg7UH6JBhp68=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FDl9e9q4n2ZLTIIIMqdE/2riJ4hFjyQ/IvjU5mj6i0vqH8X2QQrFl/YeRuYnhiKU+ abViJrqum6Vi9ZDdcWRL2Hv+L/7JF3trW4Txu84/5y7w9rD1kp2Tp9tJx2e9fBGqFP 1vCbbK1z5pO32HiGWfNlyrpqB7cqwAkeM8Q6qH2M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Qian , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 6.0 491/862] media: amphion: adjust the encoders value range of gop size Date: Wed, 19 Oct 2022 10:29:38 +0200 Message-Id: <20221019083311.690094528@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106904544087059?= X-GMAIL-MSGID: =?utf-8?q?1747106904544087059?= From: Ming Qian [ Upstream commit 996f4e89fabe44ab9ac0aabb0697aeecbe717eca ] adjust the value range of gop size from [0, 65535] to [1, 8000]. when the gop size is set to a too large value, it may affect the encoded picture quality. so constrain it to a reasonable range. Fixes: 0401e659c1f92 ("media: amphion: add v4l2 m2m vpu encoder stateful driver") Signed-off-by: Ming Qian Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/amphion/venc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/amphion/venc.c b/drivers/media/platform/amphion/venc.c index 461524dd1e44..37212f087fdd 100644 --- a/drivers/media/platform/amphion/venc.c +++ b/drivers/media/platform/amphion/venc.c @@ -644,7 +644,7 @@ static int venc_ctrl_init(struct vpu_inst *inst) BITRATE_DEFAULT_PEAK); v4l2_ctrl_new_std(&inst->ctrl_handler, &venc_ctrl_ops, - V4L2_CID_MPEG_VIDEO_GOP_SIZE, 0, (1 << 16) - 1, 1, 30); + V4L2_CID_MPEG_VIDEO_GOP_SIZE, 1, 8000, 1, 30); v4l2_ctrl_new_std(&inst->ctrl_handler, &venc_ctrl_ops, V4L2_CID_MPEG_VIDEO_B_FRAMES, 0, 4, 1, 0); From patchwork Wed Oct 19 08: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: 5228 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp266027wrs; Wed, 19 Oct 2022 04:23:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7no4O7xQiylbE2iuWJf7bVO0hGh1bBjm64cGTBBlFjketPKVbya5gNqMKvArHXRuq5883A X-Received: by 2002:a63:da4f:0:b0:43f:6af:74ed with SMTP id l15-20020a63da4f000000b0043f06af74edmr6910452pgj.290.1666178621953; Wed, 19 Oct 2022 04:23:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178621; cv=none; d=google.com; s=arc-20160816; b=mCS3SDiNnULi90eTpKUHol8yus1BAk4up12RivMOKtGkhoV+oVs6OwtD0Lld570qH0 4+z6Hhk016QPa/yDywZwsdFBOYE6xeTtS1NyDLX26DR8tiBB+YYk/FP0OjGyM6GWciDw SYS4XemH4LSyKEXTQu/RXx3VrpvawcDFr9gEpgrMdGw3T8FQwSeL8E7wF9TeNFSi9E3w 1gz+F+h3f94p4tl0gAOonqBivoA4TbL8Os8W/Ohl90JPdlNisbTYbp31Wh3mrDmmYcv4 NkM1BVsq+nlNjbeV9gwenonSbwZFceBsMzQqs4KgVNqMKibS349l2d/WXurEtraaVIk0 vQgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UmjCuZmX0JhxCzHFet7tHXHBoLaCJoQdSfpQeJ6pVlc=; b=MhcxJjyRBCE6cBUxmMkrhuDheVWrQMbkyiPxVUsPw8auUCdjeDF43GwRphtScVNI14 T5MIlJiH4YgHTcxNSQFghR/MK9Zd7h5hfAcc5qLddOHh3RSauipqJQgswXG2dRe/hdUD /xAiUbJoeO3+JKsErqMbqniz2yOKsT7gse8HWrtlULLfKnNYstczzn9dBdUHHs/kipOu SIDJ1epEdVD7RXHTtazE73fFwzkwwCRHIW+5QB0DoKdFfVSnUGjtVMdVf1droV+wb7me X1ZCj/Wx+iGp2eqc/cYCQRpYlJPQu4hO2QnG2giJI1E/gLleOhXJ5vsxRBD9kzNnrZ1P wVNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dMOMn7qr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z11-20020a630a4b000000b0044b8e2abe1csi18747263pgk.170.2022.10.19.04.23.28; Wed, 19 Oct 2022 04:23: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=dMOMn7qr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229756AbiJSLMc (ORCPT + 99 others); Wed, 19 Oct 2022 07:12:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232190AbiJSLL3 (ORCPT ); Wed, 19 Oct 2022 07:11:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08C80152C6F; Wed, 19 Oct 2022 03:38: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 29E0C617F0; Wed, 19 Oct 2022 09:00:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3BC2FC433D7; Wed, 19 Oct 2022 09:00:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170006; bh=S4RSHtuV1Yq7gBtTypNHchaWySqiBm1BQG1Zydq1K/Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dMOMn7qrddfAc6xqWngJeM5kpklMQ4xasrJIGZc1fcZOS9wLYORoeTxaeqjagmdzU fwYtyOLqsbJMUI9k79zi71WO7pWmaFj2AxfDuv3QfN1v1HdBRCj12bkU7OMJ5YeC0M XWsoVy9ZVUGQJ6uXkBZhU/ehRYLO9ci/7KFjSvcA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Qian , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 6.0 492/862] media: amphion: dont change the colorspace reported by decoder. Date: Wed, 19 Oct 2022 10:29:39 +0200 Message-Id: <20221019083311.727638675@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114914590885518?= X-GMAIL-MSGID: =?utf-8?q?1747114914590885518?= From: Ming Qian [ Upstream commit 61c2698ee60630c6a7d2e99850fa81ff6450270a ] decoder will report the colorspace information which is parsed from the sequence header, if they are unspecified, just let application to determine it, don't change it in driver. Fixes: 6de8d628df6ef ("media: amphion: add v4l2 m2m vpu decoder stateful driver") Signed-off-by: Ming Qian Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/amphion/vdec.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/media/platform/amphion/vdec.c b/drivers/media/platform/amphion/vdec.c index 9e64041cc1c1..feb75dc204de 100644 --- a/drivers/media/platform/amphion/vdec.c +++ b/drivers/media/platform/amphion/vdec.c @@ -808,14 +808,6 @@ static void vdec_init_fmt(struct vpu_inst *inst) inst->cap_format.field = V4L2_FIELD_NONE; else inst->cap_format.field = V4L2_FIELD_SEQ_TB; - if (vdec->codec_info.color_primaries == V4L2_COLORSPACE_DEFAULT) - vdec->codec_info.color_primaries = V4L2_COLORSPACE_REC709; - if (vdec->codec_info.transfer_chars == V4L2_XFER_FUNC_DEFAULT) - vdec->codec_info.transfer_chars = V4L2_XFER_FUNC_709; - if (vdec->codec_info.matrix_coeffs == V4L2_YCBCR_ENC_DEFAULT) - vdec->codec_info.matrix_coeffs = V4L2_YCBCR_ENC_709; - if (vdec->codec_info.full_range == V4L2_QUANTIZATION_DEFAULT) - vdec->codec_info.full_range = V4L2_QUANTIZATION_LIM_RANGE; } static void vdec_init_crop(struct vpu_inst *inst) @@ -1555,6 +1547,14 @@ static int vdec_get_debug_info(struct vpu_inst *inst, char *str, u32 size, u32 i vdec->codec_info.frame_rate.numerator, vdec->codec_info.frame_rate.denominator); break; + case 9: + num = scnprintf(str, size, "colorspace: %d, %d, %d, %d (%d)\n", + vdec->codec_info.color_primaries, + vdec->codec_info.transfer_chars, + vdec->codec_info.matrix_coeffs, + vdec->codec_info.full_range, + vdec->codec_info.vui_present); + break; default: break; } From patchwork Wed Oct 19 08: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: 5116 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp250996wrs; Wed, 19 Oct 2022 03:50:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5oYzChl4TfFx/BRqBXy05WddUHH77DnJByv4dbCpvcs5BRDC0hzD6dgtBfzBcbX0K0lvdQ X-Received: by 2002:a17:906:5daa:b0:78d:fa76:f837 with SMTP id n10-20020a1709065daa00b0078dfa76f837mr5963845ejv.239.1666176634096; Wed, 19 Oct 2022 03:50:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176634; cv=none; d=google.com; s=arc-20160816; b=KO4mYVq92epFVgSer10SocvJtp/46HzBNMw0Ye+Mxrt3hyG9aXaShf2zJG7pR/xjbX 6bDwCPieOJhsywRLh76yh2l8eEMLAtsG6uI7yjABOL8XCPx31/qnIEXrvA/obldikjXb aSQmvLjT19uwcguIm0y895NhctxMDPOoBCv8L65qWDYGZ/7GYsRF3JyhEqMky3HFiNKY 5CjEmPOqQ6LTj00A2IqMp0y1SwuQZwTZBhlxb//Syll94p7khMit0cjoxNJ6QsoOGj8q szYhh08+kP1bgLaMcL+ngwOMCDgRURQz8Sy/4PPxnbXPZ6OMugtOz/W69dPNmh7Y+8OI w2mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rtckd15IN/5Ed7G3YeDhSH8nEJLivVrTX3c3T4dJPWU=; b=XgcMQ1y94QHe+EL+2T7Noz3p5yRDMQFcWsyei65IPkoZTG0Qsc4S5aO0QolbX6mCEi Z6OCh5b+TFHDgXElPYzX6yHynEYH4K7lGMGAj5ARb7xaQGaBCkwFWo7jUyjAlqerWdHz daSTkb8vucTOsc1/xj/8i+vm96P7whXptcoetzClBHLqfChBnzpLZ1V1Tpqm2iSmTxaE uXkfnIJRayY09z+lXnMcyU3lpav/2JLWVZjZ+dPWy7ri/08lY3zVy8JHF3z9zDFBzFoq jUJl6GZG8UmvMCuLOW+4sP1FSEleLmNtXgSGrmDslvRI12J8/w52XmN+SpyacPQE7kA1 dzFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2oL672Tu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a1709062ad600b0078e11e9286csi11126696eje.195.2022.10.19.03.50.09; Wed, 19 Oct 2022 03:50:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2oL672Tu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234386AbiJSKs6 (ORCPT + 99 others); Wed, 19 Oct 2022 06:48:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233360AbiJSKqr (ORCPT ); Wed, 19 Oct 2022 06:46:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C58FA159D58; Wed, 19 Oct 2022 03:21: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 4E4A1B82455; Wed, 19 Oct 2022 09:00:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C20D5C433B5; Wed, 19 Oct 2022 09:00:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170009; bh=ItZpQgxAUDOyp9TQfo2oO3+DygomgjSsUCLiv7TTOqU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2oL672TuV2uNzx7m8z2T/PGkF4+PEshEGPUzvtzFcZ23WQ1l4mgCMNcR9Vy/gYE3a zXHvQ5k70AKloycBSLejeeJCj5MCKgSMDP2Z7KNwW0bWAGhO5EM5r9SGHnpMzUUBpZ x8usSbZ89YRNF2hSOB1r4EZPP5+rD+mAbgYrYtJ8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Qian , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 6.0 493/862] media: amphion: fix a bug that vpu core may not resume after suspend Date: Wed, 19 Oct 2022 10:29:40 +0200 Message-Id: <20221019083311.771847647@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112830226490057?= X-GMAIL-MSGID: =?utf-8?q?1747112830226490057?= From: Ming Qian [ Upstream commit 0202a665bf17fbe98fed954944aabbcb4f14a4cc ] driver will enable the vpu core when request the first instance on the core. one vpu core can only support 8 streaming instances in the same time, the instance won't be added to core's list before streamon. so the actual instance count may be greater then the number in the core's list. in pm resume callback, driver will resume the core immediately if core's list is not empty. but this check is not accurate, if suspend during one instance is requested, but not streamon, then after suspend, the core won't be resume, and led to instance failure. use the request_count instead of the core's list to check whether is the core needed to resume immediately after suspend. And it can make the pm suspend and resume callback more clear. Fixes: 9f599f351e86 ("media: amphion: add vpu core driver") Signed-off-by: Ming Qian Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/amphion/vpu.h | 1 - drivers/media/platform/amphion/vpu_core.c | 84 ++++++++++++----------- drivers/media/platform/amphion/vpu_core.h | 1 + drivers/media/platform/amphion/vpu_dbg.c | 9 ++- 4 files changed, 51 insertions(+), 44 deletions(-) diff --git a/drivers/media/platform/amphion/vpu.h b/drivers/media/platform/amphion/vpu.h index f914de6ed81e..beac0309ca8d 100644 --- a/drivers/media/platform/amphion/vpu.h +++ b/drivers/media/platform/amphion/vpu.h @@ -119,7 +119,6 @@ struct vpu_mbox { enum vpu_core_state { VPU_CORE_DEINIT = 0, VPU_CORE_ACTIVE, - VPU_CORE_SNAPSHOT, VPU_CORE_HANG }; diff --git a/drivers/media/platform/amphion/vpu_core.c b/drivers/media/platform/amphion/vpu_core.c index 73faa50d2865..f9ec1753f7c8 100644 --- a/drivers/media/platform/amphion/vpu_core.c +++ b/drivers/media/platform/amphion/vpu_core.c @@ -89,7 +89,7 @@ static int vpu_core_boot_done(struct vpu_core *core) core->supported_instance_count = min(core->supported_instance_count, count); } core->fw_version = fw_version; - core->state = VPU_CORE_ACTIVE; + vpu_core_set_state(core, VPU_CORE_ACTIVE); return 0; } @@ -172,10 +172,26 @@ int vpu_alloc_dma(struct vpu_core *core, struct vpu_buffer *buf) return __vpu_alloc_dma(core->dev, buf); } -static void vpu_core_check_hang(struct vpu_core *core) +void vpu_core_set_state(struct vpu_core *core, enum vpu_core_state state) { - if (core->hang_mask) - core->state = VPU_CORE_HANG; + if (state != core->state) + vpu_trace(core->dev, "vpu core state change from %d to %d\n", core->state, state); + core->state = state; + if (core->state == VPU_CORE_DEINIT) + core->hang_mask = 0; +} + +static void vpu_core_update_state(struct vpu_core *core) +{ + if (!vpu_iface_get_power_state(core)) { + if (core->request_count) + vpu_core_set_state(core, VPU_CORE_HANG); + else + vpu_core_set_state(core, VPU_CORE_DEINIT); + + } else if (core->state == VPU_CORE_ACTIVE && core->hang_mask) { + vpu_core_set_state(core, VPU_CORE_HANG); + } } static struct vpu_core *vpu_core_find_proper_by_type(struct vpu_dev *vpu, u32 type) @@ -188,11 +204,13 @@ static struct vpu_core *vpu_core_find_proper_by_type(struct vpu_dev *vpu, u32 ty dev_dbg(c->dev, "instance_mask = 0x%lx, state = %d\n", c->instance_mask, c->state); if (c->type != type) continue; + mutex_lock(&c->lock); + vpu_core_update_state(c); + mutex_unlock(&c->lock); if (c->state == VPU_CORE_DEINIT) { core = c; break; } - vpu_core_check_hang(c); if (c->state != VPU_CORE_ACTIVE) continue; if (c->request_count < request_count) { @@ -409,6 +427,12 @@ int vpu_inst_register(struct vpu_inst *inst) } mutex_lock(&core->lock); + if (core->state != VPU_CORE_ACTIVE) { + dev_err(core->dev, "vpu core is not active, state = %d\n", core->state); + ret = -EINVAL; + goto exit; + } + if (inst->id >= 0 && inst->id < core->supported_instance_count) goto exit; @@ -450,7 +474,7 @@ int vpu_inst_unregister(struct vpu_inst *inst) vpu_core_release_instance(core, inst->id); inst->id = VPU_INST_NULL_ID; } - vpu_core_check_hang(core); + vpu_core_update_state(core); if (core->state == VPU_CORE_HANG && !core->instance_mask) { int err; @@ -459,7 +483,7 @@ int vpu_inst_unregister(struct vpu_inst *inst) err = vpu_core_sw_reset(core); mutex_lock(&core->lock); if (!err) { - core->state = VPU_CORE_ACTIVE; + vpu_core_set_state(core, VPU_CORE_ACTIVE); core->hang_mask = 0; } } @@ -609,7 +633,7 @@ static int vpu_core_probe(struct platform_device *pdev) mutex_init(&core->cmd_lock); init_completion(&core->cmp); init_waitqueue_head(&core->ack_wq); - core->state = VPU_CORE_DEINIT; + vpu_core_set_state(core, VPU_CORE_DEINIT); core->res = of_device_get_match_data(dev); if (!core->res) @@ -758,33 +782,18 @@ static int __maybe_unused vpu_core_resume(struct device *dev) mutex_lock(&core->lock); pm_runtime_resume_and_get(dev); vpu_core_get_vpu(core); - if (core->state != VPU_CORE_SNAPSHOT) - goto exit; - if (!vpu_iface_get_power_state(core)) { - if (!list_empty(&core->instances)) { + if (core->request_count) { + if (!vpu_iface_get_power_state(core)) ret = vpu_core_boot(core, false); - if (ret) { - dev_err(core->dev, "%s boot fail\n", __func__); - core->state = VPU_CORE_DEINIT; - goto exit; - } - } else { - core->state = VPU_CORE_DEINIT; - } - } else { - if (!list_empty(&core->instances)) { + else ret = vpu_core_sw_reset(core); - if (ret) { - dev_err(core->dev, "%s sw_reset fail\n", __func__); - core->state = VPU_CORE_HANG; - goto exit; - } + if (ret) { + dev_err(core->dev, "resume fail\n"); + vpu_core_set_state(core, VPU_CORE_HANG); } - core->state = VPU_CORE_ACTIVE; } - -exit: + vpu_core_update_state(core); pm_runtime_put_sync(dev); mutex_unlock(&core->lock); @@ -798,18 +807,11 @@ static int __maybe_unused vpu_core_suspend(struct device *dev) int ret = 0; mutex_lock(&core->lock); - if (core->state == VPU_CORE_ACTIVE) { - if (!list_empty(&core->instances)) { - ret = vpu_core_snapshot(core); - if (ret) { - mutex_unlock(&core->lock); - return ret; - } - } - - core->state = VPU_CORE_SNAPSHOT; - } + if (core->request_count) + ret = vpu_core_snapshot(core); mutex_unlock(&core->lock); + if (ret) + return ret; vpu_core_cancel_work(core); diff --git a/drivers/media/platform/amphion/vpu_core.h b/drivers/media/platform/amphion/vpu_core.h index 00a662997da4..65b562642603 100644 --- a/drivers/media/platform/amphion/vpu_core.h +++ b/drivers/media/platform/amphion/vpu_core.h @@ -11,5 +11,6 @@ u32 csr_readl(struct vpu_core *core, u32 reg); int vpu_alloc_dma(struct vpu_core *core, struct vpu_buffer *buf); void vpu_free_dma(struct vpu_buffer *buf); struct vpu_inst *vpu_core_find_instance(struct vpu_core *core, u32 index); +void vpu_core_set_state(struct vpu_core *core, enum vpu_core_state state); #endif diff --git a/drivers/media/platform/amphion/vpu_dbg.c b/drivers/media/platform/amphion/vpu_dbg.c index f72c8a506b22..260f1c4b8f8d 100644 --- a/drivers/media/platform/amphion/vpu_dbg.c +++ b/drivers/media/platform/amphion/vpu_dbg.c @@ -15,6 +15,7 @@ #include #include "vpu.h" #include "vpu_defs.h" +#include "vpu_core.h" #include "vpu_helpers.h" #include "vpu_cmds.h" #include "vpu_rpc.h" @@ -233,6 +234,10 @@ static int vpu_dbg_core(struct seq_file *s, void *data) if (seq_write(s, str, num)) return 0; + num = scnprintf(str, sizeof(str), "power %s\n", + vpu_iface_get_power_state(core) ? "on" : "off"); + if (seq_write(s, str, num)) + return 0; num = scnprintf(str, sizeof(str), "state = %d\n", core->state); if (seq_write(s, str, num)) return 0; @@ -346,10 +351,10 @@ static ssize_t vpu_dbg_core_write(struct file *file, pm_runtime_resume_and_get(core->dev); mutex_lock(&core->lock); - if (core->state != VPU_CORE_DEINIT && !core->instance_mask) { + if (vpu_iface_get_power_state(core) && !core->request_count) { dev_info(core->dev, "reset\n"); if (!vpu_core_sw_reset(core)) { - core->state = VPU_CORE_ACTIVE; + vpu_core_set_state(core, VPU_CORE_ACTIVE); core->hang_mask = 0; } } From patchwork Wed Oct 19 08:29:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5132 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp251708wrs; Wed, 19 Oct 2022 03:52:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6obWKZRsSGPj7YUAvkqDh5LjxQu0RDPgxsjlkgO+HhQRKedwtMhFhB7jVnL0K0n799qhFq X-Received: by 2002:a17:907:2bda:b0:78d:9144:fb6d with SMTP id gv26-20020a1709072bda00b0078d9144fb6dmr6187775ejc.238.1666176749006; Wed, 19 Oct 2022 03:52:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176749; cv=none; d=google.com; s=arc-20160816; b=TEc//XKnVFzUGbD6LZ9PdquxfYzUrns7M66vivP+aCeIR7vscYSiKd6St6U3TD+HCq yz1eqtt7g6cVkkhm6kM9534Hu4iY0dBzN4Q85y54s4pKe54xNqptNVVMLIa/DJ91Lzey h7aEk1R1X1jJIASXdO63ZsvyANuYnzfWDRTN+ArNn+iT8VPSIjvIWUfswSq/XsrjmrCQ j8ExGA/N9nIu2TN5jA3muVo8z0Q+eLhNtfzDc0LtOLdQGdnNzwgkNL7Ckj26yaPcN4ka t9P95JswWLqY33SZuqa4BumZ85kdGFKHy8h8Zp4tFYV++0FsItS9MGf69m8sLlfSAROA iqwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XhWVOrWp1pGGSeEQALigQ8X9+kgy5G8IEinUpuJjHGU=; b=gFZ48cRG7MU5OF0xl1CBRIoYLaaiV/CxJR4NyUczulGRg72UVTjbQdzJ0SesWHp9eq yJhE/xqaL1GSurFdc6Fdxrwq3GWUEUSAHIH1ECWyYS9qX4a8OMUwXs0GL3PqHPZsyJ9+ lCXNSIQdxkrMRAsVBzf8ODJn+i9KFLgND6N+deW+lbwBUlhYFtWv8bvVJlun/kY+TvOA u/yp1Pcr2zRUSODmPHDs5dvnPCyK7utCIaN8v2Zqvg1QTURYRrbkpF31+aIzO5YqNodA a+wstMeWbcTQqu4ud6cPDsUR8dRLVSAFZfawqlgQhTq343/cjM/ZPJTrGP53DLJmOm6+ m8yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=j4ynn39e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cs11-20020a0564020c4b00b0045bce3fe831si13437984edb.522.2022.10.19.03.52.04; Wed, 19 Oct 2022 03:52: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=j4ynn39e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234482AbiJSKu4 (ORCPT + 99 others); Wed, 19 Oct 2022 06:50:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234275AbiJSKs3 (ORCPT ); Wed, 19 Oct 2022 06:48:29 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 776F611F494; Wed, 19 Oct 2022 03:22:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 21D7CB82459; Wed, 19 Oct 2022 09:00:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7CFF3C43143; Wed, 19 Oct 2022 09:00:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170011; bh=lU1rMge4AvOB32EqEc1cYUnGuxCTzQQf26R06XK4qiY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j4ynn39eImlDyJG4z3aiBnDvSTz3RwfNQ1bf5ad3Q77VWURqQPBrFAP3YiuYPCCaS IEp5PllsHrkbg7yOrQxjXn11A6oSGLVV6w5G9rt1zfCmzOCMR/ZRt8ocq6YwSX1qnZ MFh5IATmH8BqoF9AwcJ50UhcoyWYc9TV3vLOkZfA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xu Qiang , Neil Armstrong , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 6.0 494/862] media: meson: vdec: add missing clk_disable_unprepare on error in vdec_hevc_start() Date: Wed, 19 Oct 2022 10:29:41 +0200 Message-Id: <20221019083311.804252411@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112950802392005?= X-GMAIL-MSGID: =?utf-8?q?1747112950802392005?= From: Xu Qiang [ Upstream commit 4029372233e13e281f8c387f279f9f064ced3810 ] Add the missing clk_disable_unprepare() before return from vdec_hevc_start() in the error handling case. Fixes: 823a7300340e (“media: meson: vdec: add common HEVC decoder support”) Signed-off-by: Xu Qiang Reviewed-by: Neil Armstrong Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/staging/media/meson/vdec/vdec_hevc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/staging/media/meson/vdec/vdec_hevc.c b/drivers/staging/media/meson/vdec/vdec_hevc.c index 9530e580e57a..afced435c907 100644 --- a/drivers/staging/media/meson/vdec/vdec_hevc.c +++ b/drivers/staging/media/meson/vdec/vdec_hevc.c @@ -167,8 +167,12 @@ static int vdec_hevc_start(struct amvdec_session *sess) clk_set_rate(core->vdec_hevc_clk, 666666666); ret = clk_prepare_enable(core->vdec_hevc_clk); - if (ret) + if (ret) { + if (core->platform->revision == VDEC_REVISION_G12A || + core->platform->revision == VDEC_REVISION_SM1) + clk_disable_unprepare(core->vdec_hevcf_clk); return ret; + } if (core->platform->revision == VDEC_REVISION_SM1) regmap_update_bits(core->regmap_ao, AO_RTI_GEN_PWR_SLEEP0, From patchwork Wed Oct 19 08:29:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4778 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp215710wrs; Wed, 19 Oct 2022 02:16:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4pwn2VRXTJmsDMMZ5Q8wxYdmLZ//ksm6aSYgiS3HK7FZ+QDEvpqx2T8XfiGZtrsbxh5BQO X-Received: by 2002:a17:907:1b12:b0:72f:9b44:f9e with SMTP id mp18-20020a1709071b1200b0072f9b440f9emr5823661ejc.653.1666170986327; Wed, 19 Oct 2022 02:16:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170986; cv=none; d=google.com; s=arc-20160816; b=jm0FIFcr3EgkNv5AjEmvZDlm0oam9BWpWXdkX3M7TZFBO+/3NSV4AE4m7M1KdU7QMP T7gs3xtLdS5NAmQ4+fEvk97+4TGTFjayzTv8mIGUpzuPDCa0vOPvT6M23LuzNCo5J8eG 1J6Pf/gLJDIJI36WbLx4GTTdhL1BQ3nLol6E9GVz2yOgKSTnfOnYyuIYbPLRfSn+9zZD til/d+k3Qypd7wVzwjedNJi1FkaSyqFatDDXuYaarZx066dC2VJo6c/Apiakq7i1Ug3o FrYasOWMqxyYoDAhJ0EmB+i1Dp/AAooPkSM2Ei+jL7ogNuHfPjuO+QEvcoJbIJzn4Tvd JqHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=83DeWd0ZwpmvYfyS6ZBRkGkPhDiDs5QZWZa8ouDzNvM=; b=zyVbmTa7aceaUJhN80gUNZf0KrJNQo7pfl8sHq8znAF9wuIrwK1biMLrfIuhhAkgSY bF+pcwbd+tqP2ccJMy2KF3rSwDQdE23EiKXU6YngO4Sn9xyCyMOb/qnoNi2lDbdSlIeJ CIJrSGcHUbJJ+XGQ7YuqvqTmXs/pdxVzoB66hbUBU62U07B9z9oKoQ3XTS5dOmIRbQJu FzAfbUEoxJrCDyQA/WkY3ARfSNgWk4L12ePGWf2yTWc3AQiWBHQpXeRHAMiUOTTAFBMu S2mYWHxbY9ZWLCb2EzGty7JpKzxGn8t35YEAGRtIaivYPD5oEAgRHx3lRsr/wIR1KF2E KsMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UAa9DoDS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dn20-20020a17090794d400b007123952b00dsi14032067ejc.100.2022.10.19.02.16.01; Wed, 19 Oct 2022 02:16: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=UAa9DoDS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232819AbiJSJNa (ORCPT + 99 others); Wed, 19 Oct 2022 05:13:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232624AbiJSJK4 (ORCPT ); Wed, 19 Oct 2022 05:10:56 -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 D859595AD1; Wed, 19 Oct 2022 02:02: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 dfw.source.kernel.org (Postfix) with ESMTPS id 13AF76170D; Wed, 19 Oct 2022 09:00:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27A5DC433C1; Wed, 19 Oct 2022 09:00:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170014; bh=f/k+s/t67tIsDk8B10xjJn1qqErzlt/ZonE+Si3m5Fw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UAa9DoDSSngy4K/RSKbTc96wFZv32ubHGDTt8u7EpWEP5pEn/VosRy+KyaHomW8H8 H77UYFl6pF9Rye4RAWilLx8QylhXhNpQILgt+M1QF05X8ABHwWxjsWz5mDAE/pN1kU w4xNarh+CdjMjUjHujQiuxwP1Uj6TReM6sfMrASk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= , Ricardo Ribalda , Laurent Pinchart , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 6.0 495/862] media: uvcvideo: Fix memory leak in uvc_gpio_parse Date: Wed, 19 Oct 2022 10:29:42 +0200 Message-Id: <20221019083311.844751745@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106907891766626?= X-GMAIL-MSGID: =?utf-8?q?1747106907891766626?= From: José Expósito [ Upstream commit f0f078457f18f10696888f8d0e6aba9deb9cde92 ] Previously the unit buffer was allocated before checking the IRQ for privacy GPIO. In case of error, the unit buffer was leaked. Allocate the unit buffer after the IRQ to avoid it. Addresses-Coverity-ID: 1474639 ("Resource leak") Fixes: 2886477ff987 ("media: uvcvideo: Implement UVC_EXT_GPIO_UNIT") Signed-off-by: José Expósito Reviewed-by: Ricardo Ribalda Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/usb/uvc/uvc_driver.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c index d509a4a2f08e..822e9694f092 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c @@ -1553,10 +1553,6 @@ static int uvc_gpio_parse(struct uvc_device *dev) if (IS_ERR_OR_NULL(gpio_privacy)) return PTR_ERR_OR_ZERO(gpio_privacy); - unit = uvc_alloc_entity(UVC_EXT_GPIO_UNIT, UVC_EXT_GPIO_UNIT_ID, 0, 1); - if (!unit) - return -ENOMEM; - irq = gpiod_to_irq(gpio_privacy); if (irq < 0) { if (irq != EPROBE_DEFER) @@ -1565,6 +1561,10 @@ static int uvc_gpio_parse(struct uvc_device *dev) return irq; } + unit = uvc_alloc_entity(UVC_EXT_GPIO_UNIT, UVC_EXT_GPIO_UNIT_ID, 0, 1); + if (!unit) + return -ENOMEM; + unit->gpio.gpio_privacy = gpio_privacy; unit->gpio.irq = irq; unit->gpio.bControlSize = 1; From patchwork Wed Oct 19 08: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: 4768 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214881wrs; Wed, 19 Oct 2022 02:14:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM45y/SeYZXdj/9n/69aYT64ZBnc/2jWDASKBMi9JNIaq4wpB4X3pZA4RNP/AJT/+JRCeQxj X-Received: by 2002:a17:907:78a:b0:78d:9ac7:b697 with SMTP id xd10-20020a170907078a00b0078d9ac7b697mr5746919ejb.457.1666170840598; Wed, 19 Oct 2022 02:14:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170840; cv=none; d=google.com; s=arc-20160816; b=rx6L/MR52c6ek+8lHT/NG5/RzV6N0i/KsHl6UE9/HwgCPEfMQ+lQATXZu8M/KwtDbz Rrg0QfdULHsthsGBUjV21h2dTzSUl691ho4cZF2KEOLkeuxnRipSFLN/zxF8fWpCoglG 2MLjodM3+sODCfdrSBk/9fn8dOFmUOc6v0su/eyqfiEDBhziAp2PerKqj+jBtLbYvUvn 8qzhP2yRKztAe/NogivLLraY670p4/WwurWvi7Kzw9a8lmTYCcR4P7Ca/Ozvuww52x4u m3a0HzLOwyoevZlx9xPvHI6gHF6JnzLZo6gBp9WZVPg/UlcInJTgmBKeEB4oI99ik8Xw siXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RmR45vl2KbODl7eoeIj/E3wXXWTWW+C1bQvKD6XJOkU=; b=fA4sPDZ6hFD3bPeGpRMgT3LM9vFuEe7wQ3JDWN7Zzuy8Hk0zgRhaUrhhJsIz2w7rqI 4iiBrQcWmvrKPJtzXbL2RldQFNxBRRnKaMP+AfWeesLMBuVNMDBl2mwOZOMYTeGRrXYq 0aP5B7oqOhN+wMZhh4NgKAhgmKTgtHCTOMPTo+6OvVvN+Sjt6cR1eQKCqERlhkZjJsL0 UyygbO2++ynIp5Wb4VbOk3y7VUUnXGyiED6VWFandsOnh2n6X1sZ51PFP1ZuRii9496Q C71xp8x7ovpvcDuo8qUI1z7dgBAncXLnpOcEfgPOi3Epi8nlg6cNL/GM6FsCcKox1Q/9 EZTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QE6MH5gZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oz15-20020a1709077d8f00b0078dcc87b1c4si6158441ejc.923.2022.10.19.02.13.36; Wed, 19 Oct 2022 02:14: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=QE6MH5gZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232890AbiJSJMH (ORCPT + 99 others); Wed, 19 Oct 2022 05:12:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232839AbiJSJJZ (ORCPT ); Wed, 19 Oct 2022 05:09:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 216BF72B74; Wed, 19 Oct 2022 02: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 dfw.source.kernel.org (Postfix) with ESMTPS id A6BB961830; Wed, 19 Oct 2022 09:00:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BDB2CC433D7; Wed, 19 Oct 2022 09:00:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170017; bh=jdZLnZbQFZrYc+ncUIK2z06tTja/ckr8DEOyMoDYb7M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QE6MH5gZIsgIO8ch6npUvyutJq5PU6khAzKDlOaW3HmSYIPY3Wj63JtWfmEoUgKOX iLG2/eY/xhLfz+4GRPp0tJrO8yx03qacy/T1tmtk+8atliiXF46rUwDT834dL2hMEF IRFQySVgwyGOIFZNeuEUqqRLxWebnEmdL5AcpY5Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yunke Cao , Ricardo Ribalda , Laurent Pinchart , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 6.0 496/862] media: uvcvideo: Use entity get_cur in uvc_ctrl_set Date: Wed, 19 Oct 2022 10:29:43 +0200 Message-Id: <20221019083311.887213783@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106755612170667?= X-GMAIL-MSGID: =?utf-8?q?1747106755612170667?= From: Yunke Cao [ Upstream commit 5f36851c36b30f713f588ed2b60aa7b4512e2c76 ] Entity controls should get_cur using an entity-defined function instead of via a query. Fix this in uvc_ctrl_set. Fixes: 65900c581d01 ("media: uvcvideo: Allow entity-defined get_info and get_cur") Signed-off-by: Yunke Cao Reviewed-by: Ricardo Ribalda Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/usb/uvc/uvc_ctrl.c | 83 ++++++++++++++++++-------------- 1 file changed, 46 insertions(+), 37 deletions(-) diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c index 8c208db9600b..53250ea75dfb 100644 --- a/drivers/media/usb/uvc/uvc_ctrl.c +++ b/drivers/media/usb/uvc/uvc_ctrl.c @@ -985,36 +985,56 @@ static s32 __uvc_ctrl_get_value(struct uvc_control_mapping *mapping, return value; } -static int __uvc_ctrl_get(struct uvc_video_chain *chain, - struct uvc_control *ctrl, struct uvc_control_mapping *mapping, - s32 *value) +static int __uvc_ctrl_load_cur(struct uvc_video_chain *chain, + struct uvc_control *ctrl) { + u8 *data; int ret; - if ((ctrl->info.flags & UVC_CTRL_FLAG_GET_CUR) == 0) - return -EACCES; + if (ctrl->loaded) + return 0; - if (!ctrl->loaded) { - if (ctrl->entity->get_cur) { - ret = ctrl->entity->get_cur(chain->dev, - ctrl->entity, - ctrl->info.selector, - uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT), - ctrl->info.size); - } else { - ret = uvc_query_ctrl(chain->dev, UVC_GET_CUR, - ctrl->entity->id, - chain->dev->intfnum, - ctrl->info.selector, - uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT), - ctrl->info.size); - } - if (ret < 0) - return ret; + data = uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT); + if ((ctrl->info.flags & UVC_CTRL_FLAG_GET_CUR) == 0) { + memset(data, 0, ctrl->info.size); ctrl->loaded = 1; + + return 0; } + if (ctrl->entity->get_cur) + ret = ctrl->entity->get_cur(chain->dev, ctrl->entity, + ctrl->info.selector, data, + ctrl->info.size); + else + ret = uvc_query_ctrl(chain->dev, UVC_GET_CUR, + ctrl->entity->id, chain->dev->intfnum, + ctrl->info.selector, data, + ctrl->info.size); + + if (ret < 0) + return ret; + + ctrl->loaded = 1; + + return ret; +} + +static int __uvc_ctrl_get(struct uvc_video_chain *chain, + struct uvc_control *ctrl, + struct uvc_control_mapping *mapping, + s32 *value) +{ + int ret; + + if ((ctrl->info.flags & UVC_CTRL_FLAG_GET_CUR) == 0) + return -EACCES; + + ret = __uvc_ctrl_load_cur(chain, ctrl); + if (ret < 0) + return ret; + *value = __uvc_ctrl_get_value(mapping, uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT)); @@ -1810,21 +1830,10 @@ int uvc_ctrl_set(struct uvc_fh *handle, * needs to be loaded from the device to perform the read-modify-write * operation. */ - if (!ctrl->loaded && (ctrl->info.size * 8) != mapping->size) { - if ((ctrl->info.flags & UVC_CTRL_FLAG_GET_CUR) == 0) { - memset(uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT), - 0, ctrl->info.size); - } else { - ret = uvc_query_ctrl(chain->dev, UVC_GET_CUR, - ctrl->entity->id, chain->dev->intfnum, - ctrl->info.selector, - uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT), - ctrl->info.size); - if (ret < 0) - return ret; - } - - ctrl->loaded = 1; + if ((ctrl->info.size * 8) != mapping->size) { + ret = __uvc_ctrl_load_cur(chain, ctrl); + if (ret < 0) + return ret; } /* Backup the current value in case we need to rollback later. */ From patchwork Wed Oct 19 08: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: 4752 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214639wrs; Wed, 19 Oct 2022 02:13:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4qgtldfC+0Tt0bOC+deNl0NigXFcntzLekw8ff/abZ6Q4lxYYJaY1iXHGnsFYz64cWInDH X-Received: by 2002:a17:907:968b:b0:78d:f5c2:70d8 with SMTP id hd11-20020a170907968b00b0078df5c270d8mr5725153ejc.564.1666170804545; Wed, 19 Oct 2022 02:13:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170804; cv=none; d=google.com; s=arc-20160816; b=wP6llBZ/YPFlI+u9Q3Er//r/efJ3stIGhHZFjEuF45c/EIHLpWwLv7jQv/YufExUI5 vuTvlcIMl0aFjXipywPNghYqh6IWg5ZgbzS9r9p+VPgtchVSYzVkIIivKh9SDD1TtXnM +npYkVTyUcTcQEKVyCfl8qrA+Kk6dwUjSFg9EjlQtHpkpl7GK4k/wh0aukpUXvbdCoEj 40/9o+fusb5kdkSlkn9KSryoC33aN81yEj8k8thxCXTzeNGsYbVeutJcOQluATNZCJ6H O2k1XWulBuN0YlxUTgrJJHMF+TS6yR+HEzqDjKczrqaEgFzWS1CJ3PrfISaugaxJvogQ muHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HVcroQFYgJ+KygxA544ve0GUT+uG9RQyqVeEvFJfVhE=; b=i4NXHyLGaFpCPN7exxCn7OpAPTRns3OxydQnOAVPhRu4wU0M5f455exToqBGQWmtXu iGWYrf8d4uGOA4p7qeqC6K8z5dz8c1FDTSQl0UvRgVt2X1gh3jNR3D5Xnq5VkAUzQTFR foEHBpFKAY2bBIHChlC0aTfOTylJOuPi4iRcxhkVN0n0s67PEufSNnrdyZ56443BmoNp BsVIlnTXFKTI9ldebqrbv6nh5aiZyUfVShu9bA76xj3zKDyS9bZr5Wjg/JjLculIy0ER EeT7j+uhYNnbwGWHSpj1pNYvJNi7Z1a+jN9JQrMs8ka1U8vq+5JW8YJOeEE+Vm0ebB22 vYXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Q8qWE62u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ck12-20020a0564021c0c00b0045ca1ce94b2si11748979edb.523.2022.10.19.02.12.58; Wed, 19 Oct 2022 02:13: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=Q8qWE62u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232850AbiJSJLm (ORCPT + 99 others); Wed, 19 Oct 2022 05:11:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232759AbiJSJJN (ORCPT ); Wed, 19 Oct 2022 05:09:13 -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 2184572B79; Wed, 19 Oct 2022 02: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 dfw.source.kernel.org (Postfix) with ESMTPS id 3DD3B617E3; Wed, 19 Oct 2022 09:00:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50ED5C433C1; Wed, 19 Oct 2022 09:00:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170019; bh=nmvG3vBy2Gnd/UxyKgj0D3lIpS0zVnyNZ2NZnicV560=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q8qWE62uecf1qftk82RnSvxFEoZCG372SzJr+wXKqk9GIqIItlUYgAc1DmonEjJx9 1V7apZf6qCnskF/TAwmXHjwtSXAkbwWE2fBv0PNaSQjNgHLBu+BOeELjJgaOJXTwUe 4UNA/KfQ2nNQGxRH/1m1djNmaahxIIWBeMv9H6E8= 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 6.0 497/862] media: xilinx: vipp: Fix refcount leak in xvip_graph_dma_init Date: Wed, 19 Oct 2022 10:29:44 +0200 Message-Id: <20221019083311.936438467@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106717348725507?= X-GMAIL-MSGID: =?utf-8?q?1747106717348725507?= 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 f34f8b077e03..0a16c218a50a 100644 --- a/drivers/media/platform/xilinx/xilinx-vipp.c +++ b/drivers/media/platform/xilinx/xilinx-vipp.c @@ -471,7 +471,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) { @@ -481,13 +481,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 Wed Oct 19 08: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: 5103 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp250273wrs; Wed, 19 Oct 2022 03:48:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5O28aRtNucW2UMiwIBtzw7DhDhECdA8V88xxR56QMocTeGJcm9bCwOiZRgIBt+D6HTJfUj X-Received: by 2002:a05:6402:26d2:b0:45d:280b:5878 with SMTP id x18-20020a05640226d200b0045d280b5878mr6924488edd.385.1666176516315; Wed, 19 Oct 2022 03:48:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176516; cv=none; d=google.com; s=arc-20160816; b=FG+fVh89LtgKXBdQdQRhDqtXdJVssBeCfjWHnPqUk4mlCr57cEcHX5hfI4EId/ximu FfT5gdj3J4guz3/6ZKM6M2aWbVosqDILhVVTBWb1tzGZr8cQGtkyQ16NBsIXZET3b/4A nTrIxex/dc7QjBL/T0ChqzxSf2K/uhdr3Ucq526QiJBL/JHxT8Mb4eVrdzDWprIqlc43 SvqheSiY0jLcZo2B3X/EuuLD/9YJdWuYDjxo06IUPyiHSULNoJAFtNFjT3JKcntTv6LH I2A/l+zrzyTb8DVjDlNYjQFQcWoSMqbAK1xZTLuavMSVG8+VLyBxhJbOEHWqNEpUr8Wj FVCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bkC/k9faFxlzrpikTd5TDYYnXiTHEkvjN8lsHpDZtH4=; b=mPd7EWhbMN2ZqrG/pM65JtHU10Ip9vGeWlWdRdH62YhSwdma4ishfL3Nd0QvLhSAC3 aU0ZrywLqAtMW42yzBwG2xAxqi0TvqPyhvgx673HduN7rI5RbPUFuUs+Z0PpI+oxbFmX td7kKPHPt8/SEVEzd3TRDItvELZOep48Q5o3i+E2YRbKW/RSwHYlJupvgJCdqi0Ta2BL 70t5IqqWaKuaqe5+HzwGvD275presN74px9mrE1knEaY0CQXHeI48GJTK9OjxaaOdq4G 5mxZ2vWKwyWxFwwS3I0K9r3BiCJK6TcbAZ3ElkuyFdYIndcvT+/PZtldqZchi4D12yjZ DGgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=grG3kNlj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sa24-20020a1709076d1800b0078deaf6b447si13998984ejc.624.2022.10.19.03.48.11; Wed, 19 Oct 2022 03:48: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=grG3kNlj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233234AbiJSKrr (ORCPT + 99 others); Wed, 19 Oct 2022 06:47:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232556AbiJSKpa (ORCPT ); Wed, 19 Oct 2022 06:45:30 -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 94F4715A30D; Wed, 19 Oct 2022 03:21: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 7362FB82457; Wed, 19 Oct 2022 09:00:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9181C433C1; Wed, 19 Oct 2022 09:00:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170022; bh=abjXBVOG+cxNl04C7+6if84CIxXflluCsmaCoO0qdos=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=grG3kNljpn6Ds0+Oq18ekcV2g+ZV4jTStEXpZfndH/2oauq+zO7WM+ovugcmoovYG Cxj2r5vO8VeR291Zqr7TPkM9ngsJ1dy3yo4BMiGHqlOAVSVoyJezfXb9e4JtUnk+bV IbMHAc7A/fZHFiEUFktb32VzRWZI7fYP2HQvmoLw= 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 6.0 498/862] RDMA/rxe: Fix "kernel NULL pointer dereference" error Date: Wed, 19 Oct 2022 10:29:45 +0200 Message-Id: <20221019083311.980763099@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112706682943857?= X-GMAIL-MSGID: =?utf-8?q?1747112706682943857?= 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 516bf9b95e48..fda03f9f03ed 100644 --- a/drivers/infiniband/sw/rxe/rxe_qp.c +++ b/drivers/infiniband/sw/rxe/rxe_qp.c @@ -797,7 +797,9 @@ static void rxe_qp_do_cleanup(struct work_struct *work) 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 Wed Oct 19 08: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: 4770 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214930wrs; Wed, 19 Oct 2022 02:14:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM53/mkjavtnxULMPBEx7zv7zEPR98u+uvAGnmGOzqp1MaUWXHFRAbNEArokHQLeNbtIlCtO X-Received: by 2002:a05:6402:528a:b0:454:8613:6560 with SMTP id en10-20020a056402528a00b0045486136560mr6744255edb.252.1666170849712; Wed, 19 Oct 2022 02:14:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170849; cv=none; d=google.com; s=arc-20160816; b=VFvNBHHlp5TMUM/4Xgg/uJ6zit/ogEmxDuCXry6LZ0Y+j4Jsh2941agrDohYTyXKf+ xb2zipCTLJHpSWGN5tBYPP9UXLgAOH9NIkUt2LMZ0lPyz6rJkeLVxhm3Epg6XwxFw4La qP+FpMOu0ffBxDs1GMDNahWmwBMlcFzh8iJ06veVlO0/bA0GPlufdeI6BLkcqklA8mXw fiDO9J9LMs8trgUMded56p/1EucYMjDdk6lPjVhX6W0f2lhyrLCO2npJ0v7N1H7Va6Bx nUX+Fb5NcswUpdoawVsZoSlBCByUCQ2U+qoGZMRuEIyfnbTQRlIE3O9slzQsftRKLaSs jYMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Fe+LS5Do8r0e1/X8pwyPSNlaqXicuOA8anj64SGc1WE=; b=y20nBVqLEsM60oxAX3E1i8ezAOaOKkyrLzEY048B3rOLmcjgiWCSt9errcVz2FHn4p bEIrhORpp+xnMb2LV57CXmd3rouGFw9QNIOvqBzlpNise1LZKFlU8LS/wb7LUKI0fhny pgQIOK05PRluWVSijdELVnCsz8gipJ7jHclPFFV0tayYJa2YQoQr/Zuz59hAmJ2XDBjh 02hJo1ttIqNN6ZX4ZEGewsyZ4aTnXfCKie88CmzYuR8eCTIQFm/ZNb224DMdd3E95H/0 3BNePO+7hj8JYPJLAsdEjBAoXWNBKD+t1vEpXpI1mf/GTXudzG/sX8L0AjYHItZrfzSF GeVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ipiV0pNl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qw22-20020a1709066a1600b0078dcf11ccf7si13638141ejc.802.2022.10.19.02.13.45; Wed, 19 Oct 2022 02:14:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ipiV0pNl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232923AbiJSJMW (ORCPT + 99 others); Wed, 19 Oct 2022 05:12:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232907AbiJSJJf (ORCPT ); Wed, 19 Oct 2022 05:09:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06E2D6888F; Wed, 19 Oct 2022 02:00: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 850CD617D6; Wed, 19 Oct 2022 09:00:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 936E1C433D6; Wed, 19 Oct 2022 09:00:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170024; bh=DC/OKbNo75HLtAcJhoT1fSpScx56M0NZEY5Sod8yCsc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ipiV0pNldvy3tHL1xW0Clo/SHkJ14GJu2uqloFlWH+q74dvK7jYR3iKgzdxNly6LS 4Ijxbggo5ARj+bWHqp6zSijhk7rh+A/MGVbFH8OGDyyDebIR9WsxT9NId9pd7B7gtQ Wni5XU0zqISztn3/w1SMSUSxPMBaI7k1SSxm7x3A= 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 6.0 499/862] RDMA/rxe: Fix the error caused by qp->sk Date: Wed, 19 Oct 2022 10:29:46 +0200 Message-Id: <20221019083312.029376671@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106764822552393?= X-GMAIL-MSGID: =?utf-8?q?1747106764822552393?= 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 fda03f9f03ed..d776dfda43b1 100644 --- a/drivers/infiniband/sw/rxe/rxe_qp.c +++ b/drivers/infiniband/sw/rxe/rxe_qp.c @@ -835,8 +835,10 @@ static void rxe_qp_do_cleanup(struct work_struct *work) free_rd_atomic_resources(qp); - kernel_sock_shutdown(qp->sk, SHUT_RDWR); - sock_release(qp->sk); + if (qp->sk) { + kernel_sock_shutdown(qp->sk, SHUT_RDWR); + sock_release(qp->sk); + } } /* called when the last reference to the qp is dropped */ From patchwork Wed Oct 19 08:29:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4762 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214805wrs; Wed, 19 Oct 2022 02:13:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4DVajo4MCG+dX49+69yy/Yksc6cGzXLnxjgv/38NiO3Sfg+Zb1wKPJK4cItrUqgcymhf7S X-Received: by 2002:a17:907:25c9:b0:77b:a343:bd62 with SMTP id ae9-20020a17090725c900b0077ba343bd62mr5960384ejc.660.1666170828888; Wed, 19 Oct 2022 02:13:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170828; cv=none; d=google.com; s=arc-20160816; b=U4N4tgnvbNYHsCX6+02KH4+WrDOW4mHT04PeegG2n3lYaxdvxT474mYuIZfMCCX5Q8 VNqbtcTRsUu5gBTSfK40FaFblct+9waH6E0H4vu9oaF6tV2APAlE/iMUggCjnJUxK0W7 HfUM7GuaQ8G+KXYssHL61pCUpHnd44p9YH1BarEiAqGXXxl1U/rOVV42NG8VLOHtweHK gvZ/xIGjsLsT1iGwxLgjE429VCeFmy7iijxOl2Aem9oYyyk7QIrytYyCHBxaduJ78kCn 1UI2PbWVT/4Tv7ns8xn1n78Ff+Y6WnILFsF3g1c0QqzPmDpp307hn2Md0MCpJLA0b/0j IcIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1do91zy/QwzyjNEui/ffbNraRH1cttQQJW7EHx/Phmw=; b=qINBIQLufZx7UEoj8Aw4dHAgFz9OkImXkbkeWwdYRJ+TVoho873q6uUX5EdWC0LXAm XMNdQiYnAa+kYrLyempIxe0AgU96/ZCGqXBqjR0JoMay67IpspeKb81piAcoj7Ddz/Z3 iSyp16SitV/8eVe1O+kvvqPEuAcdsT4yOgnZB+djeKTwqf0ON7KtMUk+xTp7hFWkD7rJ Lr4r7ZNerrukpxDTvyRSh9pEhvmZOMNBS+P+Hy3AZ9wi0a0yWbfZ8TFDNOFgmnVhb+uj 42OTM5tPYUOIaKJKJ0zmNb3HO/1mWDYGNaPA/RNlAEzt5ytDUF0jvPvTaGhllHdIR7o+ KNjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ljOVz0sQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v1-20020a056402348100b0045483f0426csi14494625edc.10.2022.10.19.02.13.24; Wed, 19 Oct 2022 02:13:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ljOVz0sQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232929AbiJSJM1 (ORCPT + 99 others); Wed, 19 Oct 2022 05:12:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232949AbiJSJJp (ORCPT ); Wed, 19 Oct 2022 05:09:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B19180BE0; Wed, 19 Oct 2022 02:00: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 BD7436174B; Wed, 19 Oct 2022 09:00:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1CECC433C1; Wed, 19 Oct 2022 09:00:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170030; bh=WowgQztTNsEsUrr75qTilpPvrPbPyfSJgZpDw7HExZI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ljOVz0sQutCIfngdUI+FhnX7VaNezfIxWyKouA0YeuVIjxFypDLlr2wJGfeqPiA3X Rog+PZqkJ/GKIrdrn0Gzo/Ga8Kww62+2WjOTIDgCIHaLtivP4xa/KIGC2Lm+78aca/ 6hZkcJh80b35IZyA0SaRqDWVu5v3Q6m6zMLrAFzA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, AngeloGioacchino Del Regno , Bo-Chen Chen , " =?utf-8?q?N=C3=ADcolas_F_=2E__R_?= =?utf-8?q?=2E__A_=2E__Prado?= " , Stephen Boyd , Sasha Levin Subject: [PATCH 6.0 500/862] clk: mediatek: clk-mt8195-vdo0: Set rate on vdo0_dp_intf0_dp_intfs parent Date: Wed, 19 Oct 2022 10:29:47 +0200 Message-Id: <20221019083312.080562480@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106743442235080?= X-GMAIL-MSGID: =?utf-8?q?1747106743442235080?= From: AngeloGioacchino Del Regno [ Upstream commit 3f0dadd230cc2630202a977fe52cd1dd7a7579a7 ] Add the CLK_SET_RATE_PARENT flag to the CLK_VDO0_DP_INTF0_DP_INTF clock: this is required to trigger clock source selection on CLK_TOP_EDP, while avoiding to manage the enablement of the former separately from the latter in the displayport driver. Fixes: 70282c90d4a2 ("clk: mediatek: Add MT8195 vdosys0 clock support") Signed-off-by: AngeloGioacchino Del Regno Tested-by: Bo-Chen Chen Reviewed-by: Bo-Chen Chen Signed-off-by: Nícolas F. R. A. Prado Link: https://lore.kernel.org/r/20220816193257.658487-2-nfraprado@collabora.com Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/mediatek/clk-mt8195-vdo0.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/clk/mediatek/clk-mt8195-vdo0.c b/drivers/clk/mediatek/clk-mt8195-vdo0.c index 261a7f76dd3c..07b46bfd5040 100644 --- a/drivers/clk/mediatek/clk-mt8195-vdo0.c +++ b/drivers/clk/mediatek/clk-mt8195-vdo0.c @@ -37,6 +37,10 @@ static const struct mtk_gate_regs vdo0_2_cg_regs = { #define GATE_VDO0_2(_id, _name, _parent, _shift) \ GATE_MTK(_id, _name, _parent, &vdo0_2_cg_regs, _shift, &mtk_clk_gate_ops_setclr) +#define GATE_VDO0_2_FLAGS(_id, _name, _parent, _shift, _flags) \ + GATE_MTK_FLAGS(_id, _name, _parent, &vdo0_2_cg_regs, _shift, \ + &mtk_clk_gate_ops_setclr, _flags) + static const struct mtk_gate vdo0_clks[] = { /* VDO0_0 */ GATE_VDO0_0(CLK_VDO0_DISP_OVL0, "vdo0_disp_ovl0", "top_vpp", 0), @@ -85,7 +89,8 @@ static const struct mtk_gate vdo0_clks[] = { /* VDO0_2 */ GATE_VDO0_2(CLK_VDO0_DSI0_DSI, "vdo0_dsi0_dsi", "top_dsi_occ", 0), GATE_VDO0_2(CLK_VDO0_DSI1_DSI, "vdo0_dsi1_dsi", "top_dsi_occ", 8), - GATE_VDO0_2(CLK_VDO0_DP_INTF0_DP_INTF, "vdo0_dp_intf0_dp_intf", "top_edp", 16), + GATE_VDO0_2_FLAGS(CLK_VDO0_DP_INTF0_DP_INTF, "vdo0_dp_intf0_dp_intf", + "top_edp", 16, CLK_SET_RATE_PARENT), }; static int clk_mt8195_vdo0_probe(struct platform_device *pdev) From patchwork Wed Oct 19 08:29:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4759 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214719wrs; Wed, 19 Oct 2022 02:13:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6xuy4+leHUGpPm4VCZtjBG03/fJ9CrW9HIPwquiKAPJ1Pcr9i6m4GNBuQ0rdIICG/UoIC3 X-Received: by 2002:a05:6402:5406:b0:452:1560:f9d4 with SMTP id ev6-20020a056402540600b004521560f9d4mr6539350edb.333.1666170815652; Wed, 19 Oct 2022 02:13:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170815; cv=none; d=google.com; s=arc-20160816; b=ebkevBd6l5a8h+c0fmq85ldCz5OTHUKHCs+Nblx4EdPBCundcxnS4dqknOQG0M7tWg fvTbUt9FA5G8wN2z0tBa41a0JbuzLqjqcrTK3usl9cEXqUGnWynETNR96sFpcdIm9Zvg ke8csSYMcGg8QgkP3Ep7IHavuyKiOl2rVQVIDrJCRtucGHkPLclGH0aWMvL/hZK4B7ts 5bKLfxcLdQPABBIjGlJmU9+q87vzXyN2jhhtUsGWfuNTKE9SGuqSLQ2ZoYHmlDC34yhh u59bgC1N7B4AhXHVyn9kJtNdoRXKMn5S+qbFzpKCvn/yb6jaq+VAPjzReo1Ww8qMBLUO tK3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xcaWfqNDmOVLdeVF2tK6bZOHJBJmspAALR/QGSsfSLk=; b=jLm5uaBGt4BJh5o4N+sepa/srcYClIlTwl9mZ+EqLJmuxs0x5HyTXlXf1lHJgqcTx9 TzxHdrfbIGOS5LbQolJqfASB8KuOA/tskV25ocYvWXrIgHm35h7vFa4MiY9fR0J/rMSW w6qipRhFX0MVT0lvN+zXDT6kcdD/9RBu9z47eOxO4ajNIi85wqVjBIFIEn3jw3mt97fs VOnU2GKftZmemTKPIuX/ny85LKLf1qA+o+gL//Jr7SL4zCloJCI8gmG0WoQt+2550uxT iIuimD2Rr8ww01e8Q6COKOl19nsHPXKlsR3fPO5L5qEbSlnd67Yd7m8iciz5rNO6pO+d JxwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FSifBRDa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qb7-20020a1709077e8700b007878f030816si13756988ejc.109.2022.10.19.02.13.11; Wed, 19 Oct 2022 02:13: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=FSifBRDa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232473AbiJSJMO (ORCPT + 99 others); Wed, 19 Oct 2022 05:12:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232884AbiJSJJb (ORCPT ); Wed, 19 Oct 2022 05:09:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE9CC69F7B; Wed, 19 Oct 2022 02:00: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 72B8A61800; Wed, 19 Oct 2022 09:00:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 88112C4314B; Wed, 19 Oct 2022 09:00:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170032; bh=V8S7SxBGkVwHx+dCHsBMJlF/8c04H0jASveOhijYiOU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FSifBRDaNfz1vVMht6SF2SR3DZC3+RaHWQOtSvsLVgJcvt2Zz24Xct9AT/slzO7Th ziCvKsVphSvwghAl6t4cFwWl2twc+WK81LCFICpO33hLlfjTyr2YgCpCMoJ7YW7qRg LRZGQx/hTqmYHUuXJ27gk9NJ/0piFw3rqEVFRe4o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, AngeloGioacchino Del Regno , Bo-Chen Chen , " =?utf-8?q?N=C3=ADcolas_F_=2E__R_?= =?utf-8?q?=2E__A_=2E__Prado?= " , Stephen Boyd , Sasha Levin Subject: [PATCH 6.0 501/862] clk: mediatek: clk-mt8195-vdo1: Reparent and set rate on vdo1_dpintfs parent Date: Wed, 19 Oct 2022 10:29:48 +0200 Message-Id: <20221019083312.129838374@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106729271958321?= X-GMAIL-MSGID: =?utf-8?q?1747106729271958321?= From: AngeloGioacchino Del Regno [ Upstream commit f24d71feb206631116ff9adaa6d43650c5dd8849 ] Like it was done for the vdo0_dp_intf0_dp_intf clock (used for eDP), add the CLK_SET_RATE_PARENT flag to CLK_VDO1_DPINTF (used for DP) and also fix its parent clock name as it has to be "top_dp" for two reasons: - This is its real parent! - Likewise to eDP/VDO0 counterpart, we need clock source selection on CLK_TOP_DP. Fixes: 269987505ba9 ("clk: mediatek: Add MT8195 vdosys1 clock support") Signed-off-by: AngeloGioacchino Del Regno Tested-by: Bo-Chen Chen Reviewed-by: Bo-Chen Chen Signed-off-by: Nícolas F. R. A. Prado Link: https://lore.kernel.org/r/20220816193257.658487-3-nfraprado@collabora.com Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/mediatek/clk-mt8195-vdo1.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/clk/mediatek/clk-mt8195-vdo1.c b/drivers/clk/mediatek/clk-mt8195-vdo1.c index 3378487d2c90..d54d7726d186 100644 --- a/drivers/clk/mediatek/clk-mt8195-vdo1.c +++ b/drivers/clk/mediatek/clk-mt8195-vdo1.c @@ -43,6 +43,10 @@ static const struct mtk_gate_regs vdo1_3_cg_regs = { #define GATE_VDO1_2(_id, _name, _parent, _shift) \ GATE_MTK(_id, _name, _parent, &vdo1_2_cg_regs, _shift, &mtk_clk_gate_ops_setclr) +#define GATE_VDO1_2_FLAGS(_id, _name, _parent, _shift, _flags) \ + GATE_MTK_FLAGS(_id, _name, _parent, &vdo1_2_cg_regs, _shift, \ + &mtk_clk_gate_ops_setclr, _flags) + #define GATE_VDO1_3(_id, _name, _parent, _shift) \ GATE_MTK(_id, _name, _parent, &vdo1_3_cg_regs, _shift, &mtk_clk_gate_ops_setclr) @@ -99,7 +103,7 @@ static const struct mtk_gate vdo1_clks[] = { GATE_VDO1_2(CLK_VDO1_DISP_MONITOR_DPI0, "vdo1_disp_monitor_dpi0", "top_vpp", 1), GATE_VDO1_2(CLK_VDO1_DPI1, "vdo1_dpi1", "top_vpp", 8), GATE_VDO1_2(CLK_VDO1_DISP_MONITOR_DPI1, "vdo1_disp_monitor_dpi1", "top_vpp", 9), - GATE_VDO1_2(CLK_VDO1_DPINTF, "vdo1_dpintf", "top_vpp", 16), + GATE_VDO1_2_FLAGS(CLK_VDO1_DPINTF, "vdo1_dpintf", "top_dp", 16, CLK_SET_RATE_PARENT), GATE_VDO1_2(CLK_VDO1_DISP_MONITOR_DPINTF, "vdo1_disp_monitor_dpintf", "top_vpp", 17), /* VDO1_3 */ GATE_VDO1_3(CLK_VDO1_26M_SLOW, "vdo1_26m_slow", "clk26m", 8), From patchwork Wed Oct 19 08: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: 5109 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp250891wrs; Wed, 19 Oct 2022 03:50:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4fxq02Milmx380N7gdWEOpxO8/AJLXLkefN8tPaPwbwD9xEsMolw87fCM035QRbiCsJ3hX X-Received: by 2002:a05:6402:448b:b0:43b:5ec6:8863 with SMTP id er11-20020a056402448b00b0043b5ec68863mr6666437edb.377.1666176618747; Wed, 19 Oct 2022 03:50:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176618; cv=none; d=google.com; s=arc-20160816; b=031cA4W9SJc+9lbUed43PSLnsM+X7XTBsNovZAl+789P77hklGz2gSWDbU9w23h31g xiZp1TrW5d38B7LCrDTNxB0VmWrIZu3Ye37u8MIfUauYeF3mRRoD7q0pD5rC6Yr1liU2 W4t4+X7EOSq8qvpbnHDQU6yKh3MOzMrtZPu+BOkdxHBIhvE6SWLmh/iGVudxt3ReqOwc 6z1jP3tApKxTSP1Z6RQASrKVtjfI3I5u6zWp1M74yEjSF/0S7ePLZhDWwhpCL0qQ4nbn Rp4TSKfCoLNh35pblNcrRwl3JQrN7Vys1JJPXMHh5EKwEg4lAUOqfNFtPfe050A6vQfs Lr1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6C8DjW/IvvYcxe33M7PUmphdEF6lhzM+yYi9FV9hmhI=; b=VjhPJ+cdz1UZ8oNQr/bS46DPtu33edySfvylaaMGap1AI4a55iddJEQjRLE/OQNr5s 61aoeEy/DQKL1ThldAxK7xq5dIO8enxM+9UWSxzZLk4nJ3XRQjw+7GQrvR+BQr1OnX8f yHlu+vteZRhNQS+f/C1L75EKdiBvIcq7xA6pjpKpEXUP5zA6nrTFgWOCjTYoTGBLFM6g OFSYaC7YjevqLmTo7c9HcxeicMAS9jKkjIYTJ/UCHqlxQqIsZPZZw2BshQ9uzQ/FLBbG rq1G/0iCHfwXO2OaJ1USQdjB01D1bdWvrfsih1zrhQF7p7OoeNIKqbLj7M9BOAzyCZKN jWAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=D6ePb1g2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qa44-20020a17090786ac00b0078a10c159b4si14138550ejc.290.2022.10.19.03.49.54; Wed, 19 Oct 2022 03: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=D6ePb1g2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234237AbiJSKsY (ORCPT + 99 others); Wed, 19 Oct 2022 06:48:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232308AbiJSKqe (ORCPT ); Wed, 19 Oct 2022 06:46:34 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A44CDD887; Wed, 19 Oct 2022 03:21: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 A9F3BB8244D; Wed, 19 Oct 2022 09:00:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 23F58C433D6; Wed, 19 Oct 2022 09:00:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170035; bh=K97j+I7L9AaRvIOBnMiDgOiubOBBSINEGKUsqgcayO4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D6ePb1g2+4lEMC8gQt5NON75X8E7AJO7DpIVeUff/TOuRF2f9lg7GM7LKI0KjtT7E beM2pUaer7aCW0E+t0SqucA/4mwsGpmMYHAViV8o86lyE8e0FSH0S9C1ucI8acd1+5 U0aGbcek5xwS2I08unJZRsPdemuVZurFMnZwUXbE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, AngeloGioacchino Del Regno , Matthias Brugger , Stephen Boyd , Sasha Levin Subject: [PATCH 6.0 502/862] clk: mediatek: mt8195-infra_ao: Set pwrmcu clocks as critical Date: Wed, 19 Oct 2022 10:29:49 +0200 Message-Id: <20221019083312.178174715@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112814219820938?= X-GMAIL-MSGID: =?utf-8?q?1747112814219820938?= From: AngeloGioacchino Del Regno [ Upstream commit 3f10f49cd9f8ab6471639d4ca2c6db9451121779 ] The pwrmcu is responsible for power management and idle states in SSPM: on older SoCs this was managed in Linux drivers like sspm/mcupm/eemgpu but, at least on MT8195, this functionality was transferred to the ATF firmware. For this reason, turning off the pwrmcu related clocks from the kernel will lead to unability to resume the platform after suspend and other currently unknown PM related side-effects. Set the PWRMCU and PWRMCU_BUS_H clocks as critical to prevent the kernel from turning them off, fixing the aforementioned issue. Fixes: e2edf59dec0b ("clk: mediatek: Add MT8195 infrastructure clock support") Signed-off-by: AngeloGioacchino Del Regno Link: https://lore.kernel.org/r/20220719093316.37253-1-angelogioacchino.delregno@collabora.com Reviewed-by: Matthias Brugger Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/mediatek/clk-mt8195-infra_ao.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/clk/mediatek/clk-mt8195-infra_ao.c b/drivers/clk/mediatek/clk-mt8195-infra_ao.c index 97657f255618..832160c92996 100644 --- a/drivers/clk/mediatek/clk-mt8195-infra_ao.c +++ b/drivers/clk/mediatek/clk-mt8195-infra_ao.c @@ -55,8 +55,12 @@ static const struct mtk_gate_regs infra_ao4_cg_regs = { #define GATE_INFRA_AO1(_id, _name, _parent, _shift) \ GATE_INFRA_AO1_FLAGS(_id, _name, _parent, _shift, 0) +#define GATE_INFRA_AO2_FLAGS(_id, _name, _parent, _shift, _flag) \ + GATE_MTK_FLAGS(_id, _name, _parent, &infra_ao2_cg_regs, _shift, \ + &mtk_clk_gate_ops_setclr, _flag) + #define GATE_INFRA_AO2(_id, _name, _parent, _shift) \ - GATE_MTK(_id, _name, _parent, &infra_ao2_cg_regs, _shift, &mtk_clk_gate_ops_setclr) + GATE_INFRA_AO2_FLAGS(_id, _name, _parent, _shift, 0) #define GATE_INFRA_AO3_FLAGS(_id, _name, _parent, _shift, _flag) \ GATE_MTK_FLAGS(_id, _name, _parent, &infra_ao3_cg_regs, _shift, \ @@ -136,8 +140,11 @@ static const struct mtk_gate infra_ao_clks[] = { GATE_INFRA_AO2(CLK_INFRA_AO_UNIPRO_SYS, "infra_ao_unipro_sys", "top_ufs", 11), GATE_INFRA_AO2(CLK_INFRA_AO_UNIPRO_TICK, "infra_ao_unipro_tick", "top_ufs_tick1us", 12), GATE_INFRA_AO2(CLK_INFRA_AO_UFS_MP_SAP_B, "infra_ao_ufs_mp_sap_b", "top_ufs_mp_sap_cfg", 13), - GATE_INFRA_AO2(CLK_INFRA_AO_PWRMCU, "infra_ao_pwrmcu", "top_pwrmcu", 15), - GATE_INFRA_AO2(CLK_INFRA_AO_PWRMCU_BUS_H, "infra_ao_pwrmcu_bus_h", "top_axi", 17), + /* pwrmcu is used by ATF for platform PM: clocks must never be disabled by the kernel */ + GATE_INFRA_AO2_FLAGS(CLK_INFRA_AO_PWRMCU, "infra_ao_pwrmcu", "top_pwrmcu", 15, + CLK_IS_CRITICAL), + GATE_INFRA_AO2_FLAGS(CLK_INFRA_AO_PWRMCU_BUS_H, "infra_ao_pwrmcu_bus_h", "top_axi", 17, + CLK_IS_CRITICAL), GATE_INFRA_AO2(CLK_INFRA_AO_APDMA_B, "infra_ao_apdma_b", "top_axi", 18), GATE_INFRA_AO2(CLK_INFRA_AO_SPI4, "infra_ao_spi4", "top_spi", 25), GATE_INFRA_AO2(CLK_INFRA_AO_SPI5, "infra_ao_spi5", "top_spi", 26), From patchwork Wed Oct 19 08:29:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4758 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214717wrs; Wed, 19 Oct 2022 02:13:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5CMKY0QXMWjp+tRskd6cw3smcNlT3stblGZCpmTEOuC4TmD1MsSvf+QbzWPgSsYeBzhj6R X-Received: by 2002:a17:907:2d89:b0:78d:9c30:452b with SMTP id gt9-20020a1709072d8900b0078d9c30452bmr5476636ejc.533.1666170814773; Wed, 19 Oct 2022 02:13:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170814; cv=none; d=google.com; s=arc-20160816; b=XebVUCDBmQbZmMmt+qCXdqUR5hH9wkTwyp7jLLb65VHbyQYLc6lbgMwO6fvQj65p/u PQ5ab3eUsnsVXkBeSdU14544zwnMFXCAobz4NM7Ow3jAv/pL4u/Ik9RP1W5mXgTgtQvY DyutKbr7nCC8VPX/ebyMbZ3LDQ+zVopvYSJfzcvtelvEkYhKSP6GdHA1UejxIM8WE6Bn RzEr5SxtqaJCCOVHMrW8YIHLtUZGotp9QbCe4mwLYL/UcCvoX2R7jOTA6I5FR9+kmWW3 90rRrtp88nDI+oFPbE88NnoZGUChNa6KDP2IdPXdyd5RYQa3rwnIQYkY0d1yizZrpGiB ClBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0UOl1aiHxfbl5y0qLe8snXEwurKvOUmX+LG+chHolj0=; b=HPuAGTtV7li9qJ1QAAcsAvl/jA4Cz/OrNLz2YTd0au8Ajd5jegvphHk9FEHrY0thx0 Sng6NcTJn1rqLJ9A4Ie9HEYorygqboghnGFBGW34P/bNcxOSf7Vif3U1GjQZUyYsz7cF zQ3HsgbW2jtlTI26TX7kK4bJDi1rpqTtWfqTu9qThgtdswkwMKB8jxyDZQavZg5MIJp/ R/eleg3KZ3kD9p+FWrzxymMoY+zeAmFl8CeRywwqgIRJ80SqCA5M8qpdUYlA8YYLvTx7 lbF6gSLidNGPsHIIdpScp0aOPLvwUGHMxA+pr1NRFjUhm2wFDNlC/Elt7YqyG4BOpP5P S2Lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gnoIjo+k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cw11-20020a056402228b00b0043a6e796231si11532429edb.544.2022.10.19.02.13.10; Wed, 19 Oct 2022 02:13:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gnoIjo+k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232904AbiJSJMK (ORCPT + 99 others); Wed, 19 Oct 2022 05:12:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232888AbiJSJJb (ORCPT ); Wed, 19 Oct 2022 05:09:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5CA16BCFD; Wed, 19 Oct 2022 02:00: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 A7414617E1; Wed, 19 Oct 2022 09:00:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BCE17C433D6; Wed, 19 Oct 2022 09:00:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170038; bh=Wmphf3AsPlAzcTCjF/2Rty8KRXokQysKlrzKnN12nkM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gnoIjo+kRQyb5ikQYUhGDccqruCZpw7Fgs8jEsk0wYIPf/a6jN6jzHvCio/pPZ11Y 66S1U5bepvCf51vYUMLZ2Oef7myuyCm1YOE0DNKxq0kEgAR7np+xW7DRQdSo7g7c2p RuQOwMgjXLiScfZZQYyd//v7B65MAvbj8miwUWSM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Frederic Barrat , Hangyu Hua , Sasha Levin Subject: [PATCH 6.0 503/862] misc: ocxl: fix possible refcount leak in afu_ioctl() Date: Wed, 19 Oct 2022 10:29:50 +0200 Message-Id: <20221019083312.212973716@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106728022874819?= X-GMAIL-MSGID: =?utf-8?q?1747106728022874819?= From: Hangyu Hua [ Upstream commit c3b69ba5114c860d730870c03ab4ee45276e5e35 ] eventfd_ctx_put need to be called to put the refcount that gotten by eventfd_ctx_fdget when ocxl_irq_set_handler fails. Fixes: 060146614643 ("ocxl: move event_fd handling to frontend") Acked-by: Frederic Barrat Signed-off-by: Hangyu Hua Link: https://lore.kernel.org/r/20220824082600.36159-1-hbh25y@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/misc/ocxl/file.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/misc/ocxl/file.c b/drivers/misc/ocxl/file.c index 6777c419a8da..d46dba2df5a1 100644 --- a/drivers/misc/ocxl/file.c +++ b/drivers/misc/ocxl/file.c @@ -257,6 +257,8 @@ static long afu_ioctl(struct file *file, unsigned int cmd, if (IS_ERR(ev_ctx)) return PTR_ERR(ev_ctx); rc = ocxl_irq_set_handler(ctx, irq_id, irq_handler, irq_free, ev_ctx); + if (rc) + eventfd_ctx_put(ev_ctx); break; case OCXL_IOCTL_GET_METADATA: From patchwork Wed Oct 19 08: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: 5260 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp274882wrs; Wed, 19 Oct 2022 04:45:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4cCt+P4lOasWydo4P1G6Lk0Ig5mvk6CmxaFNJz4Vd0oEVHLQ9qiSxlgcaUj6t5GqwtMmjl X-Received: by 2002:a17:902:ce08:b0:179:ed2b:8cd8 with SMTP id k8-20020a170902ce0800b00179ed2b8cd8mr8114699plg.23.1666179956482; Wed, 19 Oct 2022 04:45:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666179956; cv=none; d=google.com; s=arc-20160816; b=03fuK88DEblSFXGqnSsjiYr315UOvnJqVr4hBSrzrh7COXCDYK+tTRk4nyZZG8wtsr vJ2WkPK8gD1G7FLWL1e4Ui+9fhEym8FeNonxX2gKqja4sqTUQJyQeVQ58ncFmJ8PBp8l gnNqBayBNYxf0g3AUQPl5z3JnxUZKqTa31DnV764Go08mrj/GcZL89fGOAbj68gnupj7 AGfwNlPPZsmch/bxfnSsnEpADdUfEjzx7pbsZiaBikyX4fEjO6J9dUONm159uGCF1p0N hihfQc+4koO3q2S6De9zAk4DaV2TSmdwUpMW98xYueJkkR7v+Eart4nzVneaefTbvOM3 awfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tbP+dXxm6qgOu78QZic8M10cQXXj+2JPYNR8yqQ9SaU=; b=bnIh/VarSeJ8VRewrXn+JJ4VK6od9xYhh9B/TRewqDGpzTEXzzbdANQHFp7ZXVUNoa GlO2M+GVtOO/A/4nLfqeTgwMmjK7iSjWX0/T/LslVbhNet6tpEkVKOZ/+bX92ggAIrTo m6vyjZXDP2973XCVrxmuuUqIE1JDEaxrytveLome5RmDcVbD280NfJjAqy283fy2PJjA eevH25/z9OO0y9bhhUoDEn6GbmArRGe3hZGmcfv11hDFDfU42xg3HCsOvw/frXGsef7B DVM9FwVdkFXko0hTGj+uggcg/iBmQt8WAzVdF8HrZWG5YX2kIe3VktXKdeat/UcpsL82 9S3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WLP9JvLF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e17-20020a63e011000000b00460f2778426si18113273pgh.59.2022.10.19.04.45.43; Wed, 19 Oct 2022 04:45: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=WLP9JvLF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230442AbiJSLkq (ORCPT + 99 others); Wed, 19 Oct 2022 07:40:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231518AbiJSLkA (ORCPT ); Wed, 19 Oct 2022 07:40: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 1217618F908; Wed, 19 Oct 2022 04:18:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 495BB61805; Wed, 19 Oct 2022 09:00:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59B96C433D6; Wed, 19 Oct 2022 09:00:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170040; bh=vcaLK0lvNkR+XV77RCpMih3ZdGG56S+uibkBqrOTXyc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WLP9JvLF4ESpMGQcJqB2WAVqZHcRLdhIi6tDunJNA3DBxkeEHz/aTZxqNRXWu0G2I dvJLeSaWNPoBV2YfmKuk8MJ+gz+eP8zaVP3QvzFIrpo3/YdoiRafuAc5Oj5CtUXedA 6v1MEIo+l+gDUoi9Rvsg7G5KN2AJU/5e9vgRSCAY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Matthew Gerlach , Tianfei Zhang , Marco Pagani , Tom Rix , Wu Hao , Xu Yilun , Sasha Levin Subject: [PATCH 6.0 504/862] fpga: dfl-pci: Add IDs for Intel N6000, N6001 and C6100 cards Date: Wed, 19 Oct 2022 10:29:51 +0200 Message-Id: <20221019083312.264626205@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,UPPERCASE_50_75 autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747116314015967709?= X-GMAIL-MSGID: =?utf-8?q?1747116314015967709?= From: Matthew Gerlach [ Upstream commit 65f5c01033ab85f8d385d65c4b51fe31459da603 ] Add pci_dev_table entries supporting the Intel N6000, N6001 and C6100 cards to the dfl-pci driver. Signed-off-by: Matthew Gerlach Signed-off-by: Tianfei Zhang Tested-by: Marco Pagani Reviewed-by: Tom Rix Acked-by: Wu Hao Acked-by: Xu Yilun Link: https://lore.kernel.org/r/20220719145644.242481-1-matthew.gerlach@linux.intel.com Signed-off-by: Xu Yilun Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/fpga/dfl-pci.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) --- a/drivers/fpga/dfl-pci.c +++ b/drivers/fpga/dfl-pci.c @@ -77,12 +77,18 @@ static void cci_pci_free_irq(struct pci_ #define PCIE_DEVICE_ID_INTEL_PAC_D5005 0x0B2B #define PCIE_DEVICE_ID_SILICOM_PAC_N5010 0x1000 #define PCIE_DEVICE_ID_SILICOM_PAC_N5011 0x1001 +#define PCIE_DEVICE_ID_INTEL_DFL 0xbcce +/* PCI Subdevice ID for PCIE_DEVICE_ID_INTEL_DFL */ +#define PCIE_SUBDEVICE_ID_INTEL_N6000 0x1770 +#define PCIE_SUBDEVICE_ID_INTEL_N6001 0x1771 +#define PCIE_SUBDEVICE_ID_INTEL_C6100 0x17d4 /* VF Device */ #define PCIE_DEVICE_ID_VF_INT_5_X 0xBCBF #define PCIE_DEVICE_ID_VF_INT_6_X 0xBCC1 #define PCIE_DEVICE_ID_VF_DSC_1_X 0x09C5 #define PCIE_DEVICE_ID_INTEL_PAC_D5005_VF 0x0B2C +#define PCIE_DEVICE_ID_INTEL_DFL_VF 0xbccf static struct pci_device_id cci_pcie_id_tbl[] = { {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCIE_DEVICE_ID_PF_INT_5_X),}, @@ -96,6 +102,18 @@ static struct pci_device_id cci_pcie_id_ {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCIE_DEVICE_ID_INTEL_PAC_D5005_VF),}, {PCI_DEVICE(PCI_VENDOR_ID_SILICOM_DENMARK, PCIE_DEVICE_ID_SILICOM_PAC_N5010),}, {PCI_DEVICE(PCI_VENDOR_ID_SILICOM_DENMARK, PCIE_DEVICE_ID_SILICOM_PAC_N5011),}, + {PCI_DEVICE_SUB(PCI_VENDOR_ID_INTEL, PCIE_DEVICE_ID_INTEL_DFL, + PCI_VENDOR_ID_INTEL, PCIE_SUBDEVICE_ID_INTEL_N6000),}, + {PCI_DEVICE_SUB(PCI_VENDOR_ID_INTEL, PCIE_DEVICE_ID_INTEL_DFL_VF, + PCI_VENDOR_ID_INTEL, PCIE_SUBDEVICE_ID_INTEL_N6000),}, + {PCI_DEVICE_SUB(PCI_VENDOR_ID_INTEL, PCIE_DEVICE_ID_INTEL_DFL, + PCI_VENDOR_ID_INTEL, PCIE_SUBDEVICE_ID_INTEL_N6001),}, + {PCI_DEVICE_SUB(PCI_VENDOR_ID_INTEL, PCIE_DEVICE_ID_INTEL_DFL_VF, + PCI_VENDOR_ID_INTEL, PCIE_SUBDEVICE_ID_INTEL_N6001),}, + {PCI_DEVICE_SUB(PCI_VENDOR_ID_INTEL, PCIE_DEVICE_ID_INTEL_DFL, + PCI_VENDOR_ID_INTEL, PCIE_SUBDEVICE_ID_INTEL_C6100),}, + {PCI_DEVICE_SUB(PCI_VENDOR_ID_INTEL, PCIE_DEVICE_ID_INTEL_DFL_VF, + PCI_VENDOR_ID_INTEL, PCIE_SUBDEVICE_ID_INTEL_C6100),}, {0,} }; MODULE_DEVICE_TABLE(pci, cci_pcie_id_tbl); From patchwork Wed Oct 19 08: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: 5113 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp250894wrs; Wed, 19 Oct 2022 03:50:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM57ebJyN7YcIBYHDUvoYXMEsnhnsu61V363LzNw4FuiRrWdQyXCdm6ckE+2ltbBO9lOSe2p X-Received: by 2002:a17:906:5dcc:b0:78d:e77d:e66f with SMTP id p12-20020a1709065dcc00b0078de77de66fmr6118483ejv.102.1666176618791; Wed, 19 Oct 2022 03:50:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176618; cv=none; d=google.com; s=arc-20160816; b=YXKKIGhTCO/kV9535V1Q63ipu03X5liqwc4SGkhaiiMEWaRoBuls22/ifWFlz838Eq JW6VM2/anatJyfGxMXKgqH2HBANAmROigHhM3rOzc9I2zQNOBfjhVgjbkkLChfhfNvta Onqe5P533YOqYYIFM22T6mbVRLA5+yY5ZMAJ5mMTU1U+gxmyV7lKGBf+ACI1NclNYmSB DYpAnkvz10URyCRCKEyELg5vKMuly+aBdT7qukXklJTyFpUnb+TMgKovuJZzDKDjPsgu DgSw/B2QLjX09wEsPApzRLY4/y+7o5qSxrCUzvXSJMjVZLfz/VD9wisSdQCkBFjL5r/j I1CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=F19Q5KP4az5kvzkBglTVal7Jq9150LLLbtZoy1+FawQ=; b=rqtlz9V68BXhLQgNLE4Gk1zwFM7xDljSnZDoI2egCF88zYleQi0KXq9yllAxLrcby4 XOfq5v1Bejbdsg07VZ2cA0RiU8sYVJzPQo7NBFoBxUqK1PJaLD809wbtTysHOQMIQFlA jNEQOgA1TYswTkJo1yclSir9CLyuZ8fJZtQqJaptOU7YHx70X1mLNBAQESynnR4/wxfn Xvke77f9JQJkyAj/ngjsEFRMtlHj5Eknf7jHoNqGHyrYWz451Zrnl9TkvEHx/3RauXJ6 zWL40uKQicNuOvU/7o/EpRBcv6ZpqQCtytn6s+ydZXszhGLhccWHXUg71P16ALVSidvN GiYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XdPWLO8N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bu3-20020a170906a14300b00782539a0286si11662870ejb.142.2022.10.19.03.49.54; Wed, 19 Oct 2022 03: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=XdPWLO8N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234036AbiJSKr6 (ORCPT + 99 others); Wed, 19 Oct 2022 06:47:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232947AbiJSKpv (ORCPT ); Wed, 19 Oct 2022 06:45:51 -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 6728A11D984; Wed, 19 Oct 2022 03:21: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 936CCB82454; Wed, 19 Oct 2022 09:00:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E50F7C433D7; Wed, 19 Oct 2022 09:00:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170043; bh=qZLcI+C2kMZApJ2J7MvfP6RYfBi+1GyHo4kolVk2Mq4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XdPWLO8NskYBrV0Pw7vdMqoiUsDh8cIpRkrQjNOfdbGG3syKKPX85+1FkxHgrsbEZ zVry5oB3oVmO3Mv7iAzHaNbCyM6IdC7wznq/cAr7PND+W39cTxqwPSPN2QVlx8NTfl 7b49AVfi31r7CFyaKyof2MLH5uMDUb7R/59uuWP4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Xu Yilun , Sasha Levin Subject: [PATCH 6.0 505/862] fpga: prevent integer overflow in dfl_feature_ioctl_set_irq() Date: Wed, 19 Oct 2022 10:29:52 +0200 Message-Id: <20221019083312.305200120@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112814171690155?= X-GMAIL-MSGID: =?utf-8?q?1747112814171690155?= From: Dan Carpenter [ Upstream commit 939bc5453b8cbdde9f1e5110ce8309aedb1b501a ] The "hdr.count * sizeof(s32)" multiplication can overflow on 32 bit systems leading to memory corruption. Use array_size() to fix that. Fixes: 322b598be4d9 ("fpga: dfl: introduce interrupt trigger setting API") Signed-off-by: Dan Carpenter Acked-by: Xu Yilun Link: https://lore.kernel.org/r/YxBAtYCM38dM7yzI@kili Signed-off-by: Xu Yilun Signed-off-by: Sasha Levin --- drivers/fpga/dfl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/fpga/dfl.c b/drivers/fpga/dfl.c index 5498bc337f8b..b9aae85ba930 100644 --- a/drivers/fpga/dfl.c +++ b/drivers/fpga/dfl.c @@ -1866,7 +1866,7 @@ long dfl_feature_ioctl_set_irq(struct platform_device *pdev, return -EINVAL; fds = memdup_user((void __user *)(arg + sizeof(hdr)), - hdr.count * sizeof(s32)); + array_size(hdr.count, sizeof(s32))); if (IS_ERR(fds)) return PTR_ERR(fds); From patchwork Wed Oct 19 08: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: 5115 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp250978wrs; Wed, 19 Oct 2022 03:50:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6/zDd4RAHH7qqx9H1RQhkDeaKa2CRN4lGbXjIGByxqaD0ONFKoCBiDW8vV04Fu2JnJoKKk X-Received: by 2002:a17:906:8457:b0:78d:b793:5511 with SMTP id e23-20020a170906845700b0078db7935511mr6101797ejy.393.1666176630505; Wed, 19 Oct 2022 03:50:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176630; cv=none; d=google.com; s=arc-20160816; b=Imv0vcNtReT4BXBIY8WiHW7HZqG3vI44QUvocn72uJo+tknV6Y6X0UjG+JRNE9nF/S xerUpHYxcpmvqt5HtIeEpxkvjnObapWYejUMytXQTcDggMSix18yXBAsqReiG9LnfhAq 9vN6X7mD39rmRdxN2w+RNd9Qje+Y2QnCS1LYRGpMFqWws0EvGuS617PzGuBW+khzIDE8 ndgPL17Whd7qLBPtAlLACI0Tm5VrWcwPGxXmRGfKL6t08hhTrxWrQOI1CipI8Nq0Oj2O jw15SGazL46ifugGAQbyvuWf+4yKQYQuP5bcMOkPzeTj/kwB/dOyYSEKVung+iKQ9IjM fLmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FCwzk50Jojn3egVS12KPj3vqvDLZq24zeyLTpKKDGdE=; b=eMssYBLFsBFUgRDEKe4QhSNVpvyPhS8pIGZqXXAtwHR8aOn4StVwe4b99ex6pbieLh nyALuCLh9YvLeeWreY7XmQKXLNLvmn+9osjRbmdg3HbBh8Yq/ALDP5ZKG3cN7YdHnpM4 +zqD+RCrSNu+KJBLuI121iRPZxjXuQvWygWr48Lv60OiGeOxMWUQX0hGDnYBMRxPguav uGBrRE0k3h08q2xfvj9pqDNk3CSnEv+f1elkqT9MH2EL83K2zXDbiwzLJ7iRfA6dr03B th8dQdkSVMWZoVxrrmaNeW88gbXM99BafDK/ozTqfWF8sm8prf2v9zs2OkCZORbQ2GPj owWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kN4LESQP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j9-20020a05640211c900b0045db850a506si6230438edw.46.2022.10.19.03.50.04; Wed, 19 Oct 2022 03:50: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=kN4LESQP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234347AbiJSKsw (ORCPT + 99 others); Wed, 19 Oct 2022 06:48:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233413AbiJSKqp (ORCPT ); Wed, 19 Oct 2022 06:46:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E09E215A32C; Wed, 19 Oct 2022 03:21: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 3297FB8245F; Wed, 19 Oct 2022 09:00:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91372C433C1; Wed, 19 Oct 2022 09:00:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170045; bh=ARqMNczG9AC7cTclunG4sGzC2KLFxA0jYdI0tZNSQo0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kN4LESQPz9uxwFljqq1zsC9Rqv2DUWjGn8+HBuDSqkf74J6gi3aPimzKC3+hDZZtk 7nQrIqOl5ud9C6EEOXo2kW4qNaiiXD5K4V0Uc6xuYn/6dCirqIgMv4eYCt0a4D+Xls dwDZRjJ1xk8G4Q/MjkZ+SQnYpBUQrtynwZImKCSk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Markus Reichl , Michael Riesch , Peter Geis , Samuel Holland , Vinod Koul , Sasha Levin Subject: [PATCH 6.0 506/862] phy: rockchip-inno-usb2: Return zero after otg sync Date: Wed, 19 Oct 2022 10:29:53 +0200 Message-Id: <20221019083312.345036441@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112826265523617?= X-GMAIL-MSGID: =?utf-8?q?1747112826265523617?= From: Peter Geis [ Upstream commit f340ed8664a55a467850ec1689996e63d9ee971a ] The otg sync state patch reuses the ret variable, but fails to set it to zero after use. This leads to a situation when the otg port is in peripheral mode where the otg phy aborts halfway through setup. It also fails to account for a failure to register the extcon notifier. Fix this by using our own variable and skipping otg sync in case of failure. Fixes: 8dc60f8da22f ("phy: rockchip-inno-usb2: Sync initial otg state") Reported-by: Markus Reichl Reported-by: Michael Riesch Signed-off-by: Peter Geis Tested-by: Michael Riesch Tested-by: Markus Reichl Reviewed-by: Samuel Holland Link: https://lore.kernel.org/r/20220902184543.1234835-1-pgwipeout@gmail.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c index 0b1e9337ee8e..e6ededc51523 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c @@ -1124,7 +1124,7 @@ static int rockchip_usb2phy_otg_port_init(struct rockchip_usb2phy *rphy, struct rockchip_usb2phy_port *rport, struct device_node *child_np) { - int ret; + int ret, id; rport->port_id = USB2PHY_PORT_OTG; rport->port_cfg = &rphy->phy_cfg->port_cfgs[USB2PHY_PORT_OTG]; @@ -1162,13 +1162,15 @@ static int rockchip_usb2phy_otg_port_init(struct rockchip_usb2phy *rphy, ret = devm_extcon_register_notifier(rphy->dev, rphy->edev, EXTCON_USB_HOST, &rport->event_nb); - if (ret) + if (ret) { dev_err(rphy->dev, "register USB HOST notifier failed\n"); + goto out; + } if (!of_property_read_bool(rphy->dev->of_node, "extcon")) { /* do initial sync of usb state */ - ret = property_enabled(rphy->grf, &rport->port_cfg->utmi_id); - extcon_set_state_sync(rphy->edev, EXTCON_USB_HOST, !ret); + id = property_enabled(rphy->grf, &rport->port_cfg->utmi_id); + extcon_set_state_sync(rphy->edev, EXTCON_USB_HOST, !id); } } From patchwork Wed Oct 19 08:29:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4811 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp218598wrs; Wed, 19 Oct 2022 02:23:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Kc4W/opU/TDag7iWFjdZ6VMILqUtFzuuVFhl/+WhRG8ofNHGvqasyx181U1xn4BMPQn/c X-Received: by 2002:a05:6402:40d4:b0:45d:1351:3f9d with SMTP id z20-20020a05640240d400b0045d13513f9dmr6470339edb.199.1666171398440; Wed, 19 Oct 2022 02:23:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666171398; cv=none; d=google.com; s=arc-20160816; b=gDi83bmVt3tNml/vgqHF5wueGaNqtKUkGb6CW/MZbPi4ou+rwlygjcAvqTdMdrjRe2 uo7H8eyfQCjZACZupMg3IklRCqMB7wtmi9PqiCu5kPlRdKnV+5NrcZXITFhwNfKhEGSq wCg/grDt4dZsuxiRpG+9hatA5tZ/I7eoG1vbWTF5X+SfdWCB0X4c+xM5k7yJqyCWEZGB wKNQl7N8TTlSSwlPCT6yW5Ui42Mf2J2RRx547CLPGUvEXZAJqtoua+ta8ZIgynVL0zSk 3hVykHYhr4ZFAIZLi4qo6UPiDr48xcfWnkiJmltUGISeB1Bj2AF28fj3h8yyEiubpMsW INdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=F0ZW0k//9OnPv/YFGK1/u1Uwtm1TX/Jr7ByLNI0XqQo=; b=rRPB9opDXdM5rEHFU3lcV98gvwF2oaWTiAfzsXCwd949VK2Qb/2yXYm7ebv89/HQ2J DRv9zFlPSyRL3a9oMYkzuUZwml7p6DPm+QPcreQwxmWgXyZq5/eMA9I6pEE6iWy/T6j/ fnb6ROhGyIxrYJfGQ6aTPTewg1L+URz18D1u0reuUVtfSP8wa2e8qnQsExo9+r2HCdiY K+3dNxqHsdT6kgPAMEriz832jG4GFBc12QKIihewSJoHzmhMIQYbp58wFcOepO7Cwy4P QcxRD62USSRsECtEjzraXYsRxT+8EvRH8/SDMvFtcsNHDzQGqTy3z1mJzmZg9i2cJHA4 OaeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uwIKVdGu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a1709070d8a00b0078e11cbb722si16839623ejc.92.2022.10.19.02.22.52; Wed, 19 Oct 2022 02:23: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=uwIKVdGu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233284AbiJSJSC (ORCPT + 99 others); Wed, 19 Oct 2022 05:18:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233221AbiJSJOO (ORCPT ); Wed, 19 Oct 2022 05:14: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 E7FD5DFC9; Wed, 19 Oct 2022 02:04: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 0A0F46181D; Wed, 19 Oct 2022 09:00:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F2C6C433D6; Wed, 19 Oct 2022 09:00:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170048; bh=k9UmSSd24VoHD4EdvwgqSONVwGFzHEbaHDORRiPVUfQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uwIKVdGuzLQwhxO9hQgPH/9lrl8YqE0aJ+NE0Pfcckc3qOgT0aTTiiw3VsTX9/dzp BDnLnraPQRqNTc79C7c11VNR/oZeLznitDUxD22PrbH/j+h2lIlE1OIGpipu3ff5EG MOezB958iyT8c2Q1/dAM7n3fcjEGwlycjQX9moko= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fenghua Yu , Dave Jiang , Vinod Koul , dmaengine@vger.kernel.org, Jerry Snitselaar , Sasha Levin Subject: [PATCH 6.0 507/862] dmaengine: idxd: avoid deadlock in process_misc_interrupts() Date: Wed, 19 Oct 2022 10:29:54 +0200 Message-Id: <20221019083312.384744713@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747107340491794681?= X-GMAIL-MSGID: =?utf-8?q?1747107340491794681?= From: Jerry Snitselaar [ Upstream commit 407171717a4f4d2d80825584643374a2dfdb0540 ] idxd_device_clear_state() now grabs the idxd->dev_lock itself, so don't grab the lock prior to calling it. This was seen in testing after dmar fault occurred on system, resulting in lockup stack traces. Cc: Fenghua Yu Cc: Dave Jiang Cc: Vinod Koul Cc: dmaengine@vger.kernel.org Fixes: cf4ac3fef338 ("dmaengine: idxd: fix lockdep warning on device driver removal") Signed-off-by: Jerry Snitselaar Reviewed-by: Dave Jiang Link: https://lore.kernel.org/r/20220823163709.2102468-1-jsnitsel@redhat.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/idxd/irq.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/dma/idxd/irq.c b/drivers/dma/idxd/irq.c index 743ead5ebc57..5b9921475be6 100644 --- a/drivers/dma/idxd/irq.c +++ b/drivers/dma/idxd/irq.c @@ -324,13 +324,11 @@ static int process_misc_interrupts(struct idxd_device *idxd, u32 cause) idxd->state = IDXD_DEV_HALTED; idxd_wqs_quiesce(idxd); idxd_wqs_unmap_portal(idxd); - spin_lock(&idxd->dev_lock); idxd_device_clear_state(idxd); dev_err(&idxd->pdev->dev, "idxd halted, need %s.\n", gensts.reset_type == IDXD_DEVICE_RESET_FLR ? "FLR" : "system reset"); - spin_unlock(&idxd->dev_lock); return -ENXIO; } } From patchwork Wed Oct 19 08: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: 5090 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp249692wrs; Wed, 19 Oct 2022 03:46:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6XB5SRZBen9/V/LLumCm180LKx/SkBYTlK8E133RA6pBOOhKdpiyT5S2JGxVYo5AQUxPwu X-Received: by 2002:a17:90b:1184:b0:20c:c0f:7c43 with SMTP id gk4-20020a17090b118400b0020c0c0f7c43mr45103019pjb.236.1666176414377; Wed, 19 Oct 2022 03:46:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176414; cv=none; d=google.com; s=arc-20160816; b=iXVb7PEKY4oHdI5emOMrhJi11LxXpXLhArNKNV9Cybmaadp1Xfjc7s1s0lmlzR0RIU ks+bbckHIoO5gowVHtKbzDvSSehVtGZZa6PeZtIy2qKzSDICyx4R2AFSLrp/2gf40yGG GbbtL86xE00PEcy9VJ40+lDLVVXEKTJ5c4O3o/B0E3a0UBhj5OMYTWE37f+hGcj7DHfB Zkgpg2OUIFAAsfMzJluBFXzdGWvskvJzmSS3qauF9cU+FXl8bpqdoLBJOjBKYSnQo9YE vxToF1TIo7Li3fEjJw2gnoNwOkPV7d9SO2gV2LayFDtZqN/OJyjJjATf0fO3wrYuqG7i 74bQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PrgHe7CX1UwWMIO4mMhjm7t1RjA3aOW7qy6jtVcGhNU=; b=j/zH1Hj5lQZRr1RVHKtYNT4tiZSgTxagsDamiSWtjlqeuPzMK8SbcmLwL1Nn+4m8iC OFzrfIyfpEh5u9APaTZ9MuFNTnuR0j9ra+gaUNUwSc+ogUjFAaq0UUxtBwP5weUAcy+I Ri9Gh1gMFXcaxHJkLWqnxJAobPPZkHPtJu13HPtdEORog88giy0ik9jxNM7JxnB7J4JM jfkv/uap866h+hM6RONxoPaG9NPt2p5zWM6BgLsINgP4o0lq3ZuIWUeh3Xi3Cx3k0ajb BJeZtEKVs6WBtL9PJl7FJcuW6EwlNN/aDMPhgpXOCY6SW2gelXv52hXse0XvVuIE1emt JmWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="c/nm/tma"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s16-20020a63e810000000b0046248881576si18453793pgh.157.2022.10.19.03.46.41; Wed, 19 Oct 2022 03:46:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="c/nm/tma"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233126AbiJSKqU (ORCPT + 99 others); Wed, 19 Oct 2022 06:46:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233132AbiJSKo3 (ORCPT ); Wed, 19 Oct 2022 06:44: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 B7933112AAC; Wed, 19 Oct 2022 03:21:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5547BB8244A; Wed, 19 Oct 2022 09:00:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5080C433C1; Wed, 19 Oct 2022 09:00:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170051; bh=rMbA6/oW/i/Lu6KasqXn0fbJlBZXxf0bUD+LrqGkdqU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c/nm/tmaasT/m97T/0KYYeYynqqDQw/MIV+1ddTXBe6IXJfogRqwyzbjhAh7aeTrG q9xS4qT0zv05+zD/+VcxvShyv6E6ksOB25+NXakzeQwCtJMLjUFLDSAr3yVLXBQbJs b01Sb2NLwe2Ol5g9RTtOhL7Wl6r0gl80YL6DVN0c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jie Hai , Zhou Wang , Vinod Koul , Sasha Levin Subject: [PATCH 6.0 508/862] dmaengine: hisilicon: Disable channels when unregister hisi_dma Date: Wed, 19 Oct 2022 10:29:55 +0200 Message-Id: <20221019083312.433390135@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112600000396024?= X-GMAIL-MSGID: =?utf-8?q?1747112600000396024?= From: Jie Hai [ Upstream commit e3bdaa04ada31f46d0586df83a2789b8913053c5 ] When hisi_dma is unloaded or unbinded, all of channels should be disabled. This patch disables DMA channels when driver is unloaded or unbinded. Fixes: e9f08b65250d ("dmaengine: hisilicon: Add Kunpeng DMA engine support") Signed-off-by: Jie Hai Acked-by: Zhou Wang Link: https://lore.kernel.org/r/20220830062251.52993-2-haijie1@huawei.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/hisi_dma.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/dma/hisi_dma.c b/drivers/dma/hisi_dma.c index 43817ced3a3e..98bc488893cc 100644 --- a/drivers/dma/hisi_dma.c +++ b/drivers/dma/hisi_dma.c @@ -180,7 +180,8 @@ static void hisi_dma_reset_qp_point(struct hisi_dma_dev *hdma_dev, u32 index) hisi_dma_chan_write(hdma_dev->base, HISI_DMA_CQ_HEAD_PTR, index, 0); } -static void hisi_dma_reset_hw_chan(struct hisi_dma_chan *chan) +static void hisi_dma_reset_or_disable_hw_chan(struct hisi_dma_chan *chan, + bool disable) { struct hisi_dma_dev *hdma_dev = chan->hdma_dev; u32 index = chan->qp_num, tmp; @@ -201,8 +202,11 @@ static void hisi_dma_reset_hw_chan(struct hisi_dma_chan *chan) hisi_dma_do_reset(hdma_dev, index); hisi_dma_reset_qp_point(hdma_dev, index); hisi_dma_pause_dma(hdma_dev, index, false); - hisi_dma_enable_dma(hdma_dev, index, true); - hisi_dma_unmask_irq(hdma_dev, index); + + if (!disable) { + hisi_dma_enable_dma(hdma_dev, index, true); + hisi_dma_unmask_irq(hdma_dev, index); + } ret = readl_relaxed_poll_timeout(hdma_dev->base + HISI_DMA_Q_FSM_STS + index * HISI_DMA_OFFSET, tmp, @@ -218,7 +222,7 @@ static void hisi_dma_free_chan_resources(struct dma_chan *c) struct hisi_dma_chan *chan = to_hisi_dma_chan(c); struct hisi_dma_dev *hdma_dev = chan->hdma_dev; - hisi_dma_reset_hw_chan(chan); + hisi_dma_reset_or_disable_hw_chan(chan, false); vchan_free_chan_resources(&chan->vc); memset(chan->sq, 0, sizeof(struct hisi_dma_sqe) * hdma_dev->chan_depth); @@ -394,7 +398,7 @@ static void hisi_dma_enable_qp(struct hisi_dma_dev *hdma_dev, u32 qp_index) static void hisi_dma_disable_qp(struct hisi_dma_dev *hdma_dev, u32 qp_index) { - hisi_dma_reset_hw_chan(&hdma_dev->chan[qp_index]); + hisi_dma_reset_or_disable_hw_chan(&hdma_dev->chan[qp_index], true); } static void hisi_dma_enable_qps(struct hisi_dma_dev *hdma_dev) From patchwork Wed Oct 19 08: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: 4765 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214850wrs; Wed, 19 Oct 2022 02:13:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4loBnrELw2yLJKlgRMci6thMp73g93AONuhAJI9322Th9SI42HlEeFyBOQwqNxAGxOKUyq X-Received: by 2002:a05:6402:1b08:b0:458:d229:bcac with SMTP id by8-20020a0564021b0800b00458d229bcacmr6340108edb.118.1666170837097; Wed, 19 Oct 2022 02:13:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170837; cv=none; d=google.com; s=arc-20160816; b=UxhifnTsqN0sglZvUAl4VybUzqVzGY4x0JHNogYu1VpNjmGI8B+oRPLOsoIQ+wZpKO sky6xSS8B5SYCaR3CXQeF061Hkd2nyhIieas32lWFoX+0Ja9DhBTRWrdN2kVlxyLde3r AjYPjpaYujreATA4NEcdxpvtszZQhtI2Ek7y86JMrd9pUzMD4tY4LHw1aBhh0ljlCHnJ VPNFUr44njTNb/dnNI2+zrYQIK5o1jwQ9AzoUjSCGJG6AmYsQsSKLg0PBAsHYIJopv8P lqG9ki6Vu+iAIpFVM/6rrkp48hX2nwXAi04mp7R09jKvbbQLIb1qwYoxjcpSdJ0w9Qs/ GLhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DNPMDxDPD2lYiT8qMnosRbZhEcz8fSp7m4z5gW6kwQs=; b=RuMTL1hV1IkkXcvUnG7DbLoAn7MZHEoCv0lAKqkjK2Na14K2bV6B416AerpjzZBl/d 2cMpgt2cp13Rva+D9ZHambUPfIVeadtle5N6rkN3JNpqWsr+Yp7pNy+ElDhWDhIuveoI nO3yxqtb3bxgNvnRtU/+FxXhcQoeh0TjX0Pz6EDJ974q250J5wDjlPy44Q1/LQFBXTcN SfjZfCfKNDQxxl0If/hbEtU/fMlNTKuQ0RzvXNcwrOW7RcR8ax88QaB3LAxqOdmk45BI QXREtbCxGu52bBQKhOynpdQO0FFI1CIbkRqTb39NqvKjuaFXbKJqsa5eBHxG2hlK64Al RKHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zb8GnXL1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hk6-20020a170906c9c600b0077497671e2asi13561310ejb.406.2022.10.19.02.13.32; Wed, 19 Oct 2022 02:13: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=zb8GnXL1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232941AbiJSJMg (ORCPT + 99 others); Wed, 19 Oct 2022 05:12:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232984AbiJSJJv (ORCPT ); Wed, 19 Oct 2022 05:09:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A0979F362; Wed, 19 Oct 2022 02:00: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 37E6161800; Wed, 19 Oct 2022 09:00:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 48AA1C433C1; Wed, 19 Oct 2022 09:00:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170053; bh=+vbNUCQv8UUCMwCDsqLsnnb70lWBjwdQNQ0Y+msAdpk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zb8GnXL1b8j3+3WvQprX8M8FBws05KrrMigCJmVVTpElmFYyWw7eLy+zS3PVKX6fn hukBDEEA8TaQv73/bvRCK/0NSnBsTc7u/ao/q/mBJ70wf+eL2GQ56xnKiIiH0G8pa1 pyuAyDGMcvtMVMaIuhE37pN6tFPl6VFYhRsIFw5w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jie Hai , Zhou Wang , Vinod Koul , Sasha Levin Subject: [PATCH 6.0 509/862] dmaengine: hisilicon: Fix CQ head update Date: Wed, 19 Oct 2022 10:29:56 +0200 Message-Id: <20221019083312.477351647@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106751773841667?= X-GMAIL-MSGID: =?utf-8?q?1747106751773841667?= From: Jie Hai [ Upstream commit 94477a79cf80e8ab55b68f14bc579a12ddea1e0b ] After completion of data transfer of one or multiple descriptors, the completion status and the current head pointer to submission queue are written into the CQ and interrupt can be generated to inform the software. In interrupt process CQ is read and cq_head is updated. hisi_dma_irq updates cq_head only when the completion status is success. When an abnormal interrupt reports, cq_head will not update which will cause subsequent interrupt processes read the error CQ and never report the correct status. This patch updates cq_head whenever CQ is accessed. Fixes: e9f08b65250d ("dmaengine: hisilicon: Add Kunpeng DMA engine support") Signed-off-by: Jie Hai Acked-by: Zhou Wang Link: https://lore.kernel.org/r/20220830062251.52993-3-haijie1@huawei.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/hisi_dma.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/dma/hisi_dma.c b/drivers/dma/hisi_dma.c index 98bc488893cc..837f7e4adfa6 100644 --- a/drivers/dma/hisi_dma.c +++ b/drivers/dma/hisi_dma.c @@ -436,12 +436,10 @@ static irqreturn_t hisi_dma_irq(int irq, void *data) desc = chan->desc; cqe = chan->cq + chan->cq_head; if (desc) { + chan->cq_head = (chan->cq_head + 1) % hdma_dev->chan_depth; + hisi_dma_chan_write(hdma_dev->base, HISI_DMA_CQ_HEAD_PTR, + chan->qp_num, chan->cq_head); if (FIELD_GET(STATUS_MASK, cqe->w0) == STATUS_SUCC) { - chan->cq_head = (chan->cq_head + 1) % - hdma_dev->chan_depth; - hisi_dma_chan_write(hdma_dev->base, - HISI_DMA_CQ_HEAD_PTR, chan->qp_num, - chan->cq_head); vchan_cookie_complete(&desc->vd); } else { dev_err(&hdma_dev->pdev->dev, "task error!\n"); From patchwork Wed Oct 19 08: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: 5120 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp251207wrs; Wed, 19 Oct 2022 03:51:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6F8edBrytWBvj767GLDQKkEkcIvEONEq5akanMSYcdIDqYNFRKe1s1eidoTS/pc1wLq43m X-Received: by 2002:a17:907:31c9:b0:740:ef93:2ffd with SMTP id xf9-20020a17090731c900b00740ef932ffdmr6191221ejb.584.1666176667284; Wed, 19 Oct 2022 03:51:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176667; cv=none; d=google.com; s=arc-20160816; b=SEmhZyrCc1lZsvRMk4yv3JXEmEuGc2TlT8itf96je7bRnPyCWsiNvwFfOMHyGQQG6F Igoj5pmCKm6rVuEo0nIpXhU94K8afXyjNOBDVITCaxzJJFfiG+5Pmhv8jDyJ2QKZgUgQ Ne2yWOB3LPL1VOAldAfAc527+u65mErZEhmx9L7zhcwm9NRLlqXpVWGUUtOL8MRqpNF1 AxyryeqEfYjIrD4KRS87lMknFTUvJkV5DkEqunkM8PK4WtTB8aMQI6kZc2fLozTdKOPC VEnjRl9tP3YIIZZUlHK/jy7uCHQ/YHwTiCQmEdafEmtq1flgrg9iaq5ocGkq1gABGkVE g/PA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0wsrwGAhHMGMCbkHoA4N+gkqwOt0onh8W5TqDi5vMcY=; b=F+7tHptrY7CcbVP+vRzVlP5qv9lKziHZ8mT+n9eM8TogUKHUSoo22EO9i++slSogSp 5ibzJH80G6u0XhfpPWbLQ69lI/+/zRzHw/2kcepKf/h195SJtsyrCcoQdGRUj5DIHq1u VG5XIlhCL7L1vMHLR8ZJnx3OsWAiO84OvLnniTtbSCwRDESontoBXXbT77HTm15L6Aus eN2SbLD3MiMATM1zgmtgjh87AMXSG5WjT0ZdXdDAzNUYbvo5+v2sTM3hep1rC7V1qyUO NxMF3pRA0vddWzqh+AGTHhe80UIUZ57hQdgPoxZjrns6H4lUBtBLmEQXBAp4GuH1GZ5F 3wkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="N3/XSi7j"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sb24-20020a1709076d9800b0078de83a052csi14576392ejc.483.2022.10.19.03.50.40; Wed, 19 Oct 2022 03:51: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="N3/XSi7j"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233363AbiJSKuD (ORCPT + 99 others); Wed, 19 Oct 2022 06:50:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233600AbiJSKrU (ORCPT ); Wed, 19 Oct 2022 06: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 7C3EB1382F0; Wed, 19 Oct 2022 03:21: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 ams.source.kernel.org (Postfix) with ESMTPS id 15D29B8245A; Wed, 19 Oct 2022 09:01:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B537C433C1; Wed, 19 Oct 2022 09:00:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170059; bh=s3BcNo+4Mt/v+RbVxnDPFg5Kc5akKszf8xfXcrWrnLk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N3/XSi7jEen4qGSAfwjADgoEUWDsQuu9STf/Ryo158JXkC4YKqrjZrC0aBwb24GEn xEuzY2RlvxeeKD4CwEKKlLGZ+x8DMrtz/D5bPsVis/KOM9lPDd77b1xrU2svi06/gs Xlunq6L1X5fXrxki7098pMyz77ZYv7P8B8VVqL38= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jie Hai , Zhou Wang , Vinod Koul , Sasha Levin Subject: [PATCH 6.0 510/862] dmaengine: hisilicon: Add multi-thread support for a DMA channel Date: Wed, 19 Oct 2022 10:29:57 +0200 Message-Id: <20221019083312.517043549@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112864971327734?= X-GMAIL-MSGID: =?utf-8?q?1747112864971327734?= From: Jie Hai [ Upstream commit 2cbb95883c990d0002a77e13d3278913ab26ad79 ] When we get a DMA channel and try to use it in multiple threads it will cause oops and hanging the system. % echo 100 > /sys/module/dmatest/parameters/threads_per_chan % echo 100 > /sys/module/dmatest/parameters/iterations % echo 1 > /sys/module/dmatest/parameters/run [383493.327077] Unable to handle kernel paging request at virtual address dead000000000108 [383493.335103] Mem abort info: [383493.335103] ESR = 0x96000044 [383493.335105] EC = 0x25: DABT (current EL), IL = 32 bits [383493.335107] SET = 0, FnV = 0 [383493.335108] EA = 0, S1PTW = 0 [383493.335109] FSC = 0x04: level 0 translation fault [383493.335110] Data abort info: [383493.335111] ISV = 0, ISS = 0x00000044 [383493.364739] CM = 0, WnR = 1 [383493.367793] [dead000000000108] address between user and kernel address ranges [383493.375021] Internal error: Oops: 96000044 [#1] PREEMPT SMP [383493.437574] CPU: 63 PID: 27895 Comm: dma0chan0-copy2 Kdump: loaded Tainted: GO 5.17.0-rc4+ #2 [383493.457851] pstate: 204000c9 (nzCv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--) [383493.465331] pc : vchan_tx_submit+0x64/0xa0 [383493.469957] lr : vchan_tx_submit+0x34/0xa0 This occurs because the transmission timed out, and that's due to data race. Each thread rewrite channels's descriptor as soon as device_issue_pending is called. It leads to the situation that the driver thinks that it uses the right descriptor in interrupt handler while channels's descriptor has been changed by other thread. The descriptor which in fact reported interrupt will not be handled any more, as well as its tx->callback. That's why timeout reports. With current fixes channels' descriptor changes it's value only when it has been used. A new descriptor is acquired from vc->desc_issued queue that is already filled with descriptors that are ready to be sent. Threads have no direct access to DMA channel descriptor. In case of channel's descriptor is busy, try to submit to HW again when a descriptor is completed. In this case, vc->desc_issued may be empty when hisi_dma_start_transfer is called, so delete error reporting on this. Now it is just possible to queue a descriptor for further processing. Fixes: e9f08b65250d ("dmaengine: hisilicon: Add Kunpeng DMA engine support") Signed-off-by: Jie Hai Acked-by: Zhou Wang Link: https://lore.kernel.org/r/20220830062251.52993-4-haijie1@huawei.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/hisi_dma.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/hisi_dma.c b/drivers/dma/hisi_dma.c index 837f7e4adfa6..0233b42143c7 100644 --- a/drivers/dma/hisi_dma.c +++ b/drivers/dma/hisi_dma.c @@ -271,7 +271,6 @@ static void hisi_dma_start_transfer(struct hisi_dma_chan *chan) vd = vchan_next_desc(&chan->vc); if (!vd) { - dev_err(&hdma_dev->pdev->dev, "no issued task!\n"); chan->desc = NULL; return; } @@ -303,7 +302,7 @@ static void hisi_dma_issue_pending(struct dma_chan *c) spin_lock_irqsave(&chan->vc.lock, flags); - if (vchan_issue_pending(&chan->vc)) + if (vchan_issue_pending(&chan->vc) && !chan->desc) hisi_dma_start_transfer(chan); spin_unlock_irqrestore(&chan->vc.lock, flags); @@ -441,11 +440,10 @@ static irqreturn_t hisi_dma_irq(int irq, void *data) chan->qp_num, chan->cq_head); if (FIELD_GET(STATUS_MASK, cqe->w0) == STATUS_SUCC) { vchan_cookie_complete(&desc->vd); + hisi_dma_start_transfer(chan); } else { dev_err(&hdma_dev->pdev->dev, "task error!\n"); } - - chan->desc = NULL; } spin_unlock(&chan->vc.lock); From patchwork Wed Oct 19 08: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: 4874 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225341wrs; Wed, 19 Oct 2022 02:42:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4TqXroMqB4WPlOv0J7m0Wf2ryKy4y6z2GpSByE5zcYMroq6/hAH82g8PbI3/DaJw4rz9pZ X-Received: by 2002:a05:6402:42c6:b0:45c:fc58:bd0f with SMTP id i6-20020a05640242c600b0045cfc58bd0fmr6678320edc.19.1666172576794; Wed, 19 Oct 2022 02:42:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172576; cv=none; d=google.com; s=arc-20160816; b=aJF+FxgIoaemLE10dhZQBpN+bV1WFSjpvEi/97crSljzX2yZAMCNdPNMwTHDJTVqPl eE45OY0h7ymuBol1JcpkhYxwrRGn2bxYoextZk6H/2bTVKBpgjyNxZRimqsB62cSh/c9 gz5yVcwy+XP6OJdZBjcStpeyFZ6+/TBgsgkybHAk4Jut9TKGI+8nKSk26+NBLDkj0/qH 2C5zIWjKJxxqNqp2Xr4BvD5kiODQblRmtNttxFSi1EhxcOAc4TnzE0T/W/YuGxv/jbBr UvRRTFaZ4QZNqBZcYnS4CFnJEnRZGcXA35FDdoFW+Z3tIqTa+S7JPDM6yCM+cHZf419U Jdpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sb6t8jSooG1cuMhZqRJMkZG8COa6//vm9IH/41TbkSo=; b=vR4psuD77KHQrjchdb0HDinQqWo69VvC+L/W4s2wiqiJ2zEC5leBlWHOVmWgMsmnG6 UNzCtE4/nMve6P+0DuBy/pVq43/Hs69P1bvx9YtsbXtGCMzSIdcFvRAT+OuzObmZ4b9U R6Dc8uhy1T8n0ZG4KWvt9H42n9ohybaNxXY+MB8k3RX3pxPsOXs1X8+hYa37K7ytJGod 0FWQiG3QB7xcnAUjPpIij981JYjvXoBiSDQ621fCRuu0P+qK8Waz9CbLYjbRwOIitiWP qx3gSene8aOq9I7RpQNBVaXRhBVpFsSUJdyMBb+nqUggFMekyHJDAKKlusyU3/lrKLM0 n1Wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TfPLgsHH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id en19-20020a056402529300b0045878eab247si12135932edb.193.2022.10.19.02.42.31; Wed, 19 Oct 2022 02:42:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TfPLgsHH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233605AbiJSJbL (ORCPT + 99 others); Wed, 19 Oct 2022 05:31:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233541AbiJSJ1V (ORCPT ); Wed, 19 Oct 2022 05:27: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 0C7B5E6F76; Wed, 19 Oct 2022 02:12:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 14F7361738; Wed, 19 Oct 2022 09:01:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21F17C433C1; Wed, 19 Oct 2022 09:01:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170062; bh=9DW2B3GfccMQLd9+7/WwNZWZFVrCRAP6iFxZJ8fPyXQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TfPLgsHHNLWQT+iZFvGYO7f8/ZMzPz7MVPNm+msJ9T9hbM4wNi0eAbdXcp0bRGyfV UYHQ3MYpTed35ikixLHmIqFaCrPZUQNsSpydISW8Th+X4EqI+PAzuFyJkBIa0qA8EC VnycnET23AvjgkbmMDrEmXPb+4XpMwdSnxOOjw2I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vincent Whitchurch , Andy Shevchenko , Jonathan Cameron , Sasha Levin Subject: [PATCH 6.0 511/862] iio: Use per-device lockdep class for mlock Date: Wed, 19 Oct 2022 10:29:58 +0200 Message-Id: <20221019083312.561138991@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108576069254997?= X-GMAIL-MSGID: =?utf-8?q?1747108576069254997?= From: Vincent Whitchurch [ Upstream commit 2bc9cd66eb25d0fefbb081421d6586495e25840e ] If an IIO driver uses callbacks from another IIO driver and calls iio_channel_start_all_cb() from one of its buffer setup ops, then lockdep complains due to the lock nesting, as in the below example with lmp91000. Since the locks are being taken on different IIO devices, there is no actual deadlock. Fix the warning by telling lockdep to use a different class for each iio_device. ============================================ WARNING: possible recursive locking detected -------------------------------------------- python3/23 is trying to acquire lock: (&indio_dev->mlock){+.+.}-{3:3}, at: iio_update_buffers but task is already holding lock: (&indio_dev->mlock){+.+.}-{3:3}, at: enable_store other info that might help us debug this: Possible unsafe locking scenario: CPU0 ---- lock(&indio_dev->mlock); lock(&indio_dev->mlock); *** DEADLOCK *** May be due to missing lock nesting notation 5 locks held by python3/23: #0: (sb_writers#5){.+.+}-{0:0}, at: ksys_write #1: (&of->mutex){+.+.}-{3:3}, at: kernfs_fop_write_iter #2: (kn->active#14){.+.+}-{0:0}, at: kernfs_fop_write_iter #3: (&indio_dev->mlock){+.+.}-{3:3}, at: enable_store #4: (&iio_dev_opaque->info_exist_lock){+.+.}-{3:3}, at: iio_update_buffers Call Trace: __mutex_lock iio_update_buffers iio_channel_start_all_cb lmp91000_buffer_postenable __iio_update_buffers enable_store Fixes: 67e17300dc1d76 ("iio: potentiostat: add LMP91000 support") Signed-off-by: Vincent Whitchurch Reviewed-by: Andy Shevchenko Link: https://lore.kernel.org/r/20220829091840.2791846-1-vincent.whitchurch@axis.com Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin --- drivers/iio/industrialio-core.c | 5 +++++ include/linux/iio/iio-opaque.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c index 0f4dbda3b9d3..921d8e8643a2 100644 --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c @@ -1621,6 +1621,8 @@ static void iio_dev_release(struct device *device) iio_device_detach_buffers(indio_dev); + lockdep_unregister_key(&iio_dev_opaque->mlock_key); + ida_free(&iio_ida, iio_dev_opaque->id); kfree(iio_dev_opaque); } @@ -1680,6 +1682,9 @@ struct iio_dev *iio_device_alloc(struct device *parent, int sizeof_priv) INIT_LIST_HEAD(&iio_dev_opaque->buffer_list); INIT_LIST_HEAD(&iio_dev_opaque->ioctl_handlers); + lockdep_register_key(&iio_dev_opaque->mlock_key); + lockdep_set_class(&indio_dev->mlock, &iio_dev_opaque->mlock_key); + return indio_dev; } EXPORT_SYMBOL(iio_device_alloc); diff --git a/include/linux/iio/iio-opaque.h b/include/linux/iio/iio-opaque.h index 6b3586b3f952..d1f8b30a7c8b 100644 --- a/include/linux/iio/iio-opaque.h +++ b/include/linux/iio/iio-opaque.h @@ -11,6 +11,7 @@ * checked by device drivers but should be considered * read-only as this is a core internal bit * @driver_module: used to make it harder to undercut users + * @mlock_key: lockdep class for iio_dev lock * @info_exist_lock: lock to prevent use during removal * @trig_readonly: mark the current trigger immutable * @event_interface: event chrdevs associated with interrupt lines @@ -42,6 +43,7 @@ struct iio_dev_opaque { int currentmode; int id; struct module *driver_module; + struct lock_class_key mlock_key; struct mutex info_exist_lock; bool trig_readonly; struct iio_event_interface *event_interface; From patchwork Wed Oct 19 08:29:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5517 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp336998wrs; Wed, 19 Oct 2022 06:48:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5w2/9RN6hSwIsc5jcowLvXJe0OLfiyJV5gTqW0Xn7tYvXjwFc0YMun8Q1YlawOJx5RjJfs X-Received: by 2002:a17:903:48e:b0:17f:802b:f079 with SMTP id jj14-20020a170903048e00b0017f802bf079mr8628572plb.89.1666187295874; Wed, 19 Oct 2022 06:48:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666187295; cv=none; d=google.com; s=arc-20160816; b=dDxk65XbGB0ftLHUWY+J3HxziRPd9crNb5GlXVJvTc2cUWeOvVzWkycnv+gQbXzh/x NhX8SeJodDLeCQqCx3+8SOR0qGSViVALZTJ9Xrax4tkS6kJnlnFQ4h2vPKxeZUI16s2d wuufLu6F9WOHTUkT38vceSVXJIVqxWbRlnyctGzVn9dK5vrJvFNYr8CubJ+bHksjE9J/ R3HnsJCwMIzxr/ByvgwoSM07UQuQnznl4ohB33vCJqaeCyo38d220xVVWf7lHhPMLOvL q3DjVgWP2JPYHuBagK3KxZzcITaMRvsa/bvOwcF7Rc0qXi5aKo0br7TKA759U3Ipir9u IVAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=d1iHjBmYVefgoFKeQ96nLRwl9b6TLPErveY9hV1aOic=; b=wUpc0JklphYRHszPs+nf74a1yV1xUtuilsi3x8LRcT42nWUz0ex+iabCdH/feq7F9D Golcmz6H0MwLeY5MxgqudpOWnqueYgetxusLzaEuc/UGyi1SKHXGcQA/8bVgTBehynPt SBhyMuVkDr4EcHmJy17hLtmRew0B3FuDp5k4rhPLHhCibOoMpIlR0V7PlQB1aJqJIgHR zuWbPwSSXQZikSJ6r3tlXjDBlyMh6vLFsQy4gDfmUHJUxOPkpn0AoZFgnT97DUmm4Dwk UiXe1AXYBP4Fr+efy7ZTUNjQnvjRT7XWM82pfB/2G68qJsM26Bf4rQYA72GPq3uM/L2d 2TDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=A3ziCNs7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a16-20020a17090ad81000b0020b2535b138si21642190pjv.151.2022.10.19.06.48.02; Wed, 19 Oct 2022 06:48:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=A3ziCNs7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233525AbiJSNrf (ORCPT + 99 others); Wed, 19 Oct 2022 09:47:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233314AbiJSNqQ (ORCPT ); Wed, 19 Oct 2022 09:46:16 -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 67516172527; Wed, 19 Oct 2022 06:32: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 3D6F1B82461; Wed, 19 Oct 2022 09:01:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF861C433C1; Wed, 19 Oct 2022 09:01:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170065; bh=vpqfbiunWovxa5YCg5882NV1JJiUtyPwMIje/6zZPJA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A3ziCNs7eFbbSyGyu0W9JNISyxAor8yDDfq7eHJfLTBIz9fNuwLDuCGRlqcTf5aa6 iuikciD41aljedEDcZeftuVKzrLO6g+lqx0M9qOaerZ7hqGj3kdZlybv5GHyA0b07Z 9VnpDsHgxHcNL1M3Qmt2TIBV+ToOSuk1xZEuogio= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Sasha Levin Subject: [PATCH 6.0 512/862] usb: gadget: f_fs: stricter integer overflow checks Date: Wed, 19 Oct 2022 10:29:59 +0200 Message-Id: <20221019083312.610349805@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747124010165297878?= X-GMAIL-MSGID: =?utf-8?q?1747124010165297878?= From: Dan Carpenter [ Upstream commit f57004b9d96755cd6a243b51c267be4016b4563c ] This from static analysis. The vla_item() takes a size and adds it to the total. It has a built in integer overflow check so if it encounters an integer overflow anywhere then it records the total as SIZE_MAX. However there is an issue here because the "lang_count*(needed_count+1)" multiplication can overflow. Technically the "lang_count + 1" addition could overflow too, but that would be detected and is harmless. Fix both using the new size_add() and size_mul() functions. Fixes: e6f3862fa1ec ("usb: gadget: FunctionFS: Remove VLAIS usage from gadget code") Signed-off-by: Dan Carpenter Link: https://lore.kernel.org/r/YxDI3lMYomE7WCjn@kili Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/gadget/function/f_fs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c index e0fa4b186ec6..36184a762527 100644 --- a/drivers/usb/gadget/function/f_fs.c +++ b/drivers/usb/gadget/function/f_fs.c @@ -2645,10 +2645,10 @@ static int __ffs_data_got_strings(struct ffs_data *ffs, unsigned i = 0; vla_group(d); vla_item(d, struct usb_gadget_strings *, stringtabs, - lang_count + 1); + size_add(lang_count, 1)); vla_item(d, struct usb_gadget_strings, stringtab, lang_count); vla_item(d, struct usb_string, strings, - lang_count*(needed_count+1)); + size_mul(lang_count, (needed_count + 1))); char *vlabuf = kmalloc(vla_group_size(d), GFP_KERNEL); From patchwork Wed Oct 19 08: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: 5521 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp337102wrs; Wed, 19 Oct 2022 06:48:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6XreXsIxojlalyQIeD6L3eSFKEYJhtozDkGP50uQvdf3DGQG67/2g2+6B6DFXUzW4IEAvZ X-Received: by 2002:a17:90b:3891:b0:20d:59e3:1f4f with SMTP id mu17-20020a17090b389100b0020d59e31f4fmr9822210pjb.21.1666187308584; Wed, 19 Oct 2022 06:48:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666187308; cv=none; d=google.com; s=arc-20160816; b=vI1LR4dTGNqcXf1R6w1Rk74jFQCTarYyNXy9rTGBiJ+jUT05haQ2hpmjUZu0EeYKDC nLGpaqeCl2CqN9TeOUMQpLy/e9LA1PgxnKTqeQ18vTYReTupzQSLA693kp5pD/gOI2ow 7w/8tADmrzcQVc9rJUUBj9XvrV1MHPxSxy3xBu0OcFZO+FsCkQdq2Zb1e+A0EeHqNr5q RndzDzFM7Si7X1kSu+VY6zcnQeXoYCNb8hPCUZfpCRvyID3wk/V3Qa7ZUBJfYRjsOwET K59o9clsTcNUvOupgg5X3Ogn9xI31gba3zHew/eJr7bfz5hweICfK4kaw9HVVenxkSzL YOTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Xe257ESVMWjRoUD+pbBPd+DmfH4zAbDtmevNwHwQndE=; b=UF/zsWPDSHMuDpBZZBe2pktanFlOQaNnPDeY1gNJSbXr3wW+Vcwg16vG2/zg/S5HjM Lowkm7boDDzCbPgEfR0tw8UQmL37IB7Hx1g6kG+PheY+4gnumfsn2YR43101t9KIP/OO D6UWlgR9AUQoTy1ElEZq2maDZuToBbqZiBSBBXEUUeHnjopEnqwVJ9zkDX/H1F8COcP7 CUAZzF4b3U49jTdlGB2GETfK04jqCuV0Bw4pj26+fVJMFxxb5QhgJJazs26e9jJNi6aw 8gfKMCzy/uHGJyYE0k24kFc7mEgBOFNbhXp7KLzsYhE3J2H+16Ojr3SN0MOkuUMC9QbH 3W9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CQyu8c3i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z5-20020aa785c5000000b0054307ac90f1si17437814pfn.319.2022.10.19.06.48.16; Wed, 19 Oct 2022 06:48: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=CQyu8c3i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233068AbiJSNrx (ORCPT + 99 others); Wed, 19 Oct 2022 09:47:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233366AbiJSNqX (ORCPT ); Wed, 19 Oct 2022 09:46:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEDD313D0D; Wed, 19 Oct 2022 06:32:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E946DB823C3; Wed, 19 Oct 2022 09:01:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49E51C433D6; Wed, 19 Oct 2022 09:01:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170067; bh=4wv5WtR//CDdsvxu8xL/5g2O2bXmliW8UL1zS+PsHLM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CQyu8c3ip3MooVefqQvBWcxKhNA8KNBlVoKBWDpteEzHwmKjwrcIx/RYxop3/lHsr GApJCNpSrxApuZPiuT8Uds92APTHBZ8IdSm9o5I0z0dWyp+wWHt/fM2oaijjO5MRP8 1VOxH0ZNfElHmFuiDwPWmMQe6x9FxhT+5//+uCjM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, vincent.whitchurch@axis.com, Jason Baron , Daniel Vetter , Jim Cromie , Sasha Levin Subject: [PATCH 6.0 513/862] dyndbg: fix static_branch manipulation Date: Wed, 19 Oct 2022 10:30:00 +0200 Message-Id: <20221019083312.654631487@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747124023432485941?= X-GMAIL-MSGID: =?utf-8?q?1747124023432485941?= From: Jim Cromie [ Upstream commit ee879be38bc87f8cedc79ae2742958db6533ca59 ] In https://lore.kernel.org/lkml/20211209150910.GA23668@axis.com/ Vincent's patch commented on, and worked around, a bug toggling static_branch's, when a 2nd PRINTK-ish flag was added. The bug results in a premature static_branch_disable when the 1st of 2 flags was disabled. The cited commit computed newflags, but then in the JUMP_LABEL block, failed to use that result, instead using just one of the terms in it. Using newflags instead made the code work properly. This is Vincents test-case, reduced. It needs the 2nd flag to demonstrate the bug, but it's explanatory here. pt_test() { echo 5 > /sys/module/dynamic_debug/verbose site="module tcp" # just one callsite echo " $site =_ " > /proc/dynamic_debug/control # clear it # A B ~A ~B for flg in +T +p "-T #broke here" -p; do echo " $site $flg " > /proc/dynamic_debug/control done; # A B ~B ~A for flg in +T +p "-p #broke here" -T; do echo " $site $flg " > /proc/dynamic_debug/control done } pt_test Fixes: 84da83a6ffc0 dyndbg: combine flags & mask into a struct, simplify with it CC: vincent.whitchurch@axis.com Acked-by: Jason Baron Acked-by: Daniel Vetter Signed-off-by: Jim Cromie Link: https://lore.kernel.org/r/20220904214134.408619-2-jim.cromie@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- lib/dynamic_debug.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index dd7f56af9aed..a56c1286ffa4 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -211,10 +211,11 @@ static int ddebug_change(const struct ddebug_query *query, continue; #ifdef CONFIG_JUMP_LABEL if (dp->flags & _DPRINTK_FLAGS_PRINT) { - if (!(modifiers->flags & _DPRINTK_FLAGS_PRINT)) + if (!(newflags & _DPRINTK_FLAGS_PRINT)) static_branch_disable(&dp->key.dd_key_true); - } else if (modifiers->flags & _DPRINTK_FLAGS_PRINT) + } else if (newflags & _DPRINTK_FLAGS_PRINT) { static_branch_enable(&dp->key.dd_key_true); + } #endif dp->flags = newflags; v4pr_info("changed %s:%d [%s]%s =%s\n", From patchwork Wed Oct 19 08: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: 4767 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214862wrs; Wed, 19 Oct 2022 02:13:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6nSMMhxymQL3QpQOFKTPgwomXXRihR5IyqM8O9At8jUonGI2PiKqPFbBpO6V3hnP88MaRf X-Received: by 2002:a17:907:a4c:b0:77b:ba98:d3e with SMTP id be12-20020a1709070a4c00b0077bba980d3emr5910868ejc.13.1666170837959; Wed, 19 Oct 2022 02:13:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170837; cv=none; d=google.com; s=arc-20160816; b=xB+UujaWErqqUvAK315dTLR5yQFWZuXlzv+1HqIjAqfw9RpntvEycGMPKxXq3EgSBQ 9/1uczh9wV+L4+Ha8zwmlj5MRW4kWMELfOMLCMaKVlYfYGw4TdHgrLhKoEq6J/59jPkd Kh5ko/DvnEQ0fjDaoC29SzGhV3NmC/KdAsUT2JD4xojGf54ryLz29RwvWW4k/BsUuC0W ramFJU1/PGVR7R8khOVrWEvwFLFwTQ7tjKvjQaINb1CpwN+befYUPeprxh5hsbqjOM/n m7CPxUP4Ctfd6wKZ1QhgKc7PNZR0C4w/PWT7Xc28gxWX7C5PkWELonbxWsEscbNHRhzl PzWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jl55Qgzp+RLgEHvCwc7k6nsS6mMuqw05hq0ZPbqjkwU=; b=NQ+0LCOsE5XfIHcyi9ePVn5357u3jESeATf6PWr04wv3KzNWCH0w0kE2mRYoJLSUE5 Wzdf7p/kPANcdh2NpetZA1nkJ1VzXvAHUvbLXfaSry6nMsYa4fRlXpjTzBu80E4dS3qo C4658Ct8MxDwWsKJ3TS+4yXx9jWuWAb6j611RfaOGcEXn4aN5XQlOMxQkp2IIeICIfhC wu5UXx5aYoeM78pvDzcxFoNZ6WT7K+UbmPgaZhoo0YV/cerDokYZS7ttHOIf8qGqZPGR Wvlr3mZn57Do4P/wvpESVPLvS9slqmmFyiHPepWTBb5rYLCjKLDGe9AsZCkleRfLkTmu NdIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Rzf3wX8z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ga29-20020a1709070c1d00b00772fe97b31esi13839716ejc.901.2022.10.19.02.13.33; Wed, 19 Oct 2022 02:13: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=Rzf3wX8z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232615AbiJSJMl (ORCPT + 99 others); Wed, 19 Oct 2022 05:12:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233037AbiJSJJ7 (ORCPT ); Wed, 19 Oct 2022 05:09: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 0F4B1B5148; Wed, 19 Oct 2022 02:01: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 BA9986174B; Wed, 19 Oct 2022 09:01:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D08C7C433D6; Wed, 19 Oct 2022 09:01:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170070; bh=2jkvL5g/HD5FsyAP8TMFn08xR4PzTjIkzrqUWM+1a30=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rzf3wX8z2SRR7ASrtO3ztIeRz0u/q+nN0mTk3MEvtG6hilGPkSP7Y7V6U3NMA0muS AHOXDioFJXxyfzwLzjSJpidIjOFfquKsAemdOrK98GnAA3Yzs8TApr5CkFMdKdNFuO 6k407Y0DTPBvtm1aJvztiCoXuVyVxlzLllwZeGE0= 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 6.0 514/862] dyndbg: fix module.dyndbg handling Date: Wed, 19 Oct 2022 10:30:01 +0200 Message-Id: <20221019083312.705808466@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106752336399216?= X-GMAIL-MSGID: =?utf-8?q?1747106752336399216?= 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 dce631e678dd..f30b01aa9fa4 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -201,7 +201,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 Wed Oct 19 08: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: 4895 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225527wrs; Wed, 19 Oct 2022 02:43:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4U8dHMK3P4Fhv7Yvc1b+oueEz7jn0d7HzxbaKsuImQzsfoexL0NdcTkBCdFpq3j96xHWkw X-Received: by 2002:a05:6402:42cf:b0:457:ae6f:e443 with SMTP id i15-20020a05640242cf00b00457ae6fe443mr6623426edc.299.1666172601247; Wed, 19 Oct 2022 02:43:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172601; cv=none; d=google.com; s=arc-20160816; b=CWQalE9od/DwMDhq7iHPDfpkUoYxltqoKcSNfCPhDe+iR9isJS7aYLL6Vw3LQyMIAg hv6M6QxnMQ2sPvk9ilfGA8TeW+d0elY9LBMCP/R5iZFqdbc3xZjQjx4p6Y8Ge2+gFeJE ByfT562QIWTyYLsv1x8Wg15IikgNoiN51/T5i9Dm9+9L8ssGb1Zvk+p/sdLzSaF+jkXE Rxgv4ZHeqHCeRLm7A/4NTYK2wbU12m7w77+tDCwiRFPEVO9HjkhQH6Ja/8YHQKHEVGSI LYMzHoprWQIb2mXpLGWXtxgJpvgjzQhLyI0kh2FcN8zr+IVB7LOxUTDbFWqTkrLFK/E4 XjjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DoNt0pXLagS07yM6N8Kcij3wYWGEjnGqJUWKkOcKf7A=; b=vehExIM9Vt8+xvbOrhG8igTiklQvtxnrMSK4BINQxiGk5QhJEpuTABy2Dj9Ful0law Jc6E5kJQTtTU70XExkzQYxj2rwP2mHDxCMxLBaAnAtnUB5lBOoCMFtHp+x52+BeLNhsm 7/fWcHq8W/G04b3skoebwW7Sp2vm4cLTRxd7JSblZwiBoY4i/XaW3oyaKOCYi2lwXsWa AM/Us7nuKNxCzG5vBZUIHG3uGShSrf1gDOB23bBN0/8liFcIDgQjZXEXoo60zG0FB4Dk OlCVKydrqoBit8o1sZeOcxMSRIzRysUBS8uYtVPWrXo1bQ9ZID/f46Z/qFxAXmet6Ill 10HQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sHjNkpa6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s18-20020a1709067b9200b0078df19995e4si12705827ejo.241.2022.10.19.02.42.55; Wed, 19 Oct 2022 02:43:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sHjNkpa6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233950AbiJSJeJ (ORCPT + 99 others); Wed, 19 Oct 2022 05:34:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233783AbiJSJ30 (ORCPT ); Wed, 19 Oct 2022 05:29:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2A98EB754; Wed, 19 Oct 2022 02:13: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 5A5BC617D6; Wed, 19 Oct 2022 09:01:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6EDECC433D7; Wed, 19 Oct 2022 09:01:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170072; bh=sZH1AfOZE2dYsZSEtdB7yfve1BZph91UMlLwjQ5Fm+g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sHjNkpa6e5a0u+HJDm5tRpflfcZ+lpB8yBISLUjPU7pSrz+79ZPn853nxRTiocPO+ nWDknSZJbbyu6sULJAdTxS6Gnhw5NiSic0EsuPySdABJfgZffXU3ioEtMtwpM/4wWC sUf439e3a2017o8oNbXvdHxHPxwXettmXM6Fgsrw= 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 6.0 515/862] dyndbg: let query-modname override actual module name Date: Wed, 19 Oct 2022 10:30:02 +0200 Message-Id: <20221019083312.742710490@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108601360369876?= X-GMAIL-MSGID: =?utf-8?q?1747108601360369876?= 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 a56c1286ffa4..4d168efcf779 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -384,10 +384,6 @@ static int ddebug_parse_query(char *words[], int nwords, return -EINVAL; } - if (modname) - /* support $modname.dyndbg= */ - query->module = modname; - for (i = 0; i < nwords; i += 2) { char *keyword = words[i]; char *arg = words[i+1]; @@ -428,6 +424,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 Wed Oct 19 08: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: 5510 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp336664wrs; Wed, 19 Oct 2022 06:47:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Qm+P6C1Re5ikPDydGhNtBFWQagnyl+ECKH3W7Pqyv2/mqZl1kV64LBd5vrgKtEsHxCmVu X-Received: by 2002:a63:91ca:0:b0:460:c58f:3127 with SMTP id l193-20020a6391ca000000b00460c58f3127mr7361607pge.31.1666187250227; Wed, 19 Oct 2022 06:47:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666187250; cv=none; d=google.com; s=arc-20160816; b=e9s85V/XgSa5u6ZCnu258bm6MF3W11JtwXk1T1F6r3NWKLAyHe8hZvNTT7hnsiwf4+ QgTSY48ZOW7n1khrSJT1NXNdsq2p6d3qVD2rlKXY5ofVPGVbzryWWOOgoE8s1aYHp4h8 CV3YPtXWWz4dQCbreoBlbOmox/oM5QL4NYQ6FZlZGFVKtM/LlZzZVVajG9QRLiJ/kYon OlfmRrs2lAcPUT+CtVkb7Ta++gzPCJl2oIuygcVudIQBidb3ZWrbH/kXik2MBlQcAAMo /cM6SNhezx468S2tc1iV7oyJC5+AVh0HwXsZXHCliVsuCXgWi0xeOsgncfuCWMcY0ToD sE8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RtCrQnx+KRSJl80kUbtRA+Q1YCgUyTG8MdhYOwkNRpw=; b=JcH4cmKG+1nDg7ayJpeTJ58OHSc/oTRd/1SuFLL9oiGshyuss/EfW9CXo7YzhkqHbQ OPzEUMwU7ttylKG7eNZUvG0ItG3SV5fjcMB2D1f2MN4P0JrUDd8k9O4jjiOnj/ns2m55 NYnIKPcDQA+kBTDI9BIuS6a7X0SWlMn244lYOT3DlxmNCTGG7dre8XmytohY2HQQdpZM o3j7Q1Gfh/j1a/+2+nK68sKPMsWAH9ES5nGYyT6bRacAkRmB0m883IEtR3E0Vge+2RcT 91gHepk5VuNTcXJGynNUda7gCxdlmxVHcXw5KXW4OOh9arHRCAnZ08rW3BE2pbOzKcJg 1kAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=owbkCU4c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g63-20020a636b42000000b0046004f18c6csi18194614pgc.456.2022.10.19.06.47.17; Wed, 19 Oct 2022 06:47: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=owbkCU4c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233438AbiJSNq6 (ORCPT + 99 others); Wed, 19 Oct 2022 09:46:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233178AbiJSNpi (ORCPT ); Wed, 19 Oct 2022 09:45:38 -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 D29D348C8D; Wed, 19 Oct 2022 06:32: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 ams.source.kernel.org (Postfix) with ESMTPS id 94E5BB8238D; Wed, 19 Oct 2022 09:01:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D727C433C1; Wed, 19 Oct 2022 09:01:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170075; bh=rRdn83gaQeaNkPFVcGa5S1CTqcpCTQhYS+1Lvk4tkVM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=owbkCU4cbcMkKFfvkIUapwyaEbxi0KgXFyWkhv3hOKcZ1NddKh23jwK6E+WL//TcT nEX3X8gA13CCwhg16M7zgTmADvJJ7I+TSeu/sXpDReyG9AiDcZGXaBbV9n57a9jLJz w0s75tpMkbkgeacXsA4H4h0TDOtY4F8h1O55SJl0= 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 6.0 516/862] dyndbg: drop EXPORTed dynamic_debug_exec_queries Date: Wed, 19 Oct 2022 10:30:03 +0200 Message-Id: <20221019083312.790893382@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123962501152001?= X-GMAIL-MSGID: =?utf-8?q?1747123962501152001?= From: Jim Cromie [ Upstream commit e26ef3af964acfea311403126acee8c56c89e26b ] This exported fn is unused, and will not be needed. Lets dump it. The export was added to let drm control pr_debugs, as part of using them to avoid drm_debug_enabled overheads. But its better to just implement the drm.debug bitmap interface, then its available for everyone. Fixes: a2d375eda771 ("dyndbg: refine export, rename to dynamic_debug_exec_queries()") Fixes: 4c0d77828d4f ("dyndbg: export ddebug_exec_queries") Acked-by: Jason Baron Acked-by: Daniel Vetter Signed-off-by: Jim Cromie Link: https://lore.kernel.org/r/20220904214134.408619-10-jim.cromie@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- include/linux/dynamic_debug.h | 9 --------- lib/dynamic_debug.c | 29 ----------------------------- 2 files changed, 38 deletions(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index f30b01aa9fa4..8d9eec5f6d8b 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -55,9 +55,6 @@ struct _ddebug { #if defined(CONFIG_DYNAMIC_DEBUG_CORE) -/* exported for module authors to exercise >control */ -int dynamic_debug_exec_queries(const char *query, const char *modname); - int ddebug_add_module(struct _ddebug *tab, unsigned int n, const char *modname); extern int ddebug_remove_module(const char *mod_name); @@ -221,12 +218,6 @@ static inline int ddebug_dyndbg_module_param_cb(char *param, char *val, rowsize, groupsize, buf, len, ascii); \ } while (0) -static inline int dynamic_debug_exec_queries(const char *query, const char *modname) -{ - pr_warn("kernel not built with CONFIG_DYNAMIC_DEBUG_CORE\n"); - return 0; -} - #endif /* !CONFIG_DYNAMIC_DEBUG_CORE */ #endif diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 4d168efcf779..c9b3d9e5d470 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -557,35 +557,6 @@ static int ddebug_exec_queries(char *query, const char *modname) return nfound; } -/** - * dynamic_debug_exec_queries - select and change dynamic-debug prints - * @query: query-string described in admin-guide/dynamic-debug-howto - * @modname: string containing module name, usually &module.mod_name - * - * This uses the >/proc/dynamic_debug/control reader, allowing module - * authors to modify their dynamic-debug callsites. The modname is - * canonically struct module.mod_name, but can also be null or a - * module-wildcard, for example: "drm*". - */ -int dynamic_debug_exec_queries(const char *query, const char *modname) -{ - int rc; - char *qry; /* writable copy of query */ - - if (!query) { - pr_err("non-null query/command string expected\n"); - return -EINVAL; - } - qry = kstrndup(query, PAGE_SIZE, GFP_KERNEL); - if (!qry) - return -ENOMEM; - - rc = ddebug_exec_queries(qry, modname); - kfree(qry); - return rc; -} -EXPORT_SYMBOL_GPL(dynamic_debug_exec_queries); - #define PREFIX_SIZE 64 static int remaining(int wrote) From patchwork Wed Oct 19 08: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: 4856 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223870wrs; Wed, 19 Oct 2022 02:38:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5YdmeQRVmlmubbMy074iu2ZUG8MULPa6R5oDPQfVDjQ77RCf77kYJN0uwBloWHpCz679Ws X-Received: by 2002:a63:20f:0:b0:43c:1ef6:ebd6 with SMTP id 15-20020a63020f000000b0043c1ef6ebd6mr6496438pgc.217.1666172324375; Wed, 19 Oct 2022 02:38:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172324; cv=none; d=google.com; s=arc-20160816; b=VcLRGViXVYAwRFDoKCmrp74e8Z0ikZ0sCj118hF7YSPI6iGVE7K92VUejTDUC9wtUk V2YziPaL1zTCvB9vRTYTH/FtgaOuLvfT0PMhi2/jHnlJB//rqJqPqrKf0+nGogybzD1A WGs0aLZGWD4DQmo/dQxCUzVuh7urS0Uxh5OvPsNhrAixbEi/WAroiOwYuVScFtae8kjp itH7Iy2fP58+VBycVV5d5bmnRCzaEMwy4FowSc7s/KssMTEcjihyyPDZpMbCweQzKofG 7cZoWpv1KzIA3YbPsGvw6aFgfzf6dkeyOUquKVg6EZSizo1F0+7hgxfkcjc2rdY/PYc9 Amxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3/tkMaLVrbczAouB+ClEvDpEmv4k3PVBx9LcN3Uog5s=; b=XY+jjhzumtPN0Js+aPKqXSW7g6k3rXAQE3ycBEt+r+/3PXdtwZYorecuQQX5ex1Qzw CUwWuOXbeGoVTG/HqymMQuRpE6TORp0yXwLYk4wttNqHbBELxM/k87QlBql0xYbalRzs XbqrqHptHkFkl8h5bdi727nFpWBi8/Kgs29cjdFCavTTRwonr0VegTVOfOzyH+GCevwV qFplTbojhYREescCC1rT9qMej7b4xFoCOHpUIeR9WwsBx+/Id9Qh6AckwQSt5ViRr5Nl gl7LqdAAUOqEZQA8UnJXB4jT96nPXNhlARU8UVri/RT/1mHrvcRWOaP+DVC1RLTLL8+x z3PQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Do2Yej9G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h185-20020a6383c2000000b00461515e9706si16509065pge.654.2022.10.19.02.38.31; Wed, 19 Oct 2022 02:38: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=Do2Yej9G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233442AbiJSJVk (ORCPT + 99 others); Wed, 19 Oct 2022 05:21:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233715AbiJSJT6 (ORCPT ); Wed, 19 Oct 2022 05:19:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22A70CFB; Wed, 19 Oct 2022 02:09: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 948F6617DE; Wed, 19 Oct 2022 09:01:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A69ACC433D6; Wed, 19 Oct 2022 09:01:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170078; bh=Gor8ma1Y1JlT4Q8d2TK31fIyEysqMQqMhBeWnc8gzp8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Do2Yej9Go8Yb9vetJKhI6o078LI6hq+OcMKip6+CSeJqMJRc5MR0nIVPT66hfBHP3 eDw6Hs3JuSgavQ0UzMZpbpMHIwuxzypg4JDjO0iWbqc8P0TvQUOmYm/QfL/N6zDoWk 1uz50f6FIjynpxK9y7DtA740vqRFDpU2A/yEv5gg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Keith Busch , Jan Kara , Jens Axboe , Sasha Levin Subject: [PATCH 6.0 517/862] sbitmap: Avoid leaving waitqueue in invalid state in __sbq_wake_up() Date: Wed, 19 Oct 2022 10:30:04 +0200 Message-Id: <20221019083312.840347737@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108311414504656?= X-GMAIL-MSGID: =?utf-8?q?1747108311414504656?= From: Jan Kara [ Upstream commit 48c033314f372478548203c583529f53080fd078 ] When __sbq_wake_up() decrements wait_cnt to 0 but races with someone else waking the waiter on the waitqueue (so the waitqueue becomes empty), it exits without reseting wait_cnt to wake_batch number. Once wait_cnt is 0, nobody will ever reset the wait_cnt or wake the new waiters resulting in possible deadlocks or busyloops. Fix the problem by making sure we reset wait_cnt even if we didn't wake up anybody in the end. Fixes: 040b83fcecfb ("sbitmap: fix possible io hung due to lost wakeup") Reported-by: Keith Busch Signed-off-by: Jan Kara Link: https://lore.kernel.org/r/20220908130937.2795-1-jack@suse.cz Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- lib/sbitmap.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/lib/sbitmap.c b/lib/sbitmap.c index 1f31147872e6..bb1970ad4875 100644 --- a/lib/sbitmap.c +++ b/lib/sbitmap.c @@ -605,6 +605,7 @@ static bool __sbq_wake_up(struct sbitmap_queue *sbq) struct sbq_wait_state *ws; unsigned int wake_batch; int wait_cnt; + bool ret; ws = sbq_wake_ptr(sbq); if (!ws) @@ -615,12 +616,23 @@ static bool __sbq_wake_up(struct sbitmap_queue *sbq) * For concurrent callers of this, callers should call this function * again to wakeup a new batch on a different 'ws'. */ - if (wait_cnt < 0 || !waitqueue_active(&ws->wait)) + if (wait_cnt < 0) return true; + /* + * If we decremented queue without waiters, retry to avoid lost + * wakeups. + */ if (wait_cnt > 0) - return false; + return !waitqueue_active(&ws->wait); + /* + * When wait_cnt == 0, we have to be particularly careful as we are + * responsible to reset wait_cnt regardless whether we've actually + * woken up anybody. But in case we didn't wakeup anybody, we still + * need to retry. + */ + ret = !waitqueue_active(&ws->wait); wake_batch = READ_ONCE(sbq->wake_batch); /* @@ -649,7 +661,7 @@ static bool __sbq_wake_up(struct sbitmap_queue *sbq) sbq_index_atomic_inc(&sbq->wake_index); atomic_set(&ws->wait_cnt, wake_batch); - return false; + return ret; } void sbitmap_queue_wake_up(struct sbitmap_queue *sbq) From patchwork Wed Oct 19 08: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: 4851 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223842wrs; Wed, 19 Oct 2022 02:38:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM76ub7qoeSs++aN8TaXe+4UHYyw8vH23G2Swt9S9OihpGxmfAUFnrq1CxXQF5vdsvBB9gWd X-Received: by 2002:a63:86c7:0:b0:459:437c:ca90 with SMTP id x190-20020a6386c7000000b00459437cca90mr6566776pgd.33.1666172319768; Wed, 19 Oct 2022 02:38:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172319; cv=none; d=google.com; s=arc-20160816; b=n6QYZ3nufleOlP/XRXlNmroa6fnRMJeiElmKXy4bbFo9aDfYLcnk9AyYGJIzFcntg3 BxqlUWIIpfNYuv1t+9AcvllG7ugiZjbghHrFz0zyfEdqCnu7eOwluJKhngizWNXLu8Yp o4BXASXN77QfWN+qa8jByYsIlbig/swG/VFqk5P5XYwwTbrS16F2tVBnQPEdVPAG5tHq 3XwqAgykRB3ujieB3muLP9L5kjlcZ7T2qOZ/AuQGi1ksyPct0st/Vt9TUeUmvuCYXd7C /h1xWSsMaxiHKHPT5p3YSmeckWvahNgcW+yWP73eY/vnLgfum2jzx8jKDj+IeeWBFQgI r0lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nm1rMwo1+BzMp1/PCH78WYvt43Ok8UCkJzbB/m5HMMs=; b=07acxfLSOy+Iyfl170SQNRUi0Iu+w9Es3sjhx6M3hcoBzKKiuNx/siYZ1nQz26Kine PSNyH87H0daOQOcLOZv70HHkj4vqYuKqIGpDNK4KP9PLSzD/n8nJ1xJuS/QsHS/G5XLX IE3gj99b6xeO8TyRPp38t5BG1Vibtg+rsiq+akGNzO6WQlMDhk7mRxch2Kccgm9N+CnC zy00hjq495MIQhnW+d1hg202ouutbd6+5AUMOITOxHuC6qVo0QDhLoX3YNvyjK73vXa1 Sz2qOAiVMJeKjX1/utwmwTwJ8te0YRdh/no98llaSSWRdvyapWbcDkeccLYd9p9umsjl PUEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BGEKI7FK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bd33-20020a056a0027a100b0056782f3bdf1si2060716pfb.19.2022.10.19.02.38.26; Wed, 19 Oct 2022 02:38: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=BGEKI7FK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233343AbiJSJUi (ORCPT + 99 others); Wed, 19 Oct 2022 05:20:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233528AbiJSJTa (ORCPT ); Wed, 19 Oct 2022 05:19: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 E5E76DCEAA; Wed, 19 Oct 2022 02:08: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 2272561800; Wed, 19 Oct 2022 09:01:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 373B9C433D7; Wed, 19 Oct 2022 09:01:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170080; bh=CSMZGEx1Zb4R7a0Kvi9BC+oRFdzrgkIBNh8I2cuuVlg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BGEKI7FKXcOFoniwMz3Xczn469v6uUwaZXk9D2hOcJGZLOcr+v9g7O/UHSQi8YNU8 PbQuHud+kTf44y9N+EoOIxQHNkEcdgxAEw0jac8JCusXfHIZU9BdNib0PncfmhMPek OIxnXi49w79JEXISPkOeGnsYMCc7C+2sizd6tyss= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dang Huynh , Dmitry Baryshkov , Bjorn Andersson , Sasha Levin Subject: [PATCH 6.0 518/862] clk: qcom: sm6115: Select QCOM_GDSC Date: Wed, 19 Oct 2022 10:30:05 +0200 Message-Id: <20221019083312.883157055@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108306688294745?= X-GMAIL-MSGID: =?utf-8?q?1747108306688294745?= From: Dang Huynh [ Upstream commit 50ee65dc512b9b5c4de354cf3b4dded34f46c571 ] While working on the Fxtec Pro1X device, this error shows up with my own minimal configuration: gcc-sm6115: probe of 1400000.clock-controller failed with error -38 The clock driver depends on CONFIG_QCOM_GDSC and after enabling that, the driver probes successfully. Signed-off-by: Dang Huynh Fixes: cbe63bfdc54f ("clk: qcom: Add Global Clock controller (GCC) Reviewed-by: Dmitry Baryshkov Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220910170207.1592220-1-danct12@riseup.net Signed-off-by: Sasha Levin --- drivers/clk/qcom/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/clk/qcom/Kconfig b/drivers/clk/qcom/Kconfig index 1cf1ef70e347..d566fbdebdf9 100644 --- a/drivers/clk/qcom/Kconfig +++ b/drivers/clk/qcom/Kconfig @@ -645,6 +645,7 @@ config SM_DISPCC_6350 config SM_GCC_6115 tristate "SM6115 and SM4250 Global Clock Controller" + select QCOM_GDSC help Support for the global clock controller on SM6115 and SM4250 devices. Say Y if you want to use peripheral devices such as UART, SPI, From patchwork Wed Oct 19 08: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: 4792 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp216150wrs; Wed, 19 Oct 2022 02:17:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM44v8TxSAscsFn7683Vlnr3HlwJRYHtX1cSYcvgHTopuzDfbs0C9JA0sCVyXehrRyDAxkF7 X-Received: by 2002:a05:6402:4505:b0:451:1551:7b14 with SMTP id ez5-20020a056402450500b0045115517b14mr6490854edb.300.1666171060802; Wed, 19 Oct 2022 02:17:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666171060; cv=none; d=google.com; s=arc-20160816; b=MUiJ64H95wvLNc+bRHAIfl/MmJeYVMz2vazE6b5qCmbiIxvlph2F5irn+aoEYLFsHW 8P2BAxGWyzCQ7gdiqtCFrWbvHpyd+HnaN+Wwjrm2HXYYgghCM33ffwDe7Q7xkQ0Z39DS Y09LJ/ZOVG2ouaV1LO1KHhzhmwzFOHkAHEStlCieh9hG2kUvewvGoTO98q2OFcueNtVr pK5fweriLMvZKgyCYpeg6alWxlVjTyrX2sBuDEnK3d1jE9s3gorLSTmPoUXq957HjSQd pCY4B2CD24Q4Y1iFpZIZBJatIwtopWoUXE50vTLmUNaqIZY4ry5Im+O67pAgktn+M8nb bIcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=d7vX2IzeXzYYiFoZDsxshkReZojEcD2Rjpr6kixr5bc=; b=u3MJDajpg55LDTyxt9x4/jxEPmLewWVBO0nYOmXd1101K0FZgCvIeTjPoXrOFqnp7k B9OOQp8Ij5uUy2HL9hUgQ5jk+YllJXmwGFkdT38MZoyA11/GyUQgbDAnnbEm8ZbdTLjG sQ6GIik8qm4LQMnW7V9B53RFeqTGOi9odORXrJG/NF5cYEPz9p0uBXvK6EXG9iPxMvol X/IHw8n+xnBcTH5+Jzd4JglvJxV1Vcj+w1THuLOfoDf+hvizi9LgMOQisHxLCa+kj429 2g1nKEVR+Mx/bUkpcVRnmEyNDSUoxu5zWE8AOJjxMuH0Q9M3tcpuhug0zKGwMU6+W4Vo sDMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=K8lFrk0R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y90-20020a50bb63000000b004591f95a2f7si12530512ede.163.2022.10.19.02.17.16; Wed, 19 Oct 2022 02:17: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=K8lFrk0R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233062AbiJSJQm (ORCPT + 99 others); Wed, 19 Oct 2022 05:16:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233125AbiJSJOB (ORCPT ); Wed, 19 Oct 2022 05:14:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7C839A9D0; Wed, 19 Oct 2022 02:03:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 427596183D; Wed, 19 Oct 2022 09:03:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51CA6C433D6; Wed, 19 Oct 2022 09:03:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170201; bh=6g1bMV9wQxwTNLQeIPfdCg5TvIRt0sy9rejM01WnztY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K8lFrk0R7aUaQLpUs0DW+0AMoB0gjtfbHZyB8GwB8kjpAVoZ64eu1NiThl4wSewGC euVcp31WosQAXulcsh6mv6w7YKTmN/HD3V3gQvMzSnBw3/Jzyjpv1Iydp7Y9BfUbE2 BTLKVf8NbljWwscgtVG38NWuEorMNQr3dQvqnTKU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Justin Tee , James Smart , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 6.0 519/862] scsi: lpfc: Fix various issues reported by tools Date: Wed, 19 Oct 2022 10:30:06 +0200 Message-Id: <20221019083312.915840651@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106986467203694?= X-GMAIL-MSGID: =?utf-8?q?1747106986467203694?= From: James Smart [ Upstream commit a4de8356b68e54149ebdbe6e748e2726152b650c ] This patch fixes below Smatch reported issues: 1. lpfc_hbadisc.c:3020 lpfc_mbx_cmpl_fcf_rr_read_fcf_rec() error: uninitialized symbol 'vlan_id'. 2. lpfc_hbadisc.c:3121 lpfc_mbx_cmpl_read_fcf_rec() error: uninitialized symbol 'vlan_id'. 3. lpfc_init.c:335 lpfc_dump_wakeup_param_cmpl() warn: always true condition '(prg->dist < 4) => (0-3 < 4)' 4. lpfc_init.c:2419 lpfc_parse_vpd() warn: inconsistent indenting. 5. lpfc_init.c:13248 lpfc_sli4_enable_msi() warn: 'phba->pcidev->irq' 2147483648 can't fit into 65535 'eqhdl->irq' 6. lpfc_debugfs.c:5300 lpfc_idiag_extacc_avail_get() error: uninitialized symbol 'ext_cnt' 7. lpfc_debugfs.c:5300 lpfc_idiag_extacc_avail_get() error: uninitialized symbol 'ext_size' 8. lpfc_vmid.c:248 lpfc_vmid_get_appid() warn: sleeping in atomic context. 9. lpfc_init.c:8342 lpfc_sli4_driver_resource_setup() warn: missing error code 'rc'. 10. lpfc_init.c:13573 lpfc_sli4_hba_unset() warn: variable dereferenced before check 'phba->pport' (see line 13546) 11. lpfc_auth.c:1923 lpfc_auth_handle_dhchap_reply() error: double free of 'hash_value' Fixes: 1. Initialize vlan_id to LPFC_FCOE_NULL_VID. 2. Initialize vlan_id to LPFC_FCOE_NULL_VID. 3. prg->dist is a 2 bit field. Its value can only be between 0-3. Remove redundent check 'if (prg->dist < 4)'. 4. Fix inconsistent indenting. Moved logic into helper function lpfc_fill_vpd(). 5. Define 'eqhdl->irq' as int value as pci_irq_vector() returns int. Also, check for return value of pci_irq_vector() and log message in case of failure. 6. Initialize 'ext_cnt' to 0. 7. Initialize 'ext_size' to 0. 8. Use alloc_percpu_gfp() with GFP_ATOMIC flag. 9. 'rc' was not updated when dma_pool_create() fails. Update 'rc = -ENOMEM' when dma_pool_create() fails before calling goto statement. 10. Add check for 'phba->pport' in lpfc_cpuhp_remove(). 11. Initialize 'hash_value' to NULL, same like 'aug_chal' variable. Link: https://lore.kernel.org/r/20220911221505.117655-13-jsmart2021@gmail.com Co-developed-by: Justin Tee Signed-off-by: Justin Tee Signed-off-by: James Smart Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/lpfc/lpfc_debugfs.c | 2 +- drivers/scsi/lpfc/lpfc_hbadisc.c | 4 +- drivers/scsi/lpfc/lpfc_init.c | 249 +++++++++++++++++-------------- drivers/scsi/lpfc/lpfc_sli.c | 3 + drivers/scsi/lpfc/lpfc_sli4.h | 4 +- drivers/scsi/lpfc/lpfc_vmid.c | 4 +- 6 files changed, 148 insertions(+), 118 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c index e37b028eae5f..f5252e45a48a 100644 --- a/drivers/scsi/lpfc/lpfc_debugfs.c +++ b/drivers/scsi/lpfc/lpfc_debugfs.c @@ -5156,7 +5156,7 @@ lpfc_idiag_mbxacc_write(struct file *file, const char __user *buf, static int lpfc_idiag_extacc_avail_get(struct lpfc_hba *phba, char *pbuffer, int len) { - uint16_t ext_cnt, ext_size; + uint16_t ext_cnt = 0, ext_size = 0; len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, "\nAvailable Extents Information:\n"); diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c index 2645def612e6..a488d00894ae 100644 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c @@ -2964,7 +2964,7 @@ lpfc_mbx_cmpl_fcf_rr_read_fcf_rec(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) uint32_t boot_flag, addr_mode; uint16_t next_fcf_index, fcf_index; uint16_t current_fcf_index; - uint16_t vlan_id; + uint16_t vlan_id = LPFC_FCOE_NULL_VID; int rc; /* If link state is not up, stop the roundrobin failover process */ @@ -3069,7 +3069,7 @@ lpfc_mbx_cmpl_read_fcf_rec(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) struct fcf_record *new_fcf_record; uint32_t boot_flag, addr_mode; uint16_t fcf_index, next_fcf_index; - uint16_t vlan_id; + uint16_t vlan_id = LPFC_FCOE_NULL_VID; int rc; /* If link state is not up, no need to proceed */ diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index a76f2a120d9d..1a02134438fc 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -325,8 +325,7 @@ lpfc_dump_wakeup_param_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq) prog_id_word = pmboxq->u.mb.un.varWords[7]; /* Decode the Option rom version word to a readable string */ - if (prg->dist < 4) - dist = dist_char[prg->dist]; + dist = dist_char[prg->dist]; if ((prg->dist == 3) && (prg->num == 0)) snprintf(phba->OptionROMVersion, 32, "%d.%d%d", @@ -2258,6 +2257,101 @@ lpfc_handle_latt(struct lpfc_hba *phba) return; } +static void +lpfc_fill_vpd(struct lpfc_hba *phba, uint8_t *vpd, int length, int *pindex) +{ + int i, j; + + while (length > 0) { + /* Look for Serial Number */ + if ((vpd[*pindex] == 'S') && (vpd[*pindex + 1] == 'N')) { + *pindex += 2; + i = vpd[*pindex]; + *pindex += 1; + j = 0; + length -= (3+i); + while (i--) { + phba->SerialNumber[j++] = vpd[(*pindex)++]; + if (j == 31) + break; + } + phba->SerialNumber[j] = 0; + continue; + } else if ((vpd[*pindex] == 'V') && (vpd[*pindex + 1] == '1')) { + phba->vpd_flag |= VPD_MODEL_DESC; + *pindex += 2; + i = vpd[*pindex]; + *pindex += 1; + j = 0; + length -= (3+i); + while (i--) { + phba->ModelDesc[j++] = vpd[(*pindex)++]; + if (j == 255) + break; + } + phba->ModelDesc[j] = 0; + continue; + } else if ((vpd[*pindex] == 'V') && (vpd[*pindex + 1] == '2')) { + phba->vpd_flag |= VPD_MODEL_NAME; + *pindex += 2; + i = vpd[*pindex]; + *pindex += 1; + j = 0; + length -= (3+i); + while (i--) { + phba->ModelName[j++] = vpd[(*pindex)++]; + if (j == 79) + break; + } + phba->ModelName[j] = 0; + continue; + } else if ((vpd[*pindex] == 'V') && (vpd[*pindex + 1] == '3')) { + phba->vpd_flag |= VPD_PROGRAM_TYPE; + *pindex += 2; + i = vpd[*pindex]; + *pindex += 1; + j = 0; + length -= (3+i); + while (i--) { + phba->ProgramType[j++] = vpd[(*pindex)++]; + if (j == 255) + break; + } + phba->ProgramType[j] = 0; + continue; + } else if ((vpd[*pindex] == 'V') && (vpd[*pindex + 1] == '4')) { + phba->vpd_flag |= VPD_PORT; + *pindex += 2; + i = vpd[*pindex]; + *pindex += 1; + j = 0; + length -= (3 + i); + while (i--) { + if ((phba->sli_rev == LPFC_SLI_REV4) && + (phba->sli4_hba.pport_name_sta == + LPFC_SLI4_PPNAME_GET)) { + j++; + (*pindex)++; + } else + phba->Port[j++] = vpd[(*pindex)++]; + if (j == 19) + break; + } + if ((phba->sli_rev != LPFC_SLI_REV4) || + (phba->sli4_hba.pport_name_sta == + LPFC_SLI4_PPNAME_NON)) + phba->Port[j] = 0; + continue; + } else { + *pindex += 2; + i = vpd[*pindex]; + *pindex += 1; + *pindex += i; + length -= (3 + i); + } + } +} + /** * lpfc_parse_vpd - Parse VPD (Vital Product Data) * @phba: pointer to lpfc hba data structure. @@ -2277,7 +2371,7 @@ lpfc_parse_vpd(struct lpfc_hba *phba, uint8_t *vpd, int len) { uint8_t lenlo, lenhi; int Length; - int i, j; + int i; int finished = 0; int index = 0; @@ -2310,101 +2404,10 @@ lpfc_parse_vpd(struct lpfc_hba *phba, uint8_t *vpd, int len) Length = ((((unsigned short)lenhi) << 8) + lenlo); if (Length > len - index) Length = len - index; - while (Length > 0) { - /* Look for Serial Number */ - if ((vpd[index] == 'S') && (vpd[index+1] == 'N')) { - index += 2; - i = vpd[index]; - index += 1; - j = 0; - Length -= (3+i); - while(i--) { - phba->SerialNumber[j++] = vpd[index++]; - if (j == 31) - break; - } - phba->SerialNumber[j] = 0; - continue; - } - else if ((vpd[index] == 'V') && (vpd[index+1] == '1')) { - phba->vpd_flag |= VPD_MODEL_DESC; - index += 2; - i = vpd[index]; - index += 1; - j = 0; - Length -= (3+i); - while(i--) { - phba->ModelDesc[j++] = vpd[index++]; - if (j == 255) - break; - } - phba->ModelDesc[j] = 0; - continue; - } - else if ((vpd[index] == 'V') && (vpd[index+1] == '2')) { - phba->vpd_flag |= VPD_MODEL_NAME; - index += 2; - i = vpd[index]; - index += 1; - j = 0; - Length -= (3+i); - while(i--) { - phba->ModelName[j++] = vpd[index++]; - if (j == 79) - break; - } - phba->ModelName[j] = 0; - continue; - } - else if ((vpd[index] == 'V') && (vpd[index+1] == '3')) { - phba->vpd_flag |= VPD_PROGRAM_TYPE; - index += 2; - i = vpd[index]; - index += 1; - j = 0; - Length -= (3+i); - while(i--) { - phba->ProgramType[j++] = vpd[index++]; - if (j == 255) - break; - } - phba->ProgramType[j] = 0; - continue; - } - else if ((vpd[index] == 'V') && (vpd[index+1] == '4')) { - phba->vpd_flag |= VPD_PORT; - index += 2; - i = vpd[index]; - index += 1; - j = 0; - Length -= (3+i); - while(i--) { - if ((phba->sli_rev == LPFC_SLI_REV4) && - (phba->sli4_hba.pport_name_sta == - LPFC_SLI4_PPNAME_GET)) { - j++; - index++; - } else - phba->Port[j++] = vpd[index++]; - if (j == 19) - break; - } - if ((phba->sli_rev != LPFC_SLI_REV4) || - (phba->sli4_hba.pport_name_sta == - LPFC_SLI4_PPNAME_NON)) - phba->Port[j] = 0; - continue; - } - else { - index += 2; - i = vpd[index]; - index += 1; - index += i; - Length -= (3 + i); - } - } - finished = 0; - break; + + lpfc_fill_vpd(phba, vpd, Length, &index); + finished = 0; + break; case 0x78: finished = 1; break; @@ -8278,8 +8281,10 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) &phba->pcidev->dev, phba->cfg_sg_dma_buf_size, i, 0); - if (!phba->lpfc_sg_dma_buf_pool) + if (!phba->lpfc_sg_dma_buf_pool) { + rc = -ENOMEM; goto out_free_bsmbx; + } phba->lpfc_cmd_rsp_buf_pool = dma_pool_create("lpfc_cmd_rsp_buf_pool", @@ -8287,8 +8292,10 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) sizeof(struct fcp_cmnd) + sizeof(struct fcp_rsp), i, 0); - if (!phba->lpfc_cmd_rsp_buf_pool) + if (!phba->lpfc_cmd_rsp_buf_pool) { + rc = -ENOMEM; goto out_free_sg_dma_buf; + } mempool_free(mboxq, phba->mbox_mem_pool); @@ -12379,7 +12386,7 @@ lpfc_hba_eq_hdl_array_init(struct lpfc_hba *phba) for (i = 0; i < phba->cfg_irq_chann; i++) { eqhdl = lpfc_get_eq_hdl(i); - eqhdl->irq = LPFC_VECTOR_MAP_EMPTY; + eqhdl->irq = LPFC_IRQ_EMPTY; eqhdl->phba = phba; } } @@ -12752,7 +12759,7 @@ static void __lpfc_cpuhp_remove(struct lpfc_hba *phba) static void lpfc_cpuhp_remove(struct lpfc_hba *phba) { - if (phba->pport->fc_flag & FC_OFFLINE_MODE) + if (phba->pport && (phba->pport->fc_flag & FC_OFFLINE_MODE)) return; __lpfc_cpuhp_remove(phba); @@ -13016,9 +13023,17 @@ lpfc_sli4_enable_msix(struct lpfc_hba *phba) LPFC_DRIVER_HANDLER_NAME"%d", index); eqhdl->idx = index; - rc = request_irq(pci_irq_vector(phba->pcidev, index), - &lpfc_sli4_hba_intr_handler, 0, - name, eqhdl); + rc = pci_irq_vector(phba->pcidev, index); + if (rc < 0) { + lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, + "0489 MSI-X fast-path (%d) " + "pci_irq_vec failed (%d)\n", index, rc); + goto cfg_fail_out; + } + eqhdl->irq = rc; + + rc = request_irq(eqhdl->irq, &lpfc_sli4_hba_intr_handler, 0, + name, eqhdl); if (rc) { lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, "0486 MSI-X fast-path (%d) " @@ -13026,8 +13041,6 @@ lpfc_sli4_enable_msix(struct lpfc_hba *phba) goto cfg_fail_out; } - eqhdl->irq = pci_irq_vector(phba->pcidev, index); - if (aff_mask) { /* If found a neighboring online cpu, set affinity */ if (cpu_select < nr_cpu_ids) @@ -13144,7 +13157,14 @@ lpfc_sli4_enable_msi(struct lpfc_hba *phba) } eqhdl = lpfc_get_eq_hdl(0); - eqhdl->irq = pci_irq_vector(phba->pcidev, 0); + rc = pci_irq_vector(phba->pcidev, 0); + if (rc < 0) { + pci_free_irq_vectors(phba->pcidev); + lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, + "0496 MSI pci_irq_vec failed (%d)\n", rc); + return rc; + } + eqhdl->irq = rc; cpu = cpumask_first(cpu_present_mask); lpfc_assign_eq_map_info(phba, 0, LPFC_CPU_FIRST_IRQ, cpu); @@ -13171,8 +13191,8 @@ lpfc_sli4_enable_msi(struct lpfc_hba *phba) * MSI-X -> MSI -> IRQ. * * Return codes - * 0 - successful - * other values - error + * Interrupt mode (2, 1, 0) - successful + * LPFC_INTR_ERROR - error **/ static uint32_t lpfc_sli4_enable_intr(struct lpfc_hba *phba, uint32_t cfg_mode) @@ -13217,7 +13237,14 @@ lpfc_sli4_enable_intr(struct lpfc_hba *phba, uint32_t cfg_mode) intr_mode = 0; eqhdl = lpfc_get_eq_hdl(0); - eqhdl->irq = pci_irq_vector(phba->pcidev, 0); + retval = pci_irq_vector(phba->pcidev, 0); + if (retval < 0) { + lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, + "0502 INTR pci_irq_vec failed (%d)\n", + retval); + return LPFC_INTR_ERROR; + } + eqhdl->irq = retval; cpu = cpumask_first(cpu_present_mask); lpfc_assign_eq_map_info(phba, 0, LPFC_CPU_FIRST_IRQ, diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 55c9eb39ea19..03c21167fc85 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -6202,6 +6202,9 @@ lpfc_sli4_get_avail_extnt_rsrc(struct lpfc_hba *phba, uint16_t type, struct lpfc_mbx_get_rsrc_extent_info *rsrc_info; LPFC_MBOXQ_t *mbox; + *extnt_count = 0; + *extnt_size = 0; + mbox = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); if (!mbox) return -ENOMEM; diff --git a/drivers/scsi/lpfc/lpfc_sli4.h b/drivers/scsi/lpfc/lpfc_sli4.h index 1ddad5b170a6..cbb1aa1cf025 100644 --- a/drivers/scsi/lpfc/lpfc_sli4.h +++ b/drivers/scsi/lpfc/lpfc_sli4.h @@ -489,7 +489,7 @@ struct lpfc_hba; #define LPFC_SLI4_HANDLER_NAME_SZ 16 struct lpfc_hba_eq_hdl { uint32_t idx; - uint16_t irq; + int irq; char handler_name[LPFC_SLI4_HANDLER_NAME_SZ]; struct lpfc_hba *phba; struct lpfc_queue *eq; @@ -611,6 +611,8 @@ struct lpfc_vector_map_info { }; #define LPFC_VECTOR_MAP_EMPTY 0xffff +#define LPFC_IRQ_EMPTY 0xffffffff + /* Multi-XRI pool */ #define XRI_BATCH 8 diff --git a/drivers/scsi/lpfc/lpfc_vmid.c b/drivers/scsi/lpfc/lpfc_vmid.c index f64ced04b912..ed1d7f7b88a3 100644 --- a/drivers/scsi/lpfc/lpfc_vmid.c +++ b/drivers/scsi/lpfc/lpfc_vmid.c @@ -245,9 +245,7 @@ int lpfc_vmid_get_appid(struct lpfc_vport *vport, char *uuid, /* allocate the per cpu variable for holding */ /* the last access time stamp only if VMID is enabled */ if (!vmp->last_io_time) - vmp->last_io_time = __alloc_percpu(sizeof(u64), - __alignof__(struct - lpfc_vmid)); + vmp->last_io_time = alloc_percpu_gfp(u64, GFP_ATOMIC); if (!vmp->last_io_time) { hash_del(&vmp->hnode); vmp->flag = LPFC_VMID_SLOT_FREE; From patchwork Wed Oct 19 08: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: 4876 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225358wrs; Wed, 19 Oct 2022 02:42:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5IclH9L1TFMfUg2bm4DH/2RaaKzjrADUlRqJak91hpH7gcKc/bTIaubcokA2WVqt0xc7FJ X-Received: by 2002:a17:902:e0d1:b0:182:6ab:98e3 with SMTP id e17-20020a170902e0d100b0018206ab98e3mr7583852pla.5.1666172578401; Wed, 19 Oct 2022 02:42:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172578; cv=none; d=google.com; s=arc-20160816; b=ClBLLRJvoTyqVgoebzIpwUTMkjOFa+sNduI6HJkXzX7De+YbMj0bcB4piCCI1eDHJy uFfLyNEeOLc2EKSpJ7JAjwA4lgeJPBfkQ/yCJLb3YTSBC7juHfwg01SvU+aJO1fdA/fB I1Y3eBqajK0HgqKMpGFaeCRbG7A/Aoh7jTxNTmMTRxlIR6X58NpF4HNH1zQ93PrT0sgL 9q8836OmUPvmmLfli9nfl+5QPYh+91UaOkd/heiYUO2IYY5x30vTBfI1xkItT13XVbZM p/NBDlx5M+2rFuKOZarzBnUIKDi5ltvSntKYiztIqs72NqdH2Gt8Hm4ZancpU9eDK2cn R8/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=WjoXa8Zt14lxad46j760H2XqKZUIdxZYDgFPK+9gOJ0=; b=wmzfKQ6o1KGcayCu/luUzTvgtxWxNSFrMCnHnBnZPbKd05U32hmkaNKUDyJgA0VKzf vBTLGjkqoeBD9N0Yj56luEytMKNP1GikTvzsHu+GAH7rnXgY608uc6NpuN7IAiTS6U87 ax5zMeil3CJQEr85He4ZqCvAWx6SxIQq55XwwOI+aGC5N3/1xvnZTOEKhOnePjBzwyAY XB/jnYGp7WAOOSbMz8TD7mH6gGu1RUsNA291bcjp5xS9+C0X2/nfP2CjJoOVx2PiTmss xok36ZupNb0GFqSjLhGeW35UNVtw3BIrNB5Snq0ykZ+FX897/BmH7DTQz7F76Gbcv5Mq iyrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fttDkwpu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x185-20020a6386c2000000b0043961d07372si16356143pgd.585.2022.10.19.02.42.45; Wed, 19 Oct 2022 02:42: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=fttDkwpu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231143AbiJSJdO (ORCPT + 99 others); Wed, 19 Oct 2022 05:33:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233699AbiJSJ3H (ORCPT ); Wed, 19 Oct 2022 05:29: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 0D47FEA37E; Wed, 19 Oct 2022 02:12: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 dfw.source.kernel.org (Postfix) with ESMTPS id 4DD92617F7; Wed, 19 Oct 2022 09:01:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5CE1EC433D6; Wed, 19 Oct 2022 09:01:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170101; bh=d4xHh/EUCkCOVmUiHgDNQoi2lFnlAt1QKWLdSYAR6Ls=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fttDkwpuNtykFY3q1TEAKKW4de/YNEP9wt/5JlUalFG8TbZf5IjT4dbClvmHXFayw RnVLuhkyIOW9GWAHQQbYxEqJepbRf5J+1H8bWyzqd/f+Sx9zvNVfkSwNounKSwujTI voIg0R+2CnEzIDDXzWSlL/o4qX2CJsyhBQSS1iIA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hacash Robot , William Dean , Miquel Raynal , Sasha Levin Subject: [PATCH 6.0 520/862] mtd: devices: docg3: check the return value of devm_ioremap() in the probe Date: Wed, 19 Oct 2022 10:30:07 +0200 Message-Id: <20221019083312.961891298@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108577751327963?= X-GMAIL-MSGID: =?utf-8?q?1747108577751327963?= From: William Dean [ Upstream commit 26e784433e6c65735cd6d93a8db52531970d9a60 ] The function devm_ioremap() in docg3_probe() can fail, so its return value should be checked. Fixes: 82402aeb8c81e ("mtd: docg3: Use devm_*() functions") Reported-by: Hacash Robot Signed-off-by: William Dean Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20220722091644.2937953-1-williamsukatube@163.com Signed-off-by: Sasha Levin --- drivers/mtd/devices/docg3.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/devices/docg3.c b/drivers/mtd/devices/docg3.c index 5b0ae5ddad74..27c08f22dec8 100644 --- a/drivers/mtd/devices/docg3.c +++ b/drivers/mtd/devices/docg3.c @@ -1974,9 +1974,14 @@ static int __init docg3_probe(struct platform_device *pdev) dev_err(dev, "No I/O memory resource defined\n"); return ret; } - base = devm_ioremap(dev, ress->start, DOC_IOSPACE_SIZE); ret = -ENOMEM; + base = devm_ioremap(dev, ress->start, DOC_IOSPACE_SIZE); + if (!base) { + dev_err(dev, "devm_ioremap dev failed\n"); + return ret; + } + cascade = devm_kcalloc(dev, DOC_MAX_NBFLOORS, sizeof(*cascade), GFP_KERNEL); if (!cascade) From patchwork Wed Oct 19 08: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: 4780 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp215756wrs; Wed, 19 Oct 2022 02:16:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5nvynJpp0ylypattXXb/BcbqBICDCa7GS+gPEWTPVAmkTca4Lh6soLzEDWz8HLzoHDUvIb X-Received: by 2002:a17:907:a40f:b0:790:540c:b6e3 with SMTP id sg15-20020a170907a40f00b00790540cb6e3mr5904723ejc.41.1666170995193; Wed, 19 Oct 2022 02:16:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170995; cv=none; d=google.com; s=arc-20160816; b=dQ6fvh6C/eha9BSw+fCcAAqwVF301DXIG+xpwBG9ttMy9gFkwM7b1HxYQXi4V5ISKc b8SKzJ9IHLqUkmsjeagGbZ3l/2MBWs6HdNB1pHP1IkqqCvxK0dfUB8cLSJFjcgnOsHyh vGQJc17ojK7C/BmnYBMjUuHLjovkChoZNyCzQpUhdsnPUqxZ0cEND0LqMs6RhZI3QdHt /JK03w85rMn+15tBH1IHWYrrIlprQYneqs3tna091SAuRhACP8lqhN8WAxWU30/d8p3W 9ZmBooC/zFsmBQeJbVz5s6/kS0j6BlqFfJamDb7K/VVisnOLApG0KlGskNTHttxKTrsh PBlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gtCFeexjlwRhakT+0LL2q9Zf7acWfPhVCCp5QrlWvps=; b=oFNTNYKU+BCuUxyIO+VdlD61odeyxZ2MHyJHF/aajJykTKdyNGcK652q1SVmbVXsIn UCTtUS0ODAwE47tQ2mJBnGIR0saIltC/46aJ0rOC2v2eYg1GHg0kKSPCHwzpyDBAXlC/ CKuxrQqwEPooQPOvHRHxOGyWFmLDFTPGIPHToJP36thDZdu+Y2daCrL282tgvcUy53GB UsYKAP13P+MyHdCy2ig86wKrg5rUAOzhaKzO2UrsULpb5qhAvd68oMGxmmqcXu+z3E45 2HGOvVDBcCPHrlK8GqxFX4N5Y7wVaHG9RpL2viaQnkYet61D6RBAf+F1LL467pCBF3Iu JsTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=foGm2pLt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i16-20020a50fc10000000b0045c26758001si12087349edr.539.2022.10.19.02.16.10; Wed, 19 Oct 2022 02:16: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=foGm2pLt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233050AbiJSJNn (ORCPT + 99 others); Wed, 19 Oct 2022 05:13:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232762AbiJSJLF (ORCPT ); Wed, 19 Oct 2022 05:11:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56CC44F3BD; Wed, 19 Oct 2022 02:02: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 27D0F6174B; Wed, 19 Oct 2022 09:02:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36041C433D7; Wed, 19 Oct 2022 09:02:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170130; bh=g4F35njtKClTm2AcWT7WheFUPbeErkcDnc/IAYofFMo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=foGm2pLti9XZRJ4JqtYG1VOz/T7vokLw2J0+2eGLBrd/0XBkUcjSw36R/jhHxIeAF 80R2s9MxOQQ8iXIZek2QqztJXQh5UYs6WqJfn2jy/VEDdNuTPKiFSkFpBvK1wWIVM6 R9A/gR+IIVFuKGQnXY3QGFLrdHkzpk4TFSg0/+sc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , "Gustavo A. R. Silva" , Mukesh Ojha , Mathieu Poirier , Sasha Levin Subject: [PATCH 6.0 521/862] remoteproc: Harden rproc_handle_vdev() against integer overflow Date: Wed, 19 Oct 2022 10:30:08 +0200 Message-Id: <20221019083313.006320760@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106917451960258?= X-GMAIL-MSGID: =?utf-8?q?1747106917451960258?= From: Dan Carpenter [ Upstream commit 7d7f8fe4e399519cc9ac68a475fec6d3a996341b ] The struct_size() macro protects against integer overflows but adding "+ rsc->config_len" introduces the risk of integer overflows again. Use size_add() to be safe. Fixes: c87846571587 ("remoteproc: use struct_size() helper") Signed-off-by: Dan Carpenter Reviewed-by: Gustavo A. R. Silva Reviewed-by: Mukesh Ojha Link: https://lore.kernel.org/r/YyMyoPoGOJUcEpZT@kili Signed-off-by: Mathieu Poirier Signed-off-by: Sasha Levin --- drivers/remoteproc/remoteproc_core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index e5279ed9a8d7..4fc5ce2187ac 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -520,12 +520,13 @@ static int rproc_handle_vdev(struct rproc *rproc, void *ptr, struct fw_rsc_vdev *rsc = ptr; struct device *dev = &rproc->dev; struct rproc_vdev *rvdev; + size_t rsc_size; int i, ret; char name[16]; /* make sure resource isn't truncated */ - if (struct_size(rsc, vring, rsc->num_of_vrings) + rsc->config_len > - avail) { + rsc_size = struct_size(rsc, vring, rsc->num_of_vrings); + if (size_add(rsc_size, rsc->config_len) > avail) { dev_err(dev, "vdev rsc is truncated\n"); return -EINVAL; } From patchwork Wed Oct 19 08: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: 4891 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225487wrs; Wed, 19 Oct 2022 02:43:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4QfjpclIDkSTzE5HeM1VnBmO6qq++ad0OOZ1ls7E68afmvLkjBi+LZJXGIWfJUZ1Bg10bK X-Received: by 2002:a17:906:eec1:b0:782:6384:76be with SMTP id wu1-20020a170906eec100b00782638476bemr5986155ejb.756.1666172596630; Wed, 19 Oct 2022 02:43:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172596; cv=none; d=google.com; s=arc-20160816; b=bsGiiJ9OlhO0f6sEplz6/Hl+9WFwPBlQ+Fyk3IJTOIK84QD5gXaBFVS53geCou7fQm B7bXwNxSZ9FeFEFmbKNAJ9nbxxdeT1uffm5VMTUkjeaVNjEiI4pP0cgcwRrDXLmzLZO1 bOI+g6063ImmWjbveq52GCu25j/IEOwsD5/eqxsmcmtaDOh9oy+i9XA219aBRggh8cqb ejSm5zOPFZspXz5/zxKv4RngFfVUZWUskHLFAt/VflXSVkorkvTsnaI92wb/4Q/ltQ/l VdDcRzM6VsD7DbVCmik8wUKNGs6XLdHT5tMca+ksPILriNKwtrCt7Tu9zFZ+EMRWP78v ZVUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=atcfmY/jmqQIDkqFn+2ogBecsN3vmqQGNqjD2GJ2Lhw=; b=GGbmBbQGb5TpeXnQaXYXMOkANprsQzTeM1eprveQ82nUCeNwFksDLfyaRY27HagkbG /XdYhgI5wl1YVId8Xlxaa79B4M+gIiHCXXfbfjtquvq+a2vIEkmHFNOG8UQ7rrJry2y8 G49wjD8tmd+HS5Zaoq4PbO8wOACCVVe8eXif3rBEtbum8K+1dfXN4nWDlYPYIsctMb1/ dnctkOE7UCRDnvnofA+RhKg6ge9+SIyQPnUHCttnPGaZJd/BzfL6tGDjFpDVASfr6Jmx 5sAcLHWFDuWVPTpe42nrU+R+RkqV7zimHgj3HQ/t7TqROpwTJBFAGXcaZ/NdO2aYyN1r RXZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RF7zIHnP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cf20-20020a170906b2d400b0078043d1e9fbsi10407395ejb.354.2022.10.19.02.42.50; Wed, 19 Oct 2022 02:43: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=RF7zIHnP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230355AbiJSJdr (ORCPT + 99 others); Wed, 19 Oct 2022 05:33:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233755AbiJSJ3T (ORCPT ); Wed, 19 Oct 2022 05:29:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31A5EE8AA6; Wed, 19 Oct 2022 02:12: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 dfw.source.kernel.org (Postfix) with ESMTPS id BB24961834; Wed, 19 Oct 2022 09:02:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA55CC433D6; Wed, 19 Oct 2022 09:02:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170159; bh=iNGubPr7HaKVgh+TiSU6p3K2AlZjj1CtChzrtePmDaE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RF7zIHnPT90lCwEsULcHIcX6s9xTrAZ9Ik1dafd+wBkmbnPuwW334QP1YHY+tgVJt NWpkdHDyY8yOyUo7R2t87FJFoZfBVQ3ExAbfxY6CZUiGpF1wXqHM0W2HJqmmFzMoCl 4l0rpWTs4hoaIxnrAa4K8UAZeDqHNXZ2oZ8474Mo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Dmitry Baryshkov , Vinod Koul , Sasha Levin Subject: [PATCH 6.0 522/862] phy: qcom-qmp-usb: disable runtime PM on unbind Date: Wed, 19 Oct 2022 10:30:09 +0200 Message-Id: <20221019083313.046819184@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108596775531852?= X-GMAIL-MSGID: =?utf-8?q?1747108596775531852?= From: Johan Hovold [ Upstream commit e57655e66806750785f9121c98a962404d02395b ] Make sure to disable runtime PM also on driver unbind. Fixes: ac0d239936bd ("phy: qcom-qmp: Add support for runtime PM"). Signed-off-by: Johan Hovold Reviewed-by: Dmitry Baryshkov Link: https://lore.kernel.org/r/20220907110728.19092-10-johan+linaro@kernel.org Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c index 1d270356a97f..1eb4ec576361 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c @@ -2704,7 +2704,9 @@ static int qcom_qmp_phy_usb_probe(struct platform_device *pdev) return -ENOMEM; pm_runtime_set_active(dev); - pm_runtime_enable(dev); + ret = devm_pm_runtime_enable(dev); + if (ret) + return ret; /* * Prevent runtime pm from being ON by default. Users can enable * it using power/control in sysfs. @@ -2738,13 +2740,10 @@ static int qcom_qmp_phy_usb_probe(struct platform_device *pdev) phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); if (!IS_ERR(phy_provider)) dev_info(dev, "Registered Qcom-QMP phy\n"); - else - pm_runtime_disable(dev); return PTR_ERR_OR_ZERO(phy_provider); err_node_put: - pm_runtime_disable(dev); of_node_put(child); return ret; } From patchwork Wed Oct 19 08: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: 4791 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp216112wrs; Wed, 19 Oct 2022 02:17:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6UEEn2CXm4pJYDqUKzP9zGzv/qIvMoquEm1NxfPWWIRBLuv8jMSrHSkJx5sXExa6uSIqIb X-Received: by 2002:a17:906:58c7:b0:722:f4bf:cb75 with SMTP id e7-20020a17090658c700b00722f4bfcb75mr5877259ejs.450.1666171054035; Wed, 19 Oct 2022 02:17:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666171054; cv=none; d=google.com; s=arc-20160816; b=k0W5oxFZ9n+iLeARMClyXGTmSnbkrrqoAvXGFq9NjV8+qIU/lCAgPGUnFxj8++yyVO DZWRrKXhx129pfvkPQlUT5e2MMPSar5u14NshJOP7IpopT3xVlg35QhAYKG64bF3enGU XQp6qEK0R07bQlN6Dt81SXH8TKXmWdM8BfXqWn3nl1sLP92o0EKNbypY0+QJcooF7pi9 hCrGw3byB3ogpK+EoP/ALNjH99z1xJTOzsnZOEE70xOkAWhImbX9i9f7A3DqlRBFW8uK Y1fm/ZJGuKjWnePMZEuZ287epWSZD/HI+HRuSWvE7s/qJf7KtPUNe84qphpd9IXABtT5 wR2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4KiRceZ59rkklgYNCVVQEjMNIndyAQ4MRWWQ/+sZYg8=; b=n5fOBb9iXFF/qjWgvHqitzo5Yft0EJuDhv37LrlO/i4PWfK8wIXrZUwWaaKSdaVkSr tt39hdJQ4vGLEOU8HPn+6i4U0/UBs9pM7pxQX2le3fICk3wHO94NHaQJGaNuYGRB8fQO xeSJ/vKquEKTs03gvLhIhZkaaIV/q1ZPviXPGK6R5Pq3xIYKF2YzBKYXlJLm9U2kSo0n y7IuX+o2oTw8uE4Yso/eQbaXSDGOqTAJsStWK6cj6Yb0CU2CFXG6ZhugsfT73l1BOckA SDdSKbOqqwpoeVEhiewRFM3dbx0nNZbZAWfp9ZtCQmBz1OXZ8ocX+pgpVTMh1BrFwEAa q+fQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OEJpbvj+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u26-20020aa7d99a000000b0045be16903d0si12522511eds.310.2022.10.19.02.17.08; Wed, 19 Oct 2022 02:17:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OEJpbvj+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233189AbiJSJQb (ORCPT + 99 others); Wed, 19 Oct 2022 05:16:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233083AbiJSJN5 (ORCPT ); Wed, 19 Oct 2022 05:13:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CF5CCA8AA; Wed, 19 Oct 2022 02:03: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 dfw.source.kernel.org (Postfix) with ESMTPS id 42F8061830; Wed, 19 Oct 2022 09:03:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A5B8C433C1; Wed, 19 Oct 2022 09:03:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170185; bh=g5t/hZ0fNgoFIR61nY0PEk2xBx40TJC1T+SjBz4tOpA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OEJpbvj+TINxNMVrA85WD5R1viaRMp4P3hZbmASu233gM7VTHhrzTpBnZxXJ0Kc2F NjWn3k2epMR1TYR+AiUC7783H7dFqOZykD0MCE4xY2tnlwjKRXcv2bp/UAtwE8qidA SfWjvtXCV7z/CfnSlFG0rJe4OJvD17E2MtA8KTjQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Vinod Koul , Sasha Levin Subject: [PATCH 6.0 523/862] phy: qcom-qmp-pcie: add pcs_misc sanity check Date: Wed, 19 Oct 2022 10:30:10 +0200 Message-Id: <20221019083313.087411998@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106978774625459?= X-GMAIL-MSGID: =?utf-8?q?1747106978774625459?= From: Johan Hovold [ Upstream commit ecd5507e72ea03659dc2cc3e4393fbf8f4e2e02a ] Make sure that the (otherwise) optional pcs_misc IO region has been provided in case the configuration specifies a corresponding initialisation table to avoid crashing with malformed device trees. Note that the related debug message is now superfluous as the region is only used when the configuration has a pcs_misc table. Fixes: 421c9a0e9731 ("phy: qcom: qmp: Add SDM845 PCIe QMP PHY support") Signed-off-by: Johan Hovold Link: https://lore.kernel.org/r/20220916102340.11520-2-johan+linaro@kernel.org Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/phy/qualcomm/phy-qcom-qmp-pcie.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c index 2d65e1f56bfc..0e0f2482827a 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c @@ -2371,8 +2371,10 @@ int qcom_qmp_phy_pcie_create(struct device *dev, struct device_node *np, int id, of_device_is_compatible(dev->of_node, "qcom,ipq6018-qmp-pcie-phy")) qphy->pcs_misc = qphy->pcs + 0x400; - if (!qphy->pcs_misc) - dev_vdbg(dev, "PHY pcs_misc-reg not used\n"); + if (!qphy->pcs_misc) { + if (cfg->pcs_misc_tbl || cfg->pcs_misc_tbl_sec) + return -EINVAL; + } snprintf(prop_name, sizeof(prop_name), "pipe%d", id); qphy->pipe_clk = devm_get_clk_from_child(dev, np, prop_name); From patchwork Wed Oct 19 08: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: 5304 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp283022wrs; Wed, 19 Oct 2022 05:04:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM748Txz/a44zx5FqldRD8JwSyZWKVlx2N0HHfmyqHs+A+Gl6CHEIizyoMZFnVRBMrPox9ab X-Received: by 2002:a05:6a00:1ca4:b0:562:daf9:6162 with SMTP id y36-20020a056a001ca400b00562daf96162mr8068443pfw.40.1666181038254; Wed, 19 Oct 2022 05:03:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666181038; cv=none; d=google.com; s=arc-20160816; b=G8DJTkb0Qaebo2GTfa3sGS2qqIP6gKQUv5vU3fXgH9LlvIwCzWQeJdhOp8SrQlmItL tqbH9d9w8jvUUvQvIHJAJ5ItctiFvRYHYuLRZPG+4jC6CEEq71nrsSqluMTPyKaWf+Un TgUSacqg0QeXYxB2Ji4mwmCHoVkRqWKAZWlVebdgK5qh9SQXhqnIPaF1U1MJIJFpC243 5wxGVgPaVvrkdw8YrpYjj2SqSCx2v40gj/EsY3fUiyXRTHob5qoLF7HBNFkAJuZunCzG cJT2BIu0brWrGdj1ioUndRz6+pTvHqa516RkDw+r7Eq9bH3w/+Mm9rgC5jTtZC8fSAt2 OblA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8/JIv6DE5lYz6XAI0b/D+D+cV6LTgDdb9jONJlX6t3I=; b=n/9EgCScCTkI0DyZBhFDLPpZorSFU60am0TRtnSk9jtNpz/zk6d6sPS29mvRq8rJ28 0vhYNNYO6j3qzxwOPNwAaqHcNg7jJ2XpWVUB2qIiU2iTF5VizBuEElUA+s4HT2DvfOmo w/UC8d2kfsu7ZGUeixqyWDx0n6goG/UzqNYMalsTiuyeLGCEmpiit6ucV1wmWsrFre4j rNenRVT4nQSWDkmqvE+9jK8PJ8A9yzYIO6bpHWZFXbKkq/Ccj0d0o53MiFaXmjxdSv5w oD1AQERT3n0XLxJPnC2IELtDkEDnDobQ6y9GzTOICvBfgQ0MoiffTf9VJkLWKQpgtVp8 PmRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uT6etYBr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a056a00174700b005660f2c4b27si19126815pfc.274.2022.10.19.05.03.44; Wed, 19 Oct 2022 05:03: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=uT6etYBr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232001AbiJSLzb (ORCPT + 99 others); Wed, 19 Oct 2022 07:55:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232300AbiJSLyy (ORCPT ); Wed, 19 Oct 2022 07:54: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 9C0CDF0E; Wed, 19 Oct 2022 04:33: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 sin.source.kernel.org (Postfix) with ESMTPS id 031D7CE2158; Wed, 19 Oct 2022 09:03:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E88C0C433D6; Wed, 19 Oct 2022 09:03:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170188; bh=yKJziEW283XpJTXlC22Huxwlr5z6BXBtoJ1k6n5TaWs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uT6etYBrfhUkdmLd3ReGPcAFzwVHg1E38D3udNuf6kngqkN3E6QdK7hc32yIN6j0r leQaVIpfSS9175ErM0h2tEfoBSDaD0SktC0wX2FxvTUJPZWSrVJfNgrgRupS9C434o 9TCi2DJNJ3efaOgOSfbX2bvaO4dHbSrXpAW0lCzI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Vinod Koul , Sasha Levin Subject: [PATCH 6.0 524/862] phy: qcom-qmp-pcie: fix memleak on probe deferral Date: Wed, 19 Oct 2022 10:30:11 +0200 Message-Id: <20221019083313.126741569@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747117448244771473?= X-GMAIL-MSGID: =?utf-8?q?1747117448244771473?= From: Johan Hovold [ Upstream commit 4be26f695ffa458b065b7942dbff9393bf0836ea ] Switch to using the device-managed of_iomap helper to avoid leaking memory on probe deferral and driver unbind. Note that this helper checks for already reserved regions and may fail if there are multiple devices claiming the same memory. Fixes: e78f3d15e115 ("phy: qcom-qmp: new qmp phy driver for qcom-chipsets") Signed-off-by: Johan Hovold Link: https://lore.kernel.org/r/20220916102340.11520-3-johan+linaro@kernel.org Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/phy/qualcomm/phy-qcom-qmp-pcie.c | 34 ++++++++++++------------ 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c index 0e0f2482827a..819bcd975ba4 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c @@ -2329,17 +2329,17 @@ int qcom_qmp_phy_pcie_create(struct device *dev, struct device_node *np, int id, * For dual lane PHYs: tx2 -> 3, rx2 -> 4, pcs_misc (optional) -> 5 * For single lane PHYs: pcs_misc (optional) -> 3. */ - qphy->tx = of_iomap(np, 0); - if (!qphy->tx) - return -ENOMEM; + qphy->tx = devm_of_iomap(dev, np, 0, NULL); + if (IS_ERR(qphy->tx)) + return PTR_ERR(qphy->tx); - qphy->rx = of_iomap(np, 1); - if (!qphy->rx) - return -ENOMEM; + qphy->rx = devm_of_iomap(dev, np, 1, NULL); + if (IS_ERR(qphy->rx)) + return PTR_ERR(qphy->rx); - qphy->pcs = of_iomap(np, 2); - if (!qphy->pcs) - return -ENOMEM; + qphy->pcs = devm_of_iomap(dev, np, 2, NULL); + if (IS_ERR(qphy->pcs)) + return PTR_ERR(qphy->pcs); /* * If this is a dual-lane PHY, then there should be registers for the @@ -2348,9 +2348,9 @@ int qcom_qmp_phy_pcie_create(struct device *dev, struct device_node *np, int id, * offset from the first lane. */ if (cfg->is_dual_lane_phy) { - qphy->tx2 = of_iomap(np, 3); - qphy->rx2 = of_iomap(np, 4); - if (!qphy->tx2 || !qphy->rx2) { + qphy->tx2 = devm_of_iomap(dev, np, 3, NULL); + qphy->rx2 = devm_of_iomap(dev, np, 4, NULL); + if (IS_ERR(qphy->tx2) || IS_ERR(qphy->rx2)) { dev_warn(dev, "Underspecified device tree, falling back to legacy register regions\n"); @@ -2360,20 +2360,20 @@ int qcom_qmp_phy_pcie_create(struct device *dev, struct device_node *np, int id, qphy->rx2 = qphy->rx + QMP_PHY_LEGACY_LANE_STRIDE; } else { - qphy->pcs_misc = of_iomap(np, 5); + qphy->pcs_misc = devm_of_iomap(dev, np, 5, NULL); } } else { - qphy->pcs_misc = of_iomap(np, 3); + qphy->pcs_misc = devm_of_iomap(dev, np, 3, NULL); } - if (!qphy->pcs_misc && + if (IS_ERR(qphy->pcs_misc) && of_device_is_compatible(dev->of_node, "qcom,ipq6018-qmp-pcie-phy")) qphy->pcs_misc = qphy->pcs + 0x400; - if (!qphy->pcs_misc) { + if (IS_ERR(qphy->pcs_misc)) { if (cfg->pcs_misc_tbl || cfg->pcs_misc_tbl_sec) - return -EINVAL; + return PTR_ERR(qphy->pcs_misc); } snprintf(prop_name, sizeof(prop_name), "pipe%d", id); From patchwork Wed Oct 19 08: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: 4790 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp216091wrs; Wed, 19 Oct 2022 02:17:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5NNLs3pbMIrlTHlQgyJZO7Lw3VTMyVm33bVfLz3ISDqGhph6eXTnb51BupXiyZux7BQXd3 X-Received: by 2002:a17:907:7e9e:b0:78d:f3b0:fc78 with SMTP id qb30-20020a1709077e9e00b0078df3b0fc78mr5937881ejc.478.1666171049955; Wed, 19 Oct 2022 02:17:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666171049; cv=none; d=google.com; s=arc-20160816; b=LvX1OZEy3PlQsfa+SGihhDSQ/o2XFS2ttBSMWAj2yPutFy8hs3seWck1Pu4V1Y8ct+ elxiBA1JTa6kr6zRH5xrVMEnO8JR/Q4xUaZBafWtN59nJ6oX/G2prajH5Mb0IXdwlvGV Bh/3CC2Lm+CMX+szlrk3uPOcUxu9F1kq8tD83K9AiuAnNvLshzEPJ67wDDCY2Rqbh701 JMKqJyb5EDu+fX5Hhymd+eMMjsZ8q/Y52ykZihxoBbeV8y/Ybd7QXjqN9Z1P0o5zvmc+ CKZwXnRFZ7d6PDLQ2lS6QnicMV2TeTWlRBvFWzNnkMRy24o73qdvV3tdL3Zs/YmG8Edk 8U5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7qAuQX/qSMOqVUhXDB0vuZkaTJ86NAuOpDexf/Vn4Ao=; b=cbhRjC4kN5LzRIbYXIalR231JecVLY5zyMF5OQOxmo5+guepAWuHuBitGBNChBII// iEvOg+JaFJvsdJhi6RF5OpeBAR5Iy2dpVRJ9cKzyV0TvXirsY/cPQ/g10UqaVIBKmtM/ 7a2jpbYCEnRqJwDMxxly6FdXYcp1lzae+nfmeLYEH61k9AXiFObGr6TmBzbjnN+xC3Da v73iDqq4P5/myQ3Z4cABmm1FkqeQrplN+Reqz0REWdOzlVTEij2+6ZBeXIAtABwdgwTZ 7/bRc5s+LsL4h28UqdWlfvdVhYFUTrkGvrYGno9VnLkcoXsXpTi4+WKarcPGtfxQz7+5 NYog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="moHj1Nj/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ti5-20020a170907c20500b007307fa2da78si10503192ejc.450.2022.10.19.02.17.03; Wed, 19 Oct 2022 02:17: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="moHj1Nj/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233181AbiJSJQZ (ORCPT + 99 others); Wed, 19 Oct 2022 05:16:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233088AbiJSJN5 (ORCPT ); Wed, 19 Oct 2022 05:13:57 -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 2D0D598CA0; Wed, 19 Oct 2022 02:03: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 A6402617E8; Wed, 19 Oct 2022 09:03:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F852C433C1; Wed, 19 Oct 2022 09:03:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170191; bh=frTwBlKI1wjhe+k/zVR0m4zNwhuMu0VCaVx17vlF2lg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=moHj1Nj//T/UWdMquIEvG1Cyfm0I7+ed9HnbmE+3r7/2mctXGfn/cpK4HJZ9/GkSi mm+vuD6DfWxmAS4Dh7BEEZ/goA9k3C1bAE4vP/5OAsrm2wi7teYjfgKuOc+9dA5Iwm nsxA06kib5s2mPWpWtKfyZwKth/hoxYDqnxKBPeI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Vinod Koul , Sasha Levin Subject: [PATCH 6.0 525/862] phy: qcom-qmp-pcie-msm8996: fix memleak on probe deferral Date: Wed, 19 Oct 2022 10:30:12 +0200 Message-Id: <20221019083313.175878033@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106974540444422?= X-GMAIL-MSGID: =?utf-8?q?1747106974540444422?= From: Johan Hovold [ Upstream commit 1f69ededf8e80c42352e7f1c165a003614de9cc2 ] Switch to using the device-managed of_iomap helper to avoid leaking memory on probe deferral and driver unbind. Note that this helper checks for already reserved regions and may fail if there are multiple devices claiming the same memory. Fixes: e78f3d15e115 ("phy: qcom-qmp: new qmp phy driver for qcom-chipsets") Signed-off-by: Johan Hovold Link: https://lore.kernel.org/r/20220916102340.11520-4-johan+linaro@kernel.org Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- .../phy/qualcomm/phy-qcom-qmp-pcie-msm8996.c | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-pcie-msm8996.c b/drivers/phy/qualcomm/phy-qcom-qmp-pcie-msm8996.c index be6a94439b6c..14ea4ae95861 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-pcie-msm8996.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-pcie-msm8996.c @@ -875,21 +875,20 @@ int qcom_qmp_phy_pcie_msm8996_create(struct device *dev, struct device_node *np, * For dual lane PHYs: tx2 -> 3, rx2 -> 4, pcs_misc (optional) -> 5 * For single lane PHYs: pcs_misc (optional) -> 3. */ - qphy->tx = of_iomap(np, 0); - if (!qphy->tx) - return -ENOMEM; - - qphy->rx = of_iomap(np, 1); - if (!qphy->rx) - return -ENOMEM; + qphy->tx = devm_of_iomap(dev, np, 0, NULL); + if (IS_ERR(qphy->tx)) + return PTR_ERR(qphy->tx); - qphy->pcs = of_iomap(np, 2); - if (!qphy->pcs) - return -ENOMEM; + qphy->rx = devm_of_iomap(dev, np, 1, NULL); + if (IS_ERR(qphy->rx)) + return PTR_ERR(qphy->rx); - qphy->pcs_misc = of_iomap(np, 3); + qphy->pcs = devm_of_iomap(dev, np, 2, NULL); + if (IS_ERR(qphy->pcs)) + return PTR_ERR(qphy->pcs); - if (!qphy->pcs_misc) + qphy->pcs_misc = devm_of_iomap(dev, np, 3, NULL); + if (IS_ERR(qphy->pcs_misc)) dev_vdbg(dev, "PHY pcs_misc-reg not used\n"); snprintf(prop_name, sizeof(prop_name), "pipe%d", id); From patchwork Wed Oct 19 08: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: 4799 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp216303wrs; Wed, 19 Oct 2022 02:18:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7UyHKtY4mxrELncUy6naBbIAvD1XbLeYsRr8SdQBz4OSqL8voyKclfX0fBXuDZrwdoSToD X-Received: by 2002:a05:6402:5211:b0:45d:131b:8dd7 with SMTP id s17-20020a056402521100b0045d131b8dd7mr6542631edd.93.1666171084823; Wed, 19 Oct 2022 02:18:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666171084; cv=none; d=google.com; s=arc-20160816; b=CSIR6cUT43mcvRPmXwIQh+5oshAGkpn4Ya8OA4H6MimqSaZ7k5XUVi59BL0PvbrUfA jPyszZuxZS6WK4kpgdAR+HfoWXS7Q4G1R3Lo1Mo6RjVBEpnaLsxle8H+nJMpkq0K4ckp S00hmDyoTP/hTU9p+6qGP8Srg9Uc6I8v2s0BAt8odNjtu1bTxDwzSgswdIY7DT3Xcpux X52gKOKuNXXAQgTTSEerMjrpEra+h+BriUAncicV2KbPoqigz5V98HJ+s748hgw8fLUT zRQ3upceoTbBk9KeNFP2zEwE7cXbyyMYQUCBEFjQ4MkSiysHavQ/9W82xh3IJUDWvWEB LtBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=O5Z5JqyGf1w2ISBZrEbDT+6vU84vLgZGOCsdFhhYYSg=; b=LYfQ6CqWc57gG9G4G5vbD1DhpVGYHyfaPxwtdTXuVJRvT1jTnqEV0fam8uie55kGBD FcKpBh6d4QpG9IgXKDhH+oA7L1nTzRuw/E6T6FIxAdPVwIL32iy8zdILgKh6Gw6HJYj4 O5XjT+la59cefmbWe3xCfwg069HpIdKZYsWLHEGcIqbtl4cT+s19NuOv+GUP38ipnqsY QTx3uP9YIuUfqs09+Z9EkuyIbqGCV6yKo2vUC63wnnDfOSCODPt4QQCfVyeAAdWezY7x vEjlDM1aiD0DbAHFwF/L2dRZDBTibpqLCbOX7Vibj45cml2j4cBZ4CsSic2v+LvDz2EX e3CQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="v/KIgXYx"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a17090797ca00b0078e20d9c473si9767965ejc.764.2022.10.19.02.17.40; Wed, 19 Oct 2022 02:18: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="v/KIgXYx"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232757AbiJSJQf (ORCPT + 99 others); Wed, 19 Oct 2022 05:16:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233103AbiJSJN7 (ORCPT ); Wed, 19 Oct 2022 05:13:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09367CF185; Wed, 19 Oct 2022 02:03: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 705F46181B; Wed, 19 Oct 2022 09:03:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82E2EC433D6; Wed, 19 Oct 2022 09:03:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170193; bh=cciPacl9eT/Q43v963/166drUbkyCCfGboVieuGeFvc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v/KIgXYxzYWLQfL4y91kDI/OroeY9ugZd02ZZLSLKlo+dWZdT+PuU4+meHX41Qk/W qSTVHTE8ZzSBd3AuHhGhv4f0P3DbEilwnYFhqC66C+DWhE/qmYHm1pT6fvB1sKOPDb bJOb0+0JA/gkI/xk89xIl2KFAtK2Y3sr4FZQnoNk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Vinod Koul , Sasha Levin Subject: [PATCH 6.0 526/862] phy: qcom-qmp-combo: fix memleak on probe deferral Date: Wed, 19 Oct 2022 10:30:13 +0200 Message-Id: <20221019083313.221255789@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747107011571977820?= X-GMAIL-MSGID: =?utf-8?q?1747107011571977820?= From: Johan Hovold [ Upstream commit 2de8a325b1084330ae500380cc27edc39f488c30 ] Switch to using the device-managed of_iomap helper to avoid leaking memory on probe deferral and driver unbind. Note that this helper checks for already reserved regions and may fail if there are multiple devices claiming the same memory. Fixes: e78f3d15e115 ("phy: qcom-qmp: new qmp phy driver for qcom-chipsets") Signed-off-by: Johan Hovold Link: https://lore.kernel.org/r/20220916102340.11520-5-johan+linaro@kernel.org Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 32 ++++++++++++----------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c index bbdca263058c..f089977c85bb 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c @@ -2350,17 +2350,17 @@ int qcom_qmp_phy_combo_create(struct device *dev, struct device_node *np, int id * For dual lane PHYs: tx2 -> 3, rx2 -> 4, pcs_misc (optional) -> 5 * For single lane PHYs: pcs_misc (optional) -> 3. */ - qphy->tx = of_iomap(np, 0); - if (!qphy->tx) - return -ENOMEM; + qphy->tx = devm_of_iomap(dev, np, 0, NULL); + if (IS_ERR(qphy->tx)) + return PTR_ERR(qphy->tx); - qphy->rx = of_iomap(np, 1); - if (!qphy->rx) - return -ENOMEM; + qphy->rx = devm_of_iomap(dev, np, 1, NULL); + if (IS_ERR(qphy->rx)) + return PTR_ERR(qphy->rx); - qphy->pcs = of_iomap(np, 2); - if (!qphy->pcs) - return -ENOMEM; + qphy->pcs = devm_of_iomap(dev, np, 2, NULL); + if (IS_ERR(qphy->pcs)) + return PTR_ERR(qphy->pcs); if (cfg->pcs_usb_offset) qphy->pcs_usb = qphy->pcs + cfg->pcs_usb_offset; @@ -2372,9 +2372,9 @@ int qcom_qmp_phy_combo_create(struct device *dev, struct device_node *np, int id * offset from the first lane. */ if (cfg->is_dual_lane_phy) { - qphy->tx2 = of_iomap(np, 3); - qphy->rx2 = of_iomap(np, 4); - if (!qphy->tx2 || !qphy->rx2) { + qphy->tx2 = devm_of_iomap(dev, np, 3, NULL); + qphy->rx2 = devm_of_iomap(dev, np, 4, NULL); + if (IS_ERR(qphy->tx2) || IS_ERR(qphy->rx2)) { dev_warn(dev, "Underspecified device tree, falling back to legacy register regions\n"); @@ -2384,15 +2384,17 @@ int qcom_qmp_phy_combo_create(struct device *dev, struct device_node *np, int id qphy->rx2 = qphy->rx + QMP_PHY_LEGACY_LANE_STRIDE; } else { - qphy->pcs_misc = of_iomap(np, 5); + qphy->pcs_misc = devm_of_iomap(dev, np, 5, NULL); } } else { - qphy->pcs_misc = of_iomap(np, 3); + qphy->pcs_misc = devm_of_iomap(dev, np, 3, NULL); } - if (!qphy->pcs_misc) + if (IS_ERR(qphy->pcs_misc)) { dev_vdbg(dev, "PHY pcs_misc-reg not used\n"); + qphy->pcs_misc = NULL; + } /* * Get PHY's Pipe clock, if any. USB3 and PCIe are PIPE3 From patchwork Wed Oct 19 08: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: 5445 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp327913wrs; Wed, 19 Oct 2022 06:30:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5KjjJAAfiY7WpQgkL0VhzR89gGqJHoGgjjupRycKKAL5+JDGpA9T5p+XoBB8TiG+QnDY1B X-Received: by 2002:a63:f47:0:b0:46a:e00c:24c7 with SMTP id 7-20020a630f47000000b0046ae00c24c7mr7371029pgp.239.1666186200115; Wed, 19 Oct 2022 06:30:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666186200; cv=none; d=google.com; s=arc-20160816; b=zJQLrwCC7xX1b12INsp4udov3IDVElnItMRfsAekhRsjWBf+375SFn2gJ3Fu7FuuDo IKbj9DgUkzKSMQaVV28dqlB6YTGzlKbDDlwhXZEjCooKVI4/3bNBTZFlQvS4CxCko8wv Ezt22EwEVUCmR5ayyPqvYAIZQKR1jruu8G9aksZPoJbbYsQCW2dQLQ4zXJc3LgUjaE9R urg2qDayrV7E0dVzBnEq/sTGpHhsfQIZs/swMYhoY7Oy3oXwR8lB84O+whQDEPD8ibfW 5DUPlnEs9bG8VBeppisSd5sTSB6sld/kNLYI+C9q8RGBbSygn37eF+Bs9STsRT3s4HdT JKFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=E3otRfKb5HElaw3EAbmXmiy9WKOpuByLAO/mJJYdhQk=; b=sUEt//2I3Y6Uw/KrXMevXlLzQUmFn69C1iKPjyKlz0bS3gE73IFu0jSiTPhsbXSSkN SoOOaEXzNrgN7FFIIEOBvAAfolbwGe9ntoRYnuY9jy6/7wbO8mgbss/w/tbK5O5bv1t2 Oaz72isZQ/8qsTaK+gIeWsTd+//I87fRctRc7uYj9OXV+kUoQNXflmNW8ehJ454tfkpt U0wfDzzDZa398emrps892WDAsjyN5x5Chnpgk6NzPNi1Q9TRq3Zihr7mCXTM0Xoai1gM Yak0QA4WYnApB6L5NreCp+XyrN3pU987jcpCOp695HbamRPvylDw7+KaB44+5EKmrwIx cIbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lpS+LnDj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ay12-20020a1709028b8c00b00178072335cbsi16928891plb.132.2022.10.19.06.29.46; Wed, 19 Oct 2022 06:30: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=lpS+LnDj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229920AbiJSNQ3 (ORCPT + 99 others); Wed, 19 Oct 2022 09:16:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232657AbiJSNPt (ORCPT ); Wed, 19 Oct 2022 09:15:49 -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 6E782DEA3; Wed, 19 Oct 2022 06:01:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9BB6AB82473; Wed, 19 Oct 2022 09:03:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D34EC433C1; Wed, 19 Oct 2022 09:03:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170196; bh=yOd+dCvGotr+0Lam7OWssr1UOPUUFI+5pHMnw++qGTk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lpS+LnDjnD8eMAdF4d69aALCqV+NpjE4O+1F4qEjpAeLB2FCl6LLCJtI1VRoNZApr ltQgN3+KDN4I8uwp88Z8Be9HK/sXnrXoDkQO+B6jnade0R5CMGXox6peSM7SzFV/aL 4FBvV3U4g2QsJwZnGGyXg6EQhZXMM+U7axVuhykc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Vinod Koul , Sasha Levin Subject: [PATCH 6.0 527/862] phy: qcom-qmp-ufs: fix memleak on probe deferral Date: Wed, 19 Oct 2022 10:30:14 +0200 Message-Id: <20221019083313.259607297@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747122861262059788?= X-GMAIL-MSGID: =?utf-8?q?1747122861262059788?= From: Johan Hovold [ Upstream commit ef74a97f0df8758efe4476b4645961286aa86f0d ] Switch to using the device-managed of_iomap helper to avoid leaking memory on probe deferral and driver unbind. Note that this helper checks for already reserved regions and may fail if there are multiple devices claiming the same memory. Fixes: e78f3d15e115 ("phy: qcom-qmp: new qmp phy driver for qcom-chipsets") Signed-off-by: Johan Hovold Link: https://lore.kernel.org/r/20220916102340.11520-6-johan+linaro@kernel.org Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/phy/qualcomm/phy-qcom-qmp-ufs.c | 30 ++++++++++++------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c b/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c index c8583f5a54bd..f586e5260856 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c @@ -1188,17 +1188,17 @@ int qcom_qmp_phy_ufs_create(struct device *dev, struct device_node *np, int id, * For dual lane PHYs: tx2 -> 3, rx2 -> 4, pcs_misc (optional) -> 5 * For single lane PHYs: pcs_misc (optional) -> 3. */ - qphy->tx = of_iomap(np, 0); - if (!qphy->tx) - return -ENOMEM; + qphy->tx = devm_of_iomap(dev, np, 0, NULL); + if (IS_ERR(qphy->tx)) + return PTR_ERR(qphy->tx); - qphy->rx = of_iomap(np, 1); - if (!qphy->rx) - return -ENOMEM; + qphy->rx = devm_of_iomap(dev, np, 1, NULL); + if (IS_ERR(qphy->rx)) + return PTR_ERR(qphy->rx); - qphy->pcs = of_iomap(np, 2); - if (!qphy->pcs) - return -ENOMEM; + qphy->pcs = devm_of_iomap(dev, np, 2, NULL); + if (IS_ERR(qphy->pcs)) + return PTR_ERR(qphy->pcs); /* * If this is a dual-lane PHY, then there should be registers for the @@ -1207,9 +1207,9 @@ int qcom_qmp_phy_ufs_create(struct device *dev, struct device_node *np, int id, * offset from the first lane. */ if (cfg->is_dual_lane_phy) { - qphy->tx2 = of_iomap(np, 3); - qphy->rx2 = of_iomap(np, 4); - if (!qphy->tx2 || !qphy->rx2) { + qphy->tx2 = devm_of_iomap(dev, np, 3, NULL); + qphy->rx2 = devm_of_iomap(dev, np, 4, NULL); + if (IS_ERR(qphy->tx2) || IS_ERR(qphy->rx2)) { dev_warn(dev, "Underspecified device tree, falling back to legacy register regions\n"); @@ -1219,14 +1219,14 @@ int qcom_qmp_phy_ufs_create(struct device *dev, struct device_node *np, int id, qphy->rx2 = qphy->rx + QMP_PHY_LEGACY_LANE_STRIDE; } else { - qphy->pcs_misc = of_iomap(np, 5); + qphy->pcs_misc = devm_of_iomap(dev, np, 5, NULL); } } else { - qphy->pcs_misc = of_iomap(np, 3); + qphy->pcs_misc = devm_of_iomap(dev, np, 3, NULL); } - if (!qphy->pcs_misc) + if (IS_ERR(qphy->pcs_misc)) dev_vdbg(dev, "PHY pcs_misc-reg not used\n"); generic_phy = devm_phy_create(dev, np, &qcom_qmp_ufs_ops); From patchwork Wed Oct 19 08: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: 4843 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223780wrs; Wed, 19 Oct 2022 02:38:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6xs6EUqz+fURWjDq2CyF6QF/AIkKA2WFmQRCamBM9SUdXBmgM7MheOkpRAO8RhMXPGM6+6 X-Received: by 2002:a17:902:a707:b0:178:bd1e:e8be with SMTP id w7-20020a170902a70700b00178bd1ee8bemr7466388plq.167.1666172307876; Wed, 19 Oct 2022 02:38:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172307; cv=none; d=google.com; s=arc-20160816; b=LvrpQf7FGyLooX4u+TqBmaNVOApybED9ilf1nsiVoyEC2yGXA8PmjF6hIgzl8PCek0 u5fteqLB9qaMqKRyyQV5S08NssmzES/xDydQkx7qPy81D1JpaqUu3IWZi1X+w+DoIfYA oiBVKcTgh26ooou2Y2Jmp95eNVKdXM3Ap75r7PcMoTXBshaHQ3Z078PgjiL9MqAIicNG khmkbi8ty2LnL/FADSh9Xv9T2GQZmzFKaGC3zFSnlmBWfZtgm4CT5NqggKdUePYjJ8H4 4pBuZnuRBZCxttm8BBSVJ/225Q1U+2P1D2cbP0Gt7XFgl+rlpyStanuTxAk6eVIb0+hF QQGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TDcLYGcGAZCv5z2b3pIG9y886fk70+uka9vclmDwfkM=; b=JHtNAAEUjRh0Jsk818o/0FkMvSLmM2ZGHpBhkSTmSD1iuQYfEBbFOZIHWpWK+aKfu4 oGZmhaeaHM/DVVd5CQqP2lFRfTX2+UYVVvFgUl+tPRxVWuIrS3iDPWSmY9i1crhyOKzx 2XAu3GVIHoZb8CoqdEpjlmuK9/Aro7MRlGR9LQocolME3pRlj6fhEbmRCBPRpcQXvQvH jfuwxP+LZCtVtrr6zyT66376Ra5YkXyAE5m4+SrBM7kC26YkLS90q2LSRKWVvjkMjeym mWczIbZEsvBPOnO/OQfa9ap5hLIb9BP3EQXAeCvE+V+4N+3Ow7PYPpJ3AhvJPmFNLdGM rJsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0TIR2ShH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d19-20020a170902e15300b00179e261e4f8si15375391pla.90.2022.10.19.02.38.14; Wed, 19 Oct 2022 02:38: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=0TIR2ShH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233268AbiJSJUX (ORCPT + 99 others); Wed, 19 Oct 2022 05:20:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233396AbiJSJTJ (ORCPT ); Wed, 19 Oct 2022 05:19:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6103289CC6; Wed, 19 Oct 2022 02:08:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9F7C26174B; Wed, 19 Oct 2022 09:03:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B43EFC433D7; Wed, 19 Oct 2022 09:03:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170199; bh=jqy8C+Kc3rOan3G2Kng9jfcs+w4MNPapy2AHnhT+17U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0TIR2ShH4eB2MRY7LKAQ/SJiEYSCBVw3TVBiyEtVbsaUDCMGe2DEhU5z7c4wOpXF7 NB0FCm9Cw4/HJcsu3FokC48KEhpK+w7YzNUxWt6XHQXotyXT4Ihy+rGDsX68x3aE3b 0RTpY694rQAxuZb23yhN2oF+ybH0f+fanY+pVZNA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Vinod Koul , Sasha Levin Subject: [PATCH 6.0 528/862] phy: qcom-qmp-usb: fix memleak on probe deferral Date: Wed, 19 Oct 2022 10:30:15 +0200 Message-Id: <20221019083313.304749902@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108293758295889?= X-GMAIL-MSGID: =?utf-8?q?1747108293758295889?= From: Johan Hovold [ Upstream commit a5d6b1ac56cbd6b5850a3a54e35f1cb71e8e8cdd ] Switch to using the device-managed of_iomap helper to avoid leaking memory on probe deferral and driver unbind. Note that this helper checks for already reserved regions and may fail if there are multiple devices claiming the same memory. Two bindings currently rely on overlapping mappings for the PCS region so fallback to non-exclusive mappings for those for now. Fixes: e78f3d15e115 ("phy: qcom-qmp: new qmp phy driver for qcom-chipsets") Signed-off-by: Johan Hovold Link: https://lore.kernel.org/r/20220916102340.11520-7-johan+linaro@kernel.org Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 61 +++++++++++++++++++++++--------- 1 file changed, 44 insertions(+), 17 deletions(-) --- a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c @@ -2489,6 +2489,21 @@ static const struct phy_ops qcom_qmp_phy .owner = THIS_MODULE, }; +static void __iomem *qmp_usb_iomap(struct device *dev, struct device_node *np, + int index, bool exclusive) +{ + struct resource res; + + if (!exclusive) { + if (of_address_to_resource(np, index, &res)) + return IOMEM_ERR_PTR(-EINVAL); + + return devm_ioremap(dev, res.start, resource_size(&res)); + } + + return devm_of_iomap(dev, np, index, NULL); +} + static int qcom_qmp_phy_usb_create(struct device *dev, struct device_node *np, int id, void __iomem *serdes, const struct qmp_phy_cfg *cfg) @@ -2497,8 +2512,18 @@ int qcom_qmp_phy_usb_create(struct devic struct phy *generic_phy; struct qmp_phy *qphy; char prop_name[MAX_PROP_NAME]; + bool exclusive = true; int ret; + /* + * FIXME: These bindings should be fixed to not rely on overlapping + * mappings for PCS. + */ + if (of_device_is_compatible(dev->of_node, "qcom,sdx65-qmp-usb3-uni-phy")) + exclusive = false; + if (of_device_is_compatible(dev->of_node, "qcom,sm8350-qmp-usb3-uni-phy")) + exclusive = false; + qphy = devm_kzalloc(dev, sizeof(*qphy), GFP_KERNEL); if (!qphy) return -ENOMEM; @@ -2511,17 +2536,17 @@ int qcom_qmp_phy_usb_create(struct devic * For dual lane PHYs: tx2 -> 3, rx2 -> 4, pcs_misc (optional) -> 5 * For single lane PHYs: pcs_misc (optional) -> 3. */ - qphy->tx = of_iomap(np, 0); - if (!qphy->tx) - return -ENOMEM; - - qphy->rx = of_iomap(np, 1); - if (!qphy->rx) - return -ENOMEM; - - qphy->pcs = of_iomap(np, 2); - if (!qphy->pcs) - return -ENOMEM; + qphy->tx = devm_of_iomap(dev, np, 0, NULL); + if (IS_ERR(qphy->tx)) + return PTR_ERR(qphy->tx); + + qphy->rx = devm_of_iomap(dev, np, 1, NULL); + if (IS_ERR(qphy->rx)) + return PTR_ERR(qphy->rx); + + qphy->pcs = qmp_usb_iomap(dev, np, 2, exclusive); + if (IS_ERR(qphy->pcs)) + return PTR_ERR(qphy->pcs); if (cfg->pcs_usb_offset) qphy->pcs_usb = qphy->pcs + cfg->pcs_usb_offset; @@ -2533,9 +2558,9 @@ int qcom_qmp_phy_usb_create(struct devic * offset from the first lane. */ if (cfg->is_dual_lane_phy) { - qphy->tx2 = of_iomap(np, 3); - qphy->rx2 = of_iomap(np, 4); - if (!qphy->tx2 || !qphy->rx2) { + qphy->tx2 = devm_of_iomap(dev, np, 3, NULL); + qphy->rx2 = devm_of_iomap(dev, np, 4, NULL); + if (IS_ERR(qphy->tx2) || IS_ERR(qphy->rx2)) { dev_warn(dev, "Underspecified device tree, falling back to legacy register regions\n"); @@ -2545,15 +2570,17 @@ int qcom_qmp_phy_usb_create(struct devic qphy->rx2 = qphy->rx + QMP_PHY_LEGACY_LANE_STRIDE; } else { - qphy->pcs_misc = of_iomap(np, 5); + qphy->pcs_misc = devm_of_iomap(dev, np, 5, NULL); } } else { - qphy->pcs_misc = of_iomap(np, 3); + qphy->pcs_misc = devm_of_iomap(dev, np, 3, NULL); } - if (!qphy->pcs_misc) + if (IS_ERR(qphy->pcs_misc)) { dev_vdbg(dev, "PHY pcs_misc-reg not used\n"); + qphy->pcs_misc = NULL; + } snprintf(prop_name, sizeof(prop_name), "pipe%d", id); qphy->pipe_clk = devm_get_clk_from_child(dev, np, prop_name); From patchwork Wed Oct 19 08: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: 5503 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp336270wrs; Wed, 19 Oct 2022 06:46:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6raiMGD0SOzXcLQrGKqd9EDZ7hODDtMKqrtmsb1q9JIaSCQX7utFWW7T6UVHakLwBeuHhw X-Received: by 2002:a17:90a:6484:b0:210:f17b:f465 with SMTP id h4-20020a17090a648400b00210f17bf465mr79861pjj.241.1666187204638; Wed, 19 Oct 2022 06:46:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666187204; cv=none; d=google.com; s=arc-20160816; b=V/fk2A2NJKBBOEjB3Bh72xeYZ6xNvIzPIDIORl+e89oA3f7unUceHvyUurhXfe4uNP FPk2aYAj53EnWRsI79hosXQ49zg2t56oNmPDre9kO7JkLEw+SviRmR2ZUxKRpqPVFUZw RCWl8ozDD18ZK5aCEKAcarRNqhmByel7ySkyJkUdtqW0hippsr9zszSehmnB/ym8GPmD BWXb9sZ+5qEF1mPO1GRVy4MvIQCzDAnV0C5AC1myxW2y3xy91XAe8AZ+7hJ+VT8DqN1y Wmuqfipjy0Iuv95hylg01hwV65n1Rklk2+8pHT+3+/+yiv0UrK/lxsCnaYuTfnPUh3BD LGMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=b+5GxKKMva9AUUqwKXre1iUt58LUAQDxqegFIE1qj5s=; b=nvESkozRGqex7XT7tJAszL0bxfa9B6vfJWCu6164dAyoegYrk8pTHrkrQxCbvRyHEv W2/RGRPbNdn7WMG/VAivB3LsAt9WDg7UDNRVIj/jnufFpi/TVOvWTkwGM85iMf5C1b3o 76AZjePtTak0V3Ia631QS5m70z4aaddu64+PAJvnuVtLYBqOJjpBCqwNwbqyht3NXvwx phmRIqXfU5UPSrC4UIkrXLySeKDAmkCC4pHGtt8ip/VwNG6lCTBwDO8KDdJvLOGzt07c heI8xjkK/Fr34qcm4fty+ItVdEEol8ayhB3DSFEE1r1Qlj8F6ZG8R29gwWbPCqQIMrbi 094Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=U6WVDF4J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y8-20020aa78f28000000b0055fdb74973esi17548364pfr.140.2022.10.19.06.46.31; Wed, 19 Oct 2022 06:46: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=U6WVDF4J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233299AbiJSNqP (ORCPT + 99 others); Wed, 19 Oct 2022 09:46:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233010AbiJSNpX (ORCPT ); Wed, 19 Oct 2022 09:45:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0774C50B85; Wed, 19 Oct 2022 06:31: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 78D84B82462; Wed, 19 Oct 2022 09:01:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E064CC433D6; Wed, 19 Oct 2022 09:01:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170104; bh=mPVjszT3wboNXS/Hfwq1BXiLQmXtBUP5WVrK5S+6wHQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U6WVDF4JAfd97fahQq/QVZCoIlp/ldOlDsKF+047d7ky6rb/fqbmGCDMaiabWG3GQ youAk436nVIEDKnwRt7zqM1XdvbdesKu7WYQjxY6LtR7N85mXM4nzarL5ntzMPcbhm rUBqyKoMY//PPG8gVExj99EzwEm2vHtYgk2L9D/s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Vinod Koul , Sasha Levin Subject: [PATCH 6.0 529/862] phy: amlogic: phy-meson-axg-mipi-pcie-analog: Hold reference returned by of_get_parent() Date: Wed, 19 Oct 2022 10:30:16 +0200 Message-Id: <20221019083313.347306560@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123914449959202?= X-GMAIL-MSGID: =?utf-8?q?1747123914449959202?= From: Liang He [ Upstream commit c4c349be07aeec5f397a349046dc5fc0f2657691 ] As the of_get_parent() will increase the refcount of the node->parent and the reference will be discarded, so we should hold the reference with which we can decrease the refcount when done. Fixes: 8eff8b4e22d9 ("phy: amlogic: phy-meson-axg-mipi-pcie-analog: add support for MIPI DSI analog") Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220915093506.4009456-1-windhl@126.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/phy/amlogic/phy-meson-axg-mipi-pcie-analog.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/phy/amlogic/phy-meson-axg-mipi-pcie-analog.c b/drivers/phy/amlogic/phy-meson-axg-mipi-pcie-analog.c index 1027ece6ca12..a3e1108b736d 100644 --- a/drivers/phy/amlogic/phy-meson-axg-mipi-pcie-analog.c +++ b/drivers/phy/amlogic/phy-meson-axg-mipi-pcie-analog.c @@ -197,7 +197,7 @@ static int phy_axg_mipi_pcie_analog_probe(struct platform_device *pdev) struct phy_provider *phy; struct device *dev = &pdev->dev; struct phy_axg_mipi_pcie_analog_priv *priv; - struct device_node *np = dev->of_node; + struct device_node *np = dev->of_node, *parent_np; struct regmap *map; int ret; @@ -206,7 +206,9 @@ static int phy_axg_mipi_pcie_analog_probe(struct platform_device *pdev) return -ENOMEM; /* Get the hhi system controller node */ - map = syscon_node_to_regmap(of_get_parent(dev->of_node)); + parent_np = of_get_parent(dev->of_node); + map = syscon_node_to_regmap(parent_np); + of_node_put(parent_np); if (IS_ERR(map)) { dev_err(dev, "failed to get HHI regmap\n"); From patchwork Wed Oct 19 08: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: 4904 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225421wrs; Wed, 19 Oct 2022 02:43:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7FfiWg8XBHJPd2oSGj/K35SYCkUdbqpmyPO5CAyH8VBpPrRTZVvRYbD8z284DrpE9WPq+E X-Received: by 2002:a17:906:794b:b0:790:2dc7:3115 with SMTP id l11-20020a170906794b00b007902dc73115mr6024891ejo.3.1666172587986; Wed, 19 Oct 2022 02:43:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172587; cv=none; d=google.com; s=arc-20160816; b=Nyrxbfufn9xfGXheWNa3MQVkpMq0GsA0AjCuCZjVWNArTrJSQiMlW6rKOo/KtG7GnP JQUbCRpQQDIXDw5907wENcKIfiW/ISA9Tm9EBphKDaCwnOT2/P84YCZtHfimvVwNwPUn 8a4aRK7YGPjsmxXv133Y3B6znJQg1PedUP/SrhbheZEyYOmml6tJSjzaYNHGI2O7ad0P suv/YI7Y5mFkPNfxSKbMD3P/zgVnRe9dHf1U4FhjSBeVZi9oCzdytwrSh4m5t1ElDrVi JcKUks6vC8VRYDCAw/3KrQPJcZ1X8EObc4h7TQzli/cjzTdxxfipSR7W97xJ0+zQnPct HmGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=cCN4ryWoc/Wc2GzjGDNwJlDAbUrfOv18RRlOtznM2AA=; b=bbNmBVHv7mQi8JuM1f5XW6KIoBwFEAYD14wz1Kg31mf6ZxK0UFyk56vmE83URK+h5A PBPuAQEEt1VCD0EYXuWqGilMPMHg1PN7cLGyomJTXdPLBah5t0rzsdeXJrhTspGVmVrb ZVZjti96sGO45afW37emfvMbqI6S9n3iFGSM4LhzEw2YEdxB+W7FsS0Hh6yjqSyppMU3 QzqydTDIZoWJfFF86ccV20wJskq//TE47sPXziOh8Ecrth6Ee4wm5oVqqDHSV3mfyBmI +VLc6WdqM3/G+H8ULZ4P1OYFTMET3m9YwcR5rB9UM2hPL3kQpbKkOaOnuRrBIbFOgRjw OgVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OmxlNoVj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a05640240d400b0045cef1f1f70si14127251edb.548.2022.10.19.02.42.43; Wed, 19 Oct 2022 02:43: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=OmxlNoVj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233841AbiJSJdE (ORCPT + 99 others); Wed, 19 Oct 2022 05:33:04 -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 S233691AbiJSJ3G (ORCPT ); Wed, 19 Oct 2022 05:29:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87539EA358; Wed, 19 Oct 2022 02:12: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 68869617ED; Wed, 19 Oct 2022 09:01:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7FA75C433C1; Wed, 19 Oct 2022 09:01:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170106; bh=joD3mbfUiz/qsnrMG3CKx0XowThncKwMs1kwZheyZHE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OmxlNoVj7HMfBkaxiC+XB4zwnrjTHIXmLizEld/t9F03A0hCSyuS0WqGKVhAOKlPj 0qKJNOn68zIz9Dl/bClqfqLrkFnyOl2/nDjzJR87e24S4EACk6Qa9Nq8KLIHaSjC5v E1yHJoSXC0OlwcdJsb5o6Zxs/1aIQcvp3CxIb83Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chunfeng Yun , AngeloGioacchino Del Regno , Vinod Koul , Sasha Levin Subject: [PATCH 6.0 530/862] phy: phy-mtk-tphy: fix the phy type setting issue Date: Wed, 19 Oct 2022 10:30:17 +0200 Message-Id: <20221019083313.391172232@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108587270003837?= X-GMAIL-MSGID: =?utf-8?q?1747108587270003837?= From: Chunfeng Yun [ Upstream commit 931c05a8cb1be029ef2fbc1e4af313d4cb297c47 ] The PHY type is not set if the index is non zero, prepare type value according to the index, like as mask value. Fixes: 39099a443358 ("phy: phy-mtk-tphy: support type switch by pericfg") Signed-off-by: Chunfeng Yun Reviewed-by: AngeloGioacchino Del Regno Link: https://lore.kernel.org/r/20220914060746.10004-7-chunfeng.yun@mediatek.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/phy/mediatek/phy-mtk-tphy.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c b/drivers/phy/mediatek/phy-mtk-tphy.c index 8ee7682b8e93..bdffc21858f6 100644 --- a/drivers/phy/mediatek/phy-mtk-tphy.c +++ b/drivers/phy/mediatek/phy-mtk-tphy.c @@ -906,7 +906,7 @@ static int phy_type_syscon_get(struct mtk_phy_instance *instance, static int phy_type_set(struct mtk_phy_instance *instance) { int type; - u32 mask; + u32 offset; if (!instance->type_sw) return 0; @@ -929,8 +929,9 @@ static int phy_type_set(struct mtk_phy_instance *instance) return 0; } - mask = RG_PHY_SW_TYPE << (instance->type_sw_index * BITS_PER_BYTE); - regmap_update_bits(instance->type_sw, instance->type_sw_reg, mask, type); + offset = instance->type_sw_index * BITS_PER_BYTE; + regmap_update_bits(instance->type_sw, instance->type_sw_reg, + RG_PHY_SW_TYPE << offset, type << offset); return 0; } From patchwork Wed Oct 19 08: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: 4773 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp215654wrs; Wed, 19 Oct 2022 02:16:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6TJ6trxujUtdJ0+a/oVm2hYmGURVirapi1G8yn3I/5kXmBALjUrsw3d9dXk0HszWThc1tK X-Received: by 2002:a05:6402:84d:b0:454:f41d:6ccf with SMTP id b13-20020a056402084d00b00454f41d6ccfmr6503338edz.129.1666170976649; Wed, 19 Oct 2022 02:16:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170976; cv=none; d=google.com; s=arc-20160816; b=KeNGBfygV9H+xUKn8YsyGx544CwvIgOcmCI1v9d1RM5gaedjYrT5Ttl3hfVFnhbALJ 1bdsxNaKdGIaT05fSwicvjWxIHFtIA4bdbF3nJmqWhiNa1wovfIDMpdk7/fiZ90IISkB Oj2EOmqUndYCr+YufapLXztvwf5r1ofjTbebqWbiy95A0iqb0UxsxhDoszyk/xmPNVmh /GWOC/xAsnEL3NnFyA8NTRY9umQX13IwBmwmnFqSS5IF5GCLT8SeHjvn9W6cMQNlvm1F ExMatwGt1PzBbbX6IpGLd1YsJIA+0ZqPgM5TtZQwaAq/UUW20TWDW1gsU6GvvU5nu8qB +1eQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=cpMcjDTV9x8uURe/ZNs17adrE3pPe29XLOyQVuyJoNE=; b=wgLkZk230gSP1Zl13qgCA56i2sCryGMQn2AENvlyvIRfcWCBS/rInERW6o5BsckSVS /+b1dL5wCdsJWj7jrjM3etzamaGfQTRp2gWj3mS83ekYDHX6nLoDWrlKfmK+MuAaNLO+ 1fcZjSznvbqaBNQFCrzj2cESXaswMsmveICPoAHsoX7wsfxGaK1yt/7hSqpukKO4QvpW Y6ulqNhVyFshNNSZFEQeGfXwmt/8syBnelCSgEN9prHLnKB/1wK3J9fE0GWrODF8wq76 ghA++7pw6JKEbahrvTMqgC4V5L8ruey7JJZsaVKXgpudOjqKbhyKk+w5FQeg/1a+8CVJ 1YFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=afXWtY6q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sd17-20020a1709076e1100b0078e11b38986si13201621ejc.873.2022.10.19.02.15.52; Wed, 19 Oct 2022 02:16: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=afXWtY6q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232726AbiJSJND (ORCPT + 99 others); Wed, 19 Oct 2022 05:13:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233174AbiJSJKX (ORCPT ); Wed, 19 Oct 2022 05:10:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D34DDC2C84; Wed, 19 Oct 2022 02:02:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0660361812; Wed, 19 Oct 2022 09:01:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1779FC433C1; Wed, 19 Oct 2022 09:01:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170109; bh=9BePWnK8/VkHjNuHRA8V9IPoLddrvuN0dJOkG015dOo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=afXWtY6qf1rZFVu2HRRiI9t0s4NQe4T3vYOogZj4cnRJ1V0pYvM8s9VcXSsJxdkc4 dskyf6bXlgqmmlvNV8r50TWzZl8fcfl2m3W+ZFNLSp15eivUvXz5nV74tzKmN+K2DQ BmI9IzAIWsobDRbwMseZQhKc2fHB8Qp3D4N8Arsk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Martin Blumenstingl , Miquel Raynal , Sasha Levin Subject: [PATCH 6.0 531/862] mtd: rawnand: intel: Read the chip-select line from the correct OF node Date: Wed, 19 Oct 2022 10:30:18 +0200 Message-Id: <20221019083313.433614250@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106898078198380?= X-GMAIL-MSGID: =?utf-8?q?1747106898078198380?= From: Martin Blumenstingl [ Upstream commit bfc618fcc3f167ad082053e81e9d664e724c6288 ] The chip select has to be read from the flash node which is a child node of the NAND controller. Fixes: 0b1039f016e8a3 ("mtd: rawnand: Add NAND controller support on Intel LGM SoC") Signed-off-by: Martin Blumenstingl Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20220702231227.1579176-4-martin.blumenstingl@googlemail.com Signed-off-by: Sasha Levin --- drivers/mtd/nand/raw/intel-nand-controller.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/nand/raw/intel-nand-controller.c b/drivers/mtd/nand/raw/intel-nand-controller.c index e91b879b32bd..3df3f32423f9 100644 --- a/drivers/mtd/nand/raw/intel-nand-controller.c +++ b/drivers/mtd/nand/raw/intel-nand-controller.c @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -580,6 +581,7 @@ static int ebu_nand_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct ebu_nand_controller *ebu_host; + struct device_node *chip_np; struct nand_chip *nand; struct mtd_info *mtd; struct resource *res; @@ -604,7 +606,12 @@ static int ebu_nand_probe(struct platform_device *pdev) if (IS_ERR(ebu_host->hsnand)) return PTR_ERR(ebu_host->hsnand); - ret = device_property_read_u32(dev, "reg", &cs); + chip_np = of_get_next_child(dev->of_node, NULL); + if (!chip_np) + return dev_err_probe(dev, -EINVAL, + "Could not find child node for the NAND chip\n"); + + ret = of_property_read_u32(chip_np, "reg", &cs); if (ret) { dev_err(dev, "failed to get chip select: %d\n", ret); return ret; @@ -660,7 +667,7 @@ static int ebu_nand_probe(struct platform_device *pdev) writel(ebu_host->cs[cs].addr_sel | EBU_ADDR_MASK(5) | EBU_ADDR_SEL_REGEN, ebu_host->ebu + EBU_ADDR_SEL(cs)); - nand_set_flash_node(&ebu_host->chip, dev->of_node); + nand_set_flash_node(&ebu_host->chip, chip_np); mtd = nand_to_mtd(&ebu_host->chip); if (!mtd->name) { From patchwork Wed Oct 19 08: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: 5500 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp336157wrs; Wed, 19 Oct 2022 06:46:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM70v+DOQU8WPJWDgwjSOlpTYWW/Xb4PPV0P6s1ygABxK7ziC2cCwR6mBD++2NDfg5W/oS4N X-Received: by 2002:a17:902:f549:b0:185:3b98:380f with SMTP id h9-20020a170902f54900b001853b98380fmr8569457plf.36.1666187189973; Wed, 19 Oct 2022 06:46:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666187189; cv=none; d=google.com; s=arc-20160816; b=U37asjfa8KoRZJTFXtf1717UbNnKyYz3//bG9tzfd/LTP/flMSCTwlT8z2iZQidkKC w4ukqdv8igAh5MgdGGMCD/uVtwcGUIUS2ExtdNyoJpQwy4AnObfTN9mzIbCqpdc4t1c5 et2CvbBKIfssbG4eUZSlE0kJpXOdpk8ncotd1P++wdFFLaYbTeAQTzD+p9Sr1NgCG+GM XkrbJxeXOJ6IM4MbbDJ3o8fvQo4pQ+0/UPqycNY3PiGHK/vStsZbVNGVHd+8Pg/aFEHs iujuTQtASGV4ryGHESDJfdKtd4Gy0a1hYQ7s2+LEVXkflxXyIjUPo4R4mWknDKCFbPYD +oTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=cstszvTH+x0VbidHtB7mmVeReYCiuZlP3o1Ahlyj3N0=; b=EYNBTd/NUszcMf/ZmEwNACrcrVNEudhP9GAEDrY2sZ3X9QdglyP6obu2fBnUzSDFfx Cz7z2py2PullNYTpmkZSGEmpoHDwZMqXfmNheMllA5x7SbQYmlCBm6Yv6A7NRWs8rsvi SeEVZF83oik/2UPHMPksgi+eATu6j6ofbBwoyT9axqRS9bgBdBr2oD9y+dCywgOIEZ6s eUo4hmeoxcqlWraKNdkcX5UkNT/ukPASajEny4FkKN9S4DyeKq3ZT5NEh4ldJgr7WrlF F8BZHf0NNgvMsK/LVco+K95pRWpSQ7gPI0FkL/5vdUnNL9uX8QVfXyHWN4maWbJ/UzgL BCUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OQYROfui; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f23-20020a17090aa79700b0020b07bfc54esi21847297pjq.108.2022.10.19.06.46.16; Wed, 19 Oct 2022 06:46: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=OQYROfui; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233244AbiJSNp4 (ORCPT + 99 others); Wed, 19 Oct 2022 09:45:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232005AbiJSNoh (ORCPT ); Wed, 19 Oct 2022 09:44:37 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06F951C132; Wed, 19 Oct 2022 06:31: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 54C55B82466; Wed, 19 Oct 2022 09:01:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3AEFC433D6; Wed, 19 Oct 2022 09:01:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170112; bh=qv6GhL++iCfHg3FVW2VZhiZ6RiB16PZ7hQc1kPHkqT8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OQYROfuitNQw0M8h4m7sDosudH74budUPUpXOoU9EwFOpP1au8M/kHLM5ATf62P/2 mzpbBrHdmbeGHe81I413fBuXLMUrjZks5tD9a009++zWgqCzFz54Bk2IQrI5/PKIjp qsUGwassOWohVkDSEHJs5PeTZJYzEPAImvR7JYTo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Martin Blumenstingl , Miquel Raynal , Sasha Levin Subject: [PATCH 6.0 532/862] mtd: rawnand: intel: Remove undocumented compatible string Date: Wed, 19 Oct 2022 10:30:19 +0200 Message-Id: <20221019083313.466632967@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123899107796601?= X-GMAIL-MSGID: =?utf-8?q?1747123899107796601?= From: Martin Blumenstingl [ Upstream commit 68c02ebaa34d41063ccbbc789a352537ddc3cd8a ] The "intel,nand-controller" compatible string is not part of the dt-bindings. Remove it from the driver as it's not supposed to be used without any documentation for it. Fixes: 0b1039f016e8a3 ("mtd: rawnand: Add NAND controller support on Intel LGM SoC") Signed-off-by: Martin Blumenstingl Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20220702231227.1579176-5-martin.blumenstingl@googlemail.com Signed-off-by: Sasha Levin --- drivers/mtd/nand/raw/intel-nand-controller.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/mtd/nand/raw/intel-nand-controller.c b/drivers/mtd/nand/raw/intel-nand-controller.c index 3df3f32423f9..056835fd4562 100644 --- a/drivers/mtd/nand/raw/intel-nand-controller.c +++ b/drivers/mtd/nand/raw/intel-nand-controller.c @@ -723,7 +723,6 @@ static int ebu_nand_remove(struct platform_device *pdev) } static const struct of_device_id ebu_nand_match[] = { - { .compatible = "intel,nand-controller" }, { .compatible = "intel,lgm-ebunand" }, {} }; From patchwork Wed Oct 19 08:30:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5515 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp336872wrs; Wed, 19 Oct 2022 06:47:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM50q1YGGwjbXT5gAjGfelrUxxT9KzLrtTQhd5ShKTFzDsk4aV2Lv7S8mfxWMF9EPeZt8SmO X-Received: by 2002:a17:902:e88e:b0:183:dcb7:c4fc with SMTP id w14-20020a170902e88e00b00183dcb7c4fcmr8326411plg.32.1666187277482; Wed, 19 Oct 2022 06:47:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666187277; cv=none; d=google.com; s=arc-20160816; b=LqWYdt62DpxM6vEbiQ4t5uGoZJFhp3r5ur9FbkVhuGAw/i5xZ5F8RkpiAd0d0wyBjx BLQAxHIRmq95BY1afvMvP2+iVC15tJRksyoQ65pin5veOZf/vgBfHQgiMfVy0KR3CAJU 8bvSlPgg/+AKiKkWMxz6XzrUqbhsxSVkwbnhgxg3J9hZPt8RyK9PXrAFdfv0WbXzZEau wxaX1pgLgGsS8GvrvJ7j/0HCE33EceCPSrsoNX8myDPbpjJOSZahdH/+dag/BzcNJPRr sprKbEl35LNBZ8nZ03Gu1vvYVDh/lS+GtnmJSNyspu9PkEUUqG8NPO9V51S2GMav79CV i/gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Ogp5IC53I/2HrgAV8Jz/BBsPe8LoVHks+gjNFQThP1Y=; b=mLyXJ+irY2akAtYuUm29++/qMujbBWPWQkjw21blvVuJzcCMeaMLElqTl7xrTme2a3 ym1L8Ea0eXB4O/S3g/s0Bms9jsKdT8s8UhjgECjiKdw+NxMqWvSJck0B1/vjg23vJXV8 CJnnR3M6JeSZdDo1Blih2M47AFL4oPAMvBxwlkEhqcUOmwPj+/h6l4y5cGFdbBzJAy+n sJkwMtEyi0AV7ONAz9ChQ+WuhdXWPRBOYkHHbGhafkd+2S2hDWNg8HRsvYsunGpkpEq6 dPV6TT3gy05DGDJ1dSS+x3emuKPDfeHWjito0rdQnK9PecPatNPGPKbV6GqJcYDDx/WD 0taQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kERbWqww; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t2-20020a170902d20200b0017a09cc694dsi16685247ply.561.2022.10.19.06.47.44; Wed, 19 Oct 2022 06:47: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=kERbWqww; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233508AbiJSNr0 (ORCPT + 99 others); Wed, 19 Oct 2022 09:47:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233278AbiJSNqK (ORCPT ); Wed, 19 Oct 2022 09:46:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8B13172526; Wed, 19 Oct 2022 06:32: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 C949BB82463; Wed, 19 Oct 2022 09:01:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A976C433C1; Wed, 19 Oct 2022 09:01:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170114; bh=WFVjG+q3vUFosN6VOG2U+vIcJlTIVoQCqEg0IL9VlxE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kERbWqwwcTkz3i8HhvfM0lAxhU7YjgZVpnV+lyAqRHW5zCf2DRRI8msmpeqeV6xHT 5B4+9cDOc8b90Wg/P47p9T4vDIRfEdMxJS55CHlDXsqwYsU6IibutKBGx+80Gfr2p0 UBGpN2fQ3B0kz0CNfHyS5VBfxrLebd9exWrENJfA= 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?= , =?utf-8?q?Marek_Beh=C3=BAn?= , Miquel Raynal , Sasha Levin Subject: [PATCH 6.0 533/862] mtd: rawnand: fsl_elbc: Fix none ECC mode Date: Wed, 19 Oct 2022 10:30:20 +0200 Message-Id: <20221019083313.518818027@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123990903751555?= X-GMAIL-MSGID: =?utf-8?q?1747123990903751555?= From: Pali Rohár [ Upstream commit 049e43b9fd8fd2966940485da163d67e96ee3fea ] Commit f6424c22aa36 ("mtd: rawnand: fsl_elbc: Make SW ECC work") added support for specifying ECC mode via DTS and skipping autodetection. But it broke explicit specification of HW ECC mode in DTS as correct settings for HW ECC mode are applied only when NONE mode or nothing was specified in DTS file. Also it started aliasing NONE mode to be same as when ECC mode was not specified and disallowed usage of ON_DIE mode. Fix all these issues. Use autodetection of ECC mode only in case when mode was really not specified in DTS file by checking that ecc value is invalid. Set HW ECC settings either when HW ECC was specified in DTS or it was autodetected. And do not fail when ON_DIE mode is set. Fixes: f6424c22aa36 ("mtd: rawnand: fsl_elbc: Make SW ECC work") Signed-off-by: Pali Rohár Reviewed-by: Marek Behún Reviewed-by: Marek Behún Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20220707184328.3845-1-pali@kernel.org Signed-off-by: Sasha Levin --- drivers/mtd/nand/raw/fsl_elbc_nand.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/drivers/mtd/nand/raw/fsl_elbc_nand.c b/drivers/mtd/nand/raw/fsl_elbc_nand.c index aab93b9e6052..a18d121396aa 100644 --- a/drivers/mtd/nand/raw/fsl_elbc_nand.c +++ b/drivers/mtd/nand/raw/fsl_elbc_nand.c @@ -726,36 +726,40 @@ static int fsl_elbc_attach_chip(struct nand_chip *chip) struct fsl_lbc_regs __iomem *lbc = ctrl->regs; unsigned int al; - switch (chip->ecc.engine_type) { /* * if ECC was not chosen in DT, decide whether to use HW or SW ECC from * CS Base Register */ - case NAND_ECC_ENGINE_TYPE_NONE: + if (chip->ecc.engine_type == NAND_ECC_ENGINE_TYPE_INVALID) { /* If CS Base Register selects full hardware ECC then use it */ if ((in_be32(&lbc->bank[priv->bank].br) & BR_DECC) == BR_DECC_CHK_GEN) { - chip->ecc.read_page = fsl_elbc_read_page; - chip->ecc.write_page = fsl_elbc_write_page; - chip->ecc.write_subpage = fsl_elbc_write_subpage; - chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST; - mtd_set_ooblayout(mtd, &fsl_elbc_ooblayout_ops); - chip->ecc.size = 512; - chip->ecc.bytes = 3; - chip->ecc.strength = 1; } else { /* otherwise fall back to default software ECC */ chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_SOFT; chip->ecc.algo = NAND_ECC_ALGO_HAMMING; } + } + + switch (chip->ecc.engine_type) { + /* if HW ECC was chosen, setup ecc and oob layout */ + case NAND_ECC_ENGINE_TYPE_ON_HOST: + chip->ecc.read_page = fsl_elbc_read_page; + chip->ecc.write_page = fsl_elbc_write_page; + chip->ecc.write_subpage = fsl_elbc_write_subpage; + mtd_set_ooblayout(mtd, &fsl_elbc_ooblayout_ops); + chip->ecc.size = 512; + chip->ecc.bytes = 3; + chip->ecc.strength = 1; break; - /* if SW ECC was chosen in DT, we do not need to set anything here */ + /* if none or SW ECC was chosen, we do not need to set anything here */ + case NAND_ECC_ENGINE_TYPE_NONE: case NAND_ECC_ENGINE_TYPE_SOFT: + case NAND_ECC_ENGINE_TYPE_ON_DIE: break; - /* should we also implement *_ECC_ENGINE_CONTROLLER to do as above? */ default: return -EINVAL; } From patchwork Wed Oct 19 08: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: 4777 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp215687wrs; Wed, 19 Oct 2022 02:16:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4lqPWuYbEkDrhqIuPX+QiFvX1U1nVQ4AzLzS10pPZrT+91f3RpwrgJnEazbXCn/hSZl20I X-Received: by 2002:a17:907:2723:b0:78e:214b:e3c7 with SMTP id d3-20020a170907272300b0078e214be3c7mr6042924ejl.186.1666170982324; Wed, 19 Oct 2022 02:16:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170982; cv=none; d=google.com; s=arc-20160816; b=0jnfGicYGHNAYiZvEJYq2spiMH4PtOBNdXzUDISRpii2986W1J3oMBOVfoIstGQQFU x9wCozkdvQbmDnwsjxZTImRH1Sdqi7zAqNPfXDk8s79hlEmk6N4fpNZ0ZivCIBkNm+iO 5w2KIcuZ7xFsWGflzWLbI26Nl/1WRrtRB8rkv3lv7lAVUoXbPSFYJdo2ZgsRsSDXScui ZNWtiIHk3FAfEAZFlPxEAmRaW9bzViEyded2AXdB/C9jkwVTErwapy6C4pjyDRWzmhIU RX8kHzzYgMHV2p2UE/y9n6o7JuWQu7dd4G95w2Goux33UdwzXohFh0MY97BrF0sX4DAZ yXVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UVmWaGhexKQs+8xTPull2BSPj8XWyGzQRgXbLWG2cEk=; b=EyMyLP3Nh6YIEhovONsz4I+Z8FjhmaYxJximyt/S3Wi/4FFayqFfX3/PnfJ4OuWIbs yLEbd+xuQ1H6lTqm8x1AkG/dcRA1ltI/81xahJW4Ae/j9al7yFrx0wGhhh69E6j4Q3Tr BW+zotDHGbFCj72wtj3W+ty33ui5+dFL8P7+sm6ncaOIlm33hxT+Si+TgwwrPiC8XTZK uE01vP9G/fB4FJehk/BXBZU3c/hcW1q8jwaFBarE6/zKXOd0uzOB8EEJAILkHaB9eERl QcaC8g68QfFojFucYL0IpnBYyIr77XEiV2WGSmOgqselcs+QZ/2/+HyfpGow3/gNR4Nm 8Q0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ao2oqN5h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u21-20020aa7d895000000b004569899e0bcsi11975534edq.138.2022.10.19.02.15.57; Wed, 19 Oct 2022 02:16:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ao2oqN5h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232785AbiJSJNU (ORCPT + 99 others); Wed, 19 Oct 2022 05:13:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233237AbiJSJKb (ORCPT ); Wed, 19 Oct 2022 05:10:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26E73C45BF; Wed, 19 Oct 2022 02:02:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F1E3F61750; Wed, 19 Oct 2022 09:01:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F1F57C433B5; Wed, 19 Oct 2022 09:01:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170117; bh=JJO7GEfi2VMChMr1CkuDIHQS2nIxPA4+VM1CS/P0ccY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ao2oqN5hQ5mK5EQ1S9q2Qr5moF7H6+iRVhiNIe5xW82oqchSeSFDY2aX0hOKMHlqC bJyhusnt57WNxdtDjXqLzDVfjBAEsuBa2I4B0lY2CkVMzwN2RiJ35g/LODIpOlwxaK xIg++XhGwWJDL47DAn+82fHvxtkTYIicQby1YWlc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sindhu-Devale , Shiraz Saleem , Leon Romanovsky , Sasha Levin Subject: [PATCH 6.0 534/862] RDMA/irdma: Align AE id codes to correct flush code and event Date: Wed, 19 Oct 2022 10:30:21 +0200 Message-Id: <20221019083313.559358791@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106903848881427?= X-GMAIL-MSGID: =?utf-8?q?1747106903848881427?= From: Sindhu-Devale [ Upstream commit 7f51a961f8c6b84752a48e950074a8c4a0808d91 ] A number of asynchronous event (AE) ids were not aligned to the correct flush_code and event_type. Fix these up so that the correct IBV error and event codes are returned to application. Also, add handling for new AE ids like IRDMA_AE_INVALID_REQUEST to return the correct WC error code. Fixes: 44d9e52977a1 ("RDMA/irdma: Implement device initialization definitions") Signed-off-by: Sindhu-Devale Signed-off-by: Shiraz Saleem Link: https://lore.kernel.org/r/20220907191324.1173-2-shiraz.saleem@intel.com Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin --- drivers/infiniband/hw/irdma/defs.h | 1 + drivers/infiniband/hw/irdma/hw.c | 51 +++++++++++++++++------------ drivers/infiniband/hw/irdma/type.h | 1 + drivers/infiniband/hw/irdma/user.h | 1 + drivers/infiniband/hw/irdma/utils.c | 3 ++ drivers/infiniband/hw/irdma/verbs.c | 2 ++ 6 files changed, 38 insertions(+), 21 deletions(-) diff --git a/drivers/infiniband/hw/irdma/defs.h b/drivers/infiniband/hw/irdma/defs.h index e03e03082a5f..c1906cab5c8a 100644 --- a/drivers/infiniband/hw/irdma/defs.h +++ b/drivers/infiniband/hw/irdma/defs.h @@ -314,6 +314,7 @@ enum irdma_cqp_op_type { #define IRDMA_AE_IB_REMOTE_ACCESS_ERROR 0x020d #define IRDMA_AE_IB_REMOTE_OP_ERROR 0x020e #define IRDMA_AE_WQE_LSMM_TOO_LONG 0x0220 +#define IRDMA_AE_INVALID_REQUEST 0x0223 #define IRDMA_AE_DDP_INVALID_MSN_GAP_IN_MSN 0x0301 #define IRDMA_AE_DDP_UBE_DDP_MESSAGE_TOO_LONG_FOR_AVAILABLE_BUFFER 0x0303 #define IRDMA_AE_DDP_UBE_INVALID_DDP_VERSION 0x0304 diff --git a/drivers/infiniband/hw/irdma/hw.c b/drivers/infiniband/hw/irdma/hw.c index 4f132c6fb653..ab246447520b 100644 --- a/drivers/infiniband/hw/irdma/hw.c +++ b/drivers/infiniband/hw/irdma/hw.c @@ -138,59 +138,68 @@ static void irdma_set_flush_fields(struct irdma_sc_qp *qp, qp->event_type = IRDMA_QP_EVENT_CATASTROPHIC; switch (info->ae_id) { - case IRDMA_AE_AMP_UNALLOCATED_STAG: case IRDMA_AE_AMP_BOUNDS_VIOLATION: case IRDMA_AE_AMP_INVALID_STAG: - qp->event_type = IRDMA_QP_EVENT_ACCESS_ERR; - fallthrough; + case IRDMA_AE_AMP_RIGHTS_VIOLATION: + case IRDMA_AE_AMP_UNALLOCATED_STAG: case IRDMA_AE_AMP_BAD_PD: - case IRDMA_AE_UDA_XMIT_BAD_PD: + case IRDMA_AE_AMP_BAD_QP: + case IRDMA_AE_AMP_BAD_STAG_KEY: + case IRDMA_AE_AMP_BAD_STAG_INDEX: + case IRDMA_AE_AMP_TO_WRAP: + case IRDMA_AE_PRIV_OPERATION_DENIED: qp->flush_code = FLUSH_PROT_ERR; + qp->event_type = IRDMA_QP_EVENT_ACCESS_ERR; break; - case IRDMA_AE_AMP_BAD_QP: + case IRDMA_AE_UDA_XMIT_BAD_PD: case IRDMA_AE_WQE_UNEXPECTED_OPCODE: qp->flush_code = FLUSH_LOC_QP_OP_ERR; + qp->event_type = IRDMA_QP_EVENT_CATASTROPHIC; + break; + case IRDMA_AE_UDA_XMIT_DGRAM_TOO_LONG: + case IRDMA_AE_UDA_XMIT_DGRAM_TOO_SHORT: + case IRDMA_AE_UDA_L4LEN_INVALID: + case IRDMA_AE_DDP_UBE_INVALID_MO: + case IRDMA_AE_DDP_UBE_DDP_MESSAGE_TOO_LONG_FOR_AVAILABLE_BUFFER: + qp->flush_code = FLUSH_LOC_LEN_ERR; + qp->event_type = IRDMA_QP_EVENT_CATASTROPHIC; break; - case IRDMA_AE_AMP_BAD_STAG_KEY: - case IRDMA_AE_AMP_BAD_STAG_INDEX: - case IRDMA_AE_AMP_TO_WRAP: - case IRDMA_AE_AMP_RIGHTS_VIOLATION: case IRDMA_AE_AMP_INVALIDATE_NO_REMOTE_ACCESS_RIGHTS: - case IRDMA_AE_PRIV_OPERATION_DENIED: - case IRDMA_AE_IB_INVALID_REQUEST: case IRDMA_AE_IB_REMOTE_ACCESS_ERROR: qp->flush_code = FLUSH_REM_ACCESS_ERR; qp->event_type = IRDMA_QP_EVENT_ACCESS_ERR; break; case IRDMA_AE_LLP_SEGMENT_TOO_SMALL: - case IRDMA_AE_DDP_UBE_DDP_MESSAGE_TOO_LONG_FOR_AVAILABLE_BUFFER: - case IRDMA_AE_UDA_XMIT_DGRAM_TOO_LONG: - case IRDMA_AE_UDA_XMIT_DGRAM_TOO_SHORT: - case IRDMA_AE_UDA_L4LEN_INVALID: + case IRDMA_AE_LLP_RECEIVED_MPA_CRC_ERROR: case IRDMA_AE_ROCE_RSP_LENGTH_ERROR: - qp->flush_code = FLUSH_LOC_LEN_ERR; + case IRDMA_AE_IB_REMOTE_OP_ERROR: + qp->flush_code = FLUSH_REM_OP_ERR; + qp->event_type = IRDMA_QP_EVENT_CATASTROPHIC; break; case IRDMA_AE_LCE_QP_CATASTROPHIC: qp->flush_code = FLUSH_FATAL_ERR; + qp->event_type = IRDMA_QP_EVENT_CATASTROPHIC; break; - case IRDMA_AE_DDP_UBE_INVALID_MO: case IRDMA_AE_IB_RREQ_AND_Q1_FULL: - case IRDMA_AE_LLP_RECEIVED_MPA_CRC_ERROR: qp->flush_code = FLUSH_GENERAL_ERR; break; case IRDMA_AE_LLP_TOO_MANY_RETRIES: qp->flush_code = FLUSH_RETRY_EXC_ERR; + qp->event_type = IRDMA_QP_EVENT_CATASTROPHIC; break; case IRDMA_AE_AMP_MWBIND_INVALID_RIGHTS: case IRDMA_AE_AMP_MWBIND_BIND_DISABLED: case IRDMA_AE_AMP_MWBIND_INVALID_BOUNDS: qp->flush_code = FLUSH_MW_BIND_ERR; + qp->event_type = IRDMA_QP_EVENT_ACCESS_ERR; break; - case IRDMA_AE_IB_REMOTE_OP_ERROR: - qp->flush_code = FLUSH_REM_OP_ERR; + case IRDMA_AE_IB_INVALID_REQUEST: + qp->flush_code = FLUSH_REM_INV_REQ_ERR; + qp->event_type = IRDMA_QP_EVENT_REQ_ERR; break; default: - qp->flush_code = FLUSH_FATAL_ERR; + qp->flush_code = FLUSH_GENERAL_ERR; + qp->event_type = IRDMA_QP_EVENT_CATASTROPHIC; break; } } diff --git a/drivers/infiniband/hw/irdma/type.h b/drivers/infiniband/hw/irdma/type.h index 9e7b8ecb137a..517d41a1c289 100644 --- a/drivers/infiniband/hw/irdma/type.h +++ b/drivers/infiniband/hw/irdma/type.h @@ -98,6 +98,7 @@ enum irdma_term_mpa_errors { enum irdma_qp_event_type { IRDMA_QP_EVENT_CATASTROPHIC, IRDMA_QP_EVENT_ACCESS_ERR, + IRDMA_QP_EVENT_REQ_ERR, }; enum irdma_hw_stats_index_32b { diff --git a/drivers/infiniband/hw/irdma/user.h b/drivers/infiniband/hw/irdma/user.h index ddd0ebbdd7d5..2ef61923c926 100644 --- a/drivers/infiniband/hw/irdma/user.h +++ b/drivers/infiniband/hw/irdma/user.h @@ -103,6 +103,7 @@ enum irdma_flush_opcode { FLUSH_FATAL_ERR, FLUSH_RETRY_EXC_ERR, FLUSH_MW_BIND_ERR, + FLUSH_REM_INV_REQ_ERR, }; enum irdma_cmpl_status { diff --git a/drivers/infiniband/hw/irdma/utils.c b/drivers/infiniband/hw/irdma/utils.c index 075defaabee5..8dfc9e154d73 100644 --- a/drivers/infiniband/hw/irdma/utils.c +++ b/drivers/infiniband/hw/irdma/utils.c @@ -2479,6 +2479,9 @@ void irdma_ib_qp_event(struct irdma_qp *iwqp, enum irdma_qp_event_type event) case IRDMA_QP_EVENT_ACCESS_ERR: ibevent.event = IB_EVENT_QP_ACCESS_ERR; break; + case IRDMA_QP_EVENT_REQ_ERR: + ibevent.event = IB_EVENT_QP_REQ_ERR; + break; } ibevent.device = iwqp->ibqp.device; ibevent.element.qp = &iwqp->ibqp; diff --git a/drivers/infiniband/hw/irdma/verbs.c b/drivers/infiniband/hw/irdma/verbs.c index 9b207f5084eb..6f07a913ef88 100644 --- a/drivers/infiniband/hw/irdma/verbs.c +++ b/drivers/infiniband/hw/irdma/verbs.c @@ -3315,6 +3315,8 @@ static enum ib_wc_status irdma_flush_err_to_ib_wc_status(enum irdma_flush_opcode return IB_WC_RETRY_EXC_ERR; case FLUSH_MW_BIND_ERR: return IB_WC_MW_BIND_ERR; + case FLUSH_REM_INV_REQ_ERR: + return IB_WC_REM_INV_REQ_ERR; case FLUSH_FATAL_ERR: default: return IB_WC_FATAL_ERR; From patchwork Wed Oct 19 08:30:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5529 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp337656wrs; Wed, 19 Oct 2022 06:49:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM55Mmua+kC+eVQXZV7IX60ie5z7F/G6h+NlIr6JhYxj/mJ15XMH+AG6AonQPQxIPC1fQjnB X-Received: by 2002:a05:6a00:22d1:b0:562:5d7d:5588 with SMTP id f17-20020a056a0022d100b005625d7d5588mr8619476pfj.58.1666187396396; Wed, 19 Oct 2022 06:49:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666187396; cv=none; d=google.com; s=arc-20160816; b=rHpI+zdh21eLWpOXYJdVjEs4mdF1yrm0UJLEYYeV8WhOIJVyR8BEj8HiRAbrqS5oKI GH3D36ej0qK6wXhfZ0E60n947Cra7bp+F1ooHnXhMRuVzkvDWCmCFBTKyNb+F+zxDIk8 OrNg0MqIXjlf+liYdmxWqN3JGwSYiivwnP6sE+iugMdMegKTMdH+oUW7gnaDZe19FKtM 2KhwslJrErAoR4Kn5D99F3DQ42YT1S+cTDAuAcuvoYyvMpNhn7nJpc1e7Pkr78AtVAH7 qQC5mIaFdnRXG4ks5KrG63mnR7+HQzUHyC0kUx0KemWpBTXB4dH22ro6Kgll1Hby9Al/ RAnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=24DUYPA8wWmJJ4bELW3zJcyFDm/vpvKDs6p78w3ga94=; b=fV53FaAdBgvClt0wjC0NnGrCngsppaF1nrucqEPqWvmxrRQHr5fZotn5wBjIPAcj8F /QVU8bRLYw8l0iQKSb7alVMR/IZMd1GaXhfIpVNIFH6mk4C11qLdaIjMQ2cd459hgcoZ DcI8TsiD/9j9WePUhjp2vkTaVbkzR/b6PCkgvJaQF+DU0zOmTpMXihSv2KWLeuJZPh50 12jFC7YOBqx+UNO7GhqgVLq/x+rOmmGF0zJw/61/bsICK0m4SqMtcaqsqK/WRv/4jkre 2i+PjjcCTjSBJMRXYI2U6kUadzTiRbpst/aJcKXyQnHT9QHkn7TntPl9UrQJPio9+yVK mMGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DrI4cuCV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j12-20020a170903024c00b001787f199d85si22396824plh.54.2022.10.19.06.49.43; Wed, 19 Oct 2022 06:49: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=DrI4cuCV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233507AbiJSNst (ORCPT + 99 others); Wed, 19 Oct 2022 09:48:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233491AbiJSNrS (ORCPT ); Wed, 19 Oct 2022 09:47:18 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCE5DE8A80; Wed, 19 Oct 2022 06:32: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 463BAB8245B; Wed, 19 Oct 2022 09:02:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9DD2CC433D6; Wed, 19 Oct 2022 09:01:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170120; bh=B9OXRxYm/Rh3Qqarh2RqipaamNVnRGmhXltBMzQXJ+M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DrI4cuCVxeN/BzdyrEFHp8az87uMH1GPmItijjskqOl3nzFA/N/Rbst+/mKDKWTtW 4PVNGy8wt7RecGMHOGngC2/MwqQ7X4SDOKdL+I2Mb1Wuz/MsXEd4k9kgkKHY7DkHzE 7Plc1JUE+CCUidFjtF9aAg9I3clld27X57trB0ts= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Shiraz Saleem , Leon Romanovsky , Sasha Levin Subject: [PATCH 6.0 535/862] RDMA/irdma: Validate udata inlen and outlen Date: Wed, 19 Oct 2022 10:30:22 +0200 Message-Id: <20221019083313.599857915@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747124115331875047?= X-GMAIL-MSGID: =?utf-8?q?1747124115331875047?= From: Shiraz Saleem [ Upstream commit 34acb833cc83bdea912a160ff99b537e62bb4cf3 ] Currently ib_copy_from_udata and ib_copy_to_udata could underfill the request and response buffer if the user-space passes an undersized value for udata->inlen or udata->outlen respectively [1] This could lead to undesirable behavior. Zero initing the buffer only goes as far as preventing using the buffer uninitialized. Validate udata->inlen and udata->outlen passed from user-space to ensure they are at least the required minimum size. [1] https://lore.kernel.org/linux-rdma/MWHPR11MB0029F37D40D9D4A993F8F549E9D79@MWHPR11MB0029.namprd11.prod.outlook.com/ Fixes: b48c24c2d710 ("RDMA/irdma: Implement device supported verb APIs") Reported-by: Dan Carpenter Signed-off-by: Shiraz Saleem Link: https://lore.kernel.org/r/20220907191324.1173-3-shiraz.saleem@intel.com Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin --- drivers/infiniband/hw/irdma/verbs.c | 67 ++++++++++++++++++++++++++--- 1 file changed, 60 insertions(+), 7 deletions(-) diff --git a/drivers/infiniband/hw/irdma/verbs.c b/drivers/infiniband/hw/irdma/verbs.c index 6f07a913ef88..a22afbb25bc5 100644 --- a/drivers/infiniband/hw/irdma/verbs.c +++ b/drivers/infiniband/hw/irdma/verbs.c @@ -299,13 +299,19 @@ static void irdma_alloc_push_page(struct irdma_qp *iwqp) static int irdma_alloc_ucontext(struct ib_ucontext *uctx, struct ib_udata *udata) { +#define IRDMA_ALLOC_UCTX_MIN_REQ_LEN offsetofend(struct irdma_alloc_ucontext_req, rsvd8) +#define IRDMA_ALLOC_UCTX_MIN_RESP_LEN offsetofend(struct irdma_alloc_ucontext_resp, rsvd) struct ib_device *ibdev = uctx->device; struct irdma_device *iwdev = to_iwdev(ibdev); - struct irdma_alloc_ucontext_req req; + struct irdma_alloc_ucontext_req req = {}; struct irdma_alloc_ucontext_resp uresp = {}; struct irdma_ucontext *ucontext = to_ucontext(uctx); struct irdma_uk_attrs *uk_attrs; + if (udata->inlen < IRDMA_ALLOC_UCTX_MIN_REQ_LEN || + udata->outlen < IRDMA_ALLOC_UCTX_MIN_RESP_LEN) + return -EINVAL; + if (ib_copy_from_udata(&req, udata, min(sizeof(req), udata->inlen))) return -EINVAL; @@ -317,7 +323,7 @@ static int irdma_alloc_ucontext(struct ib_ucontext *uctx, uk_attrs = &iwdev->rf->sc_dev.hw_attrs.uk_attrs; /* GEN_1 legacy support with libi40iw */ - if (udata->outlen < sizeof(uresp)) { + if (udata->outlen == IRDMA_ALLOC_UCTX_MIN_RESP_LEN) { if (uk_attrs->hw_rev != IRDMA_GEN_1) return -EOPNOTSUPP; @@ -389,6 +395,7 @@ static void irdma_dealloc_ucontext(struct ib_ucontext *context) */ static int irdma_alloc_pd(struct ib_pd *pd, struct ib_udata *udata) { +#define IRDMA_ALLOC_PD_MIN_RESP_LEN offsetofend(struct irdma_alloc_pd_resp, rsvd) struct irdma_pd *iwpd = to_iwpd(pd); struct irdma_device *iwdev = to_iwdev(pd->device); struct irdma_sc_dev *dev = &iwdev->rf->sc_dev; @@ -398,6 +405,9 @@ static int irdma_alloc_pd(struct ib_pd *pd, struct ib_udata *udata) u32 pd_id = 0; int err; + if (udata && udata->outlen < IRDMA_ALLOC_PD_MIN_RESP_LEN) + return -EINVAL; + err = irdma_alloc_rsrc(rf, rf->allocated_pds, rf->max_pd, &pd_id, &rf->next_pd); if (err) @@ -814,12 +824,14 @@ static int irdma_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *init_attr, struct ib_udata *udata) { +#define IRDMA_CREATE_QP_MIN_REQ_LEN offsetofend(struct irdma_create_qp_req, user_compl_ctx) +#define IRDMA_CREATE_QP_MIN_RESP_LEN offsetofend(struct irdma_create_qp_resp, rsvd) struct ib_pd *ibpd = ibqp->pd; struct irdma_pd *iwpd = to_iwpd(ibpd); struct irdma_device *iwdev = to_iwdev(ibpd->device); struct irdma_pci_f *rf = iwdev->rf; struct irdma_qp *iwqp = to_iwqp(ibqp); - struct irdma_create_qp_req req; + struct irdma_create_qp_req req = {}; struct irdma_create_qp_resp uresp = {}; u32 qp_num = 0; int err_code; @@ -836,6 +848,10 @@ static int irdma_create_qp(struct ib_qp *ibqp, if (err_code) return err_code; + if (udata && (udata->inlen < IRDMA_CREATE_QP_MIN_REQ_LEN || + udata->outlen < IRDMA_CREATE_QP_MIN_RESP_LEN)) + return -EINVAL; + sq_size = init_attr->cap.max_send_wr; rq_size = init_attr->cap.max_recv_wr; @@ -1120,6 +1136,8 @@ static int irdma_query_pkey(struct ib_device *ibdev, u32 port, u16 index, int irdma_modify_qp_roce(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask, struct ib_udata *udata) { +#define IRDMA_MODIFY_QP_MIN_REQ_LEN offsetofend(struct irdma_modify_qp_req, rq_flush) +#define IRDMA_MODIFY_QP_MIN_RESP_LEN offsetofend(struct irdma_modify_qp_resp, push_valid) struct irdma_pd *iwpd = to_iwpd(ibqp->pd); struct irdma_qp *iwqp = to_iwqp(ibqp); struct irdma_device *iwdev = iwqp->iwdev; @@ -1138,6 +1156,13 @@ int irdma_modify_qp_roce(struct ib_qp *ibqp, struct ib_qp_attr *attr, roce_info = &iwqp->roce_info; udp_info = &iwqp->udp_info; + if (udata) { + /* udata inlen/outlen can be 0 when supporting legacy libi40iw */ + if ((udata->inlen && udata->inlen < IRDMA_MODIFY_QP_MIN_REQ_LEN) || + (udata->outlen && udata->outlen < IRDMA_MODIFY_QP_MIN_RESP_LEN)) + return -EINVAL; + } + if (attr_mask & ~IB_QP_ATTR_STANDARD_BITS) return -EOPNOTSUPP; @@ -1374,7 +1399,7 @@ int irdma_modify_qp_roce(struct ib_qp *ibqp, struct ib_qp_attr *attr, if (iwqp->iwarp_state == IRDMA_QP_STATE_ERROR) { spin_unlock_irqrestore(&iwqp->lock, flags); - if (udata) { + if (udata && udata->inlen) { if (ib_copy_from_udata(&ureq, udata, min(sizeof(ureq), udata->inlen))) return -EINVAL; @@ -1426,7 +1451,7 @@ int irdma_modify_qp_roce(struct ib_qp *ibqp, struct ib_qp_attr *attr, } else { iwqp->ibqp_state = attr->qp_state; } - if (udata && dev->hw_attrs.uk_attrs.hw_rev >= IRDMA_GEN_2) { + if (udata && udata->outlen && dev->hw_attrs.uk_attrs.hw_rev >= IRDMA_GEN_2) { struct irdma_ucontext *ucontext; ucontext = rdma_udata_to_drv_context(udata, @@ -1466,6 +1491,8 @@ int irdma_modify_qp_roce(struct ib_qp *ibqp, struct ib_qp_attr *attr, int irdma_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask, struct ib_udata *udata) { +#define IRDMA_MODIFY_QP_MIN_REQ_LEN offsetofend(struct irdma_modify_qp_req, rq_flush) +#define IRDMA_MODIFY_QP_MIN_RESP_LEN offsetofend(struct irdma_modify_qp_resp, push_valid) struct irdma_qp *iwqp = to_iwqp(ibqp); struct irdma_device *iwdev = iwqp->iwdev; struct irdma_sc_dev *dev = &iwdev->rf->sc_dev; @@ -1480,6 +1507,13 @@ int irdma_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask, int err; unsigned long flags; + if (udata) { + /* udata inlen/outlen can be 0 when supporting legacy libi40iw */ + if ((udata->inlen && udata->inlen < IRDMA_MODIFY_QP_MIN_REQ_LEN) || + (udata->outlen && udata->outlen < IRDMA_MODIFY_QP_MIN_RESP_LEN)) + return -EINVAL; + } + if (attr_mask & ~IB_QP_ATTR_STANDARD_BITS) return -EOPNOTSUPP; @@ -1565,7 +1599,7 @@ int irdma_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask, case IB_QPS_RESET: if (iwqp->iwarp_state == IRDMA_QP_STATE_ERROR) { spin_unlock_irqrestore(&iwqp->lock, flags); - if (udata) { + if (udata && udata->inlen) { if (ib_copy_from_udata(&ureq, udata, min(sizeof(ureq), udata->inlen))) return -EINVAL; @@ -1662,7 +1696,7 @@ int irdma_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask, } } } - if (attr_mask & IB_QP_STATE && udata && + if (attr_mask & IB_QP_STATE && udata && udata->outlen && dev->hw_attrs.uk_attrs.hw_rev >= IRDMA_GEN_2) { struct irdma_ucontext *ucontext; @@ -1797,6 +1831,7 @@ static int irdma_destroy_cq(struct ib_cq *ib_cq, struct ib_udata *udata) static int irdma_resize_cq(struct ib_cq *ibcq, int entries, struct ib_udata *udata) { +#define IRDMA_RESIZE_CQ_MIN_REQ_LEN offsetofend(struct irdma_resize_cq_req, user_cq_buffer) struct irdma_cq *iwcq = to_iwcq(ibcq); struct irdma_sc_dev *dev = iwcq->sc_cq.dev; struct irdma_cqp_request *cqp_request; @@ -1819,6 +1854,9 @@ static int irdma_resize_cq(struct ib_cq *ibcq, int entries, IRDMA_FEATURE_CQ_RESIZE)) return -EOPNOTSUPP; + if (udata && udata->inlen < IRDMA_RESIZE_CQ_MIN_REQ_LEN) + return -EINVAL; + if (entries > rf->max_cqe) return -EINVAL; @@ -1951,6 +1989,8 @@ static int irdma_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr, struct ib_udata *udata) { +#define IRDMA_CREATE_CQ_MIN_REQ_LEN offsetofend(struct irdma_create_cq_req, user_cq_buf) +#define IRDMA_CREATE_CQ_MIN_RESP_LEN offsetofend(struct irdma_create_cq_resp, cq_size) struct ib_device *ibdev = ibcq->device; struct irdma_device *iwdev = to_iwdev(ibdev); struct irdma_pci_f *rf = iwdev->rf; @@ -1969,6 +2009,11 @@ static int irdma_create_cq(struct ib_cq *ibcq, err_code = cq_validate_flags(attr->flags, dev->hw_attrs.uk_attrs.hw_rev); if (err_code) return err_code; + + if (udata && (udata->inlen < IRDMA_CREATE_CQ_MIN_REQ_LEN || + udata->outlen < IRDMA_CREATE_CQ_MIN_RESP_LEN)) + return -EINVAL; + err_code = irdma_alloc_rsrc(rf, rf->allocated_cqs, rf->max_cq, &cq_num, &rf->next_cq); if (err_code) @@ -2746,6 +2791,7 @@ static struct ib_mr *irdma_reg_user_mr(struct ib_pd *pd, u64 start, u64 len, u64 virt, int access, struct ib_udata *udata) { +#define IRDMA_MEM_REG_MIN_REQ_LEN offsetofend(struct irdma_mem_reg_req, sq_pages) struct irdma_device *iwdev = to_iwdev(pd->device); struct irdma_ucontext *ucontext; struct irdma_pble_alloc *palloc; @@ -2763,6 +2809,9 @@ static struct ib_mr *irdma_reg_user_mr(struct ib_pd *pd, u64 start, u64 len, if (len > iwdev->rf->sc_dev.hw_attrs.max_mr_size) return ERR_PTR(-EINVAL); + if (udata->inlen < IRDMA_MEM_REG_MIN_REQ_LEN) + return ERR_PTR(-EINVAL); + region = ib_umem_get(pd->device, start, len, access); if (IS_ERR(region)) { @@ -4298,12 +4347,16 @@ static int irdma_create_user_ah(struct ib_ah *ibah, struct rdma_ah_init_attr *attr, struct ib_udata *udata) { +#define IRDMA_CREATE_AH_MIN_RESP_LEN offsetofend(struct irdma_create_ah_resp, rsvd) struct irdma_ah *ah = container_of(ibah, struct irdma_ah, ibah); struct irdma_device *iwdev = to_iwdev(ibah->pd->device); struct irdma_create_ah_resp uresp; struct irdma_ah *parent_ah; int err; + if (udata && udata->outlen < IRDMA_CREATE_AH_MIN_RESP_LEN) + return -EINVAL; + err = irdma_setup_ah(ibah, attr); if (err) return err; From patchwork Wed Oct 19 08:30:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4809 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp217322wrs; Wed, 19 Oct 2022 02:20:25 -0700 (PDT) X-Received: by 2002:a17:907:a42a:b0:78d:3ade:a543 with SMTP id sg42-20020a170907a42a00b0078d3adea543mr6068387ejc.400.1666170985604; Wed, 19 Oct 2022 02:16:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6tMT3c0wbc+B9OsJ45bOo5OJRFQS8km6WuCNEk5naga/s/wgAk7JP1theHBxVsUIqyqNip X-Received: by 2002:a17:907:a42a:b0:78d:3ade:a543 with SMTP id sg42-20020a170907a42a00b0078d3adea543mr6068327ejc.400.1666170984476; Wed, 19 Oct 2022 02:16:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170984; cv=none; d=google.com; s=arc-20160816; b=zNVOqanr0K/Xw+inpch1NI2kc4OTYAxzI0F5PGCbxjSx87tDCoMMJinxIn/Nsu9AI8 +kvgiTe7TZyWizUcoTfZXeLXybBc6Zlildk4hbBHoqG5mwcMWsGUyRkCMEjPigNhXa4q RCevzR1rOwEcDVIgUfcpnjISEm5tchNgKPOXjugXdhMCKd3mO5ijQJr4r5Turw/OxtnP kPuV9t02tC8K5FEgSTwgA9g8AJnQu1BRtS4AQ4FDbOEaRai8pnppwlh6GtCWqA30V09r jWQ3xDOd3bXaioqLg3SqiIqypNYnkvW0PpMeFoD+dRiKYp2//U0XG+kwKHax0pzNgFiB CxuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fwrpnl/cufWskTVYzy32pMvoOxItOA/ZmRCJYMefCXU=; b=fIpefYTh2I82q/BIyaqIhwzQ1tbW0BZhh0yS6tTJZEOCOzhiOsjI2YRQRKyma95Uvm zrPEj/H97qqDhOt8so5PZDxhEGSX7/zR1IMbSvVlo6ymdvtqVSvAvSAQLQ+8JOXZ5VX1 1X/6FNbkx2gLqmEf3dLIlzCZV19slZtytCKvCcKzSbQWK1vJqkm7TPP3Ejq8agKXqXgy zXVZQKSI9Z5xvrXmLHw0U2Pn8p69tCx5kqrBN03Bj0DgSGv5TEaOAfRwRuetR2iklxZ3 n5p8A13GP0ZykJdYtG9jNT0y2vCjrqATEyMv/RwkiwWBMBLKrWvEGQHxXF66XZoOflj7 Kzaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LUwY8y1r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qf24-20020a1709077f1800b0078a4aad3141si15863866ejc.211.2022.10.19.02.15.59; Wed, 19 Oct 2022 02:16: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=LUwY8y1r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233033AbiJSJN2 (ORCPT + 99 others); Wed, 19 Oct 2022 05:13:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232620AbiJSJK4 (ORCPT ); Wed, 19 Oct 2022 05:10:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 081B9C3564; Wed, 19 Oct 2022 02:02:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2C85C61830; Wed, 19 Oct 2022 09:02:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3744CC433C1; Wed, 19 Oct 2022 09:02:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170122; bh=Ggo1VEe0EXDgrsvE/t2ids5mCaXNBVenLwbwOjRvDNc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LUwY8y1rvtyLxQJ+Rzxyv0vLBVPcJPkX2oYoNzFb5qAiS0Kjm/fr8H4h4nT9EQld4 ZoB/K/dXUY6voucGo0U5Nn7++b0tzaIjLFAKOyOXXY5EpzFEYMm1pojRBDvhCCkSt8 ocm9cBfcMpd0tTevU2fTeUYNKClPBbSLFH2Ud0K8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiao Yang , Bart Van Assche , Leon Romanovsky , Sasha Levin Subject: [PATCH 6.0 536/862] RDMA/srp: Fix srp_abort() Date: Wed, 19 Oct 2022 10:30:23 +0200 Message-Id: <20221019083313.638697595@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106906332977422?= X-GMAIL-MSGID: =?utf-8?q?1747106906332977422?= From: Bart Van Assche [ Upstream commit 6dbe4a8dead84de474483910b02ec9e6a10fc1a9 ] Fix the code for converting a SCSI command pointer into an SRP request pointer. Cc: Xiao Yang Fixes: ad215aaea4f9 ("RDMA/srp: Make struct scsi_cmnd and struct srp_request adjacent") Signed-off-by: Bart Van Assche Link: https://lore.kernel.org/r/20220908233139.3042628-1-bvanassche@acm.org Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin --- drivers/infiniband/ulp/srp/ib_srp.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index d7f69e593a63..9c9872868aee 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -2789,7 +2789,7 @@ static int srp_send_tsk_mgmt(struct srp_rdma_ch *ch, u64 req_tag, u64 lun, static int srp_abort(struct scsi_cmnd *scmnd) { struct srp_target_port *target = host_to_target(scmnd->device->host); - struct srp_request *req = (struct srp_request *) scmnd->host_scribble; + struct srp_request *req = scsi_cmd_priv(scmnd); u32 tag; u16 ch_idx; struct srp_rdma_ch *ch; @@ -2797,8 +2797,6 @@ static int srp_abort(struct scsi_cmnd *scmnd) shost_printk(KERN_ERR, target->scsi_host, "SRP abort called\n"); - if (!req) - return SUCCESS; tag = blk_mq_unique_tag(scsi_cmd_to_rq(scmnd)); ch_idx = blk_mq_unique_tag_to_hwq(tag); if (WARN_ON_ONCE(ch_idx >= target->ch_count)) From patchwork Wed Oct 19 08: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: 4884 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225453wrs; Wed, 19 Oct 2022 02:43:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6SDwM1jakHyFWnDKTblX3K0Jp3mlefQc4JWcMhunJ/VF6DQRdKY+zPsmdh70UvHXypCqT8 X-Received: by 2002:a17:906:4795:b0:794:8b93:2e33 with SMTP id cw21-20020a170906479500b007948b932e33mr518818ejc.265.1666172591663; Wed, 19 Oct 2022 02:43:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172591; cv=none; d=google.com; s=arc-20160816; b=CP4U7HrEqBQ0ngzLYITeYyXdnSwI8tg19j5c3RrEwuF9FkMdN70E/Fh//ePiS6qXK1 QeFdKVuHZbsQc+lLUqrw6utCJLBjC+8kCtfcbPbpSrCSrbQdIvckylJA1XlSExaYdcIy 1TG17YaFOQRuxXNe1pUsTbNF73khDb3lwsKXxqNcq0CyLqPl4cQYJwJoyWYGgJpsLgsn fedr1/093yBgkuPcC3VXs+cZyEPPGho4+XK3mvK+Ex4szvQIVDcUL4sr6ivitE7eijO1 g0F7p8PD3WvYqqPN20HW5Ksl0koIdqOzWLKD3c0iYwRRZz+HlsXyMtkSTYav/688qbUY 8FFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yDzZDLBfeQwxQKhsiXI9kjlEHRYagcfeA4ctb4wIQxo=; b=RV3/59hdtuQm+yjzHye0ILL9fTwnHtoxfqgdKBGcZiV7DdrL5vkjrbWzMhj1kBCz6l Zm2nWALoU6IKH8lLYMr+FQkGybSX8WZc66CdaI7p307vxNwJO/ZRc4N9OGHT48DnePiK CVFKIHVx1UN9T0RdOgqiFKJhn4yi1jOezW+2EI3wfZJA6+eE7XGC0ynf238NICA337k8 ZmTqwl+0Lq3HlcyvEDqdr+3tET2SVd2fvu7EIJRPrqJo5IOg+VvaSsnj+xMJKYxUqRyF KVXm3x2RYpDEqnLqOad18mpAXneQ9Od1xVh8+fXyCYG7lNZlGYmAAIJKHRiLUjyBfRCN T87g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SoXg+h68; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j19-20020a1709064b5300b0078d42f9d0cfsi11028281ejv.420.2022.10.19.02.42.44; Wed, 19 Oct 2022 02:43: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=SoXg+h68; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231375AbiJSJdJ (ORCPT + 99 others); Wed, 19 Oct 2022 05:33:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233697AbiJSJ3H (ORCPT ); Wed, 19 Oct 2022 05:29: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 5B2C1EB746; Wed, 19 Oct 2022 02:12:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E7455617E1; Wed, 19 Oct 2022 09:02:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D87D0C433D6; Wed, 19 Oct 2022 09:02:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170125; bh=obz5FPNMsHHx1sO6B0yQTmd5pxFcPPFY4b0ZdeXu71Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SoXg+h68uwHN9yxcnKp+JRJIzYU8jFuOsZtce9+xdF2dm3ANJGLVLvX3kMw13DRAm 9HIyhKmdH18pq5Wjtk3EeVlHq+ezUJJ+89B2JK9QNttFfgarkc6DM754LHcfgQfKeE 1Gj/dDHfkIhl6Je/AlYEn2hi5hlxPhA19SSeU2z0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Olga Kornievskaia , Bernard Metzler , Leon Romanovsky , Sasha Levin Subject: [PATCH 6.0 537/862] RDMA/siw: Always consume all skbuf data in sk_data_ready() upcall. Date: Wed, 19 Oct 2022 10:30:24 +0200 Message-Id: <20221019083313.678213207@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108591638479849?= X-GMAIL-MSGID: =?utf-8?q?1747108591638479849?= From: Bernard Metzler [ Upstream commit 754209850df8367c954ac1de7671c7430b1f342c ] For header and trailer/padding processing, siw did not consume new skb data until minimum amount present to fill current header or trailer structure, including potential payload padding. Not consuming any data during upcall may cause a receive stall, since tcp_read_sock() is not upcalling again if no new data arrive. A NFSoRDMA client got stuck at RDMA Write reception of unaligned payload, if the current skb did contain only the expected 3 padding bytes, but not the 4 bytes CRC trailer. Expecting 4 more bytes already arrived in another skb, and not consuming those 3 bytes in the current upcall left the Write incomplete, waiting for the CRC forever. Fixes: 8b6a361b8c48 ("rdma/siw: receive path") Reported-by: Olga Kornievskaia Tested-by: Olga Kornievskaia Signed-off-by: Bernard Metzler Link: https://lore.kernel.org/r/20220920081202.223629-1-bmt@zurich.ibm.com Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin --- drivers/infiniband/sw/siw/siw_qp_rx.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/drivers/infiniband/sw/siw/siw_qp_rx.c b/drivers/infiniband/sw/siw/siw_qp_rx.c index 875ea6f1b04a..fd721cc19682 100644 --- a/drivers/infiniband/sw/siw/siw_qp_rx.c +++ b/drivers/infiniband/sw/siw/siw_qp_rx.c @@ -961,27 +961,28 @@ int siw_proc_terminate(struct siw_qp *qp) static int siw_get_trailer(struct siw_qp *qp, struct siw_rx_stream *srx) { struct sk_buff *skb = srx->skb; + int avail = min(srx->skb_new, srx->fpdu_part_rem); u8 *tbuf = (u8 *)&srx->trailer.crc - srx->pad; __wsum crc_in, crc_own = 0; siw_dbg_qp(qp, "expected %d, available %d, pad %u\n", srx->fpdu_part_rem, srx->skb_new, srx->pad); - if (srx->skb_new < srx->fpdu_part_rem) - return -EAGAIN; - - skb_copy_bits(skb, srx->skb_offset, tbuf, srx->fpdu_part_rem); + skb_copy_bits(skb, srx->skb_offset, tbuf, avail); - if (srx->mpa_crc_hd && srx->pad) - crypto_shash_update(srx->mpa_crc_hd, tbuf, srx->pad); + srx->skb_new -= avail; + srx->skb_offset += avail; + srx->skb_copied += avail; + srx->fpdu_part_rem -= avail; - srx->skb_new -= srx->fpdu_part_rem; - srx->skb_offset += srx->fpdu_part_rem; - srx->skb_copied += srx->fpdu_part_rem; + if (srx->fpdu_part_rem) + return -EAGAIN; if (!srx->mpa_crc_hd) return 0; + if (srx->pad) + crypto_shash_update(srx->mpa_crc_hd, tbuf, srx->pad); /* * CRC32 is computed, transmitted and received directly in NBO, * so there's never a reason to convert byte order. @@ -1083,10 +1084,9 @@ static int siw_get_hdr(struct siw_rx_stream *srx) * completely received. */ if (iwarp_pktinfo[opcode].hdr_len > sizeof(struct iwarp_ctrl_tagged)) { - bytes = iwarp_pktinfo[opcode].hdr_len - MIN_DDP_HDR; + int hdrlen = iwarp_pktinfo[opcode].hdr_len; - if (srx->skb_new < bytes) - return -EAGAIN; + bytes = min_t(int, hdrlen - MIN_DDP_HDR, srx->skb_new); skb_copy_bits(skb, srx->skb_offset, (char *)c_hdr + srx->fpdu_part_rcvd, bytes); @@ -1096,6 +1096,9 @@ static int siw_get_hdr(struct siw_rx_stream *srx) srx->skb_new -= bytes; srx->skb_offset += bytes; srx->skb_copied += bytes; + + if (srx->fpdu_part_rcvd < hdrlen) + return -EAGAIN; } /* From patchwork Wed Oct 19 08: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: 4779 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp215717wrs; Wed, 19 Oct 2022 02:16:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7p9sETZg0CIpSEjlam/9zogZpc/ISGJ/t+NjRN793aOdteDbzekaIrnv5jdec7Yu67jq/y X-Received: by 2002:a17:907:760b:b0:78d:9d67:83b9 with SMTP id jx11-20020a170907760b00b0078d9d6783b9mr5819570ejc.568.1666170987797; Wed, 19 Oct 2022 02:16:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170987; cv=none; d=google.com; s=arc-20160816; b=XhY9fCR39kfrtQlbIut6uS8+rehRDsvMz0g2szyqrn9L5yqPO1DsX4u9AnuwlRz84i 0A1sfeBJd4VnVDCs9zsrCzK6giV72tS7HvaS5kEA8GP8IUicUbCGdK7TzEqR7YXkY692 iBXDcMs6etQczpqLn4gaGiXdRaqliUhoLdxILeoH0163BT3GwwVFJZ7pZgPxwHX7ZxP1 STVi5j5pYiTeY7cnNjCVvsDvhYooBP3Xk3n89IRT0Mw2uLUVyzsDQUSjeUcIYLaDHqn6 c5dTgpJkB28dIahgkQYsty63JRjnn+YjwFWErva3VzCO/OcIcSuB4UNSewniuDvdf9KK xRWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3943B9jb7S3kyt4/eqG7dN2tyGV+alXqbqBaEMH8+Sw=; b=oWGfgxWSUjjAdQGVT+fTAaib1ES2s/rmDLoFtUsk7821Xd8fa/n45IfFkfY/i9vkQe yl/oAVYx0EbZ9x3wr9S5Mf4IuGMxZp6GWRp2TsENjldvNY94/aTMN25eGXs0j7lVdZI9 5JtfkAT7YN5Q6wmmNKNskIQeDsJpV1r9d9yrQZy36KPJYK6VdZtD+x3qYuIX5d4ayXGU S0h3RWAC4g6+y4q8vO7n3h9fNdIRvfU39dyYLqgxEyYG/K40OciQ6Z5YNQDHBNcrKGjn FCSnpq/S1fOVvqpG1AGBpvSSgBx8eMb/dUecWKOontX0AunE2OvZKc2gW5SZ9bz4qM0r /RtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fCaPBBbx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c11-20020a0564021f8b00b00458ab55ccc9si14719207edc.168.2022.10.19.02.16.03; Wed, 19 Oct 2022 02:16:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fCaPBBbx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233044AbiJSJNf (ORCPT + 99 others); Wed, 19 Oct 2022 05:13:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232637AbiJSJK5 (ORCPT ); Wed, 19 Oct 2022 05:10:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E1B0C4DB9; Wed, 19 Oct 2022 02:02: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 7C92161825; Wed, 19 Oct 2022 09:02:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E90CC433C1; Wed, 19 Oct 2022 09:02:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170127; bh=SVGyauJPlNV9CwUJHeaBYDZmpQHU7dMSWq2bl8Wcheg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fCaPBBbxP023kNdTCIlsZDp8DveWT6QXLeEwTFuGGCOgsMt2IYKAnQ4n1Sf1FShV+ 7I5uyt/VYHvI32vpKh8mETZTcrSd9Q9usGR6n2fK2VbmL7JLLMyoKzyMjI/suDKueO 5qKHN3a9FmZn8Q8MPQsJOQgrqcFHBl6eF/xk+rdw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Olga Kornievskaia , Bernard Metzler , Leon Romanovsky , Sasha Levin Subject: [PATCH 6.0 538/862] RDMA/siw: Fix QP destroy to wait for all references dropped. Date: Wed, 19 Oct 2022 10:30:25 +0200 Message-Id: <20221019083313.726298309@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106909842146682?= X-GMAIL-MSGID: =?utf-8?q?1747106909842146682?= From: Bernard Metzler [ Upstream commit a3c278807a459e6f50afee6971cabe74cccfb490 ] Delay QP destroy completion until all siw references to QP are dropped. The calling RDMA core will free QP structure after successful return from siw_qp_destroy() call, so siw must not hold any remaining reference to the QP upon return. A use-after-free was encountered in xfstest generic/460, while testing NFSoRDMA. Here, after a TCP connection drop by peer, the triggered siw_cm_work_handler got delayed until after QP destroy call, referencing a QP which has already freed. Fixes: 303ae1cdfdf7 ("rdma/siw: application interface") Reported-by: Olga Kornievskaia Signed-off-by: Bernard Metzler Link: https://lore.kernel.org/r/20220920082503.224189-1-bmt@zurich.ibm.com Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin --- drivers/infiniband/sw/siw/siw.h | 1 + drivers/infiniband/sw/siw/siw_qp.c | 2 +- drivers/infiniband/sw/siw/siw_verbs.c | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/sw/siw/siw.h b/drivers/infiniband/sw/siw/siw.h index df03d84c6868..2f3a9cda3850 100644 --- a/drivers/infiniband/sw/siw/siw.h +++ b/drivers/infiniband/sw/siw/siw.h @@ -418,6 +418,7 @@ struct siw_qp { struct ib_qp base_qp; struct siw_device *sdev; struct kref ref; + struct completion qp_free; struct list_head devq; int tx_cpu; struct siw_qp_attrs attrs; diff --git a/drivers/infiniband/sw/siw/siw_qp.c b/drivers/infiniband/sw/siw/siw_qp.c index 7e01f2438afc..e6f634971228 100644 --- a/drivers/infiniband/sw/siw/siw_qp.c +++ b/drivers/infiniband/sw/siw/siw_qp.c @@ -1342,6 +1342,6 @@ void siw_free_qp(struct kref *ref) vfree(qp->orq); siw_put_tx_cpu(qp->tx_cpu); - + complete(&qp->qp_free); atomic_dec(&sdev->num_qp); } diff --git a/drivers/infiniband/sw/siw/siw_verbs.c b/drivers/infiniband/sw/siw/siw_verbs.c index 8dedae7ae79e..3e814cfb298c 100644 --- a/drivers/infiniband/sw/siw/siw_verbs.c +++ b/drivers/infiniband/sw/siw/siw_verbs.c @@ -480,6 +480,8 @@ int siw_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *attrs, list_add_tail(&qp->devq, &sdev->qp_list); spin_unlock_irqrestore(&sdev->lock, flags); + init_completion(&qp->qp_free); + return 0; err_out_xa: @@ -624,6 +626,7 @@ int siw_destroy_qp(struct ib_qp *base_qp, struct ib_udata *udata) qp->scq = qp->rcq = NULL; siw_qp_put(qp); + wait_for_completion(&qp->qp_free); return 0; } From patchwork Wed Oct 19 08: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: 5351 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp296461wrs; Wed, 19 Oct 2022 05:27:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Ud7ZU+qkQKz4+xkf9JJGauU5FdY61ci5GEacZgTZdCT1j0jl8a51KyH2aNQby3/AdgBRt X-Received: by 2002:a05:6a00:2393:b0:566:813c:ae26 with SMTP id f19-20020a056a00239300b00566813cae26mr8546781pfc.8.1666182457116; Wed, 19 Oct 2022 05:27:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666182457; cv=none; d=google.com; s=arc-20160816; b=f9Xt9203YHz4p4mWNEz2RQ8O/+xFqB0ZYRwiqnT/6u180BwnSJxto/QjG5V8N2NZMR 4VPZpdcXIT5aF5ZKqYR444xBbaBEOrB+/I9VGrlTGSUbvPI1tZqOfMsbPVWYZQFU35ch 3v27Gt8EXMgRwbjM6KvmHXIVv/aDPfD5KUTrm7HUoeBEfUdOTMGhp2fx/QyHw8tE6sIe mhwJApOIc4DdaUeFzt5+uygRqhZyOLzcZV1AJJker1kxl9DAcj5Bcmpun9KciKhXM7js EmNibQZpfu72n4XihNYQT8nP6d+Xsy7gLMkWAqKQvtxtGJGRi7X/OQ3BJwzNevlm6Cez 5khA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=t5IKKE7F2yTl0RQzm5WcZtOu1DxktQ6bENcOtZu8oM4=; b=WawOYVbtNkLnZKAIqatuD+P4nPshG076xQxHIDjVhVMb5yLBqN4OReGLCn8k3CNrWF PFN/0A925WkCh6dTRMjNVxhOveC/YHXPxhMzUWchoJTJzaDu1mL17dNNZ62pAB9rSxkv zqBC9sG1MY9cBSHZQzWO7mmTobxgEylpPHlC1vMOhbAHTPeyoUK4gtEZZ+fR7VeP+jDo 5fm3C28PyuXvEBAYaZu6qTLXmP821wxmvxOtQfAF+Ipuhb9bpa2f3xVd3hlLj3rPsVJd cl5VUxsEKbGz4gbwADsJUua7fis6VV7CbDS/JugABwFsM4H3U8cx+YUXvQIObqLDUwWv eCJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jql1V640; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a13-20020a056a000c8d00b00546ce9189b1si19929141pfv.65.2022.10.19.05.27.06; Wed, 19 Oct 2022 05:27: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=jql1V640; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232727AbiJSMQv (ORCPT + 99 others); Wed, 19 Oct 2022 08:16:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232646AbiJSMQV (ORCPT ); Wed, 19 Oct 2022 08:16:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97E564AD42; Wed, 19 Oct 2022 04:52:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 50F4FB82467; Wed, 19 Oct 2022 09:02:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BEF8BC433D7; Wed, 19 Oct 2022 09:02:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170133; bh=2jLg4sorREdD9Kh2cd4WxQmBKxAsrF1D/dWByB0ETJk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jql1V640h0gGtOVmXKzbSOcEpiHUnZnRwyAraQ1ynGBZRgGqV42D8+eiKFnk3cAIq mjcCoMSe8p+O543W5lXYibPN5k3vCCrzVzG3WtMMw8rwbKJEiP7yo0VEf/hkzIqtFv sjkUX7wLuZwqyqmN5OuF//0KRv+H5bBtVlMPlDrk= 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 6.0 539/862] ata: fix ata_id_sense_reporting_enabled() and ata_id_has_sense_reporting() Date: Wed, 19 Oct 2022 10:30:26 +0200 Message-Id: <20221019083313.776189334@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747118936142462675?= X-GMAIL-MSGID: =?utf-8?q?1747118936142462675?= 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 21292b5bbb55..868bfd503aee 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -771,16 +771,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 Wed Oct 19 08: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: 4781 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp215793wrs; Wed, 19 Oct 2022 02:16:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6E0S4vEcmOImZLRQ1IWaEpvsuH1SW39Zy0j8o0GqOHcsFwzUcfNHxxQAJMsZ+pXBLU42f6 X-Received: by 2002:a17:906:5dd8:b0:78d:efa7:f78d with SMTP id p24-20020a1709065dd800b0078defa7f78dmr5924536ejv.641.1666171000034; Wed, 19 Oct 2022 02:16:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666171000; cv=none; d=google.com; s=arc-20160816; b=pKuU6MgfvQq+7vQkOFum+ZYu2WE8oQv1cheDOVnD2HS9ySAilvZ4cF0OmIBfjIfokc ZojhCexQEOFpC52US9o02T8zZJoLMVFCFxqrihHfacTv4F/uP1Q8B1f3zYGtbp/3W7c3 oFqo2TcW4IrNCEtkgNgK/xA1VeP49sLAlZe5E9S4cfgSq00ptGmOZllxELcMTm48gnaz g/Ta1CkxmotbuXVcIHXAQvXziR8xIwnKY2vrbbTWA2YS4LVrzeLIla97cbn+p0oWicAF XV++AbW7rL3la0PUfEYRjL3m4BhDMpsuEbDyaBUE15iyDf6VKSwEltd5AiwtzBY9YRKl sA+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=Itv99EoVwD5CC0iuKs15PTjSGqpnhHwQxIkFy/4WXGc=; b=H03wjafJ3WACh4oOOM6EgQYIdijbqcBjVnN5yuWMMuU9zSVG91RoHa/S3n8v1Wjj25 m67ju74NPDvizxo0+R8POq73xQsfUF05hOo6qVBc4MOQqRAfUFP6Wyy1Z2U0/kEpYL63 LsPysTu7FTXq7f1HivoDx+tV14i+doJ+ab1vL2tHjONlzq1hZgwSv+68YBQFuwhALRbF Gmti0lZIYVx8IgQozOkAMsYd93dcIwv6IP96KvYavUOMUlNk3AmDqx4xWJjWFk4Qy45S 7jpp/Gr1evwoEZlas/XgUdirP6dVFE5QhpkZcLN3sAkAh6A30aCEhkzhLrxV5QsdrAZf wgXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iGmgUa7s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dd17-20020a1709069b9100b0077cfec3a52fsi15072642ejc.839.2022.10.19.02.16.16; Wed, 19 Oct 2022 02:16:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iGmgUa7s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233054AbiJSJNt (ORCPT + 99 others); Wed, 19 Oct 2022 05:13:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232776AbiJSJLM (ORCPT ); Wed, 19 Oct 2022 05:11: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 CE326BBF26; Wed, 19 Oct 2022 02:02: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 391C261840; Wed, 19 Oct 2022 09:02:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 517ECC4314E; Wed, 19 Oct 2022 09:02:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170135; bh=wgTpcZw6pHeLmUWIFLe8Y+4Afsn152FcGu5DNgbGAyI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iGmgUa7sjOEuH9eFuTkiYUZ5S9qu4B1wGNE9Ib56OXFGmMfueNYNqO6IimginnXQP Mb50I8rWI2J3ei6M1wLgwTkfcLWED9nFC8bMr2ONGmdi3EXdnFffrIUjh7Q0HKWuLu 4LkPwtNHn1kFo94dgNFTkeRPApbWKgW5WhuiIcko= 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 6.0 540/862] ata: fix ata_id_has_devslp() Date: Wed, 19 Oct 2022 10:30:27 +0200 Message-Id: <20221019083313.826087970@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106922352829814?= X-GMAIL-MSGID: =?utf-8?q?1747106922352829814?= 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 868bfd503aee..bc136a43689f 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -566,6 +566,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) \ @@ -578,7 +582,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 Wed Oct 19 08: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: 4932 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp226198wrs; Wed, 19 Oct 2022 02:45:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4dJoKOZi22+uUBxvvkoPtypnSYvHby5nUAA8L2w+1yhtj56mhfUIivY3sMfIHmSzHLwz3i X-Received: by 2002:a17:906:8473:b0:77b:efa8:50e4 with SMTP id hx19-20020a170906847300b0077befa850e4mr5947689ejc.250.1666172599200; Wed, 19 Oct 2022 02:43:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172599; cv=none; d=google.com; s=arc-20160816; b=xRAM+I1yW6UNC503AF8Jj2x81tDXqQ11/3C/OM1ILpjiUyxeghlL0S1PALswzFTAOy F8Y0oqLKgsLKiqh5Dv2m0xMspTZpTnAyPbdkwd0w32v9wjhIYr1f9xZdaozUWYQ0kFZU p9jbLNCAJfSJgv9y9QSf3KIIU1LGUI0LwDhXF4I+ZElNEcu3HHIOryNpzs4cXoOaej2c 8O3bLZsonaqulrGPTti+Y0STZWj9j8Ihik5iFE4dll/keL4jGXujXEy4BfEW3A8F1a4o vXoRB8ASEGmH9tfI08mJ6AVZQSrOsqDqK+dAzjE2FOlBX17BCI42pIyhmNxdSkOHYpqA OMkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6bGb9xh0CMBPZSOqD/eybkKkp+mExbT9ishSmmm8tUM=; b=KucS0PJCbxzmoWo5epAI7T4wCyJniyBlf7Q7H4X+xieJk99efSDyutKSZ3GKPQkFTL UWK79hE7jR7pGd409y/8eDoSMN5FgkXpZT17DNGasznaNHEhquKTRyTCildXHy8hYvv0 4Z3k6b8O74TWJxDXxQ7o+sXP2tz+EzE6YGMJMVOKN6Ogs8i7z2MedsjfKwm/unfCBeDc n3yOF+X5Dsavx2yp8/XAHxNcPVyBmQICgi03iYRwb8g1yTfmYuQtaWf0FP+24HXgwvhy zuaDre3xUs3zUiQeTFQmYYN+mNBth6xq3kJmN0QNbd1G0c8+EEez5quQastaGb69/dVc e4zA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rjPsJYtm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v7-20020aa7d647000000b0044eb6f979d7si11145600edr.152.2022.10.19.02.42.52; Wed, 19 Oct 2022 02:43: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=rjPsJYtm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233889AbiJSJdw (ORCPT + 99 others); Wed, 19 Oct 2022 05:33:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233772AbiJSJ3Y (ORCPT ); Wed, 19 Oct 2022 05:29:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA4E267C9F; Wed, 19 Oct 2022 02:12: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 DB04E6183C; Wed, 19 Oct 2022 09:02:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E99D0C433C1; Wed, 19 Oct 2022 09:02:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170138; bh=RqMptm6VErJfkdlk9lLnznG/cTGLaJPV5tVwTLdwaP8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rjPsJYtmb7AmL6Ss2dlNct7Q/nuMHWOMjqeE/HPcyKMTWO+ikSXDYUiIPueCoQrFH 2/XqIPJLg0HH4lhiZ+Qe4ghQgN7APoLmv5BxlvQMg9GHBQaCTPehfcFWvNF7x+sfVk FhPqrsVdD16z4J8jz+g6hvnh5mLM2Wz9at0b1tsY= 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 6.0 541/862] ata: fix ata_id_has_ncq_autosense() Date: Wed, 19 Oct 2022 10:30:28 +0200 Message-Id: <20221019083313.873459729@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108599382923169?= X-GMAIL-MSGID: =?utf-8?q?1747108599382923169?= 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 bc136a43689f..4845443e0f08 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -570,6 +570,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) \ @@ -582,8 +586,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 Wed Oct 19 08: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: 4786 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp215950wrs; Wed, 19 Oct 2022 02:17:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4WruiDTjrMwlhW0AgBB80neK4n2A1sfjQweJH7NWOUCK/9LYxhrptvMlGZAITcPAbassrF X-Received: by 2002:a17:907:94d6:b0:78d:f947:7cf5 with SMTP id dn22-20020a17090794d600b0078df9477cf5mr5942742ejc.446.1666171028480; Wed, 19 Oct 2022 02:17:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666171028; cv=none; d=google.com; s=arc-20160816; b=QxbdFJfFOBZmOZ7D6ePZRXvRsuDhrN8wF7Kl+Z8LgQgpX61/gNnz1CYpmJA9fGINO4 hOAIfNzTOEoPpdgQavJNgGTDBMjIhMDFMXqOLvE7lqMTJdQv3cRfwUUr6AwxDXI0wFwz EVG/gXa92hkJ5aE9BUue4YxIhA3lgFpt6hYb9xdC2XkLmsh5rGaHK4PSkOXJVFjkmGk6 TtPhjiyZMe3DwclJGSWUArllnTM+zZn6fNDRz+VE+e/a2h+5nd2e4skdPSjcCKJj5nJS hB7gSJYEzqSgbjGPchs7FXzx26aEcBZ+O8Kw9l9RDzP7tOurxAMLvaSGp3GYQxUQZn+8 dI1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NhuL2svf/LZ8a4GBRIwNsrhtvZ+UH7LEa3sRLaDV/6o=; b=tXncBV1VLsPLnDh6kbRPXbI1oMf/kE3GQzeJHZZUHcJ8MXWtHR+qakJqOkqxmQbG7Z 6NY02tSeLvl+IZ1EJMW4qovMJLRdhZ5PzNanDTnoyARdjMQ6i/OCF/PksE/E5tCmoSKu 6uHJ49NR51l3guMWjH7Ph3CFKowI2L53bfLk/sdKbH/34qRyGFPwhStkeFNW5A96rsPI nR5lEXWC1bgk3kHtrFIIQqRRlOyFK6rj4tWgoCndXEnXTUpkCDCWOfO4sPUU2Vo8GVN9 X7yer6STIXKn5N+JKlfZUuz7A8t7TqLy2PLRsF8WBmh5CFgt7XdPYNgu8L9DjmSAOOmJ KIag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qzJHzfR+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dp20-20020a170906c15400b0073da0ce043csi14969928ejc.619.2022.10.19.02.16.44; Wed, 19 Oct 2022 02:17: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=qzJHzfR+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233061AbiJSJNx (ORCPT + 99 others); Wed, 19 Oct 2022 05:13:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232804AbiJSJLV (ORCPT ); Wed, 19 Oct 2022 05:11:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 002F886F97; Wed, 19 Oct 2022 02:02: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 6B8D761812; Wed, 19 Oct 2022 09:02:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80511C433D6; Wed, 19 Oct 2022 09:02:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170140; bh=PmD6zO5UnGlyOotddJ1nz8tCENZ3//IlzNov9zWnXmY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qzJHzfR+pxDLKZ07dDVcqcFLWBvd8rIYFa7M8EF86dCBKSMZx+TZ9BVllVeOleTds /aL6j9ZjEDBYoFYWQKk+m6RMsTf3USAw7it5FaRgEaEDyDhEhwAkXylYExhCVC3FIV 1MmMRH5eHz6AU/LrDPu/ntkmBT0N2JLVi8/iXY7Q= 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 6.0 542/862] ata: fix ata_id_has_dipm() Date: Wed, 19 Oct 2022 10:30:29 +0200 Message-Id: <20221019083313.908352640@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106952145792058?= X-GMAIL-MSGID: =?utf-8?q?1747106952145792058?= 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 4845443e0f08..e3050e153a71 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -574,6 +574,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) \ @@ -597,17 +601,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 Wed Oct 19 08: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: 5358 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp298255wrs; Wed, 19 Oct 2022 05:30:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM70I3P7he2999hVaiDDfTXdYg+9clPeO6yx3DaijmquPkEjwcMHHBLIEHa//Ztz8J6YFUti X-Received: by 2002:a05:6402:3509:b0:45d:c25b:b80e with SMTP id b9-20020a056402350900b0045dc25bb80emr7316209edd.250.1666182612910; Wed, 19 Oct 2022 05:30:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666182612; cv=none; d=google.com; s=arc-20160816; b=QW0vexRZkHWXywDXBdifMW/HOFjkfixbY3ZUwCZnPVgnJUFpLpldnD63BcPpo6Gx0L CMLs4HRm/or1BFGFKqcV4NjU+rpKPOo6C26U7eckdzfbSNkh4YBouOrADEUxOfgSMeLb q6kQzjw/Z9ppOZ4Y5olV5GlzNkNrWiaWLsCtZLxqnqlAZLC6409jnsoz4I3yz4pUDYVV fGtCw7CMreGCd6x4c2AFda75iHaJeD9tLCdxcGpvxaxJvxDSegm0BYdTIPuUNnGuO1rN Yo1ySdLqU6/2jF7gsT9cfJv1vDlvh8n+loUzmVF2KfsPvCq2aa0HWeLEne30kzFzGvg/ PgtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vgahABATD5LLL7z+7KOGLwKxD5be95GzuVTV5xWbMyA=; b=qlYN1oPpc+8HDLZCAP4VksfeVf1SZMtc+fta+Thy/MlJe6DrvHsdTLvWFPULa003g2 YEttvYG2zAKvpV0/+x67xrnYEK3n2JjLhX5mO+UrxrxfeKQ63nj8fdy3ifTn+ioKPN22 3tnv5urSHxPJI2IMTq3G6qZIsCx+EJOA7L3qctWtIuaT1hdk6pwaZPQlc5eik7+9nspG eJ7a92LP+l6zwi33buv7+a77A1Eh8winWa1LfKj/eDvy03QI5PQEfciwVPnrYObtxxjA IJgg/nwhUXTIvlIVRaMcFnjiUMgesYSTNwIhJD3tI0FcDzPvkCZErxhplFZ0eBdmvxYV 4VhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=048A0v4V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p19-20020a05640210d300b00451d5c11293si12019427edu.496.2022.10.19.05.29.46; Wed, 19 Oct 2022 05:30: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=048A0v4V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233009AbiJSMTX (ORCPT + 99 others); Wed, 19 Oct 2022 08:19:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232845AbiJSMSL (ORCPT ); Wed, 19 Oct 2022 08:18: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 4723E1C39ED; Wed, 19 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 ams.source.kernel.org (Postfix) with ESMTPS id C3BF6B8245E; Wed, 19 Oct 2022 09:02:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2334AC433D7; Wed, 19 Oct 2022 09:02:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170143; bh=7C+xT1rRzPbiCm43+74AUTchCTj9A/0iYrQyNA+gvIg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=048A0v4V6PS1Qm/OwDTLkZ8IGI8tt4dlXBcCQPUUtqqWHfiitndLOQ/cjnsFyzVL0 2VOyCDCwZEnXQtvnqG2M5JNF5fPUZJQilkqIJns/y3G0OafuQGG1oqb628daiPcZPO AboY4HOpFv4IGGNMYFMcQpMNi2Tv5jfbnC2Kn7qU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Liang Yang , Miquel Raynal , Sasha Levin Subject: [PATCH 6.0 543/862] mtd: rawnand: meson: fix bit map use in meson_nfc_ecc_correct() Date: Wed, 19 Oct 2022 10:30:30 +0200 Message-Id: <20221019083313.949160914@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747119099150779359?= X-GMAIL-MSGID: =?utf-8?q?1747119099150779359?= From: Dan Carpenter [ Upstream commit 3e4ad3212cf22687410b1e8f4e68feec50646113 ] The meson_nfc_ecc_correct() function accidentally does a right shift instead of a left shift so it only works for BIT(0). Also use BIT_ULL() because "correct_bitmap" is a u64 and we want to avoid shift wrapping bugs. Fixes: 8fae856c5350 ("mtd: rawnand: meson: add support for Amlogic NAND flash controller") Signed-off-by: Dan Carpenter Acked-by: Liang Yang Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/YuI2zF1hP65+LE7r@kili Signed-off-by: Sasha Levin --- drivers/mtd/nand/raw/meson_nand.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c index 829b76b303aa..ad2ffd0ca800 100644 --- a/drivers/mtd/nand/raw/meson_nand.c +++ b/drivers/mtd/nand/raw/meson_nand.c @@ -454,7 +454,7 @@ static int meson_nfc_ecc_correct(struct nand_chip *nand, u32 *bitflips, if (ECC_ERR_CNT(*info) != ECC_UNCORRECTABLE) { mtd->ecc_stats.corrected += ECC_ERR_CNT(*info); *bitflips = max_t(u32, *bitflips, ECC_ERR_CNT(*info)); - *correct_bitmap |= 1 >> i; + *correct_bitmap |= BIT_ULL(i); continue; } if ((nand->options & NAND_NEED_SCRAMBLING) && @@ -800,7 +800,7 @@ static int meson_nfc_read_page_hwecc(struct nand_chip *nand, u8 *buf, u8 *data = buf + i * ecc->size; u8 *oob = nand->oob_poi + i * (ecc->bytes + 2); - if (correct_bitmap & (1 << i)) + if (correct_bitmap & BIT_ULL(i)) continue; ret = nand_check_erased_ecc_chunk(data, ecc->size, oob, ecc->bytes + 2, From patchwork Wed Oct 19 08: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: 5290 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp281592wrs; Wed, 19 Oct 2022 05:02:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6kXoc2VDCeXiadUti/NAta7xowvDTeKt6haCh2NYNSCotA969A0FAgYZvrr8E5jik+0hYo X-Received: by 2002:a17:906:8453:b0:78d:b65a:abf1 with SMTP id e19-20020a170906845300b0078db65aabf1mr6197480ejy.696.1666180932035; Wed, 19 Oct 2022 05:02:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666180932; cv=none; d=google.com; s=arc-20160816; b=gLuiGW50d+Cm4297XnOMtrD1SlcR2pb6ZehZLDcjl6+szfp+UcVKrT7ykudiAwtggY yOSM6/OfKslUR5SNyRIgRvSAdFAfa2Wu8nKzm7oe/C8O0KskfpEMlNKzU/vj7u4DrWlQ +F6Qg6Hys5cYx3+rfJVm2KtbxM8Um5jmCJzHC63+Dov6zp6UTDVJBmPgdNAWk8zHa+2i iGCfWUbBeLsQnTNErzp/afNniNG5AaGKHr73oLwCB7uM2mKNeWW1sLY8fxwCbmn5+AO5 ugP4ziaUS628hlDb1IXDvgN93YljFSNXmEoJGYUF5dJ9Eo9ndAoAmb8tle5tmJHh3E6A TMlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=CWQBYA6f0fpz0z9THUDJxECAi037YLTQT3I36eoED3A=; b=bAc70/HTp6IcHbBfygP6NO7IOgsM0tXMjFYFlNTLgkCmvhKnmPh9xVYqh3wAFaBwzF OY0/3t3Vl5L+Tiq6shS7u22/AVlvvX/w3jWVjRRrJJguliJhROU1oMOHiKEd79qrD36B hkfDH68xKogXkOQF2YfwzPRyOP7Y6luuBVl7vWae8rmQJNdE9OHPSN9LtklbWYuZN40j 6Uf39TzlVi3M2zW2j7IoXdG6YMk/7o4PjNGbsJB/VFsdnfeiH4ojSt7OWtwu/Bv9j6ep N4Bma0lhfzS2wFcg+7a26Ax6oXo2OhLoIem7FSOZ3H1kk2LjpVFdmJJiS7rrVx6JwLzw RSCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=C0bmSx7Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hs40-20020a1709073ea800b0078df2f22f80si14912556ejc.647.2022.10.19.05.01.44; Wed, 19 Oct 2022 05:02: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=C0bmSx7Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230175AbiJSL5r (ORCPT + 99 others); Wed, 19 Oct 2022 07:57:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232315AbiJSL46 (ORCPT ); Wed, 19 Oct 2022 07:56:58 -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 544D2A59A4; Wed, 19 Oct 2022 04:35: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 D826FCE2154; Wed, 19 Oct 2022 09:02:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E1B0C433D6; Wed, 19 Oct 2022 09:02:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170146; bh=d/SBqC/iWgZnvoilQmoMgTf/cQ6a1kVGxLMDkcIvoqk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C0bmSx7ZTnh751PL9X5UQtKxFEd1tAPITCDj/Xa9BLOsshmdt+tTjlvV6YBOfzUXO DCMporOZfWJzCg/cgJoGhNeNmvRBEpF/NFbAK3YlWFLL9sJ3WuFo3Ezm0veAkQNpYe /XK2zFlaejRJi26sFaQVR4zNM383ZhDdCP6qGJU4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christoph Hellwig , Ming Lei , Hannes Reinecke , Damien Le Moal , Johannes Thumshirn , Bart Van Assche , Damien Le Moal , Jens Axboe , Sasha Levin Subject: [PATCH 6.0 544/862] block: Fix the enum blk_eh_timer_return documentation Date: Wed, 19 Oct 2022 10:30:31 +0200 Message-Id: <20221019083313.997289806@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747117336718721218?= X-GMAIL-MSGID: =?utf-8?q?1747117336718721218?= From: Bart Van Assche [ Upstream commit b2bed51a5261f4266ecb857bba680a7f668d3ddf ] The documentation of the blk_eh_timer_return enumeration values does not reflect correctly how e.g. the SCSI core uses these values. Fix the documentation. Cc: Christoph Hellwig Cc: Ming Lei Cc: Hannes Reinecke Cc: Damien Le Moal Cc: Johannes Thumshirn Fixes: 88b0cfad2888 ("block: document the blk_eh_timer_return values") Signed-off-by: Bart Van Assche Reviewed-by: Johannes Thumshirn Reviewed-by: Damien Le Moal Link: https://lore.kernel.org/r/20220920200626.3422296-1-bvanassche@acm.org Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- include/linux/blk-mq.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index 92294a5fb083..1532cd07a597 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h @@ -268,9 +268,16 @@ static inline void rq_list_move(struct request **src, struct request **dst, rq_list_add(dst, rq); } +/** + * enum blk_eh_timer_return - How the timeout handler should proceed + * @BLK_EH_DONE: The block driver completed the command or will complete it at + * a later time. + * @BLK_EH_RESET_TIMER: Reset the request timer and continue waiting for the + * request to complete. + */ enum blk_eh_timer_return { - BLK_EH_DONE, /* drivers has completed the command */ - BLK_EH_RESET_TIMER, /* reset timer and try again */ + BLK_EH_DONE, + BLK_EH_RESET_TIMER, }; #define BLK_TAG_ALLOC_FIFO 0 /* allocate starting from 0 */ From patchwork Wed Oct 19 08: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: 5359 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp298745wrs; Wed, 19 Oct 2022 05:30:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Ujn21fcb00srqojGftzAdiFu1/tPaH2NjHV8TXqZW2G2FTEo1J8qjsMKvLtD/gLjIsvuK X-Received: by 2002:a17:907:320c:b0:741:1e55:7a69 with SMTP id xg12-20020a170907320c00b007411e557a69mr6804766ejb.740.1666182657426; Wed, 19 Oct 2022 05:30:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666182657; cv=none; d=google.com; s=arc-20160816; b=xyIJzs/BfdsbG5apvK2ppancBNp9gs71bJch7BkVOAPbBgPLLyJonMci0UD5dNsrxK QZECTvtLJbSPpKpFHhwzFWy0eHvp8knnO8y5wjDBAyJiXpJ3fOvVLmPjySZ08EFeugTB Ei7nLHF+pHIwGgzz044cNf0d6xhgGDVA4bTWl/qlepFYZMDhazf9FazaopGZ/wjNdhWx OMbzdFFHot9kgYNnKwtyhZ0k9SY3b+cVyxDwIeGHtQ4LBDZzvhygMbQXTthMpCX2Lsn5 zvysSB1oJgSvCerKauA99gj6zOzpPmLwlLQXLW6M3BktC3onfapA1h1rlUnaRwKrFPBo nmkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fNX9SJsAlJENB0ThRhQpv2LbpU6v/Kgr1vQWd8eYhTs=; b=I4JAVISeC6kLwrM7RhNqz3wmwJN7Cm+8anmyLBZvz1AKyQgEOKqq31QZ2JRwFuuh43 HRVRfQ/hB/8w6WQiCflgxbOX7rUqQcZNIwG1D8GOeUFYoVTlyq9BVSKSX4/c3Nzi5Lo+ VQZdQm/ajI1wZHa7gne9WZFkrRO+R1sSqUFxxVv6FJLxwyHEqZETQqczrOkSWm1m4LIr iRif/URcZnVp9Z7YGXuyRqHqigBIwfd4085Zr6xzLIvhPd7NRrxirNKMU/hNr5CinxhW n9VTxyTrxQ5mbEEH0TfpHXyAsja1xhGAsS4kjcUV/ytsX8jE0cpplV3iOl6dVwPRp4r3 7i2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=abVJlzuz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z9-20020a05640235c900b00459060fce1bsi15347504edc.574.2022.10.19.05.30.24; Wed, 19 Oct 2022 05:30: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=abVJlzuz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233026AbiJSMTj (ORCPT + 99 others); Wed, 19 Oct 2022 08:19:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231894AbiJSMSo (ORCPT ); Wed, 19 Oct 2022 08:18:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1289136403; Wed, 19 Oct 2022 04: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 00F99B822BB; Wed, 19 Oct 2022 09:02:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54F77C433D6; Wed, 19 Oct 2022 09:02:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170148; bh=6A4G5ttVug3XAxhzsOqGeSmvV1mp2WWrcAMaD8Bz/k8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=abVJlzuzJx3hexX5PeEqOSdur8KO1npIUlD2kkvBdT4nNB2RMvXxK3n5sM1EU9tzV 3aXQEuVsHqI+QNyRgk7xhsmgzSf8FpTT70JI5R8Qwpz30JCwJGrUkljC4RiRkIVnIO RnP9OG1SsVGQbhS8T92ldDxxIHdJ1VgCtcWH+kNk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dylan Yudaken , Jens Axboe , Sasha Levin Subject: [PATCH 6.0 545/862] eventfd: guard wake_up in eventfd fs calls as well Date: Wed, 19 Oct 2022 10:30:32 +0200 Message-Id: <20221019083314.035666345@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747119146265298493?= X-GMAIL-MSGID: =?utf-8?q?1747119146265298493?= From: Dylan Yudaken [ Upstream commit 9f0deaa12d832f488500a5afe9b912e9b3cfc432 ] Guard wakeups that the user can trigger, and that may end up triggering a call back into eventfd_signal. This is in addition to the current approach that only guards in eventfd_signal. Rename in_eventfd_signal -> in_eventfd at the same time to reflect this. Without this there would be a deadlock in the following code using libaio: int main() { struct io_context *ctx = NULL; struct iocb iocb; struct iocb *iocbs[] = { &iocb }; int evfd; uint64_t val = 1; evfd = eventfd(0, EFD_CLOEXEC); assert(!io_setup(2, &ctx)); io_prep_poll(&iocb, evfd, POLLIN); io_set_eventfd(&iocb, evfd); assert(1 == io_submit(ctx, 1, iocbs)); write(evfd, &val, 8); } Signed-off-by: Dylan Yudaken Reviewed-by: Jens Axboe Link: https://lore.kernel.org/r/20220816135959.1490641-1-dylany@fb.com Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- fs/eventfd.c | 10 +++++++--- include/linux/eventfd.h | 2 +- include/linux/sched.h | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) --- a/fs/eventfd.c +++ b/fs/eventfd.c @@ -69,17 +69,17 @@ __u64 eventfd_signal(struct eventfd_ctx * it returns false, the eventfd_signal() call should be deferred to a * safe context. */ - if (WARN_ON_ONCE(current->in_eventfd_signal)) + if (WARN_ON_ONCE(current->in_eventfd)) return 0; spin_lock_irqsave(&ctx->wqh.lock, flags); - current->in_eventfd_signal = 1; + current->in_eventfd = 1; if (ULLONG_MAX - ctx->count < n) n = ULLONG_MAX - ctx->count; ctx->count += n; if (waitqueue_active(&ctx->wqh)) wake_up_locked_poll(&ctx->wqh, EPOLLIN); - current->in_eventfd_signal = 0; + current->in_eventfd = 0; spin_unlock_irqrestore(&ctx->wqh.lock, flags); return n; @@ -253,8 +253,10 @@ static ssize_t eventfd_read(struct kiocb __set_current_state(TASK_RUNNING); } eventfd_ctx_do_read(ctx, &ucnt); + current->in_eventfd = 1; if (waitqueue_active(&ctx->wqh)) wake_up_locked_poll(&ctx->wqh, EPOLLOUT); + current->in_eventfd = 0; spin_unlock_irq(&ctx->wqh.lock); if (unlikely(copy_to_iter(&ucnt, sizeof(ucnt), to) != sizeof(ucnt))) return -EFAULT; @@ -301,8 +303,10 @@ static ssize_t eventfd_write(struct file } if (likely(res > 0)) { ctx->count += ucnt; + current->in_eventfd = 1; if (waitqueue_active(&ctx->wqh)) wake_up_locked_poll(&ctx->wqh, EPOLLIN); + current->in_eventfd = 0; } spin_unlock_irq(&ctx->wqh.lock); --- a/include/linux/eventfd.h +++ b/include/linux/eventfd.h @@ -46,7 +46,7 @@ void eventfd_ctx_do_read(struct eventfd_ static inline bool eventfd_signal_allowed(void) { - return !current->in_eventfd_signal; + return !current->in_eventfd; } #else /* CONFIG_EVENTFD */ --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -936,7 +936,7 @@ struct task_struct { #endif #ifdef CONFIG_EVENTFD /* Recursion prevention for eventfd_signal() */ - unsigned in_eventfd_signal:1; + unsigned in_eventfd:1; #endif #ifdef CONFIG_IOMMU_SVA unsigned pasid_activated:1; From patchwork Wed Oct 19 08: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: 4813 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp219406wrs; Wed, 19 Oct 2022 02:25:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM763E4tCUFmMm4ZReyuemnOR8T1LBI2Os3IfqcLEJeTXIihXAuObu+6dTJPKRuXvinqZfZw X-Received: by 2002:a17:90a:b28d:b0:20d:6790:19fa with SMTP id c13-20020a17090ab28d00b0020d679019famr43936365pjr.68.1666171551972; Wed, 19 Oct 2022 02:25:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666171551; cv=none; d=google.com; s=arc-20160816; b=De7JM+46r2JZwfcCpKZUUy0WPnyqKtbUGNfeqIY8Sz8qdRc1zbQiJz9611P85fyJ0m NOwGuU/yZVyEoAr/qsupbaGG3T0b95L/tK2s3MWWl2764qqJbvXKO9JmBFGKYolmJmqN pNi0lF80Sdg7j76sSL1U6MMwaL9GqIZv7VxHP2Ttae1vaw7WbgQukhoxq4hWOBj6GFtR vzZLl/nj/Wz4Z6gZhEVGVXfE5Mpe6z25D8t/ia8gX09A3sefaLfh5TyQ1Pjg52+/MuC4 OtD+BtUDw/UUoqUeM9ejbGoCbS9MqlFKd5nFQxgZRhrgbRL+Tn/QTctOs7VlNNtl/73K nO3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=S529gyrj7kjX/ixCzEInflebV5awHHeELcabJkOv9A4=; b=Rj3yKlMZoE3aydo6yluno3rNHHRFVMsFc5/LpyHE2ttpyeXrlRGKLghgdQB61zQIT6 6kMOoUj/VVMvuoxxmYYQS4uIM7W0qT6DGSxRVEe9Jq9qdfj4FULQa8o0988qhKxGfI7e 1DJXOOPBVYYhAmQXz52ZLwS5INbvQjQPX3xG24P5N2cBrkqYxacJ5kcHNLos26IvfOsI CQHL15LQFErm2Oe3n5VQ7pPtSB7IyJuV7X8PtzEIg4TTT4P5g3aNzg3ZAfE4vmWmJrRC ugYyHnsVy8KJNGrDMfKgVAFlC1+522pFkvAE0exJZ5PHMV0T7RCbGgUFVk42Dw0kAm07 RL9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=n6T9u4iC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b10-20020a63d30a000000b00446ec91cdd8si19470714pgg.604.2022.10.19.02.25.38; Wed, 19 Oct 2022 02:25: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=n6T9u4iC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233152AbiJSJRw (ORCPT + 99 others); Wed, 19 Oct 2022 05:17:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233612AbiJSJP1 (ORCPT ); Wed, 19 Oct 2022 05:15:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FE32A8794; Wed, 19 Oct 2022 02:06: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 F2ECB61843; Wed, 19 Oct 2022 09:02:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16ED7C4314C; Wed, 19 Oct 2022 09:02:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170151; bh=pCi2CnpLXCNPWmrEJl7lbBc+7SY2enWuUJG3lZBk1PE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n6T9u4iCaSJ5S4q9mdWmNYxNrpxWQCwdgBtgF3XNNS3mQVG+cIfhj9vUF24Pyzl7f bkyGme7uI+SlNqBQ1yK57SgNldaA7V2Jh1wAxyImAm9FvYQHS+1/iUtGJfaiSuQQ9m u9YQjI/pbO2C2R12Dnqk9r+PAboiFLAB/t231AlE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jens Axboe , Sasha Levin Subject: [PATCH 6.0 546/862] io_uring/fdinfo: fix sqe dumping for IORING_SETUP_SQE128 Date: Wed, 19 Oct 2022 10:30:33 +0200 Message-Id: <20221019083314.075537817@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747107501420540704?= X-GMAIL-MSGID: =?utf-8?q?1747107501420540704?= From: Jens Axboe [ Upstream commit 3b8fdd1dc35e395d19efbc8391a809a5b954ecf4 ] If we have doubly sized SQEs, then we need to shift the sq index by 1 to account for using two entries for a single request. The CQE dumping gets this right, but the SQE one does not. Improve the SQE dumping in general, the information dumped is pretty sparse and doesn't even cover the whole basic part of the SQE. Include information on the extended part of the SQE, if doubly sized SQEs are in use. A typical dump now looks like the following: [...] SQEs: 32 32: opcode:URING_CMD, fd:0, flags:1, off:3225964160, addr:0x0, rw_flags:0x0, buf_index:0 user_data:2721, e0:0x0, e1:0xffffb8041000, e2:0x100000000000, e3:0x5500, e4:0x7, e5:0x0, e6:0x0, e7:0x0 33: opcode:URING_CMD, fd:0, flags:1, off:3225964160, addr:0x0, rw_flags:0x0, buf_index:0 user_data:2722, e0:0x0, e1:0xffffb8043000, e2:0x100000000000, e3:0x5508, e4:0x7, e5:0x0, e6:0x0, e7:0x0 34: opcode:URING_CMD, fd:0, flags:1, off:3225964160, addr:0x0, rw_flags:0x0, buf_index:0 user_data:2723, e0:0x0, e1:0xffffb8045000, e2:0x100000000000, e3:0x5510, e4:0x7, e5:0x0, e6:0x0, e7:0x0 [...] Fixes: ebdeb7c01d02 ("io_uring: add support for 128-byte SQEs") Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- io_uring/fdinfo.c | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/io_uring/fdinfo.c b/io_uring/fdinfo.c index b29e2d02216f..6d4cc7a92724 100644 --- a/io_uring/fdinfo.c +++ b/io_uring/fdinfo.c @@ -60,6 +60,7 @@ static __cold void __io_uring_show_fdinfo(struct io_ring_ctx *ctx, unsigned int cq_head = READ_ONCE(r->cq.head); unsigned int cq_tail = READ_ONCE(r->cq.tail); unsigned int cq_shift = 0; + unsigned int sq_shift = 0; unsigned int sq_entries, cq_entries; bool has_lock; bool is_cqe32 = (ctx->flags & IORING_SETUP_CQE32); @@ -67,6 +68,8 @@ static __cold void __io_uring_show_fdinfo(struct io_ring_ctx *ctx, if (is_cqe32) cq_shift = 1; + if (ctx->flags & IORING_SETUP_SQE128) + sq_shift = 1; /* * we may get imprecise sqe and cqe info if uring is actively running @@ -82,19 +85,36 @@ static __cold void __io_uring_show_fdinfo(struct io_ring_ctx *ctx, seq_printf(m, "CqHead:\t%u\n", cq_head); seq_printf(m, "CqTail:\t%u\n", cq_tail); seq_printf(m, "CachedCqTail:\t%u\n", ctx->cached_cq_tail); - seq_printf(m, "SQEs:\t%u\n", sq_tail - ctx->cached_sq_head); + seq_printf(m, "SQEs:\t%u\n", sq_tail - sq_head); sq_entries = min(sq_tail - sq_head, ctx->sq_entries); for (i = 0; i < sq_entries; i++) { unsigned int entry = i + sq_head; - unsigned int sq_idx = READ_ONCE(ctx->sq_array[entry & sq_mask]); struct io_uring_sqe *sqe; + unsigned int sq_idx; + sq_idx = READ_ONCE(ctx->sq_array[entry & sq_mask]); if (sq_idx > sq_mask) continue; - sqe = &ctx->sq_sqes[sq_idx]; - seq_printf(m, "%5u: opcode:%d, fd:%d, flags:%x, user_data:%llu\n", - sq_idx, sqe->opcode, sqe->fd, sqe->flags, - sqe->user_data); + sqe = &ctx->sq_sqes[sq_idx << 1]; + seq_printf(m, "%5u: opcode:%s, fd:%d, flags:%x, off:%llu, " + "addr:0x%llx, rw_flags:0x%x, buf_index:%d " + "user_data:%llu", + sq_idx, io_uring_get_opcode(sqe->opcode), sqe->fd, + sqe->flags, (unsigned long long) sqe->off, + (unsigned long long) sqe->addr, sqe->rw_flags, + sqe->buf_index, sqe->user_data); + if (sq_shift) { + u64 *sqeb = (void *) (sqe + 1); + int size = sizeof(struct io_uring_sqe) / sizeof(u64); + int j; + + for (j = 0; j < size; j++) { + seq_printf(m, ", e%d:0x%llx", j, + (unsigned long long) *sqeb); + sqeb++; + } + } + seq_printf(m, "\n"); } seq_printf(m, "CQEs:\t%u\n", cq_tail - cq_head); cq_entries = min(cq_tail - cq_head, ctx->cq_entries); From patchwork Wed Oct 19 08:30:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4923 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225843wrs; Wed, 19 Oct 2022 02:44:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM65XzrDRkabfpywwXcNS01EoYKkt/3UOdBH2z7fzT2Lac64+qeVNC/w6KtJ7TPPRI9oah58 X-Received: by 2002:a17:907:3ea7:b0:78d:cb74:3d1f with SMTP id hs39-20020a1709073ea700b0078dcb743d1fmr6054891ejc.483.1666172650251; Wed, 19 Oct 2022 02:44:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172650; cv=none; d=google.com; s=arc-20160816; b=OBRd2vFtJAK1Tc2iazMFCBmOS9BjVtqD+SFxnmbTmbHql/zLkg1Gb6S05D0orYvoZg TBYpL/SttMCpvd5AheJRZZO+yjxUC7v27uAVa2PhNaGX0zO8ZHoy9FlyjijhD/YOAj1A sqwHOLepY1uA+CVVf5h95vlJBAYYpfMnszRm3pUyaACKe3R4bB7SMua/taw9Wm3GYA6I LJtAgDfxcBYOZtHf4hoC73ba3hhPuUNk9BLMYHiLeRX6O8Xpz7KGOK2yiUJqk5KQZPPO WupI4+lpExTtQWivElYr2xBTjs96v3a8wDkFEUbi8/fRDkOFt7kfR4t6vzJztEhyL5aR VyQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kXK7Kg1sitz6gVQQCIRVGUXDPSpAuQwxrs5gca//c1k=; b=Q7Oaka3lDaMRQ9ptCg8COVlBmbb54yTm6XnpyWO5BILDA9Hh3miPgxkfYM5hou3KnR lKuOSIKGStRTZPcuxM1Agda7ISxDIf9zlwqDJCkcoEjwiTJrStsdkuBtCXupZleHs51V +j+a8YSSRCca2ZnfDxqjO5c2iYcMxe9ig62D+lAcvXtg4RVaGmz+66fb2fTa/yl+QaAk zzhUT0m2w5qjCTcj+mONk+PmCIHHTjRBqc/V+tRUrjyJOykYe1z4ZOYAVUD+O/tI9POl epc7kdqof3hFvTNJjCMX/9wQ585rzDgm3HDisr6IB5CaPsFwqqUx3LxCLtFkhFUnBf5l /Eyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qHyfjAam; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a19-20020a509b53000000b0045713c5c784si12916343edj.127.2022.10.19.02.43.36; Wed, 19 Oct 2022 02: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=qHyfjAam; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233962AbiJSJg4 (ORCPT + 99 others); Wed, 19 Oct 2022 05:36:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233972AbiJSJaH (ORCPT ); Wed, 19 Oct 2022 05:30:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28D22EB752; Wed, 19 Oct 2022 02:13:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8FA6F617D1; Wed, 19 Oct 2022 09:02:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A2203C43470; Wed, 19 Oct 2022 09:02:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170154; bh=Fbe3KMtCdsW7s2zZrX5blXwHhz1QzTcZnQm6f1z/NVM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qHyfjAamgIDObNW3C+qYaKh5xF9vC8pUq+q4WjLNbbdUT0Ssl+r37FGTZfJXm1+/q lr6wfogzXrKBTH1NCJeV4QekPj/AC+jhAdl5TLVmgQPZYfAH7LYeXxubrCvxTI0tDH ldUC7q1DX/GvZahoSsH/NJTdu2bIKqFidn3WIxbo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Kelley , Guoqing Jiang , Saurabh Sengar , Song Liu , Sasha Levin Subject: [PATCH 6.0 547/862] md: Replace snprintf with scnprintf Date: Wed, 19 Oct 2022 10:30:34 +0200 Message-Id: <20221019083314.124312910@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108652982051177?= X-GMAIL-MSGID: =?utf-8?q?1747108652982051177?= From: Saurabh Sengar [ Upstream commit 1727fd5015d8f93474148f94e34cda5aa6ad4a43 ] Current code produces a warning as shown below when total characters in the constituent block device names plus the slashes exceeds 200. snprintf() returns the number of characters generated from the given input, which could cause the expression “200 – len” to wrap around to a large positive number. Fix this by using scnprintf() instead, which returns the actual number of characters written into the buffer. [ 1513.267938] ------------[ cut here ]------------ [ 1513.267943] WARNING: CPU: 15 PID: 37247 at /lib/vsprintf.c:2509 vsnprintf+0x2c8/0x510 [ 1513.267944] Modules linked in: [ 1513.267969] CPU: 15 PID: 37247 Comm: mdadm Not tainted 5.4.0-1085-azure #90~18.04.1-Ubuntu [ 1513.267969] Hardware name: Microsoft Corporation Virtual Machine/Virtual Machine, BIOS Hyper-V UEFI Release v4.1 05/09/2022 [ 1513.267971] RIP: 0010:vsnprintf+0x2c8/0x510 <-snip-> [ 1513.267982] Call Trace: [ 1513.267986] snprintf+0x45/0x70 [ 1513.267990] ? disk_name+0x71/0xa0 [ 1513.267993] dump_zones+0x114/0x240 [raid0] [ 1513.267996] ? _cond_resched+0x19/0x40 [ 1513.267998] raid0_run+0x19e/0x270 [raid0] [ 1513.268000] md_run+0x5e0/0xc50 [ 1513.268003] ? security_capable+0x3f/0x60 [ 1513.268005] do_md_run+0x19/0x110 [ 1513.268006] md_ioctl+0x195e/0x1f90 [ 1513.268007] blkdev_ioctl+0x91f/0x9f0 [ 1513.268010] block_ioctl+0x3d/0x50 [ 1513.268012] do_vfs_ioctl+0xa9/0x640 [ 1513.268014] ? __fput+0x162/0x260 [ 1513.268016] ksys_ioctl+0x75/0x80 [ 1513.268017] __x64_sys_ioctl+0x1a/0x20 [ 1513.268019] do_syscall_64+0x5e/0x200 [ 1513.268021] entry_SYSCALL_64_after_hwframe+0x44/0xa9 Fixes: 766038846e875 ("md/raid0: replace printk() with pr_*()") Reviewed-by: Michael Kelley Acked-by: Guoqing Jiang Signed-off-by: Saurabh Sengar Signed-off-by: Song Liu Signed-off-by: Sasha Levin --- drivers/md/raid0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index 78addfe4a0c9..857c49399c28 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c @@ -47,7 +47,7 @@ static void dump_zones(struct mddev *mddev) int len = 0; for (k = 0; k < conf->strip_zone[j].nb_dev; k++) - len += snprintf(line+len, 200-len, "%s%pg", k?"/":"", + len += scnprintf(line+len, 200-len, "%s%pg", k?"/":"", conf->devlist[j * raid_disks + k]->bdev); pr_debug("md: zone%d=[%s]\n", j, line); From patchwork Wed Oct 19 08: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: 4882 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225416wrs; Wed, 19 Oct 2022 02:43:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5oiNvfCZ1Eaz7oDbvqVRMdlShejMnI5bHdQBTJ6nvVd/G7MP78N6XSv+4KFUlyIJ3bVmEo X-Received: by 2002:a05:6402:298d:b0:451:5fc5:d423 with SMTP id eq13-20020a056402298d00b004515fc5d423mr6498016edb.102.1666172587720; Wed, 19 Oct 2022 02:43:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172587; cv=none; d=google.com; s=arc-20160816; b=f2aPFCN8whs59+FJQz8Mhw2OLRv4kLFL8D6HdickiqQf34rLr6a02KLOwcd0sXXjE6 w2CrrugbcEuDY8fgwO58QH5eyj7tbZAYxRhdnr/VXOI5px89V/3N8axSqamS40EP+PnS DEoyq1O87lSgpMYvHq0CYzmLjRpismmTq5+tpcKB/P0nn8VWfQtGv+uvx2WIlnHezmvI hEB5S8bNtIspoO184+/RdfWlU3iskyiVd3wpR+ORRB3+stsi5r9DPO+urskvO+sNOYz3 K0XQGoxjHykahnanl/RWj9FH3sfsSOFv4f26+RrWgpyKfP9krmNAN8cOqXQVcTa8EOSZ j1sQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uhyi8XXKLwO1H/adyFrV+0kKmWa7eXtGrU1+aQbBBmc=; b=VewIgMpKwlxnCF9VbDCoVRHSkGQcLBgFgqtZr31NejYXH9dYcDA4diAHE9dvnnTAUs BDFNNXWZBC6ohCtH6uzTyK/poxUh4akEV+d0HLaYWZmPEGwQzbfrchjbNSp0UY7X7QVE SynyXPC1VG9UezVB0puaWt9QP+ftYg+HwaAAQ1MGQpRzcx9bohwzndcud+jLAGtP3Y7+ JNT0KAzWWgDBS90AxQ5TzvmbZYuzSk0Knt8rEmdCp+0gTnEei/qZBvrN7X6bBRJaV8pr QP3mUom6B1Z4Ubu4zf/14SjWMrPkeSF86UR8waF3e9OpbcVt6iVG/TXwajrVLgJzAlfv 0s0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BVLNy6Hq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f10-20020a0564021e8a00b0045d29efdb5esi14567662edf.381.2022.10.19.02.42.42; Wed, 19 Oct 2022 02:43: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=BVLNy6Hq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233836AbiJSJdB (ORCPT + 99 others); Wed, 19 Oct 2022 05:33:01 -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 S233690AbiJSJ3G (ORCPT ); Wed, 19 Oct 2022 05:29:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8707AEA357; Wed, 19 Oct 2022 02:12: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 2D76A6182C; Wed, 19 Oct 2022 09:02:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41B0CC433C1; Wed, 19 Oct 2022 09:02:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170156; bh=HvN8GzZzETVsezl8m80/slKJZZivatHf2m1FWyT3bAU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BVLNy6HqLTSizp/hM1eb2wflGI21Ot6CA1A4HzVgRm/vqcDldN8lwST1etqf7fWzM YomQgjDMWYRgW4n5I8qO5uWYzcc1XPd9aC3U3c4A6nqqnucZ2qT468JwA2mJZ/cPSA 7TUhDCXFO5RfzVZUtuRntJeRFL/r78GDuRzVmjbk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Song Liu , Logan Gunthorpe , Sasha Levin Subject: [PATCH 6.0 548/862] md/raid5: Ensure stripe_fill happens on non-read IO with journal Date: Wed, 19 Oct 2022 10:30:35 +0200 Message-Id: <20221019083314.173964506@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108587451006035?= X-GMAIL-MSGID: =?utf-8?q?1747108587451006035?= From: Logan Gunthorpe [ Upstream commit e2eed85bc75138a9eeb63863d20f8904ac42a577 ] When doing degrade/recover tests using the journal a kernel BUG is hit at drivers/md/raid5.c:4381 in handle_parity_checks5(): BUG_ON(!test_bit(R5_UPTODATE, &dev->flags)); This was found to occur because handle_stripe_fill() was skipped for stripes in the journal due to a condition in that function. Thus blocks were not fetched and R5_UPTODATE was not set when the code reached handle_parity_checks5(). To fix this, don't skip handle_stripe_fill() unless the stripe is for read. Fixes: 07e83364845e ("md/r5cache: shift complex rmw from read path to write path") Link: https://lore.kernel.org/linux-raid/e05c4239-41a9-d2f7-3cfa-4aa9d2cea8c1@deltatee.com/ Suggested-by: Song Liu Signed-off-by: Logan Gunthorpe Signed-off-by: Song Liu Signed-off-by: Sasha Levin --- drivers/md/raid5.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 31a0cbf63384..4ec33fd62018 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -4047,7 +4047,7 @@ static void handle_stripe_fill(struct stripe_head *sh, * back cache (prexor with orig_page, and then xor with * page) in the read path */ - if (s->injournal && s->failed) { + if (s->to_read && s->injournal && s->failed) { if (test_bit(STRIPE_R5C_CACHING, &sh->state)) r5c_make_stripe_write_out(sh); goto out; From patchwork Wed Oct 19 08: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: 5149 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp253380wrs; Wed, 19 Oct 2022 03:57:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM451dgKewnOCS7qy3Gd8aRioC3dYT2RTX+dBWgfqY5XtoJizygP8qKXcksa3XtM3hMu7FiR X-Received: by 2002:a17:907:1deb:b0:78d:4a0e:f654 with SMTP id og43-20020a1709071deb00b0078d4a0ef654mr6289436ejc.757.1666177026949; Wed, 19 Oct 2022 03:57:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666177026; cv=none; d=google.com; s=arc-20160816; b=WN+SrqS+qU5HR+tiUOjg0Ui4vKYxkLgfuU9Ky2wXcWAB/u87ujvk5Ux05W+w1W4P8e /RoknxuL4IM3VP/AmCa5i/I+MnCW+j73lG902k/kK+GPdUF1jQN5aSFKIdu6kCz5cXNO ULrR/H044RSRLcC3p/R/T7DEvhjFQgygvxKjIa4hYXSOR1gZf6BUzgD+z+cQR/jkaQ1J te0X+uGFGedJfxiBe1opZhlxGeJYv8qGowuwQgzJWl3QWsQ4TSdiuJ1ctQjucil745my YjXHAhI84QNDBqgoBDw75P1NV2Jr2HSJ9aUsKUJFQM7cGOGzVBigda/Z1yYokOXLw4MP UAjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dAvZM9bRa5mRzE4EHqZ/ch/ZhUbu3EHYD+WWakCbpkk=; b=Ckp40UrG5Yxc6RAGTd+fh8zdan4k55xvyV6wHNrc4mcEobub+b37d8vXQ5u581Lf8i ktyHhn5N7aifoSwUnvainefAdRMcuwrUk4p8OmJWJA44JkBOOCn4QeHwnmmuaFPot2L+ VR5uriyrmiukrilFZ2TygUSZwVYc7K6wxi3BPf9pr4W9cVcuJEFjVEgTOJ41P5oPwfeK ZoifzHqQFv5VetR9sVWUX8gDTEzfoYxGVklpWf3QMl8Lur2pfkXlwM4+W+iW923OaEZr Kh99JqnsKSH5rB6H2o/OX3eZfPIPT5tfEfdm5IT4TBrkEt2dDaAd9+g5k74gfRJ2jUuo DrEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gGDjCYZ8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r23-20020a170906365700b0077951929341si12239333ejb.312.2022.10.19.03.56.40; Wed, 19 Oct 2022 03:57: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=gGDjCYZ8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231582AbiJSK4L (ORCPT + 99 others); Wed, 19 Oct 2022 06:56:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235164AbiJSKzU (ORCPT ); Wed, 19 Oct 2022 06:55:20 -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 CCC25164BD3; Wed, 19 Oct 2022 03:27: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 sin.source.kernel.org (Postfix) with ESMTPS id 4B7CCCE20FF; Wed, 19 Oct 2022 09:02:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B7FEC433D6; Wed, 19 Oct 2022 09:02:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170161; bh=xQdewhot8li4sCHLPZ88DG2+NEfVO7ps6WCDAPXebyU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gGDjCYZ8ZgZ6uHJuEdDDyzH8pFHHHmx1KlcNXlscixU5qxB+k1JqN75HnJiEh3w0W kdvqBSsXFI4zN2oWr/AhzxQc1mcmeTEbcV5GFHyGCEKVUFZnJ3He1/VErcWxpHQ3E0 JV5Zgyzx0XdudFugToso9uoMEhbhUjtjFfhthLLY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Sloan , Logan Gunthorpe , Christoph Hellwig , Guoqing Jiang , Song Liu , Sasha Levin Subject: [PATCH 6.0 549/862] md/raid5: Remove unnecessary bio_put() in raid5_read_one_chunk() Date: Wed, 19 Oct 2022 10:30:36 +0200 Message-Id: <20221019083314.222334258@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747113241961261930?= X-GMAIL-MSGID: =?utf-8?q?1747113241961261930?= From: David Sloan [ Upstream commit c66a6f41e09ad386fd2cce22b9cded837bbbc704 ] When running chunk-sized reads on disks with badblocks duplicate bio free/puts are observed: ============================================================================= BUG bio-200 (Not tainted): Object already free ----------------------------------------------------------------------------- Allocated in mempool_alloc_slab+0x17/0x20 age=3 cpu=2 pid=7504 __slab_alloc.constprop.0+0x5a/0xb0 kmem_cache_alloc+0x31e/0x330 mempool_alloc_slab+0x17/0x20 mempool_alloc+0x100/0x2b0 bio_alloc_bioset+0x181/0x460 do_mpage_readpage+0x776/0xd00 mpage_readahead+0x166/0x320 blkdev_readahead+0x15/0x20 read_pages+0x13f/0x5f0 page_cache_ra_unbounded+0x18d/0x220 force_page_cache_ra+0x181/0x1c0 page_cache_sync_ra+0x65/0xb0 filemap_get_pages+0x1df/0xaf0 filemap_read+0x1e1/0x700 blkdev_read_iter+0x1e5/0x330 vfs_read+0x42a/0x570 Freed in mempool_free_slab+0x17/0x20 age=3 cpu=2 pid=7504 kmem_cache_free+0x46d/0x490 mempool_free_slab+0x17/0x20 mempool_free+0x66/0x190 bio_free+0x78/0x90 bio_put+0x100/0x1a0 raid5_make_request+0x2259/0x2450 md_handle_request+0x402/0x600 md_submit_bio+0xd9/0x120 __submit_bio+0x11f/0x1b0 submit_bio_noacct_nocheck+0x204/0x480 submit_bio_noacct+0x32e/0xc70 submit_bio+0x98/0x1a0 mpage_readahead+0x250/0x320 blkdev_readahead+0x15/0x20 read_pages+0x13f/0x5f0 page_cache_ra_unbounded+0x18d/0x220 Slab 0xffffea000481b600 objects=21 used=0 fp=0xffff8881206d8940 flags=0x17ffffc0010201(locked|slab|head|node=0|zone=2|lastcpupid=0x1fffff) CPU: 0 PID: 34525 Comm: kworker/u24:2 Not tainted 6.0.0-rc2-localyes-265166-gf11c5343fa3f #143 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.13.0-1ubuntu1.1 04/01/2014 Workqueue: raid5wq raid5_do_work Call Trace: dump_stack_lvl+0x5a/0x78 dump_stack+0x10/0x16 print_trailer+0x158/0x165 object_err+0x35/0x50 free_debug_processing.cold+0xb7/0xbe __slab_free+0x1ae/0x330 kmem_cache_free+0x46d/0x490 mempool_free_slab+0x17/0x20 mempool_free+0x66/0x190 bio_free+0x78/0x90 bio_put+0x100/0x1a0 mpage_end_io+0x36/0x150 bio_endio+0x2fd/0x360 md_end_io_acct+0x7e/0x90 bio_endio+0x2fd/0x360 handle_failed_stripe+0x960/0xb80 handle_stripe+0x1348/0x3760 handle_active_stripes.constprop.0+0x72a/0xaf0 raid5_do_work+0x177/0x330 process_one_work+0x616/0xb20 worker_thread+0x2bd/0x6f0 kthread+0x179/0x1b0 ret_from_fork+0x22/0x30 The double free is caused by an unnecessary bio_put() in the if(is_badblock(...)) error path in raid5_read_one_chunk(). The error path was moved ahead of bio_alloc_clone() in c82aa1b76787c ("md/raid5: move checking badblock before clone bio in raid5_read_one_chunk"). The previous code checked and freed align_bio which required a bio_put. After the move that is no longer needed as raid_bio is returned to the control of the common io path which performs its own endio resulting in a double free on bad device blocks. Fixes: c82aa1b76787c ("md/raid5: move checking badblock before clone bio in raid5_read_one_chunk") Signed-off-by: David Sloan Signed-off-by: Logan Gunthorpe Reviewed-by: Christoph Hellwig Acked-by: Guoqing Jiang Signed-off-by: Song Liu Signed-off-by: Sasha Levin --- drivers/md/raid5.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 4ec33fd62018..db149d28f639 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -5542,7 +5542,6 @@ static int raid5_read_one_chunk(struct mddev *mddev, struct bio *raid_bio) if (is_badblock(rdev, sector, bio_sectors(raid_bio), &first_bad, &bad_sectors)) { - bio_put(raid_bio); rdev_dec_pending(rdev, mddev); return 0; } From patchwork Wed Oct 19 08: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: 4789 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp216020wrs; Wed, 19 Oct 2022 02:17:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6XNMrLeVQbzoV4bInv4ffQ6Kajis/ZpQwxa1Wikl62aKtggccp4E8d8XHnN3Huyiqgf5c9 X-Received: by 2002:a17:907:760c:b0:78d:b37f:5ce4 with SMTP id jx12-20020a170907760c00b0078db37f5ce4mr5722670ejc.50.1666171038089; Wed, 19 Oct 2022 02:17:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666171038; cv=none; d=google.com; s=arc-20160816; b=C+Fcea4y04FmqFzKqMM2Mn1eKAhtbf7MhWsxb8Y2t0qZZWT2Fwx5ywRpxFB8LeahUJ yyz482w/+ExCntBg8oibwJh/pTv6O+Sw11OkZ27TeD44wr2IuTeYc7Sb97iEwdJfLcFq uvI2UsIfabL69zdFBnH/dXIFNTiZomktL59JHhbSCSgrpzVoK4pDag8WiORTynccn5S/ dPzzgNLxcs5L1YqQGV4fa/VfTBgY2ZdqXmNDmxtt1DKlY8bxF0dxR/kmFchkaJuLfqum x732GQH2O7m6tfSHP7V+ZZVH8aI0IfH6rLUcmad1EEzYVEbtJaRWKu8vjmnV43Zy1fVf OWbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XU+sDPYjQ4UtInYrEI0YTJq9Fn7lYUxHmpgdNar9khE=; b=tTPhoZJHBoHZIsf7D1Vf1yzhuLUuKeYntWXjfXgYHbDZUuk1tnCEhQqHBIHI1JPtkg LipEJEgFmhryARrPCGVY2cPxVB68cAb/QczA4RR40Rs1brmoTxNuOYPVDv6f/qlcL5fH WOP8L11s1G/hOd7kfxjwk2pwHPB5F2iCcFkjwOqgW63IUPsPQ2WorLgkzBceUQOlo+zN vOawAcutMxx8HD2TxcLaQEa8TqHNZtx7yyUC+ZFbkIH4oUshcEG2qxvOSrGKn79b1tQ/ GinF27NPc5dMw7BKeWgRWzuYLP9ED1iJA6ko+lI8+lTUoj26p4dM8CcRnQYmjJo3qqqO LGVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yoRHaa9d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o13-20020a170906974d00b0078e0fd161dasi16341705ejy.87.2022.10.19.02.16.53; Wed, 19 Oct 2022 02: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=yoRHaa9d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233129AbiJSJQQ (ORCPT + 99 others); Wed, 19 Oct 2022 05:16:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233035AbiJSJN3 (ORCPT ); Wed, 19 Oct 2022 05:13:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA6C590823; Wed, 19 Oct 2022 02:03: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 1A22B61750; Wed, 19 Oct 2022 09:02:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0535DC433D6; Wed, 19 Oct 2022 09:02:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170164; bh=8jvjNDiaCdUPJjeCJK4JOqJEZvEbt3GWCTDXTZfvlps=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yoRHaa9d+kM/gv1CffIJvtcCzBVewU/cEfMMkrsT7kl+o+IQiP7ytBwgDoi3F+06b zWRaTnSeTKHI06aCT7ufVAcxkwh7vB/EIqhXd50fENjejOFCJQQ/iCZClZYHwTR0AN 0PEzKzoINSAn0jy+HmCJJ17vYcJP4zvQXD46CmUs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Logan Gunthorpe , Christoph Hellwig , Guoqing Jiang , Song Liu , Sasha Levin Subject: [PATCH 6.0 550/862] md: Remove extra mddev_get() in md_seq_start() Date: Wed, 19 Oct 2022 10:30:37 +0200 Message-Id: <20221019083314.271924843@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106962536515242?= X-GMAIL-MSGID: =?utf-8?q?1747106962536515242?= From: Logan Gunthorpe [ Upstream commit 3bfc3bcd787c48aa31e4fde4a6dfcef4cd7ee2c2 ] A regression is seen where mddev devices stay permanently after they are stopped due to an elevated reference count. This was tracked down to an extra mddev_get() in md_seq_start(). It only happened rarely because most of the time the md_seq_start() is called with a zero offset. The path with an extra mddev_get() only happens when it starts with a non-zero offset. The commit noted below changed an mddev_get() to check its success but inadvertently left the original call in. Remove the extra call. Fixes: 12a6caf27324 ("md: only delete entries from all_mddevs when the disk is freed") Signed-off-by: Logan Gunthorpe Reviewed-by: Christoph Hellwig Acked-by: Guoqing Jiang Signed-off-by: Song Liu Signed-off-by: Sasha Levin --- drivers/md/md.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/md/md.c b/drivers/md/md.c index 729be2c5296c..470a975e4be9 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -8156,7 +8156,6 @@ static void *md_seq_start(struct seq_file *seq, loff_t *pos) list_for_each(tmp,&all_mddevs) if (!l--) { mddev = list_entry(tmp, struct mddev, all_mddevs); - mddev_get(mddev); if (!mddev_get(mddev)) continue; spin_unlock(&all_mddevs_lock); From patchwork Wed Oct 19 08: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: 5419 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp316064wrs; Wed, 19 Oct 2022 06:07:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4ozBqS7fyWRpnCUw1eSiJBScUzZuLW1osQotuGz0xaxXkjm0Mo2jJ7+wkP0gYQooQr/yBq X-Received: by 2002:a17:90b:811:b0:20b:16ca:2abc with SMTP id bk17-20020a17090b081100b0020b16ca2abcmr9904631pjb.163.1666184831997; Wed, 19 Oct 2022 06:07:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666184831; cv=none; d=google.com; s=arc-20160816; b=KvSbIXBSChPIjK/wRzaF5It+DFzolUV/MlJmiLlB/raKnDZNEOetQNLa+S02fj4iPT JkYNf2tY421PtZUAqawjZY9JzrASKrkS4sKk7TsMvgRbPdueCPJ6mdmBuQ9KYwDY5jag uv4yY05jmrJuGHeTXxZIG7+Ir5KFj7tMJS9IsKDwZR2n1pI3UdutFD7xhNbciSm4eQny K+VcbLFUeFgslVOrpZsbH4AWocTt/Y7ButCVI8xkzPE1wf2V8wQqUah3ojgUqbAl+lYb o/uI4DAdtWR9ueXCn0m5Wl6SbQvwmWrkS7D6WM6wqYmMhenMaSfCPaZvVt2B8EsY9qVp vU6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XQWTFWqPdrLlJyM9kTwxE6M4jvxIaSdeF7dUraf0DXY=; b=q7rXpMYg11gr2wC77c+w2cXXy+mW+of6uAzg2zUehOSLoxfYBKiAbnnxRRqfOVW863 Lsj86KyG+UlLT6SSdezs/SfGzXD+k314pZH3rmhzeoKyhq2Nuhjy/uuWeZzeGPhquutn X2zL8Pn2jjzDpn3cF3sXjhLH+8NSLMDCeYQAmWD4+RXZQX6zBmCnqRcg/uqDNXMjk8bZ GPjYInRlJCNZR/XI9NomH4WSPVqJY+6AqZQXTkGIGWFO42CIDr3bcUvqvLsU4QeMN0MA gXSFBcnvZK3RFVjhoCp9DMHBpx1BMBFwZ9E/nuDDRNV/8LdDwFHx51F7WJI636TrzayZ yKNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rs24cvKH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 184-20020a6304c1000000b0046afcf0fa93si17926756pge.522.2022.10.19.06.06.43; Wed, 19 Oct 2022 06:07: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=rs24cvKH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231340AbiJSNDf (ORCPT + 99 others); Wed, 19 Oct 2022 09:03:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231270AbiJSNDN (ORCPT ); Wed, 19 Oct 2022 09:03:13 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3B951D440A; Wed, 19 Oct 2022 05:46:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id C51E5CE2101; Wed, 19 Oct 2022 09:02:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C416CC433D6; Wed, 19 Oct 2022 09:02:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170167; bh=PxotsaKLlKY7b4HcUMIZ3OuGfX1704mNrjuqwc66VrE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rs24cvKHcV+f0JnbBfW7wsPYqCGOtYDgsxRYng/XVx7/tnwwSz/LHgYCh4FBDPldG oXhqe/W4yAzgnKsYs6XwZfPr2RQZW8gwL9ioqqYpCxIDsTyU3CyoWHZBaF+ebjNO8z 3P31i3crlpm7aQa3+G9+eeUR1pO1edDAeVUXbcbY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Zhang , Mark Bloch , Leon Romanovsky , Sasha Levin Subject: [PATCH 6.0 551/862] RDMA/cm: Use SLID in the work completion as the DLID in responder side Date: Wed, 19 Oct 2022 10:30:38 +0200 Message-Id: <20221019083314.320395236@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747121426185524188?= X-GMAIL-MSGID: =?utf-8?q?1747121426185524188?= From: Mark Zhang [ Upstream commit b7d95040c13f61a4a6a859c5355faf583eff9658 ] The responder should always use WC's SLID as the dlid, to follow the IB SPEC section "13.5.4.2 COMMON RESPONSE ACTIONS": A responder always takes the following actions in constructing a response packet: - The SLID of the received packet is used as the DLID in the response packet. Fixes: ac3a949fb2ff ("IB/CM: Set appropriate slid and dlid when handling CM request") Signed-off-by: Mark Zhang Reviewed-by: Mark Bloch Link: https://lore.kernel.org/r/cd17c240231e059d2fc07c17dfe555d548b917eb.1662631201.git.leonro@nvidia.com Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin --- drivers/infiniband/core/cm.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c index b985e0d9bc05..5c910f5c01b3 100644 --- a/drivers/infiniband/core/cm.c +++ b/drivers/infiniband/core/cm.c @@ -1632,14 +1632,13 @@ static void cm_path_set_rec_type(struct ib_device *ib_device, u32 port_num, static void cm_format_path_lid_from_req(struct cm_req_msg *req_msg, struct sa_path_rec *primary_path, - struct sa_path_rec *alt_path) + struct sa_path_rec *alt_path, + struct ib_wc *wc) { u32 lid; if (primary_path->rec_type != SA_PATH_REC_TYPE_OPA) { - sa_path_set_dlid(primary_path, - IBA_GET(CM_REQ_PRIMARY_LOCAL_PORT_LID, - req_msg)); + sa_path_set_dlid(primary_path, wc->slid); sa_path_set_slid(primary_path, IBA_GET(CM_REQ_PRIMARY_REMOTE_PORT_LID, req_msg)); @@ -1676,7 +1675,8 @@ static void cm_format_path_lid_from_req(struct cm_req_msg *req_msg, static void cm_format_paths_from_req(struct cm_req_msg *req_msg, struct sa_path_rec *primary_path, - struct sa_path_rec *alt_path) + struct sa_path_rec *alt_path, + struct ib_wc *wc) { primary_path->dgid = *IBA_GET_MEM_PTR(CM_REQ_PRIMARY_LOCAL_PORT_GID, req_msg); @@ -1734,7 +1734,7 @@ static void cm_format_paths_from_req(struct cm_req_msg *req_msg, if (sa_path_is_roce(alt_path)) alt_path->roce.route_resolved = false; } - cm_format_path_lid_from_req(req_msg, primary_path, alt_path); + cm_format_path_lid_from_req(req_msg, primary_path, alt_path, wc); } static u16 cm_get_bth_pkey(struct cm_work *work) @@ -2148,7 +2148,7 @@ static int cm_req_handler(struct cm_work *work) if (cm_req_has_alt_path(req_msg)) work->path[1].rec_type = work->path[0].rec_type; cm_format_paths_from_req(req_msg, &work->path[0], - &work->path[1]); + &work->path[1], work->mad_recv_wc->wc); if (cm_id_priv->av.ah_attr.type == RDMA_AH_ATTR_TYPE_ROCE) sa_path_set_dmac(&work->path[0], cm_id_priv->av.ah_attr.roce.dmac); From patchwork Wed Oct 19 08: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: 4794 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp216201wrs; Wed, 19 Oct 2022 02:17:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5xQeBTIUOLqFQMpRAdO8lVRDyJRdPArtZu7n8g02/nnsqO/58ESO5UplOlpSWYcZaeRv7i X-Received: by 2002:a17:907:3e9c:b0:78d:ce8b:8548 with SMTP id hs28-20020a1709073e9c00b0078dce8b8548mr6011956ejc.427.1666171068461; Wed, 19 Oct 2022 02:17:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666171068; cv=none; d=google.com; s=arc-20160816; b=L/2dlJuLw6bgp7Jvmw14y6LYkMqNc8DCCpeHxeXnDOgLDx2QQR5hw8MQeBcUolVC5c ON2i6+qy2CrsagcG1D9uUpYISgl80VtPVAmn48kX8ReVNRLmJnMs92+hzFDhRiD9Ws6K xsCMzgjxVJ3e4V1p7EN5f7yhmh1c1hxGLYXDL10+FS3ehRlkOxyY53QxMg8lbZ3VnWPU oP4uMcCGNaPWUZZvb7BcNxS+f2SXuernEkcDm+GV2CXheBPNLSKAu5dXuDCcUth3qpBS haElU4Be6fp4bRi7gYMiI3iSioHQVuD1kOrgSuuzAbiEx39kS3qhynkO10cBpvXGZmnt 1Y4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=140KZRh9LACpHILqQQ4t5cICFNwZBFF4XqeBjeTeCTE=; b=FHCQHQI1hsXms2E6mAPb9d6C5tMFfLDJChTPP24vX+3OiRePks3OUjyqF+RXTcYnA/ +oIg+44n5UplKBar129qJ0g317E0S9K+LOr7NT21/jOUUS8OUmHsse5TUScAC9E3ThFL TtgoYwVzA9fLjFGI5RgZOKMf4XwywDSW0pPjCOIOaFXq3K8+P4ebh5q10CuatztLokDI 9kSUjHxgUrr2qzYQ3lSQSv+WmQlwKfcsduGmq6Xl3WDDvKYO8HP2GSsxfLorWYZjB//5 HIY1QuSnrKB9YnL2RbxNNM2/qGqYj1cMsZfGOxFFl266iTslpEXDpUFdifay6kGPqPa/ mMQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MZsX8dO5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170906a10600b00782e9b7305dsi11383070ejy.266.2022.10.19.02.17.23; Wed, 19 Oct 2022 02: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=MZsX8dO5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233166AbiJSJQU (ORCPT + 99 others); Wed, 19 Oct 2022 05:16:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232830AbiJSJNc (ORCPT ); Wed, 19 Oct 2022 05:13:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9AC80C90F0; Wed, 19 Oct 2022 02:03:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5934461825; Wed, 19 Oct 2022 09:02:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68E9EC433C1; Wed, 19 Oct 2022 09:02:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170169; bh=W/qDAiByOmW1Y7CEAQjz9gU5fPmSyXrCb/xo6AYIas8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MZsX8dO5AlCV60L6+yi9NXCrKorQ0FY7nuiMGCWVLTgm3jlBS1t3ulV9IMK6Sh+FE tKR4iWY9vFt9FHRbe01nWddw2pd8vGcHmYwxCVof/InQk0K/jjUYKlKOR4dxc/NVPJ NkNZ0yyDBsgO2CBCtnMbk44YkGjXntLx6H9tKgB0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daisuke Matsuda , Leon Romanovsky , Sasha Levin Subject: [PATCH 6.0 552/862] IB: Set IOVA/LENGTH on IB_MR in core/uverbs layers Date: Wed, 19 Oct 2022 10:30:39 +0200 Message-Id: <20221019083314.369588800@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106994695046939?= X-GMAIL-MSGID: =?utf-8?q?1747106994695046939?= From: Daisuke Matsuda [ Upstream commit 241f9a27e0fc0eaf23e3d52c8450f10648cd11f1 ] Set 'iova' and 'length' on ib_mr in ib_uverbs and ib_core layers to let all drivers have the members filled. Also, this commit removes redundancy in the respective drivers. Previously, commit 04c0a5fcfcf65 ("IB/uverbs: Set IOVA on IB MR in uverbs layer") changed to set 'iova', but seems to have missed 'length' and the ib_core layer at that time. Fixes: 04c0a5fcfcf65 ("IB/uverbs: Set IOVA on IB MR in uverbs layer") Signed-off-by: Daisuke Matsuda Link: https://lore.kernel.org/r/20220921080844.1616883-1-matsuda-daisuke@fujitsu.com Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin --- drivers/infiniband/core/uverbs_cmd.c | 5 ++++- drivers/infiniband/core/verbs.c | 2 ++ drivers/infiniband/hw/hns/hns_roce_mr.c | 1 - drivers/infiniband/hw/mlx4/mr.c | 1 - 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c index 046376bd68e2..4796f6a8828c 100644 --- a/drivers/infiniband/core/uverbs_cmd.c +++ b/drivers/infiniband/core/uverbs_cmd.c @@ -739,6 +739,7 @@ static int ib_uverbs_reg_mr(struct uverbs_attr_bundle *attrs) mr->uobject = uobj; atomic_inc(&pd->usecnt); mr->iova = cmd.hca_va; + mr->length = cmd.length; rdma_restrack_new(&mr->res, RDMA_RESTRACK_MR); rdma_restrack_set_name(&mr->res, NULL); @@ -861,8 +862,10 @@ static int ib_uverbs_rereg_mr(struct uverbs_attr_bundle *attrs) mr->pd = new_pd; atomic_inc(&new_pd->usecnt); } - if (cmd.flags & IB_MR_REREG_TRANS) + if (cmd.flags & IB_MR_REREG_TRANS) { mr->iova = cmd.hca_va; + mr->length = cmd.length; + } } memset(&resp, 0, sizeof(resp)); diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c index e54b3f1b730e..f8964c8cf0ad 100644 --- a/drivers/infiniband/core/verbs.c +++ b/drivers/infiniband/core/verbs.c @@ -2149,6 +2149,8 @@ struct ib_mr *ib_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, mr->pd = pd; mr->dm = NULL; atomic_inc(&pd->usecnt); + mr->iova = virt_addr; + mr->length = length; rdma_restrack_new(&mr->res, RDMA_RESTRACK_MR); rdma_restrack_parent_name(&mr->res, &pd->res); diff --git a/drivers/infiniband/hw/hns/hns_roce_mr.c b/drivers/infiniband/hw/hns/hns_roce_mr.c index 867972c2a894..dedfa56f5773 100644 --- a/drivers/infiniband/hw/hns/hns_roce_mr.c +++ b/drivers/infiniband/hw/hns/hns_roce_mr.c @@ -249,7 +249,6 @@ struct ib_mr *hns_roce_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, goto err_alloc_pbl; mr->ibmr.rkey = mr->ibmr.lkey = mr->key; - mr->ibmr.length = length; return &mr->ibmr; diff --git a/drivers/infiniband/hw/mlx4/mr.c b/drivers/infiniband/hw/mlx4/mr.c index 04a67b481608..a40bf58bcdd3 100644 --- a/drivers/infiniband/hw/mlx4/mr.c +++ b/drivers/infiniband/hw/mlx4/mr.c @@ -439,7 +439,6 @@ struct ib_mr *mlx4_ib_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, goto err_mr; mr->ibmr.rkey = mr->ibmr.lkey = mr->mmr.key; - mr->ibmr.length = length; mr->ibmr.page_size = 1U << shift; return &mr->ibmr; From patchwork Wed Oct 19 08: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: 5355 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp297276wrs; Wed, 19 Oct 2022 05:28:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7I4pCieDuHxrSKMoSbzELMyMJhqIhYI9SwQ52/1gbHV05zBZ//4ZkCiAnSo6uPrIL3lxbK X-Received: by 2002:a17:906:8a66:b0:78b:da52:b752 with SMTP id hy6-20020a1709068a6600b0078bda52b752mr6440752ejc.365.1666182523388; Wed, 19 Oct 2022 05:28:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666182523; cv=none; d=google.com; s=arc-20160816; b=HGs5syfoEwDHDy7tRNQo57kC61/I7+A16nqxfrvs8MO3xoezejDPwWvqb1z3JWNj1b n7Npd572DHA+E9DRPq7EW2zJQOzliBovuJ2iFhi0gEyClNhV2uLqBlYjH8/lwwHA5kD4 1an3123uou6DbIqsqSXKc9JIg/2FNaFS2khvQPfB7RoojhuwOZI7wmIOoMOlB6rTTL7Y 19erxGumI37vddH2OKhgygzR0XXqtRqOWa/VrqHKSOlZrYhBX/fUSonvkekar6MwpmID QM3CfDgT+yFL0E3PFdg2DliW3NxvORrxGgHsR14PS3fooZmXb50T3nV0+yPgvCRuckEa dMBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UQT/RBcMwYsllz3NtL9eyvzMx1/o4/tLqDof4NbQ7EA=; b=gRMINsIGqkOQqKDGPsy8dNcWDL/HYxYvWTomMGWaNsPQfic5oXSIXWg/NNc+NY8iX1 vpCgE6CLSzSOCq3cEwWh0UjSJDyveNenHpbnKqIEbYKOy4UYbmPbL7aWR883bSeXEQc1 hnllFOOTPra9gJGJGCzKh+CT1ChOGCye/5kUvotwdUhgPuf+tysB4y+VterA0YHEegjt 8QYR6DH9TPqHUru24aVFPuK5xadqPuY8mw57nrbccb5vElFNob6T/Yo5jrra8hWVJJKn WF4t02Wvt+JSgFnAy1an1kdUe+WU8kD3ulQEiDrmVeDvVlbP0wYfVg4wHbHsiYUveIQ2 M3aA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VQNu23nu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w10-20020a50d78a000000b004539b045326si14213785edi.417.2022.10.19.05.28.15; Wed, 19 Oct 2022 05:28: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=VQNu23nu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232988AbiJSMSW (ORCPT + 99 others); Wed, 19 Oct 2022 08:18:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232850AbiJSMRn (ORCPT ); Wed, 19 Oct 2022 08:17:43 -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 2C3B117425; Wed, 19 Oct 2022 04:53: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 A0C47B8246B; Wed, 19 Oct 2022 09:02:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 174DAC433C1; Wed, 19 Oct 2022 09:02:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170172; bh=aRoHgLT18h88Rn43em+coJfcbxqhuSaOBcPrfYQ//0Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VQNu23nuUfbrsSUPFuhHAJQNdhPAj76eIFhtPmkb5WLGv7kKAJ1kqkHarW829DXCZ zowfUp40Zw92NskT2Oxpdh9wU7ZXe2HauupsozmnLsiQKdrKsMXXJIzfMsQntdmmkm cBW15+dm4rxpoHVCLybmBjPWhHDzCEM/f2KPdjNI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Artem S. Tashkinov" , Mario Limonciello , Mathias Nyman , Sasha Levin Subject: [PATCH 6.0 553/862] xhci: Dont show warning for reinit on known broken suspend Date: Wed, 19 Oct 2022 10:30:40 +0200 Message-Id: <20221019083314.412569380@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747119005388471773?= X-GMAIL-MSGID: =?utf-8?q?1747119005388471773?= From: Mario Limonciello [ Upstream commit 484d6f7aa3283d082c87654b7fe7a7f725423dfb ] commit 8b328f8002bc ("xhci: re-initialize the HC during resume if HCE was set") introduced a new warning message when the host controller error was set and re-initializing. This is expected behavior on some designs which already set `xhci->broken_suspend` so the new warning is alarming to some users. Modify the code to only show the warning if this was a surprising behavior to the XHCI driver. Link: https://bugzilla.kernel.org/show_bug.cgi?id=216470 Fixes: 8b328f8002bc ("xhci: re-initialize the HC during resume if HCE was set") Reported-by: Artem S. Tashkinov Signed-off-by: Mario Limonciello Signed-off-by: Mathias Nyman Link: https://lore.kernel.org/r/20220921123450.671459-4-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/host/xhci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 38649284ff88..a7ef675f00fd 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -1183,7 +1183,8 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) /* re-initialize the HC on Restore Error, or Host Controller Error */ if (temp & (STS_SRE | STS_HCE)) { reinit_xhc = true; - xhci_warn(xhci, "xHC error in resume, USBSTS 0x%x, Reinit\n", temp); + if (!xhci->broken_suspend) + xhci_warn(xhci, "xHC error in resume, USBSTS 0x%x, Reinit\n", temp); } if (reinit_xhc) { From patchwork Wed Oct 19 08: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: 5455 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp329960wrs; Wed, 19 Oct 2022 06:33:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4cD5ghbTFx8zOEdXWhXh66/qB741ENywe6TSpakJ1RpjHn/+tjUzT3yrix2r5GjfSdFvgk X-Received: by 2002:a05:6a00:168e:b0:53b:3f2c:3213 with SMTP id k14-20020a056a00168e00b0053b3f2c3213mr8490434pfc.56.1666186437780; Wed, 19 Oct 2022 06:33:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666186437; cv=none; d=google.com; s=arc-20160816; b=iGrI5zD/OCJVCgrJ3bX2PqjoPuubH6/yazR6yxLaQkmMHG4CIoYYs8GCw0jdWWf1rb KMKyTQEQfPBQuZ0+Iq1S+2TebdPCcIcPUm/8B1Ccm0WxOxqQecemxEZr5jLU3VKOPXql 2WOiVFwgLH7pXlP8Z9Bz3NsTKQ5zKedLOTuxp83RldF8ZikHO19sj3b6+jxzYiiROcfn yYC99axluLTCsBMKIX8e+X/iJ3eCIArJaVQFsbRH4zORAtJPeUEBTF2ghYNZXe2kEZbn u05PJsXfzHjitos5TbNONNVJap+yiFSNMY08iCY1fVhw0oyeUTHhqzLaoIMyY1mSbL1a Ezuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GopUa9vsr1OxMVWo981lkrXIwnEQVOtAvY4d/Qv/5AE=; b=UX/OqM34WiMvsekAjiE4VepqlH2BC68HftorJ4tBpjW/xhkVGoaWc9EXfl41eMMxbv NekEFy8wD8LLWdNh2XcSbS8jdfus/GUOj4HrY359jWNufdNIzLkosQKWzOu9q5AlbRwZ 7kxTfKSus3x1I2BLYiMP2OZcVuHpmd7K59tqAxCZmle4SVwdSP5ExDt9s/tJKMqvL4gx 3VS7yc8gAZjwzhROKO5GK8GOKZyLO2hI3Zi3fQ/npF822RNRzYgDwQQiDN7alCB74gOH GUEvxIWs1Qch1xPJ2JXRIAXLk9lBh+qaZYuSjyEa/qX7eq9yfN7bO/Y115lLEXfq/hw8 kjFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TgB+xAWd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f23-20020a17090aa79700b0020b07bfc54esi21819248pjq.108.2022.10.19.06.33.44; Wed, 19 Oct 2022 06:33: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=TgB+xAWd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232271AbiJSNVO (ORCPT + 99 others); Wed, 19 Oct 2022 09:21:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231607AbiJSNUn (ORCPT ); Wed, 19 Oct 2022 09:20:43 -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 AE60DFC1D0; Wed, 19 Oct 2022 06:06: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 4AAF5B8246D; Wed, 19 Oct 2022 09:02:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A73FDC433D6; Wed, 19 Oct 2022 09:02:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170175; bh=0yp0MeoCQn55dZ0Ly+Cfe8r8xQVfv9yqt30m368kJ1M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TgB+xAWdEjxjpbt4FFdSu7fwAD//sYyPQy40yATI72Q9z7kL+CfaZxLnYcKTiSaff pPvQI8B2wTDcUz56uN1yIcbbNorm/0M49lqFjoGeO91dA1ZjTc0GaJ9ouLdD1h4Jtl KKuTzAs0OucmyS4IxNmTylz2NoAozoRgAiS4vB9I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Albert Briscoe , Sasha Levin Subject: [PATCH 6.0 554/862] usb: gadget: function: fix dangling pnp_string in f_printer.c Date: Wed, 19 Oct 2022 10:30:41 +0200 Message-Id: <20221019083314.455865060@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123110056670408?= X-GMAIL-MSGID: =?utf-8?q?1747123110056670408?= From: Albert Briscoe [ Upstream commit 24b7ba2f88e04800b54d462f376512e8c41b8a3c ] When opts->pnp_string is changed with configfs, new memory is allocated for the string. It does not, however, update dev->pnp_string, even though the memory is freed. When rquesting the string, the host then gets old or corrupted data rather than the new string. The ieee 1284 id string should be allowed to change while the device is connected. The bug was introduced in commit fdc01cc286be ("usb: gadget: printer: Remove pnp_string static buffer"), which changed opts->pnp_string from a char[] to a char*. This patch changes dev->pnp_string from a char* to a char** pointing to opts->pnp_string. Fixes: fdc01cc286be ("usb: gadget: printer: Remove pnp_string static buffer") Signed-off-by: Albert Briscoe Link: https://lore.kernel.org/r/20220911223753.20417-1-albertsbriscoe@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/gadget/function/f_printer.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/usb/gadget/function/f_printer.c b/drivers/usb/gadget/function/f_printer.c index abec5c58f525..a881c69b1f2b 100644 --- a/drivers/usb/gadget/function/f_printer.c +++ b/drivers/usb/gadget/function/f_printer.c @@ -89,7 +89,7 @@ struct printer_dev { u8 printer_cdev_open; wait_queue_head_t wait; unsigned q_len; - char *pnp_string; /* We don't own memory! */ + char **pnp_string; /* We don't own memory! */ struct usb_function function; }; @@ -1000,16 +1000,16 @@ static int printer_func_setup(struct usb_function *f, if ((wIndex>>8) != dev->interface) break; - if (!dev->pnp_string) { + if (!*dev->pnp_string) { value = 0; break; } - value = strlen(dev->pnp_string); + value = strlen(*dev->pnp_string); buf[0] = (value >> 8) & 0xFF; buf[1] = value & 0xFF; - memcpy(buf + 2, dev->pnp_string, value); + memcpy(buf + 2, *dev->pnp_string, value); DBG(dev, "1284 PNP String: %x %s\n", value, - dev->pnp_string); + *dev->pnp_string); break; case GET_PORT_STATUS: /* Get Port Status */ @@ -1475,7 +1475,7 @@ static struct usb_function *gprinter_alloc(struct usb_function_instance *fi) kref_init(&dev->kref); ++opts->refcnt; dev->minor = opts->minor; - dev->pnp_string = opts->pnp_string; + dev->pnp_string = &opts->pnp_string; dev->q_len = opts->q_len; mutex_unlock(&opts->lock); From patchwork Wed Oct 19 08: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: 5371 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp300520wrs; Wed, 19 Oct 2022 05:34:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5bYtIb16szgHVcTkoLrCu1xfPt11LSq3UtorB9wYn7TYo8xZGwUlsJXfAhOEyEueyOlSy6 X-Received: by 2002:a17:903:124e:b0:178:6946:a2ba with SMTP id u14-20020a170903124e00b001786946a2bamr8123807plh.89.1666182871977; Wed, 19 Oct 2022 05:34:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666182871; cv=none; d=google.com; s=arc-20160816; b=gPzwFrmue3oNmT6ERa1RXdccM3mTMuI0/w8rYgmMbz72kzMPfkDviSYYht/vAHRgxI qC5U88wnoDPm3PiI75drkK3CJ+IfNJ6w1p+pxy7OmkfbtkvzLdwHp0K4siiIeA6ewpig BEEyYTbYQWPycqWk5xVmqgYkRFQZg0BlRRqOF3Bw4nKB7u7plAXeHp1MWXPXhxqs+T/N uMaCoHfoWxKsdi1aWAKzGMDvx5FBKtfxRoBjVNEhsJjnyY85BeZbxiwDUuB2d3J9HDig zMAfN5lDBeOrTN8Om/oU5p3Omzx1rpafmdGZBH/qmvqNiXgb3cnXZwgyvu2D0mZgyfJY 5A8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=AktuG8X1SBIue15VZejGJ55iMtm0O+7ONH48o+op19U=; b=AxttyQyMRpmc1jz8yfH0vlOJDA1VKtjrgAMQ08rYFKOACMTXC7zM3bGthmZuaQPR3r MnH7ZTlG/rkDBi3/K01+8YtiBlChTk7treElcRqYszdurWUzDBPoNWx3QfWArtXcGv5f YYf1/sRdhiQpI/0jPQls9CNh362JyYWGUzfEEijyCzvrd/xW45H4ZHaCZHIcmfqDAsLT pxezrQSL21qu7v8oMu8buc3KOee/2HfEHgSZ91UjjBbIHaZiw7pk0uq9C6hMBHc29LfP Cp1WKAdsn/XsewyK1hC6ukgETwCcCsNqSIt6TcU2cPjTdMbbWp9uO6tNEZoteddKFd+W pxSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HToKCqE5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170902d54e00b00183f6ff535dsi18272977plf.490.2022.10.19.05.34.16; Wed, 19 Oct 2022 05:34: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=HToKCqE5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231564AbiJSMVV (ORCPT + 99 others); Wed, 19 Oct 2022 08:21:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231925AbiJSMTy (ORCPT ); Wed, 19 Oct 2022 08:19:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFCEE18C427; Wed, 19 Oct 2022 04:55: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 ams.source.kernel.org (Postfix) with ESMTPS id CD978B8246E; Wed, 19 Oct 2022 09:02:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B9A1C433D6; Wed, 19 Oct 2022 09:02:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170177; bh=DmgTEDOjY1ekANe0B6+eltI6M8iO58ZnFGi/+ktAkkk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HToKCqE5MoniIQ1KWcQZtHC2Hni4vj2TIzaYuTUUhboellTy+FCHTmZjpTXfMWxAE AC9qS33+ZE04zfYGqZGD1FsqctEzkG2G6sHGka7Dpe5+qQKSHrJ4qJ/YwPmMN5sGiM YS6WUWFCV1yYd6pkrtol18VLNHidYDwH7A0cCzKk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Heikki Krogerus , Liang He , Sasha Levin Subject: [PATCH 6.0 555/862] usb: typec: anx7411: Use of_get_child_by_name() instead of of_find_node_by_name() Date: Wed, 19 Oct 2022 10:30:42 +0200 Message-Id: <20221019083314.503826672@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747119370822682074?= X-GMAIL-MSGID: =?utf-8?q?1747119370822682074?= From: Liang He [ Upstream commit e45d7337dc0e4f7f1c2876e1b22c71a544ad12fd ] In anx7411_typec_switch_probe(), we should call of_get_child_by_name() instead of of_find_node_by_name() as of_find_xxx API will decrease the refcount of the 'from' argument. Fixes: fe6d8a9c8e64 ("usb: typec: anx7411: Add Analogix PD ANX7411 support") Acked-by: Heikki Krogerus Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220915092209.4009273-1-windhl@126.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/typec/anx7411.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/typec/anx7411.c b/drivers/usb/typec/anx7411.c index c0f0842d443c..f178d0eb47b1 100644 --- a/drivers/usb/typec/anx7411.c +++ b/drivers/usb/typec/anx7411.c @@ -1105,7 +1105,7 @@ static int anx7411_typec_switch_probe(struct anx7411_data *ctx, int ret; struct device_node *node; - node = of_find_node_by_name(dev->of_node, "orientation_switch"); + node = of_get_child_by_name(dev->of_node, "orientation_switch"); if (!node) return 0; @@ -1115,7 +1115,7 @@ static int anx7411_typec_switch_probe(struct anx7411_data *ctx, return ret; } - node = of_find_node_by_name(dev->of_node, "mode_switch"); + node = of_get_child_by_name(dev->of_node, "mode_switch"); if (!node) { dev_err(dev, "no typec mux exist"); ret = -ENODEV; From patchwork Wed Oct 19 08: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: 5366 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp299554wrs; Wed, 19 Oct 2022 05:32:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM67ZOyXL/t/Szp011v7E9jFiUQSKQMxgXUFnWAV7DpM2wxaULKKNkBOD7NOT7SpS+lvB+QK X-Received: by 2002:a17:906:fe04:b0:777:b13d:30a6 with SMTP id wy4-20020a170906fe0400b00777b13d30a6mr6486347ejb.248.1666182749445; Wed, 19 Oct 2022 05:32:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666182749; cv=none; d=google.com; s=arc-20160816; b=0m5Ng07B5FaMoH4O52UngVQRAEn8AXqFLxEpwBb3hYeZeoEO7/8PUv8OIza/9qw2Mg yR3LQrbi5Z1MjzRWNmP3g2X3h7n9Kq5fV4pdky2FXv/SiTxbD/VU8eDGGkbYp73rxf8D qrRq8StvZMD/bYBbQzVkTiEd+UhCvSMtpKCTR+usVXgt8TkXIG+9y29Z2GMiDxRyCa4p OP7pK0sXcApPRDsFCibgx7DdXdeBARfb2LE9KPwMgb4KCAtXYriSfZhINcEYMNGfgG3x Myagz5dTXXXVN/oKZ4gO2Y0m1pYpW+pblmk/CgjZOQYQ7aPISjAmc9BTcDOBvRHr/L60 zCPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nVu0YmmNoBMP8YeraxqFTCj9C+CF9e5vTfj9QcuVnBM=; b=QDzDrrnFJTy5yPXcNHf48LLAAHvOaOc2nWSOQ3v7tES57j4Bf5lSpbpskyAzIyd/ff wvFvDTERx2NO9mgaiFpXDAruPlQ6+27ifJacr1Q8uZul9/VaqsqBUScu82uhNYVOCuQj iPs9b/I6brJ2yX02423txeAXj5D4llsXxmVnPf40P8vFkM46rZf7BfvY4qi8o5CyI6n5 5nWeuhrjJri4DFt3vL4ZEy1st4u8jLDeC79kDDO2cIQW0u9ULh2NwN7Tj3iKgOmn8qLV x2iaIwAkoQfrQNaLiWztUiXN6a3IHBzZZqbd6kYZFsmv5zirpj/Fo6CfzFw7YC4NTuU4 UH+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=d7MRcJF+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t25-20020a1709064f1900b00783d969f337si11386901eju.307.2022.10.19.05.32.04; Wed, 19 Oct 2022 05:32: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=d7MRcJF+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230030AbiJSMUZ (ORCPT + 99 others); Wed, 19 Oct 2022 08:20:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233213AbiJSMTK (ORCPT ); Wed, 19 Oct 2022 08:19:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5FEF1D679; Wed, 19 Oct 2022 04:54: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 982D6B82468; Wed, 19 Oct 2022 09:03:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7D41C433D6; Wed, 19 Oct 2022 09:02:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170180; bh=vsC+cg4HPLsC+F2/XwsJv30mCC9+RhZxAHJVrJ++TDg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d7MRcJF+juIjn5mdz4wynuoyeFa90P8fuAvzDnx1ybFlWwmNEDL2h8O8k+93xPGXP V1Hl+eZU40ludm//Ep3SRmM9hlaAziFTneaZpf9KwT3dkQS1T/JYgyQQhRKHuj3U29 blIsxGtedqam7KoomDBlgoFBvvb83VM5NnOvRRwM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Sasha Levin Subject: [PATCH 6.0 556/862] usb: dwc3: core: fix some leaks in probe Date: Wed, 19 Oct 2022 10:30:43 +0200 Message-Id: <20221019083314.546151210@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747119242645488265?= X-GMAIL-MSGID: =?utf-8?q?1747119242645488265?= From: Dan Carpenter [ Upstream commit 2a735e4b5580a2a6bbd6572109b4c4f163c57462 ] The dwc3_get_properties() function calls: dwc->usb_psy = power_supply_get_by_name(usb_psy_name); so there is some additional clean up required on these error paths. Fixes: 6f0764b5adea ("usb: dwc3: add a power supply for current control") Signed-off-by: Dan Carpenter Link: https://lore.kernel.org/r/YyxFYFnP53j9sCg+@kili Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/dwc3/core.c | 58 +++++++++++++++++++++++++---------------- 1 file changed, 36 insertions(+), 22 deletions(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 219d797e2230..919d36fd0298 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -1712,8 +1712,10 @@ static int dwc3_probe(struct platform_device *pdev) dwc3_get_properties(dwc); dwc->reset = devm_reset_control_array_get_optional_shared(dev); - if (IS_ERR(dwc->reset)) - return PTR_ERR(dwc->reset); + if (IS_ERR(dwc->reset)) { + ret = PTR_ERR(dwc->reset); + goto put_usb_psy; + } if (dev->of_node) { /* @@ -1723,45 +1725,57 @@ static int dwc3_probe(struct platform_device *pdev) * check for them to retain backwards compatibility. */ dwc->bus_clk = devm_clk_get_optional(dev, "bus_early"); - if (IS_ERR(dwc->bus_clk)) - return dev_err_probe(dev, PTR_ERR(dwc->bus_clk), - "could not get bus clock\n"); + if (IS_ERR(dwc->bus_clk)) { + ret = dev_err_probe(dev, PTR_ERR(dwc->bus_clk), + "could not get bus clock\n"); + goto put_usb_psy; + } if (dwc->bus_clk == NULL) { dwc->bus_clk = devm_clk_get_optional(dev, "bus_clk"); - if (IS_ERR(dwc->bus_clk)) - return dev_err_probe(dev, PTR_ERR(dwc->bus_clk), - "could not get bus clock\n"); + if (IS_ERR(dwc->bus_clk)) { + ret = dev_err_probe(dev, PTR_ERR(dwc->bus_clk), + "could not get bus clock\n"); + goto put_usb_psy; + } } dwc->ref_clk = devm_clk_get_optional(dev, "ref"); - if (IS_ERR(dwc->ref_clk)) - return dev_err_probe(dev, PTR_ERR(dwc->ref_clk), - "could not get ref clock\n"); + if (IS_ERR(dwc->ref_clk)) { + ret = dev_err_probe(dev, PTR_ERR(dwc->ref_clk), + "could not get ref clock\n"); + goto put_usb_psy; + } if (dwc->ref_clk == NULL) { dwc->ref_clk = devm_clk_get_optional(dev, "ref_clk"); - if (IS_ERR(dwc->ref_clk)) - return dev_err_probe(dev, PTR_ERR(dwc->ref_clk), - "could not get ref clock\n"); + if (IS_ERR(dwc->ref_clk)) { + ret = dev_err_probe(dev, PTR_ERR(dwc->ref_clk), + "could not get ref clock\n"); + goto put_usb_psy; + } } dwc->susp_clk = devm_clk_get_optional(dev, "suspend"); - if (IS_ERR(dwc->susp_clk)) - return dev_err_probe(dev, PTR_ERR(dwc->susp_clk), - "could not get suspend clock\n"); + if (IS_ERR(dwc->susp_clk)) { + ret = dev_err_probe(dev, PTR_ERR(dwc->susp_clk), + "could not get suspend clock\n"); + goto put_usb_psy; + } if (dwc->susp_clk == NULL) { dwc->susp_clk = devm_clk_get_optional(dev, "suspend_clk"); - if (IS_ERR(dwc->susp_clk)) - return dev_err_probe(dev, PTR_ERR(dwc->susp_clk), - "could not get suspend clock\n"); + if (IS_ERR(dwc->susp_clk)) { + ret = dev_err_probe(dev, PTR_ERR(dwc->susp_clk), + "could not get suspend clock\n"); + goto put_usb_psy; + } } } ret = reset_control_deassert(dwc->reset); if (ret) - return ret; + goto put_usb_psy; ret = dwc3_clk_enable(dwc); if (ret) @@ -1861,7 +1875,7 @@ static int dwc3_probe(struct platform_device *pdev) dwc3_clk_disable(dwc); assert_reset: reset_control_assert(dwc->reset); - +put_usb_psy: if (dwc->usb_psy) power_supply_put(dwc->usb_psy); From patchwork Wed Oct 19 08:30:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4937 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp226233wrs; Wed, 19 Oct 2022 02:45:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7GsDH1RClc5r56yBZPwvif9GAg3zwOFbz12s+DS9FSMeIemNuB+m0Au1dlI5E2Il9hlmXD X-Received: by 2002:a17:902:d2c3:b0:185:3bda:46f8 with SMTP id n3-20020a170902d2c300b001853bda46f8mr7437380plc.58.1666172720505; Wed, 19 Oct 2022 02:45:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172720; cv=none; d=google.com; s=arc-20160816; b=JwQWkwej95Ml3x1aEo8TLplAA5FyC5r/v5od9OCy32AL+E2xwzviFW8UyJ5r18OsIN +kmV1Rp1eldD+lgf+/ErCK30r33EEu7NyoecZTSQ0p5TVC7rx4DmglSNNvgWVTCKkVGM El77awtT6hzUYWkwzqb25pRTJ/rU1BHxwc49A04B2z3dMF1JkG7HBXaj2rkzLvv/8ckC R40MsZHElWcpj7FU+DWcG32nYon1NrR2ew7Rm2ebNYTEw2GJsjNziYYAZaySe/8ABWED ZjD53gwvDv5Q4vFTF9KX0td45Wck0bxbpLJE2/QjIc5mOeiMVWWq1rFqop8ZmIklpVm5 60yQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VN/ZhL/+2gwdWZCCCXosWejfzSNh7KUdlyhVqIkn4qE=; b=vUr68C2SCx+XfD702zR1gkWa8bowS46VJQo4C+gvGux5iFab4S7WX1SHSPtSE+l2nb GBYIznS42MrCfh/WUeTB2vndd0L8VkhyaT6g0KpbMrc+yaCcYeq9B1bMmkwisCYituWe e4/6x56+5LIobEjjYAwmQWGKi5WrAKu4YEhcRSS1ifw7j+rHUQ/CfFX5lmpRF9M1HcPI DJ11/lpl24K35Req78B8s7lHhvzRL0RCEe67g+YYxTxxYQer4qTh3zGcZX0ntbm8dTw7 mLvzTWs+gBagy2LEBHSMoCxNRg/Zf+CjS96aNtxUP9mZXLKTfkXi5HSJokVz8AqMJG+X Mh8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ckOTFgtc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o23-20020a639217000000b00434d4a0be40si18978862pgd.589.2022.10.19.02.45.04; Wed, 19 Oct 2022 02:45:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ckOTFgtc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233617AbiJSJd0 (ORCPT + 99 others); Wed, 19 Oct 2022 05:33:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233706AbiJSJ3J (ORCPT ); Wed, 19 Oct 2022 05:29:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B03FEE9840; Wed, 19 Oct 2022 02:12: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 98B5E6170D; Wed, 19 Oct 2022 09:03:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE16BC433D6; Wed, 19 Oct 2022 09:03:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170183; bh=7DGMLTKFsU7+7Ad+NpWJf8+q3b2TJwi8QfsrxUDd5oo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ckOTFgtcUZD80Rai45v3NCemAHznQ9lL6rqElUH8/scEYfm/CyVN3nyrI5P70hYTH cVIBTC2Mh7Lze7YpvjBnce2IfUUz0hh3cd5Ss/kAo/Lmx7/Ok232KQkE9Ugz/2i2Oc GnEFqn2T/EXf69o69y4PkdTAqNv2gvgQ1PI+tYLw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Sasha Levin Subject: [PATCH 6.0 557/862] drivers: serial: jsm: fix some leaks in probe Date: Wed, 19 Oct 2022 10:30:44 +0200 Message-Id: <20221019083314.583713096@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108726514951802?= X-GMAIL-MSGID: =?utf-8?q?1747108726514951802?= 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 0ea799bf8dbb..417a5b6bffc3 100644 --- a/drivers/tty/serial/jsm/jsm_driver.c +++ b/drivers/tty/serial/jsm/jsm_driver.c @@ -211,7 +211,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 Wed Oct 19 08:30:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5305 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp283074wrs; Wed, 19 Oct 2022 05:04:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6KrgSgZw0xUPdMMxdj9oGkHwgZGI9r8i+OZThwzGTfKsTHjtTzzOOqg4sIMkPFHSCuEIzn X-Received: by 2002:a17:90a:5892:b0:20a:9cf5:c13c with SMTP id j18-20020a17090a589200b0020a9cf5c13cmr44588484pji.63.1666181046174; Wed, 19 Oct 2022 05:04:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666181046; cv=none; d=google.com; s=arc-20160816; b=wAGqtTbM7RatAd8xlzYHW+e3clSn4A7kr3x+KACQlPRkmADIQBgcGiXhw7qQDhU+pY 5NB8LG60gmosGIw3poSQhV/B4p1Il9zAHlQs67WrlPcAeiiB3x7rx5/JJAlX0Ptdrmki LMl8tfavVvl2c+q4a3G8Qc5UczFrLOL7Q0hcmUfgnDxA1bw0e0x6DXZX/lPeu6A6ZrpL p/9paPsn/zYwxFlFsCvKoDgfFQ4U/BWbCgn/s6/mlrfYI7SidfMkt35r/6zlD/KGtrIm 5jT746qBacwZfZcz9slk+JaQUGAS6l+MeSCZYmjYz/QnVtFOEJMO2tzW5W+dF4lpKe6a n5OA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=14T4q1lFI1wqkyv65wngqokQtKvzRgmO6XhhkEPG7Kg=; b=crJwVx74yuNi7LpRkfdxfHvZi0219U/Cj3KV7U957LyzZptgCnC+Gb93jfbk9ILBtH XcowcWJGmR/s8muYOpjhVNo7WXzuj7SDH+ZeJ4igODRl5Q+r8zARz3qwAFezGdm7hNtM 2i06xLnkebuMP2eM8L0TWUZJhT2zD5gYSit3o7RB0m6JwWkeiGlG4oT4IGO1VcukhdhQ bkosmcR7/y2oIPZ8gq1HiW802PpHMX+OrN6BTz76ODG6BLiZgslc6Y1b9Jh4455gg+kz i/xZJsLLwt79fTPOTGGVZutT+TBth+vNpCslF389sS6ox22koWKASSs+UxE/d0Ag0MDS Du4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xyd2Dk+l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l1-20020a17090270c100b0017d9b373175si756089plt.415.2022.10.19.05.03.50; Wed, 19 Oct 2022 05:04: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=xyd2Dk+l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231932AbiJSL4c (ORCPT + 99 others); Wed, 19 Oct 2022 07:56:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231533AbiJSLzW (ORCPT ); Wed, 19 Oct 2022 07:55:22 -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 CCCBC17C578; Wed, 19 Oct 2022 04:34: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 sin.source.kernel.org (Postfix) with ESMTPS id 93924CE2174; Wed, 19 Oct 2022 09:05:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91803C433C1; Wed, 19 Oct 2022 09:05:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170306; bh=kSZdv4FoXcAAE+q8B1CSVisl+kDNlN8+saXkHJNVcu4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xyd2Dk+llinVED/BK+KIt4uE+hOLfE1iyi3n4D1lG/UJKM8dn9p34n0gSca465gJV 8svXBatJxaEeLOmNVYUeKrED8dGw1/X/WMMRdw3T27E8xmhpJtT0uBJQKCPZmv4BXF 0I20zWUlykGlpLi/C/baX5NRKh40AJRNjhwbkRRw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lennert Buytenhek , Andy Shevchenko , =?utf-8?q?Ilpo_J=C3=A4?= =?utf-8?q?rvinen?= , Sasha Levin Subject: [PATCH 6.0 558/862] serial: 8250: Toggle IER bits on only after irq has been set up Date: Wed, 19 Oct 2022 10:30:45 +0200 Message-Id: <20221019083314.632660731@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747117456439057573?= X-GMAIL-MSGID: =?utf-8?q?1747117456439057573?= From: Ilpo Järvinen [ Upstream commit 039d4926379b1d1c17b51cf21c500a5eed86899e ] Invoking TIOCVHANGUP on 8250_mid port on Ice Lake-D and then reopening the port triggers these faults during serial8250_do_startup(): DMAR: DRHD: handling fault status reg 3 DMAR: [DMA Write NO_PASID] Request device [00:1a.0] fault addr 0x0 [fault reason 0x05] PTE Write access is not set If the IRQ hasn't been set up yet, the UART will have zeroes in its MSI address/data registers. Disabling the IRQ at the interrupt controller won't stop the UART from performing a DMA write to the address programmed in its MSI address register (zero) when it wants to signal an interrupt. The UARTs (in Ice Lake-D) implement PCI 2.1 style MSI without masking capability, so there is no way to mask the interrupt at the source PCI function level, except disabling the MSI capability entirely, but that would cause it to fall back to INTx# assertion, and the PCI specification prohibits disabling the MSI capability as a way to mask a function's interrupt service request. The MSI address register is zeroed by the hangup as the irq is freed. The interrupt is signalled during serial8250_do_startup() performing a THRE test that temporarily toggles THRI in IER. The THRE test currently occurs before UART's irq (and MSI address) is properly set up. Refactor serial8250_do_startup() such that irq is set up before the THRE test. The current irq setup code is intermixed with the timer setup code. As THRE test must be performed prior to the timer setup, extract it into own function and call it only after the THRE test. The ->setup_timer() needs to be part of the struct uart_8250_ops in order to not create circular dependency between 8250 and 8250_base modules. Fixes: 40b36daad0ac ("[PATCH] 8250 UART backup timer") Reported-by: Lennert Buytenhek Tested-by: Lennert Buytenhek Reviewed-by: Andy Shevchenko Signed-off-by: Ilpo Järvinen Link: https://lore.kernel.org/r/20220922070005.2965-1-ilpo.jarvinen@linux.intel.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/serial/8250/8250_core.c | 16 +++++++++++----- drivers/tty/serial/8250/8250_port.c | 8 +++++--- include/linux/serial_8250.h | 1 + 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c index 2e83e7367441..94fbf0add2ce 100644 --- a/drivers/tty/serial/8250/8250_core.c +++ b/drivers/tty/serial/8250/8250_core.c @@ -298,10 +298,9 @@ static void serial8250_backup_timeout(struct timer_list *t) jiffies + uart_poll_timeout(&up->port) + HZ / 5); } -static int univ8250_setup_irq(struct uart_8250_port *up) +static void univ8250_setup_timer(struct uart_8250_port *up) { struct uart_port *port = &up->port; - int retval = 0; /* * The above check will only give an accurate result the first time @@ -322,10 +321,16 @@ static int univ8250_setup_irq(struct uart_8250_port *up) */ if (!port->irq) mod_timer(&up->timer, jiffies + uart_poll_timeout(port)); - else - retval = serial_link_irq_chain(up); +} - return retval; +static int univ8250_setup_irq(struct uart_8250_port *up) +{ + struct uart_port *port = &up->port; + + if (port->irq) + return serial_link_irq_chain(up); + + return 0; } static void univ8250_release_irq(struct uart_8250_port *up) @@ -381,6 +386,7 @@ static struct uart_ops univ8250_port_ops; static const struct uart_8250_ops univ8250_driver_ops = { .setup_irq = univ8250_setup_irq, .release_irq = univ8250_release_irq, + .setup_timer = univ8250_setup_timer, }; static struct uart_8250_port serial8250_ports[UART_NR]; diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c index 6a9d3c8ffa56..ec7dca43619f 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -2300,6 +2300,10 @@ int serial8250_do_startup(struct uart_port *port) if (port->irq && (up->port.flags & UPF_SHARE_IRQ)) up->port.irqflags |= IRQF_SHARED; + retval = up->ops->setup_irq(up); + if (retval) + goto out; + if (port->irq && !(up->port.flags & UPF_NO_THRE_TEST)) { unsigned char iir1; @@ -2342,9 +2346,7 @@ int serial8250_do_startup(struct uart_port *port) } } - retval = up->ops->setup_irq(up); - if (retval) - goto out; + up->ops->setup_timer(up); /* * Now, initialize the UART diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h index 8c7b793aa4d7..16e3d75a324c 100644 --- a/include/linux/serial_8250.h +++ b/include/linux/serial_8250.h @@ -74,6 +74,7 @@ struct uart_8250_port; struct uart_8250_ops { int (*setup_irq)(struct uart_8250_port *); void (*release_irq)(struct uart_8250_port *); + void (*setup_timer)(struct uart_8250_port *); }; struct uart_8250_em485 { From patchwork Wed Oct 19 08:30:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4793 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp216195wrs; Wed, 19 Oct 2022 02:17:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4euunrmqpTZ92VdQbBqW4EfiQ+M7efEPk5a3R5NmMTQGddyT76imvTai1EVHNMbflXKofB X-Received: by 2002:a05:6402:2687:b0:45d:3a94:348f with SMTP id w7-20020a056402268700b0045d3a94348fmr6516962edd.48.1666171066993; Wed, 19 Oct 2022 02:17:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666171066; cv=none; d=google.com; s=arc-20160816; b=ZBB1NHROPdliFE2zIT5mqyqpRTovrP6bBhrk+/hX5Zc5CfYa8SEFsMXQaRWuWVGqwM wX9FUTKO+E51St/NuZDL/B+fREIU2TwdmD0d+cVLh78Thqy3JwDBTk4CCOY18PqmVs7R gIt7PeZP+Xm7UorBugyEXppZgeOmFkoYKaOuBer1E33QwDbFFlcjgsxgjODGnbD8/Ndp vazInARB9S1ID4NoXUAWS3I724s7HNM5YI+6/wSBj+Zso4Lkmw+jrv07nVRRr0otUcBE Qy8hISFuoWCxqoUtKeWNECIi3MMbR4ya/mkzU6sD+yxryYmFWA4qzVhmEL+xhUt5IoOW WvIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=K2cV94ms1+eNdI2TOnc6J4/QHTFFeAK06xbYT2UFUP4=; b=fEGIlY4Pvm3na6U6iWekmk3Ing9LmWIiFi9Rn1XdxNCSOKwCvxdkH/GzOc9U6vii9O V6y7i5Mg8JHXU06+3D6VTdVI6bF2yGVzqWpyVWcTeBYMUX1vf7ArtJ1Nb0LoEl8fK9uP Zxl8nCFqWZr7x+PyjpszU+sbrvZ4POirzzTvq/uJBGS9lVqmAeVM7zv01Y2JqIah2mog XdQlXaRyhB/jVGRVhVEnbapUYMD2WXtzdB4PGbB1nOK3njVPtuGJEKCa5G74sMhU0doc pxUuZ9d6PKkbS6A2EOh2uI69xEnGlqQ1jqYe1sfpGwsXr4zLCl+rcOzmOKJAoIfCokZF az0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fyy005wh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c11-20020a0564021f8b00b00458ab55ccc9si14721542edc.168.2022.10.19.02.17.22; Wed, 19 Oct 2022 02: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=fyy005wh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233141AbiJSJQt (ORCPT + 99 others); Wed, 19 Oct 2022 05:16:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233130AbiJSJOC (ORCPT ); Wed, 19 Oct 2022 05:14:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C56595E72; Wed, 19 Oct 2022 02:04: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 DC94161838; Wed, 19 Oct 2022 09:03:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1864C433C1; Wed, 19 Oct 2022 09:03:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170204; bh=fAy0ykRhta6WOpnptsIYEneB62jrJUa3Q4PxHr2dY7E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fyy005wh/SNPsyc/Ji1XhUlXYQvCep3KAoe/UwSw8waCR75/HpG84qnRHHlF85UAx BLz4uMkFVB6V2qey1ICcLZCwvVe4Qq0fWrqxInFamEeVzUZGCGx9hzvkvrRl1XivdM LhSfiqWG+kYkm2y6oAH5Odimfw/YPHhG+8pMIuHI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Thara Gopinath , Sherry Sun , Sasha Levin Subject: [PATCH 6.0 559/862] tty: serial: fsl_lpuart: disable dma rx/tx use flags in lpuart_dma_shutdown Date: Wed, 19 Oct 2022 10:30:46 +0200 Message-Id: <20221019083314.679827840@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106993049042226?= X-GMAIL-MSGID: =?utf-8?q?1747106993049042226?= From: Sherry Sun [ Upstream commit 316ae95c175a7d770d1bfe4c011192712f57aa4a ] lpuart_dma_shutdown tears down lpuart dma, but lpuart_flush_buffer can still occur which in turn tries to access dma apis if lpuart_dma_tx_use flag is true. At this point since dma is torn down, these dma apis can abort. Set lpuart_dma_tx_use and the corresponding rx flag lpuart_dma_rx_use to false in lpuart_dma_shutdown so that dmas are not accessed after they are relinquished. Otherwise, when try to kill btattach, kernel may panic. This patch may fix this issue. root@imx8ulpevk:~# btattach -B /dev/ttyLP2 -S 115200 ^C[ 90.182296] Internal error: synchronous external abort: 96000210 [#1] PREEMPT SMP [ 90.189806] Modules linked in: moal(O) mlan(O) [ 90.194258] CPU: 0 PID: 503 Comm: btattach Tainted: G O 5.15.32-06136-g34eecdf2f9e4 #37 [ 90.203554] Hardware name: NXP i.MX8ULP 9X9 EVK (DT) [ 90.208513] pstate: 600000c5 (nZCv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 90.215470] pc : fsl_edma3_disable_request+0x8/0x60 [ 90.220358] lr : fsl_edma3_terminate_all+0x34/0x20c [ 90.225237] sp : ffff800013f0bac0 [ 90.228548] x29: ffff800013f0bac0 x28: 0000000000000001 x27: ffff000008404800 [ 90.235681] x26: ffff000008404960 x25: ffff000008404a08 x24: ffff000008404a00 [ 90.242813] x23: ffff000008404a60 x22: 0000000000000002 x21: 0000000000000000 [ 90.249946] x20: ffff800013f0baf8 x19: ffff00000559c800 x18: 0000000000000000 [ 90.257078] x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000 [ 90.264211] x14: 0000000000000003 x13: 0000000000000000 x12: 0000000000000040 [ 90.271344] x11: ffff00000600c248 x10: ffff800013f0bb10 x9 : ffff000057bcb090 [ 90.278477] x8 : fffffc0000241a08 x7 : ffff00000534ee00 x6 : ffff000008404804 [ 90.285609] x5 : 0000000000000000 x4 : 0000000000000000 x3 : ffff0000055b3480 [ 90.292742] x2 : ffff8000135c0000 x1 : ffff00000534ee00 x0 : ffff00000559c800 [ 90.299876] Call trace: [ 90.302321] fsl_edma3_disable_request+0x8/0x60 [ 90.306851] lpuart_flush_buffer+0x40/0x160 [ 90.311037] uart_flush_buffer+0x88/0x120 [ 90.315050] tty_driver_flush_buffer+0x20/0x30 [ 90.319496] hci_uart_flush+0x44/0x90 [ 90.323162] +0x34/0x12c [ 90.327253] tty_ldisc_close+0x38/0x70 [ 90.331005] tty_ldisc_release+0xa8/0x190 [ 90.335018] tty_release_struct+0x24/0x8c [ 90.339022] tty_release+0x3ec/0x4c0 [ 90.342593] __fput+0x70/0x234 [ 90.345652] ____fput+0x14/0x20 [ 90.348790] task_work_run+0x84/0x17c [ 90.352455] do_exit+0x310/0x96c [ 90.355688] do_group_exit+0x3c/0xa0 [ 90.359259] __arm64_sys_exit_group+0x1c/0x20 [ 90.363609] invoke_syscall+0x48/0x114 [ 90.367362] el0_svc_common.constprop.0+0xd4/0xfc [ 90.372068] do_el0_svc+0x2c/0x94 [ 90.375379] el0_svc+0x28/0x80 [ 90.378438] el0t_64_sync_handler+0xa8/0x130 [ 90.382711] el0t_64_sync+0x1a0/0x1a4 [ 90.386376] Code: 17ffffda d503201f d503233f f9409802 (b9400041) [ 90.392467] ---[ end trace 2f60524b4a43f1f6 ]--- [ 90.397073] note: btattach[503] exited with preempt_count 1 [ 90.402636] Fixing recursive fault but reboot is needed! Fixes: 6250cc30c4c4 ("tty: serial: fsl_lpuart: Use scatter/gather DMA for Tx") Reviewed-by: Ilpo Järvinen Signed-off-by: Thara Gopinath Signed-off-by: Sherry Sun Link: https://lore.kernel.org/r/20220920111703.1532-1-sherry.sun@nxp.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/serial/fsl_lpuart.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c index 6eb3d6c62458..34990901c805 100644 --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c @@ -1776,6 +1776,7 @@ static void lpuart_dma_shutdown(struct lpuart_port *sport) if (sport->lpuart_dma_rx_use) { del_timer_sync(&sport->lpuart_timer); lpuart_dma_rx_free(&sport->port); + sport->lpuart_dma_rx_use = false; } if (sport->lpuart_dma_tx_use) { @@ -1784,6 +1785,7 @@ static void lpuart_dma_shutdown(struct lpuart_port *sport) sport->dma_tx_in_progress = false; dmaengine_terminate_all(sport->dma_tx_chan); } + sport->lpuart_dma_tx_use = false; } if (sport->dma_tx_chan) From patchwork Wed Oct 19 08: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: 4801 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp216378wrs; Wed, 19 Oct 2022 02:18:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6SNRHeLebEK0aPL+bExXnWgZn6aSRK8g3EGV0k1QYUmxAejWqprPDLhFQCyhMlt4jYgZZE X-Received: by 2002:a17:907:783:b0:76e:f290:8b5 with SMTP id xd3-20020a170907078300b0076ef29008b5mr6076239ejb.395.1666171095638; Wed, 19 Oct 2022 02:18:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666171095; cv=none; d=google.com; s=arc-20160816; b=bCrf6L1xWvGobGDQ4Hw+aShl5/Ko3nQbeR3uvTkqdtmyHpVNZvpN8AiOaSFjHOM+ew qHkZ98XnsYDUHHD9FUJ5zW18itKn9mw79h/O/D89ysKJDSMfjDPDpik0alG6wsOx5p15 0jzXEO+97jS16rbZ9UsKbVOPt2lLsWR5/0+ng1wOkihsDDShL+xgd98/I6UMtIfDDvD+ 7OyM0tr+kXMMYnRDJiCP0IhgR2CzT3bPxF+P+jHs7B0cp4owtwcAJ7PsAfTqzNOGmBgD 69y2LYP5TvqGNGt6WQa1EMpqMyK5nL08BdwkvoBjUZW5Law0+Z3rWswO+KVN1XWojX3I puJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kNaGe+gRNNJN9311HSyBaLL5guDPg3kkZIdTXpU39W8=; b=uL6V5AG6/sO3Jhd6urhTORP9IERGreeYaPAc29zjUVykZ3SVEPOWC45zZ0IilGjN+w YDH6DFzLMFLU2IwkHBjJkopY8WLvEkr+w4xePQKDDj89AhusqK7qitkWM0eTS77DmPC6 0/OtXx2LGPlBqMUiQmBRGd8qDsnb056iss537V+0giq9LqX3wJiziFq7W+C6AQPADdxo koDhKNVSjOicVGz9tzu4dCtVuagbhuLIHJLK8ZgnlpEM5KjWTZIXEFMpymeRCw50EA7n xaflmpWcz7waxEvqn1iSSa2u4axgXPzfh2MsvwVKCZnaEp1ZpOKeKnRsP4KKq2noHAV6 pNoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wjF4cyrL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170906794f00b0078333d9f17bsi15297945ejo.819.2022.10.19.02.17.51; Wed, 19 Oct 2022 02:18: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=wjF4cyrL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233030AbiJSJRL (ORCPT + 99 others); Wed, 19 Oct 2022 05:17:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233222AbiJSJOO (ORCPT ); Wed, 19 Oct 2022 05:14:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C192E0A6; Wed, 19 Oct 2022 02:04:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C8B4F61750; Wed, 19 Oct 2022 09:03:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DDD0AC433C1; Wed, 19 Oct 2022 09:03:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170233; bh=uVPtii6QQOmB4B6xF72ZYD0gNI18FJWJaZLcL+ZjKkI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wjF4cyrLSozly00eR663QyIoWB3Iz4vXXPqT3rQZbHOfRmNHaQLv6BFMv4+mYHgVX 8LtZAmkUL4KqivCHJGcwpwcYGUd8pUrf3a1MUItGZbPRgKe/J2l5mxh0jSFfeF8rLC 00eItiMW2sZoiuwmfNvVc6n57m78IGQppf2VIVr8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dongliang Mu , Neil Armstrong , Vinod Koul , Sasha Levin Subject: [PATCH 6.0 560/862] phy: qualcomm: call clk_disable_unprepare in the error handling Date: Wed, 19 Oct 2022 10:30:47 +0200 Message-Id: <20221019083314.730032616@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747107022983745044?= X-GMAIL-MSGID: =?utf-8?q?1747107022983745044?= From: Dongliang Mu [ Upstream commit c3966ced8eb8dc53b6c8d7f97d32cc8a2107d83e ] Smatch reports the following error: drivers/phy/qualcomm/phy-qcom-usb-hsic.c:82 qcom_usb_hsic_phy_power_on() warn: 'uphy->cal_clk' from clk_prepare_enable() not released on lines: 58. drivers/phy/qualcomm/phy-qcom-usb-hsic.c:82 qcom_usb_hsic_phy_power_on() warn: 'uphy->cal_sleep_clk' from clk_prepare_enable() not released on lines: 58. drivers/phy/qualcomm/phy-qcom-usb-hsic.c:82 qcom_usb_hsic_phy_power_on() warn: 'uphy->phy_clk' from clk_prepare_enable() not released on lines: 58. Fix this by calling proper clk_disable_unprepare calls. Fixes: 0b56e9a7e835 ("phy: Group vendor specific phy drivers") Signed-off-by: Dongliang Mu Reviewed-by: Neil Armstrong Link: https://lore.kernel.org/r/20220914051334.69282-1-dzm91@hust.edu.cn Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/phy/qualcomm/phy-qcom-usb-hsic.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-usb-hsic.c b/drivers/phy/qualcomm/phy-qcom-usb-hsic.c index 716a77748ed8..20f6dd37c7c1 100644 --- a/drivers/phy/qualcomm/phy-qcom-usb-hsic.c +++ b/drivers/phy/qualcomm/phy-qcom-usb-hsic.c @@ -54,8 +54,10 @@ static int qcom_usb_hsic_phy_power_on(struct phy *phy) /* Configure pins for HSIC functionality */ pins_default = pinctrl_lookup_state(uphy->pctl, PINCTRL_STATE_DEFAULT); - if (IS_ERR(pins_default)) - return PTR_ERR(pins_default); + if (IS_ERR(pins_default)) { + ret = PTR_ERR(pins_default); + goto err_ulpi; + } ret = pinctrl_select_state(uphy->pctl, pins_default); if (ret) From patchwork Wed Oct 19 08: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: 5295 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp282108wrs; Wed, 19 Oct 2022 05:02:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6tLT6/CUClgf+7MWQ/pwRn6JhAYBAoWoPsIh19X+8Q4/xoggTdb8DMYYBf6/SRIELKGpAq X-Received: by 2002:aa7:c58a:0:b0:459:1511:6cff with SMTP id g10-20020aa7c58a000000b0045915116cffmr7194933edq.27.1666180971728; Wed, 19 Oct 2022 05:02:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666180971; cv=none; d=google.com; s=arc-20160816; b=IP3vKOM9nhvxGymgNzZ6ILtlIbwFjoDAU0lj6/89TVu1cIOoolBUnsW8b+UTQNqcdm 4Tlau9V5BZRfKO4jqRWtXW0ou0buhpP+i2Z5Ht/eVmX3y4yhGp2r80lTulPmI51mAVSE lo9qLmc1jBq/mOAKPTzD2R7dA+ZnQNXYA0t3H3/Ae/3YVPd3yUhbHNCBq1Q5yk5Xj981 oHcBFeXXPiE3iVtwO7J+77qVUa9zPiP3d1b5eokKgx4WtOXnbdpDPpeEmpg0kjF2xxD6 ooZVITWbZOnNle01nYhtau8G0ecE32owd0cwokpze45lwl0XG+NBdDb3pnRReV8Wu9hS JoOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=smgLWoVtM1UFVmtSp0lHC2kS9rtCxUNPtq0eYjXq2wQ=; b=wMV0XedyMSEqmKIzXzoQDdEmUtlPg1iw3Gsi7RwukAyjlUUGAp0s8MdYEdb5wp6viY l4JlgJXb8Tu9zpvg8rEtRa9F9zV/+uGPyJNL/961vtLaPFfbC15ki8fkAfzo0wdQqOvx /VdqwU6zF1YQKA/F4C5EN20CxWqolE74xrJ+zTAQtCjlr13u2P6AdjseMsWNrO7xRBdq 3Fh7qQBe/AZGbjGm/ZqUjF2PLJ+QWmnhG7Z5HYjNnooc8L1KwxM4Urx0SMNYQNy3DnHZ Cq+zhcPB5/3c4UMQ2wG8UsNuevHoTPHRW+vGSEmnP/IHfmDJRXSkMtz3/iYvaEXcSbeB 0Mcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=urwMgium; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xg14-20020a170907320e00b00780805b99ccsi15752343ejb.648.2022.10.19.05.02.23; Wed, 19 Oct 2022 05:02: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=urwMgium; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231205AbiJSL7Q (ORCPT + 99 others); Wed, 19 Oct 2022 07:59:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232224AbiJSL6m (ORCPT ); Wed, 19 Oct 2022 07:58:42 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BB843B9AF; Wed, 19 Oct 2022 04:36: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 A7D5ACE215A; Wed, 19 Oct 2022 09:04:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A134C433D6; Wed, 19 Oct 2022 09:04:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170261; bh=aG1VmPiSOMKW2hCxcFGQZpli/fWumh5/A/cWuJlqu4w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=urwMgiumImtwKnLLjZSeTCtHje+FFMtdJRfxY720kIwBbiKmDbso00KM0wy1rRfFd hmR6mlFEolerOooTMABhl9qf+AawHFNCJt3+zgHtAkpzXAJEXZiWEIb5C+7EVcf+r4 CUN4h1fWtTcv6h2rVzoxdcLlasMLzO27bSpQyaCE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Philipp Hortmann , Nam Cao , Sasha Levin Subject: [PATCH 6.0 561/862] staging: vt6655: fix some erroneous memory clean-up loops Date: Wed, 19 Oct 2022 10:30:48 +0200 Message-Id: <20221019083314.776142674@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747117378816172501?= X-GMAIL-MSGID: =?utf-8?q?1747117378816172501?= From: Nam Cao [ Upstream commit 2a2db520e3ca5aafba7c211abfd397666c9b5f9d ] In some initialization functions of this driver, memory is allocated with 'i' acting as an index variable and increasing from 0. The commit in "Fixes" introduces some clean-up codes in case of allocation failure, which free memory in reverse order with 'i' decreasing to 0. However, there are some problems: - The case i=0 is left out. Thus memory is leaked. - In case memory allocation fails right from the start, the memory freeing loops will start with i=-1 and invalid memory locations will be accessed. One of these loops has been fixed in commit c8ff91535880 ("staging: vt6655: fix potential memory leak"). Fix the remaining erroneous loops. Link: https://lore.kernel.org/linux-staging/Yx9H1zSpxmNqx6Xc@kadam/ Fixes: 5341ee0adb17 ("staging: vt6655: check for memory allocation failures") Reported-by: Dan Carpenter Tested-by: Philipp Hortmann Signed-off-by: Nam Cao Link: https://lore.kernel.org/r/20220912170429.29852-1-namcaov@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/staging/vt6655/device_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index bab08a40fe66..d76f65756db8 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -583,7 +583,7 @@ static int device_init_rd0_ring(struct vnt_private *priv) kfree(desc->rd_info); err_free_desc: - while (--i) { + while (i--) { desc = &priv->aRD0Ring[i]; device_free_rx_buf(priv, desc); kfree(desc->rd_info); @@ -629,7 +629,7 @@ static int device_init_rd1_ring(struct vnt_private *priv) kfree(desc->rd_info); err_free_desc: - while (--i) { + while (i--) { desc = &priv->aRD1Ring[i]; device_free_rx_buf(priv, desc); kfree(desc->rd_info); @@ -734,7 +734,7 @@ static int device_init_td1_ring(struct vnt_private *priv) return 0; err_free_desc: - while (--i) { + while (i--) { desc = &priv->apTD1Rings[i]; kfree(desc->td_info); } From patchwork Wed Oct 19 08: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: 5277 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp280342wrs; Wed, 19 Oct 2022 05:00:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM51JVi2YNXf+jRUXNdwdGFNwM2Xli4sS2TlN/pTCPjy1trYJHlXmWR/61Z58tq6y+6mSt5C X-Received: by 2002:a05:6402:5162:b0:457:6ef2:df3 with SMTP id d2-20020a056402516200b004576ef20df3mr7068059ede.128.1666180840430; Wed, 19 Oct 2022 05:00:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666180840; cv=none; d=google.com; s=arc-20160816; b=MwA3wkhBL2KbHjBnQFx6UPoOIkXIDhFOHPIDfUQZ9TzRvDd1TkSKWBA4TiPFeihp75 f4afKuNA+l2f2j8jVDjc/ULikqZywGduQHtUjSpyjVU3Z9+TxhqsJ565iz8nnB4B5D42 BBktxNA7DLmRXli++WoWoEwgTZ9ofnaoYc2eFkDWdiPGpWYfCYf1oHIaVfRPRWW/hXwy R4MHM/xda/X8hPZWVJH52CPycZKfdRatP9ZQdRbjbJvZ/Z3ws6yee75QRlOdjjIi3Nuo MBP2VGhRYX4WBCZiNZULpSYPTytLn5lVs9CUVGkOBuCWiueZm9y7yV+pRTmuj3cjaF7p 8ZzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Tk6rJCCrUU+UDNO3KpzwcKkHRjzn/vohe9OfHA2ccnM=; b=rvYeqxVxXMvZNVbNHS6yrQlO0HuGdNMK/5PUgiLEZuVjA/JU1V3IG9slqrQ8VdIvJL odUPOBO2meDBbAXrN9FiLnfbpRN05KcXCgEg/Nfb0DRAXYb/HYLHAi2mUxb0ZOqB0LiA +OwW/uHy+mlyK1JRDvO6g+UzRzDcmVXoRRtZf8lKXwEumjvUD+gGOONDMRgFAVnpde8f 6638ndSgRS2kNF+9UVQSkBaBcMFWe6hp9peSj65LuLVi0p7Biorr1zjivokq1gpbI+Xw ZmWrLT7XW8XVhi/HyM+Cj0diohAmI4tNWPOiBPo5vbKtlyuZKlTfdWFfUJ923hk6xzXl sCQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uPyOXGHK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p11-20020a056402500b00b0045d212cc170si13526557eda.363.2022.10.19.05.00.13; Wed, 19 Oct 2022 05:00: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=uPyOXGHK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231852AbiJSLxF (ORCPT + 99 others); Wed, 19 Oct 2022 07:53:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231857AbiJSLwt (ORCPT ); Wed, 19 Oct 2022 07:52:49 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C8081ACA84; Wed, 19 Oct 2022 04:31: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 A4F2ECE2170; Wed, 19 Oct 2022 09:04:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C502CC433C1; Wed, 19 Oct 2022 09:04:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170291; bh=AIPgOlTw2C29CZW+Rcr36Sfqvrn2uqvWjCZRKazOqQQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uPyOXGHKxg13vb4UmrEf0/Ue6S6nsUQ82IOUsKUTTnC+Xw0fe1fzPgjIHSTez7OD6 V68xrBimGBocJrKx65NZQuXHC1YQdgcvzKJiYpt1rXMLpk8xrrPfSo25+VRvt8ruTc O1Ugx5uVEWhiGjm7wkT3xf3vdNGnyvQCupPsqQIE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Neil Armstrong , Lin Yujun , Sasha Levin Subject: [PATCH 6.0 562/862] slimbus: qcom-ngd: Add error handling in of_qcom_slim_ngd_register Date: Wed, 19 Oct 2022 10:30:49 +0200 Message-Id: <20221019083314.815961935@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747117240696957440?= X-GMAIL-MSGID: =?utf-8?q?1747117240696957440?= From: Lin Yujun [ Upstream commit 42992cf187e4e4bcfe3c58f8fc7b1832c5652d9f ] No error handling is performed when platform_device_add() return fails. Refer to the error handling of driver_set_override(), add error handling for platform_device_add(). Fixes: 917809e2280b ("slimbus: ngd: Add qcom SLIMBus NGD driver") Reviewed-by: Neil Armstrong Signed-off-by: Lin Yujun Link: https://lore.kernel.org/r/20220914031953.94061-1-linyujun809@huawei.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/slimbus/qcom-ngd-ctrl.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/slimbus/qcom-ngd-ctrl.c b/drivers/slimbus/qcom-ngd-ctrl.c index bacc6af1d51e..d29a1a9cf12f 100644 --- a/drivers/slimbus/qcom-ngd-ctrl.c +++ b/drivers/slimbus/qcom-ngd-ctrl.c @@ -1470,7 +1470,13 @@ static int of_qcom_slim_ngd_register(struct device *parent, ngd->pdev->dev.of_node = node; ctrl->ngd = ngd; - platform_device_add(ngd->pdev); + ret = platform_device_add(ngd->pdev); + if (ret) { + platform_device_put(ngd->pdev); + kfree(ngd); + of_node_put(node); + return ret; + } ngd->base = ctrl->base + ngd->id * data->offset + (ngd->id - 1) * data->size; From patchwork Wed Oct 19 08: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: 4808 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp216559wrs; Wed, 19 Oct 2022 02:18:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7STGfc/8gkuGgS1+BEpt/d7sK4bOKZwiydjT/7xOlRKEtflsY18gAaCeq95Q3P0TIt1kEB X-Received: by 2002:a05:6402:50cd:b0:45d:74d:93a2 with SMTP id h13-20020a05640250cd00b0045d074d93a2mr6464453edb.156.1666171123225; Wed, 19 Oct 2022 02:18:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666171123; cv=none; d=google.com; s=arc-20160816; b=sGz4AFenxhSGEwmwR917Q5Cfefi6EfkNIKOGkEz8HW6vQIJFRm1BA5Hte7Fki3Eufg prWxNBmMaQHQ55jgCdf5gWiUB7qguRqqA/5/44h7w75sDVi1UvbLsP6xun16OqqDaP1q Z/WIf7ix4NJQLcWUYBhyQffD4BZDvTY6x7j0uB90gQy+r57HO5YCpzMAt1TJfyAv8THC CCLaXqz5GNWJRKfYxHOKP51zOHNRW7PiAWfCa2BprpfmdOpsbJqh7APZK+Sktoapn7nF swVWYHCkZOWBE9XVDC3//fku/6yaSUe4sBH24Jq+V4Cn2HeMJcWpjK60QdTdS0Ki/VqC m2sQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=D4aeKO3li6DXpfT9DJMVqwM4QmuvNIwWWCVGysYMwoY=; b=SmihWAamdfqiM1Wwh0Zh2Nd3cOnxsVYYtNhHhY5CsUEQ2E4F/nkustJC4pn53/f3oJ lhbTDeICq0d5muyfnkLxZvwkUdFwEL+jiKvU9CXER2IpSQ2PQZm01krS0KCBlwFOj+IR lYkTHlASdegOUgveNWGhaJdNCfmI0qzR3RbxNeA2TgWVfiOnQ+ofV+WI6yg3Df4/GOqf wBRuvSKIH6x9DCUq3dZvc22MtSD2fdeAB/XeCS7wTJ9nOU/UF8B5V7C1RnUr+mTBJgJv g/kiB9c8QRN2jJVy+qaXmNlQEq0aJYVxZor4QoLgUDLxDWAksH4rZolO7pnlVnK9coa3 gG9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="VCU/fSTZ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a0564020d0d00b00457e1a02339si17486171edb.592.2022.10.19.02.18.19; Wed, 19 Oct 2022 02:18: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="VCU/fSTZ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233142AbiJSJRt (ORCPT + 99 others); Wed, 19 Oct 2022 05:17:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233349AbiJSJOm (ORCPT ); Wed, 19 Oct 2022 05:14: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 923AD42D7E; Wed, 19 Oct 2022 02:04:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5560B617DF; Wed, 19 Oct 2022 09:04:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6CE17C433D6; Wed, 19 Oct 2022 09:04:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170293; bh=C+1GBcd4vi3x1Lbhy7+9mb4yrjJTjU/i8BhkPvezHH8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VCU/fSTZxFMQKTQa5D3I19vpyszspxuEd4PuWiJDOfCjBIMpxq0Lezvg/5tKMmjcs yU2DNkzayF5+Tdi+zfsu8gCOHtqWKk1FDQKBLRsFTvgtHO4xbmF28AK+vmEZlXLzbR 3WoiO+drPWydrlPm232Um7UB+7rg7wJ0vKLfXlQs= 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 6.0 563/862] firmware: google: Test spinlock on panic path to avoid lockups Date: Wed, 19 Oct 2022 10:30:50 +0200 Message-Id: <20221019083314.864066698@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747107051940594231?= X-GMAIL-MSGID: =?utf-8?q?1747107051940594231?= 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 adaa492c3d2d..4e2575dfeb90 100644 --- a/drivers/firmware/google/gsmi.c +++ b/drivers/firmware/google/gsmi.c @@ -681,6 +681,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 Wed Oct 19 08:30:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5287 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp281174wrs; Wed, 19 Oct 2022 05:01:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7QUuE6mf2ChZul9XNp+c4p2wCNqsjoasKaR6CxPImrK9OhR3SEBsEjDCKBCCbqvT8Yvtqj X-Received: by 2002:a17:907:1623:b0:78d:9e8b:171d with SMTP id hb35-20020a170907162300b0078d9e8b171dmr6382204ejc.309.1666180893604; Wed, 19 Oct 2022 05:01:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666180893; cv=none; d=google.com; s=arc-20160816; b=ov66pu/8o/PjiadXVjGQn5IzTh+SAEtk6JB+FSgak2l0A3B8/TODhnEBgTXC28SxV7 tmVq59Cm9wuIUOV0CvjsgZKqo5qrNnFrSiP5Z+Oqdf6lDyUNxgH5+vx+BVFWWbKTx+Y5 xk9c0d6WVAKeDkBh2Z3UkWd26uA0HFuLAVcwNf8Hit1vsGNfhLCmOKlqJPiGLsEpkMeF +t+jl6144CRoHmeCUp/zjSmkYkSUSC+5aVbCnX4VIOkDd2bct5Nfd5I+0f8uyzWhQXRl 7f5833RaHUtgc6yTJSMtra1IR6VNv6X7Rpo7UcThErAAorvMUV7DyEDV4K/ccozsCUEv 2Kwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MfzIupuU4f7gxKCpHvYWZjw5mhygAi+AJtqHNo1yPvA=; b=wXjPrI3dzcC7kvzQy8EIC2M6SX+0rs/XTOo1pED73qi0bMl6PzjErEuEgOpYXlxZPj asUcNfFAtVqHUs+tucAqHG3TCN2otalxthpfUZwLwhXrmkGkaPbzzEsnbdkQRXhMXvEZ RJejzFwqBJZ4Pys3BgzUVxuQIEzkOri4aYAEMBtluSqUQl6qmJQ9uzLENPq8wwoE0dQg RKcTAPAadYwkENIgrYk4SaZ20eefww4vG2YY3qhwxNL38sL17bSeB7q0jmqu17PDNho3 2ggwpTAqi8adUgEXK0mlKklFMvg587ygNIdy78jhmB+uz+BKJKgIX1vpUGE9eVjlGuNQ pRnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xNokawkH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gq2-20020a170906e24200b0078dc5b2b6c4si11824847ejb.666.2022.10.19.05.01.06; Wed, 19 Oct 2022 05:01: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=xNokawkH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232095AbiJSL4M (ORCPT + 99 others); Wed, 19 Oct 2022 07:56:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232657AbiJSLyy (ORCPT ); Wed, 19 Oct 2022 07:54: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 C25AE4E85B; Wed, 19 Oct 2022 04:33: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 sin.source.kernel.org (Postfix) with ESMTPS id 0926DCE2176; Wed, 19 Oct 2022 09:04:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 073A5C433C1; Wed, 19 Oct 2022 09:04:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170296; bh=09iG3FKJdgaGX8LMpwgPlfxosKODNCDDfn7JVVuezq0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xNokawkHd8mjdtaK0RAY3tXYkTNUMJqTorjEWhGbssmUNRuhI6aLpu2P/YkVbIQ5t 0dZhgj1g2c0VzEjXrbRYjbtAnpVPHRQGVCEq4vp/fKhxpNP8tAR1F7W8nAF5UZ8tQn GfovQf4gw1C6ojulSzUPQC9yjkzdZ6p18eDJBKjI= 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 6.0 564/862] serial: 8250: Fix restoring termios speed after suspend Date: Wed, 19 Oct 2022 10:30:51 +0200 Message-Id: <20221019083314.914687345@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747117296457605891?= X-GMAIL-MSGID: =?utf-8?q?1747117296457605891?= 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 ec7dca43619f..2030a92ac66e 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -3319,8 +3319,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(port, baud, &frac); From patchwork Wed Oct 19 08: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: 5470 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp332435wrs; Wed, 19 Oct 2022 06:38:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4yDLhwmOX1zIUu3cyovQbLLsmzBg/0E599AuyF+jBXMXrUwUTlYiIW9DJ/dyvihaWyvij5 X-Received: by 2002:a63:1612:0:b0:461:4180:d88b with SMTP id w18-20020a631612000000b004614180d88bmr7443275pgl.434.1666186728243; Wed, 19 Oct 2022 06:38:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666186728; cv=none; d=google.com; s=arc-20160816; b=dIuFBd5v0IB64g+i+nu+SNtFhw/1gDsF0Dd2Lv9+1QhaYQS0A6aRNWTwLmaACripx5 LpLrFiyENYFLqM0sLPbcCLuF67bg/Z9bvVSTc2u90BeU7Fd5/p66FD58zWQz63EkoJ9h XqIuNT6A15YG4xJBafK3VpMILxipMSwu8S9quYUUfPB9c11siw3nb4+QKPY9KDpChiLU lNHINt54qJ81NQt2Kj2dqD6po1TkI5w++FqehFoI7KzYJSUcMI/KTJag9JUQT6SYskk3 d9FiSpAJcqIKf15gzPFS29SbOS+8RKq4SDcEg3um6LWJPh0CXZKtgKSSYdPNi7dWVaLL joSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ArSNUb49BbA1Njga8bz0Cnw5SuyWZ+TUc6uI9wHKT6c=; b=ov2efl4msZDMdTSzxcZx/mcfd3r9kwuQYbw02cJmQb9ADcwce9UWGrlHGDMGoG+1EK sb0wix1UOCsNZzqAebqcOIj0irUb4z6ruGnGlIRJTAsJr2PxXOAJf+x74cNMjQTe+i1C fmuSrKndwKLc6m3Xlmg3WJk/KAp17v6BuhlTWcinVeS2OeliSvQvuhmtXyzkEWE523nt 4uw0VnttYiOB446i5YFwm6MHls0jmihlgOmZ803jsJAFd9TASyB/nkTy9S4SwThpe8Z/ 93fJ6fv+Ude9HpYS0dvvp7P+MryKc5y1qFs8YFoRu6v8LS9lVXmprAESD1jtY5ZMHkCa 1x9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2L8q+z+L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h124-20020a636c82000000b0045eaaba641bsi17993981pgc.777.2022.10.19.06.38.34; Wed, 19 Oct 2022 06:38: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=2L8q+z+L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231856AbiJSNfD (ORCPT + 99 others); Wed, 19 Oct 2022 09:35:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232817AbiJSNe0 (ORCPT ); Wed, 19 Oct 2022 09:34:26 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EED2310EA2D; Wed, 19 Oct 2022 06:23:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 54961B82477; Wed, 19 Oct 2022 09:05:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3E00C433C1; Wed, 19 Oct 2022 09:04:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170299; bh=G9GOzQgt9GJresKgsdu7VVr7HoVOvDNE9KXB4pbcRpE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2L8q+z+L5sL2C57Rsis7qqxprbkd8P6Av/8iDpIcHZ+5d8gX9jjuhVelwfESxZdIG xKxaEKH0Y+289O3LEwZzlnOlU3vNwypmxOoHKoXjkRZvt5s8o2MWsYW6BsijnYz0V+ xfsQ/6Pv4tW+tDv8apEuTGtHMmEFg00N7ZXdJTWA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jason Yan , Duoming Zhou , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 6.0 565/862] scsi: libsas: Fix use-after-free bug in smp_execute_task_sg() Date: Wed, 19 Oct 2022 10:30:52 +0200 Message-Id: <20221019083314.963185967@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123414477114666?= X-GMAIL-MSGID: =?utf-8?q?1747123414477114666?= From: Duoming Zhou [ Upstream commit 46ba53c30666717cb06c2b3c5d896301cd00d0c0 ] When executing SMP task failed, the smp_execute_task_sg() calls del_timer() to delete "slow_task->timer". However, if the timer handler sas_task_internal_timedout() is running, the del_timer() in smp_execute_task_sg() will not stop it and a UAF will happen. The process is shown below: (thread 1) | (thread 2) smp_execute_task_sg() | sas_task_internal_timedout() ... | del_timer() | ... | ... sas_free_task(task) | kfree(task->slow_task) //FREE| | task->slow_task->... //USE Fix by calling del_timer_sync() in smp_execute_task_sg(), which makes sure the timer handler have finished before the "task->slow_task" is deallocated. Link: https://lore.kernel.org/r/20220920144213.10536-1-duoming@zju.edu.cn Fixes: 2908d778ab3e ("[SCSI] aic94xx: new driver") Reviewed-by: Jason Yan Signed-off-by: Duoming Zhou Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/libsas/sas_expander.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c index fa2209080cc2..5ce251830104 100644 --- a/drivers/scsi/libsas/sas_expander.c +++ b/drivers/scsi/libsas/sas_expander.c @@ -67,7 +67,7 @@ static int smp_execute_task_sg(struct domain_device *dev, res = i->dft->lldd_execute_task(task, GFP_KERNEL); if (res) { - del_timer(&task->slow_task->timer); + del_timer_sync(&task->slow_task->timer); pr_notice("executing SMP task failed:%d\n", res); break; } From patchwork Wed Oct 19 08: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: 5484 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp333772wrs; Wed, 19 Oct 2022 06:41:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6m4HghtJzLKcJUol14UJitebO+jV/8aaqGro7h3Lb3uSw5FV+bMNYexN34SSk3YVMzmZx9 X-Received: by 2002:a17:907:a054:b0:78d:7822:3108 with SMTP id gz20-20020a170907a05400b0078d78223108mr6703255ejc.764.1666186889415; Wed, 19 Oct 2022 06:41:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666186889; cv=none; d=google.com; s=arc-20160816; b=gnOVmXvYWrxSAzy6gtIdouK9HqnGiIjLzHjhRcosY89bKWjgwv0hUxmR4/mm3qgSLr vVUYd9lO06FOAHeJovFPwNI0q50PiocxtNyH/CNo/u61YGsj29RWMxuf9rzqoasIJWX2 6jYZWVo+DU2WHOb/D5K+/tX71h+Up4L3QQWl1LxJr1LjyGs2UfjFbihtWwBCsMYuSEAS 5UXZYV/59kMcs7NL9otyrnsWQy4cBZw1/AGLf54YE9cI56g23+otpBV+r6MTEyvxDFwk iahhm2OQpG5OL4s6I/EVn/DAB43wKN7LFChBeTLW0hccgPk9f+mHCex/hqawIjJH401T y1vQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wFa77AYY6Oj3Wl8LGLsmtn1dTwb+4W/6ieqjre2g4xg=; b=KK+fRuIgs/l0IjllVHd+BvLA22ievMVRNOuJ/Yw0bu4y1f1nv7nHYUEBlrG9gdyPYm U1VV/uzgrE11HLE4lv863C64V4P/KQhYqxuaMgnF24GFgYuYR+O30L7L27BJJXtutqqu fu/aBeYDEza8eVG2cm7/d+QZtWOFo4WUkCH1S5IzGy3QyM1XGofrEBeuB6alRvD+Vp5U rRVnBTg2U2CTG6EUljl7Y/OukS6yYPOvh+Vd684JCiOcRJfQGOEtrsjCFKdDDAUAha7W uEbNE5TvxVzxD7i+aCwqT3bBc6UnLrUqSOa2hbd7QFDjc2C9nfyPSU93tAHksvjho04I PSLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZXZ1OPmr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w10-20020a50d78a000000b004539b045326si14361201edi.417.2022.10.19.06.41.03; Wed, 19 Oct 2022 06:41: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=ZXZ1OPmr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232592AbiJSNhd (ORCPT + 99 others); Wed, 19 Oct 2022 09:37:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230507AbiJSNgl (ORCPT ); Wed, 19 Oct 2022 09:36:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B987715A30F; Wed, 19 Oct 2022 06:25: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 EA7A8B8246F; Wed, 19 Oct 2022 09:05:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4EB96C433D6; Wed, 19 Oct 2022 09:05:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170301; bh=3cZfXNGay6xumMtnyc1YClpFLbzGcS3qOU+GZM9G51o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZXZ1OPmrFm38tcVxKpOuiVRjU6nFgTuhFS4Rv1XPlp/64X2sKurOlMfhk3jOaKHZx RxatXq7hRVhK1ulPCDrLPnTqctVRlfAXxidf3l+3RGa/gamU+pcRf+OQ1G7Z8wWlLi rHXgAK5xOKjoaDRcvchFZkQrT4qWP9YQP5QV7DQI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jack Wang , John Garry , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 6.0 566/862] scsi: pm8001: Fix running_req for internal abort commands Date: Wed, 19 Oct 2022 10:30:53 +0200 Message-Id: <20221019083315.004056912@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123583641917182?= X-GMAIL-MSGID: =?utf-8?q?1747123583641917182?= From: John Garry [ Upstream commit d8c22c4697c11ed28062afe3c2b377025be11a23 ] Disabling the remote phy for a SATA disk causes a hang: root@(none)$ more /sys/class/sas_phy/phy-0:0:8/target_port_protocols sata root@(none)$ echo 0 > sys/class/sas_phy/phy-0:0:8/enable root@(none)$ [ 67.855950] sas: ex 500e004aaaaaaa1f phy08 change count has changed [ 67.920585] sd 0:0:2:0: [sdc] Synchronizing SCSI cache [ 67.925780] sd 0:0:2:0: [sdc] Synchronize Cache(10) failed: Result: hostbyte=0x04 driverbyte=DRIVER_OK [ 67.935094] sd 0:0:2:0: [sdc] Stopping disk [ 67.939305] sd 0:0:2:0: [sdc] Start/Stop Unit failed: Result: hostbyte=0x04 driverbyte=DRIVER_OK ... [ 123.998998] INFO: task kworker/u192:1:642 blocked for more than 30 seconds. [ 124.005960] Not tainted 6.0.0-rc1-205202-gf26f8f761e83 #218 [ 124.012049] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. [ 124.019872] task:kworker/u192:1 state:D stack:0 pid: 642 ppid: 2 flags:0x00000008 [ 124.028223] Workqueue: 0000:04:00.0_event_q sas_port_event_worker [ 124.034319] Call trace: [ 124.036758] __switch_to+0x128/0x278 [ 124.040333] __schedule+0x434/0xa58 [ 124.043820] schedule+0x94/0x138 [ 124.047045] schedule_timeout+0x2fc/0x368 [ 124.051052] wait_for_completion+0xdc/0x200 [ 124.055234] __flush_workqueue+0x1a8/0x708 [ 124.059328] sas_porte_broadcast_rcvd+0xa8/0xc0 [ 124.063858] sas_port_event_worker+0x60/0x98 [ 124.068126] process_one_work+0x3f8/0x660 [ 124.072134] worker_thread+0x70/0x700 [ 124.075793] kthread+0x1a4/0x1b8 [ 124.079014] ret_from_fork+0x10/0x20 The issue is that the per-device running_req read in pm8001_dev_gone_notify() never goes to zero and we never make progress. This is caused by missing accounting for running_req for when an internal abort command completes. In commit 2cbbf489778e ("scsi: pm8001: Use libsas internal abort support") we started to send internal abort commands as a proper sas_task. In this when we deliver a sas_task to HW the per-device running_req is incremented in pm8001_queue_command(). However it is never decremented for internal abort commnds, so decrement in pm8001_mpi_task_abort_resp(). Link: https://lore.kernel.org/r/1663854664-76165-1-git-send-email-john.garry@huawei.com Fixes: 2cbbf489778e ("scsi: pm8001: Use libsas internal abort support") Acked-by: Jack Wang Signed-off-by: John Garry Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/pm8001/pm8001_hwi.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c index 91d78d0a38fe..628b08ba6770 100644 --- a/drivers/scsi/pm8001/pm8001_hwi.c +++ b/drivers/scsi/pm8001/pm8001_hwi.c @@ -3612,6 +3612,10 @@ int pm8001_mpi_task_abort_resp(struct pm8001_hba_info *pm8001_ha, void *piomb) pm8001_dbg(pm8001_ha, FAIL, " TASK NULL. RETURNING !!!\n"); return -1; } + + if (t->task_proto == SAS_PROTOCOL_INTERNAL_ABORT) + atomic_dec(&pm8001_dev->running_req); + ts = &t->task_status; if (status != 0) pm8001_dbg(pm8001_ha, FAIL, "task abort failed status 0x%x ,tag = 0x%x, scp= 0x%x\n", From patchwork Wed Oct 19 08: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: 4887 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225366wrs; Wed, 19 Oct 2022 02:42:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4vEJ6vxzG5XWWp/hUAtVCTTQmg0YL5b/xHF2H3EiiJWTS9TBjMFsV2L7B7LsoU5T0tq3p4 X-Received: by 2002:a05:6402:5409:b0:44f:1e05:1e8 with SMTP id ev9-20020a056402540900b0044f1e0501e8mr6513545edb.373.1666172579434; Wed, 19 Oct 2022 02:42:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172579; cv=none; d=google.com; s=arc-20160816; b=oCbaGmImEGgzb1MGnEQvP2aSRcI4hQU9VKu2bymbxi77x8zyi9qUdAfgiXwns4AWRN hTenF7BnkTMogXb1UEXubOzgQYz0NV4EVZtxGZj4mB+vXISmwZNEQvRHHzI5oXtdpZ+l 0SZoBvRqFSv3MEdaGtOwGeW4q2u7gQznzOs22WUltRfAIxj6Ao4xhnvhgbhRh8qrk/CX JZDvy1xIC8yl1tRP4QVgtlUlFZRvJgzow20P0BhP7LLsdU/g8I3YXVPz5FMGEQRkyDEH vErl9GU8f4ECSpBWo6UL6roZ3hV0qMag1iPvEfpWoowLdD04Dy+rpXr46jjBfDk3wjaT MEXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Pv9POG/eWrVDB2c76yZgA5ERsUMtL28cofLyQBFkjx8=; b=Ia48U3sxfA496i3vPD6rgpBXNfCJW+XqAmrK5qeIVWSEBN2SzmCOpbnpZFLsN8ajBJ 7w2ODUamCOAk5ZvyzetVZc3Ulxx4n2MDqnHg81/9d87fY5JXrDOtF8Wmmi9yNt9JlHLU oRGwZYZsMEpqgfPQl9DG8KuNgSy7+e0wSxLgPsC+2W95n1gG98cLMsrw7zfiwlSmIksS xzTavuZQjg5pW5WGuG+4J73iSAVJ5pc2GQ1kppNuUhdzUbGLRh+ycAyI/JSHB4kBAHxK O2u7rptdcgSNgvJTN3AQVhmfLcET9rXfAl7oEGcoLwN9qwgBksNiY+lyLdmEFgCyP3yw Y7fQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xpMAaxS6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qf38-20020a1709077f2600b007823754ecd5si15138360ejc.43.2022.10.19.02.42.34; Wed, 19 Oct 2022 02:42: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=xpMAaxS6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233804AbiJSJcl (ORCPT + 99 others); Wed, 19 Oct 2022 05:32:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233511AbiJSJ2p (ORCPT ); Wed, 19 Oct 2022 05:28:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA980E5EF2; Wed, 19 Oct 2022 02:12: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 D89F16181D; Wed, 19 Oct 2022 09:05:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA733C433D6; Wed, 19 Oct 2022 09:05:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170304; bh=kM2ayhja+gVFWReLn9s3nJy/X++1lg0CJsGfRCb5Pg4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xpMAaxS6BmBbOi4pd5KZLhdlGf/DE4fS7dLT/fOArlGu83qFNaT4UiSp+f9jU6bju PMrXob5mA+SA72BaNsphpu/bTysPeJuknMMY/RwM2zucREIvDG93OXP3MtDk7wc8Y+ AVFLVZUpka023tcE/FhFk0jqCXZ3H25uyTPqs92s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mike Christie , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 6.0 567/862] scsi: iscsi: iscsi_tcp: Fix null-ptr-deref while calling getpeername() Date: Wed, 19 Oct 2022 10:30:54 +0200 Message-Id: <20221019083315.043654715@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108578883795086?= X-GMAIL-MSGID: =?utf-8?q?1747108578883795086?= From: Mike Christie [ Upstream commit 57569c37f0add1b6489e1a1563c71519daf732cf ] Fix a NULL pointer crash that occurs when we are freeing the socket at the same time we access it via sysfs. The problem is that: 1. iscsi_sw_tcp_conn_get_param() and iscsi_sw_tcp_host_get_param() take the frwd_lock and do sock_hold() then drop the frwd_lock. sock_hold() does a get on the "struct sock". 2. iscsi_sw_tcp_release_conn() does sockfd_put() which does the last put on the "struct socket" and that does __sock_release() which sets the sock->ops to NULL. 3. iscsi_sw_tcp_conn_get_param() and iscsi_sw_tcp_host_get_param() then call kernel_getpeername() which accesses the NULL sock->ops. Above we do a get on the "struct sock", but we needed a get on the "struct socket". Originally, we just held the frwd_lock the entire time but in commit bcf3a2953d36 ("scsi: iscsi: iscsi_tcp: Avoid holding spinlock while calling getpeername()") we switched to refcount based because the network layer changed and started taking a mutex in that path, so we could no longer hold the frwd_lock. Instead of trying to maintain multiple refcounts, this just has us use a mutex for accessing the socket in the interface code paths. Link: https://lore.kernel.org/r/20220907221700.10302-1-michael.christie@oracle.com Fixes: bcf3a2953d36 ("scsi: iscsi: iscsi_tcp: Avoid holding spinlock while calling getpeername()") Signed-off-by: Mike Christie Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/iscsi_tcp.c | 73 ++++++++++++++++++++++++++++------------ drivers/scsi/iscsi_tcp.h | 3 ++ 2 files changed, 55 insertions(+), 21 deletions(-) diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index 29b1bd755afe..5fb1f364e815 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c @@ -595,6 +595,8 @@ iscsi_sw_tcp_conn_create(struct iscsi_cls_session *cls_session, INIT_WORK(&conn->recvwork, iscsi_sw_tcp_recv_data_work); tcp_sw_conn->queue_recv = iscsi_recv_from_iscsi_q; + mutex_init(&tcp_sw_conn->sock_lock); + tfm = crypto_alloc_ahash("crc32c", 0, CRYPTO_ALG_ASYNC); if (IS_ERR(tfm)) goto free_conn; @@ -629,11 +631,15 @@ iscsi_sw_tcp_conn_create(struct iscsi_cls_session *cls_session, static void iscsi_sw_tcp_release_conn(struct iscsi_conn *conn) { - struct iscsi_session *session = conn->session; struct iscsi_tcp_conn *tcp_conn = conn->dd_data; struct iscsi_sw_tcp_conn *tcp_sw_conn = tcp_conn->dd_data; struct socket *sock = tcp_sw_conn->sock; + /* + * The iscsi transport class will make sure we are not called in + * parallel with start, stop, bind and destroys. However, this can be + * called twice if userspace does a stop then a destroy. + */ if (!sock) return; @@ -649,9 +655,9 @@ static void iscsi_sw_tcp_release_conn(struct iscsi_conn *conn) iscsi_suspend_rx(conn); - spin_lock_bh(&session->frwd_lock); + mutex_lock(&tcp_sw_conn->sock_lock); tcp_sw_conn->sock = NULL; - spin_unlock_bh(&session->frwd_lock); + mutex_unlock(&tcp_sw_conn->sock_lock); sockfd_put(sock); } @@ -703,7 +709,6 @@ iscsi_sw_tcp_conn_bind(struct iscsi_cls_session *cls_session, struct iscsi_cls_conn *cls_conn, uint64_t transport_eph, int is_leading) { - struct iscsi_session *session = cls_session->dd_data; struct iscsi_conn *conn = cls_conn->dd_data; struct iscsi_tcp_conn *tcp_conn = conn->dd_data; struct iscsi_sw_tcp_conn *tcp_sw_conn = tcp_conn->dd_data; @@ -723,10 +728,10 @@ iscsi_sw_tcp_conn_bind(struct iscsi_cls_session *cls_session, if (err) goto free_socket; - spin_lock_bh(&session->frwd_lock); + mutex_lock(&tcp_sw_conn->sock_lock); /* bind iSCSI connection and socket */ tcp_sw_conn->sock = sock; - spin_unlock_bh(&session->frwd_lock); + mutex_unlock(&tcp_sw_conn->sock_lock); /* setup Socket parameters */ sk = sock->sk; @@ -763,8 +768,15 @@ static int iscsi_sw_tcp_conn_set_param(struct iscsi_cls_conn *cls_conn, break; case ISCSI_PARAM_DATADGST_EN: iscsi_set_param(cls_conn, param, buf, buflen); + + mutex_lock(&tcp_sw_conn->sock_lock); + if (!tcp_sw_conn->sock) { + mutex_unlock(&tcp_sw_conn->sock_lock); + return -ENOTCONN; + } tcp_sw_conn->sendpage = conn->datadgst_en ? sock_no_sendpage : tcp_sw_conn->sock->ops->sendpage; + mutex_unlock(&tcp_sw_conn->sock_lock); break; case ISCSI_PARAM_MAX_R2T: return iscsi_tcp_set_max_r2t(conn, buf); @@ -779,8 +791,8 @@ static int iscsi_sw_tcp_conn_get_param(struct iscsi_cls_conn *cls_conn, enum iscsi_param param, char *buf) { struct iscsi_conn *conn = cls_conn->dd_data; - struct iscsi_tcp_conn *tcp_conn = conn->dd_data; - struct iscsi_sw_tcp_conn *tcp_sw_conn = tcp_conn->dd_data; + struct iscsi_sw_tcp_conn *tcp_sw_conn; + struct iscsi_tcp_conn *tcp_conn; struct sockaddr_in6 addr; struct socket *sock; int rc; @@ -790,21 +802,36 @@ static int iscsi_sw_tcp_conn_get_param(struct iscsi_cls_conn *cls_conn, case ISCSI_PARAM_CONN_ADDRESS: case ISCSI_PARAM_LOCAL_PORT: spin_lock_bh(&conn->session->frwd_lock); - if (!tcp_sw_conn || !tcp_sw_conn->sock) { + if (!conn->session->leadconn) { spin_unlock_bh(&conn->session->frwd_lock); return -ENOTCONN; } - sock = tcp_sw_conn->sock; - sock_hold(sock->sk); + /* + * The conn has been setup and bound, so just grab a ref + * incase a destroy runs while we are in the net layer. + */ + iscsi_get_conn(conn->cls_conn); spin_unlock_bh(&conn->session->frwd_lock); + tcp_conn = conn->dd_data; + tcp_sw_conn = tcp_conn->dd_data; + + mutex_lock(&tcp_sw_conn->sock_lock); + sock = tcp_sw_conn->sock; + if (!sock) { + rc = -ENOTCONN; + goto sock_unlock; + } + if (param == ISCSI_PARAM_LOCAL_PORT) rc = kernel_getsockname(sock, (struct sockaddr *)&addr); else rc = kernel_getpeername(sock, (struct sockaddr *)&addr); - sock_put(sock->sk); +sock_unlock: + mutex_unlock(&tcp_sw_conn->sock_lock); + iscsi_put_conn(conn->cls_conn); if (rc < 0) return rc; @@ -842,17 +869,21 @@ static int iscsi_sw_tcp_host_get_param(struct Scsi_Host *shost, } tcp_conn = conn->dd_data; tcp_sw_conn = tcp_conn->dd_data; - sock = tcp_sw_conn->sock; - if (!sock) { - spin_unlock_bh(&session->frwd_lock); - return -ENOTCONN; - } - sock_hold(sock->sk); + /* + * The conn has been setup and bound, so just grab a ref + * incase a destroy runs while we are in the net layer. + */ + iscsi_get_conn(conn->cls_conn); spin_unlock_bh(&session->frwd_lock); - rc = kernel_getsockname(sock, - (struct sockaddr *)&addr); - sock_put(sock->sk); + mutex_lock(&tcp_sw_conn->sock_lock); + sock = tcp_sw_conn->sock; + if (!sock) + rc = -ENOTCONN; + else + rc = kernel_getsockname(sock, (struct sockaddr *)&addr); + mutex_unlock(&tcp_sw_conn->sock_lock); + iscsi_put_conn(conn->cls_conn); if (rc < 0) return rc; diff --git a/drivers/scsi/iscsi_tcp.h b/drivers/scsi/iscsi_tcp.h index 850a018aefb9..68e14a344904 100644 --- a/drivers/scsi/iscsi_tcp.h +++ b/drivers/scsi/iscsi_tcp.h @@ -28,6 +28,9 @@ struct iscsi_sw_tcp_send { struct iscsi_sw_tcp_conn { struct socket *sock; + /* Taken when accessing the sock from the netlink/sysfs interface */ + struct mutex sock_lock; + struct work_struct recvwork; bool queue_recv; From patchwork Wed Oct 19 08: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: 4798 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp216301wrs; Wed, 19 Oct 2022 02:18:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7vIWwJnIJSQN41wYbXAK/TojxHYuk55nOHWTTuJMXlHb9qPwy99UJVNPH9fbaMCc/MXWfG X-Received: by 2002:a17:906:30c5:b0:782:707:9e2d with SMTP id b5-20020a17090630c500b0078207079e2dmr5821029ejb.286.1666171084047; Wed, 19 Oct 2022 02:18:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666171084; cv=none; d=google.com; s=arc-20160816; b=Fy+Q45W2dMHxDO4UfXEIZA1M6f16YcHItHQkGB7ElrTKT7zHxemwfdOK8iYbnO5Ov6 J562OxwkLfCvzQfLu4LFQFSQdueJMIsCKXLnsX5kjVgNTiC7wocTuei8ja4GLBXJ1IYV TUzwOTX8Com59I1ivZy9eCmnmbv+5J7w4vECDIq9WnFI21xJx67n5HfYDzYk3Ca89KHV GGch7idWOUJGRkvpDudEuWdE1SEgDIKXQ/0NjF9tChZ7YcXHhSg/jT44HEUAQIg0ztIg M4cQyicYxQLPzO7C3hzDeXGlJ2OMA137qFz52+UF1LgFaAIOLKox0YyQvfHzwYXeVB8M mlJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4pdCq+Q/mNU1dzih3D5AxQKT3NZ99hzd+urRWjuk/Kk=; b=RYlRwl58ayLlpHNg0L733xnKAFcCY8YruCanKwF5Hmu7qjsBA/vCzPvIIqMNPsNtnN PHxkDvdm4xdcz6Fj2ncALz8yNL5aEtcExvVrO9B2saJzTs/90fbEvUtBMN/BBlHh7Y0G dahYy+XMot7afaYS2lMC5KuPeVG00THsUwIhWA7dVb1Jbj/nq0NK8cNAXtAna0KX33dg uPo1VgIEg2GfuHqLR21pTHw1hPrEO/KM479FeEe61cm5qNarcqiII0TUylXoEXht+IMg ajd3FWLbV+mmcse/sFOcFQ/KE/X58FFWqrQkzPnSiOzxiqRXDAQVR+sRRNVBBmGEmLbN gH1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=alSJsnEH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dr8-20020a170907720800b0077945c44b7fsi15429864ejc.856.2022.10.19.02.17.40; Wed, 19 Oct 2022 02:18: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=alSJsnEH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233200AbiJSJQj (ORCPT + 99 others); Wed, 19 Oct 2022 05:16:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233114AbiJSJOA (ORCPT ); Wed, 19 Oct 2022 05:14:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D57F1A4867; Wed, 19 Oct 2022 02:04:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6F68B61840; Wed, 19 Oct 2022 09:03:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84248C433C1; Wed, 19 Oct 2022 09:03:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170206; bh=HWsCh6S8kYslKrA90A/YzpYwjW55iz5uvgEbnbjOmZE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=alSJsnEHve3LNkgC8Tj8cNDmWBVUjzyfA/koY586aGiw5uAMgmVVZHaLQbePs1oCD /Bl+s0GM6NAmy1uTFY5GB5xVYUtxWlWR6vnJgF3VQNuHIrmrQQstyOlIPPLIRAfpC+ 1NTJO0aHdYRNwUjkZKJa3jpE7CP8A/K2jw3SRFAs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert Marko , Dmitry Baryshkov , Bjorn Andersson , Sasha Levin Subject: [PATCH 6.0 568/862] clk: qcom: apss-ipq6018: mark apcs_alias0_core_clk as critical Date: Wed, 19 Oct 2022 10:30:55 +0200 Message-Id: <20221019083315.084807810@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747107010825666433?= X-GMAIL-MSGID: =?utf-8?q?1747107010825666433?= From: Robert Marko [ Upstream commit 86e78995c93ee182433f965babfccd48417d4dcf ] While fixing up the driver I noticed that my IPQ8074 board was hanging after CPUFreq switched the frequency during boot, WDT would eventually reset it. So mark apcs_alias0_core_clk as critical since its the clock feeding the CPU cluster and must never be disabled. Fixes: 5e77b4ef1b19 ("clk: qcom: Add ipq6018 apss clock controller") Signed-off-by: Robert Marko Reviewed-by: Dmitry Baryshkov Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220818220628.339366-3-robimarko@gmail.com Signed-off-by: Sasha Levin --- drivers/clk/qcom/apss-ipq6018.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/qcom/apss-ipq6018.c b/drivers/clk/qcom/apss-ipq6018.c index d78ff2f310bf..b5d93657e1ee 100644 --- a/drivers/clk/qcom/apss-ipq6018.c +++ b/drivers/clk/qcom/apss-ipq6018.c @@ -57,7 +57,7 @@ static struct clk_branch apcs_alias0_core_clk = { .parent_hws = (const struct clk_hw *[]){ &apcs_alias0_clk_src.clkr.hw }, .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, + .flags = CLK_SET_RATE_PARENT | CLK_IS_CRITICAL, .ops = &clk_branch2_ops, }, }, From patchwork Wed Oct 19 08: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: 4796 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp216281wrs; Wed, 19 Oct 2022 02:17:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5G8yLQ4TCF9ve/1CeHDV39CcibSPPuKeo8MO20528PtCjZw1uFbm5Rxgr3Es99ehgf9V8a X-Received: by 2002:a17:906:8b81:b0:78e:1cb:e411 with SMTP id nr1-20020a1709068b8100b0078e01cbe411mr5712311ejc.681.1666171079708; Wed, 19 Oct 2022 02:17:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666171079; cv=none; d=google.com; s=arc-20160816; b=onkXO3gALZEC+4ByxsSekjdh8+lHEBBRDtnWVjsciAbyploPmb6x1kEV9bGobWzaT5 KpeEHjCKu2euUxYhpeK/zoNjz+Rb0CZhu1qIxkqrAQ2axnHt+wXTlBc72/r1JbYuGCCh 9YftRteQ8IM/Yi+AoDvXPBvXAPcUp+xjxY+pEEFPRpQljHv7leSyJdKzDV9SlYWx6GlY DIj5psKgUWRanvaklLg9WUrgdpdnT44JHwY0whe3FB2ERykEBS+KowOXPrwaT9liAE53 Bqjuku2U7uITD0v1Pi9il5k3WRAFJPP4WEGzqEA9ks3/FdGRpTE7sdpd2IAW6tUbcHLA qtvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uzbO9DSjnC1Yd0fQAin7YROKX3YifTgd3Ygidwkio6k=; b=yECHn/eQE9/f0NyOXsaMgP5merXxsNJXaTw2+xw5XOZc2yQb3zmCbGphqRl10R6D7x ocdlUsKBTf495QVAblTKKcsXb2OuppJINXiD594dZmSzsTzU1SUHqek/GsGQAU/qrN5n 5pu0SEjEguEAQqz6i0X93Q0Agri2djUKLgj3V1D9pU38udHSMfT+wrSIfSMsz2tdnOGo Qu0tCur3udiJMF2poMi4l3o0ZggvJ+cluGntVj871XytZ+QoGVtNQ7/KQ6A+OH2BS2al 1GPU9Irn/ru5CYw7hyoc82Y51RlpIvP5duJJmfl/mQS2hXNtvA16pHugcK6gODlw5hrb rLSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="RONCrz/L"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a5-20020a056402168500b004592b993080si11513955edv.162.2022.10.19.02.17.35; Wed, 19 Oct 2022 02:17: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="RONCrz/L"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232839AbiJSJQ6 (ORCPT + 99 others); Wed, 19 Oct 2022 05:16:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233168AbiJSJOH (ORCPT ); Wed, 19 Oct 2022 05:14:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9B8BA6C0E; Wed, 19 Oct 2022 02:04: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 1933B617DF; Wed, 19 Oct 2022 09:03:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2BB46C433C1; Wed, 19 Oct 2022 09:03:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170209; bh=ugBjsepRYvYP6ewZJtg3S2+9ioUPke2+iMbvqyO+qVE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RONCrz/LAVxsOjuTpGS62qyeRl27dTnlAqybtkPttgYPnTCQfZttu6I8I504wR3WU INXYMjAEVAvCLUkrJCTDBr+bJ+9H88UoWeLEROCGo3N0d+zVQpWLDGYGKnUlAH2dnX ECkOtKVXIkYFXHgTSEBjs2cxTRvwnB7VJzTQsOP4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Adam Skladowski , Iskren Chernev , Bjorn Andersson , Sasha Levin Subject: [PATCH 6.0 569/862] clk: qcom: gcc-sm6115: Override default Alpha PLL regs Date: Wed, 19 Oct 2022 10:30:56 +0200 Message-Id: <20221019083315.123056749@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747107006265533543?= X-GMAIL-MSGID: =?utf-8?q?1747107006265533543?= From: Adam Skladowski [ Upstream commit 068a0605ef5a6b430e7278c169bfcd25b680b28f ] The DEFAULT and BRAMMO PLL offsets are non-standard in downstream, but currently only BRAMMO ones are overridden. Override DEFAULT ones too. A very similar thing is happening in gcc-qcm2290 driver. Fixes: cbe63bfdc54f ("clk: qcom: Add Global Clock controller (GCC) driver for SM6115") Signed-off-by: Adam Skladowski Signed-off-by: Iskren Chernev Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220830075620.974009-2-iskren.chernev@gmail.com Signed-off-by: Sasha Levin --- drivers/clk/qcom/gcc-sm6115.c | 46 +++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/drivers/clk/qcom/gcc-sm6115.c b/drivers/clk/qcom/gcc-sm6115.c index 68fe9f6f0d2f..e24a977c2580 100644 --- a/drivers/clk/qcom/gcc-sm6115.c +++ b/drivers/clk/qcom/gcc-sm6115.c @@ -53,11 +53,25 @@ static struct pll_vco gpll10_vco[] = { { 750000000, 1500000000, 1 }, }; +static const u8 clk_alpha_pll_regs_offset[][PLL_OFF_MAX_REGS] = { + [CLK_ALPHA_PLL_TYPE_DEFAULT] = { + [PLL_OFF_L_VAL] = 0x04, + [PLL_OFF_ALPHA_VAL] = 0x08, + [PLL_OFF_ALPHA_VAL_U] = 0x0c, + [PLL_OFF_TEST_CTL] = 0x10, + [PLL_OFF_TEST_CTL_U] = 0x14, + [PLL_OFF_USER_CTL] = 0x18, + [PLL_OFF_USER_CTL_U] = 0x1c, + [PLL_OFF_CONFIG_CTL] = 0x20, + [PLL_OFF_STATUS] = 0x24, + }, +}; + static struct clk_alpha_pll gpll0 = { .offset = 0x0, .vco_table = default_vco, .num_vco = ARRAY_SIZE(default_vco), - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr = { .enable_reg = 0x79000, .enable_mask = BIT(0), @@ -83,7 +97,7 @@ static struct clk_alpha_pll_postdiv gpll0_out_aux2 = { .post_div_table = post_div_table_gpll0_out_aux2, .num_post_div = ARRAY_SIZE(post_div_table_gpll0_out_aux2), .width = 4, - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr.hw.init = &(struct clk_init_data){ .name = "gpll0_out_aux2", .parent_hws = (const struct clk_hw *[]){ &gpll0.clkr.hw }, @@ -115,7 +129,7 @@ static struct clk_alpha_pll_postdiv gpll0_out_main = { .post_div_table = post_div_table_gpll0_out_main, .num_post_div = ARRAY_SIZE(post_div_table_gpll0_out_main), .width = 4, - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr.hw.init = &(struct clk_init_data){ .name = "gpll0_out_main", .parent_hws = (const struct clk_hw *[]){ &gpll0.clkr.hw }, @@ -137,7 +151,7 @@ static struct clk_alpha_pll gpll10 = { .offset = 0xa000, .vco_table = gpll10_vco, .num_vco = ARRAY_SIZE(gpll10_vco), - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr = { .enable_reg = 0x79000, .enable_mask = BIT(10), @@ -163,7 +177,7 @@ static struct clk_alpha_pll_postdiv gpll10_out_main = { .post_div_table = post_div_table_gpll10_out_main, .num_post_div = ARRAY_SIZE(post_div_table_gpll10_out_main), .width = 4, - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr.hw.init = &(struct clk_init_data){ .name = "gpll10_out_main", .parent_hws = (const struct clk_hw *[]){ &gpll10.clkr.hw }, @@ -189,7 +203,7 @@ static struct clk_alpha_pll gpll11 = { .vco_table = default_vco, .num_vco = ARRAY_SIZE(default_vco), .flags = SUPPORTS_DYNAMIC_UPDATE, - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr = { .enable_reg = 0x79000, .enable_mask = BIT(11), @@ -215,7 +229,7 @@ static struct clk_alpha_pll_postdiv gpll11_out_main = { .post_div_table = post_div_table_gpll11_out_main, .num_post_div = ARRAY_SIZE(post_div_table_gpll11_out_main), .width = 4, - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr.hw.init = &(struct clk_init_data){ .name = "gpll11_out_main", .parent_hws = (const struct clk_hw *[]){ &gpll11.clkr.hw }, @@ -229,7 +243,7 @@ static struct clk_alpha_pll gpll3 = { .offset = 0x3000, .vco_table = default_vco, .num_vco = ARRAY_SIZE(default_vco), - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr = { .enable_reg = 0x79000, .enable_mask = BIT(3), @@ -248,7 +262,7 @@ static struct clk_alpha_pll gpll4 = { .offset = 0x4000, .vco_table = default_vco, .num_vco = ARRAY_SIZE(default_vco), - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr = { .enable_reg = 0x79000, .enable_mask = BIT(4), @@ -274,7 +288,7 @@ static struct clk_alpha_pll_postdiv gpll4_out_main = { .post_div_table = post_div_table_gpll4_out_main, .num_post_div = ARRAY_SIZE(post_div_table_gpll4_out_main), .width = 4, - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr.hw.init = &(struct clk_init_data){ .name = "gpll4_out_main", .parent_hws = (const struct clk_hw *[]){ &gpll4.clkr.hw }, @@ -287,7 +301,7 @@ static struct clk_alpha_pll gpll6 = { .offset = 0x6000, .vco_table = default_vco, .num_vco = ARRAY_SIZE(default_vco), - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr = { .enable_reg = 0x79000, .enable_mask = BIT(6), @@ -313,7 +327,7 @@ static struct clk_alpha_pll_postdiv gpll6_out_main = { .post_div_table = post_div_table_gpll6_out_main, .num_post_div = ARRAY_SIZE(post_div_table_gpll6_out_main), .width = 4, - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr.hw.init = &(struct clk_init_data){ .name = "gpll6_out_main", .parent_hws = (const struct clk_hw *[]){ &gpll6.clkr.hw }, @@ -326,7 +340,7 @@ static struct clk_alpha_pll gpll7 = { .offset = 0x7000, .vco_table = default_vco, .num_vco = ARRAY_SIZE(default_vco), - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr = { .enable_reg = 0x79000, .enable_mask = BIT(7), @@ -352,7 +366,7 @@ static struct clk_alpha_pll_postdiv gpll7_out_main = { .post_div_table = post_div_table_gpll7_out_main, .num_post_div = ARRAY_SIZE(post_div_table_gpll7_out_main), .width = 4, - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr.hw.init = &(struct clk_init_data){ .name = "gpll7_out_main", .parent_hws = (const struct clk_hw *[]){ &gpll7.clkr.hw }, @@ -380,7 +394,7 @@ static struct clk_alpha_pll gpll8 = { .offset = 0x8000, .vco_table = default_vco, .num_vco = ARRAY_SIZE(default_vco), - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .flags = SUPPORTS_DYNAMIC_UPDATE, .clkr = { .enable_reg = 0x79000, @@ -407,7 +421,7 @@ static struct clk_alpha_pll_postdiv gpll8_out_main = { .post_div_table = post_div_table_gpll8_out_main, .num_post_div = ARRAY_SIZE(post_div_table_gpll8_out_main), .width = 4, - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr.hw.init = &(struct clk_init_data){ .name = "gpll8_out_main", .parent_hws = (const struct clk_hw *[]){ &gpll8.clkr.hw }, From patchwork Wed Oct 19 08: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: 4819 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223375wrs; Wed, 19 Oct 2022 02:37:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6I0RYKGfhZWZYTYhzy1AfWD2Sc2UZzrVvAhIkLZDhovpVw2U7eDygcWUMrMrLqWvSwqi9L X-Received: by 2002:a17:902:e944:b0:179:dee4:f115 with SMTP id b4-20020a170902e94400b00179dee4f115mr7758369pll.141.1666172242090; Wed, 19 Oct 2022 02:37:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172242; cv=none; d=google.com; s=arc-20160816; b=jl4fi/RSPSy/kPF+TT7I3CPs8/7TcvBDzbN49gHfqHYGkdcNUzbwpz2ke3R8DrRaos FeaHSEvuSCI91eNamT8+nFFeAlTapYmosXFXojJBNBRlQaspH74+jZPoSkgfv+FlJi3W Nl/1kuhluRfhukR0mPn9uPSk+/ZnR7kiZZ3OU378tB0KZGQIEG5qtzWi+DcYXEuzkDDl DLA2xrQpYh1iq9Ltnbx98xgk8KVtg1eKsAteI5iqGzcNp37996KwRdToupgtn8sJayTi zlrwuNtJJXwRpjpwXUPTwuu8w7VsrRCE0VzetJeILfgqcJlT4uyB3fyLm7NMwotr/r7j 8mkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xh++wBJhdNx9KW1LcGE/naA4aWkRTb208ii+kYmFqNU=; b=nePmCjFWM1wBdm9JgMNf3WrVZ/CxZYn1nObi9cTCgDj/upg71hxX/jEmjGmw5HSmVf aKWfw/bpH1tNGdEhP1e6eSOxvH7y/t5M/Og8Fm5B+M5tkMgYKTipYdsJDNC4jGUkwmkc zdcLH16VB1oL5wNHTEXrVAFjh2U633mSaAvr/Fs/pMj8/zQaI5PBXnMxFmlHY99W8yoL LfEkAgzGpFm/Tpmigr8AFmEb38qPxIlUiwBmV4Y40FAkXrRX8x8wEjOkrysggcb8HN5/ SFrcCQtrpniz2/cTMeKYzJaT4I3bg740eRLGwwS9oUALMegbbpjLUkgno41MW79XEU9q 88SA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sUFtiuTv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e15-20020a63db0f000000b00440395dafc7si18777507pgg.187.2022.10.19.02.37.09; Wed, 19 Oct 2022 02:37: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=sUFtiuTv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233336AbiJSJUf (ORCPT + 99 others); Wed, 19 Oct 2022 05:20:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233475AbiJSJTT (ORCPT ); Wed, 19 Oct 2022 05:19:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC114D77C0; Wed, 19 Oct 2022 02:08: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 CB8126178B; Wed, 19 Oct 2022 09:03:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF25AC433C1; Wed, 19 Oct 2022 09:03:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170212; bh=sQ9NXxr/f8eLg3digNQPAnvxyfeNTxmeNbktTp8h32g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sUFtiuTvXciwz+xm+hNoCOfJC8bNmYYPLyMmPxpJV0iQI75WM4zh4qvxCUNXz/ZEH AuxTAmwpg3vOPTujt7Y9Zip/fc4QTfMhgALeQPvQDCSmDIn2l2nPT6SCFpYyYxoVYH Fpztkg+BLolRBp7G9Q9Y6AVNFrPab5Zu96+z2ANI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christoph Hellwig , Sagi Grimberg , Hannes Reinecke , Sasha Levin Subject: [PATCH 6.0 570/862] nvmet-auth: dont try to cancel a non-initialized work_struct Date: Wed, 19 Oct 2022 10:30:57 +0200 Message-Id: <20221019083315.174120838@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108224906232531?= X-GMAIL-MSGID: =?utf-8?q?1747108224906232531?= From: Christoph Hellwig [ Upstream commit 1befd944e05050d76950014f3dc04ed47faba2c3 ] Currently blktests nvme/002 trips up debugobjects if CONFIG_NVME_AUTH is enabled, but authentication is not on a queue. This is because nvmet_auth_sq_free cancels sq->auth_expired_work unconditionaly, while auth_expired_work is only ever initialized if authentication is enabled for a given controller. Fix this by calling most of what is nvmet_init_auth unconditionally when initializing the SQ, and just do the setting of the result field in the connect command handler. Fixes: db1312dd9548 ("nvmet: implement basic In-Band Authentication") Signed-off-by: Christoph Hellwig Reviewed-by: Sagi Grimberg Reviewed-by: Hannes Reinecke Signed-off-by: Sasha Levin --- drivers/nvme/target/core.c | 1 + drivers/nvme/target/fabrics-cmd-auth.c | 13 ++++--------- drivers/nvme/target/fabrics-cmd.c | 6 ++++-- drivers/nvme/target/nvmet.h | 7 ++++--- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c index 7f4083cf953a..14677145bbba 100644 --- a/drivers/nvme/target/core.c +++ b/drivers/nvme/target/core.c @@ -832,6 +832,7 @@ int nvmet_sq_init(struct nvmet_sq *sq) } init_completion(&sq->free_done); init_completion(&sq->confirm_done); + nvmet_auth_sq_init(sq); return 0; } diff --git a/drivers/nvme/target/fabrics-cmd-auth.c b/drivers/nvme/target/fabrics-cmd-auth.c index ebdf9aa81041..0c078b6b1447 100644 --- a/drivers/nvme/target/fabrics-cmd-auth.c +++ b/drivers/nvme/target/fabrics-cmd-auth.c @@ -23,17 +23,12 @@ static void nvmet_auth_expired_work(struct work_struct *work) sq->dhchap_tid = -1; } -void nvmet_init_auth(struct nvmet_ctrl *ctrl, struct nvmet_req *req) +void nvmet_auth_sq_init(struct nvmet_sq *sq) { - u32 result = le32_to_cpu(req->cqe->result.u32); - /* Initialize in-band authentication */ - INIT_DELAYED_WORK(&req->sq->auth_expired_work, - nvmet_auth_expired_work); - req->sq->authenticated = false; - req->sq->dhchap_step = NVME_AUTH_DHCHAP_MESSAGE_NEGOTIATE; - result |= (u32)NVME_CONNECT_AUTHREQ_ATR << 16; - req->cqe->result.u32 = cpu_to_le32(result); + INIT_DELAYED_WORK(&sq->auth_expired_work, nvmet_auth_expired_work); + sq->authenticated = false; + sq->dhchap_step = NVME_AUTH_DHCHAP_MESSAGE_NEGOTIATE; } static u16 nvmet_auth_negotiate(struct nvmet_req *req, void *d) diff --git a/drivers/nvme/target/fabrics-cmd.c b/drivers/nvme/target/fabrics-cmd.c index f91a56180d3d..bd739d8b6991 100644 --- a/drivers/nvme/target/fabrics-cmd.c +++ b/drivers/nvme/target/fabrics-cmd.c @@ -272,7 +272,8 @@ static void nvmet_execute_admin_connect(struct nvmet_req *req) req->cqe->result.u16 = cpu_to_le16(ctrl->cntlid); if (nvmet_has_auth(ctrl)) - nvmet_init_auth(ctrl, req); + req->cqe->result.u32 |= + cpu_to_le32((u32)NVME_CONNECT_AUTHREQ_ATR << 16); out: kfree(d); complete: @@ -334,7 +335,8 @@ static void nvmet_execute_io_connect(struct nvmet_req *req) pr_debug("adding queue %d to ctrl %d.\n", qid, ctrl->cntlid); req->cqe->result.u16 = cpu_to_le16(ctrl->cntlid); if (nvmet_has_auth(ctrl)) - nvmet_init_auth(ctrl, req); + req->cqe->result.u32 |= + cpu_to_le32((u32)NVME_CONNECT_AUTHREQ_ATR << 16); out: kfree(d); diff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h index 6ffeeb0a1c49..dfe3894205aa 100644 --- a/drivers/nvme/target/nvmet.h +++ b/drivers/nvme/target/nvmet.h @@ -704,7 +704,7 @@ int nvmet_auth_set_key(struct nvmet_host *host, const char *secret, bool set_ctrl); int nvmet_auth_set_host_hash(struct nvmet_host *host, const char *hash); int nvmet_setup_auth(struct nvmet_ctrl *ctrl); -void nvmet_init_auth(struct nvmet_ctrl *ctrl, struct nvmet_req *req); +void nvmet_auth_sq_init(struct nvmet_sq *sq); void nvmet_destroy_auth(struct nvmet_ctrl *ctrl); void nvmet_auth_sq_free(struct nvmet_sq *sq); int nvmet_setup_dhgroup(struct nvmet_ctrl *ctrl, u8 dhgroup_id); @@ -726,8 +726,9 @@ static inline int nvmet_setup_auth(struct nvmet_ctrl *ctrl) { return 0; } -static inline void nvmet_init_auth(struct nvmet_ctrl *ctrl, - struct nvmet_req *req) {}; +static inline void nvmet_auth_sq_init(struct nvmet_sq *sq) +{ +} static inline void nvmet_destroy_auth(struct nvmet_ctrl *ctrl) {}; static inline void nvmet_auth_sq_free(struct nvmet_sq *sq) {}; static inline bool nvmet_check_auth_status(struct nvmet_req *req) From patchwork Wed Oct 19 08: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: 5494 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp335613wrs; Wed, 19 Oct 2022 06:45:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7o5/gmJIcABLNdtayStRQkUcsfPOQHzKjWvioVk9nSixvohN6qZ1JvTWpp9knO3y5opar4 X-Received: by 2002:a17:902:ccc2:b0:178:29e1:899e with SMTP id z2-20020a170902ccc200b0017829e1899emr8665393ple.114.1666187123759; Wed, 19 Oct 2022 06:45:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666187123; cv=none; d=google.com; s=arc-20160816; b=qsnVplypNJe4OQ6si7fXJ4hMcSNCEq45rcn3t8LW8CG2LcLG1vcVONVZu0usvTnvVN af2YDxtks09s5+ZaegZ73Tap3xGyus6kIyWNBLypk85t+P+U0KOvP+goVLB7OhYBrlIP d0SUAehT0VPF7Imu5VHtm/UVDQHiKA5Se57DmjsPASNTLeKDc6XgSE4GTEv0Wy4FUqnp +LjZDoiaOr0KywyM+of4OQRFpYzotm1EHDH/CpVWW/4HZ1vCBHy4YDz6qpOgv9yypGfq zUm23VjVJ1+iBCOsbRtGZTVddKZBr0oVTaPm4m/l2UTa8WnSWLwS4c6RG6cXmOkQ3NeB XKog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ECo/VfjmQW7BUodEZYLvpc8c6ZpbV/X6r82S8Rwfv58=; b=wMQBs5rP+36oJgfI0SbOgI70RvsYH6RKZZongKrfNCj/+qatpoVP3XmoxQMt+ldwYG 4iJaDKHL2Mv5rtZIQb2wmS9eMETZgFStoXkyueF3glEcVGmmVV5tQEov0bD7ermFDVa4 Qdb7NETf1/KF0LoQSTPRicKxe3EIV4tV6DALQ196CXw9pUjtx2cveKxx7ZzbhF9k/zUf 0O6YTjho/DvYACsnzX9m3Vx/DlZBT7n6Vt+7p2YqEsR8thf59zMjBJuhDWKyrDBZxDuV FWeIyOXsZG99dexq61i0Bh8PLcAHzOsfAp2CLG69joz0YAkY9cB6eedyk+vxFCBLdqZh WzSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LD5y8ho4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b16-20020a639310000000b0045e00b905cbsi18996589pge.73.2022.10.19.06.45.10; Wed, 19 Oct 2022 06:45: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=LD5y8ho4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232165AbiJSNna (ORCPT + 99 others); Wed, 19 Oct 2022 09:43:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233026AbiJSNmv (ORCPT ); Wed, 19 Oct 2022 09:42:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A60CD4000E; Wed, 19 Oct 2022 06:29:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3044CB82464; Wed, 19 Oct 2022 09:03:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F89DC433D6; Wed, 19 Oct 2022 09:03:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170214; bh=dGxpgPpxv2upwt6DOdrkuPto6gj0JiwAD2NSZhFByPw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LD5y8ho44nZBFwqNsOocXz5AI7ggRhfVctMEIAPveP25Wj8tSLO63DEecJ38uqvCS excAWeNP7R1YprGA/srWbpMxWf4TqlLRl4pZNlhIjyaHkqIm1xcHpMAsylaJmJsl+O lzPdIAQ5Do/8hnu6W/iiq2QVnBgnp5gG8FX4sds0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bob Pearson , Li Zhijian , Jason Gunthorpe , Sasha Levin Subject: [PATCH 6.0 571/862] RDMA/rxe: Set pd early in mr alloc routines Date: Wed, 19 Oct 2022 10:30:58 +0200 Message-Id: <20221019083315.211477935@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123829637450237?= X-GMAIL-MSGID: =?utf-8?q?1747123829637450237?= From: Bob Pearson [ Upstream commit 58651bbb30f87dab474eff31ab564391aa6ea1f3 ] Move setting of pd in mr objects ahead of any possible errors so that it will always be set in rxe_mr_cleanup() to avoid seg faults when rxe_put(mr_pd(mr)) is called. Fixes: cf40367961d8 ("RDMA/rxe: Move mr cleanup code to rxe_mr_cleanup()") Link: https://lore.kernel.org/r/20220805183153.32007-2-rpearsonhpe@gmail.com Signed-off-by: Bob Pearson Reviewed-by: Li Zhijian Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin --- drivers/infiniband/sw/rxe/rxe_loc.h | 6 +++--- drivers/infiniband/sw/rxe/rxe_mr.c | 11 ++++------- drivers/infiniband/sw/rxe/rxe_verbs.c | 12 +++++++----- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_loc.h b/drivers/infiniband/sw/rxe/rxe_loc.h index 22f6cc31d1d6..c2a5c8814a48 100644 --- a/drivers/infiniband/sw/rxe/rxe_loc.h +++ b/drivers/infiniband/sw/rxe/rxe_loc.h @@ -64,10 +64,10 @@ int rxe_mmap(struct ib_ucontext *context, struct vm_area_struct *vma); /* rxe_mr.c */ u8 rxe_get_next_key(u32 last_key); -void rxe_mr_init_dma(struct rxe_pd *pd, int access, struct rxe_mr *mr); -int rxe_mr_init_user(struct rxe_pd *pd, u64 start, u64 length, u64 iova, +void rxe_mr_init_dma(int access, struct rxe_mr *mr); +int rxe_mr_init_user(struct rxe_dev *rxe, u64 start, u64 length, u64 iova, int access, struct rxe_mr *mr); -int rxe_mr_init_fast(struct rxe_pd *pd, int max_pages, struct rxe_mr *mr); +int rxe_mr_init_fast(int max_pages, struct rxe_mr *mr); int rxe_mr_copy(struct rxe_mr *mr, u64 iova, void *addr, int length, enum rxe_mr_copy_dir dir); int copy_data(struct rxe_pd *pd, int access, struct rxe_dma_info *dma, diff --git a/drivers/infiniband/sw/rxe/rxe_mr.c b/drivers/infiniband/sw/rxe/rxe_mr.c index 850b80f5ad8b..af34f198e645 100644 --- a/drivers/infiniband/sw/rxe/rxe_mr.c +++ b/drivers/infiniband/sw/rxe/rxe_mr.c @@ -103,17 +103,16 @@ static int rxe_mr_alloc(struct rxe_mr *mr, int num_buf) return -ENOMEM; } -void rxe_mr_init_dma(struct rxe_pd *pd, int access, struct rxe_mr *mr) +void rxe_mr_init_dma(int access, struct rxe_mr *mr) { rxe_mr_init(access, mr); - mr->ibmr.pd = &pd->ibpd; mr->access = access; mr->state = RXE_MR_STATE_VALID; mr->type = IB_MR_TYPE_DMA; } -int rxe_mr_init_user(struct rxe_pd *pd, u64 start, u64 length, u64 iova, +int rxe_mr_init_user(struct rxe_dev *rxe, u64 start, u64 length, u64 iova, int access, struct rxe_mr *mr) { struct rxe_map **map; @@ -125,7 +124,7 @@ int rxe_mr_init_user(struct rxe_pd *pd, u64 start, u64 length, u64 iova, int err; int i; - umem = ib_umem_get(pd->ibpd.device, start, length, access); + umem = ib_umem_get(&rxe->ib_dev, start, length, access); if (IS_ERR(umem)) { pr_warn("%s: Unable to pin memory region err = %d\n", __func__, (int)PTR_ERR(umem)); @@ -175,7 +174,6 @@ int rxe_mr_init_user(struct rxe_pd *pd, u64 start, u64 length, u64 iova, } } - mr->ibmr.pd = &pd->ibpd; mr->umem = umem; mr->access = access; mr->length = length; @@ -197,7 +195,7 @@ int rxe_mr_init_user(struct rxe_pd *pd, u64 start, u64 length, u64 iova, return err; } -int rxe_mr_init_fast(struct rxe_pd *pd, int max_pages, struct rxe_mr *mr) +int rxe_mr_init_fast(int max_pages, struct rxe_mr *mr) { int err; @@ -208,7 +206,6 @@ int rxe_mr_init_fast(struct rxe_pd *pd, int max_pages, struct rxe_mr *mr) if (err) goto err1; - mr->ibmr.pd = &pd->ibpd; mr->max_buf = max_pages; mr->state = RXE_MR_STATE_FREE; mr->type = IB_MR_TYPE_MEM_REG; diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c index e264cf69bf55..f54a3eba652f 100644 --- a/drivers/infiniband/sw/rxe/rxe_verbs.c +++ b/drivers/infiniband/sw/rxe/rxe_verbs.c @@ -903,7 +903,9 @@ static struct ib_mr *rxe_get_dma_mr(struct ib_pd *ibpd, int access) return ERR_PTR(-ENOMEM); rxe_get(pd); - rxe_mr_init_dma(pd, access, mr); + mr->ibmr.pd = ibpd; + + rxe_mr_init_dma(access, mr); rxe_finalize(mr); return &mr->ibmr; @@ -928,8 +930,9 @@ static struct ib_mr *rxe_reg_user_mr(struct ib_pd *ibpd, rxe_get(pd); + mr->ibmr.pd = ibpd; - err = rxe_mr_init_user(pd, start, length, iova, access, mr); + err = rxe_mr_init_user(rxe, start, length, iova, access, mr); if (err) goto err3; @@ -938,7 +941,6 @@ static struct ib_mr *rxe_reg_user_mr(struct ib_pd *ibpd, return &mr->ibmr; err3: - rxe_put(pd); rxe_cleanup(mr); err2: return ERR_PTR(err); @@ -962,8 +964,9 @@ static struct ib_mr *rxe_alloc_mr(struct ib_pd *ibpd, enum ib_mr_type mr_type, } rxe_get(pd); + mr->ibmr.pd = ibpd; - err = rxe_mr_init_fast(pd, max_num_sg, mr); + err = rxe_mr_init_fast(max_num_sg, mr); if (err) goto err2; @@ -972,7 +975,6 @@ static struct ib_mr *rxe_alloc_mr(struct ib_pd *ibpd, enum ib_mr_type mr_type, return &mr->ibmr; err2: - rxe_put(pd); rxe_cleanup(mr); err1: return ERR_PTR(err); From patchwork Wed Oct 19 08: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: 4797 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp216286wrs; Wed, 19 Oct 2022 02:18:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7ydUBZ3VU1ff43FmDDLUz9Yyhl+QPtO3JRsa9jcXJY+XNvfj/h6ytfxDwM7F/+fRVnc5sx X-Received: by 2002:a17:907:3f27:b0:78d:ad42:f733 with SMTP id hq39-20020a1709073f2700b0078dad42f733mr6092996ejc.320.1666171081800; Wed, 19 Oct 2022 02:18:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666171081; cv=none; d=google.com; s=arc-20160816; b=Lsmb/AmBwa66II54qb98erM335X90aFnHWNkzrREhNCfsiuLgIvlahQsUunubI/u37 o5ABnMBrljsbptpERLX4DIKMtg8Q0x9bZzqCD8MouUqK4FueXSy/W98b/BwuQUQSqPOH Baigk8ytvoG6yCPYgl/uSK/rDp0CyUi2sFZzyJWtXY47TG3uCRS2beej+CmpjykMVIqP Xo0PeXSOtIeX2DyISEqmpisW15de9Uu17Ue13sB5QUurF6vX8pV5G/t81bg82wM0YWKo EGKcY8O1xyXd78CpnlmZOfc6srsVH3MTCozfbN0uRN81qe48vPG787cObIg9LcmJWiIZ E6Tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=R+b2huPMsaMi5FgkgPUWChaHItGkkPxr9G8EYuakqs4=; b=kbcmYq4pBrgYPXskL/tXK6iupHSFUS4ijVrR52sjfArTN4QFGTL2/l9uMF+S8fNJFd 5VA/xOLTsjUmJSt5IgPhb+LojrM9d4laERSte0afSjiX1ExsK73vtxbKef/wrSfByLRz UvB0B/TdbOj5eY5kNxXCAwYpPJzq5SZqjQKucU0ael/YMO8scJq2w62AT4CqWZ1QWQik 6u5kX/o+6Z5gtavYVWdkwU3MKES0bdekthAeD+MT4X1zaUGuSYSzC4Wr/qDTxtgavWi+ Qos1Yc4NX13B1/zFoKLNAoJWbkNBYu+bwDUVInCmpaif9kfz2TXX/yvHDKp1hVBN8cS1 kM9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AUQjT+iA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qa44-20020a17090786ac00b0078a10c159b4si13969723ejc.290.2022.10.19.02.17.37; Wed, 19 Oct 2022 02:18: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=AUQjT+iA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233116AbiJSJRC (ORCPT + 99 others); Wed, 19 Oct 2022 05:17:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233180AbiJSJOI (ORCPT ); Wed, 19 Oct 2022 05:14:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B43019C7C2; Wed, 19 Oct 2022 02:04: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 1500E617F1; Wed, 19 Oct 2022 09:03:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27781C433D6; Wed, 19 Oct 2022 09:03:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170217; bh=tv9L0ATtm/g+3f1svrh0qKf6P+ZJy0hTBvk3G0cON/Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AUQjT+iA5Z6zgiBk5ZOoA44rgMuyTrX9tLHKMFcdtwzZY2RGiL1d2qWgHI8eKs9o6 u96360hwOy2K71OF9RLUG3FSqlRdrqMMCUw5CkNjkjXWnL/TuZ5TGz1qgqxUUuDf1P NzfW2VzzEPe2v7GOD+L4EPf0jD+T2jmFb9xLZr5Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bob Pearson , Li Zhijian , Jason Gunthorpe , Sasha Levin Subject: [PATCH 6.0 572/862] RDMA/rxe: Fix resize_finish() in rxe_queue.c Date: Wed, 19 Oct 2022 10:30:59 +0200 Message-Id: <20221019083315.249347163@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747107008487130318?= X-GMAIL-MSGID: =?utf-8?q?1747107008487130318?= From: Bob Pearson [ Upstream commit fda5d0cf8aef12f0a4f714a96a4b2fce039a3e55 ] Currently in resize_finish() in rxe_queue.c there is a loop which copies the entries in the original queue into a newly allocated queue. The termination logic for this loop is incorrect. The call to queue_next_index() updates cons but has no effect on whether the queue is empty. So if the queue starts out empty nothing is copied but if it is not then the loop will run forever. This patch changes the loop to compare the value of cons to the original producer index. Fixes: ae6e843fe08d0 ("RDMA/rxe: Add memory barriers to kernel queues") Link: https://lore.kernel.org/r/20220825221446.6512-1-rpearsonhpe@gmail.com Signed-off-by: Bob Pearson Reviewed-by: Li Zhijian Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin --- drivers/infiniband/sw/rxe/rxe_queue.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_queue.c b/drivers/infiniband/sw/rxe/rxe_queue.c index dbd4971039c0..d6dbf5a0058d 100644 --- a/drivers/infiniband/sw/rxe/rxe_queue.c +++ b/drivers/infiniband/sw/rxe/rxe_queue.c @@ -112,23 +112,25 @@ static int resize_finish(struct rxe_queue *q, struct rxe_queue *new_q, unsigned int num_elem) { enum queue_type type = q->type; + u32 new_prod; u32 prod; u32 cons; if (!queue_empty(q, q->type) && (num_elem < queue_count(q, type))) return -EINVAL; - prod = queue_get_producer(new_q, type); + new_prod = queue_get_producer(new_q, type); + prod = queue_get_producer(q, type); cons = queue_get_consumer(q, type); - while (!queue_empty(q, type)) { - memcpy(queue_addr_from_index(new_q, prod), + while ((prod - cons) & q->index_mask) { + memcpy(queue_addr_from_index(new_q, new_prod), queue_addr_from_index(q, cons), new_q->elem_size); - prod = queue_next_index(new_q, prod); + new_prod = queue_next_index(new_q, new_prod); cons = queue_next_index(q, cons); } - new_q->buf->producer_index = prod; + new_q->buf->producer_index = new_prod; q->buf->consumer_index = cons; /* update private index copies */ From patchwork Wed Oct 19 08: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: 5284 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp280930wrs; Wed, 19 Oct 2022 05:01:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4HKFvRtUWukXbhgjfDtKqN1ayHk76/QnSpoSi07r0n6BozVlfzXZQQTfiJv28h01OJGDkw X-Received: by 2002:a17:907:2c75:b0:78d:c201:e9aa with SMTP id ib21-20020a1709072c7500b0078dc201e9aamr6422790ejc.235.1666180888090; Wed, 19 Oct 2022 05:01:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666180888; cv=none; d=google.com; s=arc-20160816; b=oO+ENHksfy2iqKNZ/CHaVGHYaIqpHVXVaZnSBuggUE9ObxPyhD8I0S4cN6kvWrZeP1 7UcacVoZ8XsrOoqsVDqqsNbZ8ZppL9nayym3Y3AXo5TSqL6L/aBuWnYAECiwg4S2NlQJ H8y2hUI93s22qoRNMsuLN434syqtGeI9CqWQnv5FkYa2dM3hRkrUR4A67xAHr3mQebN3 ThE3bp1/7F4L6eVL2bIz3+jK8MgCttMnD031uVNMrvdLIQhiOisYTZDNRLAWky3UXoP9 Rrs0k/OokDe7AXVjo0BCIe396/Iv51cVzktSRjrBx5a2E7MHiUEdHgMHwdA1L89F8y7w Ivqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2gns+FEdS4MRDGVMHTHPbHNp/HxSEF7fIZwKgvc6t3o=; b=SC2yjDkSsvviQfgdN/tYrNjHd4DmAotQLTxrX3/qpeDhfvozTKwUalR7p9WryDs9AF 8NZPXMXB0TqT/MqgcKZVYG9ljdd1o7ZLIVl4cnjMMx0rongJ6+tY5cDaXsfyEl7xcemD rwlUmPvCHTjlJbguuAdzjLW6UHh/k91vDVsDWusc7IC+5D6FrQDZ9Y6kWbGbofcRlwyJ bwNyjuHazK40Nl9wJ6Gkxs+j8HwHE5lwW8Wu2wz8Q/sQTUn6NbklMzonK5mgKARDsR8b VYKnzNF82IOIi/P3fO/Dvs5pwDSRvBAqtFwxQSDw7H+b5jdsMZ9SKdfcrM5+FG2INhAL JlEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sNT3XQMg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s10-20020a170906354a00b007891fd9179bsi11787374eja.150.2022.10.19.05.00.59; Wed, 19 Oct 2022 05:01: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=sNT3XQMg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231837AbiJSL4E (ORCPT + 99 others); Wed, 19 Oct 2022 07:56:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232624AbiJSLyy (ORCPT ); Wed, 19 Oct 2022 07:54: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 4DAE8BE51C; Wed, 19 Oct 2022 04:34: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 sin.source.kernel.org (Postfix) with ESMTPS id D30A6CE2157; Wed, 19 Oct 2022 09:03:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B50C4C433C1; Wed, 19 Oct 2022 09:03:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170220; bh=1OAwvSabGh6LnKItuicwtRw9I08Q/Qc3Yz5P8kejiIA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sNT3XQMgoTyxVBCMHZf/jf5RHQ+SvhM/NLbITtdDL/txxfriWRt0HkIQsL3h4mFOp EEqwgmIxHHydCYJnLYnFT4Bbvh8wQcigyVvIXdgsG7Ph0/mtXcF2++fVinaSEnkmGt ussTs7x1W8ncngz2BURXn6bAN1X8GQVRvfOI3nZw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Eddie James , Joel Stanley , Sasha Levin Subject: [PATCH 6.0 573/862] fsi: core: Check error number after calling ida_simple_get Date: Wed, 19 Oct 2022 10:31:00 +0200 Message-Id: <20221019083315.296999903@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747117290983692504?= X-GMAIL-MSGID: =?utf-8?q?1747117290983692504?= From: Jiasheng Jiang [ Upstream commit 35af9fb49bc5c6d61ef70b501c3a56fe161cce3e ] If allocation fails, the ida_simple_get() will return error number. So master->idx could be error number and be used in dev_set_name(). Therefore, it should be better to check it and return error if fails, like the ida_simple_get() in __fsi_get_new_minor(). Fixes: 09aecfab93b8 ("drivers/fsi: Add fsi master definition") Signed-off-by: Jiasheng Jiang Reviewed-by: Eddie James Link: https://lore.kernel.org/r/20220111073411.614138-1-jiasheng@iscas.ac.cn Signed-off-by: Joel Stanley Signed-off-by: Sasha Levin --- drivers/fsi/fsi-core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c index 3a7b78e36701..5858e6339a10 100644 --- a/drivers/fsi/fsi-core.c +++ b/drivers/fsi/fsi-core.c @@ -1314,6 +1314,9 @@ int fsi_master_register(struct fsi_master *master) mutex_init(&master->scan_lock); master->idx = ida_simple_get(&master_ida, 0, INT_MAX, GFP_KERNEL); + if (master->idx < 0) + return master->idx; + dev_set_name(&master->dev, "fsi%d", master->idx); master->dev.class = &fsi_master_class; From patchwork Wed Oct 19 08: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: 4924 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225858wrs; Wed, 19 Oct 2022 02:44:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5mRj2KNIpmRYgcKaZAmB1+XdJ4bpltwGP4TDUBlia+9KHZCXCbKzy6pxF+paqrf2DRb6zU X-Received: by 2002:a17:907:75dc:b0:783:9c71:5e20 with SMTP id jl28-20020a17090775dc00b007839c715e20mr6012062ejc.125.1666172652932; Wed, 19 Oct 2022 02:44:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172652; cv=none; d=google.com; s=arc-20160816; b=YiuFrTHy0Tk2kqurIJ/8Ay3mHATPMV6U+Ll+Fo2QP4mp3k14yWAlFGv/ZMC6lWJFWv qrMabBf622DNNP2WNZcninUvT8rY+0L3z/kIxvkqXK2Fpc1gjSSTXF2MVPi9FLboSgEx +XSX30fwLAaVW3lp5u1QBCG7DdAvBOk4WffVEBz1+F2CD7lJbVNe98d4Nr8mDFvP3xWD n3PntemAcQ6wziqxVG7xr8MIgk6RHpo3rva0CKFCwnPu8CellH7rrywBbcaqBfFffKjk 0sjT69Ze+hZLC8hceJ3kFrg0lqVdu+SZvBrILI8IaCiucctDxKjszfxG4E4jNr6sb9PV VTww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DaTEd/xT6UTzO3OgvZc60DTCtjxGPPhX+9N6vYoS20k=; b=FkWebk22XhxmsUgjunWJJ3nu886N2I8IYxN2L8IRU6Z8p0PkbMGhyfe+8p38emjrrZ rXN4r+xWvZO13xUwpFrKN4ynoVfhnkwl8VoMKetfWGfLSEdK2xMozEXMSFuotYAgbnGS LbChzmJnnITY2o6MKJNQfHJzD76W0PHrk/mfizD7yoivTsSX1ejahhsbsKVLhyRGnUeO jHhUqSS+xYNUX9JvB5efUTsbwl+i5mnhTEsMqliD5oOQ2/9B3lSP14GiezK+r6y5OQ4l WroupwLX+5qP7KNIQ9gu1jO7n9cFD7SbCfbnT3ruIFx8gpsOVdLh2FX7lJS70KC9ncFJ P7Ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lrl30fVH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qw22-20020a1709066a1600b0073d91a38b35si14029855ejc.789.2022.10.19.02.43.36; Wed, 19 Oct 2022 02:44: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=lrl30fVH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233711AbiJSJdk (ORCPT + 99 others); Wed, 19 Oct 2022 05:33:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233756AbiJSJ3T (ORCPT ); Wed, 19 Oct 2022 05:29:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E828EB77A; Wed, 19 Oct 2022 02:13: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 7424061847; Wed, 19 Oct 2022 09:03:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A2DDC433D6; Wed, 19 Oct 2022 09:03:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170222; bh=TOSu46mciuE/L6gJio2Q140JlgyZxiLGuzWYQlMx65Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lrl30fVHbt9xRvTXna0z9IGBq1T7bAUl6aHIpNoi/QVFqAQE2XzVkyIhHPJbnIoQi Z9o6CfsmlWVKIns9WRR2moWEhprzhbRmfSC+hpCeMrYP0hoZhCIdJ7NH//kPS7Ncfp YOFik7maRyFM6DXQlqVvSS1eOeK/fnHABFWrfeBs= 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 6.0 574/862] mfd: intel_soc_pmic: Fix an error handling path in intel_soc_pmic_i2c_probe() Date: Wed, 19 Oct 2022 10:31:01 +0200 Message-Id: <20221019083315.333881079@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108655642740399?= X-GMAIL-MSGID: =?utf-8?q?1747108655642740399?= 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 5e8c94e008ed..85d070bce0e2 100644 --- a/drivers/mfd/intel_soc_pmic_core.c +++ b/drivers/mfd/intel_soc_pmic_core.c @@ -77,6 +77,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 Wed Oct 19 08: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: 4795 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp216249wrs; Wed, 19 Oct 2022 02:17:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4C93mi7G+NKKf5bUOGSlxXUjnncA88awXUxhFvUX5Y0sAaZnfHGANEoa8bof3JiPF7Cro+ X-Received: by 2002:a17:907:7ea7:b0:78d:3638:9018 with SMTP id qb39-20020a1709077ea700b0078d36389018mr5968871ejc.236.1666171075793; Wed, 19 Oct 2022 02:17:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666171075; cv=none; d=google.com; s=arc-20160816; b=dN1GRO8JMGBucih2GFzsWieSdjxU6+e3nQUu5qGn+Sq4drBNYiBe1UAez8StE2wY8t B1ZWcX87nTAGi504XZlCxqXGE3agOvtW4zU4DeaaYYyQs+pA/yxcVsv/5okB/6Le2sD6 6yFcahqdoeDw8IHIQvrcfeqwZVm1SdcT8F+ngqrE+xiREuuVF1paNXzvDRW2WFccJWnI 8WSKpnjTFZSK/GlODKtEMu5+2vMXf5iQyDoizA5YZtqwLjiZoqk0NLTpirXVBtzXt7F8 aNIb8gtAveMxDWrXF1lLjQgbu3iKiRmE/+aDFjs37rk7VV2TLRGoVMoju+jDs0nfzEZB h6KQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XTIhGMgQ0F1wWDDTAASWJeNHYYCpzlxmNaVF2yvzPXo=; b=xbDrbxA4u+LUxMHBnitNXO8Gc+5IbZ4hty4HAgh3qyJ83Su9rtpW0F9zOkQDBsMU2j oN4FeVgiToS986E6sO07cx4NVcX+xquS9mm8WXkzPRsvBQImXOpJCDwWlSVYIAO4wbpd fMnxWU6CNPETLgtpktKC2iSFMwCE2kPJq4APvJ3anWUhtpeuRrD045KcguzpVlR0QG1S d2g09dBoEXDvt32X5xHlpKplDr6NvHnkAXIb4k3wZMLmz0DbsaWzu3HKazfsNboVq9/R nUzdZRwSs8kcxGeM1BrY5cZbEF5NU5Hn/QOtDbKqEKKExN+3yZ4bObjQHu0HwsWnXGi/ Jqig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ayhabMHj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p11-20020a056402500b00b0045cca8f9a0asi16179292eda.580.2022.10.19.02.17.31; Wed, 19 Oct 2022 02:17: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=ayhabMHj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233217AbiJSJQx (ORCPT + 99 others); Wed, 19 Oct 2022 05:16:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233139AbiJSJOD (ORCPT ); Wed, 19 Oct 2022 05:14: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 4824096202; Wed, 19 Oct 2022 02:04:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1A75B61777; Wed, 19 Oct 2022 09:03:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2EABCC433C1; Wed, 19 Oct 2022 09:03:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170225; bh=7rNgIZ8t7ZwPJgpss76pj0gV2+cw0OBlIpaZoHxPsnE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ayhabMHjQrCVibZvyfrJsKFK/KGJO2/obCPoZDZRGGrH7tphrosaD80yI9d/HQbfP QMvd0i+YHm/Xu5c6aqthHlyO1vIC0Xl3c6hL4zz21E6KK+YJxFGy9UDOlI2aGQvj6u BOWoXp2K16LOL5CpYKwTziF1mXCpJO9V7vruZNkE= 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 6.0 575/862] mfd: fsl-imx25: Fix an error handling path in mx25_tsadc_setup_irq() Date: Wed, 19 Oct 2022 10:31:02 +0200 Message-Id: <20221019083315.382420303@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747107002032401993?= X-GMAIL-MSGID: =?utf-8?q?1747107002032401993?= From: Christophe JAILLET [ Upstream commit 3fa9e4cfb55da512ebfd57336fde468830719298 ] If devm_of_platform_populate() fails, some resources need to be released. Introduce a mx25_tsadc_unset_irq() function that undoes mx25_tsadc_setup_irq() and call it both from the new error handling path of the probe and in the remove function. Fixes: a55196eff6d6 ("mfd: fsl-imx25: Use devm_of_platform_populate()") Signed-off-by: Christophe JAILLET Signed-off-by: Lee Jones Link: https://lore.kernel.org/r/d404e04828fc06bcfddf81f9f3e9b4babbe35415.1659269156.git.christophe.jaillet@wanadoo.fr Signed-off-by: Sasha Levin --- drivers/mfd/fsl-imx25-tsadc.c | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/drivers/mfd/fsl-imx25-tsadc.c b/drivers/mfd/fsl-imx25-tsadc.c index 37e5e02a1d05..85f7982d26d2 100644 --- a/drivers/mfd/fsl-imx25-tsadc.c +++ b/drivers/mfd/fsl-imx25-tsadc.c @@ -84,6 +84,19 @@ static int mx25_tsadc_setup_irq(struct platform_device *pdev, return 0; } +static int mx25_tsadc_unset_irq(struct platform_device *pdev) +{ + struct mx25_tsadc *tsadc = platform_get_drvdata(pdev); + int irq = platform_get_irq(pdev, 0); + + if (irq) { + irq_set_chained_handler_and_data(irq, NULL, NULL); + irq_domain_remove(tsadc->domain); + } + + return 0; +} + static void mx25_tsadc_setup_clk(struct platform_device *pdev, struct mx25_tsadc *tsadc) { @@ -171,18 +184,21 @@ static int mx25_tsadc_probe(struct platform_device *pdev) platform_set_drvdata(pdev, tsadc); - return devm_of_platform_populate(dev); + ret = devm_of_platform_populate(dev); + if (ret) + goto err_irq; + + return 0; + +err_irq: + mx25_tsadc_unset_irq(pdev); + + return ret; } static int mx25_tsadc_remove(struct platform_device *pdev) { - struct mx25_tsadc *tsadc = platform_get_drvdata(pdev); - int irq = platform_get_irq(pdev, 0); - - if (irq) { - irq_set_chained_handler_and_data(irq, NULL, NULL); - irq_domain_remove(tsadc->domain); - } + mx25_tsadc_unset_irq(pdev); return 0; } From patchwork Wed Oct 19 08: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: 4800 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp216319wrs; Wed, 19 Oct 2022 02:18:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM69d9h7KWRBEQ3y0yQtIzeJ7evry04HXgmt+DnLWJxAp9cp5zhlJClX9Ragm3hj+R7nqayd X-Received: by 2002:a05:6402:d75:b0:459:fad8:fbf with SMTP id ec53-20020a0564020d7500b00459fad80fbfmr6407920edb.0.1666171087050; Wed, 19 Oct 2022 02:18:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666171087; cv=none; d=google.com; s=arc-20160816; b=jXbL1EiwEwuLoHXTqwMtP+H+Yf0D+4BOAWIncjo2wSN2Rfi3uCNKVDkAW85LJ+///H KTye7y1xBmVXIITmrY7pgh06mCmkvDEA+YdItIETkvWcHV8kHCBEpGhTl0wMGypZjSGc 0YFwlSxrsqqy8Ne8f/mE1N45J56Chxje3hk9tWJB0v/gngOD/MuBeUlxg5okiuVrcPrb SD+M89/AwsP9kejtibR9q4KR94zmTGzQVyCjbXAfAXMnOFxB/03C6XjKXIt6HhJZnPmD xo3N7a03Anjm3XUSx902cYTmaMF9SKr2PCjp1gm17Gil5ndoNF4o+6qwfJ2Q7EPAt2vM YoLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/yB1Ibw3wCLACPtCe4w/w4R9JkSResqOfKHH1PCnfio=; b=gRUBzfZ4AKYQYGMCTEdWJXrmtDo5klV7c4pjOkI1A9j12UngcpcxumNWsqC9O7LLYy qtfGO8Dl5EqvpYhpoYLINVROl2aHT/ikv3LmpomWG0CfySz7C9yo22NTGUVQcEWjFBZR EWC0ioYb2Cgx4p/b2RHM0RMP6goU1qyXNhEZw2431BjqvgGXYlheXaltbVG+WgVAl9EK cPMYZU1j98Fy9xUiDD/ZUYY75ZjyHy8ZWN2s8TgNq1331nPX+ei//vpOM4AiFovDpm5B LuheaZwnfQHAQJb4y5Q4eg3SOoqAYl40ziBw5pORoUjsx0jrCRGYSjlzqMa6rnalHgBN HLBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oUi0ZhXF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l13-20020a170906794d00b00781d6cda765si15054165ejo.913.2022.10.19.02.17.42; Wed, 19 Oct 2022 02:18: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=oUi0ZhXF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233150AbiJSJRG (ORCPT + 99 others); Wed, 19 Oct 2022 05:17:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233203AbiJSJOL (ORCPT ); Wed, 19 Oct 2022 05:14: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 05ACBF57; Wed, 19 Oct 2022 02:04: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 A20C46185F; Wed, 19 Oct 2022 09:03:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA90CC433C1; Wed, 19 Oct 2022 09:03:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170228; bh=WXxZPIWiyubGD4UyoxgS6nPk1TseZmuCXaYHcZUh6f4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oUi0ZhXFEkVmHWIecD/eeEMxwt7SlHn+vjwTxOQMqZZTrfBtFZYZ0gy7I+vLQAU5w nVZJObeoBDQM23wDxCJ60SkyId465xYqvyWWNA8nOEl4oKRVBCpvv33nt07sBpI428 0qiPfJ0RBUP/5+3xVqtoCTO4f14CRdHjQWaQeykw= 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 6.0 576/862] mfd: lp8788: Fix an error handling path in lp8788_probe() Date: Wed, 19 Oct 2022 10:31:03 +0200 Message-Id: <20221019083315.421760313@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747107013889414096?= X-GMAIL-MSGID: =?utf-8?q?1747107013889414096?= 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 c223d2c6a363..998e8cc408a0 100644 --- a/drivers/mfd/lp8788.c +++ b/drivers/mfd/lp8788.c @@ -195,8 +195,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 Wed Oct 19 08:31:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5416 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp315985wrs; Wed, 19 Oct 2022 06:07:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4RGdyOqb3sk+DS/VfSlRLXn/ofv/fn8njuzk4HmWLXbqtPi1S3WqCs9Foje8czrqtnSMnj X-Received: by 2002:a17:903:24e:b0:179:b755:b82f with SMTP id j14-20020a170903024e00b00179b755b82fmr8106331plh.34.1666184823944; Wed, 19 Oct 2022 06:07:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666184823; cv=none; d=google.com; s=arc-20160816; b=jwQsDoN3CGKIR5NTE7K+FtKbYlXn+mIiWuIBzic0zBKhFQA2X2A/zvjI++cutYwtLA uxAFEUuYpgi6Xus/lY3ORIqG2jWMSQZqa3qTfu15QTdiIl2trTwP+BS+aAEM7XpVkuCL UdACAiMsWAiVDVjCD6+5+iz9ihFXcPCe4Oa/94wfnHthetsUgbJQrFnvzZlRwEKwZeCX 0Bac2g6I0hKQOHlN7EOCVQMau2yWZhaiVZZDVMTB6EfkzjISCDqukqBfHYsNaTTZriyH OyNd4BHCRjhn5MXIqChL8ADVsabucpKUXUqnVAgZTfU63XsMI/6rloPQDbp3C8vID9WD xm0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zzon+syC4d/y8skF7+zvINdnuWToVbLqabMxD8RyuoU=; b=lBi2ed+Wo22T1bb0mN5GKOrYOreSjK9jDodwC2BA1d9VyE0QNxoF9ouD97T+L4y4iH MD5bavRZHOOZUhYeNeUS0fs9+Ulfs1ZlRa0XB763cfqq3TG1lpWjHspeD94tY/uvbDTj hNJZg7VFj/ks0hrSwxBprFb0XeYcW6qgOjCCXIKuqNKHtxF2KxrMrxfNqgq5iXHFK8Zt X6NXrgvGsV++gxnmVvc/agx7jFw/5J+cgxtLe+e1/OyloXzzlocQQT6qN84eqULjNQT7 uFoPoWg3WrY6TmShEUVM16CYmeB2wf4rEpRKAL3CEsxPd/RLmufCXWTES+7NEkxZqPdc b3Pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CagYI3fh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m17-20020a170902e41100b001786830f52asi15565831ple.308.2022.10.19.06.06.35; Wed, 19 Oct 2022 06:07: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=CagYI3fh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232488AbiJSNCq (ORCPT + 99 others); Wed, 19 Oct 2022 09:02:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231755AbiJSNCR (ORCPT ); Wed, 19 Oct 2022 09:02:17 -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 37448630C; Wed, 19 Oct 2022 05: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 sin.source.kernel.org (Postfix) with ESMTPS id 78E06CE215C; Wed, 19 Oct 2022 09:03:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58610C433D6; Wed, 19 Oct 2022 09:03:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170230; bh=Ku35vuD17YGpq0QHl+DAKe80YrZ/0TpL18rzyvhTdJ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CagYI3fh6r38FyflXj4TC2rflExuXnvmtp87s4RFxpALov6+hTXxTtKi+6/ZTDQxy BqKSEAfhT7Y7Ldx6BNBNHsoxtA6EnRa7Mon5icmMdE0YL/ejB6bxqyfutUsKX1FcD8 lpa5ar5TOvJIUAc+G9gB1pMe1c36xlk6HL65OSVM= 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 6.0 577/862] mfd: lp8788: Fix an error handling path in lp8788_irq_init() and lp8788_irq_init() Date: Wed, 19 Oct 2022 10:31:04 +0200 Message-Id: <20221019083315.456426694@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747121418261016985?= X-GMAIL-MSGID: =?utf-8?q?1747121418261016985?= 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 348439a3fbbd..39006297f3d2 100644 --- a/drivers/mfd/lp8788-irq.c +++ b/drivers/mfd/lp8788-irq.c @@ -175,6 +175,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; } @@ -188,4 +189,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 Wed Oct 19 08: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: 4896 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225531wrs; Wed, 19 Oct 2022 02:43:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5C8RhWWpc8e9IrSPZ+Yjrpc0tGJs0GnWORUlW3HrLAVpIoGJkz72pZb2CiUM+XCjdKiodh X-Received: by 2002:a17:907:1c28:b0:78d:4616:e6b6 with SMTP id nc40-20020a1709071c2800b0078d4616e6b6mr5672589ejc.257.1666172601521; Wed, 19 Oct 2022 02:43:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172601; cv=none; d=google.com; s=arc-20160816; b=GcyJ/6PY9bTWtJGFhjgNGXJTGAbe9hZTub+XKFCV+j8afj4+dl8cz7a4WvOycQ9CRD oOgp8LnUZ6mn4FtSsJcKlHK3jgngxAlYuxRz4PVrdooO7Gwqdttpfx7XK2nWBCCs1dhK jpRwecfdzZXBHuhNr03q3fy5W+9Yeejw94ETMJDh7a8cxULZWM5GZBQsVSIOmAppclEg oZqUBZk8xIFokuUDWm/CvdlLrGCzv3m5lE9k2HtR1oERPeb3JZZDmHop/xcHK5dmPV7V +4GHHT5RPiPq7rkuzkckXadAeKh65/rL7zHTl1orDw8RwedHchUQ/Kdhb6icDJNnomSl J61w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0ATPCS8Y3WjRgGflB2uOFybiEyvctPzj/oV05yt+ARo=; b=eT6ZOOQyr7T1d8RIa9ZZujthiO30DY11YLcwCSB7pS56fUUjr1/1whGThEEwdI19Y3 2yo2bNrvPl2/BVefdybKEkoXzYYnaeQPM8RdYpbvXQgoYNMQphZy3AGtPbUAHEnXQZ3x jdedRsgD8NRUt5B7/FN74cl6AZ7k+CsUvFanUzMbA0O0sdcxYWaObSBGGl+QItsfzf0z KboW3jKmhITw2CwmKROdIf7aCGlQttc4CiyV0KTI1G+FxkEwjtoFNpHv5jjGopZ8VxBH 4yYFA/Ts+wYoI6ZrGXWORNOCQx9qGm0Oya9FMOo0JAkeP5hwNMnodPczXcQfFVRh+e2U oJjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RE4wFPHl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a17090716a000b0078ddd8656d9si14806648ejc.9.2022.10.19.02.42.56; Wed, 19 Oct 2022 02:43:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RE4wFPHl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234026AbiJSJe0 (ORCPT + 99 others); Wed, 19 Oct 2022 05:34:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233785AbiJSJ30 (ORCPT ); Wed, 19 Oct 2022 05:29:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EF0D6BD57; Wed, 19 Oct 2022 02:13: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 74BB661857; Wed, 19 Oct 2022 09:03:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 808E7C433D6; Wed, 19 Oct 2022 09:03:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170235; bh=qWqlig6IlzpHHxfd14zNaM8RXMalHFwmu12oJV+HDCI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RE4wFPHlsVGZWDPYocoyd2cwcSGvp2mmdHwwl8niUJWKFmr8dPWpQqplnQX8V/X2/ QfPYC29kWS4Cc3rX678ZDj4EBEiXutqQEEcGh7zoc8C2wSkVE2BeQ087V1xw+0o2gG mm2iledHzDt+Ppx50Z8OC+yFDKA4m2NfIL2VCydY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Martin Kaiser , Lee Jones , Sasha Levin Subject: [PATCH 6.0 578/862] mfd: fsl-imx25: Fix check for platform_get_irq() errors Date: Wed, 19 Oct 2022 10:31:05 +0200 Message-Id: <20221019083315.496182277@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108602024447787?= X-GMAIL-MSGID: =?utf-8?q?1747108602024447787?= From: Dan Carpenter [ Upstream commit 75db7907355ca5e2ff606e9dd3e86b6c3a455fe2 ] The mx25_tsadc_remove() function assumes all non-zero returns are success but the platform_get_irq() function returns negative on error and positive non-zero values on success. It never returns zero, but if it did then treat that as a success. Fixes: 18f773937968 ("mfd: fsl-imx25: Clean up irq settings during removal") Signed-off-by: Dan Carpenter Reviewed-by: Martin Kaiser Signed-off-by: Lee Jones Link: https://lore.kernel.org/r/YvTfkbVQWYKMKS/t@kili Signed-off-by: Sasha Levin --- drivers/mfd/fsl-imx25-tsadc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mfd/fsl-imx25-tsadc.c b/drivers/mfd/fsl-imx25-tsadc.c index 85f7982d26d2..823595bcc9b7 100644 --- a/drivers/mfd/fsl-imx25-tsadc.c +++ b/drivers/mfd/fsl-imx25-tsadc.c @@ -69,7 +69,7 @@ static int mx25_tsadc_setup_irq(struct platform_device *pdev, int irq; irq = platform_get_irq(pdev, 0); - if (irq <= 0) + if (irq < 0) return irq; tsadc->domain = irq_domain_add_simple(np, 2, 0, &mx25_tsadc_domain_ops, @@ -89,7 +89,7 @@ static int mx25_tsadc_unset_irq(struct platform_device *pdev) struct mx25_tsadc *tsadc = platform_get_drvdata(pdev); int irq = platform_get_irq(pdev, 0); - if (irq) { + if (irq >= 0) { irq_set_chained_handler_and_data(irq, NULL, NULL); irq_domain_remove(tsadc->domain); } From patchwork Wed Oct 19 08: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: 5472 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp332540wrs; Wed, 19 Oct 2022 06:39:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7svGS1A6hwz9/mHX48D3dfwZVgBw5MPf4TguHzTwULsZeA+Guxebkxm6TgVFdZyBO9QqP5 X-Received: by 2002:a17:902:8c92:b0:178:29d4:600f with SMTP id t18-20020a1709028c9200b0017829d4600fmr8699421plo.40.1666186743482; Wed, 19 Oct 2022 06:39:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666186743; cv=none; d=google.com; s=arc-20160816; b=XOHjptgJCxNIjz5QE5AbvA9UuzELPftOLqW4525xD4gKkX59VsBouxIABPqPmYMQnP S+54kbFvYTtsmw892s/uQtdUYf/nc6xvIulWNQSecnYF/aHCw0mjdOcOuBSPMdRA4lDT Wsl1yQFg3QbTghbe58nxF4rCmGfCSa7jqdKmEal2kFMvZvRgpqOOxECXsMSJ6axqL3dT CADGP8x7vQ6RXR4VEz37THWJekcbmN3J7lrAdh49XtAENts/Yyp2YpRqpe+Q//tx2qrZ R2Haygk89TAKFH2MRzshTG87BLIN+nfnQGobej/xWhHrCTkuVr6ErLhek8HCCpNGy+f4 rQhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hUbD7jYnkfK2RLtqHcB1eSo0ORYYYje42e/pQX0r7+0=; b=yf+tDSlpTVcidbbgQZmyb/XNQBli4cxA2NsS6f3z6U/XkSjCslPLSEP98uM/uIzzWk qUPR255P00prVRNsPaXzMO8GviWFrPGPzIqD93ty9DGif+cO0BnNCFNoqOtyqvpL+ERO zdi9ciEARrrc1mn/evWq5YTWFizS0cojxykPp8wE3hn4bo0vQ/6cc+wEeHjC63i4aNzR qGDofItbat2xsFRVX6u5Gr5IwlasZEal5s25Hj/bHMISGkFnTOmnuX8iMQadUy7NA2XK 4RKvkFRO+/yX7RRl5EekPSMSxrB/po7fwWWV3CgQqa1IrHE0hHQc3t4nLvbg8FLqPQX3 XxIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gYkU8cKV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u31-20020a63141f000000b0045a048683e1si18310343pgl.58.2022.10.19.06.38.50; Wed, 19 Oct 2022 06:39: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=gYkU8cKV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229755AbiJSNf1 (ORCPT + 99 others); Wed, 19 Oct 2022 09:35:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232993AbiJSNed (ORCPT ); Wed, 19 Oct 2022 09:34: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 442781DB898; Wed, 19 Oct 2022 06:23: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 ams.source.kernel.org (Postfix) with ESMTPS id 9BA5DB82470; Wed, 19 Oct 2022 09:03:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D0C4C433C1; Wed, 19 Oct 2022 09:03:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170238; bh=/HIERa100lh8MOJ+VnEm9GMQEByn7+Vm+HFFy4N/aVA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gYkU8cKV9C2WyBw9VlhISJV8LsRwTuKAtA4do4DE8Kh0Ubw4EmUUOLBGcikaU5lo5 Ys3f98mY2cP6YE0EeOYxxP+JicW3Q5KEJvZjvw1gpC+wUvAHxJBmtxwgmJ/6YLo/2c 5nMIQprWEL9s6FlhTSf9NPWwF/9EDK9AQK50voms= 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 6.0 579/862] mfd: sm501: Add check for platform_driver_register() Date: Wed, 19 Oct 2022 10:31:06 +0200 Message-Id: <20221019083315.537366902@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123430983323869?= X-GMAIL-MSGID: =?utf-8?q?1747123430983323869?= 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 bc0a2c38653e..3ac4508a6742 100644 --- a/drivers/mfd/sm501.c +++ b/drivers/mfd/sm501.c @@ -1720,7 +1720,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 Wed Oct 19 08: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: 5285 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp281070wrs; Wed, 19 Oct 2022 05:01:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4i7xDVaePG8OwT3k0Vwz6IPof55ZyKUQKVTFmpdIK5v/Q+jM9ctwSMZE/977OjrA1OspAE X-Received: by 2002:a17:907:2711:b0:78e:c2a:a3fb with SMTP id w17-20020a170907271100b0078e0c2aa3fbmr6356265ejk.556.1666180896810; Wed, 19 Oct 2022 05:01:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666180896; cv=none; d=google.com; s=arc-20160816; b=esf1hXGIvbiBKRPgT8WG/6UrUIvdyl0O9rh2xOa4gr4V+uwqqdYOvExX2eNSuyb+zk NOV1qfaPfiUTZ9T+q/Ay5PNRLO1efhk7cRy4O01n6zOynBNUZKd5vJw/oSsuv0dfJYuS u/AOygmwEcbNH5SBgMNEZR32vXW7ac/XRNNjZ7kFDl21uyv23eZfLVxG8pD1GMOvbKOl bGWJE4okh3m5iT+ZQVaG2BQY52tubicE/jzliLXCEViwWBqO3KUEbYWNY++OcRgpgimc Ao47z2aLYzidIVmfVTMDgD04WZHdOci8TVMlzbVOoCvEcWJKL8mW5NSgVDPxG+pwdF6l l0fA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6lTb0eKTiMxmfcHJM9/oa7dpHu3BOlegrHT8hcIg9yQ=; b=z6Zhr/tVlgkNlmPAZLv219njrxAKSpvgmLZX3DsqLhHBmuua70Tiujxr0NSSb2EW3M eEXx6c/pFdJfT3ArhewrC+Pk90Rz6MnwVWQR9marZLKjPI7CKYehRbZ07Mis+R4X239t 21gxS1vSX9eEeDuQvxkpIg/M/fbTELRpzWp/kppw6qbVUvdAcOPkE/OROs2QJJ+DASE4 XPh/pNvtTYhWvQLbFFIkUaFLiM7+aX00OXR5MZb5uWUivKxm8WdPIr669H+AN1FR/hRB /HVe7K6tEt/KxEZNGMg75afd+r7xnYAXZkwc2v7T+BwCRrbPckTA+C5LO7pjWZ5u9w+u mVEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="F3Ar/MPv"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i29-20020a50871d000000b0045cbe41a837si12898120edb.308.2022.10.19.05.01.08; Wed, 19 Oct 2022 05:01: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="F3Ar/MPv"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232317AbiJSL4W (ORCPT + 99 others); Wed, 19 Oct 2022 07:56:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232666AbiJSLyy (ORCPT ); Wed, 19 Oct 2022 07:54: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 EFD621B94CA; Wed, 19 Oct 2022 04:34: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 B2B4BCE20EA; Wed, 19 Oct 2022 09:04:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B89AAC433C1; Wed, 19 Oct 2022 09:04:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170241; bh=1Ex0IhPVO/kdm+4mY+F4aJIeYW5QUwl8qdfY4dthjZE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F3Ar/MPv7RVXaYR1KdIjxJqg4CDkBUD5gug8ZM7ZxXao8ilBRwZpT0nHtRgbelNie FEoG33fb/is3D4VDA4EEfIIquzNGPl7g1lq5HdRmATfTGzw5uXU0oHXjGwXGCrduMi q0kgOD8QZsFeUyD617fA0CkyMG3RvXJhAPfqu4+g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jens Hillenstedt , Adam Ward , Lee Jones , Sasha Levin Subject: [PATCH 6.0 580/862] mfd: da9061: Fix Failed to set Two-Wire Bus Mode. Date: Wed, 19 Oct 2022 10:31:07 +0200 Message-Id: <20221019083315.577464035@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747117300278344027?= X-GMAIL-MSGID: =?utf-8?q?1747117300278344027?= From: Jens Hillenstedt [ Upstream commit 834382ea32865a4bdeae83ec2dcb9321dc9489f2 ] In da9062_i2c_probe() regmap_clear_bits() tries to access CONFIG_J register. As CONFIG_J is not present in da9061_aa_writeable_ranges[] probe of da9061 fails: da9062 2-0058: Entering I2C mode! da9062 2-0058: Failed to set Two-Wire Bus Mode. da9062: probe of 2-0058 failed with error -5 Add CONFIG_J register to da9061_aa_writeable_ranges[]. Fixes: 5c6f0f456351 ("mfd: da9062: Support SMBus and I2C mode") Signed-off-by: Jens Hillenstedt Reviewed-by: Adam Ward Signed-off-by: Lee Jones Link: https://lore.kernel.org/r/20220915092004.168744-1-jens.hillenstedt@ise.de Signed-off-by: Sasha Levin --- drivers/mfd/da9062-core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mfd/da9062-core.c b/drivers/mfd/da9062-core.c index 2774b2cbaea6..c2acdbcd5d6b 100644 --- a/drivers/mfd/da9062-core.c +++ b/drivers/mfd/da9062-core.c @@ -453,6 +453,7 @@ static const struct regmap_range da9061_aa_writeable_ranges[] = { regmap_reg_range(DA9062AA_VBUCK1_B, DA9062AA_VBUCK4_B), regmap_reg_range(DA9062AA_VBUCK3_B, DA9062AA_VBUCK3_B), regmap_reg_range(DA9062AA_VLDO1_B, DA9062AA_VLDO4_B), + regmap_reg_range(DA9062AA_CONFIG_J, DA9062AA_CONFIG_J), regmap_reg_range(DA9062AA_GP_ID_0, DA9062AA_GP_ID_19), }; From patchwork Wed Oct 19 08: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: 4802 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp216395wrs; Wed, 19 Oct 2022 02:18:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7J3JNprIbs3DW2Q11naOjOB7qjvsBmRMrRTH1TxvdD9TCmm3zB0b+8QIA8iCsMzmf1pxbg X-Received: by 2002:a05:6402:f83:b0:458:8c97:29af with SMTP id eh3-20020a0564020f8300b004588c9729afmr6443264edb.210.1666171097363; Wed, 19 Oct 2022 02:18:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666171097; cv=none; d=google.com; s=arc-20160816; b=RbSu4pYl2GEJpBRXqMRTe5nUlPvVZ5TyXwVxIkCVGYU1ubCvANEcpZTk2V0fJibQkP CQUZ6rRhQvL06coA9HIPxKLgCvDUa5a/KSBYsN48q1CwWtsVng1dAGY/+lZfEdnk+GtE 7PAdMJzu8aR4AVnkmhf0hKlRyUVyi2m290nUMOrpoQyDWMYkHrjkQypq2VQlDzjq2YNW wp3rmD60qaM2Og2aEDytKeMmWtXYSv3rgLFgma2w4wW2CBTSqgkYz+kkIkx4ZGeBTBVo tXxIn6iAzroxlTg94pgRcMkfaNEcQbXRGnIRZdWCRopYM+u6wzIEBs3lr397hnKzm8hS rANA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6uAE3ooxfCfRaPEyOTN8dSX9k7p1mrvClZ/iBMbAZDU=; b=JjaQKUS4MQLRS58PxJBjZ108zJmybgWNUHiOYkWaUFHwjdgyUxiFRjm7ebXRfYrsjH VzD3jBVjy+zwjtYhBUfCHKYgsSBY+XpOwXxPt/NDo9gPdCdoFq66zLBhRI/+KKHFkYX/ FY4v+Ff367+iDXoKVaxDMJ/Erv4TBmQ/IIHxBo0dyVxSywPqFsEDDzvFEvq5i5XfH6bD u8ir21o1xYEMv5LRjXMCHB09cvrGA9hH4kTtNUNXE5ueCEQZldoJSinbgaJh+jEoGZfN MILcKTNM2WYoBwWubr51Hh2dWTU0LqOFvs/+V0LqXeja3QZzz3PXeyBTwgcrkzr9XEm3 kosg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=u6mvTUYi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qf38-20020a1709077f2600b007823754ecd5si15096431ejc.43.2022.10.19.02.17.53; Wed, 19 Oct 2022 02:18: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=u6mvTUYi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233226AbiJSJRN (ORCPT + 99 others); Wed, 19 Oct 2022 05:17:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233225AbiJSJOP (ORCPT ); Wed, 19 Oct 2022 05:14:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F42811820; Wed, 19 Oct 2022 02:04: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 32680617EC; Wed, 19 Oct 2022 09:04:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B917C433D6; Wed, 19 Oct 2022 09:04:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170243; bh=Fjt2jIwBgVzTGqtp7I6RkWwJ6PuwF/5JIKJ4axJCIgg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u6mvTUYiHLo0YqOU+JWukgaIUh/6bfwgT8gxlmVnWXZPvHtKzja1y1rO36gu7l9O9 0w4T1VKiQjKEeq3kgPWli1X/bpRZdJCrcX1YPpsMFJAeKoKn8JU2/sLiAqAEUfj9Fu eYs70PidoS6mY9WPNFsSclEJrSZ+7ktNWtzTE6Y0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chen-Yu Tsai , AngeloGioacchino Del Regno , Sasha Levin Subject: [PATCH 6.0 581/862] clk: mediatek: mt8183: mfgcfg: Propagate rate changes to parent Date: Wed, 19 Oct 2022 10:31:08 +0200 Message-Id: <20221019083315.630905870@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747107024603986851?= X-GMAIL-MSGID: =?utf-8?q?1747107024603986851?= From: Chen-Yu Tsai [ Upstream commit 9f94f545f258b15bfa6357eb62e1e307b712851e ] The only clock in the MT8183 MFGCFG block feeds the GPU. Propagate its rate change requests to its parent, so that DVFS for the GPU can work properly. Fixes: acddfc2c261b ("clk: mediatek: Add MT8183 clock support") Signed-off-by: Chen-Yu Tsai Reviewed-by: AngeloGioacchino Del Regno Signed-off-by: AngeloGioacchino Del Regno Link: https://lore.kernel.org/r/20220927101128.44758-3-angelogioacchino.delregno@collabora.com Signed-off-by: Chen-Yu Tsai Signed-off-by: Sasha Levin --- drivers/clk/mediatek/clk-mt8183-mfgcfg.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/clk/mediatek/clk-mt8183-mfgcfg.c b/drivers/clk/mediatek/clk-mt8183-mfgcfg.c index d774edaf760b..230299728859 100644 --- a/drivers/clk/mediatek/clk-mt8183-mfgcfg.c +++ b/drivers/clk/mediatek/clk-mt8183-mfgcfg.c @@ -18,9 +18,9 @@ static const struct mtk_gate_regs mfg_cg_regs = { .sta_ofs = 0x0, }; -#define GATE_MFG(_id, _name, _parent, _shift) \ - GATE_MTK(_id, _name, _parent, &mfg_cg_regs, _shift, \ - &mtk_clk_gate_ops_setclr) +#define GATE_MFG(_id, _name, _parent, _shift) \ + GATE_MTK_FLAGS(_id, _name, _parent, &mfg_cg_regs, _shift, \ + &mtk_clk_gate_ops_setclr, CLK_SET_RATE_PARENT) static const struct mtk_gate mfg_clks[] = { GATE_MFG(CLK_MFG_BG3D, "mfg_bg3d", "mfg_sel", 0) From patchwork Wed Oct 19 08: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: 4803 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp216421wrs; Wed, 19 Oct 2022 02:18:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5PXli9TEEUv/wJZPx5Z3d/EwZzNcnkLQMYnT/qI7DIxK8pHcA0OzR3AQbwbWlYNJZpe15t X-Received: by 2002:a05:6402:d06:b0:45a:3ac6:ad26 with SMTP id eb6-20020a0564020d0600b0045a3ac6ad26mr6542324edb.195.1666171102546; Wed, 19 Oct 2022 02:18:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666171102; cv=none; d=google.com; s=arc-20160816; b=FUIUKeAKUvniizZPma5kadn19qGSuh4csUnwH3yavpeRD1Vs4muJJoLhUCOj8iMfvj yTwUevC4BtsUoyiCGXnG4etpc/x4aHdYvmIoeF4ly9moHSTPvTEjxMnj00UMUUqrPkm8 lhLbRBFiz4inbrpCk9eruXKewimfFIiKXKqLLifCTPpaLYNhZDcVtEBwmbhk35ghoX53 FQ94vOBic6zZFoMcfV9REFA6TyszdRsnXvoSShct2Z/zELm7sEOmyofuQiyjRBlLMH+q el8SSfiJy+We0gFD9tsPF07u3hq2F89rJ/yQ1igntHIgqE1eANkNNXYKymS4LRZzuADY nB+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=ZiZhiKH2+fKKIypKpgj/SHczTm3Euf9W+5FO4SHhG5M=; b=OaxL9MYrQueI5KIm43kG7aY8Yuk36Drtf8D9QBwPcSQHRzpS+pYzBiAN4H0Y08MQrn OZSOMj5miH/TpakgoM03+/Wr8e/oH2SbUTAhYesD5zVQwT+a4dFAQaiUIDO9DvHVVkHh GbD0arzL+UX4wg05Db980JYQfnlVDAViDzuWyTXbpFgKFcIEmH1mWN38TcTvz2MwxvrF baEB6ny+yHW2tQxp1/uUk+OEX8fDCPVY7JlGkgOzW+0pOXLhsXsArxKX2gSWjp4Aj3uQ henJncyoMLfdIckIHWXn95PEEkLAiNmxCG5SMawF2fOxl2q6Xvgjgb1CUUh1LYm903Mo Hzwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wzBUzrQc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id by28-20020a0564021b1c00b00454424b5c2csi12279919edb.314.2022.10.19.02.17.57; Wed, 19 Oct 2022 02:18: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=wzBUzrQc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233232AbiJSJRU (ORCPT + 99 others); Wed, 19 Oct 2022 05:17:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233282AbiJSJOe (ORCPT ); Wed, 19 Oct 2022 05:14: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 291481CFC0; Wed, 19 Oct 2022 02:04: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 C801A61802; Wed, 19 Oct 2022 09:04:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DDCB5C433D6; Wed, 19 Oct 2022 09:04:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170246; bh=xwQFS+0dceWteJ5a9d7UTXfY02GKVvj6lofGoSNaXtU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wzBUzrQcJs8Rk3fLPisGvDwW2+2JKP4FVQUkDM+qjxopMVlsWyMztmCSJt3Yi9KdA 3PxGzbKd7KTI7MFkosvUUz0AanrD2foVlr3NfyQ7Ut1qBiPWJOT9y8EOee9rYxOT4R pJoMyKLBH8HLEpzWyxOVsIxS5CvF/UqT3m25u8Sc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, AngeloGioacchino Del Regno , Chen-Yu Tsai , Sasha Levin Subject: [PATCH 6.0 582/862] clk: mediatek: clk-mt8195-mfg: Reparent mfg_bg3d and propagate rate changes Date: Wed, 19 Oct 2022 10:31:09 +0200 Message-Id: <20221019083315.682505160@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747107029836521690?= X-GMAIL-MSGID: =?utf-8?q?1747107029836521690?= From: AngeloGioacchino Del Regno [ Upstream commit a5f7bf5458c2cf6730106e16a6373638a0e5ed1e ] The MFG_BG3D is a gate to enable/disable clock output to the GPU, but the actual output is decided by multiple muxes; in particular: mfg_ck_fast_ref muxes between "slow" (top_mfg_core_tmp) and "fast" (MFGPLL) clock, while top_mfg_core_tmp muxes between the 26MHz clock and various system PLLs. The clock gate comes after all the muxes, so its parent is mfg_ck_fast_reg, not top_mfg_core_tmp. Reparent MFG_BG3D to the latter to match the hardware and add the CLK_SET_RATE_PARENT flag to it: this way we ensure propagating rate changes that are requested on MFG_BG3D along its entire clock tree. Fixes: 35016f10c0e5 ("clk: mediatek: Add MT8195 mfgcfg clock support") Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Chen-Yu Tsai Link: https://lore.kernel.org/r/20220927101128.44758-6-angelogioacchino.delregno@collabora.com Signed-off-by: Chen-Yu Tsai Signed-off-by: Sasha Levin --- drivers/clk/mediatek/clk-mt8195-mfg.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/clk/mediatek/clk-mt8195-mfg.c b/drivers/clk/mediatek/clk-mt8195-mfg.c index 9411c556a5a9..c94cb71bd9b9 100644 --- a/drivers/clk/mediatek/clk-mt8195-mfg.c +++ b/drivers/clk/mediatek/clk-mt8195-mfg.c @@ -17,10 +17,12 @@ static const struct mtk_gate_regs mfg_cg_regs = { }; #define GATE_MFG(_id, _name, _parent, _shift) \ - GATE_MTK(_id, _name, _parent, &mfg_cg_regs, _shift, &mtk_clk_gate_ops_setclr) + GATE_MTK_FLAGS(_id, _name, _parent, &mfg_cg_regs, \ + _shift, &mtk_clk_gate_ops_setclr, \ + CLK_SET_RATE_PARENT) static const struct mtk_gate mfg_clks[] = { - GATE_MFG(CLK_MFG_BG3D, "mfg_bg3d", "top_mfg_core_tmp", 0), + GATE_MFG(CLK_MFG_BG3D, "mfg_bg3d", "mfg_ck_fast_ref", 0), }; static const struct mtk_clk_desc mfg_desc = { From patchwork Wed Oct 19 08: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: 5490 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp334454wrs; Wed, 19 Oct 2022 06:42:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6nNRUFHZYCqIO9C3PMnCxS9cNBeULuTDy439uQEy/xWPJqbMy4CBDwwnPynfjeOw0PTMn+ X-Received: by 2002:a17:907:628a:b0:781:bbff:1d42 with SMTP id nd10-20020a170907628a00b00781bbff1d42mr6617503ejc.375.1666186973531; Wed, 19 Oct 2022 06:42:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666186973; cv=none; d=google.com; s=arc-20160816; b=y/aS2X2GANdyxVEh33SthQalcmGjUgzEobl/wMw6DDeQSnqYUNZz7D+niDSFy1A+lw a77xVA01JPAjiVz27JJmBGFjo2HwsoYh1xrCdRpal4u1BbCQ1WLib26EO/+3lvzHCj2A 0sYBDCdbjr6VqSzqSjmjMbcA5TVLTvliQC1nKIUu4hySPVxMgfrTXTW9a9q1t84E99cE 2l4f+AZ18Hpt+Nu93Xt6njI02GFFyBf4tIqJbbXZzvWGyHA/JuQ6uYHYoehCu3xEGi+D 2wV+JkETB3q7g622Yrw2Ony6GZIwnTWZ5teWjfgP14Tbsmn4/3iI/ui/BzxdpZMrdnS5 QFVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=78Kc8w8ydrkkfPYB4fmn7aG3ncQJYMfXAfQX4Guliqg=; b=VnPJ4S26wEI7eakXloZUmvkOu75ff/cKegXZgbo1DlVy4/R/RpnwhbBE+lVqB3RVk4 9hGL9B6be3/W0crE3RQzTg2iLutiAiul7dbTWLBQyYkQBVVEB2tv623KT6awiyLw02o6 aclkRZBjQ1fC3mYlImafP08fOLEU5501VavY7cCE4F9sf6DndfYedqTxLhOehwVHmPEY lc2NHzQRqNc6vsRRgpf6HIIW9Z54iikPwgWjHVqOC9oTBvTg1kUR7TWEXRYkC/TWrCl0 wdvxr1kpsjBXXCeYLriAZlI/8tf5LBgiJlNmFlNc7q4ode0q4vcSiWEuHYldKub191z5 cyYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EPUtDqQ3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dp17-20020a170906c15100b00793988d8dc7si1119437ejc.351.2022.10.19.06.42.27; Wed, 19 Oct 2022 06:42: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=EPUtDqQ3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232707AbiJSNjd (ORCPT + 99 others); Wed, 19 Oct 2022 09:39:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232732AbiJSNi5 (ORCPT ); Wed, 19 Oct 2022 09:38:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E1531DEC08; Wed, 19 Oct 2022 06:26: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 2561EB82474; Wed, 19 Oct 2022 09:04:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E7C1C433C1; Wed, 19 Oct 2022 09:04:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170248; bh=wZRJP6DZHyUxGwtrN/A53yev+G+r02XBhhxY+GvCr8k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EPUtDqQ3NnqPFS0XkejD7Xfr9LDtKD7flCzh3qV1blWRCqq8AteRtTTFLiQ+FEFXF Os7pXmHAtFiNceNKE+nzn+8vZD5+ysGyADAqrDJCGtj0eg+btxYFD7wcD1ympPunGe Exri3Z0CzVM3PZHfF3u/5EZGwQwcUTCmgoUksYb4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, AngeloGioacchino Del Regno , Chen-Yu Tsai , Sasha Levin Subject: [PATCH 6.0 583/862] clk: mediatek: fix unregister function in mtk_clk_register_dividers cleanup Date: Wed, 19 Oct 2022 10:31:10 +0200 Message-Id: <20221019083315.728009225@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123671905353138?= X-GMAIL-MSGID: =?utf-8?q?1747123671905353138?= From: Chen-Yu Tsai [ Upstream commit 20f7a0dba9075fb0e3d645495bc24d7025b58de1 ] When the cleanup paths for the various clk register APIs in the MediaTek clk library were added, the one in the dividers type used the wrong type of unregister function. This would result in incorrect dereferencing of the clk pointer and freeing of invalid pointers. Fix this by switching to the correct type of clk unregistration call. Fixes: 3c3ba2ab0226 ("clk: mediatek: mtk: Implement error handling in register APIs") Reviewed-by: AngeloGioacchino Del Regno Link: https://lore.kernel.org/r/20220926102523.2367530-2-wenst@chromium.org Signed-off-by: Chen-Yu Tsai Signed-off-by: Sasha Levin --- drivers/clk/mediatek/clk-mtk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/mediatek/clk-mtk.c b/drivers/clk/mediatek/clk-mtk.c index 05a188c62119..9b82956260d3 100644 --- a/drivers/clk/mediatek/clk-mtk.c +++ b/drivers/clk/mediatek/clk-mtk.c @@ -393,7 +393,7 @@ int mtk_clk_register_dividers(const struct mtk_clk_divider *mcds, int num, if (IS_ERR_OR_NULL(clk_data->hws[mcd->id])) continue; - mtk_clk_unregister_composite(clk_data->hws[mcd->id]); + clk_hw_unregister_divider(clk_data->hws[mcd->id]); clk_data->hws[mcd->id] = ERR_PTR(-ENOENT); } From patchwork Wed Oct 19 08: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: 4947 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp226295wrs; Wed, 19 Oct 2022 02:45:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5UwzpHkxV6HWD7zB8bbv91tGjXF8p1aVbAo2hPEqy2qhz1uU15b9JE/wQnk9ZU1ol1pUNB X-Received: by 2002:a17:90b:1d4d:b0:20a:794a:f6e7 with SMTP id ok13-20020a17090b1d4d00b0020a794af6e7mr44800370pjb.151.1666172729444; Wed, 19 Oct 2022 02:45:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172729; cv=none; d=google.com; s=arc-20160816; b=PPmPhVw4OO5JWNgtC4QQUyEiHkpos944hKdrPSs9wR0Xzq1dw9g36tr3c6M5NFGrZn 9xsgM67dUAWrrTZNPT4kKqiQeCky8aam9aIJjZi+NKNn25ta0JmlcGTxbG58im3UDUev lU3m8JkSrSx9AffHu5hjQWwCkzGqozdEWQGnxAXfckF2mLOueASeP/9wv7cq/d/EZELf iIU62Lrn+DOCWLii+w6jUjxNozpB7SAxPLLxNTtJZnKt+eicWd+wHcVaZHwfYI5CCHlv K/tpOvPZ0buQ5iWfjbf/TVtARILhLyrYuFRA9J30ijuCYGf/GeQfGp1ZnnicIGepFXla XAgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pNTr0KNQnd5Vvb/hKYLjq9eYwlofTklQQIuTZT31wxk=; b=VuURlh6Lo14bow44iwfI1stRJSTiCguN/05UT8EvnK8TYFEATCKGhK/Ky/cP9xUSUF aCtr4uRHcFaP4ypdk6UpsnFhXapTKD7Cf1c1bqjlEOIXOusBMJ9juCL6CcGbKGoOjGCo XNyrYcqij8EC5d392P7pdv93kt+YbE+ikJy0ypscNzyUGQdWEOuj3Afsch6O5DkBvoEr v7KbLljxCr2o8Pyr19idC9Oi5DaripwwKE9oUrW9a0kcNtwY7EQ/a7epvrAuLDFQAJDF 2U8TH7cjVaW+XhE1BjX7MuRscODTNI+okG5dukn/zzKESQLWNdTc4SL877KyyC4DiJsI WUQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hIxPga6l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a63da45000000b00462ee755db7si18497598pgj.156.2022.10.19.02.45.10; Wed, 19 Oct 2022 02: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=hIxPga6l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231416AbiJSJmd (ORCPT + 99 others); Wed, 19 Oct 2022 05:42:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231474AbiJSJhD (ORCPT ); Wed, 19 Oct 2022 05:37: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 A9CC33CBED; Wed, 19 Oct 2022 02:15: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 30E1F617E8; Wed, 19 Oct 2022 09:04:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47D65C433C1; Wed, 19 Oct 2022 09:04:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170251; bh=1wghsjgKKn7NZz43uELGlj/gxRjZkbBQYsZJUpGB+wY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hIxPga6lQQp1q5iZNxztv0hLMsF+xIlgqsfeC5o7X38F+kuCoW45TmTABmD6DN149 F+/iZoJJe2m3swl3uRzZjnmWAPxHYlH5wAOCrzhb5oAgWRoJNj+TYm6osV49xTo4+Z nflOn4rLxajupD2NQww9n90YaM72a1fiTkkOM5oQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, AngeloGioacchino Del Regno , Chen-Yu Tsai , Sasha Levin Subject: [PATCH 6.0 584/862] clk: mediatek: Migrate remaining clk_unregister_*() to clk_hw_unregister_*() Date: Wed, 19 Oct 2022 10:31:11 +0200 Message-Id: <20221019083315.771298596@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108736153627398?= X-GMAIL-MSGID: =?utf-8?q?1747108736153627398?= From: Chen-Yu Tsai [ Upstream commit fef14676fc4be40b8441745a3c96b7e7d7d8592d ] During the previous |struct clk| to |struct clk_hw| clk provider API migration in commit 6f691a586296 ("clk: mediatek: Switch to clk_hw provider APIs"), a few clk_unregister_*() calls were missed. Migrate the remaining ones to the |struct clk_hw| provider API, i.e. change clk_unregister_*() to clk_hw_unregister_*(). Fixes: 6f691a586296 ("clk: mediatek: Switch to clk_hw provider APIs") Reviewed-by: AngeloGioacchino Del Regno Link: https://lore.kernel.org/r/20220926102523.2367530-3-wenst@chromium.org Signed-off-by: Chen-Yu Tsai Signed-off-by: Sasha Levin --- drivers/clk/mediatek/clk-mtk.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/clk/mediatek/clk-mtk.c b/drivers/clk/mediatek/clk-mtk.c index 9b82956260d3..e1b445f2c5c5 100644 --- a/drivers/clk/mediatek/clk-mtk.c +++ b/drivers/clk/mediatek/clk-mtk.c @@ -80,7 +80,7 @@ int mtk_clk_register_fixed_clks(const struct mtk_fixed_clk *clks, int num, if (IS_ERR_OR_NULL(clk_data->hws[rc->id])) continue; - clk_unregister_fixed_rate(clk_data->hws[rc->id]->clk); + clk_hw_unregister_fixed_rate(clk_data->hws[rc->id]); clk_data->hws[rc->id] = ERR_PTR(-ENOENT); } @@ -102,7 +102,7 @@ void mtk_clk_unregister_fixed_clks(const struct mtk_fixed_clk *clks, int num, if (IS_ERR_OR_NULL(clk_data->hws[rc->id])) continue; - clk_unregister_fixed_rate(clk_data->hws[rc->id]->clk); + clk_hw_unregister_fixed_rate(clk_data->hws[rc->id]); clk_data->hws[rc->id] = ERR_PTR(-ENOENT); } } @@ -146,7 +146,7 @@ int mtk_clk_register_factors(const struct mtk_fixed_factor *clks, int num, if (IS_ERR_OR_NULL(clk_data->hws[ff->id])) continue; - clk_unregister_fixed_factor(clk_data->hws[ff->id]->clk); + clk_hw_unregister_fixed_factor(clk_data->hws[ff->id]); clk_data->hws[ff->id] = ERR_PTR(-ENOENT); } @@ -168,7 +168,7 @@ void mtk_clk_unregister_factors(const struct mtk_fixed_factor *clks, int num, if (IS_ERR_OR_NULL(clk_data->hws[ff->id])) continue; - clk_unregister_fixed_factor(clk_data->hws[ff->id]->clk); + clk_hw_unregister_fixed_factor(clk_data->hws[ff->id]); clk_data->hws[ff->id] = ERR_PTR(-ENOENT); } } @@ -414,7 +414,7 @@ void mtk_clk_unregister_dividers(const struct mtk_clk_divider *mcds, int num, if (IS_ERR_OR_NULL(clk_data->hws[mcd->id])) continue; - clk_unregister_divider(clk_data->hws[mcd->id]->clk); + clk_hw_unregister_divider(clk_data->hws[mcd->id]); clk_data->hws[mcd->id] = ERR_PTR(-ENOENT); } } From patchwork Wed Oct 19 08: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: 5291 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp281671wrs; Wed, 19 Oct 2022 05:02:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Ds87OQAA3KZUu+tHIAAi1KosGJLDab4xQZlXFaoiIbP9Cp4P+B735i85X9o52rLdf0YBs X-Received: by 2002:a17:906:730f:b0:791:9b75:2ca1 with SMTP id di15-20020a170906730f00b007919b752ca1mr6141343ejc.140.1666180938594; Wed, 19 Oct 2022 05:02:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666180938; cv=none; d=google.com; s=arc-20160816; b=b2TsHMyuBPPKoMIHgpsKqO+0Jw7CAfd0t1/9aq1VTkVD+G0Qs+sPR6ywR23Blbnqed 7gLqrxdRDPIZavgvJjJnD0e55uLumseSKLSnjPJQ0bT4P7/rKAXmK/GlCqjjWcenqK5G 0uszYsCDTxJK+fFWnYcbzp2/bZ0UU9B9Q8RqHV5vdMtKl+hfAAQEgkSqhNxv/38y9R2q BCMVFFIZDEbQoki8MbmrDmZRTpKUUL7ZiT0XcSydcUKmRRkY5+cQMjLQHs37hZDCu1UF 2DAo6/tklBNK4MBVcowH39wAf6mkYMIWeFLihsOvvVxWm6MLY7UMrh3o+TK2wFVCsxUU J+rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gRVaG6uS85aaWcQh02JbwJYNx/ubmeUASCkOmvODBvY=; b=BPpy5QPkTpIQfbKhznUL9FV6FQlrh5Dx3reqoS4Oge1NexF7GhxLliX4wAwqOzPqC/ fqP1MophxncquAKH1QVbplQUnewbYd1SPdFcNV/EFAQbnlQuJ5FDbmR6d5KTCCXWCkfx laEVDNizP2eEtpfr/3bUf8fJtyOIFOIlfDpvola/KrnQ3tPx7D/eAE32p0in0MURxZVU LxaIAOwlMIp8A2A40cw3mQIRDTqFs8Y9fu/WZtdKQIm4IAZsxiJUWlG6wZDgeq0HoSbs Por+BC40iwTBbgUnAcratVpHS+XipX9dtcp+eVNUk8rFIw8HZmYXtLlo/6tpAvJ4s1mq SuWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="nm/aBJ2g"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a056402015300b004597b778b3bsi12425409edu.75.2022.10.19.05.01.50; Wed, 19 Oct 2022 05:02: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="nm/aBJ2g"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229452AbiJSL6N (ORCPT + 99 others); Wed, 19 Oct 2022 07:58:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230353AbiJSL5k (ORCPT ); Wed, 19 Oct 2022 07:57:40 -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 714C3181CA2; Wed, 19 Oct 2022 04:36: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 sin.source.kernel.org (Postfix) with ESMTPS id B7CA6CE2165; Wed, 19 Oct 2022 09:04:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D3590C433C1; Wed, 19 Oct 2022 09:04:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170254; bh=XyyJvjno3/eowPKmgIE2dZVJj4PyKKovVsa8PFz8u30=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nm/aBJ2g78/ylR92QyGOevzCO3ej5xh4UWy6+PumftgcuY2da154XD5ctS88MixpR ZZdbHbn/H54Po29AH5c31y7J5IxZZxoGEF2sIb6Jt07Eyg5gHyxrLGoR/MvfjN1bg6 JqIohx/cZE0dZcoXyd19Q4kGSIoCd2y0qrYZNWLg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Baryshkov , Johan Hovold , Vinod Koul , Sasha Levin Subject: [PATCH 6.0 585/862] phy: qcom-qmp-pcie: fix resource mapping for SDM845 QHP PHY Date: Wed, 19 Oct 2022 10:31:12 +0200 Message-Id: <20221019083315.815097879@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747117343641532911?= X-GMAIL-MSGID: =?utf-8?q?1747117343641532911?= From: Dmitry Baryshkov [ Upstream commit 0a40891b83f257b25a2b983758f72f6813f361cb ] On SDM845 one of PCIe PHYs (the QHP one) has the same region for TX and RX registers. Since the commit 4be26f695ffa ("phy: qcom-qmp-pcie: fix memleak on probe deferral") added checking that resources are not allocated beforehand, this PHY can not be probed anymore. Fix this by skipping the map of ->rx resource on the QHP PHY and assign it manually. Fixes: 4be26f695ffa ("phy: qcom-qmp-pcie: fix memleak on probe deferral") Signed-off-by: Dmitry Baryshkov Reviewed-by: Johan Hovold Link: https://lore.kernel.org/r/20220926172514.880776-1-dmitry.baryshkov@linaro.org Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/phy/qualcomm/phy-qcom-qmp-pcie.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c index 819bcd975ba4..0baf62d80214 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c @@ -2333,7 +2333,10 @@ int qcom_qmp_phy_pcie_create(struct device *dev, struct device_node *np, int id, if (IS_ERR(qphy->tx)) return PTR_ERR(qphy->tx); - qphy->rx = devm_of_iomap(dev, np, 1, NULL); + if (of_device_is_compatible(dev->of_node, "qcom,sdm845-qhp-pcie-phy")) + qphy->rx = qphy->tx; + else + qphy->rx = devm_of_iomap(dev, np, 1, NULL); if (IS_ERR(qphy->rx)) return PTR_ERR(qphy->rx); From patchwork Wed Oct 19 08: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: 4807 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp216550wrs; Wed, 19 Oct 2022 02:18:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM58c2Uw1L2UvcPbooy5ndgzTa7QNatbCieGXEpnKuHJtfbwlv/Ymsbmn0tftDLEo+lRoAFD X-Received: by 2002:a17:906:fd82:b0:770:7e61:3707 with SMTP id xa2-20020a170906fd8200b007707e613707mr5657647ejb.143.1666171121031; Wed, 19 Oct 2022 02:18:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666171121; cv=none; d=google.com; s=arc-20160816; b=oAJWwhZctC5Yasv1eO9NL/Ixgl4V7Vr1zPFf+gAZ2ke2gTpOFfqCDyH+xzcPFbdqFP KBcbc2Wu+qJb66jppZ2q5Di0rtLEg1ZcIcmgb33Sx3gAzvuh14M+kTlmMF//r7Mj7uGx pHsbX5aijGhb05rZkPgeYIliTB8t5jKFUQdntttZzjmMGfSQuhC/A4I3EYhKMzjXAW1S 7zlHM6HhfxAE2ss6qcxxD8Lf0sqq0FxrHkHFGZwH9qg/eBG2eITnBhuNG8LPXjvHnKvi YoyMTz/3T57FPQ5s5R22Erqi5OdTpyFv0vfK7DwdaKgtUAAhZ/162HXYJOCjKt+2CZM5 caEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=74vd0RP5snpLDUnbJPIHKEX1yXmYTelM8b8XQVxNOmQ=; b=HCmrsheX7utFHQl2Sjdtpak0jcyn0cIyBG06MC6lihwKcgZ6sCw7NcQ76VWtFZ0WS2 hW5Xu6I4GuA00VtGewkyU6aWkYvVRYVSMsJg8y/020b3BQ57ekeTiK5MreyA4PRvTJZZ 9lnsoKG9K6ceweSeWmR7n1v7G3avmjWDg775mtlU0Pf2L3NnHiTfnUKZvXrcROySueOJ NS4eygKGRhXYI2TBsfbAzNf3nw9JpXgaCTQVMm9kAaEmGGrUpdjEnD66aGmRoTLtEFoG VsTxw2EQc918yJClcNzjoSG1fJswSSKwbtpbBSzkBCAtbiw5W5sY4pZtfVf3fDvRziTL WVHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tvuxuwYl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id st11-20020a170907c08b00b0074168953071si10437047ejc.866.2022.10.19.02.18.16; Wed, 19 Oct 2022 02:18: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=tvuxuwYl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233258AbiJSJRj (ORCPT + 99 others); Wed, 19 Oct 2022 05:17:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233325AbiJSJOk (ORCPT ); Wed, 19 Oct 2022 05:14:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D3F8222BB; Wed, 19 Oct 2022 02:04: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 4A3C06183D; Wed, 19 Oct 2022 09:04:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 61E30C433D6; Wed, 19 Oct 2022 09:04:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170256; bh=SqKkbboLaCEUZHGHFvJKgJF9FO7wa7t4MA8G7KqeKkE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tvuxuwYlIseDXieRyCVh1FMSABj03s3OD+b345PqWA02a48oo1fs/G9eW1iZxnfsl 0C36ioShqrLA5kILg0/Ia3Am2ovKkMV8kQlf5g9zo/SAflmdSCjh3WB1UCrhYcssS2 pG/3M4N1JRmFc/d+6Pqqi//dklZOXZdxgOuv5eXE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+dfcc5f4da15868df7d4d@syzkaller.appspotmail.com, Jan Kara , Jens Axboe , Sasha Levin Subject: [PATCH 6.0 586/862] io_uring/rw: defer fsnotify calls to task context Date: Wed, 19 Oct 2022 10:31:13 +0200 Message-Id: <20221019083315.856733085@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747107049006381681?= X-GMAIL-MSGID: =?utf-8?q?1747107049006381681?= From: Jens Axboe [ Upstream commit b000145e9907809406d8164c3b2b8861d95aecd1 ] We can't call these off the kiocb completion as that might be off soft/hard irq context. Defer the calls to when we process the task_work for this request. That avoids valid complaints like: stack backtrace: CPU: 1 PID: 0 Comm: swapper/1 Not tainted 6.0.0-rc6-syzkaller-00321-g105a36f3694e #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/26/2022 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 print_usage_bug kernel/locking/lockdep.c:3961 [inline] valid_state kernel/locking/lockdep.c:3973 [inline] mark_lock_irq kernel/locking/lockdep.c:4176 [inline] mark_lock.part.0.cold+0x18/0xd8 kernel/locking/lockdep.c:4632 mark_lock kernel/locking/lockdep.c:4596 [inline] mark_usage kernel/locking/lockdep.c:4527 [inline] __lock_acquire+0x11d9/0x56d0 kernel/locking/lockdep.c:5007 lock_acquire kernel/locking/lockdep.c:5666 [inline] lock_acquire+0x1ab/0x570 kernel/locking/lockdep.c:5631 __fs_reclaim_acquire mm/page_alloc.c:4674 [inline] fs_reclaim_acquire+0x115/0x160 mm/page_alloc.c:4688 might_alloc include/linux/sched/mm.h:271 [inline] slab_pre_alloc_hook mm/slab.h:700 [inline] slab_alloc mm/slab.c:3278 [inline] __kmem_cache_alloc_lru mm/slab.c:3471 [inline] kmem_cache_alloc+0x39/0x520 mm/slab.c:3491 fanotify_alloc_fid_event fs/notify/fanotify/fanotify.c:580 [inline] fanotify_alloc_event fs/notify/fanotify/fanotify.c:813 [inline] fanotify_handle_event+0x1130/0x3f40 fs/notify/fanotify/fanotify.c:948 send_to_group fs/notify/fsnotify.c:360 [inline] fsnotify+0xafb/0x1680 fs/notify/fsnotify.c:570 __fsnotify_parent+0x62f/0xa60 fs/notify/fsnotify.c:230 fsnotify_parent include/linux/fsnotify.h:77 [inline] fsnotify_file include/linux/fsnotify.h:99 [inline] fsnotify_access include/linux/fsnotify.h:309 [inline] __io_complete_rw_common+0x485/0x720 io_uring/rw.c:195 io_complete_rw+0x1a/0x1f0 io_uring/rw.c:228 iomap_dio_complete_work fs/iomap/direct-io.c:144 [inline] iomap_dio_bio_end_io+0x438/0x5e0 fs/iomap/direct-io.c:178 bio_endio+0x5f9/0x780 block/bio.c:1564 req_bio_endio block/blk-mq.c:695 [inline] blk_update_request+0x3fc/0x1300 block/blk-mq.c:825 scsi_end_request+0x7a/0x9a0 drivers/scsi/scsi_lib.c:541 scsi_io_completion+0x173/0x1f70 drivers/scsi/scsi_lib.c:971 scsi_complete+0x122/0x3b0 drivers/scsi/scsi_lib.c:1438 blk_complete_reqs+0xad/0xe0 block/blk-mq.c:1022 __do_softirq+0x1d3/0x9c6 kernel/softirq.c:571 invoke_softirq kernel/softirq.c:445 [inline] __irq_exit_rcu+0x123/0x180 kernel/softirq.c:650 irq_exit_rcu+0x5/0x20 kernel/softirq.c:662 common_interrupt+0xa9/0xc0 arch/x86/kernel/irq.c:240 Fixes: f63cf5192fe3 ("io_uring: ensure that fsnotify is always called") Link: https://lore.kernel.org/all/20220929135627.ykivmdks2w5vzrwg@quack3/ Reported-by: syzbot+dfcc5f4da15868df7d4d@syzkaller.appspotmail.com Reported-by: Jan Kara Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- io_uring/rw.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/io_uring/rw.c b/io_uring/rw.c index 295e3456d68e..eda14e8ec009 100644 --- a/io_uring/rw.c +++ b/io_uring/rw.c @@ -186,14 +186,6 @@ static void kiocb_end_write(struct io_kiocb *req) static bool __io_complete_rw_common(struct io_kiocb *req, long res) { - struct io_rw *rw = io_kiocb_to_cmd(req, struct io_rw); - - if (rw->kiocb.ki_flags & IOCB_WRITE) { - kiocb_end_write(req); - fsnotify_modify(req->file); - } else { - fsnotify_access(req->file); - } if (unlikely(res != req->cqe.res)) { if ((res == -EAGAIN || res == -EOPNOTSUPP) && io_rw_should_reissue(req)) { @@ -220,6 +212,20 @@ static inline int io_fixup_rw_res(struct io_kiocb *req, long res) return res; } +static void io_req_rw_complete(struct io_kiocb *req, bool *locked) +{ + struct io_rw *rw = io_kiocb_to_cmd(req, struct io_rw); + + if (rw->kiocb.ki_flags & IOCB_WRITE) { + kiocb_end_write(req); + fsnotify_modify(req->file); + } else { + fsnotify_access(req->file); + } + + io_req_task_complete(req, locked); +} + static void io_complete_rw(struct kiocb *kiocb, long res) { struct io_rw *rw = container_of(kiocb, struct io_rw, kiocb); @@ -228,7 +234,7 @@ static void io_complete_rw(struct kiocb *kiocb, long res) if (__io_complete_rw_common(req, res)) return; io_req_set_res(req, io_fixup_rw_res(req, res), 0); - req->io_task_work.func = io_req_task_complete; + req->io_task_work.func = io_req_rw_complete; io_req_task_work_add(req); } From patchwork Wed Oct 19 08:31:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5469 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp332273wrs; Wed, 19 Oct 2022 06:38:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7pIcLjHH5L75Mne0ylih+Y6AkTEXxtTSeXDNTNrccl+X6r5TXyY2cZ0Wl/o+P8ddM2I2ca X-Received: by 2002:a63:3348:0:b0:439:db24:8b02 with SMTP id z69-20020a633348000000b00439db248b02mr7157903pgz.425.1666186709315; Wed, 19 Oct 2022 06:38:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666186709; cv=none; d=google.com; s=arc-20160816; b=m3o1VhAYjgXs1ork9V5eN4vje0lPUfbvxcWCCsfvyXfY8biirXsdP+8GL93Dm0KwoZ 5JqwzGGGP7xL41HcyGx1S2YVBEYlR1PMOXXtHPrVH3guITxh8MiWQnZOyS2FsAg07VNj 5c+uAcbFvdUNThQaX7Mgjj5g45cbjtawKD9keMNkDosYfkSrOjOAcVPya+09/9UQ7jKa hKiJpt+t/OX2fOUhLCtZgzuasiMkhdmC4QMMb+XfM9Y/Oim4FI1eFe0kLGAf9UzoI4l+ n4GnCZDB2tqJHx9ni2zHIVzjtXJgAVhoXZDWt2jq0lC6pd6DqSZKz88oHLfqs7VeNfnA Wd1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7asfMDE5/D7dKpT8/biKetb4XW91a489M0kGzgXzjQo=; b=k/Aah35R14gvfacggmtjE+qNoMeLEHWekzIy2oCTKGeqBNZLi6cKGQyd3LWXEauN/E VrKPTPYOy8JNqs8wbaouYJG+ViYW9zT0Ws+iC/Ft82hR3l8pyp2x0ePVCII++XjUt/yU OHH/xE1k1MirGbsMDKcvGRu5dx4VAJWkAL+CBl1vOanFl//PxSrCO9U8HTul2UhQGScJ 3hMG/K+TXRg1m0K9jXrC4gsZsURea7EjUY3GUKF/JzGagaAlYfbji0ZJXGggqWjX2bC3 gQCPxL20ozVCb6g78r7qNd/SzGcLkdzvycFVs9/vZNdMF7LV74dqviI5IrulfZigfoYU 0Vrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=p3fXCtWw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v12-20020a63464c000000b00434f41f6981si17889623pgk.360.2022.10.19.06.38.16; Wed, 19 Oct 2022 06:38: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=p3fXCtWw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231557AbiJSNet (ORCPT + 99 others); Wed, 19 Oct 2022 09:34:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232582AbiJSNeS (ORCPT ); Wed, 19 Oct 2022 09:34:18 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 545F11946CB; Wed, 19 Oct 2022 06:23: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 ams.source.kernel.org (Postfix) with ESMTPS id 72C7EB8245D; Wed, 19 Oct 2022 09:04:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7186C433D6; Wed, 19 Oct 2022 09:04:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170259; bh=V1yLvhX9zdad2+j+Fwim9g75fpNwO3eUX/S2g7mfUCQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p3fXCtWwyamrO9mZlC8zlC8zaIPUZOxnijn4/Tq9+XFcGNLnWprdsSMlq4+2xbriM a32KoalkgZ+CC5Fsy7f3C8+dFIAFGO1sschbpCKfVIzsLB2hlgoiDfxXr0ynDBS6EE +/WePULCoIY6UQ70A7H1ViCc5rk8SdFqJG11VcHk= 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 6.0 587/862] dmaengine: ioat: stop mod_timer from resurrecting deleted timer in __cleanup() Date: Wed, 19 Oct 2022 10:31:14 +0200 Message-Id: <20221019083315.908972896@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123394602636054?= X-GMAIL-MSGID: =?utf-8?q?1747123394602636054?= 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 37ff4ec7db76..e2070df6cad2 100644 --- a/drivers/dma/ioat/dma.c +++ b/drivers/dma/ioat/dma.c @@ -656,7 +656,7 @@ static void __cleanup(struct ioatdma_chan *ioat_chan, dma_addr_t phys_complete) if (active - i == 0) { dev_dbg(to_dev(ioat_chan), "%s: cancel completion timeout\n", __func__); - mod_timer(&ioat_chan->timer, jiffies + IDLE_TIMEOUT); + mod_timer_pending(&ioat_chan->timer, jiffies + IDLE_TIMEOUT); } /* microsecond delay by sysfs variable per pending descriptor */ @@ -682,7 +682,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); } } @@ -879,7 +879,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); } static void ioat_reboot_chan(struct ioatdma_chan *ioat_chan) From patchwork Wed Oct 19 08:31:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4804 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp216470wrs; Wed, 19 Oct 2022 02:18:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Q348M7ggpCdbCAETXfMTljkB1PtxTJBjKH9KHUsRnnXyXeCFqvz6PTT6TYN/foBvQls9g X-Received: by 2002:a17:906:401:b0:73d:af73:b78 with SMTP id d1-20020a170906040100b0073daf730b78mr6062155eja.122.1666171109539; Wed, 19 Oct 2022 02:18:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666171109; cv=none; d=google.com; s=arc-20160816; b=u1UPf+sqwP7FdyObiBbozcdc0x51ZtlDC5+MQ3Rqc6EyNRwrU0ci96iU+SFMQaA/85 E2Ad+S2GgzZtLhWyqFh8iqc1RakXnxoQw6IiAFx2dKfNLvOBkxdUlDDsMrMKZTheMXJF 5sec4t0iYvjWbRHAmNM8SBHvcQol715ONz3RCdfq4IopQcFqul4gcl7ebSEMFZQbeSX9 P4NKZYeK34S3qN9gWjVbHZOYts7i0iW8osMe3wCp1Fn3r7HGDdLTvRxSt8S06WQw/x4R TDaH9L6v6KPyDwVtUksR2Bcr+cBWgNFVKhf9AljRZj1PwJ1uSDAmeB9FGOLT/dFi3daK km0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0q0ahai97hwqCA062clLHsz00veBwl6ZR3Ku8XQgST8=; b=f27CKOvmnxZ3HEYlSrurMcpzjmk6J2wk3Ffki8cRoX66fDyWZc5gKHKn4fdcwDtx0p QAYKGDBikKhT6LNILm7Y964Z4Udui8VB2vVuyo9dzEVhk9EX027Ml7XAoHAJcfoNEnPE /PhSPQtfhozJ+lpmBY7ustkKmV7pWt1Hi9i/udvo8WMkZKPRgYVMZ47cLCb725xe6x3S 3VPSYV4+fU5HF1lvbYbmnDdjLokgVOjTRoe5vxNdGNAfokkDuWNCUK8GoYhiuOj8y57M 0qLdn74fi/bZ2rjcc9SaRVuk8Ei1naaqoi6MV0PnCLQzBWuC5NTA/C+Wkycg9lioukFD 8tZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=h+3Zc1hz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h11-20020a50c38b000000b0045907cec72dsi13517863edf.320.2022.10.19.02.18.05; Wed, 19 Oct 2022 02:18: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=h+3Zc1hz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233082AbiJSJRY (ORCPT + 99 others); Wed, 19 Oct 2022 05:17:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233288AbiJSJOf (ORCPT ); Wed, 19 Oct 2022 05:14:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C813222A6; Wed, 19 Oct 2022 02:04: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 084B861777; Wed, 19 Oct 2022 09:04:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17349C433D6; Wed, 19 Oct 2022 09:04:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170264; bh=o+R7vp3HaUWMn4Qd2e2iX6l/NuO9gxH0uX3q7wrEphs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h+3Zc1hzZVjitxpKTkp8rWw7VDMuSn2EjVqRHBTrMXnX5QkFMAmKgYjFx8i5YrU64 Q79jAqe0ug9qFmF9U28f48w1dOpNYzDJyPZxt37y3K7cgs9uB23sfbo7txxoCo6hgY HTHUqctfM4xx89XNZUPKk7oS68MgDR+JlK7vkNy0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Basavaraj Natikar , Jiri Kosina , Sasha Levin Subject: [PATCH 6.0 588/862] HID: amd_sfh: Handle condition of "no sensors" for SFH1.1 Date: Wed, 19 Oct 2022 10:31:15 +0200 Message-Id: <20221019083315.959110162@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747107037198411524?= X-GMAIL-MSGID: =?utf-8?q?1747107037198411524?= From: Basavaraj Natikar [ Upstream commit 68266bdcceec10ea364e62c63732cd6fe5a256a8 ] Based on num_hid_devices, each sensor device registers to HID. If "no sensors" then amd_sfh work initialization and scheduling doesn’t make sense and return ENODEV to stop driver probe. Hence add a check for num_hid_devices to handle special case in the situation of "no sensors" for SFH1.1. Fixes: 93ce5e0231d7 ("HID: amd_sfh: Implement SFH1.1 functionality") Signed-off-by: Basavaraj Natikar Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin --- drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c +++ b/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c @@ -110,6 +110,8 @@ static int amd_sfh1_1_hid_client_init(st amd_sfh1_1_set_desc_ops(mp2_ops); cl_data->num_hid_devices = amd_sfh_get_sensor_num(privdata, &cl_data->sensor_idx[0]); + if (cl_data->num_hid_devices == 0) + return -ENODEV; INIT_DELAYED_WORK(&cl_data->work, amd_sfh_work); INIT_DELAYED_WORK(&cl_data->work_buffer, amd_sfh_work_buffer); From patchwork Wed Oct 19 08: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: 5417 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp316031wrs; Wed, 19 Oct 2022 06:07:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5WqrfKQKvX4HRPkk7+of3d95Mfm3YeF4/ZD2h24jdtKoj067+T9ZHBb/IU3MkqMHf//DCL X-Received: by 2002:a17:90a:4f02:b0:20b:5fe6:6125 with SMTP id p2-20020a17090a4f0200b0020b5fe66125mr45791606pjh.215.1666184828934; Wed, 19 Oct 2022 06:07:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666184828; cv=none; d=google.com; s=arc-20160816; b=ltXkDIMD0HmWjjYmiCraCzTbpz5BUrrUJYz7VhHainEVkd4PYEcLZMp3aJHa0MOqf0 HoLgOPHMzNsw4i3tX0RRGtyqAGD7pwjkm89j6Wpl2aiUyU9QhM2k0WNqQuzxV9MRi1D4 9GMiIpVOWocoz6io4XuGX9CO4R2ZgMRBAaPE+x5DvekBqTHU7aCyCZFARa1pOapbGajB qLYQTofiq49D4qCT9PjPgeoRxxq+rGqx/8ko99vlefzAzcPmEbCRpCMlnAkW3zDm8BRl 7IS7OKeOMTRtxhwkAyy7odRB2g3mI/W9G3Rb5CEYEu5fu8x/eGaBWvjIO/oAb9g230J+ u9Gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2Ed1P69DOtdHJTl0zIgH4+dD+zLJET5lZmDNHPsV8Io=; b=V5B7am9psE7Kvuuc5uluPC46kythkGCadmzwZ1nkptYuXtMnb3v44tS0Hyz9532Nkk MCWIQ/t4m2Tn2mNP3xbS0DA2EeWDdYn3wa+cysg0q12lxoVwI4PeKSFc/HX/S2SsmkIP ORQPBdCwlXtUhqPsKQV9n2wscIuNQfusIB/QBWfyV/lUOif113HJo07Lab9IVBswQpZd wUauxo1v9En7utXf0CMmA+xsgGKhBt+d9nWJbMGNrA0scxzzo0ONAksH6vWhyCX7F/lp X85kGKyeclnonvcnFUS26EApkl6OFnPam8rlOZ7chFhBZy08tvUl6Xitf5QmtMosBs0t HRpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kLG3n6M9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q14-20020a17090311ce00b001789fa8f90esi21053918plh.408.2022.10.19.06.06.38; Wed, 19 Oct 2022 06:07: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=kLG3n6M9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232318AbiJSNDV (ORCPT + 99 others); Wed, 19 Oct 2022 09:03:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231490AbiJSNDC (ORCPT ); Wed, 19 Oct 2022 09:03:02 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4601BFFFB0; Wed, 19 Oct 2022 05:46:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id CF224CE2166; Wed, 19 Oct 2022 09:04:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C199EC433D6; Wed, 19 Oct 2022 09:04:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170267; bh=Abd8TtgViZsYRoO+q7ZGMnJJBXxq5ckWM858dKQWM9s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kLG3n6M92XoH8R4lHRlqKp+1WUO9S/aH25AkN6hTIuzlsyqeYpHd/vKJxwIw+6uZy /pFB6m4KVf92eie4VwfzeLvGxmjnYi4n7md1xlFKmyMDmAnozXcxWS+L4+64WE3bda 26sGHv6dl/G3AHthpB7mW57WQ9zFGJC3aMMUuvSs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, AngeloGioacchino Del Regno , Tianping Fang , Chunfeng Yun , Sasha Levin Subject: [PATCH 6.0 589/862] usb: mtu3: fix failed runtime suspend in host only mode Date: Wed, 19 Oct 2022 10:31:16 +0200 Message-Id: <20221019083315.995498897@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747121423111372559?= X-GMAIL-MSGID: =?utf-8?q?1747121423111372559?= From: Chunfeng Yun [ Upstream commit 1c703e29da5efac6180e4c189029fa34b7e48e97 ] When the dr_mode is "host", after the host enter runtime suspend, the mtu3 can't do it, because the mtu3's device wakeup function is not enabled, instead it's enabled in gadget init function, to fix the issue, init wakeup early in mtu3's probe() Fixes: 6b587394c65c ("usb: mtu3: support suspend/resume for dual-role mode") Reviewed-by: AngeloGioacchino Del Regno Reported-by: Tianping Fang Signed-off-by: Chunfeng Yun Link: https://lore.kernel.org/r/20220929064459.32522-1-chunfeng.yun@mediatek.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/mtu3/mtu3_core.c | 2 -- drivers/usb/mtu3/mtu3_plat.c | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/mtu3/mtu3_core.c b/drivers/usb/mtu3/mtu3_core.c index 0ca173af87bb..a3a6282893d0 100644 --- a/drivers/usb/mtu3/mtu3_core.c +++ b/drivers/usb/mtu3/mtu3_core.c @@ -978,8 +978,6 @@ int ssusb_gadget_init(struct ssusb_mtk *ssusb) goto irq_err; } - device_init_wakeup(dev, true); - /* power down device IP for power saving by default */ mtu3_stop(mtu); diff --git a/drivers/usb/mtu3/mtu3_plat.c b/drivers/usb/mtu3/mtu3_plat.c index 4cb65346789d..d78ae52b4e26 100644 --- a/drivers/usb/mtu3/mtu3_plat.c +++ b/drivers/usb/mtu3/mtu3_plat.c @@ -356,6 +356,8 @@ static int mtu3_probe(struct platform_device *pdev) pm_runtime_enable(dev); pm_runtime_get_sync(dev); + device_init_wakeup(dev, true); + ret = ssusb_rscs_init(ssusb); if (ret) goto comm_init_err; From patchwork Wed Oct 19 08: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: 4879 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225379wrs; Wed, 19 Oct 2022 02:43:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5jnh7UAqydMWAai+zYJvBGa3z4LM8aoQtemnyFxLTcR1cf+qggjUnKUPgFeE+SJ4LrB0SB X-Received: by 2002:a62:5e81:0:b0:563:1f18:62ab with SMTP id s123-20020a625e81000000b005631f1862abmr7485797pfb.76.1666172579971; Wed, 19 Oct 2022 02:42:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172579; cv=none; d=google.com; s=arc-20160816; b=XJHG1djaUDyLqcwGL63e41DJcbqNRc16wOx7TyOTnbHbL0C7QLT1e4p7FmecOvhb9q CgylLMOvLw7VCOVk4FBNHfaUvNwCrA1Pi0OV8e3Gvf3L1sC9eL+dGDhQJRSP9yAHo4Lu okdnfh/fKVRWaeWcCgdyKdh7LiHmTRP4qBAPzrRUs58xPrrmTaT7CMrjORWyj5kfLaE6 djMN38o1lTyceB0LH67cav2DNRGO4hZt0xvy3bF2C/hNfyTzXvEpyNMPPnI9R1BnzR62 pjq/SraAO5FEW2BoWYK8elY0SjerTWCNGsNxdG//XfYbZT+7SOnpQb9QSTN3RZG1JHJU Zmgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ErPD93IJ6gOoF4eX7uNsUbPCy1naZfv+pcbNCA2DqbA=; b=pS7WRiK3Vf/5KCh7QjPMs3FmLFDFwdccS/Ws4lNkR0SOvhjDExWDx6tWH/UCBfcnBz 8OqrDFwDbCiX1Yq5ISNEbCc/pDc9HTFHaWtQehUwt6DNbXlbp8pK4lUn7vrrsrxqFQ81 2iGREUQWv6GV/LuJFhxe9e3xdCr6sdZaTo2mvowJDbgZ7YBfWgZ2AzW1XhmxiRgNcwI0 GYiiANk8PToWESCSbKgJp01gmnGH2jZJe/2LlP1FdhGxWOMbwAS9/7kh2MUz4F+puQh8 Y8EVettMTPdWz5hXOcfBQ50VuWqcLqviHvxe2i7S8SGdocWDMGWjxbQU8joAWoTlgRyE HxgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UKIB3Pln; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bd33-20020a056a0027a100b0056782f3bdf1si2060716pfb.19.2022.10.19.02.42.46; Wed, 19 Oct 2022 02:42: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=UKIB3Pln; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230117AbiJSJdV (ORCPT + 99 others); Wed, 19 Oct 2022 05:33:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233700AbiJSJ3I (ORCPT ); Wed, 19 Oct 2022 05:29:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6ED76BD49; Wed, 19 Oct 2022 02:12: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 dfw.source.kernel.org (Postfix) with ESMTPS id 464B361838; Wed, 19 Oct 2022 09:04:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 592ACC433C1; Wed, 19 Oct 2022 09:04:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170269; bh=K2n3lZ/Ursgsg4sKeDOQ5OROfj9/y9Ig83F2qNg4SAM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UKIB3PlnwJPYLFd9FTndVd6xYWv+Cm+FxHcHbOFSyaSSPWF5WTRwsh/hjX4kWSnY4 6sIYH4EQy7c9ToHiuXaODi6UlGso5WE6x6PbKrPaFiucSDPxAdmBPse41azR1bTCgD YYyHcRszUsKfUD+jMQ0OuU0INQICjur/EaZ/cRq4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Collins , Fenglin Wu , Stephen Boyd , Sasha Levin Subject: [PATCH 6.0 590/862] spmi: pmic-arb: correct duplicate APID to PPID mapping logic Date: Wed, 19 Oct 2022 10:31:17 +0200 Message-Id: <20221019083316.038413667@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108579373111522?= X-GMAIL-MSGID: =?utf-8?q?1747108579373111522?= From: David Collins [ Upstream commit 1f1693118c2476cb1666ad357edcf3cf48bf9b16 ] Correct the way that duplicate PPID mappings are handled for PMIC arbiter v5. The final APID mapped to a given PPID should be the one which has write owner = APPS EE, if it exists, or if not that, then the first APID mapped to the PPID, if it exists. Fixes: 40f318f0ed67 ("spmi: pmic-arb: add support for HW version 5") Signed-off-by: David Collins Signed-off-by: Fenglin Wu Link: https://lore.kernel.org/r/1655004286-11493-7-git-send-email-quic_fenglinw@quicinc.com Signed-off-by: Stephen Boyd Link: https://lore.kernel.org/r/20220930005019.2663064-8-sboyd@kernel.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/spmi/spmi-pmic-arb.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c index 2113be40b5a9..58f580e7aacc 100644 --- a/drivers/spmi/spmi-pmic-arb.c +++ b/drivers/spmi/spmi-pmic-arb.c @@ -992,7 +992,8 @@ static int pmic_arb_read_apid_map_v5(struct spmi_pmic_arb *pmic_arb) * version 5, there is more than one APID mapped to each PPID. * The owner field for each of these mappings specifies the EE which is * allowed to write to the APID. The owner of the last (highest) APID - * for a given PPID will receive interrupts from the PPID. + * which has the IRQ owner bit set for a given PPID will receive + * interrupts from the PPID. */ for (i = 0; ; i++, apidd++) { offset = pmic_arb->ver_ops->apid_map_offset(i); @@ -1015,16 +1016,16 @@ static int pmic_arb_read_apid_map_v5(struct spmi_pmic_arb *pmic_arb) apid = pmic_arb->ppid_to_apid[ppid] & ~PMIC_ARB_APID_VALID; prev_apidd = &pmic_arb->apid_data[apid]; - if (valid && is_irq_ee && - prev_apidd->write_ee == pmic_arb->ee) { + if (!valid || apidd->write_ee == pmic_arb->ee) { + /* First PPID mapping or one for this EE */ + pmic_arb->ppid_to_apid[ppid] = i | PMIC_ARB_APID_VALID; + } else if (valid && is_irq_ee && + prev_apidd->write_ee == pmic_arb->ee) { /* * Duplicate PPID mapping after the one for this EE; * override the irq owner */ prev_apidd->irq_ee = apidd->irq_ee; - } else if (!valid || is_irq_ee) { - /* First PPID mapping or duplicate for another EE */ - pmic_arb->ppid_to_apid[ppid] = i | PMIC_ARB_APID_VALID; } apidd->ppid = ppid; From patchwork Wed Oct 19 08:31:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4890 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225470wrs; Wed, 19 Oct 2022 02:43:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5F3bTjfdgv1d7NfaNXVyWYTIFkmbKFtHSyPwUCT4SxNpSPRmHWCbctyhLp56tkXVVrbFF3 X-Received: by 2002:a17:90b:1e0c:b0:20f:bcbf:ab5 with SMTP id pg12-20020a17090b1e0c00b0020fbcbf0ab5mr6806212pjb.187.1666172594203; Wed, 19 Oct 2022 02:43:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172594; cv=none; d=google.com; s=arc-20160816; b=yhxeq6+qX6vxSvp1ZC+JTRBJPB4Yxc8z3jT/r5R5PkTwFN+zLbUVb39xRLWnapJV8U i98Xp641ve+AarL3jO1iGXzHsTF7wsW28qGn9e4g/tnUKu6mKv+1xsxQvefNT75aeJZp hnEALi2V+ADCCLy1GbN0Uii1VHkmaPic2trliHYq+4C/BY22Mxc15X5GhTvblleIEaUj +dgoq611pR2eyLjK8CkS+3aeYdrTMI8tPerSInHMu70O8FJx+baSjad0FEdHAqAYqpN9 Y2y1c8NYZJtUuT60L15vCIva3TifJXKzdgeL3njXKhbGLM3DKAkk7yHAOvVIdijlVjSF UUrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ijinfp+6zshcEz3zxDVM6H6Z5AoOAH7rNPFsph+s/NQ=; b=De62HJrQLZje4XPQ+nztSewSUuWpxB3z0/VkHOrndj3Dz1UIlUR/st0rcFpEoypME0 JzbTHs/o2xIKzzmN8uqE6FE8yB843NnBLBkjFOtDSeFVeCjNXWkYiiOESQSXL6HdRJMX SfcRMUBKWm/4p2R/b5sxzzFoRREi+S6i75w5F5J1vYq0bG6xpMJajkVP2f60gupEi+7W ZnIukxAL4oLTMckx6kRiR4KmqJTW5DdBFWIvH1Nu7gtEfjEsqZI4LnZC2kPCSBCZ0jrW RyGCVMX5XEEf9iIU4CxDKOfAozjtlHP1t+a1cw0l+siQh6CGg1h7sA0PDGwQZ8JjJ1jH EjRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iI4d7Z0p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170902700700b0017e0ca906c8si15918012plk.568.2022.10.19.02.43.00; Wed, 19 Oct 2022 02:43: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=iI4d7Z0p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231355AbiJSJf2 (ORCPT + 99 others); Wed, 19 Oct 2022 05:35:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233853AbiJSJ3j (ORCPT ); Wed, 19 Oct 2022 05:29:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F291DC58B2; Wed, 19 Oct 2022 02:13: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 18F2C61828; Wed, 19 Oct 2022 09:04:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 286F3C433D7; Wed, 19 Oct 2022 09:04:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170272; bh=j+D3BSRw6K3WPL1upC13NhG7/06VKOHGGwiFpM2s2cY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iI4d7Z0psptg7GsWobXlDuAr0eIxIPW3VBCIfnLmiJIU7zyUZxjEKTCcebzq/y8/e alIKvO4+O91BXJo8Vn+93ZOZZ2xQgFYnfGXIiSQb3HQepbIsniS7+k0fMBIFL2abOt yfImzWYRZnBmApjQsb1gZOsZ+6Wy3VxSs3/hKMJk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Serge Semin , Luca Ceresoli , Stephen Boyd , Sasha Levin Subject: [PATCH 6.0 591/862] clk: vc5: Fix 5P49V6901 outputs disabling when enabling FOD Date: Wed, 19 Oct 2022 10:31:18 +0200 Message-Id: <20221019083316.087044841@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108594123923684?= X-GMAIL-MSGID: =?utf-8?q?1747108594123923684?= From: Serge Semin [ Upstream commit c388cc804016cf0f65afdc2362b120aa594ff3e6 ] We have discovered random glitches during the system boot up procedure. The problem investigation led us to the weird outcomes: when none of the Renesas 5P49V6901 ports are explicitly enabled by the kernel driver, the glitches disappeared. It was a mystery since the SoC external clock domains were fed with different 5P49V6901 outputs. The driver code didn't seem like bogus either. We almost despaired to find out a root cause when the solution has been found for a more modern revision of the chip. It turned out the 5P49V6901 clock generator stopped its output for a short period of time during the VC5_OUT_DIV_CONTROL register writing. The same problem was found for the 5P49V6965 revision of the chip and was successfully fixed in commit fc336ae622df ("clk: vc5: fix output disabling when enabling a FOD") by enabling the "bypass_sync" flag hidden inside "Unused Factory Reserved Register". Even though the 5P49V6901 registers description and programming guide doesn't provide any intel regarding that flag, setting it up anyway in the officially unused register completely eliminated the denoted glitches. Thus let's activate the functionality submitted in commit fc336ae622df ("clk: vc5: fix output disabling when enabling a FOD") for the Renesas 5P49V6901 chip too in order to remove the ports implicit inter-dependency. Fixes: dbf6b16f5683 ("clk: vc5: Add support for IDT VersaClock 5P49V6901") Signed-off-by: Serge Semin Reviewed-by: Luca Ceresoli Link: https://lore.kernel.org/r/20220929225402.9696-2-Sergey.Semin@baikalelectronics.ru Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/clk-versaclock5.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/clk-versaclock5.c b/drivers/clk/clk-versaclock5.c index e7be3e54b9be..03cfef494b49 100644 --- a/drivers/clk/clk-versaclock5.c +++ b/drivers/clk/clk-versaclock5.c @@ -1204,7 +1204,7 @@ static const struct vc5_chip_info idt_5p49v6901_info = { .model = IDT_VC6_5P49V6901, .clk_fod_cnt = 4, .clk_out_cnt = 5, - .flags = VC5_HAS_PFD_FREQ_DBL, + .flags = VC5_HAS_PFD_FREQ_DBL | VC5_HAS_BYPASS_SYNC_BIT, }; static const struct vc5_chip_info idt_5p49v6965_info = { From patchwork Wed Oct 19 08: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: 4805 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp216494wrs; Wed, 19 Oct 2022 02:18:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7UcMtaAxsdYQGHCyBvaUT+ShN0kGdOmlaUzNTsP7b1puFXhzlsSCLN5jS/yJD3jdPIhLu4 X-Received: by 2002:a17:907:8a09:b0:78d:b81e:f92f with SMTP id sc9-20020a1709078a0900b0078db81ef92fmr6117663ejc.620.1666171112073; Wed, 19 Oct 2022 02:18:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666171112; cv=none; d=google.com; s=arc-20160816; b=znF0N2PNhE4YBWbwrHwSXQ9ZjaHqIR+I7biwOqqmkJsgUZkO4AnxKlkIgWUSIqwiHn niwN6Ex27flkC05mVwpB//Il44ibMdJ+jdMV+uVDW/Kp6wwtnG2HwNjEFG07GinIpcPL pLHUt7CYkH+sR2COzGaCWp1IPV4LzXqkTue58IZbkiB/UoWQ8g5Qnq2rLMsFpeF2uxOw xU51PUEjjKFuNwyARcUT4Gy2/jRHdmW44VM8+G3Dbxs6cZDrW6orV9zVvXzxZuVW5hgh MXRzrc31jlamRDwJdpXdSD4ge9xKFokumXydT1sVXPrWTTB0asikI5oxukbiJQI55AKo W2yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=g1BD2pRscx3BLuLNatvPMtlqb/wTaXyZbIfEzXs7GjY=; b=EuMRRvudRXJNOzoZhKYMwqfRKM9AfJuh8AJO+af5eN8lvSuL2CpoW6gWyAYqDuBH/J 6erFCRXsVALMcufGc51JD3+f8dCV/NXPnwnf61ZNaNRQmRVWF0eaco1zaffduYmCgKvk 06S9rNW2+Oxw9HpKEQKyRPo9CrUIYoNQFpw1ZxMcF1kSRmyiz5LjlHLM3jNxA8je0t7v YMI/b6bXTiXf5Irk00d0hnchMwgWbRzn2YcjWdgEkpmEL0RgQWVSc/dHRA4S0+vM7zFF 7KkUac6Pr3bVe/5TZTQzhVmMxZ/z5gUnasbKbhbZZdQnCcNl96BdCRm65geM0i8r6J94 EIlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dUom+EiS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t9-20020a1709060c4900b007317756bc04si10907470ejf.1006.2022.10.19.02.18.08; Wed, 19 Oct 2022 02:18: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=dUom+EiS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233244AbiJSJR3 (ORCPT + 99 others); Wed, 19 Oct 2022 05:17:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233295AbiJSJOf (ORCPT ); Wed, 19 Oct 2022 05:14:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A112524086; Wed, 19 Oct 2022 02:04: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 dfw.source.kernel.org (Postfix) with ESMTPS id BC90861851; Wed, 19 Oct 2022 09:04:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC41AC433C1; Wed, 19 Oct 2022 09:04:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170275; bh=hDIWTXnFPYaCL2NW+LTf3CWQC5jgrfHnhKhZtQhXzUs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dUom+EiSxchyIh/C3tbm/zI0WXlqEnC0SEC5cr6j4Ing0MFs5DIdzqckCVhP4+7qa B524G68Wf3jHh3pj9vLGTe5ge4YVuBBE4FERym8ox3/zcDUXI/kK9IHAW9t4+gjjTr o+SmhVTfKYY5vQUct7R7IWnnzQ7jkvqcqC8qXH4Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Serge Semin , Stephen Boyd , Sasha Levin Subject: [PATCH 6.0 592/862] clk: baikal-t1: Fix invalid xGMAC PTP clock divider Date: Wed, 19 Oct 2022 10:31:19 +0200 Message-Id: <20221019083316.126804263@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747107040364325512?= X-GMAIL-MSGID: =?utf-8?q?1747107040364325512?= From: Serge Semin [ Upstream commit 3c742088686ce922704aec5b11d09bcc5a396589 ] Most likely due to copy-paste mistake the divider has been set to 10 while according to the SoC reference manual it's supposed to be 8 thus having PTP clock frequency of 156.25 MHz. Fixes: 353afa3a8d2e ("clk: Add Baikal-T1 CCU Dividers driver") Signed-off-by: Serge Semin Link: https://lore.kernel.org/r/20220929225402.9696-3-Sergey.Semin@baikalelectronics.ru Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/baikal-t1/clk-ccu-div.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/baikal-t1/clk-ccu-div.c b/drivers/clk/baikal-t1/clk-ccu-div.c index f141fda12b09..ea77eec40ddd 100644 --- a/drivers/clk/baikal-t1/clk-ccu-div.c +++ b/drivers/clk/baikal-t1/clk-ccu-div.c @@ -207,7 +207,7 @@ static const struct ccu_div_info sys_info[] = { CCU_DIV_GATE_INFO(CCU_SYS_XGMAC_REF_CLK, "sys_xgmac_ref_clk", "eth_clk", CCU_SYS_XGMAC_BASE, 8), CCU_DIV_FIXED_INFO(CCU_SYS_XGMAC_PTP_CLK, "sys_xgmac_ptp_clk", - "eth_clk", 10), + "eth_clk", 8), CCU_DIV_GATE_INFO(CCU_SYS_USB_CLK, "sys_usb_clk", "eth_clk", CCU_SYS_USB_BASE, 10), CCU_DIV_VAR_INFO(CCU_SYS_PVT_CLK, "sys_pvt_clk", From patchwork Wed Oct 19 08: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: 4806 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp216517wrs; Wed, 19 Oct 2022 02:18:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6VgHOmLcZ5LN5G9czhvfhH2Inoa+/R8AgQVgoh8NIEphbEFCTLWN5VrlhlL8mjzZskE8Xz X-Received: by 2002:a17:907:70a:b0:750:bf91:caa3 with SMTP id xb10-20020a170907070a00b00750bf91caa3mr5713482ejb.711.1666171115333; Wed, 19 Oct 2022 02:18:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666171115; cv=none; d=google.com; s=arc-20160816; b=XuZYBA1PvIEx8QoJL2aD8VxU8varFiaRIKPfThw8fYb/09O7KZ8wMOcctPHxh7qBqH VrhXtfKc57GwL3Cw2Xttdj0IgTy3aNzGQjKTO8yF8byVMDGLx38Lz0EctD7cAhkIOO+8 aG/JefdgknMnmB+08IKlDCWXSo9Iag4y8/l9Ijpyw2buO0Pnxn/ofDzl5o1H/JeE1Sdl NZnR995fVJ3aEaa7xSAWb7JNUHfmDPpmaslSNLhxZx0d/nH20NZjXjdoCxTQWO1lE0Vw qioMD56ODMtgqQdu/Q1++rOBP38kTnUm4WjnUw0YqcI/1/0caK9ls2XXLLfjBe8lvFwv dq+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=4g0cVlHUXjv0gLOXBoPWodJKCKk8oHQXO+u+JUneURA=; b=xLthqDXm3dStmjQFMHnu3AUBNlrjuBRqyFfOkPUtGUdS2C25sBu8/cJ9gRaOpdrY+O 03VdMomh2YJcliJTbY+5xaKjbejPrrsgIw8HifMBL3HLn9bngqAbYzmVLZdEnlBeVsVj A1SLOvtw/3fUCi0OhikIAVqPgHqwMhUIJXqFD6byHko4l4d25zNrkhpy5Il7Pk+Mt1cC +twEFR+Qz5dbji6Hd3e8WIOuyBMRj0NIQwGSRrgPtukJZjhU1uGfhNvmwl/fp4j2gLr9 wpm2n7q5HhW8SgrXDuNv65ORPohUWVFSEiF6FZXw60guocgZJrathQbywA1GAF+dgbSm yGnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="0/V7kmJ+"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020aa7c2d6000000b0044e9fd71b82si11870876edp.280.2022.10.19.02.18.11; Wed, 19 Oct 2022 02:18:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="0/V7kmJ+"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233104AbiJSJRf (ORCPT + 99 others); Wed, 19 Oct 2022 05:17:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233327AbiJSJOk (ORCPT ); Wed, 19 Oct 2022 05:14: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 F28213ED5F; Wed, 19 Oct 2022 02:04:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8AB4661852; Wed, 19 Oct 2022 09:04:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6DA37C433C1; Wed, 19 Oct 2022 09:04:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170278; bh=8OgA0C8IHIsrI+48hYao+3vnUM+6hvyUvzEmf2Rdq/4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0/V7kmJ+YqKq7ZlLxLddtI5ZTZ1XQzS9YCihm2r5s351dTJWy56VXRqSSfuSU/EMb sUok6BHMWfqL2VHkQGsN804QIgj3Va6TnLVRSZk89UM6+D0lBUfKELA2EpAObYYAsp Cl5ipeXhv0lgW39n6rnr80j0ELNDoGxEmXo22MrM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Serge Semin , Stephen Boyd , Sasha Levin Subject: [PATCH 6.0 593/862] clk: baikal-t1: Add shared xGMAC ref/ptp clocks internal parent Date: Wed, 19 Oct 2022 10:31:20 +0200 Message-Id: <20221019083316.169283492@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747107043199770821?= X-GMAIL-MSGID: =?utf-8?q?1747107043199770821?= From: Serge Semin [ Upstream commit e2eef312762e0b5a5a70d29fe59a245c0a3cffa0 ] Baikal-T1 CCU reference manual says that both xGMAC reference and xGMAC PTP clocks are generated by two different wrappers with the same constant divider thus each producing a 156.25 MHz signal. But for some reason both of these clock sources are gated by a single switch-flag in the CCU registers space - CCU_SYS_XGMAC_BASE.BIT(0). In order to make the clocks handled independently we need to define a shared parental gate so the base clock signal would be switched off only if both of the child-clocks are disabled. Note the ID is intentionally set to -2 since we are going to add a one more internal clock identifier in the next commit. Fixes: 353afa3a8d2e ("clk: Add Baikal-T1 CCU Dividers driver") Signed-off-by: Serge Semin Link: https://lore.kernel.org/r/20220929225402.9696-4-Sergey.Semin@baikalelectronics.ru Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/baikal-t1/ccu-div.c | 1 + drivers/clk/baikal-t1/ccu-div.h | 6 ++++++ drivers/clk/baikal-t1/clk-ccu-div.c | 8 +++++--- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/clk/baikal-t1/ccu-div.c b/drivers/clk/baikal-t1/ccu-div.c index 4062092d67f9..bbfa3526ee10 100644 --- a/drivers/clk/baikal-t1/ccu-div.c +++ b/drivers/clk/baikal-t1/ccu-div.c @@ -579,6 +579,7 @@ struct ccu_div *ccu_div_hw_register(const struct ccu_div_init_data *div_init) goto err_free_div; } parent_data.fw_name = div_init->parent_name; + parent_data.name = div_init->parent_name; hw_init.parent_data = &parent_data; hw_init.num_parents = 1; diff --git a/drivers/clk/baikal-t1/ccu-div.h b/drivers/clk/baikal-t1/ccu-div.h index 795665caefbd..b6a9c8e45318 100644 --- a/drivers/clk/baikal-t1/ccu-div.h +++ b/drivers/clk/baikal-t1/ccu-div.h @@ -13,6 +13,12 @@ #include #include +/* + * CCU Divider private clock IDs + * @CCU_SYS_XGMAC_CLK: CCU XGMAC internal clock + */ +#define CCU_SYS_XGMAC_CLK -2 + /* * CCU Divider private flags * @CCU_DIV_SKIP_ONE: Due to some reason divider can't be set to 1. diff --git a/drivers/clk/baikal-t1/clk-ccu-div.c b/drivers/clk/baikal-t1/clk-ccu-div.c index ea77eec40ddd..3953ae5664be 100644 --- a/drivers/clk/baikal-t1/clk-ccu-div.c +++ b/drivers/clk/baikal-t1/clk-ccu-div.c @@ -204,10 +204,12 @@ static const struct ccu_div_info sys_info[] = { "eth_clk", CCU_SYS_GMAC1_BASE, 5), CCU_DIV_FIXED_INFO(CCU_SYS_GMAC1_PTP_CLK, "sys_gmac1_ptp_clk", "eth_clk", 10), - CCU_DIV_GATE_INFO(CCU_SYS_XGMAC_REF_CLK, "sys_xgmac_ref_clk", - "eth_clk", CCU_SYS_XGMAC_BASE, 8), + CCU_DIV_GATE_INFO(CCU_SYS_XGMAC_CLK, "sys_xgmac_clk", + "eth_clk", CCU_SYS_XGMAC_BASE, 1), + CCU_DIV_FIXED_INFO(CCU_SYS_XGMAC_REF_CLK, "sys_xgmac_ref_clk", + "sys_xgmac_clk", 8), CCU_DIV_FIXED_INFO(CCU_SYS_XGMAC_PTP_CLK, "sys_xgmac_ptp_clk", - "eth_clk", 8), + "sys_xgmac_clk", 8), CCU_DIV_GATE_INFO(CCU_SYS_USB_CLK, "sys_usb_clk", "eth_clk", CCU_SYS_USB_BASE, 10), CCU_DIV_VAR_INFO(CCU_SYS_PVT_CLK, "sys_pvt_clk", From patchwork Wed Oct 19 08: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: 5292 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp281943wrs; Wed, 19 Oct 2022 05:02:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6RzFcFtewxGAmitVie3UJlsCB7JezYEuQcKb25yVqWFjr8db6vNhcLqbq1/iZSzGqPYunq X-Received: by 2002:aa7:cc13:0:b0:453:52dc:1bbf with SMTP id q19-20020aa7cc13000000b0045352dc1bbfmr7175919edt.30.1666180959829; Wed, 19 Oct 2022 05:02:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666180959; cv=none; d=google.com; s=arc-20160816; b=EY5gOI06MAOho1P2uY4bRHnziAOwG1ZOBcrWz11A6hZ7P5R7zuRXc4eJJ1mBFs4J4s XXH6CjqEIqzCUQK4y3h/c9IQHFIb8KrW0NEg+m5pqOn7dMhSeIYrcq+p9f+Q0An2W75l GZ/nnyZV/+NQ1cXW1FjfHEomVaqbiPh2eEp975DFef02diB2yPklfmw1eZzUfdAKaAv6 wNv78fDmwD5/V6NaF6hcyUCvreX9wOE0FXFneIfQSAUz9U/1zkUw/EYRu2NFqlPVs1V4 2GHSJYYNNRRdHn+e+I12kuKzPVMUrQFrdOk0I2G7gT9ulZ7ts0MEmYpwyU9wz5Merx53 q+Lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9tOCKbE/rQj/V7qeN54HTO3Ih/H1SCm6TeyHUFcw4U8=; b=qVCf+qjaF1vz3p+Te199FkAyBjxDVOnHF79giXKuf7d6TVnpJGnT81fKelv5jOX7Jt R3mNQyLlaLjurOEfsMOb2k65emvymaQZAcRbriKvvJdL/65gw51VB2S0p8SwMrQH1pXd L4/prJNiRYRbIv1WA4syvFo8t1Z7SH8NrDQImfDK2gLsrTQKy6vLZfyP2u7gNG+KS8Is wOjJ9G7QVzJ2LsbOmB+FIk0gm1fA18lTLgSGA+C6/n1n8IbTJbEtGoeS4Cv5A6FEtQmZ Du7Hu8gHFcOgA6LQz74QvnN+Q27tL7GAIBImFadq7th+X8dZcpg0f0xeaFxIY6a5G8lf zfoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vC6rFeFD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c12-20020aa7df0c000000b00459fc3fcf3csi12927960edy.102.2022.10.19.05.02.11; Wed, 19 Oct 2022 05:02: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=vC6rFeFD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232173AbiJSL61 (ORCPT + 99 others); Wed, 19 Oct 2022 07:58:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232230AbiJSL5s (ORCPT ); Wed, 19 Oct 2022 07:57:48 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E52F1ACABD; Wed, 19 Oct 2022 04:36: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 577A5CE216B; Wed, 19 Oct 2022 09:04:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35F0BC433D6; Wed, 19 Oct 2022 09:04:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170280; bh=whpjSLgFOwluMyDP5s1KRTKjvJu5FSA0Wxy6pCWsZP8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vC6rFeFDcHSkD4BYNql2sXIVED+bCLX4qhYQ/caqiPxcHhizr188+QOo4IIQT0Rsp ueJ3U/kEtVnayqp9h1dVfsClUnD+dGFe8NuCMEg3SGewh4gzNa0bqTbeDHq/FFFcaH Ccj59ScWI3CVb0BZG0HnPdsp+0yaYBVhq5h3kBWM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Serge Semin , Stephen Boyd , Sasha Levin Subject: [PATCH 6.0 594/862] clk: baikal-t1: Add SATA internal ref clock buffer Date: Wed, 19 Oct 2022 10:31:21 +0200 Message-Id: <20221019083316.219632209@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747117366463771460?= X-GMAIL-MSGID: =?utf-8?q?1747117366463771460?= From: Serge Semin [ Upstream commit 081a9b7c74eae4e12b2cb1b86720f836a8f29247 ] It turns out the internal SATA reference clock signal will stay unavailable for the SATA interface consumer until the buffer on it's way is ungated. So aside with having the actual clock divider enabled we need to ungate a buffer placed on the signal way to the SATA controller (most likely some rudiment from the initial SoC release). Seeing the switch flag is placed in the same register as the SATA-ref clock divider at a non-standard ffset, let's implement it as a separate clock controller with the set-rate propagation to the parental clock divider wrapper. As such we'll be able to disable/enable and still change the original clock source rate. Fixes: 353afa3a8d2e ("clk: Add Baikal-T1 CCU Dividers driver") Signed-off-by: Serge Semin Link: https://lore.kernel.org/r/20220929225402.9696-5-Sergey.Semin@baikalelectronics.ru Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/baikal-t1/ccu-div.c | 64 +++++++++++++++++++++++++++++ drivers/clk/baikal-t1/ccu-div.h | 4 ++ drivers/clk/baikal-t1/clk-ccu-div.c | 18 +++++++- 3 files changed, 85 insertions(+), 1 deletion(-) diff --git a/drivers/clk/baikal-t1/ccu-div.c b/drivers/clk/baikal-t1/ccu-div.c index bbfa3526ee10..a6642f3d33d4 100644 --- a/drivers/clk/baikal-t1/ccu-div.c +++ b/drivers/clk/baikal-t1/ccu-div.c @@ -34,6 +34,7 @@ #define CCU_DIV_CTL_CLKDIV_MASK(_width) \ GENMASK((_width) + CCU_DIV_CTL_CLKDIV_FLD - 1, CCU_DIV_CTL_CLKDIV_FLD) #define CCU_DIV_CTL_LOCK_SHIFTED BIT(27) +#define CCU_DIV_CTL_GATE_REF_BUF BIT(28) #define CCU_DIV_CTL_LOCK_NORMAL BIT(31) #define CCU_DIV_RST_DELAY_US 1 @@ -170,6 +171,40 @@ static int ccu_div_gate_is_enabled(struct clk_hw *hw) return !!(val & CCU_DIV_CTL_EN); } +static int ccu_div_buf_enable(struct clk_hw *hw) +{ + struct ccu_div *div = to_ccu_div(hw); + unsigned long flags; + + spin_lock_irqsave(&div->lock, flags); + regmap_update_bits(div->sys_regs, div->reg_ctl, + CCU_DIV_CTL_GATE_REF_BUF, 0); + spin_unlock_irqrestore(&div->lock, flags); + + return 0; +} + +static void ccu_div_buf_disable(struct clk_hw *hw) +{ + struct ccu_div *div = to_ccu_div(hw); + unsigned long flags; + + spin_lock_irqsave(&div->lock, flags); + regmap_update_bits(div->sys_regs, div->reg_ctl, + CCU_DIV_CTL_GATE_REF_BUF, CCU_DIV_CTL_GATE_REF_BUF); + spin_unlock_irqrestore(&div->lock, flags); +} + +static int ccu_div_buf_is_enabled(struct clk_hw *hw) +{ + struct ccu_div *div = to_ccu_div(hw); + u32 val = 0; + + regmap_read(div->sys_regs, div->reg_ctl, &val); + + return !(val & CCU_DIV_CTL_GATE_REF_BUF); +} + static unsigned long ccu_div_var_recalc_rate(struct clk_hw *hw, unsigned long parent_rate) { @@ -323,6 +358,7 @@ static const struct ccu_div_dbgfs_bit ccu_div_bits[] = { CCU_DIV_DBGFS_BIT_ATTR("div_en", CCU_DIV_CTL_EN), CCU_DIV_DBGFS_BIT_ATTR("div_rst", CCU_DIV_CTL_RST), CCU_DIV_DBGFS_BIT_ATTR("div_bypass", CCU_DIV_CTL_SET_CLKDIV), + CCU_DIV_DBGFS_BIT_ATTR("div_buf", CCU_DIV_CTL_GATE_REF_BUF), CCU_DIV_DBGFS_BIT_ATTR("div_lock", CCU_DIV_CTL_LOCK_NORMAL) }; @@ -441,6 +477,9 @@ static void ccu_div_var_debug_init(struct clk_hw *hw, struct dentry *dentry) continue; } + if (!strcmp("div_buf", name)) + continue; + bits[didx] = ccu_div_bits[bidx]; bits[didx].div = div; @@ -477,6 +516,21 @@ static void ccu_div_gate_debug_init(struct clk_hw *hw, struct dentry *dentry) &ccu_div_dbgfs_fixed_clkdiv_fops); } +static void ccu_div_buf_debug_init(struct clk_hw *hw, struct dentry *dentry) +{ + struct ccu_div *div = to_ccu_div(hw); + struct ccu_div_dbgfs_bit *bit; + + bit = kmalloc(sizeof(*bit), GFP_KERNEL); + if (!bit) + return; + + *bit = ccu_div_bits[3]; + bit->div = div; + debugfs_create_file_unsafe(bit->name, ccu_div_dbgfs_mode, dentry, bit, + &ccu_div_dbgfs_bit_fops); +} + static void ccu_div_fixed_debug_init(struct clk_hw *hw, struct dentry *dentry) { struct ccu_div *div = to_ccu_div(hw); @@ -489,6 +543,7 @@ static void ccu_div_fixed_debug_init(struct clk_hw *hw, struct dentry *dentry) #define ccu_div_var_debug_init NULL #define ccu_div_gate_debug_init NULL +#define ccu_div_buf_debug_init NULL #define ccu_div_fixed_debug_init NULL #endif /* !CONFIG_DEBUG_FS */ @@ -520,6 +575,13 @@ static const struct clk_ops ccu_div_gate_ops = { .debug_init = ccu_div_gate_debug_init }; +static const struct clk_ops ccu_div_buf_ops = { + .enable = ccu_div_buf_enable, + .disable = ccu_div_buf_disable, + .is_enabled = ccu_div_buf_is_enabled, + .debug_init = ccu_div_buf_debug_init +}; + static const struct clk_ops ccu_div_fixed_ops = { .recalc_rate = ccu_div_fixed_recalc_rate, .round_rate = ccu_div_fixed_round_rate, @@ -566,6 +628,8 @@ struct ccu_div *ccu_div_hw_register(const struct ccu_div_init_data *div_init) } else if (div_init->type == CCU_DIV_GATE) { hw_init.ops = &ccu_div_gate_ops; div->divider = div_init->divider; + } else if (div_init->type == CCU_DIV_BUF) { + hw_init.ops = &ccu_div_buf_ops; } else if (div_init->type == CCU_DIV_FIXED) { hw_init.ops = &ccu_div_fixed_ops; div->divider = div_init->divider; diff --git a/drivers/clk/baikal-t1/ccu-div.h b/drivers/clk/baikal-t1/ccu-div.h index b6a9c8e45318..4eb49ff4803c 100644 --- a/drivers/clk/baikal-t1/ccu-div.h +++ b/drivers/clk/baikal-t1/ccu-div.h @@ -15,8 +15,10 @@ /* * CCU Divider private clock IDs + * @CCU_SYS_SATA_CLK: CCU SATA internal clock * @CCU_SYS_XGMAC_CLK: CCU XGMAC internal clock */ +#define CCU_SYS_SATA_CLK -1 #define CCU_SYS_XGMAC_CLK -2 /* @@ -37,11 +39,13 @@ * enum ccu_div_type - CCU Divider types * @CCU_DIV_VAR: Clocks gate with variable divider. * @CCU_DIV_GATE: Clocks gate with fixed divider. + * @CCU_DIV_BUF: Clock gate with no divider. * @CCU_DIV_FIXED: Ungateable clock with fixed divider. */ enum ccu_div_type { CCU_DIV_VAR, CCU_DIV_GATE, + CCU_DIV_BUF, CCU_DIV_FIXED }; diff --git a/drivers/clk/baikal-t1/clk-ccu-div.c b/drivers/clk/baikal-t1/clk-ccu-div.c index 3953ae5664be..90f4fda406ee 100644 --- a/drivers/clk/baikal-t1/clk-ccu-div.c +++ b/drivers/clk/baikal-t1/clk-ccu-div.c @@ -76,6 +76,16 @@ .divider = _divider \ } +#define CCU_DIV_BUF_INFO(_id, _name, _pname, _base, _flags) \ + { \ + .id = _id, \ + .name = _name, \ + .parent_name = _pname, \ + .base = _base, \ + .type = CCU_DIV_BUF, \ + .flags = _flags \ + } + #define CCU_DIV_FIXED_INFO(_id, _name, _pname, _divider) \ { \ .id = _id, \ @@ -188,11 +198,14 @@ static const struct ccu_div_rst_map axi_rst_map[] = { * for the SoC devices registers IO-operations. */ static const struct ccu_div_info sys_info[] = { - CCU_DIV_VAR_INFO(CCU_SYS_SATA_REF_CLK, "sys_sata_ref_clk", + CCU_DIV_VAR_INFO(CCU_SYS_SATA_CLK, "sys_sata_clk", "sata_clk", CCU_SYS_SATA_REF_BASE, 4, CLK_SET_RATE_GATE, CCU_DIV_SKIP_ONE | CCU_DIV_LOCK_SHIFTED | CCU_DIV_RESET_DOMAIN), + CCU_DIV_BUF_INFO(CCU_SYS_SATA_REF_CLK, "sys_sata_ref_clk", + "sys_sata_clk", CCU_SYS_SATA_REF_BASE, + CLK_SET_RATE_PARENT), CCU_DIV_VAR_INFO(CCU_SYS_APB_CLK, "sys_apb_clk", "pcie_clk", CCU_SYS_APB_BASE, 5, CLK_IS_CRITICAL, CCU_DIV_RESET_DOMAIN), @@ -398,6 +411,9 @@ static int ccu_div_clk_register(struct ccu_div_data *data) init.base = info->base; init.sys_regs = data->sys_regs; init.divider = info->divider; + } else if (init.type == CCU_DIV_BUF) { + init.base = info->base; + init.sys_regs = data->sys_regs; } else { init.divider = info->divider; } From patchwork Wed Oct 19 08:31: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: 4849 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223827wrs; Wed, 19 Oct 2022 02:38:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Yi/uq2eSTQvXWbhEKVOoCPTIPMtlUaqGRX2gMPoJAGMbQJvMPC/cP9kTMQrbvYlvx7SZo X-Received: by 2002:a63:5a0c:0:b0:46a:fcba:862c with SMTP id o12-20020a635a0c000000b0046afcba862cmr6455734pgb.187.1666172316555; Wed, 19 Oct 2022 02:38:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172316; cv=none; d=google.com; s=arc-20160816; b=ooMfZ/dKcuQnMaHXCT2hXrJhT0v7GZWNjee2shJDxPL3PFBGYm1U+eCAQoI+at/Gh8 85OPbwiy9wd0yDMKTDli/t4ISfd6loOG43TT2UowUHm7vydjeMCEId5WbfcBzBRmZKxn IFG3gu2Re0n8bxtAHwooeAN2n1yT5LJaUYVLrqrK2GeaJ+Q8Iw/X4K1UNrqowBQN+TqE M337kjQv1LcNyAhmN0+GREzoiXp3D6Jxa2ocmgGdexs22QdNk5YNZMOMBU3SrAkBg2Ij ynnj9KQl5dJGlWAf9Ou1e+/TwcvaSAX32XlnSM/ZG9qXs7dNqCqmgYhtkJZrFWuH7z+Q Vxmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=oEHBg8tstcqvKZm1+Zj5Ta3XNIgFJ2gI6vilybXa+hg=; b=0y2+XqB1G3oyZNHmkeOOKOdQMC/Gy8Jmw5wOB90r9rSn5vT4rL1S8vvN7TD552Ts03 bTMMOC3YrBRKJApurCaok+33VyBfcFWkpZuchJEwOWv+/8sTcI/QmYYnkUFO2LdPijk8 hrpCILo/mfEl5yja25aVgAiDxU3EVzhS+9BU0l1+ehNrCU8ZiofuuVX0K3yUwhoA9HP4 E976/6Cb5I0DuuTH4garXC0+lProx/l/Mmfy18H3x8DrQzf6pQ9lOstK4gXTTs9ovJUe yNevWWpTGuhFDB6dKszz5XzFq/cC0mqPUMnqw3CwmUBFOGbAtTKASnwt/fMMDZZGYyPa TCOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=znUUEREc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r134-20020a632b8c000000b0042b30f95f99si18277715pgr.807.2022.10.19.02.38.23; Wed, 19 Oct 2022 02:38: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=znUUEREc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233363AbiJSJUx (ORCPT + 99 others); Wed, 19 Oct 2022 05:20:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233591AbiJSJTn (ORCPT ); Wed, 19 Oct 2022 05:19:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99B95DD8B4; Wed, 19 Oct 2022 02:08:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BEDF061866; Wed, 19 Oct 2022 09:04:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1109C433D6; Wed, 19 Oct 2022 09:04:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170283; bh=fxmU8Yxirtkx6Nn2/a65k3vYjYq5wHv9VIAQWdJ9EaU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=znUUEREc5WbdoW/ha47707mKzit4MtH4R3kdZMujkWxf9MgWcTRmEodfSlzBEBuEL EcMUyclBZ9Fdo0kAI8NZFTA+KLJrh6kW2yMMxqzWQ9jHblfRB1vRiUICX3pDM9TN3L 4btzLcRNysZM6PGFuuR/S2rTy11g804yfQNds8Tc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Noralf_Tr=C3=B8nnes?= , Maxime Ripard , Stefan Wahren , Stephen Boyd , Sasha Levin Subject: [PATCH 6.0 595/862] clk: bcm2835: Make peripheral PLLC critical Date: Wed, 19 Oct 2022 10:31:22 +0200 Message-Id: <20221019083316.264188613@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108302947831812?= X-GMAIL-MSGID: =?utf-8?q?1747108302947831812?= From: Maxime Ripard [ Upstream commit 6c5422851d8be8c7451e968fd2e6da41b6109e17 ] When testing for a series affecting the VEC, it was discovered that turning off and on the VEC clock is crashing the system. It turns out that, when disabling the VEC clock, it's the only child of the PLLC-per clock which will also get disabled. The source of the crash is PLLC-per being disabled. It's likely that some other device might not take a clock reference that it actually needs, but it's unclear which at this point. Let's make PLLC-per critical so that we don't have that crash. Reported-by: Noralf Trønnes Signed-off-by: Maxime Ripard Link: https://lore.kernel.org/r/20220926084509.12233-1-maxime@cerno.tech Reviewed-by: Stefan Wahren Acked-by: Noralf Trønnes Signed-off-by: Stephen Boyd Stable-dep-of: 0b919a372869 ("clk: bcm2835: fix bcm2835_clock_rate_from_divisor declaration") Signed-off-by: Sasha Levin --- drivers/clk/bcm/clk-bcm2835.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c index 48a1eb9f2d55..19de0e83b65d 100644 --- a/drivers/clk/bcm/clk-bcm2835.c +++ b/drivers/clk/bcm/clk-bcm2835.c @@ -1784,7 +1784,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = { .load_mask = CM_PLLC_LOADPER, .hold_mask = CM_PLLC_HOLDPER, .fixed_divider = 1, - .flags = CLK_SET_RATE_PARENT), + .flags = CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), /* * PLLD is the display PLL, used to drive DSI display panels. From patchwork Wed Oct 19 08: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: 5483 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp333704wrs; Wed, 19 Oct 2022 06:41:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4GrHj/EDvPY4csgQeYTLkAQ9eY+fG8dSTrS7RjUuZScHkmJRgkSZre4PYZjbn2qBU+hkFx X-Received: by 2002:a17:906:fe46:b0:73d:939a:ec99 with SMTP id wz6-20020a170906fe4600b0073d939aec99mr6946915ejb.169.1666186880962; Wed, 19 Oct 2022 06:41:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666186880; cv=none; d=google.com; s=arc-20160816; b=J/NJAm0BGwb1XyHlyfgdpZ/4fJ6aLV6UQH4yELn73yCNIzVfIE5ZtNs2m/Ajf9q8dF Ia9TE1bzFNlbISTSrsotMZWtSHW+bPwL8kDXk48ZWElv3IvaNXS/IBKDPWOGzJ/GS2vs VDR+nb/xxuFUDjB6DUn9LFvikSk4M8qovHN01z3+Pf89ss7QtW+bRaQvUDSFbm9rNpPz R6F4RZXDett+98aBVByoG6Uo+DEhpZmfrR10udubSfD8U4Jh58L8PxN23n7dw8YivZkh SEevqwcLKVcK7Kj0TNMG0DctyGu2BPxht6mjVttqw6366a+YNEcDQ2pfIm1aczri9zb1 fw0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DDrQHjBKtvRqtOX7xftYdbHkQATsfZd/L2SkPWZx+gU=; b=vJmAdABFUp3f2qCvyOY6f0HeQ/RY17KzJ2/JqLzYZDaaG3LjC7bXKB/XH0gU+Ru/qr VzmSmDnKEaWd9/kfKqagY3JwSsQVfD8V7VOkWPO4M0L9FqCUhG7EcWjRanZrkfBDsehV cdpu0eNpbPT6VIZnuODxC4qEirfXcARC0FQd7uR03T+Md/94NrLFUT3hTiUg57Rs3L4t N8Kp7p29DcCzTL2Uq6b5g6z9ITvutc2a/g+rUCmGmf2f3dtYKUb7jdY3XnpLy/WXgx7M qJJwVK1Rh9s2xH3TbWyrYyol7wGt2ES6b4N9t9JNZb35Dpl76GJAbVld9O/igaSoJNiW Dl1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="UrS/PB5h"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r15-20020a17090638cf00b0078e11e92257si11956048ejd.333.2022.10.19.06.40.54; Wed, 19 Oct 2022 06:41: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="UrS/PB5h"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232579AbiJSNh3 (ORCPT + 99 others); Wed, 19 Oct 2022 09:37:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232126AbiJSNgj (ORCPT ); Wed, 19 Oct 2022 09:36: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 295AD18B4BF; Wed, 19 Oct 2022 06:25: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 3558EB82472; Wed, 19 Oct 2022 09:04:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 96D4EC433C1; Wed, 19 Oct 2022 09:04:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170286; bh=hp2uKnZxl95or/B7zQYyBfDUtgIF706uAcUo2gKA3mI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UrS/PB5hDDJ4wq3mK42h2SzyLQ3eWWn6fDu6RhvI7qPxtaS+bhpdjGLoANHmmgA9w QGCvgHL0P8CXD04hulq8O9pQQgRHo7sDnGofDUY5l3uKLiGAyt7ita1TiYRop54OoY /aMMcPJwT4FF4axc9aaE1h2A95IZPvSH4PjKWXyw= 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 6.0 596/862] clk: bcm2835: fix bcm2835_clock_rate_from_divisor declaration Date: Wed, 19 Oct 2022 10:31:23 +0200 Message-Id: <20221019083316.304157786@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123574722317890?= X-GMAIL-MSGID: =?utf-8?q?1747123574722317890?= 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 19de0e83b65d..f1102b4c7e88 100644 --- a/drivers/clk/bcm/clk-bcm2835.c +++ b/drivers/clk/bcm/clk-bcm2835.c @@ -966,9 +966,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 Wed Oct 19 08: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: 5298 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp282362wrs; Wed, 19 Oct 2022 05:03:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM57Dg0r8mnRXl/qRIqAm8N67zudRNAv0lmZYMoI7LrhARnbUqJUPnddknVzI87xIXFukwNq X-Received: by 2002:a17:907:7f93:b0:791:91a6:5615 with SMTP id qk19-20020a1709077f9300b0079191a65615mr6655669ejc.708.1666180991583; Wed, 19 Oct 2022 05:03:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666180991; cv=none; d=google.com; s=arc-20160816; b=VdqRxdOf4PdHXjX0cYldgqFJdVrbH82jqeJAwiHkNB9HHk42321MSZsiIPe7DpHj6o IQD1WcU/mhN3yos8Nw4tCBz0TeeyqrIH1Y0JoFqarfadU7HDBJAfGs2NOFQvUvcgNlVh Gb/y09LQNFE7C31P/Ff4o1pb9tyx3/QV7ZX4dC9wqoEhNszvR8Q6PPv3VBaYNNgYvUtz sqIXLAja7u8RE7cRV7XG3KMQIT9HKLlQ9ZcUe3fzhVQMwziBp+RGuPU9dDnZWN21AQid oauRJnOf548t0msKZxoCK/YPcv4ic2/dOZU36P7jJ5jw4BsF7ZUeMY7/jp11LYE5p5wk ePIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TTeWCrEAXz/R1jaseULMYcCZqavh7WM1a9qEnvKQtes=; b=CmKrzroOjfUMGr5yJ+g5XHyoFeZin39/Eh5HBu8mb77FUmT+i/TOn22PVvfYflxa6U Ix0XsIgNiSxi25fHZhtZ0ZAfG9Zem6LHJev9TMM8MntJtN4e1gGirsByNdhdO129/xCo gVREoiC1KqB8o+tD/Txta9sjQFPdbJzptIvLqyEVcSc/SGvoboIip2cN18pLcy4E6iY3 qBGTI3RdHUsXI705tvTm92XBENxFIF8ZgwJV4/ZcjMzRtKGpLVFBJ6PJvkp7MOCIf4pT xD5NlRidyVGk4ZxO/NpktiopH2BW2PnxIitdXBJq6snFt6EOVeQG5sGGt3VAbV129LCI FuYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FTpXhf5q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i17-20020a1709064fd100b00782ee6b819bsi15152015ejw.909.2022.10.19.05.02.44; Wed, 19 Oct 2022 05:03: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=FTpXhf5q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232118AbiJSL4f (ORCPT + 99 others); Wed, 19 Oct 2022 07:56:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231695AbiJSLzX (ORCPT ); Wed, 19 Oct 2022 07:55:23 -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 950B3BC5; Wed, 19 Oct 2022 04:34: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 sin.source.kernel.org (Postfix) with ESMTPS id 39B5BCE2169; Wed, 19 Oct 2022 09:04:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B123C433D6; Wed, 19 Oct 2022 09:04:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170288; bh=hKTO3ckIBTXb4I4DS2/kQuJdu1VH4R9jTa0t7jwGJUM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FTpXhf5qBbJ3oogIfgLmC9yDqWtn4G0G6MWCJPfn+sNcom1C2ZjTTw5H6YyWy5w4s ZNO7bWZcPpI74v+3qeYp1oLkHDLjs8yLL/1CmlzPMN199GaWRlbEVlz+RV2MnX6qmo 3Pu5OqdaUyyjtAQXFQS2crB7lmhgjjSyPwh+WPPU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ye Li , Peng Fan , Abel Vesa , Sasha Levin Subject: [PATCH 6.0 597/862] clk: imx8mp: tune the order of enet_qos_root_clk Date: Wed, 19 Oct 2022 10:31:24 +0200 Message-Id: <20221019083316.351549397@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747117399343330585?= X-GMAIL-MSGID: =?utf-8?q?1747117399343330585?= From: Peng Fan [ Upstream commit c68cd258a67730c24566b9688d7c134e67459ac6 ] The enet_qos_root_clk takes sim_enet_root_clk as parent. When registering enet_qos_root_clk, it will be put into clk orphan list, because sim_enet_root_clk is not ready. When sim_enet_root_clk is ready, clk_core_reparent_orphans_nolock will set enet_qos_root_clk parent to sim_enet_root_clk. Because CLK_OPS_PARENT_ENABLE is set, sim_enet_root_clk will be enabled and disabled during the enet_qos_root_clk reparent phase. All the above are correct. But with M7 booted early and using enet, M7 enet feature will be broken, because clk driver probe phase disable the needed clks, in case M7 firmware not configure sim_enet_root_clk. And tune the order would also save cpu cycles. Reviewed-by: Ye Li Signed-off-by: Peng Fan Reviewed-by: Abel Vesa Signed-off-by: Abel Vesa Link: https://lore.kernel.org/r/20220815013428.476015-1-peng.fan@oss.nxp.com Stable-dep-of: 855ae87a2073 ("clk: imx: scu: fix memleak on platform_device_add() fails") Signed-off-by: Sasha Levin --- drivers/clk/imx/clk-imx8mp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/imx/clk-imx8mp.c b/drivers/clk/imx/clk-imx8mp.c index e89db568f5a8..652ae58c2735 100644 --- a/drivers/clk/imx/clk-imx8mp.c +++ b/drivers/clk/imx/clk-imx8mp.c @@ -665,8 +665,8 @@ static int imx8mp_clocks_probe(struct platform_device *pdev) hws[IMX8MP_CLK_CAN1_ROOT] = imx_clk_hw_gate2("can1_root_clk", "can1", ccm_base + 0x4350, 0); hws[IMX8MP_CLK_CAN2_ROOT] = imx_clk_hw_gate2("can2_root_clk", "can2", ccm_base + 0x4360, 0); hws[IMX8MP_CLK_SDMA1_ROOT] = imx_clk_hw_gate4("sdma1_root_clk", "ipg_root", ccm_base + 0x43a0, 0); - hws[IMX8MP_CLK_ENET_QOS_ROOT] = imx_clk_hw_gate4("enet_qos_root_clk", "sim_enet_root_clk", ccm_base + 0x43b0, 0); hws[IMX8MP_CLK_SIM_ENET_ROOT] = imx_clk_hw_gate4("sim_enet_root_clk", "enet_axi", ccm_base + 0x4400, 0); + hws[IMX8MP_CLK_ENET_QOS_ROOT] = imx_clk_hw_gate4("enet_qos_root_clk", "sim_enet_root_clk", ccm_base + 0x43b0, 0); hws[IMX8MP_CLK_GPU2D_ROOT] = imx_clk_hw_gate4("gpu2d_root_clk", "gpu2d_core", ccm_base + 0x4450, 0); hws[IMX8MP_CLK_GPU3D_ROOT] = imx_clk_hw_gate4("gpu3d_root_clk", "gpu3d_core", ccm_base + 0x4460, 0); hws[IMX8MP_CLK_UART1_ROOT] = imx_clk_hw_gate4("uart1_root_clk", "uart1", ccm_base + 0x4490, 0); From patchwork Wed Oct 19 08: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: 4823 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223474wrs; Wed, 19 Oct 2022 02:37:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4OIJrWd/iONHsyS+QeXD8bSFAtxM6LEOZ/NW+claRQWuv5Aezx6P0/7cZHINR43Ze9Jlja X-Received: by 2002:a17:906:8a55:b0:78d:b6db:a2d4 with SMTP id gx21-20020a1709068a5500b0078db6dba2d4mr5983164ejc.82.1666172247101; Wed, 19 Oct 2022 02:37:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172247; cv=none; d=google.com; s=arc-20160816; b=OIARls6Q9APTc6bXdrKBzr3MUxwbUKFxNxr5+bGDG7n4VvU0s9A5ivy0jZvAVYhFar NJLTJ/D2MVfEErzxTW+k7CSiOiegMekMsqHOt5eh78XbjHYit4MuXAm2+k+3t+I0FM4l nciG9C9OxZkSP8Bvybb0nKNAUz5imzQoJjGhFw6n9ZfTMkJvzSVNjIGPUCjTA3uzYdxE NPP94c8lrVOTqnbxeYVvdRrqMnLdh4WS0Br4XDQBalPc0QSm6t8rShqNjnd78dCwKq27 ZvC/IZg+w71KcEVZpOXkONT0skPFUHG8eOVloseNV9wdUe5OskYl8buepYoqySsJt5U5 c2tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hlHXTeLk6Vus863ESYLLvMsfIytHocqsYinwuBwvjGE=; b=GYX4U0JistxADr9+dwzWwXRxSBfqo6qmSuneVJ/1Aa7X3jQlF+QSWlN8Mpnl+Y68hH u6CU3PLoaC2etnMlk61M7Riczs38C0lvj4730tfIPJ+Z1AmkVW+0Xitcv4ZZYP4xxaov CYZLjpvK7e7EuL34qKkjVorjGwIs9w0n/nT/Ev3PPRB1+RCDjTTkBDdhj6RXNx6Xkc26 G2eWcvAuwiJ01p8W8iIjQxTtHfaAqXHQPDJvK42BBGFN7pKobtfjfHpgE9lXqMFMvV1D GXq2n0yZ7ABL+oPePqMsMgDF20IFa6BjPK+NpTA41ySy0bHzqI8/eisMJyuEXvLSzni7 FeRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hqrJxjZL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v15-20020a170906180f00b0078d20d71475si11997235eje.413.2022.10.19.02.37.01; Wed, 19 Oct 2022 02:37: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=hqrJxjZL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233134AbiJSJUQ (ORCPT + 99 others); Wed, 19 Oct 2022 05:20:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233309AbiJSJSQ (ORCPT ); Wed, 19 Oct 2022 05:18:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01BE7D9977; Wed, 19 Oct 2022 02:07: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 6588A617F1; Wed, 19 Oct 2022 09:06:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7C631C433D7; Wed, 19 Oct 2022 09:06:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170406; bh=1Y7qpSB/p47Zdgo29zn1EKjizf5xN3DqjUZFK+QYqKQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hqrJxjZLYMe32NBRt0lQAHjx5yiltiJGgJWcJdOezvyWXHE8+IHa170HuvW0cGKcB 5q1eIiVl3L7NLgW5vKEXxTfdWE0JAC86SYfATMcVVfUCtgMG0GAalm3xe9VtALTV2e FEjocvzD9qKgFTj5uIk3Y5uxO6aT0DkSPCSLdm/E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lin Yujun , Stephen Boyd , Sasha Levin Subject: [PATCH 6.0 598/862] clk: imx: scu: fix memleak on platform_device_add() fails Date: Wed, 19 Oct 2022 10:31:25 +0200 Message-Id: <20221019083316.386165857@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108230468494614?= X-GMAIL-MSGID: =?utf-8?q?1747108230468494614?= From: Lin Yujun [ Upstream commit 855ae87a2073ebf1b395e020de54fdf9ce7d166f ] No error handling is performed when platform_device_add() fails. Add error processing before return, and modified the return value. Fixes: 77d8f3068c63 ("clk: imx: scu: add two cells binding support") Signed-off-by: Lin Yujun Link: https://lore.kernel.org/r/20220914033206.98046-1-linyujun809@huawei.com Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/imx/clk-scu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/clk/imx/clk-scu.c b/drivers/clk/imx/clk-scu.c index c56e406138db..1e6870f3671f 100644 --- a/drivers/clk/imx/clk-scu.c +++ b/drivers/clk/imx/clk-scu.c @@ -695,7 +695,11 @@ struct clk_hw *imx_clk_scu_alloc_dev(const char *name, pr_warn("%s: failed to attached the power domain %d\n", name, ret); - platform_device_add(pdev); + ret = platform_device_add(pdev); + if (ret) { + platform_device_put(pdev); + return ERR_PTR(ret); + } /* For API backwards compatiblilty, simply return NULL for success */ return NULL; From patchwork Wed Oct 19 08: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: 5475 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp332870wrs; Wed, 19 Oct 2022 06:39:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Y7WlM0t1/s15kyfQp+UCeFvDsVJ8zVpUuQ+f3PqGChJiqSUe6OYmYy/TOxmOYtHqh3R7g X-Received: by 2002:a17:902:ec86:b0:185:483e:e4ec with SMTP id x6-20020a170902ec8600b00185483ee4ecmr8590806plg.164.1666186784664; Wed, 19 Oct 2022 06:39:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666186784; cv=none; d=google.com; s=arc-20160816; b=ggCKp7OZndFGEjrJD8ZTT1NIV8uyjTTnEgnOspH2EOA1861PdGKub6+OYcXFncbt37 scBfmr9uBH9+5EAaAOXghJvlAYmP8lDKDjpI7Utt2MVHTTMrGVXNhplEXi2aCP8N+nJu a5YpnA5Uo47UOL1QswZPiV2kNidBNJVCz5O1ZIftCFnWpCj7zclER1LlR5ay60RA4Z/5 fDvKXt3+qQZCjHmS4ZGFBHS2HuhfS1gC/ayRU2fQWeHiYWIVgeTUIAX8+/hGZuGmI72U 7w3EBYR77AghlEHGl1uHvZOJC2NGDx5tGUrOSPeQ955m/t0IeG/kvjjqBS0LeqmpRCAs KkrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=IMvrzPZDe6S/Bf4yzcrbTxTXznzTydPcp//lfajMluA=; b=U2z8w+ikFn8Vs6S++nDa+Ph4agB7lcQbQXYTFIRr9+XmWvbvI4pOa36kShLlFxrYMp 05FqARVbmLTUioCnsVab+CvefSfkF7RdvmW2SnIpnJgNddRGVcoNiZm9jLoqsC/wnQzl mkbQNid+v4ueUEWI0brE50SrzMesPbDauabd3S+QgwzmlxTZbO0BS1+63UNeXi8Ptnqj CW3eAJLSlbhSm+DKqxHSHyh1BS9Qz7xRUKeRwQNqifrVbLJuVAE9O+RZGn0DuaMXokcU xrvfmo2eScUR7tXl95uxKk+wtFvg4DU7SW9/Yk/wN4kzXZyrPYwCaIBBVsCKBMZFTXfA 5MBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=g1xvTNu8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170902b70800b00179f72a057esi17240729pls.417.2022.10.19.06.39.29; Wed, 19 Oct 2022 06:39: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=g1xvTNu8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232008AbiJSNgk (ORCPT + 99 others); Wed, 19 Oct 2022 09:36:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231997AbiJSNgF (ORCPT ); Wed, 19 Oct 2022 09:36:05 -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 AA986157893; Wed, 19 Oct 2022 06:25: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 C4780B8247F; Wed, 19 Oct 2022 09:05:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25215C433C1; Wed, 19 Oct 2022 09:05:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170309; bh=aKUcsa7cZlsRyIMxZGGQkgloTdCqdrQaEUZAYX/1P7Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g1xvTNu8Q0csK+KPQjvKrBVPoL9DAKq/DTa3sa5WeR5f6r2DCM41VGeLY7R0Df1W/ ZLFbPoz4wBo9qzhF/rVm3pmYAjvRHT9yCRf+PPxsOOPdbfECplCYR0YZjXhrMdKM7r isgMU52NPj6h0orYd9S2fvSGtuanoUo6DUr1olwo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Stephen Boyd , Sasha Levin Subject: [PATCH 6.0 599/862] clk: ti: Balance of_node_get() calls for of_find_node_by_name() Date: Wed, 19 Oct 2022 10:31:26 +0200 Message-Id: <20221019083316.424482657@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123473542204172?= X-GMAIL-MSGID: =?utf-8?q?1747123473542204172?= From: Liang He [ Upstream commit 058a3996b888ab60eb1857fb4fd28f1b89a9a95a ] In ti_find_clock_provider(), of_find_node_by_name() will call of_node_put() for the 'from' argument, possibly putting the node one too many times. Let's maintain the of_node_get() from the previous search and only put when we're exiting the function early. This should avoid a misbalanced reference count on the node. Fixes: 51f661ef9a10 ("clk: ti: Add ti_find_clock_provider() to use clock-output-names") Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220915031121.4003589-1-windhl@126.com [sboyd@kernel.org: Rewrite commit text, maintain reference instead of get again] Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/ti/clk.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/clk/ti/clk.c b/drivers/clk/ti/clk.c index 373e9438b57a..1dc2f15fb75b 100644 --- a/drivers/clk/ti/clk.c +++ b/drivers/clk/ti/clk.c @@ -140,11 +140,12 @@ static struct device_node *ti_find_clock_provider(struct device_node *from, break; } } - of_node_put(from); kfree(tmp); - if (found) + if (found) { + of_node_put(from); return np; + } /* Fall back to using old node name base provider name */ return of_find_node_by_name(from, name); From patchwork Wed Oct 19 08: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: 4814 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp221697wrs; Wed, 19 Oct 2022 02:32:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6uKD5Qo5flc9P+aExsvGiBDqDUzVSFpnKQde4Dx73Z6oZ0DDhUPqtGXBm4/n9w/VXE7GqS X-Received: by 2002:a05:6a00:1306:b0:555:6d3f:11ed with SMTP id j6-20020a056a00130600b005556d3f11edmr7689230pfu.55.1666171934527; Wed, 19 Oct 2022 02:32:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666171934; cv=none; d=google.com; s=arc-20160816; b=czXDCTJa4E7qeLnCl99bfWWzoHCx1Ms7xA1Uta/XwDkXLNpuExe84IyNI/Emli/Oc1 71cSyB9PUMXw5JYpIgqEIkiJ5Ze67seGoIdZA5TSbkYDIbuA2UAmi9DDiAmhBrDaPNPG IffRKN0o5fmCWSS1xLwN69rETC/VIYh5yypKC8rOlcItwkBFWCtc/HIaX3P5iFIiRBtS 6WV7tD59BoPfVv8k0DyliKIdWPr+hcIuRd+Ro6ycTXiBI+BxV2dBQnXfSy/Q7Ip4nwPE X+VKIJA2LjuiohCXKtRoV7uqanDtIX7EW5hXjVSyP53Jga/tDeWLZlI65HICo+CTY3cQ Xolw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NWm5zSh7HVXxZm+p7LQatkw+K0AC2OqVZ/eXnpCEpDI=; b=DiwG2tZkiz1fOEOHbn3Qi3p3cVKTVylF2FjvClSkVjCUPaSuJiwHZT+eHNkxG3LRcV fQyO5qSIgHLBa3hO3kc5Xb1h9weMcgaAHPPiE1QcCmKHT8dHdYulFIQiwFWyQVt67dNV el2Rdkj3d1/xGgwKDA2oEt9gUodilJ5sArTkipK5vjH8DFlaUNSqhD718/SSYNoPGiiw 8OVmq+CstMCflpE+l2MxqhONlKEupntHhhu1jjHAYXRCvlo+/iKHbyznr/pQ/6kPknJv R1I+KO4EdzmNGPxGnfejb7QxNBHX5mGfGBGMhzESL00ecVBL6XRVnKMoq6NV+97iSkiU gNTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0mLk2CPD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cm9-20020a056a00338900b0056771c032f4si1882568pfb.28.2022.10.19.02.31.58; Wed, 19 Oct 2022 02:32: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=0mLk2CPD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233289AbiJSJSH (ORCPT + 99 others); Wed, 19 Oct 2022 05:18:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233665AbiJSJPg (ORCPT ); Wed, 19 Oct 2022 05:15:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7856B1C7; Wed, 19 Oct 2022 02:06: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 C739C61851; Wed, 19 Oct 2022 09:05:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9BDEC433C1; Wed, 19 Oct 2022 09:05:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170338; bh=3X88PMqkuFvbCL2Lx1FKmQEB2o2cLmNKVi0b2sFtjAk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0mLk2CPD40mjPK4qpr8ICu+0FlSn6/tvQtRA1RUHwQmFL8nC9LWmz3+CCOFra1IuT XnYKw0tMMGET/s2Q3VkqmeWsg+aj7DyFgdUFNDzRWAlf3lYEgI2FppGzhfKcC5p7zq Oh9C6ewKWuyfKioqBK+I/8kw+OBaZQudQn2E/Vd8= 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 6.0 600/862] clk: ti: dra7-atl: Fix reference leak in of_dra7_atl_clk_probe Date: Wed, 19 Oct 2022 10:31:27 +0200 Message-Id: <20221019083316.457225483@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747107902168003187?= X-GMAIL-MSGID: =?utf-8?q?1747107902168003187?= 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 f0f5bf68b6d2..ff4d6a951681 100644 --- a/drivers/clk/ti/clk-dra7-atl.c +++ b/drivers/clk/ti/clk-dra7-atl.c @@ -245,14 +245,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)); @@ -285,8 +287,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 Wed Oct 19 08: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: 5195 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp264077wrs; Wed, 19 Oct 2022 04:19:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ICm0anNUtZzDrkDJPq2dF27T0sZDOtI76MqAM68CefyMQwQsbD+MCO+2l7jsa2HXRbcL9 X-Received: by 2002:a05:6402:2402:b0:45c:a1ce:94d8 with SMTP id t2-20020a056402240200b0045ca1ce94d8mr6810906eda.50.1666178359808; Wed, 19 Oct 2022 04:19:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178359; cv=none; d=google.com; s=arc-20160816; b=FmS1nbNO9zoIPEglVgI20nV4dQgs7Fd2YZyYamVp5EDKrGhN+kpjrcc6kPUfZkTmjN +jFqSPCoSHjFNoLG8ySguV3Q6KIAJIyQHFz1QSrE6YWr/Url0dUy/pCZ40hJv5PGH4WM //U7SMKEz1Cik86gJqFw+uzy6zeSCc9vDHyeGDFkf6joaWjM4IaaslaG+AA8UEnM0chl zrUsI2nvKcIgEmf6oamy/MXWGuvO1Czfusc1zS54Ko6XQIR8spN49D7w/B2gWFvEoog0 Xue4X/9rY5wABlu5xLSm2Dh1T3V3W368hXgwOSoi6moG/GKNtmUE5P0KgvLqVW0hnaGi uqlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=K3U6h1ZFYGt/wdhpVzTBJWNxbnPLKnC9h5nOVfy2B5U=; b=A/3kw+1dyf3gZyEdRIuZ/7eT5XbIfOXP3YoepO/JKJsAnDLmsS2jRtei2OTR2zLnjO 71f9gMfDDnhJal92/yQEBpC9toG890YPrSLs/AbvoDPBmWLqqbuPhvzjOm51ivEPza8I bPdaajWofJpipSEdKL/1KrOs2rYbD4WuUrzptqFIVcSh2sfMJsckBVvz51V8oNpxkzHt KWy9+y5X0ibinaA2fUWYONY6P0N9O4p0yJ2+yBuYMYUQLaAQluQH25mZzg55eCSzhLmf l5JISlA2F+6nJxh4vXEsd7ccA5+U7sDs1YzN6SR0CxIUQSBB/CcPA5LxwZ6ku/+nk31b Ulvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lin7EaOC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dm21-20020a170907949500b00787803711f9si14762941ejc.353.2022.10.19.04.18.42; Wed, 19 Oct 2022 04:19:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lin7EaOC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231895AbiJSLIj (ORCPT + 99 others); Wed, 19 Oct 2022 07:08:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230473AbiJSLIW (ORCPT ); Wed, 19 Oct 2022 07:08: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 820BF17939E; Wed, 19 Oct 2022 03:37:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3B8DAB821CA; Wed, 19 Oct 2022 09:06:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3057C433B5; Wed, 19 Oct 2022 09:06:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170367; bh=64gELA0nUsV9N2NViMDvTXlYD/PS9XrRDXeAPBJL2d8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lin7EaOC21SrB+66QrBnZN8oZaxZt/dtb5GU2D5peRTaZTsgKzU4vVypb8o1LVs7E S5nDJAiD8NMZiyUl5hubpiKdYuUshz3lnuAfZe03p7Y5woTHli21HL2577WWO2ilDi ibWKIJ/Wwo5qDjW0czYdfyLzHjEU8fXiBknAzwS4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joel Stanley , Stephen Boyd , Sasha Levin Subject: [PATCH 6.0 601/862] clk: ast2600: BCLK comes from EPLL Date: Wed, 19 Oct 2022 10:31:28 +0200 Message-Id: <20221019083316.500957495@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114639606415544?= X-GMAIL-MSGID: =?utf-8?q?1747114639606415544?= From: Joel Stanley [ Upstream commit b8c1dc9c00b252b3be853720a71b05ed451ddd9f ] This correction was made in the u-boot SDK recently. There are no in-tree users of this clock so the impact is minimal. Fixes: d3d04f6c330a ("clk: Add support for AST2600 SoC") Link: https://github.com/AspeedTech-BMC/u-boot/commit/8ad54a5ae15f27fea5e894cc2539a20d90019717 Signed-off-by: Joel Stanley Link: https://lore.kernel.org/r/20220421040426.171256-1-joel@jms.id.au Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/clk-ast2600.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/clk-ast2600.c b/drivers/clk/clk-ast2600.c index 24dab2312bc6..9c3305bcb27a 100644 --- a/drivers/clk/clk-ast2600.c +++ b/drivers/clk/clk-ast2600.c @@ -622,7 +622,7 @@ static int aspeed_g6_clk_probe(struct platform_device *pdev) regmap_write(map, 0x308, 0x12000); /* 3x3 = 9 */ /* P-Bus (BCLK) clock divider */ - hw = clk_hw_register_divider_table(dev, "bclk", "hpll", 0, + hw = clk_hw_register_divider_table(dev, "bclk", "epll", 0, scu_g6_base + ASPEED_G6_CLK_SELECTION1, 20, 3, 0, ast2600_div_table, &aspeed_g6_clk_lock); From patchwork Wed Oct 19 08: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: 5363 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp299461wrs; Wed, 19 Oct 2022 05:32:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Dizf62hf0LiVdjyoiAQLCwtbKL5jisJonWEJGuRy57BAEKt29w9AsgwoqRUexhYnrkXaY X-Received: by 2002:a05:6402:4022:b0:45c:9f2c:c4d3 with SMTP id d34-20020a056402402200b0045c9f2cc4d3mr7257201eda.223.1666182736919; Wed, 19 Oct 2022 05:32:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666182736; cv=none; d=google.com; s=arc-20160816; b=y0PnOAPbRtd/WG8cGiUoSOCuTegJGShZocCyXu24KBZlm/6F63adErsRNm5+jt27aF bJ1y9h91sNuVXEEmpzEdly7+HRIbJREAMqrVRwbN10Al5aT7fE1lldbnCOxyfz1yodi5 tQAuVEp/jNKQmaB8rh5VHfRCWs+ha8UfAbQIs8ONr7SgQ9mtaDRIA5Q6vgtE0ufnIHpP Ipvce6OByJhGtYp+4QCyJSbPjXqa3Tlhr9xVWv9DNL6Yrm97oThCWbumKNoaS4pX1Jug OYbWYOaqlcAEnrfPzcDqOJ4bzbWR0OgXwJBNiVaQf1hX24BWZXx8QrgiGxpeAxGJTZX+ 8umw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=iEBo7fyFA3e+ZvrAOMCbH4Yeukxp53pfbnpnJSFhPkk=; b=lbeWy+P6C/1gI0liGw02KGdTpk9aXBF27gkJ0rTv+rD5O3On9Xf5B5ETWXSU5pB7PY dg/Ctt0hZgWVsd0gvuCLtExz9rUA8Jr5KzNYVQdzLe+gu3LcVV88hRN9tJSRCSUq4eGw o6igtaJW4NYCTtVTEFCptVrZUBm2FWiLWjvbTw/4tg4ahr/gmHhUP2tglflIA5SIm7yk 5eUwActUOmoeEvMX822fvv2jrxuJmn7H9GJNmdMcgw5HK+FoUmSzn/RVIgXkJWVqaft7 qwyvBm8F06q7698F9w7abMJlvTl6agOyeKNY+WLE9WqS917Ff7gqXQciIAPGbXmeRt19 Z8fQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VXYO5drs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mv15-20020a170907838f00b0078d459a1ce9si11645841ejc.693.2022.10.19.05.31.51; Wed, 19 Oct 2022 05:32: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=VXYO5drs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232854AbiJSMUP (ORCPT + 99 others); Wed, 19 Oct 2022 08:20:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233176AbiJSMTI (ORCPT ); Wed, 19 Oct 2022 08:19:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B631E1DF20; Wed, 19 Oct 2022 04:54: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 1F5BF6186B; Wed, 19 Oct 2022 09:06:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 31CCCC433B5; Wed, 19 Oct 2022 09:06:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170390; bh=YV9SNubNHp2LHE3ZQBiNdjtXaux/DEG9x6Hhp3wRTGQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VXYO5drseuSGA3JIYxg6CoTOP0etYhzsfOBBiChh32t97Isg0ph0aj/0bXsrY7NMW xEhv4JwMUWs/AK8WlD9td6NL04YWQ+gbjbLoo01QCa78xGzgd2oQ50/bvkSIWRvrL7 fvPxRQlC1/FyIYzIg1b7if7P8sM6VnEptZGgRJCU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liu Ying , Peng Fan , Jassi Brar , Sasha Levin Subject: [PATCH 6.0 602/862] mailbox: imx: fix RST channel support Date: Wed, 19 Oct 2022 10:31:29 +0200 Message-Id: <20221019083316.545213987@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747119229832195777?= X-GMAIL-MSGID: =?utf-8?q?1747119229832195777?= From: Peng Fan [ Upstream commit 7e5cd064f73ccecd2ac1aadca078394bd25ea3ce ] Because IMX_MU_xCR_MAX was increased to 5, some mu cfgs were not updated to include the CR register. Add the missed CR register to xcr array. Fixes: 82ab513baed5 ("mailbox: imx: support RST channel") Reported-by: Liu Ying Signed-off-by: Peng Fan Tested-by: Liu Ying # i.MX8qm/qxp MEK boards boot Signed-off-by: Jassi Brar Signed-off-by: Sasha Levin --- drivers/mailbox/imx-mailbox.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/mailbox/imx-mailbox.c b/drivers/mailbox/imx-mailbox.c index 02922073c9ef..20f2ec880ad6 100644 --- a/drivers/mailbox/imx-mailbox.c +++ b/drivers/mailbox/imx-mailbox.c @@ -904,7 +904,7 @@ static const struct imx_mu_dcfg imx_mu_cfg_imx7ulp = { .xTR = 0x20, .xRR = 0x40, .xSR = {0x60, 0x60, 0x60, 0x60}, - .xCR = {0x64, 0x64, 0x64, 0x64}, + .xCR = {0x64, 0x64, 0x64, 0x64, 0x64}, }; static const struct imx_mu_dcfg imx_mu_cfg_imx8ulp = { @@ -927,7 +927,7 @@ static const struct imx_mu_dcfg imx_mu_cfg_imx8ulp_s4 = { .xTR = 0x200, .xRR = 0x280, .xSR = {0xC, 0x118, 0x124, 0x12C}, - .xCR = {0x110, 0x114, 0x120, 0x128}, + .xCR = {0x8, 0x110, 0x114, 0x120, 0x128}, }; static const struct imx_mu_dcfg imx_mu_cfg_imx93_s4 = { @@ -938,7 +938,7 @@ static const struct imx_mu_dcfg imx_mu_cfg_imx93_s4 = { .xTR = 0x200, .xRR = 0x280, .xSR = {0xC, 0x118, 0x124, 0x12C}, - .xCR = {0x110, 0x114, 0x120, 0x128}, + .xCR = {0x8, 0x110, 0x114, 0x120, 0x128}, }; static const struct imx_mu_dcfg imx_mu_cfg_imx8_scu = { @@ -949,7 +949,7 @@ static const struct imx_mu_dcfg imx_mu_cfg_imx8_scu = { .xTR = 0x0, .xRR = 0x10, .xSR = {0x20, 0x20, 0x20, 0x20}, - .xCR = {0x24, 0x24, 0x24, 0x24}, + .xCR = {0x24, 0x24, 0x24, 0x24, 0x24}, }; static const struct imx_mu_dcfg imx_mu_cfg_imx8_seco = { @@ -960,7 +960,7 @@ static const struct imx_mu_dcfg imx_mu_cfg_imx8_seco = { .xTR = 0x0, .xRR = 0x10, .xSR = {0x20, 0x20, 0x20, 0x20}, - .xCR = {0x24, 0x24, 0x24, 0x24}, + .xCR = {0x24, 0x24, 0x24, 0x24, 0x24}, }; static const struct of_device_id imx_mu_dt_ids[] = { From patchwork Wed Oct 19 08: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: 5468 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp332198wrs; Wed, 19 Oct 2022 06:38:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4UDk0FoLxn9RLk8co+r7aWj2DXhQH3PGOCPYx3ZqxJXik9C5Zypy5ofJ2lo9J8I7c32jSD X-Received: by 2002:a17:90b:17c7:b0:20d:7862:778e with SMTP id me7-20020a17090b17c700b0020d7862778emr9708504pjb.91.1666186699964; Wed, 19 Oct 2022 06:38:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666186699; cv=none; d=google.com; s=arc-20160816; b=u7tE9IWRJoJCaXNMfD1Xf9Z91XVQQxZCJuvXdVlpIa3AwK5qvRcUOgwvkckaYGCVOf K8Iyp87EW/CJMMLnDjnGxUaDgUnJHFEI7nYNidVQfkEze08Fko7eiGN5t430NSH0M0TC tWrPD0HFmnBNL7pc33fAJ0eRaRFNhWCcfMFMzTMBts08Sfb89IHA0Y5XCk8A/XJUgQGZ lV6WUHjwAPEepLqt97MtuBSAXymjy6myBg3bhRMU7NJBNckQMdXAYETDcQ66iHDjyGWi W/s3lTCTp0NDP2PPn9ySREcWe6X+hED5H0HWY5zvPN5E80JqMtoDcGVesiDkmEbR1vty cPhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3nSjuCAwduMBFtcaaKcXgEkc0vrdf1VD87ZjOSTdQa8=; b=SPDz5aNf1Uz+Xu8WB8XCLSoJB2N+cE1Xy0FR5SluoHRxveDDJaz3L4+B1ZZFMRbHGX 2HztteXOwWBFE2KqoLQc0qz0/HyYpD5Fo0OIrW79AFrUE3HklemE0fNBGwvKnaIorIqA 9JnBqZpJBTbcnibYM4wNL5Fr+C00OKKcLbFg3p5cn8iIvvBVlc3StDbCTIDtaSAghjNq I6H6gP0uCQNlrJgJ2hQrGtdRLP3aS3a6UkpsG7AX4mEl39twL6n3HiH3shtIVm4aR3Ub A8QO3YNYY4753c6emssS2Jus3Ad9gg4xQG9rnWx8xRVyvAA21bPl4IcAaum1JN8NYFvm H3og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rbZZJzHx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mw4-20020a17090b4d0400b001fdb95c743bsi29028955pjb.83.2022.10.19.06.38.07; Wed, 19 Oct 2022 06:38: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=rbZZJzHx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231720AbiJSNds (ORCPT + 99 others); Wed, 19 Oct 2022 09:33:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231460AbiJSNde (ORCPT ); Wed, 19 Oct 2022 09:33:34 -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 B54A21E0441; Wed, 19 Oct 2022 06:21: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 E85EBCE2186; Wed, 19 Oct 2022 09:06:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA402C433D7; Wed, 19 Oct 2022 09:06:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170393; bh=QG5TJidSSe20q6w/U96C+IpsB/oyzh/jpVsc0UJamV0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rbZZJzHxcNAgrorvcauFWJ4jaedn352qUbbE2k6hU1gbbpQ4nbUgQEK1dIYNYdU/k jVRqfhhxYLUrvWf6dXnjGcELKgbiWrsJ6e2/XZ2800wAghADWwrE7M1TuGiYKNlbEW P4OroIrT+wasAsKTOQdw9N0RXCAQD213B9w5/nyI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Conor Dooley , Jassi Brar , Sasha Levin Subject: [PATCH 6.0 603/862] mailbox: mpfs: fix handling of the reg property Date: Wed, 19 Oct 2022 10:31:30 +0200 Message-Id: <20221019083316.588729360@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123385100860716?= X-GMAIL-MSGID: =?utf-8?q?1747123385100860716?= From: Conor Dooley [ Upstream commit 2e10289d1f304f5082a4dda55a677b72b3bdb581 ] The "data" region of the PolarFire SoC's system controller mailbox is not one continuous register space - the system controller's QSPI sits between the control and data registers. Split the "data" reg into two parts: "data" & "control". Optionally get the "data" register address from the 3rd reg property in the devicetree & fall back to using the old base + MAILBOX_REG_OFFSET that the current code uses. Fixes: 83d7b1560810 ("mbox: add polarfire soc system controller mailbox") Signed-off-by: Conor Dooley Signed-off-by: Jassi Brar Signed-off-by: Sasha Levin --- drivers/mailbox/mailbox-mpfs.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/drivers/mailbox/mailbox-mpfs.c b/drivers/mailbox/mailbox-mpfs.c index 4e34854d1238..e432a8f0d148 100644 --- a/drivers/mailbox/mailbox-mpfs.c +++ b/drivers/mailbox/mailbox-mpfs.c @@ -62,6 +62,7 @@ struct mpfs_mbox { struct mbox_controller controller; struct device *dev; int irq; + void __iomem *ctrl_base; void __iomem *mbox_base; void __iomem *int_reg; struct mbox_chan chans[1]; @@ -73,7 +74,7 @@ static bool mpfs_mbox_busy(struct mpfs_mbox *mbox) { u32 status; - status = readl_relaxed(mbox->mbox_base + SERVICES_SR_OFFSET); + status = readl_relaxed(mbox->ctrl_base + SERVICES_SR_OFFSET); return status & SCB_STATUS_BUSY_MASK; } @@ -99,14 +100,13 @@ static int mpfs_mbox_send_data(struct mbox_chan *chan, void *data) for (index = 0; index < (msg->cmd_data_size / 4); index++) writel_relaxed(word_buf[index], - mbox->mbox_base + MAILBOX_REG_OFFSET + index * 0x4); + mbox->mbox_base + index * 0x4); if (extra_bits) { u8 i; u8 byte_off = ALIGN_DOWN(msg->cmd_data_size, 4); u8 *byte_buf = msg->cmd_data + byte_off; - val = readl_relaxed(mbox->mbox_base + - MAILBOX_REG_OFFSET + index * 0x4); + val = readl_relaxed(mbox->mbox_base + index * 0x4); for (i = 0u; i < extra_bits; i++) { val &= ~(0xffu << (i * 8u)); @@ -114,14 +114,14 @@ static int mpfs_mbox_send_data(struct mbox_chan *chan, void *data) } writel_relaxed(val, - mbox->mbox_base + MAILBOX_REG_OFFSET + index * 0x4); + mbox->mbox_base + index * 0x4); } } opt_sel = ((msg->mbox_offset << 7u) | (msg->cmd_opcode & 0x7fu)); tx_trigger = (opt_sel << SCB_CTRL_POS) & SCB_CTRL_MASK; tx_trigger |= SCB_CTRL_REQ_MASK | SCB_STATUS_NOTIFY_MASK; - writel_relaxed(tx_trigger, mbox->mbox_base + SERVICES_CR_OFFSET); + writel_relaxed(tx_trigger, mbox->ctrl_base + SERVICES_CR_OFFSET); return 0; } @@ -141,7 +141,7 @@ static void mpfs_mbox_rx_data(struct mbox_chan *chan) if (!mpfs_mbox_busy(mbox)) { for (i = 0; i < num_words; i++) { response->resp_msg[i] = - readl_relaxed(mbox->mbox_base + MAILBOX_REG_OFFSET + readl_relaxed(mbox->mbox_base + mbox->resp_offset + i * 0x4); } } @@ -200,14 +200,18 @@ static int mpfs_mbox_probe(struct platform_device *pdev) if (!mbox) return -ENOMEM; - mbox->mbox_base = devm_platform_get_and_ioremap_resource(pdev, 0, ®s); - if (IS_ERR(mbox->mbox_base)) - return PTR_ERR(mbox->mbox_base); + mbox->ctrl_base = devm_platform_get_and_ioremap_resource(pdev, 0, ®s); + if (IS_ERR(mbox->ctrl_base)) + return PTR_ERR(mbox->ctrl_base); mbox->int_reg = devm_platform_get_and_ioremap_resource(pdev, 1, ®s); if (IS_ERR(mbox->int_reg)) return PTR_ERR(mbox->int_reg); + mbox->mbox_base = devm_platform_get_and_ioremap_resource(pdev, 2, ®s); + if (IS_ERR(mbox->mbox_base)) // account for the old dt-binding w/ 2 regs + mbox->mbox_base = mbox->ctrl_base + MAILBOX_REG_OFFSET; + mbox->irq = platform_get_irq(pdev, 0); if (mbox->irq < 0) return mbox->irq; From patchwork Wed Oct 19 08: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: 4818 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223356wrs; Wed, 19 Oct 2022 02:37:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM64BsRe1D2SNPKQNviiiCbjsor5MJ8aEC8rrL0nyr0vppuajtRrOWk96lnBIV5xEx1e8yU3 X-Received: by 2002:a17:902:6bc8:b0:179:fef9:b2fa with SMTP id m8-20020a1709026bc800b00179fef9b2famr7640043plt.96.1666172239132; Wed, 19 Oct 2022 02:37:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172239; cv=none; d=google.com; s=arc-20160816; b=QhDErhO2PGPgaHTSnFeBkHCTgKQEPmAtrgd86WkrnXM7b8yb8N9CKDOwfrvPA4msMS WlnU55RGomf8eTNdxMGrpkkiHHGQK0zgBagdU5gubwuRO4nwk4R385F4lgkFxwtXcbjc plYHaGbv8PN2Eyfs7k78fssVskkWWfOgnfjwDCS7HY2tJkYovNTH//TH+qEvIWd6JLCZ ychWhXD9t2m2mXH+v9UD0OzWoV+3SnVcDuRYowd38b/AnQnL6Ea/YbrAMLQgEXenn/PX 545BoEwmmhvmsMm9YMT8jLbMkWG9dW/lGoEDimLRxhpInjG8xIVIGD4dQJr98m+c+lIM Z/Ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xJzHFxIB5ABkFlipgr6KWm7rM26EFsRk2b6RS9pkBzY=; b=W+liaz3QP9s+9rsJ0zHfM0EDOGK3OC7urNk/GYNs7qZRTtOLgSG4BzVw/PhtCCPqok AUMIUymuYvjwmvYRUQThZaTf0jt6bHStd6NRb62eAn5/1ZwSR548K0Rzti9QSB6nqRVf CBDYFJXRtXl9LT1bVvxvmf+8uypSz4dC6888YyFaMvf4ML59r4mRsZaYAM1cJfvIcVG5 tCNUBh5sByvmbckJKNJPH8tGfaiMDyZjJ48rOZPcjcaWNEfPJx4/dOUCJtjl5g2XQLSR OjOLl7haaK11hs2hQO2wNKNVTtlgm9weYZaVDNmfOnFs9F6HBfyqf6Y9Y6KUojbtNvC8 ZwQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jDU3wPmH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g18-20020a63e612000000b0045b0a113f6asi18579819pgh.846.2022.10.19.02.36.59; Wed, 19 Oct 2022 02:37: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=jDU3wPmH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232833AbiJSJUO (ORCPT + 99 others); Wed, 19 Oct 2022 05:20:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233274AbiJSJRz (ORCPT ); Wed, 19 Oct 2022 05:17:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B38665654; Wed, 19 Oct 2022 02:07:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7CB2361851; Wed, 19 Oct 2022 09:06:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91F40C433D7; Wed, 19 Oct 2022 09:06:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170395; bh=znIfOAw2qnyy3/KsoXWVQh5iihyrexv06scq5zFQkEo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jDU3wPmHGcyBPIuY3bhri4ccsj0TQDR3M8Wb6zddMdzCBc6Oiez9M6FihpKZ6dP+6 8wP2Z1MgsaaL8ETHdBsLbq+iXV9mUXAL+NCtzjDcmbskQt7U3x5Gu7JfEFZkPEgzHR dAXMuPWOBTEvvu2E8pfh+/FAihM1M7BAPIe1CXlo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Conor Dooley , Jassi Brar , Sasha Levin Subject: [PATCH 6.0 604/862] mailbox: mpfs: account for mbox offsets while sending Date: Wed, 19 Oct 2022 10:31:31 +0200 Message-Id: <20221019083316.634652306@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108221766695344?= X-GMAIL-MSGID: =?utf-8?q?1747108221766695344?= From: Conor Dooley [ Upstream commit 0d1aadfe10ba17ebdeb96abb9638eb0f623f9b55 ] The mailbox offset is not only used for receiving messages, but it is also used by messages sent to the system controller by Linux that have a payload, such as the "digital signature service". It is also overloaded by certain other services (reprogramming of the FPGA fabric, see Link:) to have a meaning other than the offset the system controller should read from. When the driver was written, no such services of the latter type were in use & those of the former used an offset of zero so this has gone un-noticed. Link: https://www.microsemi.com/document-portal/doc_download/1245815-polarfire-fpga-and-polarfire-soc-fpga-system-services-user-guide # Section 5.2 Fixes: 83d7b1560810 ("mbox: add polarfire soc system controller mailbox") Signed-off-by: Conor Dooley Signed-off-by: Jassi Brar Signed-off-by: Sasha Levin --- drivers/mailbox/mailbox-mpfs.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/mailbox/mailbox-mpfs.c b/drivers/mailbox/mailbox-mpfs.c index e432a8f0d148..cfacb3f320a6 100644 --- a/drivers/mailbox/mailbox-mpfs.c +++ b/drivers/mailbox/mailbox-mpfs.c @@ -100,21 +100,20 @@ static int mpfs_mbox_send_data(struct mbox_chan *chan, void *data) for (index = 0; index < (msg->cmd_data_size / 4); index++) writel_relaxed(word_buf[index], - mbox->mbox_base + index * 0x4); + mbox->mbox_base + msg->mbox_offset + index * 0x4); if (extra_bits) { u8 i; u8 byte_off = ALIGN_DOWN(msg->cmd_data_size, 4); u8 *byte_buf = msg->cmd_data + byte_off; - val = readl_relaxed(mbox->mbox_base + index * 0x4); + val = readl_relaxed(mbox->mbox_base + msg->mbox_offset + index * 0x4); for (i = 0u; i < extra_bits; i++) { val &= ~(0xffu << (i * 8u)); val |= (byte_buf[i] << (i * 8u)); } - writel_relaxed(val, - mbox->mbox_base + index * 0x4); + writel_relaxed(val, mbox->mbox_base + msg->mbox_offset + index * 0x4); } } From patchwork Wed Oct 19 08: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: 5225 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp265896wrs; Wed, 19 Oct 2022 04:23:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7c6CamcRBVmHzB7eSXUTTJ9JgexdzJMILsNYMQP8neVjBYN/NTAfHdNYcAYF5xeZeFXFnx X-Received: by 2002:a17:90a:f016:b0:20b:a65f:af42 with SMTP id bt22-20020a17090af01600b0020ba65faf42mr9195329pjb.79.1666178605479; Wed, 19 Oct 2022 04:23:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178605; cv=none; d=google.com; s=arc-20160816; b=HtnQndc+aKQCMFPxhJN/xRcStvufB4cfzk+uXA1Pja3KnApYBSU4GLNmYQqZzyYHI4 r/P4/4GgMnKuDO5HY2ChtEwSUD1+xfaipDBsFUIFueI1pzEUG2R2A1jCugMATd7R1//C KrjmdYLreY7AhvzMFlpc/GThRWSgYISVbGXG+iAwhqODfNzEhjC/Fn0bJbpzwHMrMw0y L0ptEndKPP/NW30tx5l9nfdSMLOlcLAV9UKV39rbZHUNzdqpifEaDlv4oaAR2bFVdP4C gOaaS+CyOQeIUXdHt+Y4TF4gxVD+MiXhoWQrVOzVzYMfNLg5Bi3tn7BhErcz3BZGNomy 1M4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ypV0HJqxvtZbEQ6JlEdcxcOuL8BwnALqC6YIC1VN6j4=; b=EXWsiolpKGtc0HWp9EoAJJYzL2dQDry6Dr4U6ubq1OXQ4blvYpEJ6deVs0KsnbBPtb H8iFdRk7xc0LoLxXREsBVs9IpghiLONJlHlKTG+ji+uKXECbYpiw2NWvfTJUf8zMPI5X SVCiSBtE5DhJcwTABoty977rnFN/w0QWO+sTqy87gAZgjI3FEkJl4f5TQDAvsAd9z5pO +4LbfGqr1draeTLCGeZzYXTx9Ik5q5WvEbzq/YgJaEsiTt1I8pfUuS9NShWluP2LsvJk P0yW8YtMQXcd3gMLHoKOW4yrPQ6xD4OWCupHvpQVmhimj4WwwHnupIlDOoUcbaBPGjST Bgsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KAcYywsH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j65-20020a638b44000000b0046b2ebb0a4esi15525353pge.212.2022.10.19.04.23.08; Wed, 19 Oct 2022 04:23: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=KAcYywsH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232848AbiJSLMI (ORCPT + 99 others); Wed, 19 Oct 2022 07:12:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232752AbiJSLLM (ORCPT ); Wed, 19 Oct 2022 07:11: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 51582153835; Wed, 19 Oct 2022 03:38: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 CF590B82334; Wed, 19 Oct 2022 09:06:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44479C433D7; Wed, 19 Oct 2022 09:06:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170398; bh=BaI82+rRrrtiUMrTa09afa+nj5px1HQoMoRsf7VXukE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KAcYywsHykvqeM38DgQfXuy2Jqh10AUDY1rgcDnW82sKKRGG8Y8svqd+IPmXU+V7S xD49vCXuHWSdABnSExukc8hN7d5My8TURM4IMVy666jqJ7H9Hk0lZmVHX05Pvni8na 24GUobX6hE0aHrEUgwt9QwcFeSswS9TzYwovp3qA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jack Wang , Jassi Brar , Sasha Levin Subject: [PATCH 6.0 605/862] mailbox: bcm-ferxrm-mailbox: Fix error check for dma_map_sg Date: Wed, 19 Oct 2022 10:31:32 +0200 Message-Id: <20221019083316.678797029@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114897296037656?= X-GMAIL-MSGID: =?utf-8?q?1747114897296037656?= From: Jack Wang [ Upstream commit 6b207ce8a96a71e966831e3a13c38143ba9a73c1 ] dma_map_sg return 0 on error, fix the error check, and return -EIO to caller. Fixes: dbc049eee730 ("mailbox: Add driver for Broadcom FlexRM ring manager") Signed-off-by: Jack Wang Signed-off-by: Jassi Brar Signed-off-by: Sasha Levin --- drivers/mailbox/bcm-flexrm-mailbox.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/mailbox/bcm-flexrm-mailbox.c b/drivers/mailbox/bcm-flexrm-mailbox.c index fda16f76401e..bf6e86b0ed09 100644 --- a/drivers/mailbox/bcm-flexrm-mailbox.c +++ b/drivers/mailbox/bcm-flexrm-mailbox.c @@ -622,15 +622,15 @@ static int flexrm_spu_dma_map(struct device *dev, struct brcm_message *msg) rc = dma_map_sg(dev, msg->spu.src, sg_nents(msg->spu.src), DMA_TO_DEVICE); - if (rc < 0) - return rc; + if (!rc) + return -EIO; rc = dma_map_sg(dev, msg->spu.dst, sg_nents(msg->spu.dst), DMA_FROM_DEVICE); - if (rc < 0) { + if (!rc) { dma_unmap_sg(dev, msg->spu.src, sg_nents(msg->spu.src), DMA_TO_DEVICE); - return rc; + return -EIO; } return 0; From patchwork Wed Oct 19 08: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: 5209 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp264655wrs; Wed, 19 Oct 2022 04:20:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM62uCZdSIIkzYDGhvEIxE4ca2wPLvslCSFuTdgH2OAHk4owrQZGnJWCBPe4mRI9rdWabGJB X-Received: by 2002:a17:907:2702:b0:78e:e94:2ac4 with SMTP id w2-20020a170907270200b0078e0e942ac4mr6233974ejk.679.1666178437096; Wed, 19 Oct 2022 04:20:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178437; cv=none; d=google.com; s=arc-20160816; b=zvBh9FxcUXdgyAkbasNG7LPs7M7/nggBKU8Svc6TIK3vXogKZKTou5JuKObX4Dh8GU q9NVvzBVnov9AgnAhV18SzBSr7RSh1OAopajBhRIRNOUzb19h5+fW2p/7u+f5YIMY411 wsucqobzKL0JJ6JY1luSU0uUmBvINDeHd7IzOFYGdqvkZX4d6lcXLhgujbAoBCUcWFA1 6QCtKv2CL3d+Zp+vGmhtgdksw1kdfEyD0NYN543Oms+f67qvgPteHMeXmwcKB1VHMjyo GnbqujUou/FZYUxcD73Ap0hHuZ2SXSu6abS6sKhJbB4jmfEALe9gGCeePLqvJ1bbMm44 0chg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=LCUOLP1nMan9i8WIEQSziWZ5WoxFUBos6X4ta8kGOro=; b=rh05lYTO1dvV6nPtFrvwVQYQFtOHS55QY7vlvnV3ifjEE0QqQDS9jZFr3RTsAiHe1u /SopfmHuukSqJAVAGWprVmpgCT0BtGYfmpSD5UCIOvfcpVpfCazqpTwBlHZPHyOQvkmP kc87/Swjlt/7dxQ6kbnF/EWcLe8zChm2SzXU9sCDP4iB+Hs43syovfhtTimgMeKsq2Cr JUP6tercDZsT44EZsFxoonFNqcvtS89YG9NwuLM0LoWvR1uVExUp/InxTNMO2E/j+Rbj 7nZBuiJPsSothyGdRa+F8mmAMyP4LktdKGgsrqeTegX3YLjl8NAdDqaQjzrpB4gl6VKk ahXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=p+T1nxJK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u27-20020a17090617db00b0077b2e822b5dsi12434344eje.674.2022.10.19.04.20.11; Wed, 19 Oct 2022 04:20:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=p+T1nxJK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230261AbiJSLIs (ORCPT + 99 others); Wed, 19 Oct 2022 07:08:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232334AbiJSLI1 (ORCPT ); Wed, 19 Oct 2022 07:08:27 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AFACC17C54C; Wed, 19 Oct 2022 03:37: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 B8C59B8239F; Wed, 19 Oct 2022 09:06:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05C54C433B5; Wed, 19 Oct 2022 09:06:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170401; bh=+NwEIh0CKLU+P0/6RuqD9Lvp0NWwOKt/Z49Pb8qKbWg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p+T1nxJKfd6c8vze6LZXnj3cEaI7TiDn4PaAlbMlvn9X0P18yGrd21MKJS64oH56i rg2mwdKJZKcyYzOSUp2/Kz2b6v+mVSgucqn3bT2aBtwLlbrrd8Gq/yxY7oQegphEKF /cS4QgrIQ9dOdgrOIPepA0aj0EheDQhUPr0O11Do= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hangyu Hua , "Eric W. Biederman" , Sasha Levin Subject: [PATCH 6.0 606/862] ipc: mqueue: fix possible memory leak in init_mqueue_fs() Date: Wed, 19 Oct 2022 10:31:33 +0200 Message-Id: <20221019083316.717671409@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114720382073437?= X-GMAIL-MSGID: =?utf-8?q?1747114720382073437?= From: Hangyu Hua [ Upstream commit c579d60f0d0cd87552f64fdebe68b5d941d20309 ] commit db7cfc380900 ("ipc: Free mq_sysctls if ipc namespace creation failed") Here's a similar memory leak to the one fixed by the patch above. retire_mq_sysctls need to be called when init_mqueue_fs fails after setup_mq_sysctls. Fixes: dc55e35f9e81 ("ipc: Store mqueue sysctls in the ipc namespace") Signed-off-by: Hangyu Hua Link: https://lkml.kernel.org/r/20220715062301.19311-1-hbh25y@gmail.com Signed-off-by: Eric W. Biederman Signed-off-by: Sasha Levin --- ipc/mqueue.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ipc/mqueue.c b/ipc/mqueue.c index f98de32aeea1..9cf314b3f079 100644 --- a/ipc/mqueue.c +++ b/ipc/mqueue.c @@ -1746,6 +1746,7 @@ static int __init init_mqueue_fs(void) unregister_filesystem(&mqueue_fs_type); out_sysctl: kmem_cache_destroy(mqueue_inode_cachep); + retire_mq_sysctls(&init_ipc_ns); return error; } From patchwork Wed Oct 19 08: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: 5523 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp337253wrs; Wed, 19 Oct 2022 06:48:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4aucwzpx7J2CgEjKW443G5pQhzUZiPvd4qnSS1EaTRsUx5A4IMKefaeM3YUBxjnfgzNH64 X-Received: by 2002:a05:6a00:1412:b0:557:d887:2025 with SMTP id l18-20020a056a00141200b00557d8872025mr8640903pfu.39.1666187331651; Wed, 19 Oct 2022 06:48:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666187331; cv=none; d=google.com; s=arc-20160816; b=wV1R+rHhQKCz066Ar22F9Ps9UrytVd0kEa89OgrDTVcFVu+qRxBYyNIbx2QJE2BjDx aA+DFeqlEOPTuaGbt6FHvn6UPZ3A5ApYFZX3sUhgRpV4uNJLWlZIV1ykcR3ntDMRZSN1 UVLkvG2DW3d7I4aDqdrHf5bYDSyfpI+f+5CE6/z6ykEwO6WLQSHoiEaupa46rtWGK51z lRtjma0f2hYiS0ek/oQXsMG5OvxRLLGx9ITiEj/jFuwWJX483B2kpFw5MLAPHeOBAHWT EDM2dAUTidQ1RiuAFxpUJPwsVMQmRwR+EAlZzzHwRds8fsZmSUZdH39Is/86/UvmsvmU 3pkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=boQam1fP1HcdDlBuavZdl3u9HRRqRG7gI7LtF1eD2Vs=; b=PEFHm/gy4RqSP0l64N+V4Dw8q0WWGWKLyRfdIE5LxxPeX921WePG28T5/3UsLGrxse G+WqV20yrdFMG4/850B6mZjAoVxU1lSd1VfWNKTT+lujAg4AhJgKkr1n/PFSUNYRHWqD q9MNu1GRqkSLvowzr+PN5EMVzMxbfz/kkUGPDb2Y89qGKllXw3XLzyiC+3fv3hE3WlID H5GlWQk++eI08o7LmTALf2gn7PgsN5+t727UQN5aeTWRlbMvJ2cdVHcnb0K352a6gfov Wk4bK30G5ViBnHzaS2Tp41g03HbMQzvDbNvY18LzEaq01cPC+KSB3/xNy3647uG8dXFi ++qA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cRBMGWFd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y28-20020a634b1c000000b0045259b8b37esi19196260pga.714.2022.10.19.06.48.37; Wed, 19 Oct 2022 06: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=cRBMGWFd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233468AbiJSNsR (ORCPT + 99 others); Wed, 19 Oct 2022 09:48:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233431AbiJSNq6 (ORCPT ); Wed, 19 Oct 2022 09:46:58 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9613F4E19C; Wed, 19 Oct 2022 06:32:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 9D773CE218A; Wed, 19 Oct 2022 09:06:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C19E5C433B5; Wed, 19 Oct 2022 09:06:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170404; bh=f0I55/u99pGYDq+p5TcYl8mlp27PqkFcOL+TYbcY9o0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cRBMGWFdzaFS4HuugkV/e4tzFok9/AvkwbfwvCBsJ3K3Ybt3C6AbGcfzpA9cBlPT/ r73RsD/EEDIlGR7k0vJoworlQLnHI81ADIAhufrXiFouI1tunIW882q9OxUHDepNkZ oe3FvDpQu+qOCEy+ztihT1YShR0OgbYvRb8Y1VBQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Ellerman , Sasha Levin Subject: [PATCH 6.0 607/862] powerpc/configs: Properly enable PAPR_SCM in pseries_defconfig Date: Wed, 19 Oct 2022 10:31:34 +0200 Message-Id: <20221019083316.759918368@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747124047804176622?= X-GMAIL-MSGID: =?utf-8?q?1747124047804176622?= From: Michael Ellerman [ Upstream commit aa398d88aea4ec863bd7aea35d5035a37096dc59 ] My commit to add PAPR_SCM to pseries_defconfig failed to add the required dependencies, meaning the driver doesn't get built. Add the required LIBNVDIMM=m. Fixes: d6481a7195df ("powerpc/configs: Add PAPR_SCM to pseries_defconfig") Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220901014253.252927-1-mpe@ellerman.id.au Signed-off-by: Sasha Levin --- arch/powerpc/configs/pseries_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/configs/pseries_defconfig b/arch/powerpc/configs/pseries_defconfig index b571d084c148..c05e37af9f1e 100644 --- a/arch/powerpc/configs/pseries_defconfig +++ b/arch/powerpc/configs/pseries_defconfig @@ -40,6 +40,7 @@ CONFIG_PPC_SPLPAR=y CONFIG_DTL=y CONFIG_PPC_SMLPAR=y CONFIG_IBMEBUS=y +CONFIG_LIBNVDIMM=m CONFIG_PAPR_SCM=m CONFIG_PPC_SVM=y # CONFIG_PPC_PMAC is not set From patchwork Wed Oct 19 08: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: 5480 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp333272wrs; Wed, 19 Oct 2022 06:40:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7YJw9GpsNaU1CM+ZrxaHEP1Zoh/u6/cpF9kK+KsRvlKW0wj4yCbXdsOd58bsLkGsTKTKUz X-Received: by 2002:a05:6402:4302:b0:45d:c9b4:c007 with SMTP id m2-20020a056402430200b0045dc9b4c007mr7535594edc.328.1666186834338; Wed, 19 Oct 2022 06:40:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666186834; cv=none; d=google.com; s=arc-20160816; b=tfaUuZsXC/9bldTIqlK4IYkgHLpPjdrb6/VKweBjr/nAASv5RurszF1gNI0j2BN2Eg 25KhqacarkiGyyYfMY5aiYCOiDIGy9xw6e1mj/Gbk35hOnl4qj5pYdybi8txeSzK3H3M 8jOqfLoPveAuA9FlAdMWNoY4WC6gj7OrX2QAPRVLcWNdiSqKvfnIEUvkz/V6brN7gFdl EOowCby8xhkz6vg5vqYOxJ60xwoDIKfbbraQGdBhnjEMkcL5mFLLa6AEC24zZzWkRJvt 1yBqIW9CgVzZBLKs5LOR5IRsVOn0pWf6DE8BPDHzEu/oa2PoDpKR1r5EWR4hK2aIE98Z 9wjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VdDAP0eGeDgP9t5fUtoe9++sIfX8aGNyvRDuNDvBtQ4=; b=XU0cTbTBxgfykn4gFrKLC8CE9htVS+zvKP9005PAVkvWE8OEkWI2yYAxX0J87T2vpy 5Po8g9wiAVMqOcxXa6OEStlbLFpbnF0Avq+cOFTgwPitcc1+sgYuTlRxqwb6m7jp0xaQ 4CYJd/adEPaHomSelUlHpZuioRoOCq6nvUfHLWHSO1lUobe/HF2FPooCnU+cXZuAKvAj cmBaFbqrrhtaqxPIk+MPYkACu8VfVB2enNtFqsgFAdSXRmjT4dkdZwX4utJKXehYD7pW DZshS7KkwoQyC9z+6UkLR8Qjbz9Fpr5Tss7DGil/Fz1xOxxPl+ZpNehSYVrIrjCJLqbs 6L8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="eg1/1pi4"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y88-20020a50bb61000000b0045bdff8a884si13083049ede.268.2022.10.19.06.40.09; Wed, 19 Oct 2022 06:40:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="eg1/1pi4"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231608AbiJSNe4 (ORCPT + 99 others); Wed, 19 Oct 2022 09:34:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232754AbiJSNeX (ORCPT ); Wed, 19 Oct 2022 09:34:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD5611C69DA; Wed, 19 Oct 2022 06:23: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 ams.source.kernel.org (Postfix) with ESMTPS id 47B52B8247A; Wed, 19 Oct 2022 09:05:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BAE7AC433D6; Wed, 19 Oct 2022 09:05:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170312; bh=sc+YbobDr/tEqzXPDL3b8fTi2QPNYaqR8xdhG6QRLxo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eg1/1pi4iprdSPa4j5lirmjGfV9ZRAN4/cmbHDqanrbQ5L4z20Pgi3y5OO7jYNkbH WB1QXt+h7sdKg2cGqLUNTFh9Y5xUTjfVwa34U8Rmw36Zci9AQdYKgnNFRQ4Hm6+VJp ZqaF1DovZbzLuGI+wInV6b3D2E3UjUPe1pwW4hfk= 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 6.0 608/862] powerpc/math_emu/efp: Include module.h Date: Wed, 19 Oct 2022 10:31:35 +0200 Message-Id: <20221019083316.800426492@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123525862697719?= X-GMAIL-MSGID: =?utf-8?q?1747123525862697719?= 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 39b84e7452e1..aa3bb8da1cb9 100644 --- a/arch/powerpc/math-emu/math_efp.c +++ b/arch/powerpc/math-emu/math_efp.c @@ -17,6 +17,7 @@ #include #include +#include #include #include From patchwork Wed Oct 19 08: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: 4995 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp228244wrs; Wed, 19 Oct 2022 02:51:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6kNUDx3Gu+SrfAICBUzunC73NUw763nIJZ0AgJx/dFcoNFX4YDe3X8PkRug7KfFoPcGw2T X-Received: by 2002:a17:907:168c:b0:78d:8b6c:a209 with SMTP id hc12-20020a170907168c00b0078d8b6ca209mr6346140ejc.185.1666173091332; Wed, 19 Oct 2022 02:51:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666173091; cv=none; d=google.com; s=arc-20160816; b=R3lpVkJhZfgbrPgIdLJLKpZ2Fa1w85qzZz+q0Wyx+nb/HWRCWm6lijwBR3GqT6xrJY z2N12URPhPaW3qKoN+0tamDLxL3AlfYlPGt3cMCmBisRFJkHFMbtJ4/ArbQKorLdyXOf Aiarp1p7QjBC4gWgzUmyfiV8bD3RcqBTVWKoLoMN0HYws7pMEGaOV9YfqVMpCZJa6rqy z1d8FCV8Grhm76XEJ0iaPWmkawQPUZF1acAuVFLkPF6/ArWO+YN3xfN9vvyASaj4wnes /2ukubIoBiKWqLllHG08LT8Vyw1H1ry+DtzUBKLNUklNT6Ee6s522KHFSC7QJAl8MWKg 1DZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=y9zKNt0Fgj+6W8NaXtiNXEZ5AdriOp709K78Ief3jZI=; b=01jIblElsgPqr3KyqVN1/m0Lfx3ogMbuRaxg5+mz9s1efX5fzr688Rf7o0pMu4AtpO wYBzE/KeSlLF5S759f8BuwNatD8ob44QExgP1/UmXovhCcwY7tHJl9rWKwQEIBIhNAPJ /lw8A+O5Ei5oKXhqILiXfpJh1zMlxI6fIQC3rfJlJ9FFyrGc1xLPrwiwWI82EhBoJ1ps RLbjeA8QsDWl+KCm2C+D/4e+veKQVp5vX7rOQXyevpTGOtk0K/e88PgbS+g+P7gal1Sl qGk7vAgVM4UTT2vh/uwhGO/Qh6lTNHckGX1jSMjM796fEgJPvJz2REz5QUwNmpUklhTo zOzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iNKzag5T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b4-20020a0564021f0400b0045d8bff7afesi6623963edb.376.2022.10.19.02.50.51; Wed, 19 Oct 2022 02:51: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=iNKzag5T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234605AbiJSJol (ORCPT + 99 others); Wed, 19 Oct 2022 05:44:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234785AbiJSJlW (ORCPT ); Wed, 19 Oct 2022 05:41: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 08D28F5CC0; Wed, 19 Oct 2022 02:18: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 39214617DF; Wed, 19 Oct 2022 09:05:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4EC09C433C1; Wed, 19 Oct 2022 09:05:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170314; bh=3a6Ezfk5Xd230UoZ6JDDW0SFulTzd9ZULyx1GhQQxWU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iNKzag5TGkzAn78CCI0cqICeeJNg+d6afsgKc6gi576twwkJqcbSVZvCMHycBPlTl q3dDiafnycyizTx5pP+M7gmjESGANqwdHQXqNj9ecWQnRJXFN3FnrnaxsYPN+MQ2ET 7Zn2F1XDjBIhN59flD9Fs08f0ZVN1fjCbW53Odi8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Michael Ellerman , Sasha Levin , Miaoqian Lin Subject: [PATCH 6.0 609/862] powerpc/sysdev/fsl_msi: Add missing of_node_put() Date: Wed, 19 Oct 2022 10:31:36 +0200 Message-Id: <20221019083316.833605350@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747109115405202161?= X-GMAIL-MSGID: =?utf-8?q?1747109115405202161?= From: Liang He [ Upstream commit def435c04ee984a5f9ed2711b2bfe946936c6a21 ] In fsl_setup_msi_irqs(), use of_node_put() to drop the reference returned by of_parse_phandle(). Fixes: 895d603f945ba ("powerpc/fsl_msi: add support for the fsl, msi property in PCI nodes") Co-authored-by: Miaoqian Lin Signed-off-by: Liang He Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220704145233.278539-1-windhl@126.com Signed-off-by: Sasha Levin --- arch/powerpc/sysdev/fsl_msi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c index ef9a5999fa93..73c2d70706c0 100644 --- a/arch/powerpc/sysdev/fsl_msi.c +++ b/arch/powerpc/sysdev/fsl_msi.c @@ -209,8 +209,10 @@ static int fsl_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) dev_err(&pdev->dev, "node %pOF has an invalid fsl,msi phandle %u\n", hose->dn, np->phandle); + of_node_put(np); return -EINVAL; } + of_node_put(np); } msi_for_each_desc(entry, &pdev->dev, MSI_DESC_NOTASSOCIATED) { From patchwork Wed Oct 19 08: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: 5356 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp297687wrs; Wed, 19 Oct 2022 05:29:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5HU9Gdi4tAitEtSt5Yykk6J1ruz5/eD0RCC4Dabugr380cienZDv1hioxbGGLaC43e4fNA X-Received: by 2002:a17:907:918e:b0:78d:b87e:7051 with SMTP id bp14-20020a170907918e00b0078db87e7051mr6619308ejb.227.1666182555859; Wed, 19 Oct 2022 05:29:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666182555; cv=none; d=google.com; s=arc-20160816; b=lVp9uns3bdQcEzQXQq4yD2fKXIDewziYorMO+J06QAR3rlO88LC8DcIof35uTAR69F 9FmKf/uBgnnc+W5dw2MQqWOHqcIMHaEbJxnlXllTbfp9J6R05N8xlpAO5aOTERGB4wZS C2TNwmp2DgoX0P/OFGFjckK5UzIcYjnArvaRTbqqxJKXZagSCVvBardnjZC+TPuJk9/Z bcGw9Iy5a/4o67segRjjpbau7IBwI/0iKc0FSfxLPjNCEccl9m2iJLm3JlVQX/Yke5Ai loiaYus+3XcukbkVfs7fyLGt090haA8K+DVBv854YxLEnNsIDeXREWWTdz8Brx2fjoKi QRjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wovkUgnPvx6sGLMQsrZdbl1gcKjaz76O5JZJuZhYsfk=; b=ObILVo8jg59UpqtKkzAbDD1U/DHMuIDFpfaY9h7me+ywQHwTZ+ky5KfjujcL4qFNdq 0779l+I893rj+IPNVGpyu6E+iZX9BEwzdu88H6hidETXUdbrkN7hGSn9fklvYSIpy1WI q8nZh1Rtjus1We3JNkSbFXK2fDI4dVHp+WrOBdzPEpx+SYxvu58ihHh1kC2sw2w5PKHM jFVDX/rakWKczQztOKZ8epVd0GrOrWIF5As4zzkOOWnhsoC+gTMo/tM2UKi5wn8On2RT YLS5LCFY6mv990A/YsCIm8dsZxMa3NTpYOgQW9uSlpBTVDWsNpjvN4flPDhjICCKmxXH fQQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0TxidLNK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p2-20020a170906784200b0078d202b7a3bsi12191299ejm.421.2022.10.19.05.28.49; Wed, 19 Oct 2022 05:29: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=0TxidLNK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232697AbiJSMTQ (ORCPT + 99 others); Wed, 19 Oct 2022 08:19:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232965AbiJSMSS (ORCPT ); Wed, 19 Oct 2022 08:18: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 08F4BD994B; Wed, 19 Oct 2022 04:54:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CADA661830; Wed, 19 Oct 2022 09:05:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7A82C433D6; Wed, 19 Oct 2022 09:05:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170317; bh=SI7plIqdRlLsHgnZt/jOcTT/x5bXkEhsGCXsGVX6uJo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0TxidLNKRUkBWIP+gUPsM/A+d8lk6OAP38BU/8ZhuFoSg6KRajRZo4mJVKnr4BdFP Ce5o7yOUpJa+of4nBX3YtncECBibcLMAiHnOKE2nA6FdGfaCwtdQDsZl9kbyoqiXdP M1JuyBzOJFocWVjjsGSdBHnz2UVF+f3IKmmkpfHE= 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 6.0 610/862] powerpc/pci_dn: Add missing of_node_put() Date: Wed, 19 Oct 2022 10:31:37 +0200 Message-Id: <20221019083316.883193225@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747119039784529085?= X-GMAIL-MSGID: =?utf-8?q?1747119039784529085?= 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 7a35fc25a304..38561d6a2079 100644 --- a/arch/powerpc/kernel/pci_dn.c +++ b/arch/powerpc/kernel/pci_dn.c @@ -330,6 +330,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 Wed Oct 19 08: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: 5513 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp336756wrs; Wed, 19 Oct 2022 06:47:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6BJXqHag+/k5cYGWF3KWqRdVsasCTgDBwSMYQrRFc9aadEIl62/d8Y1dAvz6zFshrbMI/6 X-Received: by 2002:a63:8243:0:b0:463:10d9:f150 with SMTP id w64-20020a638243000000b0046310d9f150mr7199535pgd.242.1666187262624; Wed, 19 Oct 2022 06:47:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666187262; cv=none; d=google.com; s=arc-20160816; b=qFFdwxRtHBqD3CybOj98ASKIfMiUH+iFy10Ur6WultUfpifQgOihLDReJkQmrsEmVF saD0bzdBCciZ54Y47eTfDzPTXojPd2cSevBTPRJsHpVHjVArG5TQLeI3azZoqoxxqiOx beiTAsjvYJUdTy5r7Yi7ol4y5BBtp9yJ00B1zJI2beT5Giaa9IuFITJ3yrirAHN/cOaW jIAUz9OOgA/1PmYThECJf9wM5XJwUGwunJX04yvvroVzwqz2lKam8vxc/neJbLUlLxiI Uk4pHvZd+aukKIeL8j/qOobmD2Ie6zRiriK12o4EGndRDtGHRqzhhjkO7ZXmnSr5JFN4 hRGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1GMx6OuFidB3j1RSaOH1gvLOJiKUKowCpwylL/pAduQ=; b=Pc8WGd+GVorbIbwltJhfFLw7lZ315KJIzaN3YErBcsTJSSR2wy7naXgOXgVyPVnRjA oy/92vEnlJd9+8R+6xkeW9fQzezjQ4xoIipYKX3HYSKNdkkoAlCIGuZEz5CmzAw3xF9s xtMcNO11/Wbhb1OhiQB06FKX+Td0/NJuBEGbsiMxx4u67x389VEXOrqZfrSizPeT5XCx 2SRBx21uS75eDXbSjCFVCALE5lJBtrRz1HUF3GIRUObTNppVQsn4c+E12FCSxQBk7FSQ BrAAw5uYiB/v+BvY4BwtxlqydViOPeQU/a7zLlD1nhVTQAfakwMoK7G6Xml/G8Zz2t2R Mp6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="kp/o175m"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o131-20020a62cd89000000b00565fc1c01c4si18944297pfg.311.2022.10.19.06.47.28; Wed, 19 Oct 2022 06:47: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="kp/o175m"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233477AbiJSNrK (ORCPT + 99 others); Wed, 19 Oct 2022 09:47:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233251AbiJSNqF (ORCPT ); Wed, 19 Oct 2022 09:46:05 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2112A12FF98; Wed, 19 Oct 2022 06:32:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 63A77CE2173; Wed, 19 Oct 2022 09:05:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69B73C43470; Wed, 19 Oct 2022 09:05:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170319; bh=MzqN5J3LzkgF+sMfK6atxZHurz4IuMxAyc9YhNaRH90=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kp/o175mQ3a1t0UAuuUgZZkHlr9IjmwQslCc+5Pe0elQArsIGRJrGkZFsC4p3x7tL cblJBw+XL4/fZevNg8annbjCc+qq7rOgcmBMLVhZcrWbHLbn7grEVtIfSiLtH41tc8 m6weL3uB6erqdMX2P+2IiYq7x6UV41Qn5wkKXNgc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheng Yongjun , Michael Ellerman , Sasha Levin Subject: [PATCH 6.0 611/862] powerpc/powernv: add missing of_node_put() in opal_export_attrs() Date: Wed, 19 Oct 2022 10:31:38 +0200 Message-Id: <20221019083316.921392634@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123975349376626?= X-GMAIL-MSGID: =?utf-8?q?1747123975349376626?= From: Zheng Yongjun [ Upstream commit 71a92e99c47900cc164620948b3863382cec4f1a ] After using 'np' returned by of_find_node_by_path(), of_node_put() need be called to decrease the refcount. Fixes: 11fe909d2362 ("powerpc/powernv: Add OPAL exports attributes to sysfs") Signed-off-by: Zheng Yongjun Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220906141703.118192-1-zhengyongjun3@huawei.com Signed-off-by: Sasha Levin --- arch/powerpc/platforms/powernv/opal.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c index 55a8fbfdb5b2..3510b55b36f8 100644 --- a/arch/powerpc/platforms/powernv/opal.c +++ b/arch/powerpc/platforms/powernv/opal.c @@ -892,6 +892,7 @@ static void opal_export_attrs(void) kobj = kobject_create_and_add("exports", opal_kobj); if (!kobj) { pr_warn("kobject_create_and_add() of exports failed\n"); + of_node_put(np); return; } From patchwork Wed Oct 19 08: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: 4898 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225559wrs; Wed, 19 Oct 2022 02:43:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM776eCQzuriP1xI+lQ5ARuuhTeKUPHAyk8TcnOHmeldNRLAqsuoVhOT+QD/hcC4bZHcwXgy X-Received: by 2002:a17:907:6e9e:b0:78c:5533:4158 with SMTP id sh30-20020a1709076e9e00b0078c55334158mr5682443ejc.417.1666172605134; Wed, 19 Oct 2022 02:43:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172605; cv=none; d=google.com; s=arc-20160816; b=Y4Zx0A+dCKSt9EEzuskZ8K6n8Rhctm+DpQ40cZuYkRTjR0djz3299zY55IBh6t0ooA p+p2YxKxP57oh41nDfrSGtWnYRl89zUUNstkCFYQ1ZpMuJ4wWnKBbHYlwG29CfcraMkt xm5FOy+VVH4B0I0WdfdKIhTcyREUqlAP6shl4Ajx2b7AWWTKXaRNsnl1mCMOLtlS7wKD 1opdvdJLshCto5t6v5L3Mb+xDR1j0o7QUiw+CSgl0cy66uI+NqUrdvOMmSPIqvtefHar HadgE3z8P8X+y4EiTYVb2wFrMiZXuPf/QiybWGcMAmCWQHlgqkZCTJLO+jsOS83qdqQK TZ3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lCPOEWas9BSnd3hB23BnsRFh8TF5DPn/rVecJFzuqas=; b=RjUTtVNT5lu1a03evHwLWf8TeZ1HsEYm5fLoYA/KtGxnHcQPW1DzHk6smh/9rkd3Yk nJfbATqdLrSPZGbp5ap+8+ES3wTLRdBEqykTZvuFWJgaYNelbcaV4hHqVokDOU7TjFKg reh0wh6SlaPpgiRGu7/UNgE4wAkiyvpNJQNeo02nple4BTJ2eLiH8FLsC/Sqf8RXPDcy 6MwLqLUAKmgxrhl+ZgZi23RzxOcXSq6Ti0O9c8XitCug76wO28+omBYqfbgv9zjmvOqW UwbgO5N8Z9WnIkm7pH+ZVMUvYyGVM2ROHvUsmm+yEaDm0aHcycQHqBvoJnkj4eRdjDqT Uc/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=H1rbBvtw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a50cc87000000b00457594320f5si14502457edi.107.2022.10.19.02.42.57; Wed, 19 Oct 2022 02:43: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=H1rbBvtw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234070AbiJSJeg (ORCPT + 99 others); Wed, 19 Oct 2022 05:34:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233802AbiJSJ33 (ORCPT ); Wed, 19 Oct 2022 05:29:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFF1FE5ED7; Wed, 19 Oct 2022 02:12: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 E7C056185A; Wed, 19 Oct 2022 09:05:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0185CC433C1; Wed, 19 Oct 2022 09:05:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170322; bh=5I3kwVes2iD1BRUK93OgLmE9qSZLIgNDQvzyOR7UBEA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H1rbBvtwOReNtTxoVO55E93J5g7Ifh1Fpc2JqHI22c4hEAbFdXxNNTlWTqzQgveHB KdMCGtGaT97ueLh934Iir/eMhZfh1SXVglUkhdAkTmNpr0M0GzcbNZJYwFhSrnzJnk MKsp8OTebeNOZb8aiLnhvQzIP8I86lU8SD9Y+LtA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anup Patel , Andrew Jones , Palmer Dabbelt , Sasha Levin Subject: [PATCH 6.0 612/862] cpuidle: riscv-sbi: Fix CPU_PM_CPU_IDLE_ENTER_xyz() macro usage Date: Wed, 19 Oct 2022 10:31:39 +0200 Message-Id: <20221019083316.963105291@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108605635761398?= X-GMAIL-MSGID: =?utf-8?q?1747108605635761398?= From: Anup Patel [ Upstream commit cfadbb9df8c4dc917787da4458327e5ec14743d4 ] Currently, we are using CPU_PM_CPU_IDLE_ENTER_PARAM() for all SBI HSM suspend types so retentive suspend types are also treated non-retentive and kernel will do redundant additional work for these states. The BIT[31] of SBI HSM suspend types allows us to differentiate between retentive and non-retentive suspend types so we should use this BIT to call appropriate CPU_PM_CPU_IDLE_ENTER_xyz() macro. Fixes: 6abf32f1d9c5 ("cpuidle: Add RISC-V SBI CPU idle driver") Signed-off-by: Anup Patel Link: https://lore.kernel.org/r/20220718084553.2056169-1-apatel@ventanamicro.com/ Reviewed-by: Andrew Jones Signed-off-by: Palmer Dabbelt Signed-off-by: Sasha Levin --- drivers/cpuidle/cpuidle-riscv-sbi.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/cpuidle/cpuidle-riscv-sbi.c b/drivers/cpuidle/cpuidle-riscv-sbi.c index 862a2876f1c9..05fe2902df9a 100644 --- a/drivers/cpuidle/cpuidle-riscv-sbi.c +++ b/drivers/cpuidle/cpuidle-riscv-sbi.c @@ -97,8 +97,13 @@ static int sbi_cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv, int idx) { u32 *states = __this_cpu_read(sbi_cpuidle_data.states); + u32 state = states[idx]; - return CPU_PM_CPU_IDLE_ENTER_PARAM(sbi_suspend, idx, states[idx]); + if (state & SBI_HSM_SUSP_NON_RET_BIT) + return CPU_PM_CPU_IDLE_ENTER_PARAM(sbi_suspend, idx, state); + else + return CPU_PM_CPU_IDLE_ENTER_RETENTION_PARAM(sbi_suspend, + idx, state); } static int __sbi_enter_domain_idle_state(struct cpuidle_device *dev, From patchwork Wed Oct 19 08:31:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5477 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp333041wrs; Wed, 19 Oct 2022 06:40:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7+fC+9iZLIINe2jWp8VzTWHlIAHdtxl7sSuK4oTbM02m/7C2PeNzZy4QTU/WCEH9Ml8vrr X-Received: by 2002:a17:907:a05:b0:77b:b538:6476 with SMTP id bb5-20020a1709070a0500b0077bb5386476mr6958101ejc.324.1666186806947; Wed, 19 Oct 2022 06:40:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666186806; cv=none; d=google.com; s=arc-20160816; b=ovzyl0jF8L4DWEy/c6w4U+vsURUYA/Dg/qo5oAIYolcia/ozf8acrPdJRDKz0vsbw2 jCueNhYJbab7cQK9xQBMaoUfQFb9n9w0ogtoMS8337iLzQTqRXwsuNUp5rv+9qeb9cCQ 9TABzRh3/Ff+Fxfu/7EJckJ4Po21cpyCjocMXQmdY8J9SuzqIJuirrOb+j8e7Xb0RmNp 5n1yZhgSXfPMhw9ebsdkxME4C9K/zU+1MRjX7Z944Zyne9UooNOmGWbA2r+gSVp4Ms0X ByMfPlt44Dys4ICMauwI05EsvnRuF+GSbD21t6ZVHMut3rfMZ3kC2PSmLlosvDJZctie Ir7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=G2WHTzLtP7gg2XY0Hgi1BfqURevE6DX7kMtC8TOueqU=; b=c8jAECnW+y8weZ4u2PuG+sQ+gGmvMvJ/9/gWS3+osw0haOmei9VX/roPgW9r2sxv1Z f5/rsjEltp2cRPdjX1JdbKtLeiuBFGD+WRHD5186m+l8FDAakqPNEJLM6d/dyQPGBatS +3ppF21tZQzyZKiclhCQ9nVc752kqC7/D5q9ZjP7tXITQfcWJNSlBZmx72zkG7yGP0lr maIyES1dj2CE8NgX5rbuHxAFgzCMm7zgN9vRlM+P9xk7Gte6KAq9Mc3v5S42Z+Obr+Tl lnWn0hOyrLyvhXOcSwxPzGlTsXtje+mLa5IXZRypkdB1OLb87qkPhSA+XEiGCIb39beN ZC/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=udaDnnP7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z88-20020a509e61000000b00459dc4e4b7fsi13109571ede.143.2022.10.19.06.39.41; Wed, 19 Oct 2022 06:40: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=udaDnnP7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231697AbiJSNhA (ORCPT + 99 others); Wed, 19 Oct 2022 09:37:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230302AbiJSNgQ (ORCPT ); Wed, 19 Oct 2022 09:36:16 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB03814EC46; Wed, 19 Oct 2022 06:25: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 ams.source.kernel.org (Postfix) with ESMTPS id 15ABFB82476; Wed, 19 Oct 2022 09:05:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89808C433C1; Wed, 19 Oct 2022 09:05:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170324; bh=Wx81bFGklbMM4d2EYeslYJlmfJiZ5tfrj5cy7G8MD9w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=udaDnnP7Flgmq58VqJjHq6hIfyjvUMVy1P0RKRZ8uOzmzZwSJ3CV0Hw4uBf4AI7YY 829ZyPQ7AhePSBOcWMuDewDDSAzIK9/OkQHOD3uZQwy9QvI7dtzZoIODMtY6P1x3vn x7PHnZcDHkjHfi4KiEHW6uWRAWV0YnG+WRlsd+U0= 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 6.0 613/862] powerpc: dts: turris1x.dts: Fix NOR partitions labels Date: Wed, 19 Oct 2022 10:31:40 +0200 Message-Id: <20221019083317.008903237@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123497609096769?= X-GMAIL-MSGID: =?utf-8?q?1747123497609096769?= From: Pali Rohár [ Upstream commit c9986f0aefd1ae22fe9cf794d49699643f1e268b ] Partition partition@20000 contains generic kernel image and it does not have to be used only for rescue purposes. Partition partition@1c0000 contains bootable rescue system and partition partition@340000 contains factory image/data for restoring to NAND. So change partition labels to better fit their purpose by removing possible misleading substring "rootfs" from these labels. Fixes: 54c15ec3b738 ("powerpc: dts: Add DTS file for CZ.NIC Turris 1.x routers") Signed-off-by: Pali Rohár Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220830225500.8856-1-pali@kernel.org Signed-off-by: Sasha Levin --- arch/powerpc/boot/dts/turris1x.dts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/boot/dts/turris1x.dts b/arch/powerpc/boot/dts/turris1x.dts index 12e08271e61f..47027b4cebb3 100644 --- a/arch/powerpc/boot/dts/turris1x.dts +++ b/arch/powerpc/boot/dts/turris1x.dts @@ -263,21 +263,21 @@ }; partition@20000 { - /* 1.7 MB for Rescue Linux Kernel Image */ + /* 1.7 MB for Linux Kernel Image */ reg = <0x00020000 0x001a0000>; - label = "rescue-kernel"; + label = "kernel"; }; partition@1c0000 { /* 1.5 MB for Rescue JFFS2 Root File System */ reg = <0x001c0000 0x00180000>; - label = "rescue-rootfs"; + label = "rescue"; }; partition@340000 { - /* 11 MB for TAR.XZ Backup with content of NAND Root File System */ + /* 11 MB for TAR.XZ Archive with Factory content of NAND Root File System */ reg = <0x00340000 0x00b00000>; - label = "backup-rootfs"; + label = "factory"; }; partition@e40000 { From patchwork Wed Oct 19 08:31:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4853 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223866wrs; Wed, 19 Oct 2022 02:38:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5+EtS/c6KUiDdg6Ud6/V8joYJSMDCaQIgsLcr3FWepi2BaU1x07G5FAgLr5BYhXHWloaKs X-Received: by 2002:a17:90b:3b45:b0:20c:2eae:e70 with SMTP id ot5-20020a17090b3b4500b0020c2eae0e70mr8772620pjb.240.1666172323596; Wed, 19 Oct 2022 02:38:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172323; cv=none; d=google.com; s=arc-20160816; b=t7TEbvHzbHJzfcOrtpB6LaTSUuezvTig68jSIhXGeLqgbBhIxEd4X7rtSu0n9KPJad MqelFXAvaFvA3lOf7jkCajWXadWCINmOk/QrGHqTDkfkdxmm9YM8ZyFlPCwfjPS3TmRg WFvwxY4p51TMdf6FU7J55KQF7ZgvadU3J5RX/Lx0YHcNFuxgkllrHY2M+q44hL0O7A0a Rkif6rUSwkkHjWB4XRxskvw/gH+fu7YRVpOkXq48qHAgdyzItPA9xH3ahJ8FtNjeK1F+ RUb9id5Z3zdMlRB3Aj4AyU4oGHWFhs5x8s8ZKPqAmJXBbAL4crEdZw9mV/OpXxeQNWSQ C8ZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JWPVaK8yGc8zVy+Bg+4iLqTxcvkGObFxw8ebQk4wH3M=; b=Qhp4ma8XJYhRIUxwRGbjHSDBhLNdKliyYpPOLXaPe04vZQDNPoCg2e+o6rLtnDUNBT +JOIWMKRISxvp7y7L5SAmq2WgcjRF859/wDZlRQePogF8omz8Io9ym8lpe5H8JAueE8i E/PSWHVb6BnmfLWTGFKZ3sXKrZMJqK6YRvei7tO4P2doZCnJakBPFQAu/aVT7U1MU2rc b5N1d4f/Pyz+TDmokZAE3Wj3nUZeWsNYpnWSTSVfhV51QeMEYU8QJn6M4oSzhQyUot2C wx7Jt1iB2hdrs5ia/DOiGa/dbTSgbKFKLruTnBnU9gcNzxww9s3rjEOYvPft12MDjS1k /VJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zhE0g4re; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cw15-20020a056a00450f00b00567719e34aesi1967167pfb.49.2022.10.19.02.38.31; Wed, 19 Oct 2022 02:38: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=zhE0g4re; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233412AbiJSJWO (ORCPT + 99 others); Wed, 19 Oct 2022 05:22:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233312AbiJSJUb (ORCPT ); Wed, 19 Oct 2022 05:20:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AACF01A39C; Wed, 19 Oct 2022 02:09: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 1A25A61840; Wed, 19 Oct 2022 09:05:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3044BC433D7; Wed, 19 Oct 2022 09:05:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170327; bh=2SjkYBbMahUyEZ8l3HQc8s3wgTMQACh2AITrVhmAKIQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zhE0g4rex5B121wUNxxczWI5aXtPfmIqGjbokglSXlmiLWLbRAJvmxreT9U1/7hff jHdmtCFfY3gGmKMyhZSxPxqpNSJZQipCjc3/M3pO8FH38V7MlhWyfydkRV0+0DC/q+ +If2mzJx5ynzB4kQf4rxDBvdKMSJyvm25hy6Zwjo= 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 6.0 614/862] powerpc: dts: turris1x.dts: Fix labels in DSA cpu port nodes Date: Wed, 19 Oct 2022 10:31:41 +0200 Message-Id: <20221019083317.059255466@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108310581783527?= X-GMAIL-MSGID: =?utf-8?q?1747108310581783527?= From: Pali Rohár [ Upstream commit 8bf056f57f1d16c561e43f9af37301f23990cd21 ] DSA cpu port node has to be marked with "cpu" label. So fix it for both cpu port nodes. Fixes: 54c15ec3b738 ("powerpc: dts: Add DTS file for CZ.NIC Turris 1.x routers") Signed-off-by: Pali Rohár Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220827131538.14577-1-pali@kernel.org Signed-off-by: Sasha Levin --- arch/powerpc/boot/dts/turris1x.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/boot/dts/turris1x.dts b/arch/powerpc/boot/dts/turris1x.dts index 47027b4cebb3..045af668e928 100644 --- a/arch/powerpc/boot/dts/turris1x.dts +++ b/arch/powerpc/boot/dts/turris1x.dts @@ -147,7 +147,7 @@ port@0 { reg = <0>; - label = "cpu1"; + label = "cpu"; ethernet = <&enet1>; phy-mode = "rgmii-id"; @@ -184,7 +184,7 @@ port@6 { reg = <6>; - label = "cpu0"; + label = "cpu"; ethernet = <&enet0>; phy-mode = "rgmii-id"; From patchwork Wed Oct 19 08: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: 5479 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp333194wrs; Wed, 19 Oct 2022 06:40:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4/aCewa5D+Puw3asvLh3MGvMAdVWFvd9G7bCoogibWRwGyxZyATkki1QF44UpzUfoo990C X-Received: by 2002:a17:907:3206:b0:780:a882:a9ac with SMTP id xg6-20020a170907320600b00780a882a9acmr6644641ejb.765.1666186825827; Wed, 19 Oct 2022 06:40:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666186825; cv=none; d=google.com; s=arc-20160816; b=LKyHo7duzrXAFNGzcE94A6199qZNroRPLhmckS+gBeB1GpgO42jQu86KHXYfpUehKe 9Mq9nk5OKpJdwQujBIg3p5bIyCYDYlARwPqEHZyO2aJ86E2bAuArnq9C83jRBoNaROno U8Kjl2Jl9tw7yVqaYrwXD7Ap22JQM2WfZA12gSWlB+KodnI5yirnNPIHZUlt3zMytu4R R7PWfNg6tg66Vw959AUzz5xo8qvw+o721m6cYeE/i/ArMMZ8/O1vWugdnYCyezKmVZCJ 35vYlCFrYvbqJ1C9G4gWNwUMTK4ycqosUbzB7DlSImowVEP142SNTKQYtaLNQiqTpoZo AWeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qp55gMiZm6q14YK0ixU2VQwhkvmz2OwXf0ZTkmZZ4jA=; b=dvGYaiKYD+yPgHBETdS6YuQYKxXk98Bd2u80pGyaNiPZsXIuIyalUsWVLcDDU4EaMr kOnBwQ915IZs7ts+jM6FyZnREXBeGaRYml2kUUWUGPYb1qMbndm6UyeIuBgRTzDaDZ3K zavbjJE8JkaGC/MG16SiCDcLvJkwKc7PqfOf7oVGQ1XnB66qPPKJcupImVNPf3Go56Md kAkydB/3/XKtvlwYIx6WUlw4IwIjTKi7CCAN0wAjwlC+b65zH3NUx280I4eZwEFjrKKw Thiy/s5z4rWMJi6EbsL7xKNSITSryj6DquCAsJxcKJseuqA81wt18NS0ZqUpzirjHDJM xKug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jTiKQq4c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qw22-20020a1709066a1600b0073d91a38b35si14434586ejc.789.2022.10.19.06.39.57; Wed, 19 Oct 2022 06:40: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=jTiKQq4c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231996AbiJSNhL (ORCPT + 99 others); Wed, 19 Oct 2022 09:37:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230187AbiJSNgU (ORCPT ); Wed, 19 Oct 2022 09:36: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 0D453167251; Wed, 19 Oct 2022 06:25:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6D6CFB8247D; Wed, 19 Oct 2022 09:05:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C404DC4347C; Wed, 19 Oct 2022 09:05:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170330; bh=gjDljZl/wvRQcLjS5e2kmaL29MSYEY38YuRzoP9nEaE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jTiKQq4cAzSTKayBKU/8755HWQQyYkN/oNrq2DFBNgQglPeVCI9a5cY7130s4XkWw bOUzKwaPJB49Ei0cgLS+VShOw1VrjXOeTXrb9p4XRQX31ZFesF9EJti5jFVyHmLMYG DoT01Ix8JQBtJJQ8GkW3Ic/mLb89rs6feuN/J0sk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Rohan McLure , Nicholas Piggin , Michael Ellerman , Sasha Levin Subject: [PATCH 6.0 615/862] powerpc: Fix fallocate and fadvise64_64 compat parameter combination Date: Wed, 19 Oct 2022 10:31:42 +0200 Message-Id: <20221019083317.105704974@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123516993767923?= X-GMAIL-MSGID: =?utf-8?q?1747123516993767923?= From: Rohan McLure [ Upstream commit 016ff72bd2090903715c0f9422a44afbb966f4ee ] As reported[1] by Arnd, the arch-specific fadvise64_64 and fallocate compatibility handlers assume parameters are passed with 32-bit big-endian ABI. This affects the assignment of odd-even parameter pairs to the high or low words of a 64-bit syscall parameter. Fix fadvise64_64 fallocate compat handlers to correctly swap upper/lower 32 bits conditioned on endianness. A future patch will replace the arch-specific compat fallocate with an asm-generic implementation. This patch is intended for ease of back-port. [1]: https://lore.kernel.org/all/be29926f-226e-48dc-871a-e29a54e80583@www.fastmail.com/ Fixes: 57f48b4b74e7 ("powerpc/compat_sys: swap hi/lo parts of 64-bit syscall args in LE mode") Reported-by: Arnd Bergmann Signed-off-by: Rohan McLure Reviewed-by: Arnd Bergmann Reviewed-by: Nicholas Piggin Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220921065605.1051927-9-rmclure@linux.ibm.com Signed-off-by: Sasha Levin --- arch/powerpc/include/asm/syscalls.h | 12 ++++++++++++ arch/powerpc/kernel/sys_ppc32.c | 14 +------------- arch/powerpc/kernel/syscalls.c | 4 ++-- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/arch/powerpc/include/asm/syscalls.h b/arch/powerpc/include/asm/syscalls.h index a2b13e55254f..da40219b303a 100644 --- a/arch/powerpc/include/asm/syscalls.h +++ b/arch/powerpc/include/asm/syscalls.h @@ -8,6 +8,18 @@ #include #include +/* + * long long munging: + * The 32 bit ABI passes long longs in an odd even register pair. + * High and low parts are swapped depending on endian mode, + * so define a macro (similar to mips linux32) to handle that. + */ +#ifdef __LITTLE_ENDIAN__ +#define merge_64(low, high) (((u64)high << 32) | low) +#else +#define merge_64(high, low) (((u64)high << 32) | low) +#endif + struct rtas_args; asmlinkage long sys_mmap(unsigned long addr, size_t len, diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/sys_ppc32.c index 16ff0399a257..719bfc6d1e3f 100644 --- a/arch/powerpc/kernel/sys_ppc32.c +++ b/arch/powerpc/kernel/sys_ppc32.c @@ -56,18 +56,6 @@ unsigned long compat_sys_mmap2(unsigned long addr, size_t len, return sys_mmap(addr, len, prot, flags, fd, pgoff << 12); } -/* - * long long munging: - * The 32 bit ABI passes long longs in an odd even register pair. - * High and low parts are swapped depending on endian mode, - * so define a macro (similar to mips linux32) to handle that. - */ -#ifdef __LITTLE_ENDIAN__ -#define merge_64(low, high) ((u64)high << 32) | low -#else -#define merge_64(high, low) ((u64)high << 32) | low -#endif - compat_ssize_t compat_sys_pread64(unsigned int fd, char __user *ubuf, compat_size_t count, u32 reg6, u32 pos1, u32 pos2) { @@ -94,7 +82,7 @@ asmlinkage int compat_sys_truncate64(const char __user * path, u32 reg4, asmlinkage long compat_sys_fallocate(int fd, int mode, u32 offset1, u32 offset2, u32 len1, u32 len2) { - return ksys_fallocate(fd, mode, ((loff_t)offset1 << 32) | offset2, + return ksys_fallocate(fd, mode, merge_64(offset1, offset2), merge_64(len1, len2)); } diff --git a/arch/powerpc/kernel/syscalls.c b/arch/powerpc/kernel/syscalls.c index fc999140bc27..abc3fbb3c490 100644 --- a/arch/powerpc/kernel/syscalls.c +++ b/arch/powerpc/kernel/syscalls.c @@ -98,8 +98,8 @@ long ppc64_personality(unsigned long personality) long ppc_fadvise64_64(int fd, int advice, u32 offset_high, u32 offset_low, u32 len_high, u32 len_low) { - return ksys_fadvise64_64(fd, (u64)offset_high << 32 | offset_low, - (u64)len_high << 32 | len_low, advice); + return ksys_fadvise64_64(fd, merge_64(offset_high, offset_low), + merge_64(len_high, len_low), advice); } SYSCALL_DEFINE0(switch_endian) From patchwork Wed Oct 19 08: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: 4894 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225523wrs; Wed, 19 Oct 2022 02:43:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM75fC447bAPZSBthGrDWmrkqZubCb4Ovq8XkpOOmkNik2/nWFvbz0c3/3bCfSmKhOSSTbNe X-Received: by 2002:a05:6402:191:b0:45c:83e8:d74a with SMTP id r17-20020a056402019100b0045c83e8d74amr6306063edv.329.1666172601021; Wed, 19 Oct 2022 02:43:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172601; cv=none; d=google.com; s=arc-20160816; b=bm876WCNUV/dd6YrGGBAGvJhknZbdwgTd76u6vrnpDpWSujic+5EPJaHfuF9DVS+gN QKwjQx5hQApLvxitLS6/Y32HKDIqYENHN/LHLPZjij9wWXsypMs89xmBCQgla+S5Krts tn8MeJvqbroQCzjrOLv/YMg9vZ4r7UmEuIqHIxQEEQxOrqHDUFNN7SlnK1+3dFWboFco EUXyENGvvGg96FoJZCHHuuXclNlOuZbBbf4S77OpdHdKufZIlw+18amemOY8EWuU5p8x XKSlrJMvOv4WU3ny2o4I5izWXiB0uNRdUZTHrnYmgDqcf0+n02mryr2g44/fwkKgQ5s+ 85Ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=joEPKpTa+uxNk9vVTRrWEAoMQ3DGHGrnvbhFNDD5Bro=; b=o5SK+de9M5ekxCExf10EvcOp6MwNmGDCniEdUpYQaHNACQvoBi50gj2Ch7Yr7kGcyb dVHQ7T29KEd1scKi9x+8gC7z2/4twdn/kHlxn4sHpJnBV2xA5pATJl0zvClI5WIYCHX2 l/618WgG3Ok3fH3hQXgRNHQdgPvegMVP6zXu00ZnuTO/hH7aR9TNsmkrp134nLIHPS7Q 7UPi2z6BRpdCR3G7zIv80kCEMMUKy3Ear0u9Sv79vuyk3uqtphE47H0OblEPLTLkAr8P N7V0HdDkDXf1dxbBr81T85ay09VJvK8x8Oy3qXT5F6E9HxTvqRwzBPmKKEFXwLZBmtkJ AVMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wMrd4LaI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t5-20020a056402524500b00459fb0c1d9esi12973985edd.549.2022.10.19.02.42.55; Wed, 19 Oct 2022 02:43:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wMrd4LaI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233964AbiJSJeO (ORCPT + 99 others); Wed, 19 Oct 2022 05:34:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233774AbiJSJ3Y (ORCPT ); Wed, 19 Oct 2022 05:29:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0299C3564; Wed, 19 Oct 2022 02:13: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 537A3617EC; Wed, 19 Oct 2022 09:05:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67734C433D6; Wed, 19 Oct 2022 09:05:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170332; bh=P6mrvCB9xhdjNaQd5esO9PzJUs/Txx/H4cT1nbvnes4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wMrd4LaIv0Xy4LTwPLTDFIXoxWa01ARrGNMUxvk5z26RUSHiuewy4rtkAxI5eTO5G oTqvjCOCORaYqrZ9GpZSqzf1hSmnRamoTjvaHOa4SsgtwjhIF5EdZdtzZySYAoZa3+ EOcn2JEf+0KD6/wFxPp5KVLuS5HJ2doJ3PIMfrY4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxim Levitsky , Michael Kelley , Vitaly Kuznetsov , Sean Christopherson , Paolo Bonzini , Sasha Levin Subject: [PATCH 6.0 616/862] x86/hyperv: Fix struct hv_enlightened_vmcs definition Date: Wed, 19 Oct 2022 10:31:43 +0200 Message-Id: <20221019083317.154179867@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108601279519190?= X-GMAIL-MSGID: =?utf-8?q?1747108601279519190?= From: Vitaly Kuznetsov [ Upstream commit ea9da788a61e47e7ab9cbad397453e51cd82ac0d ] Section 1.9 of TLFS v6.0b says: "All structures are padded in such a way that fields are aligned naturally (that is, an 8-byte field is aligned to an offset of 8 bytes and so on)". 'struct enlightened_vmcs' has a glitch: ... struct { u32 nested_flush_hypercall:1; /* 836: 0 4 */ u32 msr_bitmap:1; /* 836: 1 4 */ u32 reserved:30; /* 836: 2 4 */ } hv_enlightenments_control; /* 836 4 */ u32 hv_vp_id; /* 840 4 */ u64 hv_vm_id; /* 844 8 */ u64 partition_assist_page; /* 852 8 */ ... And the observed values in 'partition_assist_page' make no sense at all. Fix the layout by padding the structure properly. Fixes: 68d1eb72ee99 ("x86/hyper-v: define struct hv_enlightened_vmcs and clean field bits") Reviewed-by: Maxim Levitsky Reviewed-by: Michael Kelley Signed-off-by: Vitaly Kuznetsov Signed-off-by: Sean Christopherson Link: https://lore.kernel.org/r/20220830133737.1539624-2-vkuznets@redhat.com Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin --- arch/x86/include/asm/hyperv-tlfs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/hyperv-tlfs.h b/arch/x86/include/asm/hyperv-tlfs.h index 0a9407dc0859..6f0acc45e67a 100644 --- a/arch/x86/include/asm/hyperv-tlfs.h +++ b/arch/x86/include/asm/hyperv-tlfs.h @@ -546,7 +546,7 @@ struct hv_enlightened_vmcs { u64 guest_rip; u32 hv_clean_fields; - u32 hv_padding_32; + u32 padding32_1; u32 hv_synthetic_controls; struct { u32 nested_flush_hypercall:1; @@ -554,7 +554,7 @@ struct hv_enlightened_vmcs { u32 reserved:30; } __packed hv_enlightenments_control; u32 hv_vp_id; - + u32 padding32_2; u64 hv_vm_id; u64 partition_assist_page; u64 padding64_4[4]; From patchwork Wed Oct 19 08: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: 5505 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp336391wrs; Wed, 19 Oct 2022 06:46:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4fAorQANwLfAPMdVzPAL/a2kcO5P7ZhJPlPGRIP8R51HRGb6CZDtBjo/hX8+oGQnlgRRZE X-Received: by 2002:a17:903:234c:b0:17f:a253:b538 with SMTP id c12-20020a170903234c00b0017fa253b538mr8688512plh.110.1666187218431; Wed, 19 Oct 2022 06:46:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666187218; cv=none; d=google.com; s=arc-20160816; b=NUGA4ZTTGCpeVfmWVrP9PvBmKJCvKny8nimCYBOPbD9Jod8CphlizmURx0giWEKO9f 1F1Z3WjtdSw889naRND1xBHSdGObxxVeYcZGMk7RCmxaxWh3chJ4E64yAUs9c+FBfHMj AjKJlCMXhLar6yehQawf9OU1fzmNeB8pz7+i2chzHfb4wyJqC98mao0JaUQTRW18+nJw Pa3ggTHPiDU51hsSO4tQXUs2MShHgcst0YlUxBo6cUtzyntW1mSEKqTvW2ti1qoju5Ji ewt5Iy9eT4EhxjpFYuC3zBDual66jexMdy+z4xQ9gBPCRwlwjPdS3JLxlJcqZZqKJQ+u 0aJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=p6mkAPcO2lZb6OMw3n2avklTg9yfGTadgPSGUQ8EQAk=; b=yaX8WAWdH3AoQGs+jCcWSOWQxNanXfRa5gkRJY2UKDLkU/zvyrLIcE2lYLS1B8dkI8 ytP1mSJ6+qmmv8XB7FFPZROi7jxdG0AHBWTByKFVNWEzbuOPj/Mtf6XAvw+kdmN7ezrW ANML7e7vGxo663UJrU18/LOdNrkG9TzVMsKZ8jwkb8XRQiAn5VEDB4qIPI+i/VPecWHG rEJpOc5XWiCgmocl+9FptoROCVh751gR4ft1PbOkbrHbyqfpCAY84RumL2lHOc/j9MS1 IbAgkPb4ryja082BS2owvrh9g+92mn57y19YftWh4lqC4Szh13j2+6f5M2feMs+17bGF 4d3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BWzZ0o+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 m23-20020a634c57000000b00461399560e5si18723461pgl.524.2022.10.19.06.46.45; Wed, 19 Oct 2022 06:46: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=BWzZ0o+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 S233348AbiJSNqW (ORCPT + 99 others); Wed, 19 Oct 2022 09:46:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233040AbiJSNp2 (ORCPT ); Wed, 19 Oct 2022 09:45:28 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBDD01BBEE6; Wed, 19 Oct 2022 06:31: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 049F1CE1FD0; Wed, 19 Oct 2022 09:05:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F27C0C433C1; Wed, 19 Oct 2022 09:05:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170335; bh=LmAibi8tOQgHA1R+pSqYNOLnDaLHPsErLVlZKmy2KTg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BWzZ0o+g+8ua4pHQkY7v0yxa1pKTWIlh2wcz3zDSLHPMJXOjBR+XSJI1cGfxhXsLx WHJvzVHImWXvNsllmvKuiwIERFLcRiSrOZnXEz3ekq0ALeX0KtQoD/csmVlqeav6EX XYy9pPzl62Ektv/GT3fO+Denhr7Cwmru5lD7hrl4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicholas Piggin , Segher Boessenkool , Michael Ellerman , Sasha Levin Subject: [PATCH 6.0 617/862] powerpc/64s: Fix GENERIC_CPU build flags for PPC970 / G5 Date: Wed, 19 Oct 2022 10:31:44 +0200 Message-Id: <20221019083317.203428361@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123928589219020?= X-GMAIL-MSGID: =?utf-8?q?1747123928589219020?= From: Nicholas Piggin [ Upstream commit 58ec7f06b74e0d6e76c4110afce367c8b5f0837d ] Big-endian GENERIC_CPU supports 970, but builds with -mcpu=power5. POWER5 is ISA v2.02 whereas 970 is v2.01 plus Altivec. 2.02 added the popcntb instruction which a compiler might use. Use -mcpu=power4. Fixes: 471d7ff8b51b ("powerpc/64s: Remove POWER4 support") Signed-off-by: Nicholas Piggin Reviewed-by: Segher Boessenkool Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220921014103.587954-1-npiggin@gmail.com Signed-off-by: Sasha Levin --- arch/powerpc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile index 02742facf895..140a5e6471fe 100644 --- a/arch/powerpc/Makefile +++ b/arch/powerpc/Makefile @@ -152,7 +152,7 @@ CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=power8 CFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=power9,-mtune=power8) else CFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=power7,$(call cc-option,-mtune=power5)) -CFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mcpu=power5,-mcpu=power4) +CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=power4 endif else ifdef CONFIG_PPC_BOOK3E_64 CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=powerpc64 From patchwork Wed Oct 19 08: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: 5478 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp333123wrs; Wed, 19 Oct 2022 06:40:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM52/5GIrr6B6eDvolkB3xt2V6yY7hrZ2HRtY9sB7H0YrXYKjz1vuP+KLoVEQ1xK8S3B779M X-Received: by 2002:a05:6402:3705:b0:454:e006:82 with SMTP id ek5-20020a056402370500b00454e0060082mr7572723edb.360.1666186816129; Wed, 19 Oct 2022 06:40:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666186816; cv=none; d=google.com; s=arc-20160816; b=kLSW1YznlQ59WEi7awF8AkrVrAcKijFQgXPPwaD3UEPHmNzwsa3N2fSSgVkxXhcWIg eqpWcu63Z+EmROCIIAx7SJJw5tpLHfc8W5ReJTK0A2uTfr12SJ3O5tQ55BjIRVV+TByo kTQw6Y3ko1BVgNRJl65hjCPj7WaLX4BBGQVkCU61a+8YaaqYV4mKRecb8qt94B2RUhbB c69PjtF0Vt7Y22Ye9Y+RSTZ+ziRIrK19BcevRFoI6FmNayZp5QLpiSAw8nkRnblJP8Wh rnUXVyOjjrBgM50WWG0B2rlEnYWK5od/52DGOou/uM56pZN/ajBZqvzDFctZuoNlfCRu Cq1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2uGB+Q5rR6oVtWTfb+UBTf10EP4K8bIAelKbWHYG2Ww=; b=ZQwUGxXc4JhtzyT31mzW4PM0TjWE6uZK+B5GzqaqnTXHabfNLCcuVFg7EZIxltO8Sb +tcezijVkwm1Ek7GdUkS2wVUVaQHpDqvAa6DjG7V8amT8u1uaNV+2qBdIRQ7/V9T23kP F5lP/a5FIpRS0maRUWsy2N9XNB0/qlNU3jy+covLIIHWcxtQj5f5I02xNvNyTex0683v GO1GDb0/WL9momiqGRghkWvOXVNOaRy99wqn0rDyKCRq64SIfvGxkMIHRQX/8TiZX84C F/R0HUyQqsOhJzLK3C8tLSbnx/bDzELiacCvhpXEUkm35qVidhG7SHFJSBaOjuESCv6N pU5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nhK51HPN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r26-20020a170906a21a00b0078d39e310e0si11728402ejy.701.2022.10.19.06.39.51; Wed, 19 Oct 2022 06:40: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=nhK51HPN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232213AbiJSNhH (ORCPT + 99 others); Wed, 19 Oct 2022 09:37:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231786AbiJSNgS (ORCPT ); Wed, 19 Oct 2022 09:36: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 DC1C014EC76; Wed, 19 Oct 2022 06:25: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 ams.source.kernel.org (Postfix) with ESMTPS id 112DAB82481; Wed, 19 Oct 2022 09:05:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8097EC433D7; Wed, 19 Oct 2022 09:05:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170340; bh=87uGXaQ29FHYXgH/kJOHi/LtGmbeg5m3Y9g0xl9SUtQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nhK51HPNIoATH1qbakHg0/bIndU2cOmNW8maIJsaNtaJjcbZmr14R4L5RCVcES50e LJw32ou8TzFknosVKqUwiWs9Spo0I6RZDL5wNpc+RJclotlqslFHNf/P1N/zYJY2U/ RbmHSD5keV7AwB44p9KLc6wdga+YtxeY/QbJtlnw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicholas Piggin , Michael Ellerman , Sasha Levin Subject: [PATCH 6.0 618/862] powerpc/64/interrupt: Fix false warning in context tracking due to idle state Date: Wed, 19 Oct 2022 10:31:45 +0200 Message-Id: <20221019083317.242763603@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123506789526652?= X-GMAIL-MSGID: =?utf-8?q?1747123506789526652?= From: Nicholas Piggin [ Upstream commit 56adbb7a8b6cc7fc9b940829c38494e53c9e57d1 ] Commit 171476775d32 ("context_tracking: Convert state to atomic_t") added a CONTEXT_IDLE state which can be encountered by interrupts from kernel mode in the idle thread, causing a false positive warning. Fixes: 171476775d32 ("context_tracking: Convert state to atomic_t") Signed-off-by: Nicholas Piggin Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220926054305.2671436-2-npiggin@gmail.com Signed-off-by: Sasha Levin --- arch/powerpc/include/asm/interrupt.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/interrupt.h b/arch/powerpc/include/asm/interrupt.h index 8069dbc4b8d1..b61555e30c7c 100644 --- a/arch/powerpc/include/asm/interrupt.h +++ b/arch/powerpc/include/asm/interrupt.h @@ -195,7 +195,8 @@ static inline void interrupt_enter_prepare(struct pt_regs *regs) * so avoid recursion. */ if (TRAP(regs) != INTERRUPT_PROGRAM) { - CT_WARN_ON(ct_state() != CONTEXT_KERNEL); + CT_WARN_ON(ct_state() != CONTEXT_KERNEL && + ct_state() != CONTEXT_IDLE); if (IS_ENABLED(CONFIG_PPC_IRQ_SOFT_MASK_DEBUG)) BUG_ON(is_implicit_soft_masked(regs)); } From patchwork Wed Oct 19 08: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: 5525 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp337322wrs; Wed, 19 Oct 2022 06:49:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6uEkUxgzGSZZZBhbpRDhx2Bx7fZSpWtSGIev0CxGCMlpN3ti06K5ofP7Lzx2fVCST4R8Y9 X-Received: by 2002:a17:902:7598:b0:178:3f96:4ffc with SMTP id j24-20020a170902759800b001783f964ffcmr8879956pll.53.1666187340260; Wed, 19 Oct 2022 06:49:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666187340; cv=none; d=google.com; s=arc-20160816; b=Rw9bK6NeN2EzPb+E+trwBm72Anuqdn4XloJqGUkIdyjWWr3uhty4WQ7VbNSjnRAuaD F/qxJpYb7wiyYLu4FvqUMeCHj/UoAy6NmaJmWUtQ0GG4N3KFgoggTcCq4DFrIUmAhKou Cdn2fOO509A2t5ZH/c2KWNBrmvFMXM1iWHMUvrV1UbnCKVsK7d3ulXAioBmBmxEY9jTp lWsOCkLnBlJr6LXqEqe6zWLgrSVs/0wJZnE/w5d6qEauzpsxMDeNcku0GLYQAU+qB676 WjP+i0FfNtNDj4gsyIIiRGAHJcI2Ce9LmDPYzGyK/GngWBHl9juHD81heMj/6M8PzEfu 6Gag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=J49ljuCd4+/EN5zBi3AjLqEz06q39O0p5lXY+cqbf60=; b=ntz8mx0NZ3pfUEIODJYDVtx9KK5Xn6XNVgHsIFNUaQHdj+VdHTkjC+gwB9YDXjEWRj Tdlj6lt1uyWzYPp5ee/bedCbN/A5tECcwbuKsdirLNMsTg4CAGwC2G9yO4CXmpCiGgf0 Glg6pbYRqTbLK3Tmls1ql5ZX40jfVEI6QolZgaK4g8XgActexHxoHZAB1bzDq2seQfY+ l2FWidCJJdCqWH0faUaN28RT9MxNyR6sV3iXjhd88OGvN1XZjpRdzUPLD6Ziw2ugOFDd g79CGUbpjatdR1bEXmUqxyq+v5Y9e22cfUqYlH+74tFXZbXKGOP+OpbF+ia+AkT83qG3 jkZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="nDlQE/Ni"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c13-20020a655a8d000000b0043c0b4f2b68si18948168pgt.318.2022.10.19.06.48.44; Wed, 19 Oct 2022 06:49: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="nDlQE/Ni"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233251AbiJSNsX (ORCPT + 99 others); Wed, 19 Oct 2022 09:48:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233441AbiJSNq6 (ORCPT ); Wed, 19 Oct 2022 09:46:58 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 551A74F64C; Wed, 19 Oct 2022 06:32:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 577EBCE217D; Wed, 19 Oct 2022 09:05:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F279C433B5; Wed, 19 Oct 2022 09:05:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170343; bh=7iUnay9kotKl5KdpScGWZwxW0SDdUw4cc9DqQlkzRvc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nDlQE/NijiG0/iOTfLRd9IRxFpnzmtD6DXaBmMcPYWkf/lFTr4fBtw8NmUAfaJACD EihexMG8S6/63n2nMMa0ycJbSO4QS1ZYzJr7/C9AQyX1xC4WwmVeijKlK0cStq2mSx b5Li1+UEKyX+a45GwOy+6N0M6a/9RiDjtk0/XnbI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicholas Piggin , Michael Ellerman , Sasha Levin Subject: [PATCH 6.0 619/862] powerpc/64: mark irqs hard disabled in boot paca Date: Wed, 19 Oct 2022 10:31:46 +0200 Message-Id: <20221019083317.283134398@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747124056304812259?= X-GMAIL-MSGID: =?utf-8?q?1747124056304812259?= From: Nicholas Piggin [ Upstream commit 799f7063c7645f9a751d17f5dfd73b952f962cd2 ] This prevents interrupts in early boot (e.g., program check) from enabling MSR[EE], potentially causing endian mismatch or other crashes when reporting early boot traps. Fixes: 4423eb5ae32ec ("powerpc/64/interrupt: make normal synchronous interrupts enable MSR[EE] if possible") Signed-off-by: Nicholas Piggin Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220926054305.2671436-3-npiggin@gmail.com Signed-off-by: Sasha Levin --- arch/powerpc/kernel/setup_64.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c index 2b2d0b0fbb30..ce8fc6575eaa 100644 --- a/arch/powerpc/kernel/setup_64.c +++ b/arch/powerpc/kernel/setup_64.c @@ -182,8 +182,10 @@ static void __init fixup_boot_paca(void) get_paca()->cpu_start = 1; /* Allow percpu accesses to work until we setup percpu data */ get_paca()->data_offset = 0; - /* Mark interrupts disabled in PACA */ + /* Mark interrupts soft and hard disabled in PACA */ irq_soft_mask_set(IRQS_DISABLED); + get_paca()->irq_happened = PACA_IRQ_HARD_DIS; + WARN_ON(mfmsr() & MSR_EE); } static void __init configure_exceptions(void) From patchwork Wed Oct 19 08: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: 5018 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp245639wrs; Wed, 19 Oct 2022 03:36:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7UDbYj7BK38OXml1xEAFxV+fHXipyBv/f8nyXLmvpEv87KJPreZPPkOAtEMZk7acWsg8wh X-Received: by 2002:a17:907:3f85:b0:733:3f0e:2f28 with SMTP id hr5-20020a1709073f8500b007333f0e2f28mr5941283ejc.376.1666175760728; Wed, 19 Oct 2022 03:36:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666175760; cv=none; d=google.com; s=arc-20160816; b=RJvXxroQTTAUghK36Psp1R68kBe48aBHiOQkm5gM0U42yZRL5PVli9nu6mH8zOjs77 N9Y6l7chMFtgyDTVtkPFzrNUghrS+Ub08Y7N8HDHY3TWrHi7x7Y1+RZP6VxYuHjCEz7l nSqvQG28jCOZmeBiySqFQHTcaGePjgwBPieB/T8OuXOj3yGCZ8x7bDZzXJO5MIoZDU/2 RS8fiyXC9QL9Y5IAyMSbVQ7zbASGdeGBGphIqcy4QegvBcOiI86ayQiKlE9y03FY5y5j 5K80jFw/z/KE4/luGjjvSK+7YL2R/bC3YNUb+OA2FPC1BN1Xylq+XaHznFYz8tzHmG92 Q7Vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=65H456m2SsQF9E9d9cAwmGgFtNBJyH3x74V65kYOdIE=; b=bCz2OOKyW/V4xP52rvc+8zs4dTyxQhLu6pAoFwBVg1xGwku3wbp0t//uXcjfagLbBI Us/7FCAUqw59bwNhuhdJ7eXXNTMcLSMgKumVuQmZC4VBM7ZzOcuZ/ALC+RaKbI1CYYjp a1Jwr2rM9/rBxxz5eBZh+ljDScXi0m2VgHd2GoTcTZ+WS0AnxKHJGfcwrwADN7Id4CN0 B9OLEjZbNWmlUjK7Y/A6rssUT/EhlT7Ch5Nbolw6UQAQ+/tgeonzw7lJ6qdtiz8WHVQN W5bS220DA7LK+1UTCuAoyJI6wDkehijQR1/ynwh6fDPmvtHf69t2kd7eyI1I9Y65K5Zh ip/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PTWlcAdb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a17090658c300b00730936657d1si14724006ejs.552.2022.10.19.03.35.23; Wed, 19 Oct 2022 03:36: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=PTWlcAdb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231872AbiJSKRi (ORCPT + 99 others); Wed, 19 Oct 2022 06:17:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230207AbiJSKQl (ORCPT ); Wed, 19 Oct 2022 06:16: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 AC0D410B787; Wed, 19 Oct 2022 02:57: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 sin.source.kernel.org (Postfix) with ESMTPS id E1A31CE2183; Wed, 19 Oct 2022 09:05:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C259AC433D6; Wed, 19 Oct 2022 09:05:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170346; bh=QR0ElYQy4q9YU76kzPzxhsB29u2pO0wfg3SgVquJrmQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PTWlcAdbs2+3mf/yztbuU6JzEwarjj6pmA39ukFlsEZp2OC7I9rzxUOh0nt+dp3cq rP0iHMC3Bk/gISPkuJdPO/73zIjXgoEeYwq4FMG8ntW068G+rfvyaeVqQsazTwLzyz N7r+k+4jT6ED+2/D3IHnGdEbdYs6y8vfw+2rLx9w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicholas Piggin , Michael Ellerman , Sasha Levin Subject: [PATCH 6.0 620/862] powerpc/64/interrupt: Fix return to masked context after hard-mask irq becomes pending Date: Wed, 19 Oct 2022 10:31:47 +0200 Message-Id: <20221019083317.332868643@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747111914425973767?= X-GMAIL-MSGID: =?utf-8?q?1747111914425973767?= From: Nicholas Piggin [ Upstream commit e485f6c751e0a969327336c635ca602feea117f0 ] If a synchronous interrupt (e.g., hash fault) is taken inside an irqs-disabled region which has MSR[EE]=1, then an asynchronous interrupt that is PACA_IRQ_MUST_HARD_MASK (e.g., PMI) is taken inside the synchronous interrupt handler, then the synchronous interrupt will return with MSR[EE]=1 and the asynchronous interrupt fires again. If the asynchronous interrupt is a PMI and the original context does not have PMIs disabled (only Linux IRQs), the asynchronous interrupt will fire despite having the PMI marked soft pending. This can confuse the perf code and cause warnings. This patch changes the interrupt return so that irqs-disabled MSR[EE]=1 contexts will be returned to with MSR[EE]=0 if a PACA_IRQ_MUST_HARD_MASK interrupt has become pending in the meantime. The longer explanation for what happens: 1. local_irq_disable() 2. Hash fault interrupt fires, do_hash_fault handler runs 3. interrupt_enter_prepare() sets IRQS_ALL_DISABLED 4. interrupt_enter_prepare() sets MSR[EE]=1 5. PMU interrupt fires, masked handler runs 6. Masked handler marks PMI pending 7. Masked handler returns with PACA_IRQ_HARD_DIS set, MSR[EE]=0 8. do_hash_fault interrupt return handler runs 9. interrupt_exit_kernel_prepare() clears PACA_IRQ_HARD_DIS 10. interrupt returns with MSR[EE]=1 11. PMU interrupt fires, perf handler runs Fixes: 4423eb5ae32e ("powerpc/64/interrupt: make normal synchronous interrupts enable MSR[EE] if possible") Signed-off-by: Nicholas Piggin Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220926054305.2671436-4-npiggin@gmail.com Signed-off-by: Sasha Levin --- arch/powerpc/kernel/interrupt.c | 10 --------- arch/powerpc/kernel/interrupt_64.S | 34 +++++++++++++++++++++++++++--- 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/arch/powerpc/kernel/interrupt.c b/arch/powerpc/kernel/interrupt.c index 0e75cb03244a..f9db0a172401 100644 --- a/arch/powerpc/kernel/interrupt.c +++ b/arch/powerpc/kernel/interrupt.c @@ -431,16 +431,6 @@ notrace unsigned long interrupt_exit_kernel_prepare(struct pt_regs *regs) if (unlikely(stack_store)) __hard_EE_RI_disable(); - /* - * Returning to a kernel context with local irqs disabled. - * Here, if EE was enabled in the interrupted context, enable - * it on return as well. A problem exists here where a soft - * masked interrupt may have cleared MSR[EE] and set HARD_DIS - * here, and it will still exist on return to the caller. This - * will be resolved by the masked interrupt firing again. - */ - if (regs->msr & MSR_EE) - local_paca->irq_happened &= ~PACA_IRQ_HARD_DIS; #endif /* CONFIG_PPC64 */ } diff --git a/arch/powerpc/kernel/interrupt_64.S b/arch/powerpc/kernel/interrupt_64.S index ce25b28cf418..d76376ce7291 100644 --- a/arch/powerpc/kernel/interrupt_64.S +++ b/arch/powerpc/kernel/interrupt_64.S @@ -559,15 +559,43 @@ _ASM_NOKPROBE_SYMBOL(interrupt_return_\srr\()_kernel) ld r11,SOFTE(r1) cmpwi r11,IRQS_ENABLED stb r11,PACAIRQSOFTMASK(r13) - bne 1f + beq .Linterrupt_return_\srr\()_soft_enabled + + /* + * Returning to soft-disabled context. + * Check if a MUST_HARD_MASK interrupt has become pending, in which + * case we need to disable MSR[EE] in the return context. + */ + ld r12,_MSR(r1) + andi. r10,r12,MSR_EE + beq .Lfast_kernel_interrupt_return_\srr\() // EE already disabled + lbz r11,PACAIRQHAPPENED(r13) + andi. r10,r11,PACA_IRQ_MUST_HARD_MASK + beq 1f // No HARD_MASK pending + + /* Must clear MSR_EE from _MSR */ +#ifdef CONFIG_PPC_BOOK3S + li r10,0 + /* Clear valid before changing _MSR */ + .ifc \srr,srr + stb r10,PACASRR_VALID(r13) + .else + stb r10,PACAHSRR_VALID(r13) + .endif +#endif + xori r12,r12,MSR_EE + std r12,_MSR(r1) + b .Lfast_kernel_interrupt_return_\srr\() + +.Linterrupt_return_\srr\()_soft_enabled: #ifdef CONFIG_PPC_BOOK3S lbz r11,PACAIRQHAPPENED(r13) andi. r11,r11,(~PACA_IRQ_HARD_DIS)@l bne- interrupt_return_\srr\()_kernel_restart #endif - li r11,0 - stb r11,PACAIRQHAPPENED(r13) # clear out possible HARD_DIS 1: + li r11,0 + stb r11,PACAIRQHAPPENED(r13) // clear the possible HARD_DIS .Lfast_kernel_interrupt_return_\srr\(): cmpdi cr1,r3,0 From patchwork Wed Oct 19 08:31:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4893 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225520wrs; Wed, 19 Oct 2022 02:43:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7aeu2I1aQKvJNkK5WCZV8de9o3R1mPsqnwDPj2+FLWw2yXl7s+AyfqVpLWw+8nTWBJ8/Y6 X-Received: by 2002:a17:906:fe0b:b0:787:f1d3:2105 with SMTP id wy11-20020a170906fe0b00b00787f1d32105mr6026673ejb.83.1666172600806; Wed, 19 Oct 2022 02:43:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172600; cv=none; d=google.com; s=arc-20160816; b=rN+ENK37poGpfRIpKZfOpTz9mbYWgvnhrEOGSVbpI5F9y/7e/FT+kk7yAGObIFnEj5 ljtm+NlQ3jalBitUCTqPnRfPbtKLmNC7JhokEnyYHDLSFb7mZN60nTqg6xoRSf9WiV7H 1gkK+pknpU/62peQULVBahubLlI07a5O8Jo1PzDb3fiwyod1PePe6Fs+sLPOsDv8bUSJ 6JSDMdJ4NET8L76Vbmnp2eLSTSrDhmrBT8UwfLJTpCgsZzKuRdsOmXQq89FgV1hr3BX3 j4CG7OEuXaNPGcBu976ga0otVDoijgH0inVwxZYdpknUrMKaDqL5sfSq21/4vg19C9d5 88XQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dl7DbacewDRs1kZ9C6d3ti7ZEcmbSP0pgR+ErZNXqVI=; b=fnz8pw5RDmqpdOig5hnMaQEs/hq0l39ckdWtQCGmG6ymfx8LPJLo/7Xi0ny9TRzs1w kGQcGoHDPzhlysbfQnEAJO/CJVsEU18puPf8Q6DmB/e9E3y5QIw3ScHfW0l6poBKMtKU oXm9pHaBypCTraMRrJf0yrozRNQPeQ81OYL2uVl7Is3xUPXwUbzxLAqq0OYiTQjEwMz/ cN0ma08vJXDqUSzUIlpEduefK8ORJBoQC2HpTMUIPt8+StzGxYcvt/WZTnNxaa3jT6cW cjrFBSJSHz05VmiuxaMRHB8aAWrg4pDiuO/+X8QoHiRvahwXqL6OmxyywMOZVqe2Z8R1 wI1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CAmgL6L4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ae8-20020a17090725c800b0078dce38525asi14647159ejc.896.2022.10.19.02.42.55; Wed, 19 Oct 2022 02:43: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=CAmgL6L4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234011AbiJSJeX (ORCPT + 99 others); Wed, 19 Oct 2022 05:34:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233786AbiJSJ30 (ORCPT ); Wed, 19 Oct 2022 05:29:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0129DEB753; Wed, 19 Oct 2022 02:13: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 50E1061865; Wed, 19 Oct 2022 09:05:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62A90C433C1; Wed, 19 Oct 2022 09:05:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170348; bh=l0qQ2lCaxTmpz63zjBz0GZTyNJRYUHWb1NPdjSlk1wE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CAmgL6L4J2CYuZnNKWIUbYBlA/ZNKvYeaFJtiMuomGTf7NHIUru8Jih0jebw+ynSE mTu7RnDjlRLslZV8T4io/k/uk5auCF8WItt9TFDjfSgg2dZMkk4+Z8I1qf/fKmgQ9t Nl5w/vqY+2eGiE7ogj4Jmtta92s5YvOMAH0490Ls= 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 6.0 621/862] powerpc: Fix SPE Power ISA properties for e500v1 platforms Date: Wed, 19 Oct 2022 10:31:48 +0200 Message-Id: <20221019083317.381331836@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108600706348639?= X-GMAIL-MSGID: =?utf-8?q?1747108600706348639?= 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 18a885130538..e03ae130162b 100644 --- a/arch/powerpc/boot/dts/fsl/mpc8540ads.dts +++ b/arch/powerpc/boot/dts/fsl/mpc8540ads.dts @@ -7,7 +7,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 ac381e7b1c60..a2a6c5cf852e 100644 --- a/arch/powerpc/boot/dts/fsl/mpc8541cds.dts +++ b/arch/powerpc/boot/dts/fsl/mpc8541cds.dts @@ -7,7 +7,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 9f58db2a7e66..901b6ff06dfb 100644 --- a/arch/powerpc/boot/dts/fsl/mpc8555cds.dts +++ b/arch/powerpc/boot/dts/fsl/mpc8555cds.dts @@ -7,7 +7,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 a24722ccaebf..c2f9aea78b29 100644 --- a/arch/powerpc/boot/dts/fsl/mpc8560ads.dts +++ b/arch/powerpc/boot/dts/fsl/mpc8560ads.dts @@ -7,7 +7,7 @@ /dts-v1/; -/include/ "e500v2_power_isa.dtsi" +/include/ "e500v1_power_isa.dtsi" / { model = "MPC8560ADS"; From patchwork Wed Oct 19 08: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: 4815 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp221918wrs; Wed, 19 Oct 2022 02:32:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5j9/yy15XvwoaH9DqnCV1jTIOAE1lm/8jLlIHEx1jCvunpJ0gkV701TPAg39a4Gpnyz8sh X-Received: by 2002:a05:6a02:201:b0:463:5d19:4213 with SMTP id bh1-20020a056a02020100b004635d194213mr6467376pgb.377.1666171972668; Wed, 19 Oct 2022 02:32:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666171972; cv=none; d=google.com; s=arc-20160816; b=j61DHsYgM5n3PZskEAqgdnkxAXbwIRGxDGyAoBL17ifaO4ebZ+/m59Bdhgp9yKTaA6 DEXwzNrn69JYsaukqpYzN44NUH6Urs5Ako1dAZzp87iebMctDXZgTKbDXYpIrA+4bvdD uf8CCdnMzej9dzSgbneE8l0XN56GgNmUiepLVgJ7LWDfORCd3dAZvA9zx0BqUvKr3lkI MIz/xAxcFAQInjLWnhV57lR6d2RJGutiXV8B+8sGT2R+F5vyW4do+ZHLsbrE2i86sTJN 148qJZxWaGHedgBaajwujFkJZuMEMzt+2KRuYXNZkSPXwe7fxR6QnDXvup3qOKbrEbGv 9aKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=C0xId3lj6nTW1JQqQP1zhS7C5WITAszOAAiT6qThow0=; b=XDxaZrcphXO67MoDYri7qDWwYVxQlg27PU1ZctQ38wZrx6Jjw3SAATr7X1Y0dUuZX4 P+9GEr6YQXIEYHldqXlx+umvxN4DWeFeILda/N7ajxsIdE3BzLFkhIy3mGH6i4lUjYTn /CbDpGskEI2a/g61deOxKpWGOYhOzdAccBhAwCknbH87VAMVYy4hs3hsEJCFi5dGNkWw F/2JfWH1kzq8sTbyJzbdt+UU2FGgvtzb3Lg1NbzLippEhP4Uu11tX5RgAP3i/rvyCa31 v+4x1Kk9bDBgV33yzJpotDxYpPvLPE3/xhjPLb30r/i8hz+tfDoITn/BNvCYBs0rQNPW ZkhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=du0mcH1C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v16-20020a631510000000b004386a1ebe70si17226591pgl.43.2022.10.19.02.32.40; Wed, 19 Oct 2022 02:32: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=du0mcH1C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233299AbiJSJSJ (ORCPT + 99 others); Wed, 19 Oct 2022 05:18:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233723AbiJSJPr (ORCPT ); Wed, 19 Oct 2022 05:15:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C703D0192; Wed, 19 Oct 2022 02:06:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E54086186A; Wed, 19 Oct 2022 09:05:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ECD5AC433D7; Wed, 19 Oct 2022 09:05:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170351; bh=YSgRrx6e5C9KaV05ykt6gXCGLEwA9I+qydBcSRY1t0Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=du0mcH1CETpgxxiPFA5MGeVq0Wz+74fJO+0muw6dQJ+CMXWKa+ScvSdGG4D8h/k9e LSIRrITK7OmXDLDEXlz7/r8ha+2Dtr8QitFkfT/fKhKfuYBV0mD+gVEuNmGADVpwlJ a07YbM5gaxKq1rhZZDie7xJAf+1OLN7b2ajA2/4A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Li Huafei , Michael Ellerman , Sasha Levin Subject: [PATCH 6.0 622/862] powerpc/kprobes: Fix null pointer reference in arch_prepare_kprobe() Date: Wed, 19 Oct 2022 10:31:49 +0200 Message-Id: <20221019083317.425875660@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747107942497385910?= X-GMAIL-MSGID: =?utf-8?q?1747107942497385910?= From: Li Huafei [ Upstream commit 97f88a3d723162781d6cbfdc7b9617eefab55b19 ] I found a null pointer reference in arch_prepare_kprobe(): # echo 'p cmdline_proc_show' > kprobe_events # echo 'p cmdline_proc_show+16' >> kprobe_events Kernel attempted to read user page (0) - exploit attempt? (uid: 0) BUG: Kernel NULL pointer dereference on read at 0x00000000 Faulting instruction address: 0xc000000000050bfc Oops: Kernel access of bad area, sig: 11 [#1] LE PAGE_SIZE=64K MMU=Radix SMP NR_CPUS=2048 NUMA PowerNV Modules linked in: CPU: 0 PID: 122 Comm: sh Not tainted 6.0.0-rc3-00007-gdcf8e5633e2e #10 NIP: c000000000050bfc LR: c000000000050bec CTR: 0000000000005bdc REGS: c0000000348475b0 TRAP: 0300 Not tainted (6.0.0-rc3-00007-gdcf8e5633e2e) MSR: 9000000000009033 CR: 88002444 XER: 20040006 CFAR: c00000000022d100 DAR: 0000000000000000 DSISR: 40000000 IRQMASK: 0 ... NIP arch_prepare_kprobe+0x10c/0x2d0 LR arch_prepare_kprobe+0xfc/0x2d0 Call Trace: 0xc0000000012f77a0 (unreliable) register_kprobe+0x3c0/0x7a0 __register_trace_kprobe+0x140/0x1a0 __trace_kprobe_create+0x794/0x1040 trace_probe_create+0xc4/0xe0 create_or_delete_trace_kprobe+0x2c/0x80 trace_parse_run_command+0xf0/0x210 probes_write+0x20/0x40 vfs_write+0xfc/0x450 ksys_write+0x84/0x140 system_call_exception+0x17c/0x3a0 system_call_vectored_common+0xe8/0x278 --- interrupt: 3000 at 0x7fffa5682de0 NIP: 00007fffa5682de0 LR: 0000000000000000 CTR: 0000000000000000 REGS: c000000034847e80 TRAP: 3000 Not tainted (6.0.0-rc3-00007-gdcf8e5633e2e) MSR: 900000000280f033 CR: 44002408 XER: 00000000 The address being probed has some special: cmdline_proc_show: Probe based on ftrace cmdline_proc_show+16: Probe for the next instruction at the ftrace location The ftrace-based kprobe does not generate kprobe::ainsn::insn, it gets set to NULL. In arch_prepare_kprobe() it will check for: ... prev = get_kprobe(p->addr - 1); preempt_enable_no_resched(); if (prev && ppc_inst_prefixed(ppc_inst_read(prev->ainsn.insn))) { ... If prev is based on ftrace, 'ppc_inst_read(prev->ainsn.insn)' will occur with a null pointer reference. At this point prev->addr will not be a prefixed instruction, so the check can be skipped. Check if prev is ftrace-based kprobe before reading 'prev->ainsn.insn' to fix this problem. Fixes: b4657f7650ba ("powerpc/kprobes: Don't allow breakpoints on suffixes") Signed-off-by: Li Huafei [mpe: Trim oops] Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220923093253.177298-1-lihuafei1@huawei.com Signed-off-by: Sasha Levin --- arch/powerpc/kernel/kprobes.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c index 912d4f8a13be..bd7b1a035459 100644 --- a/arch/powerpc/kernel/kprobes.c +++ b/arch/powerpc/kernel/kprobes.c @@ -161,7 +161,13 @@ int arch_prepare_kprobe(struct kprobe *p) preempt_disable(); prev = get_kprobe(p->addr - 1); preempt_enable_no_resched(); - if (prev && ppc_inst_prefixed(ppc_inst_read(prev->ainsn.insn))) { + + /* + * When prev is a ftrace-based kprobe, we don't have an insn, and it + * doesn't probe for prefixed instruction. + */ + if (prev && !kprobe_ftrace(prev) && + ppc_inst_prefixed(ppc_inst_read(prev->ainsn.insn))) { printk("Cannot register a kprobe on the second word of prefixed instruction\n"); ret = -EINVAL; } From patchwork Wed Oct 19 08:31:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5476 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp332981wrs; Wed, 19 Oct 2022 06:40:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6LbdfEbpvvnNtYer6xNpVKVknaW5FljMW6D7o55KO+WD4l6s1K7uoRd5O9pWwaknY5Z7ZU X-Received: by 2002:a05:6402:1356:b0:459:3c9e:81d4 with SMTP id y22-20020a056402135600b004593c9e81d4mr7688934edw.148.1666186800225; Wed, 19 Oct 2022 06:40:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666186800; cv=none; d=google.com; s=arc-20160816; b=Ivzwxt2zIPnLlkyIObhgaSNhJ6ajtoU+bkfZWM6TxIK3hGk0hkW7IxQJI06UWWkVRh ikja/vcdSH9+PUjyeNJmbuk8k96I91EeJ8iXVBasKIT/bJkEvjs85Xx13BW63W1212CW Pl45uY1v0+U5Igor8byR5Fk3s3D6lS/I8Q4eN5uO5E+wBy846NbbQ7Yrhwq7JrxoYCft itUqcioiNWK+A1pZ++rL8PiaZi26cS0ET1tMEKp58baHoHrFh1YX/PLMzgN55EwNBxpg 2SoYDGN++hxrs1qLhvLpsyyKAnMG1PDZiCtT1suFOJYZbo8TU/IEG+KLcyVfiFfEfpMq Wl+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=JIUr8lToSg4jzYVjpGz92+PcFqeYWgm/NzrJxiZxgo4=; b=gn6PuAzDANDX55j9dGNh9c1lP9S2fT/J56PNPNYS3omRbWk3n5W6rW/tVlvD2hTVDv 9EiIptm0FEsfvZIZmwvFb9Dnv6qRXthe9Zk/dGfox2p14N8R/7FU8/o5RQ+7a4tip6IG KDMOE1Iu9mkmPJLIMyWRPa1SYh9Z+RdW4YXq002i5by8T3I3fC3kdmuOM2fg5P3mBHVc zVRGO1aFlDx9CiYD1YE0oznpxFi3bxgjdmu4GQJsVJXiLYG7RjGiSh26Os8Sl0n9h2lc wcn5B7L7OuPJ8xpIC7Ubxd1Out099yglNviMImrM5B102ptxM5Z8M8rIIUF0hr/PqIl8 uYwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RZuaasvp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d11-20020a170906370b00b007818378f560si10845125ejc.383.2022.10.19.06.39.34; Wed, 19 Oct 2022 06:40: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=RZuaasvp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231213AbiJSNgs (ORCPT + 99 others); Wed, 19 Oct 2022 09:36:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232220AbiJSNgN (ORCPT ); Wed, 19 Oct 2022 09:36: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 6C81865A5; Wed, 19 Oct 2022 06:25: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 3FA1EB82478; Wed, 19 Oct 2022 09:05:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0387C433D6; Wed, 19 Oct 2022 09:05:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170354; bh=oN1q5+EkQodGSpeSvWON/bvXRv29YUR6xT4ss1Sevw4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RZuaasvp38/ChNUy+M6JPlfJ+CQSshkiptKOlBXt++ZBljZKfqsZtJhsRXMd99Qjf jqddsDM5WlMI3rE4STz9QDgp1ZIahGf+VRzXGGGPtfGzBkNFXWR2/XGXcYSZtjqMm7 p5r+7WGcZN1JtRoxutK4iLb/EuKoY0rUgoQKWhWw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Lynch , Haren Myneni , Michael Ellerman , Sasha Levin Subject: [PATCH 6.0 623/862] powerpc/pseries/vas: Pass hw_cpu_id to node associativity HCALL Date: Wed, 19 Oct 2022 10:31:50 +0200 Message-Id: <20221019083317.464743711@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123490265172565?= X-GMAIL-MSGID: =?utf-8?q?1747123490265172565?= From: Haren Myneni [ Upstream commit f3e5d9e53e74d77e711a2c90a91a8b0836a9e0b3 ] Generally the hypervisor decides to allocate a window on different VAS instances. But if user space wishes to allocate on the current VAS instance where the process is executing, the kernel has to pass associativity domain IDs to allocate VAS window HCALL. To determine the associativity domain IDs for the current CPU, smp_processor_id() is passed to node associativity HCALL which may return H_P2 (-55) error during DLPAR CPU event. This is because Linux CPU numbers (smp_processor_id()) are not the same as the hypervisor's view of CPU numbers. Fix the issue by passing hard_smp_processor_id() with VPHN_FLAG_VCPU flag (PAPR 14.11.6.1 H_HOME_NODE_ASSOCIATIVITY). Fixes: b22f2d88e435 ("powerpc/pseries/vas: Integrate API with open/close windows") Reviewed-by: Nathan Lynch Signed-off-by: Haren Myneni [mpe: Update change log to mention Linux vs HV CPU numbers] Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/55380253ea0c11341824cd4c0fc6bbcfc5752689.camel@linux.ibm.com Signed-off-by: Sasha Levin --- arch/powerpc/platforms/pseries/vas.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/platforms/pseries/vas.c b/arch/powerpc/platforms/pseries/vas.c index 7e6e6dd2e33e..1a2cbc156e8f 100644 --- a/arch/powerpc/platforms/pseries/vas.c +++ b/arch/powerpc/platforms/pseries/vas.c @@ -333,7 +333,7 @@ static struct vas_window *vas_allocate_window(int vas_id, u64 flags, * So no unpacking needs to be done. */ rc = plpar_hcall9(H_HOME_NODE_ASSOCIATIVITY, domain, - VPHN_FLAG_VCPU, smp_processor_id()); + VPHN_FLAG_VCPU, hard_smp_processor_id()); if (rc != H_SUCCESS) { pr_err("H_HOME_NODE_ASSOCIATIVITY error: %d\n", rc); goto out; From patchwork Wed Oct 19 08: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: 5147 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp253285wrs; Wed, 19 Oct 2022 03:56:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5JNJXc46WTjvYtj17k1NRX+SRgqF9DDcsXCEzPaYLDH76Af/jGEEUcBSsF5xev55Q+i9p7 X-Received: by 2002:a05:6402:164c:b0:459:1e2e:e742 with SMTP id s12-20020a056402164c00b004591e2ee742mr6710737edx.125.1666177017129; Wed, 19 Oct 2022 03:56:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666177017; cv=none; d=google.com; s=arc-20160816; b=THyDiiRekULq0+BkBrTNehnbvAg1XJ57CJ8dKm+y+vs8b7I660ZkOLivm2DNgiaYU3 Wtlix0PhMOYuB16AhhSN3UQoW9H0Xxmd/sqLSiGEiO0l9qa4JzOAKGfrfT8xWhlKVH8D KaXxC0P4lp0YiO+kuhvSXda/lkIsrBIROEG3f4h0aWJtoqbk+EloQXpT9NQIUvRXU6bt G0MGjTTDGJ6GTKecdVzemcW8aLlTaD2pLFq4xv6dMohjgtbbSb2m9D8KO6Lt5JyUxLM+ YXZzb3bNfKvIDndBaFNq+MnKnPN4WOz5NZDf6cwB3ql13h2TR7lb8rdOxnDRtVtkKfgO sBeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UeXMP0V5EKhvdGZgYYTjnp6nrp2m6DpWou5AFJKNcsQ=; b=tNsDWvf/UXwGYypl04Mfn8UUbqv9W11oCrQRy+UgtApNkC/Hym3Xir4M8MDpPzrcBs WXPa9JN82KkaguZhFgjYBkcoRzrKsyQoL/iJK90k6Pjvcq8gXMUeHYJkdQPY4c3HHaDV fCiZ3vdXRB39cVm2ImdAurbhlLTmygOair++YRJMCjKKM6G9Scr6AMgKFEEC4hXuWmmK jzfcX5CFziD5WFXgAGqSMxD4VQeHLPScMKMp5wlJCqyfSHiPjL7favTNGDaVU1CxVceO 4XoSMse4FeQS0WjhImRZuOQ+Qck5FiWBfhVUayTfOtDrsb66gW9huPMaXTTkbnUidmxf Qdhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xhPxnjLk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ne22-20020a1709077b9600b007701a050273si15770236ejc.942.2022.10.19.03.56.30; Wed, 19 Oct 2022 03:56: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=xhPxnjLk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234460AbiJSKzt (ORCPT + 99 others); Wed, 19 Oct 2022 06:55:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235038AbiJSKy6 (ORCPT ); Wed, 19 Oct 2022 06:54:58 -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 58D7B8E9B5; Wed, 19 Oct 2022 03:26:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 44D6ECE217E; Wed, 19 Oct 2022 09:05:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E8F8C433D6; Wed, 19 Oct 2022 09:05:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170356; bh=oi1CZUVpo8tc5lnU4a5h7UpgZgb2bjuEFwx20nMrjHg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xhPxnjLkc7erG8eJFfz04vGAE821sOJ3FrWwV95jaVxXuDQWJQD3t0gHJR6RJs92g eTCdm2h4tXbCOO6p9EHIq22IRn2ZKo45QQghhJUGM780Npng2upeFUuJNhPF9JwOIO NxlFlUHTSuJCbq3ivPFR2n9CokYUjog0Yp7ktCJM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhengchao Shao , Herbert Xu , Sasha Levin Subject: [PATCH 6.0 624/862] crypto: sahara - dont sleep when in softirq Date: Wed, 19 Oct 2022 10:31:51 +0200 Message-Id: <20221019083317.505592707@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747113232037246621?= X-GMAIL-MSGID: =?utf-8?q?1747113232037246621?= From: Zhengchao Shao [ Upstream commit 108586eba094b318e6a831f977f4ddcc403a15da ] Function of sahara_aes_crypt maybe could be called by function of crypto_skcipher_encrypt during the rx softirq, so it is not allowed to use mutex lock. Fixes: c0c3c89ae347 ("crypto: sahara - replace tasklets with...") Signed-off-by: Zhengchao Shao Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/sahara.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/crypto/sahara.c b/drivers/crypto/sahara.c index 457084b344c1..b07ae4ba165e 100644 --- a/drivers/crypto/sahara.c +++ b/drivers/crypto/sahara.c @@ -26,10 +26,10 @@ #include #include #include -#include #include #include #include +#include #define SHA_BUFFER_LEN PAGE_SIZE #define SAHARA_MAX_SHA_BLOCK_SIZE SHA256_BLOCK_SIZE @@ -196,7 +196,7 @@ struct sahara_dev { void __iomem *regs_base; struct clk *clk_ipg; struct clk *clk_ahb; - struct mutex queue_mutex; + spinlock_t queue_spinlock; struct task_struct *kthread; struct completion dma_completion; @@ -642,9 +642,9 @@ static int sahara_aes_crypt(struct skcipher_request *req, unsigned long mode) rctx->mode = mode; - mutex_lock(&dev->queue_mutex); + spin_lock_bh(&dev->queue_spinlock); err = crypto_enqueue_request(&dev->queue, &req->base); - mutex_unlock(&dev->queue_mutex); + spin_unlock_bh(&dev->queue_spinlock); wake_up_process(dev->kthread); @@ -1043,10 +1043,10 @@ static int sahara_queue_manage(void *data) do { __set_current_state(TASK_INTERRUPTIBLE); - mutex_lock(&dev->queue_mutex); + spin_lock_bh(&dev->queue_spinlock); backlog = crypto_get_backlog(&dev->queue); async_req = crypto_dequeue_request(&dev->queue); - mutex_unlock(&dev->queue_mutex); + spin_unlock_bh(&dev->queue_spinlock); if (backlog) backlog->complete(backlog, -EINPROGRESS); @@ -1092,9 +1092,9 @@ static int sahara_sha_enqueue(struct ahash_request *req, int last) rctx->first = 1; } - mutex_lock(&dev->queue_mutex); + spin_lock_bh(&dev->queue_spinlock); ret = crypto_enqueue_request(&dev->queue, &req->base); - mutex_unlock(&dev->queue_mutex); + spin_unlock_bh(&dev->queue_spinlock); wake_up_process(dev->kthread); @@ -1449,7 +1449,7 @@ static int sahara_probe(struct platform_device *pdev) crypto_init_queue(&dev->queue, SAHARA_QUEUE_LENGTH); - mutex_init(&dev->queue_mutex); + spin_lock_init(&dev->queue_spinlock); dev_ptr = dev; From patchwork Wed Oct 19 08: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: 4810 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp217482wrs; Wed, 19 Oct 2022 02:20:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5MTGgWmXb2MlxAgNpvx+YeyyvW+ilqS+MqBwMbHhwOpX8HW2ndNYeRt7cRvc7IYYB46U5+ X-Received: by 2002:a05:6402:3408:b0:43c:2dd3:d86b with SMTP id k8-20020a056402340800b0043c2dd3d86bmr6567469edc.108.1666171251368; Wed, 19 Oct 2022 02:20:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666171251; cv=none; d=google.com; s=arc-20160816; b=bChh+Wz1Jn0WcfvTKvflaIVKYuen8Pa4O8WdQk1+QhKchu5TuO+tzUdl2FhvdHHAGS 64ExqnxXa6WdkTxY0cThH12R4LHUoWnbEmC4Yw/vBT4oJKqqD+qY3Mbt7h1yJMzdN8/Z pGkOBJRWrJvhdPhtzsBsSwUQQsEexGxmv30CyNKqPhIbbBPczATDW7nR7+knn0uSixxF 2/3TIQpDMjXTSmCcNEKef1f13z3nxyhQ0JPcdwyOjIgk8Lo+VwkVZYS5ay1mEwl7idGQ Je0oOxqxitJ3eMRMqafvaNxMt37laRpqmE6bNL9fvMgsF34Vcqg7SYPkJDni371UxEwE r7IQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ioykQqzDC70yjDgxYPafTemRVspFvaTwuQGnoPU+Bwo=; b=JdK856yRmc3jXJaFZ+85tSwPyjXqcHVGwCc/nsVlXsS1Ffece+/wx9U1P2X4S8WYv3 xkfIcIg0vyDhNEeLKUAAIhal+PGqFj8oCgSnJPJdcRAhvDNcug8C49p/ovZKDTNufiEY iA/z2xcSzmutCQPnIq8Qlvvu7gEh4+nfUEI4Uv4sCjyWBXfSIOIJIb7VMnNaMc4y8F0L MV5ybav84hKeeihaam4eyOskaFj+UbkklfTV9uulPe1SZw0vNgbE0qJHMl4I/LENqr0G MeM924RNXltXn8nF9w8n8RIqVdB2etQvnpLItgGn3E7itBzklvrMv1fpITfg6cODFI29 TWIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0cdfRC6r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gb22-20020a170907961600b0072fc714c92fsi14910321ejc.902.2022.10.19.02.20.25; Wed, 19 Oct 2022 02:20: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=0cdfRC6r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233302AbiJSJSM (ORCPT + 99 others); Wed, 19 Oct 2022 05:18:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232773AbiJSJPx (ORCPT ); Wed, 19 Oct 2022 05:15:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A285B274B; Wed, 19 Oct 2022 02:06: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 dfw.source.kernel.org (Postfix) with ESMTPS id C28CE6183D; Wed, 19 Oct 2022 09:05:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D597CC433D6; Wed, 19 Oct 2022 09:05:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170359; bh=M3DKLJs+12a3FysuaTwmQxqFZ8L8sCgQgxofNUcKlY4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0cdfRC6r0L0tz3EO8UggJEErTN2RDO6qV7erMa2spptTmsNs83cFnwyEXkUAYVBmo 2Wif5jC8IdufMwCjWQKyKyzKQJXs3ib6hEfHuD/+sclvvwnCicp4xJJzwYID2jymdF dcglaUJFFbmQKq8u0ttZZ1nqDrJf+y8+VvYLLu5A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ye Weihua , Herbert Xu , Sasha Levin Subject: [PATCH 6.0 625/862] crypto: hisilicon/zip - fix mismatch in get/set sgl_sge_nr Date: Wed, 19 Oct 2022 10:31:52 +0200 Message-Id: <20221019083317.546497923@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747107186153037364?= X-GMAIL-MSGID: =?utf-8?q?1747107186153037364?= From: Ye Weihua [ Upstream commit d74f9340097a881869c4c22ca376654cc2516ecc ] KASAN reported this Bug: [17619.659757] BUG: KASAN: global-out-of-bounds in param_get_int+0x34/0x60 [17619.673193] Read of size 4 at addr fffff01332d7ed00 by task read_all/1507958 ... [17619.698934] The buggy address belongs to the variable: [17619.708371] sgl_sge_nr+0x0/0xffffffffffffa300 [hisi_zip] There is a mismatch in hisi_zip when get/set the variable sgl_sge_nr. The type of sgl_sge_nr is u16, and get/set sgl_sge_nr by param_get/set_int. Replacing param_get/set_int to param_get/set_ushort can fix this bug. Fixes: f081fda293ffb ("crypto: hisilicon - add sgl_sge_nr module param for zip") Signed-off-by: Ye Weihua Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/hisilicon/zip/zip_crypto.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/hisilicon/zip/zip_crypto.c b/drivers/crypto/hisilicon/zip/zip_crypto.c index ad35434a3fdb..06a2d6e81ae9 100644 --- a/drivers/crypto/hisilicon/zip/zip_crypto.c +++ b/drivers/crypto/hisilicon/zip/zip_crypto.c @@ -123,12 +123,12 @@ static int sgl_sge_nr_set(const char *val, const struct kernel_param *kp) if (ret || n == 0 || n > HISI_ACC_SGL_SGE_NR_MAX) return -EINVAL; - return param_set_int(val, kp); + return param_set_ushort(val, kp); } static const struct kernel_param_ops sgl_sge_nr_ops = { .set = sgl_sge_nr_set, - .get = param_get_int, + .get = param_get_ushort, }; static u16 sgl_sge_nr = HZIP_SGL_SGE_NR; From patchwork Wed Oct 19 08: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: 4817 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp222641wrs; Wed, 19 Oct 2022 02:35:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5RLLYJs6goYzTarE7gvTJqx14CaF2eSW5Gv1C8+qXF3arFhsXai7CUYPMaPZWljTKvvQsW X-Received: by 2002:a17:902:e5ca:b0:183:88dd:1d34 with SMTP id u10-20020a170902e5ca00b0018388dd1d34mr7696430plf.134.1666172115232; Wed, 19 Oct 2022 02:35:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172115; cv=none; d=google.com; s=arc-20160816; b=m2z5yRoTXSIytz9fHeDqVTo0cjUgE20jsOG0gTIfWBbXOjCm6gapLsohgBU7wNBfpr dD28DDmd9FMazWqAQ2qV0ytQMhbhKLo17NG0N7Yp9zojr7KbsNvRjVIHoMT+AGobko7z 6mZaHefzRAHnwNpetf3Jdok3lNHjdrwFORJc6h20NywU7i4A/YJdrC/ra8CnKzCX8e6u OYQ1G63wRbtl6na8PxXoGsvPS4Xkkae97XsnRKgx8HfmZK/G0xj2cZVrLuHaAHMVqsOd NPfSwXtGjYGlrcb1mh+RDU0oLNwN8UBF4bJhdEy0sH1DuAcqaqbicDmRz+V/eXaNFIkT g7cQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qEKNeIL4HkIK2GQ8U2jYZWfK3ac60MEC36bmrovh++I=; b=iAnJz8aFH3gk6F9QdRXZeGK+1gmlnnsfICdJnuJ8yYVe3Yk4dCdJHcVuuQKLRTfPNA xwP1qlmhCCqFIAHw4aVvZoPq26J17uo5lfDqH86CVwa7ZmtIFrTyaJxQW+qbkBEQfipy JCHx6QXagm/Va7H8yuYuPpvaPoaDTfyaSIuBaHQn+HSGns0h0Q5K7miiTsQaGyo9IAwn wEYxPUr6l8c9xWCM5E2+G3sskbtizig4lcvAb39KOepzqNJD8gzeO3wMH1JnN16tQbGz S37AeIN2R/iw6/Wp8lKkJwBBEIrPZnNufWltdBCoLY9gH6FkoCOjNzsY7igwai0CnJ/d IA6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SDzkrgwQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s187-20020a632cc4000000b0045e96393e37si17643564pgs.20.2022.10.19.02.35.02; Wed, 19 Oct 2022 02:35: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=SDzkrgwQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233308AbiJSJSP (ORCPT + 99 others); Wed, 19 Oct 2022 05:18:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232934AbiJSJP4 (ORCPT ); Wed, 19 Oct 2022 05:15:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6410654D; Wed, 19 Oct 2022 02:06: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 627BC6187F; Wed, 19 Oct 2022 09:06:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78FB0C4347C; Wed, 19 Oct 2022 09:06:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170361; bh=iLfJweqofE4ePh5lC+qqoU4eiN4c6k2V77N1oN0Csjg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SDzkrgwQnXDapFPdh9QMtR881QEw7jGStuap9KEUbFqqY9iDeH+9EsGFuh0BKouOM GOf44V+HbOMw40aLQ+lzKqNDSJnj1M6jAZ9vlyZ87QmtJ52PpbYpZd6pe9u5ueO3YK rh/MgSFLAb4eeYhmXMEe7g2UMgulLnHIe/fVTyZA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, James Cowgill , Herbert Xu , Sasha Levin Subject: [PATCH 6.0 626/862] hwrng: arm-smccc-trng - fix NO_ENTROPY handling Date: Wed, 19 Oct 2022 10:31:53 +0200 Message-Id: <20221019083317.585926624@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108092059424176?= X-GMAIL-MSGID: =?utf-8?q?1747108092059424176?= From: James Cowgill [ Upstream commit 042b4b169c6fb9d4df268d66282d7302dd73d37b ] The SMCCC_RET_TRNG_NO_ENTROPY switch arm is never used because the NO_ENTROPY return value is negative and negative values are handled above the switch by immediately returning. Fix by handling errors using a default arm in the switch. Fixes: 0888d04b47a1 ("hwrng: Add Arm SMCCC TRNG based driver") Signed-off-by: James Cowgill Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/char/hw_random/arm_smccc_trng.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/char/hw_random/arm_smccc_trng.c b/drivers/char/hw_random/arm_smccc_trng.c index b24ac39a903b..e34c3ea692b6 100644 --- a/drivers/char/hw_random/arm_smccc_trng.c +++ b/drivers/char/hw_random/arm_smccc_trng.c @@ -71,8 +71,6 @@ static int smccc_trng_read(struct hwrng *rng, void *data, size_t max, bool wait) MAX_BITS_PER_CALL); arm_smccc_1_1_invoke(ARM_SMCCC_TRNG_RND, bits, &res); - if ((int)res.a0 < 0) - return (int)res.a0; switch ((int)res.a0) { case SMCCC_RET_SUCCESS: @@ -88,6 +86,8 @@ static int smccc_trng_read(struct hwrng *rng, void *data, size_t max, bool wait) return copied; cond_resched(); break; + default: + return -EIO; } } From patchwork Wed Oct 19 08:31:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5605 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp369552wrs; Wed, 19 Oct 2022 07:52:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5rK1IaeR8AvjdJwRGzFtELcS+OOZMf7scUQmyV9AlMu8yso9/QQLqaocb6WahfEdUW62d0 X-Received: by 2002:aa7:de9a:0:b0:44d:8191:44c5 with SMTP id j26-20020aa7de9a000000b0044d819144c5mr7729650edv.232.1666191129378; Wed, 19 Oct 2022 07:52:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666191129; cv=none; d=google.com; s=arc-20160816; b=uBfqZ1x4pYBSaL6Ov1AUxxBJytpMkJRqGv+lzhmpmU/f7UwVHgF9lzy06NRTcVB9Ri zUjYsgpJO4Z6ToiLGVHg3YEX+biRcwstHfOIe5nbLaHNp546rakk4oFTsvLcNpVaCZxR Al85UvKlpfO741Eh7CXVH65k8MddoRxgHJriD9EXyvHNz3okbYKDBHOioTfFranruUb/ WCf0FbIqGmp1l+IAsj3U4fv9DyNRtDSe/d6vNDFrgaHCsjcGRqRmQYjZak9JztqTGDTN EeHGVHz+/iAW3Er0NnHMKr5riWf28CdNJsKDVQIIrFuVCzr8pSNdyNqsEIYpZ5i0RALt NhoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=w6tz0U8UPKbtwhOkHEsa6Qf5NzLol/nzDz/Eru6RGwY=; b=YIhc7n8sfRqg3nknQZXyM7oI89V1Pjh0hwA23EZwQprmbxQ5gstLq+KgXOQ4WdXs+u 16/TH3IcP6iUSyCpgYv8rzeWguuYYXgMqiraoemOFC7g4T2S9M34WzaEDqbsOTHp2adA ldmS3Sr1T80wBcY59zBP8bFmvxI7AJ+nbuwky2IVddBX8Nj6P34pSeDGr9SGW9w2Nd68 dkQFFehBoW8YskFmzarWoJ1DHH1ZiXtZQOckA1IfxD8azkAprnkTL5KJm3CD5Tds4Vii dVQtopZSyNVNknfGZxW2uBRBMRznsC0BLrow+oK5z+qLsjjpS4iFaVZFXTHbLw+QR5K5 zm9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=m9UHvTas; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b15-20020a056402350f00b0044ee4ec8915si16639092edd.39.2022.10.19.07.51.44; Wed, 19 Oct 2022 07:52: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=m9UHvTas; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229944AbiJSOqi (ORCPT + 99 others); Wed, 19 Oct 2022 10:46:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230384AbiJSOqP (ORCPT ); Wed, 19 Oct 2022 10:46:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0260DF5F; Wed, 19 Oct 2022 07:32:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EE6BF6177D; Wed, 19 Oct 2022 09:06:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0EA3EC433D7; Wed, 19 Oct 2022 09:06:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170364; bh=Oez0xSkPvwxIgWUhwxsQd8h6OI5hQd7QDtdeIIXp/vc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m9UHvTasj6dlWCzd90IDPgDcANHzSWjtdkCDTRWS/DolJIYUt/J8VPSxtA09EgxZh elOJJGZnP6bIHBLMV44D7AmG0xBMCayoZZjE/+RCtDaQfJaBQ4EuGdtY4jAAQL4X17 oIdqzIeEOHL5Tm7IYoreYiQnv+EA793zaeK2YdtU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Gonda , kernel test robot , Jacky Li , David Rientjes , Tom Lendacky , Herbert Xu , Sasha Levin Subject: [PATCH 6.0 627/862] crypto: ccp - Fail the PSP initialization when writing psp data file failed Date: Wed, 19 Oct 2022 10:31:54 +0200 Message-Id: <20221019083317.625376706@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747128029910500580?= X-GMAIL-MSGID: =?utf-8?q?1747128029910500580?= From: Jacky Li [ Upstream commit efb4b01c1c993d245e6608076684ff2162cf9dc6 ] Currently the OS continues the PSP initialization when there is a write failure to the init_ex_file. Therefore, the userspace would be told that SEV is properly INIT'd even though the psp data file is not updated. This is problematic because later when asked for the SEV data, the OS won't be able to provide it. Fixes: 3d725965f836 ("crypto: ccp - Add SEV_INIT_EX support") Reported-by: Peter Gonda Reported-by: kernel test robot Signed-off-by: Jacky Li Acked-by: David Rientjes Acked-by: Tom Lendacky Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/ccp/sev-dev.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/drivers/crypto/ccp/sev-dev.c b/drivers/crypto/ccp/sev-dev.c index 9f588c9728f8..6c49e6d06114 100644 --- a/drivers/crypto/ccp/sev-dev.c +++ b/drivers/crypto/ccp/sev-dev.c @@ -231,7 +231,7 @@ static int sev_read_init_ex_file(void) return 0; } -static void sev_write_init_ex_file(void) +static int sev_write_init_ex_file(void) { struct sev_device *sev = psp_master->sev_data; struct file *fp; @@ -241,14 +241,16 @@ static void sev_write_init_ex_file(void) lockdep_assert_held(&sev_cmd_mutex); if (!sev_init_ex_buffer) - return; + return 0; fp = open_file_as_root(init_ex_path, O_CREAT | O_WRONLY, 0600); if (IS_ERR(fp)) { + int ret = PTR_ERR(fp); + dev_err(sev->dev, - "SEV: could not open file for write, error %ld\n", - PTR_ERR(fp)); - return; + "SEV: could not open file for write, error %d\n", + ret); + return ret; } nwrite = kernel_write(fp, sev_init_ex_buffer, NV_LENGTH, &offset); @@ -259,18 +261,20 @@ static void sev_write_init_ex_file(void) dev_err(sev->dev, "SEV: failed to write %u bytes to non volatile memory area, ret %ld\n", NV_LENGTH, nwrite); - return; + return -EIO; } dev_dbg(sev->dev, "SEV: write successful to NV file\n"); + + return 0; } -static void sev_write_init_ex_file_if_required(int cmd_id) +static int sev_write_init_ex_file_if_required(int cmd_id) { lockdep_assert_held(&sev_cmd_mutex); if (!sev_init_ex_buffer) - return; + return 0; /* * Only a few platform commands modify the SPI/NV area, but none of the @@ -285,10 +289,10 @@ static void sev_write_init_ex_file_if_required(int cmd_id) case SEV_CMD_PEK_GEN: break; default: - return; + return 0; } - sev_write_init_ex_file(); + return sev_write_init_ex_file(); } static int __sev_do_cmd_locked(int cmd, void *data, int *psp_ret) @@ -361,7 +365,7 @@ static int __sev_do_cmd_locked(int cmd, void *data, int *psp_ret) cmd, reg & PSP_CMDRESP_ERR_MASK); ret = -EIO; } else { - sev_write_init_ex_file_if_required(cmd); + ret = sev_write_init_ex_file_if_required(cmd); } print_hex_dump_debug("(out): ", DUMP_PREFIX_OFFSET, 16, 2, data, From patchwork Wed Oct 19 08:31:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5230 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp266175wrs; Wed, 19 Oct 2022 04:24:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7I9YWcVQ8qmL7IcGgAkTL2rT8iS+04oRXNNM8vrjyAy+xf5LoJkGDW1HBBsSeFvm4yYp6A X-Received: by 2002:a05:6402:27c7:b0:45d:45f0:e6c4 with SMTP id c7-20020a05640227c700b0045d45f0e6c4mr6846296ede.325.1666178643264; Wed, 19 Oct 2022 04:24:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178643; cv=none; d=google.com; s=arc-20160816; b=nIZYmO4T/NNSijCviw/23ohM2gSV4Pcmb/5WnfvQB6Za9It+PX5DatwjbFpkPkC3xk D4qknBL10o2cGkjywNeXo7Z38q68vqDU9FcSArkEurP+6YAEuyBhAsXAY2QeD+q7NAfv 5zX53u9snSd8SRYqMrvmYTl1ArfOTSPeSWfqooRlBFXK8cI4MvNwQYrqmLLpQTVyuz+/ wPvPAPdwKYwFuJ5JR+3JtwlkXP5QkW161P0XLdg2rFoC+z9I4Ng4bCuSo7xQdWLW4aC4 xeLdmVyJ0vIqQjk9CI6qdPOyGq2EPZ45ZGlfD9ZnxBnmQQAxFdqj3xm7n9Ktip9gh1hH 9r1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sbOb4dJcVuy57BmWxmthd6B9PNMKKzmA8068V8/2l40=; b=CgPHucs0Ypq5CcEMq1itFA23Fzw1pqX1n1UXveEnunfuB0imD8oxxLYxbgRl0n2lJo a9szKe174UqD5AuOYSBKt8QGMN088Wi/IC2nIHiTT9i/p7YUbzEpr4D/15JslEiBT2/P 3TVsrxWzioKNV46o1L59Oqi1sHSAH4rQNPB0IOYxAdt8KzHCCzbYhPgIA6tAuC4bNbH/ htQXSrDDQjljCgw9F/mnhGMVEndyyaJv3sBEV0corubFBJFurso6JCYAfDe5ldZbodO8 fwd6Q+CEX3RNyjIFyc4NQtz3PEgDbAJBeA51rvLVvTWEIC9rWmyiL+JpJ67ESv/MrDGM tVaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oVHMpOdC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j9-20020a05640211c900b0045db850a506si6259675edw.46.2022.10.19.04.23.35; Wed, 19 Oct 2022 04:24: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=oVHMpOdC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230107AbiJSLLX (ORCPT + 99 others); Wed, 19 Oct 2022 07:11:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232978AbiJSLKI (ORCPT ); Wed, 19 Oct 2022 07:10:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8239152C49; Wed, 19 Oct 2022 03:38: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 01315B82333; Wed, 19 Oct 2022 09:06:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 580A5C433D6; Wed, 19 Oct 2022 09:06:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170369; bh=I/XUHacc8FBmkhRg2IdQdCttKWx2Fpa5yIMG9Xa+66c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oVHMpOdCx78pcRVncNszUqy/vP63O0kUDlry+tS+WQ8VEySAJl/9W0o+W0Rv3tCVP 0LbgFV2j8bQm2r8R581Exkkh1ssswJDEVF1VxLPasMLADUsfPJs3duR8BNqyFjVN1R 5Al4bF5EDZYyFhn6NjGa/SBNOnJ5Dhn4tf8pBfLo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Michal_Koutn=C3=BD?= , Tejun Heo , Sasha Levin Subject: [PATCH 6.0 628/862] cgroup: Honor callers cgroup NS when resolving path Date: Wed, 19 Oct 2022 10:31:55 +0200 Message-Id: <20221019083317.668836387@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114936797597058?= X-GMAIL-MSGID: =?utf-8?q?1747114936797597058?= From: Michal Koutný [ Upstream commit 74e4b956eb1cac0e4c10c240339b1bbfbc9a4c48 ] cgroup_get_from_path() is not widely used function. Its callers presume the path is resolved under cgroup namespace. (There is one caller currently and resolving in init NS won't make harm (netfilter). However, future users may be subject to different effects when resolving globally.) Since, there's currently no use for the global resolution, modify the existing function to take cgroup NS into account. Fixes: a79a908fd2b0 ("cgroup: introduce cgroup namespaces") Signed-off-by: Michal Koutný Signed-off-by: Tejun Heo Signed-off-by: Sasha Levin --- kernel/cgroup/cgroup.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index 5f2090d051ac..29296a6374ef 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -6638,8 +6638,12 @@ struct cgroup *cgroup_get_from_path(const char *path) { struct kernfs_node *kn; struct cgroup *cgrp = ERR_PTR(-ENOENT); + struct cgroup *root_cgrp; - kn = kernfs_walk_and_get(cgrp_dfl_root.cgrp.kn, path); + spin_lock_irq(&css_set_lock); + root_cgrp = current_cgns_cgroup_from_root(&cgrp_dfl_root); + kn = kernfs_walk_and_get(root_cgrp->kn, path); + spin_unlock_irq(&css_set_lock); if (!kn) goto out; From patchwork Wed Oct 19 08:31:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4973 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp227004wrs; Wed, 19 Oct 2022 02:47:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6CXV3sIfA2zvpZTH6sdjTFj+Cy2UrXcHsG0FA/8wELwdkmF7cDP5FWzAt4InKEvMlDn9W9 X-Received: by 2002:a63:4a4b:0:b0:439:837:cc8d with SMTP id j11-20020a634a4b000000b004390837cc8dmr6517388pgl.199.1666172851534; Wed, 19 Oct 2022 02:47:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172851; cv=none; d=google.com; s=arc-20160816; b=Otpq5JehvUBn44uLRA6bYKiqplOlqOidLRLiVCx4QfoZxASwvyLC1zg0L6GpaGJA+k h9J26Eh2ll/lfah4CxBSxswpwLKP908WhuyU8KqolmVS66t6Cce3F44BfYLkGBOQ7Aqb dCSGE96zuA78RjyMhia9xWfnBi1ZuhPaNRvHcj30Z8dSmZbBI2ZQqMQiXT/oksY9tzfY 06+aJNFxndVO110tDofeZkdM5nAw2oQj3YauemlMeZwOloWiu6Q1r42hgM9NZhbL4LTw KjTITw8awW1eRjtUb0ih+CFAHUVMwUkh77JNKQEFsopizpuxkxjwtvkuFH6o1wx8hW87 7IaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0fPCNKgkZiaLZKf38BTWUjY+CZaIbrEobHdeYN018Wk=; b=nOlKW7EWNtqjgKg/pZQ6vm0IsUURacpANYxNfWF5IAHHWn6QM4lblliMp3BD/Bp89X WZ52Vjn9o/Igu3D0DvmheqFNfXJw7c0TzZ2ULIUiXfgbwZbcDm+mMPCyErqihuaZOQ9Z vMI9fRdIeqKM3JmDxlC6pvDFLvdmjJWstfnR8s1EpuSEGedFSGgKbcQTu8Mpr9DvvDuk eif44YiEkpdYibNRW9NvTxQlapT7Adst2/XVz2GRLWjEHrWFoQo4DL77QOhn2Mif/0bO sKMy/cW+F1Vk6mPctpOK4Qk1dXDrqSDefxZP7fM2jILwBwpSu2VpA9Wp3Z0MHicYOp0y lmCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VPxriR0+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 36-20020a631364000000b0042b438eeee1si17146325pgt.148.2022.10.19.02.47.17; Wed, 19 Oct 2022 02:47: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=VPxriR0+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234583AbiJSJoe (ORCPT + 99 others); Wed, 19 Oct 2022 05:44:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234769AbiJSJlU (ORCPT ); Wed, 19 Oct 2022 05:41:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97A74D57D9; Wed, 19 Oct 2022 02:18: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 CDE0661877; Wed, 19 Oct 2022 09:06:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E131BC433D7; Wed, 19 Oct 2022 09:06:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170372; bh=nHR/2PbanmSV3Ke5Rq57L14m7CqYrrb0pFEQAy9U4aQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VPxriR0+GRM9We3c8DXyhSfylhWOwegKTb1KzR/nXRxWH6cgcH0KQlm/0k1bK3aTT F3oR47LrWgxVUeiIlpIx8nNpYoscob+ZVwvBE34dD3ZvMM2U/r1R4hG2QF0cIJX+kt p5rajRMog6is9YMdemr3iSqC21/9LgNf0dt/egp8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Martin Kaiser , Herbert Xu , Sasha Levin Subject: [PATCH 6.0 629/862] hwrng: imx-rngc - use devm_clk_get_enabled Date: Wed, 19 Oct 2022 10:31:56 +0200 Message-Id: <20221019083317.708239220@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108863886320171?= X-GMAIL-MSGID: =?utf-8?q?1747108863886320171?= From: Martin Kaiser [ Upstream commit 6a2bc448423cea44e7dba0f72d7c82ae04ab201e ] Use the new devm_clk_get_enabled function to get our clock. We don't have to disable and unprepare the clock ourselves any more in error paths and in the remove function. Signed-off-by: Martin Kaiser Signed-off-by: Herbert Xu Stable-dep-of: 10a2199caf43 ("hwrng: imx-rngc - Moving IRQ handler registering after imx_rngc_irq_mask_clear()") Signed-off-by: Sasha Levin --- drivers/char/hw_random/imx-rngc.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/drivers/char/hw_random/imx-rngc.c b/drivers/char/hw_random/imx-rngc.c index b05d676ca814..e32c52c10d4d 100644 --- a/drivers/char/hw_random/imx-rngc.c +++ b/drivers/char/hw_random/imx-rngc.c @@ -245,7 +245,7 @@ static int imx_rngc_probe(struct platform_device *pdev) if (IS_ERR(rngc->base)) return PTR_ERR(rngc->base); - rngc->clk = devm_clk_get(&pdev->dev, NULL); + rngc->clk = devm_clk_get_enabled(&pdev->dev, NULL); if (IS_ERR(rngc->clk)) { dev_err(&pdev->dev, "Can not get rng_clk\n"); return PTR_ERR(rngc->clk); @@ -255,26 +255,20 @@ static int imx_rngc_probe(struct platform_device *pdev) if (irq < 0) return irq; - ret = clk_prepare_enable(rngc->clk); - if (ret) - return ret; - ver_id = readl(rngc->base + RNGC_VER_ID); rng_type = ver_id >> RNGC_TYPE_SHIFT; /* * This driver supports only RNGC and RNGB. (There's a different * driver for RNGA.) */ - if (rng_type != RNGC_TYPE_RNGC && rng_type != RNGC_TYPE_RNGB) { - ret = -ENODEV; - goto err; - } + if (rng_type != RNGC_TYPE_RNGC && rng_type != RNGC_TYPE_RNGB) + return -ENODEV; ret = devm_request_irq(&pdev->dev, irq, imx_rngc_irq, 0, pdev->name, (void *)rngc); if (ret) { dev_err(rngc->dev, "Can't get interrupt working.\n"); - goto err; + return ret; } init_completion(&rngc->rng_op_done); @@ -294,14 +288,14 @@ static int imx_rngc_probe(struct platform_device *pdev) ret = imx_rngc_self_test(rngc); if (ret) { dev_err(rngc->dev, "self test failed\n"); - goto err; + return ret; } } ret = hwrng_register(&rngc->rng); if (ret) { dev_err(&pdev->dev, "hwrng registration failed\n"); - goto err; + return ret; } dev_info(&pdev->dev, @@ -309,11 +303,6 @@ static int imx_rngc_probe(struct platform_device *pdev) rng_type == RNGC_TYPE_RNGB ? 'B' : 'C', (ver_id >> RNGC_VER_MAJ_SHIFT) & 0xff, ver_id & 0xff); return 0; - -err: - clk_disable_unprepare(rngc->clk); - - return ret; } static int __exit imx_rngc_remove(struct platform_device *pdev) @@ -322,8 +311,6 @@ static int __exit imx_rngc_remove(struct platform_device *pdev) hwrng_unregister(&rngc->rng); - clk_disable_unprepare(rngc->clk); - return 0; } From patchwork Wed Oct 19 08:31:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4830 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223622wrs; Wed, 19 Oct 2022 02:38:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6C+sR7KmTnRNZoSHxuKtZf5R+97hPbChwbnnzqsp6VfZBVkN4x+S+OFamKLJLw/s8ERJ2x X-Received: by 2002:a17:907:7ea7:b0:78d:3638:9018 with SMTP id qb39-20020a1709077ea700b0078d36389018mr6032632ejc.236.1666172280728; Wed, 19 Oct 2022 02:38:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172280; cv=none; d=google.com; s=arc-20160816; b=qbkftZp3UKR9x/WC2JwATsQ2IMeKfGdmR6Wm99+UdSPRwgBuDXfJN5SZUXOopr+CTn K/s4fmCEqCNvLsiYUoUN0Q5xEYvIFvsmMvy9A3enzZTiDY2armyJSMppOkpMRW8f0EdJ +aGRELfuWC2NrGKIPkRznRT7ghi7vLzZ/VTUJOtcL0FqByh8pR8OTvB1WNrSAJiJT3Mx YUihnDHEjOx5dPNN+MwBxJL2YoRDg9/Vxk8qItnD11NhtUO2J4mxx8Wkhu5Mw9Gz6DD/ hse001k42MRxIzj4FZJjpFTM9UGIyXY3RpTbQbI7agRzofLt6qonbvm2rrEh2WNw7JKf nPog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ozLVy1CgApgNt3QZ7JMAPj/clpIJeiVW0/EckVIzKuk=; b=lAwa+PjSg62KBuIMdYOtILSal/5iY6zN1jRTo+yP2DW33Ks29JqkPGV7blj+iom7gK WCsmhhpwp4c7U1CAWlh8S8KTMA5IqPeNYS1qHR75QTnP4BpEiHmYNes10bo60S1ns31j IsRf3laigXaOY3GgCIVkGWIjodgpw+YoiAL2dvUda+TJCLz08oBsjq/1hg8ycGKnjNlW NBPB5rqK/kqYCHqbYN0edosXentDmW+KN+KlvftlcWRZkbDsp5HHhd3K7a1RQujDsEaM M5E0SYwa0xRgadzGSh/NNaVc/Y5vYzCxTMP8Djrpn/Br4lz6rcB6RBT3/yzOCKqdrpb7 tsFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=o3ldRHvF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e14-20020a50a68e000000b0045cba2d74c3si12603487edc.541.2022.10.19.02.37.32; Wed, 19 Oct 2022 02:38: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=o3ldRHvF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233495AbiJSJXw (ORCPT + 99 others); Wed, 19 Oct 2022 05:23:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233083AbiJSJXH (ORCPT ); Wed, 19 Oct 2022 05:23: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 5E110B6008; Wed, 19 Oct 2022 02:10:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id A8D98CE2175; Wed, 19 Oct 2022 09:06:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8902DC433B5; Wed, 19 Oct 2022 09:06:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170374; bh=3qOQ4Jb42O8ZGVhsLpe/7X8WWC3+fEostx++8jWyCwQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o3ldRHvFzgiycj4IgLirOPXUKCGuPua8JBsK8BRFEmqh1A+WJXUOgTEcWxNeWZIrE EYdMry0sYcRETf/xUYgrVKz5d1CsG1I0gY8xmyGv34tDMzwNRsbuFO2TRL7f857PFH vV1liarTdXdaZ9jlE0jnBEaxIjIpP0iWTiehaQPs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kshitiz Varshney , Herbert Xu , Sasha Levin Subject: [PATCH 6.0 630/862] hwrng: imx-rngc - Moving IRQ handler registering after imx_rngc_irq_mask_clear() Date: Wed, 19 Oct 2022 10:31:57 +0200 Message-Id: <20221019083317.756212832@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108265376757885?= X-GMAIL-MSGID: =?utf-8?q?1747108265376757885?= From: Kshitiz Varshney [ Upstream commit 10a2199caf437e893d9027d97700b3c6010048b7 ] Issue: While servicing interrupt, if the IRQ happens to be because of a SEED_DONE due to a previous boot stage, you end up completing the completion prematurely, hence causing kernel to crash while booting. Fix: Moving IRQ handler registering after imx_rngc_irq_mask_clear() Fixes: 1d5449445bd0 (hwrng: mx-rngc - add a driver for Freescale RNGC) Signed-off-by: Kshitiz Varshney Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/char/hw_random/imx-rngc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/char/hw_random/imx-rngc.c b/drivers/char/hw_random/imx-rngc.c index e32c52c10d4d..1d7ce7443586 100644 --- a/drivers/char/hw_random/imx-rngc.c +++ b/drivers/char/hw_random/imx-rngc.c @@ -264,13 +264,6 @@ static int imx_rngc_probe(struct platform_device *pdev) if (rng_type != RNGC_TYPE_RNGC && rng_type != RNGC_TYPE_RNGB) return -ENODEV; - ret = devm_request_irq(&pdev->dev, - irq, imx_rngc_irq, 0, pdev->name, (void *)rngc); - if (ret) { - dev_err(rngc->dev, "Can't get interrupt working.\n"); - return ret; - } - init_completion(&rngc->rng_op_done); rngc->rng.name = pdev->name; @@ -284,6 +277,13 @@ static int imx_rngc_probe(struct platform_device *pdev) imx_rngc_irq_mask_clear(rngc); + ret = devm_request_irq(&pdev->dev, + irq, imx_rngc_irq, 0, pdev->name, (void *)rngc); + if (ret) { + dev_err(rngc->dev, "Can't get interrupt working.\n"); + return ret; + } + if (self_test) { ret = imx_rngc_self_test(rngc); if (ret) { From patchwork Wed Oct 19 08:31:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4812 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp219321wrs; Wed, 19 Oct 2022 02:25:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5n97jylWeZUpSo8NA4XOOHIWbwKHhOMhDzNLaytwKIPoIobvuOe3kLRAUxs37l1LVUo9+x X-Received: by 2002:a17:90b:1d8a:b0:20f:95f9:ff34 with SMTP id pf10-20020a17090b1d8a00b0020f95f9ff34mr8075677pjb.227.1666171535752; Wed, 19 Oct 2022 02:25:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666171535; cv=none; d=google.com; s=arc-20160816; b=o1T/VIgxtK6jNwPCp8Hw2KA1647o4A1+x5dDnZIf66yFIwjH5GRxDdkMKvvQ7caoqo w895S7vmEoZWVpTZHbLovkVG6gS0BXBxoqGJOJ2P093XePzqPEXOVlH6MyfueDYihwJP +dwKya5TIWq/vs4ZWPbhjJ8fN4HXJUF8/sp0xRFzIE1mNShK1t/uc1PF8Z3Qydu1sMhn 3jVkY+kzwhnOsoXhyPud/P1O/SL5YlndDqsoYlQi9w7lZSLdSVb1xR0pXGwOxxV19y3r sWdE0qaWR02WVEYU7zDURW9eSYDW4Xr15+W1LppYUfHbYb15lxvM4qdAnxIf84KUO9TC vsfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=eBp7S9F95/JHolxKOxyqCzhzhLPacV4tuaEw9EH8h54=; b=bkvVd25InOzl1/oOZbuAsddv5OE72vKfCRSf/jmUq7tMojFdHEmvD4uNFbHvge1Zuw wjgltnHk6U/31tmWEEzcUChwVDd7FqrVH6TO4qjEsQ8etM8qLOqNADmMV9wNpok/ZW76 Hp3Hemais1dEfZy5W4ZA/mSHEGuo6Amsj9NVBCBTual1qx6k7Wfzcd+Lds8PkSH+GeZB 1/Mt4wv8miBL/7k9Ux5VZM7Q0R7dbtKpweHaDZRxq6idVEgw39cYFHPo2hH62uS4+VqX sZD9ZbuVWOL4pJOVb++aNSJifcYLwmSkdCliksftpECXcPaekA5zxqUKMw/3Yugkf28T Fu4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PHplZGMR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z7-20020aa78887000000b005639db953adsi19511514pfe.68.2022.10.19.02.25.22; Wed, 19 Oct 2022 02:25: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=PHplZGMR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233313AbiJSJSS (ORCPT + 99 others); Wed, 19 Oct 2022 05:18:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233156AbiJSJQT (ORCPT ); Wed, 19 Oct 2022 05:16:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C30CA59AE; Wed, 19 Oct 2022 02:06: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 1531C61825; Wed, 19 Oct 2022 09:06:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 23D00C433D6; Wed, 19 Oct 2022 09:06:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170377; bh=vujw5cF2w9ojqX9/fEY6xpNzZwk1Hc103xQkPvbWCdM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PHplZGMRdqviz9Kqjff3VWgHRkS2QPIi4Uj1PjTOtguDUJJMD080DuZZlDsyl77Pl o+YJwzypXWgzM42YU7lnAKfmWn3w9ZQBrbcJ9sPEcYL0hlGSi0PI8jJkA4S5SubYdu tvJw8qCEJunnkg80tF5x9xdEYl+S7ZdZ/JIIZDcc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Giovanni Cabiddu , Lucas Segarra Fernandez , Herbert Xu , Sasha Levin Subject: [PATCH 6.0 631/862] crypto: qat - fix default value of WDT timer Date: Wed, 19 Oct 2022 10:31:58 +0200 Message-Id: <20221019083317.803319512@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747107484168512946?= X-GMAIL-MSGID: =?utf-8?q?1747107484168512946?= From: Lucas Segarra Fernandez [ Upstream commit cc40b04c08400d86d2d6ea0159e0617e717f729c ] The QAT HW supports an hardware mechanism to detect an accelerator hang. The reporting of a hang occurs after a watchdog timer (WDT) expires. The value of the WDT set previously was too small and was causing false positives. Change the default value of the WDT to 0x7000000ULL to avoid this. Fixes: 1c4d9d5bbb5a ("crypto: qat - enable detection of accelerators hang") Reviewed-by: Giovanni Cabiddu Signed-off-by: Lucas Segarra Fernandez Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/qat/qat_common/adf_gen4_hw_data.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/qat/qat_common/adf_gen4_hw_data.h b/drivers/crypto/qat/qat_common/adf_gen4_hw_data.h index 43b8f864806b..4fb4b3df5a18 100644 --- a/drivers/crypto/qat/qat_common/adf_gen4_hw_data.h +++ b/drivers/crypto/qat/qat_common/adf_gen4_hw_data.h @@ -107,7 +107,7 @@ do { \ * Timeout is in cycles. Clock speed may vary across products but this * value should be a few milli-seconds. */ -#define ADF_SSM_WDT_DEFAULT_VALUE 0x200000 +#define ADF_SSM_WDT_DEFAULT_VALUE 0x7000000ULL #define ADF_SSM_WDT_PKE_DEFAULT_VALUE 0x8000000 #define ADF_SSMWDTL_OFFSET 0x54 #define ADF_SSMWDTH_OFFSET 0x5C From patchwork Wed Oct 19 08:31:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5196 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp264079wrs; Wed, 19 Oct 2022 04:19:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6yRksjrtYS2jY9hKJiSq+U+yIL4/y+TTE3FSK+p5BjgZuZhrDyXVBlJdkL+ZAYNmp9W7gc X-Received: by 2002:a17:907:7b95:b0:731:113a:d7a2 with SMTP id ne21-20020a1709077b9500b00731113ad7a2mr6003514ejc.377.1666178359781; Wed, 19 Oct 2022 04:19:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178359; cv=none; d=google.com; s=arc-20160816; b=E6zls3fR45Xn//KPHXqWUOVyq0YICHXoQ3Axp25JnOyiRK0daTJz0Exc0zJPCIS1D0 Saqx1MhtrN6lJK3FzDHzT1EP6ww+Uz5ZLNWK5sO2ZfGX1qeRyieyWJEyBYUWygTBVUiN Ko5mpCG6WugXk5HspP5c3zQ53LzdbTvpmnqVzgqDsRXq4DtShoCsz/haqjqLQULtXlPK TL9RaQ+rPn01HQ6iYXYhrxIoOCA2yKZgUYnJaaWlMvhXGEMu4PWQoYJcrg+j1baCqdEm I545C5/K/HKHSs2BHh4hSEuBOHrvS+v61EPJYnUrkhJJUFqPdhbW2jnzo0ApR8LVpi2T ApJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hkS6lt0tSUmOCBE/qe8xCvEGIF09qTogxUNedvXX42U=; b=XXduta/UMJZJ0uC1SK0kG7kOjl8CYX/ApxIs2jfJy96bRkB3zwLggPMLI5rKlzqoWl x6g447QpIrDYMdYqlUuxS+V3QShQu8mLwXmXarqDlaGv08NmuAC2thOh55vtMOB/cw+I puchrAApalbBPaQrIpIhI63yaxz/aDlHUM6ySYSlbKQl7x6pstIcFn0KvayTn+CA9gj5 0hnccGsf/QWpikaGpqGinIMzncq/zOpIyexLeTqKVJ/qEmNAciLLpV8RG11TKaiexR7l bf4z+UgL36HD6v0/jGgypFgGqm2k7uRuC76atsN1sgr6zib+ny5gcMyAU6oEwVBQu3Wl GZGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bEDtTLHP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a05640250cd00b00458ac23f0b8si16427490edb.399.2022.10.19.04.18.45; Wed, 19 Oct 2022 04:19:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bEDtTLHP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230059AbiJSLIn (ORCPT + 99 others); Wed, 19 Oct 2022 07:08:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230315AbiJSLIZ (ORCPT ); Wed, 19 Oct 2022 07:08:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF8A517C54B; Wed, 19 Oct 2022 03:37: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 59B99B82330; Wed, 19 Oct 2022 09:06:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A85EBC433D6; Wed, 19 Oct 2022 09:06:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170380; bh=OgPtLTEGfETYUPU1GzT7ZQ6ful3QMszIFbtSxZ1yJ50=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bEDtTLHPgcTPK0K9Ey5nzF55l7+jGtBDWS56g2ZwsBiDiYjLUeyit8Ue5YYoUb2uT etB7L2Z+DY0QtBHHIYsV/yX1Rr/527NoKhNkxhOw0Ckb1W4Vun5fgnkMhXwpX/I/Uh WBbGSYio/g/jsaJ/7ExKjBaVMezNNvY/X7PGvUs8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Weili Qian , Herbert Xu , Sasha Levin Subject: [PATCH 6.0 632/862] crypto: hisilicon/qm - fix missing put dfx access Date: Wed, 19 Oct 2022 10:31:59 +0200 Message-Id: <20221019083317.852065606@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114639734512846?= X-GMAIL-MSGID: =?utf-8?q?1747114639734512846?= From: Weili Qian [ Upstream commit 5afc904f443de2afd31c4e0686ba178beede86fe ] In function qm_cmd_write(), if function returns from branch 'atomic_read(&qm->status.flags) == QM_STOP', the got dfx access is forgotten to put. Fixes: 607c191b371d ("crypto: hisilicon - support runtime PM for accelerator device") Signed-off-by: Weili Qian Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/hisilicon/qm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c index ad83c194d664..9fa2efe60153 100644 --- a/drivers/crypto/hisilicon/qm.c +++ b/drivers/crypto/hisilicon/qm.c @@ -2245,8 +2245,10 @@ static ssize_t qm_cmd_write(struct file *filp, const char __user *buffer, return ret; /* Judge if the instance is being reset. */ - if (unlikely(atomic_read(&qm->status.flags) == QM_STOP)) - return 0; + if (unlikely(atomic_read(&qm->status.flags) == QM_STOP)) { + ret = 0; + goto put_dfx_access; + } if (count > QM_DBG_WRITE_LEN) { ret = -ENOSPC; From patchwork Wed Oct 19 08:32:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5467 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp332045wrs; Wed, 19 Oct 2022 06:38:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM56of7poFnw4TTQyZLiaOlhqVA9ZIZen/ctPioD3oy8n7tvrZTLc8MHKAFSVZyKwT8zNNvM X-Received: by 2002:a17:902:e748:b0:180:b0d:7b43 with SMTP id p8-20020a170902e74800b001800b0d7b43mr8434191plf.12.1666186682786; Wed, 19 Oct 2022 06:38:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666186682; cv=none; d=google.com; s=arc-20160816; b=EZZYRuKzjKKxjDgbF6CkfMTJZYQWavS6daOBaEU81Wp6OX4XjDLKlDpCDXEPi65OSJ JMv+4tBLoTuddx0mPJlDDP0fT57H0Sg27bsOURHS6u9wXoH7n25fn3MtWKgw7ryCOkWU SGcbegpPEmL3dEhRSCY0o6T1Hw2l9+vxBBdSzbmZ78fJcDQ9xnvfZY+gQmGjYlySP0rs qpjVh0723l21KFlfUdEpjmjYqpidW1ewuVaaZhPbiBR4BvrIdAERs7JpMMOobeftKwCW vFlKGSGHgBpxv+7Hl3cgxpifPOlSIFeRy1wz3pCxbr36DOMO0XiDo97QOcF3SdlIQOUS wG3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Zpv7QTHXImhI1udXCUjWDwKjVaTo65+gR5Rq4s7msoY=; b=yk9pvuFXSgNfVU7mpkB/3M6odU4oS2uNmdsx3zhbxwV3eGBPA9Gui2yZg5zIr629pz VxW/NxoAsF5go269jZjjv3/qSzaK98kBFHIqmK6m5kgQwvCLv1PMROpeiZY3hSMybgta 4ofYAiEXnBqwETHEk66M9iClz0ZY1ctBVFGQzftIwN5rNPLnXeE5VIGuUOmzMkvEifPr 8oVqqcjQFb1e2AWNivxJ2nqCjmEhwYvjzWsaRG0V/xL2C8g8VAytl8fyHeNqm2rPZM2w QFaZ/hn5+MEJIR3mnjJ3wm747dXLHbDePZlw1NT+mxuQIV4tKVk5O+vsknDNCYBQcBQm RbBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FPpydNgL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cp8-20020a056a00348800b00565de49c23dsi15771563pfb.105.2022.10.19.06.37.49; Wed, 19 Oct 2022 06:38: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=FPpydNgL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229751AbiJSNdo (ORCPT + 99 others); Wed, 19 Oct 2022 09:33:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231440AbiJSNdb (ORCPT ); Wed, 19 Oct 2022 09:33:31 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CFF318DAAA; Wed, 19 Oct 2022 06:21:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 452FDCE2180; Wed, 19 Oct 2022 09:06:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43972C433D7; Wed, 19 Oct 2022 09:06:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170382; bh=cWRamBsDNvVDBJ3mqQVRbJszxwtXNpzWGuAkpTyTjgE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FPpydNgLf5yW54q/TgUcDrQ2uf7W5FiSxkNDEe0L/7jRs17ZqgC60VZUx3a1lUHxt Fl9iznih5SC5e/4SudnyMtwz7+atdMlEJ/eklAhe3vrD3JmP6ykFHzmXlhGi72657h Z8ud8QQqh2D05VutxGkMFIxsB1eTTPToQxW9mUb8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Waiman Long , Tejun Heo , Sasha Levin Subject: [PATCH 6.0 633/862] cgroup/cpuset: Enable update_tasks_cpumask() on top_cpuset Date: Wed, 19 Oct 2022 10:32:00 +0200 Message-Id: <20221019083317.900394427@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123366808091344?= X-GMAIL-MSGID: =?utf-8?q?1747123366808091344?= From: Waiman Long [ Upstream commit ec5fbdfb99d18482619ac42605cb80fbb56068ee ] Previously, update_tasks_cpumask() is not supposed to be called with top cpuset. With cpuset partition that takes CPUs away from the top cpuset, adjusting the cpus_mask of the tasks in the top cpuset is necessary. Percpu kthreads, however, are ignored. Fixes: ee8dde0cd2ce ("cpuset: Add new v2 cpuset.sched.partition flag") Signed-off-by: Waiman Long Signed-off-by: Tejun Heo Signed-off-by: Sasha Levin --- kernel/cgroup/cpuset.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index 1f3a55297f39..50bf837571ac 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -1127,10 +1128,18 @@ static void update_tasks_cpumask(struct cpuset *cs) { struct css_task_iter it; struct task_struct *task; + bool top_cs = cs == &top_cpuset; css_task_iter_start(&cs->css, 0, &it); - while ((task = css_task_iter_next(&it))) + while ((task = css_task_iter_next(&it))) { + /* + * Percpu kthreads in top_cpuset are ignored + */ + if (top_cs && (task->flags & PF_KTHREAD) && + kthread_is_per_cpu(task)) + continue; set_cpus_allowed_ptr(task, cs->effective_cpus); + } css_task_iter_end(&it); } @@ -2092,12 +2101,7 @@ static int update_prstate(struct cpuset *cs, int new_prs) update_flag(CS_CPU_EXCLUSIVE, cs, 0); } - /* - * Update cpumask of parent's tasks except when it is the top - * cpuset as some system daemons cannot be mapped to other CPUs. - */ - if (parent != &top_cpuset) - update_tasks_cpumask(parent); + update_tasks_cpumask(parent); if (parent->child_ecpus_count) update_sibling_cpumasks(parent, cs, &tmpmask); From patchwork Wed Oct 19 08:32:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5498 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp336090wrs; Wed, 19 Oct 2022 06:46:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4kw4XwtHV+V3ln26RBL8TlH9TpTXmFzC6CUsOE+nKoSivBTWmnMAmpCrfc0EO1+Hvikl6Q X-Received: by 2002:a17:902:d2cc:b0:182:d901:5d28 with SMTP id n12-20020a170902d2cc00b00182d9015d28mr8837705plc.142.1666187182139; Wed, 19 Oct 2022 06:46:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666187182; cv=none; d=google.com; s=arc-20160816; b=Qkfg9lBKlNjEYuEP9QDeHD9UA83mYy9Gtx1iFvNhDEjLJShlt5xd1F+Lpjcgh8RbXY Cccw9pDyEtoVsoiIiBY5H/e6utkPsndHJCAVibXnZQhA0VwVAuO6YnqhDXtjVM2MIU0m vq2gjCtKczkbz4K7pNTmxpWWZSlQdvctRVf2JVaqgWB7w6trF248hZTgiCaOJyVr+yTQ HANoWTG6Zv7bb61MVyQ1FE9JLhlVcBW5Rc1R+4lqQ2wDE2qioGUNbb0KWOOPYB8JhskM y39GNI4gWRLzdWD02R3wn/4iGExifFS8c4zhN0XkzQMctPDBL8FQjQUwFrKbRNkY/5eK y63Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Re463ur1U2wiu9FBcNtMjBkF7WpIaychu4lKxQTsQLs=; b=C23GTLiQpXVQCVwZq0TbYxVu3Mk8YxdxTxrWVaH1+dOxe7bQShO6s4bdI1zduCoxwZ u1VsYG6DTwVUbgAJH44jy7M2/43PzPq4qqcOBGSozcFshpiFJULuqcZTCQn8I7fkPNTH WeQUjntxDaRH8iQ7RDQcuZtMEIDJpvVVnAWWFqvc37VDO5CUeU68MAFZQ83EEP3MRKim jJzxhw36LUzTVYKCrsQMxzRx1A4FbTXgk+vPh1g5/YYybAm4rOSFCMYkoUu0OlAzQxBO PzSXPGpgqabZ9B0r4xN2tjcJVHa6N8/4IJodLjWePUsqsUsNWnkvTbk1wtMuC46C9Tl9 wg5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VTIuw+eP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x71-20020a63864a000000b00463f080c19esi17682481pgd.559.2022.10.19.06.46.07; Wed, 19 Oct 2022 06:46: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=VTIuw+eP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233159AbiJSNph (ORCPT + 99 others); Wed, 19 Oct 2022 09:45:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233558AbiJSNoY (ORCPT ); Wed, 19 Oct 2022 09:44:24 -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 A0B57153812; Wed, 19 Oct 2022 06:31: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 sin.source.kernel.org (Postfix) with ESMTPS id 0B499CE217A; Wed, 19 Oct 2022 09:06:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0C03C433D7; Wed, 19 Oct 2022 09:06:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170385; bh=AlKGxA5oHb1mhMs88++LuDXBhLryEnVpofotGpHubyE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VTIuw+ePg+vXqGAtp1sxkpp5EtoGrjocBtpW5LBCnYBvh8eHSAZrmBqQhvmJCi6jq TU7TQ/1sq3u4233rya3rKsb9x68Rjpd+ErJluYX5HY3eqfXbR6D5OTNi+Ii+s/aKzm Kn70pjhvR7XsYry5R1MPu8LezkmsDRq4hVC76UjU= 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 6.0 634/862] iommu/omap: Fix buffer overflow in debugfs Date: Wed, 19 Oct 2022 10:32:01 +0200 Message-Id: <20221019083317.948269189@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123890981179114?= X-GMAIL-MSGID: =?utf-8?q?1747123890981179114?= 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 a99afb5d9011..259f65291d90 100644 --- a/drivers/iommu/omap-iommu-debug.c +++ b/drivers/iommu/omap-iommu-debug.c @@ -32,12 +32,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 Wed Oct 19 08:32:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4869 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp224119wrs; Wed, 19 Oct 2022 02:39:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Z2l7MlFglzdtFEaU6lbSx9sUE3WnSU+qqMHT0911bLS2oy9KbJjWAdQ+PtiytmV85wu4d X-Received: by 2002:a17:907:980e:b0:78d:b6d8:f53c with SMTP id ji14-20020a170907980e00b0078db6d8f53cmr6161181ejc.70.1666172368924; Wed, 19 Oct 2022 02:39:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172368; cv=none; d=google.com; s=arc-20160816; b=YmdppSvOlIjaiIwrX/ryGHE6ZzksDoXd8V40fSx9VSv2EftHrPVqz2yqFRumJIAS3t 6kfsMZYR0k9gCCtjnSrR/eX+/gPdiuqQRfnHeGJ5QFUkUnzfDGC5a3uXYhd9uQR1gceb Wy177WCpsA7JL+pMZsKWJmutIHzkIK+YmItPQ0zviLWEhSzw7mbaDkWQ7XNj++HTpnpa yYUywLr6+n0kxlhOfGDJPhYKF/DJiotjJkCXuocAIsbZWbiN0iPyyJ0NRjeV+JMTw65s 9jBF7hvfufcXBimWCwQc1RJiMFY5YuQDL8WmLFaGU/sxcZQtOwKfMzkkUt8cBTreClfV 4mNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=s4TDZAiNiYSUYVklnJSXPar7Ef7VYkLcVSdzRuKqZDE=; b=AzG+JhM/DqXXR8z7xyegEXQQCVg5rZuEq1iIVuFBdZZhokVis5Pc8iskc914VgeAF8 pODoP710frNNxdqYuqGZv7XbkrlscccnLHMNxA7tHIOcDXz/DzBHR9ENVvn6yGGq7/kB WSVcPyTovTCP6DHVsN5ttZEcRu3LppcNPDQx6YW9L1x2X6IshDLiDUaQykkbckcfeTAy pQd9iP8dL/PaHdf6NRpfBEBVE+XPWFrXEG7SccaacGo8bfmK4r9H/p5HlCkQBqq+UEVW J4vtx5iWawShH2BmD6DAp1jCf5O1ZVyOslvdJ00nIt6y3CAf9cg+jz+gZ+dRMo4OfjFs diUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="g/9IqxyF"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gg20-20020a170906e29400b0073d6c0facdcsi11868889ejb.259.2022.10.19.02.39.03; Wed, 19 Oct 2022 02:39: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="g/9IqxyF"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233092AbiJSJSx (ORCPT + 99 others); Wed, 19 Oct 2022 05:18:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233218AbiJSJQ5 (ORCPT ); Wed, 19 Oct 2022 05:16:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBB795FAE7; Wed, 19 Oct 2022 02:07:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7CFDC61868; Wed, 19 Oct 2022 09:06:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8AE79C433D7; Wed, 19 Oct 2022 09:06:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170387; bh=NI1fBXPVYlDZ4B6j6GMBIhhEi5k4CLiLesxDmWTMZN8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g/9IqxyFPdEk3n2rhwQIJvPRSNDFkXFPpkM6dwWdhaO/e60kQmwhIm//QcA+LeI20 gxOxgswR/pTyliRExviYmqZyG27qMtDHg9w/3zmv2M3yfnHXBQZeOcnYDtYM9k9ZiT G7Gizxd0v8NKxkomjWbv5qTgsmZBquhv9qy2YcG8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ignat Korchagin , Herbert Xu , Sasha Levin Subject: [PATCH 6.0 635/862] crypto: akcipher - default implementation for setting a private key Date: Wed, 19 Oct 2022 10:32:02 +0200 Message-Id: <20221019083317.996776853@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108358108462578?= X-GMAIL-MSGID: =?utf-8?q?1747108358108462578?= From: Ignat Korchagin [ Upstream commit bc155c6c188c2f0c5749993b1405673d25a80389 ] Changes from v1: * removed the default implementation from set_pub_key: it is assumed that an implementation must always have this callback defined as there are no use case for an algorithm, which doesn't need a public key Many akcipher implementations (like ECDSA) support only signature verifications, so they don't have all callbacks defined. Commit 78a0324f4a53 ("crypto: akcipher - default implementations for request callbacks") introduced default callbacks for sign/verify operations, which just return an error code. However, these are not enough, because before calling sign the caller would likely call set_priv_key first on the instantiated transform (as the in-kernel testmgr does). This function does not have a default stub, so the kernel crashes, when trying to set a private key on an akcipher, which doesn't support signature generation. I've noticed this, when trying to add a KAT vector for ECDSA signature to the testmgr. With this patch the testmgr returns an error in dmesg (as it should) instead of crashing the kernel NULL ptr dereference. Fixes: 78a0324f4a53 ("crypto: akcipher - default implementations for request callbacks") Signed-off-by: Ignat Korchagin Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- crypto/akcipher.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crypto/akcipher.c b/crypto/akcipher.c index f866085c8a4a..ab975a420e1e 100644 --- a/crypto/akcipher.c +++ b/crypto/akcipher.c @@ -120,6 +120,12 @@ static int akcipher_default_op(struct akcipher_request *req) return -ENOSYS; } +static int akcipher_default_set_key(struct crypto_akcipher *tfm, + const void *key, unsigned int keylen) +{ + return -ENOSYS; +} + int crypto_register_akcipher(struct akcipher_alg *alg) { struct crypto_alg *base = &alg->base; @@ -132,6 +138,8 @@ int crypto_register_akcipher(struct akcipher_alg *alg) alg->encrypt = akcipher_default_op; if (!alg->decrypt) alg->decrypt = akcipher_default_op; + if (!alg->set_priv_key) + alg->set_priv_key = akcipher_default_set_key; akcipher_prepare_alg(alg); return crypto_register_alg(base); From patchwork Wed Oct 19 08:32: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: 5160 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp253666wrs; Wed, 19 Oct 2022 03:57:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7xIl3WPQGvQnf8KsiSIHv0OHhXBOCMS6AroPO2ZxuWl2jV/EDvJ6eLhr69ePn6/ky4o+4O X-Received: by 2002:aa7:9a09:0:b0:562:64cc:94e0 with SMTP id w9-20020aa79a09000000b0056264cc94e0mr8029929pfj.60.1666177072096; Wed, 19 Oct 2022 03:57:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666177072; cv=none; d=google.com; s=arc-20160816; b=dlO2ChiuYHssvg5P2U8V5oNLIjQaqAtrUnVImKPrm746AgryX70WAorJQsqb8sYF+8 Yg98/4kAYRsG8+AR0W6+lY83EapSovCZtlExoiue2eevc2NyjYTASde2M/Veuwh09hbY og0uyk2/0JhJJP5efMnQNOVTWkCcZrA4CikbGQA9tZbrYA0VuMH/1eFZQU65AYZJoW0V AyvdddsbNQocV+CV6lu3QqCTPxwpCQGCZz3QPfL4z3XQtArA/Ros3ShWquyjfHiAoxD/ E39e99s5k5iDtvkStXJ2Zk/CxhnYFvDtBHjVZbsqVrgb5WSq08jNklE9S+7qX1ls5aJ6 UN7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=AThQeGQYCqQqT78FfOQVeY0zAyJGPYQUpAdkc3HP4j4=; b=JwY9WW6++gXRXYeludyFLashQbZqhEj4BiDfYr+80sThS4U737cY/kP5GyzY3DBU6H hTYPPFvx872hWnc2rhkGw+rdwQyZvlxlupLx24qzaD1/tFJN3U1w5tWNnD5jvnao1U69 CO3cxx/1pxvh4awQrKKMPtMyS8jOQV554X7SikBs9oCP8EOuecvXKrxcI66gwcX1Qvp0 Mu8qICXoBX61Rn6/w7ic2b65QwrKzsSrKcq2iMpQhLlYA10aAHbJikF6x688eYfpHi44 GUQ3UkS9VpDBBdCfLRJ6GJ9yRE+h0cJ9NYcLA4oDuMSu4DPF9mtOe5o94RG608VDFb7H KsEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VdxQxcm6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s13-20020a632c0d000000b00440fb4f79bdsi16063824pgs.9.2022.10.19.03.57.38; Wed, 19 Oct 2022 03:57:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VdxQxcm6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234771AbiJSK5O (ORCPT + 99 others); Wed, 19 Oct 2022 06:57:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234700AbiJSK4Z (ORCPT ); Wed, 19 Oct 2022 06:56:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AB7B166994; Wed, 19 Oct 2022 03:27:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 844B6B82497; Wed, 19 Oct 2022 09:08:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E495BC433D6; Wed, 19 Oct 2022 09:08:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170499; bh=HDYsHqlawLyMenwDf+zZ2I9OXsat/1lMky2g1FD+N7I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VdxQxcm6HuDXEtYVpCYY/L3yZ2qc7jeLBrqvbGGzN6wM2220SlbWLKzj0S21L64mX U/YWzD69FFU/IQjc4We4hzwj94PwuIkQZhb88GYiBUJUQoFSELshj/jjMNizxdx9Ay aaef2j4gLKVCLfe1kLosbyVO/qXBJopiKGKyLPn0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Koba Ko , Tom Lendacky , Herbert Xu , Sasha Levin Subject: [PATCH 6.0 636/862] crypto: ccp - Release dma channels before dmaengine unrgister Date: Wed, 19 Oct 2022 10:32:03 +0200 Message-Id: <20221019083318.037257498@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747113289263548099?= X-GMAIL-MSGID: =?utf-8?q?1747113289263548099?= From: Koba Ko [ Upstream commit 68dbe80f5b510c66c800b9e8055235c5b07e37d1 ] A warning is shown during shutdown, __dma_async_device_channel_unregister called while 2 clients hold a reference WARNING: CPU: 15 PID: 1 at drivers/dma/dmaengine.c:1110 __dma_async_device_channel_unregister+0xb7/0xc0 Call dma_release_channel for occupied channles before dma_async_device_unregister. Fixes: 54cce8ecb925 ("crypto: ccp - ccp_dmaengine_unregister release dma channels") Reported-by: kernel test robot Signed-off-by: Koba Ko Acked-by: Tom Lendacky Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/ccp/ccp-dmaengine.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/ccp/ccp-dmaengine.c b/drivers/crypto/ccp/ccp-dmaengine.c index 7d4b4ad1db1f..9f753cb4f5f1 100644 --- a/drivers/crypto/ccp/ccp-dmaengine.c +++ b/drivers/crypto/ccp/ccp-dmaengine.c @@ -641,6 +641,10 @@ static void ccp_dma_release(struct ccp_device *ccp) for (i = 0; i < ccp->cmd_q_count; i++) { chan = ccp->ccp_dma_chan + i; dma_chan = &chan->dma_chan; + + if (dma_chan->client_count) + dma_release_channel(dma_chan); + tasklet_kill(&chan->cleanup_tasklet); list_del_rcu(&dma_chan->device_node); } @@ -766,8 +770,8 @@ void ccp_dmaengine_unregister(struct ccp_device *ccp) if (!dmaengine) return; - dma_async_device_unregister(dma_dev); ccp_dma_release(ccp); + dma_async_device_unregister(dma_dev); kmem_cache_destroy(ccp->dma_desc_cache); kmem_cache_destroy(ccp->dma_cmd_cache); From patchwork Wed Oct 19 08:32: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: 5506 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp336492wrs; Wed, 19 Oct 2022 06:47:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM78idwidD0dp11rKxVB/PHopPq7sjSm6E5b685Sz/MsDF+VDGHF/pP9FQR/eEg8fZAwuDAI X-Received: by 2002:a63:b4d:0:b0:454:d8b4:285 with SMTP id a13-20020a630b4d000000b00454d8b40285mr7406629pgl.410.1666187229826; Wed, 19 Oct 2022 06:47:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666187229; cv=none; d=google.com; s=arc-20160816; b=FH64gUelSYBVDxFFnrukBCrVtBiFywQrhjZ2FHWMg8K4XMZDJZw+14jpOLKgcMLKjj 7Niwf3kJG1/SOaj935AIThvJmjjSQB1YeJJd80ZU6koyHhkugnZCLqfo3WDeJRcO1hkV JCGBvVcobuIarkuu98SFCSC9SBu81UuxV/zzuoRr6zEKIcDsZLZGkDuO4ckSfMo0eSas c1wzOBPWIKIWvp4poCPzowVAa3BUyJ/snTzYzo1H0piHvICbKtcWjxKx7cUoGUpldWLl ep+MUrBKqTn+3ncgS/mwyufo2xcDT0B5zq3iTr9OUiyTOrPgYxegpo7D1cwOgJynbYVh ajvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7x2n/RkekdGOKth6jNyMxgSl4XjLQSVzhxcKcZ4+GV8=; b=gEZhgu12hJhE+QIZ/2T/GiIL2JJdpi8GA8nrMJmyJRSGcFnP20AbG8+A3XNaH0H4Rd QCJzFeEZQnO/UWjI6d5pA9evOqS9cjtRofhNAlHDg/KfMqlSgfk/OgL7NyD6A4XSqAtu rfirORkH53zt5/OWGkFWX6XuZGfDfHZMhJHkAFvSdY8kRHVgGZOl1inmbLwfjVMn1E+C aqmMrxWI1pbExDg1Bxo0pp2Qah7l0U0sUSWrZf7aTUq2uQrmjofR7OqWmG3qVU05QmWZ dGT4dasRl12rZwusCWv3iTFNhIhS5PHusMEhefBPsSbvpc3AWiHWluWtUZR/iE0eZQHp D+1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Cs2s97br; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c24-20020a637258000000b0041183daa0ffsi17200461pgn.761.2022.10.19.06.46.56; Wed, 19 Oct 2022 06: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=Cs2s97br; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233049AbiJSNqZ (ORCPT + 99 others); Wed, 19 Oct 2022 09:46:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233045AbiJSNp2 (ORCPT ); Wed, 19 Oct 2022 09:45:28 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 531DA3A154; Wed, 19 Oct 2022 06:31: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 070DACE2182; Wed, 19 Oct 2022 09:06:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0DB1DC433D6; Wed, 19 Oct 2022 09:06:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170409; bh=V158gqfaGOuKvv7mls5uKxEIcANh4s5FzQov9SkR/sc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cs2s97brTX4g9/pdKdnupz9nPUvDqEXXS6R/XjtDnA36nTNNr48/R51zBymsegKGK VoWFLnOKQgy0HaOByK0UbRCPoDjDnwo6BWloNFPPBnocrkkytBObbrQTdTnrkOjE/p +lXpA7ATUAZzgZzrufoBwFDgL8YD0DhMN9pAQzaA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Harliman Liem , Antoine Tenart , Herbert Xu , Sasha Levin Subject: [PATCH 6.0 637/862] crypto: inside-secure - Change swab to swab32 Date: Wed, 19 Oct 2022 10:32:04 +0200 Message-Id: <20221019083318.078529484@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123940931144894?= X-GMAIL-MSGID: =?utf-8?q?1747123940931144894?= From: Peter Harliman Liem [ Upstream commit 664593407e936b6438fbfaaf98876910fd31cf9a ] The use of swab() is causing failures in 64-bit arch, as it translates to __swab64() instead of the intended __swab32(). It eventually causes wrong results in xcbcmac & cmac algo. Fixes: 78cf1c8bfcb8 ("crypto: inside-secure - Move ipad/opad into safexcel_context") Signed-off-by: Peter Harliman Liem Acked-by: Antoine Tenart Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/inside-secure/safexcel_hash.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/inside-secure/safexcel_hash.c b/drivers/crypto/inside-secure/safexcel_hash.c index bc60b5802256..2124416742f8 100644 --- a/drivers/crypto/inside-secure/safexcel_hash.c +++ b/drivers/crypto/inside-secure/safexcel_hash.c @@ -383,7 +383,7 @@ static int safexcel_ahash_send_req(struct crypto_async_request *async, int ring, u32 x; x = ipad[i] ^ ipad[i + 4]; - cache[i] ^= swab(x); + cache[i] ^= swab32(x); } } cache_len = AES_BLOCK_SIZE; @@ -821,7 +821,7 @@ static int safexcel_ahash_final(struct ahash_request *areq) u32 *result = (void *)areq->result; /* K3 */ - result[i] = swab(ctx->base.ipad.word[i + 4]); + result[i] = swab32(ctx->base.ipad.word[i + 4]); } areq->result[0] ^= 0x80; // 10- padding crypto_cipher_encrypt_one(ctx->kaes, areq->result, areq->result); @@ -2106,7 +2106,7 @@ static int safexcel_xcbcmac_setkey(struct crypto_ahash *tfm, const u8 *key, crypto_cipher_encrypt_one(ctx->kaes, (u8 *)key_tmp + AES_BLOCK_SIZE, "\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3"); for (i = 0; i < 3 * AES_BLOCK_SIZE / sizeof(u32); i++) - ctx->base.ipad.word[i] = swab(key_tmp[i]); + ctx->base.ipad.word[i] = swab32(key_tmp[i]); crypto_cipher_clear_flags(ctx->kaes, CRYPTO_TFM_REQ_MASK); crypto_cipher_set_flags(ctx->kaes, crypto_ahash_get_flags(tfm) & @@ -2189,7 +2189,7 @@ static int safexcel_cmac_setkey(struct crypto_ahash *tfm, const u8 *key, return ret; for (i = 0; i < len / sizeof(u32); i++) - ctx->base.ipad.word[i + 8] = swab(aes.key_enc[i]); + ctx->base.ipad.word[i + 8] = swab32(aes.key_enc[i]); /* precompute the CMAC key material */ crypto_cipher_clear_flags(ctx->kaes, CRYPTO_TFM_REQ_MASK); From patchwork Wed Oct 19 08:32:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5183 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp263696wrs; Wed, 19 Oct 2022 04:18:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4D7doCyVAlxfKT7UDxD7yg2iGlYCoJZ1GmRSYuAS9+sfowoF2C/iZ3eQdOFfBI1mpYxLZn X-Received: by 2002:a17:90a:c90c:b0:20a:7179:b14f with SMTP id v12-20020a17090ac90c00b0020a7179b14fmr9036484pjt.58.1666178314788; Wed, 19 Oct 2022 04:18:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178314; cv=none; d=google.com; s=arc-20160816; b=wf/EoN3cBGfWgt9zD3itwL2o0D68pwz24VtrG35VHEMjWYgiQFQc3J5hli4L4xDsDL Dsywk1Q8yHCMZ8ZHesz+UnVYwfx6qlLmLO0H8BPEdEXhR9bz9Oon4RCedGhzxa0PGlHz DDUrLTdivBOOfg2VKBFD2sN0PAn2NrtmTz2OKqZR+COEmTZed3JJW85DdLYdA/WM61lD mO829P+ZM2aoUHDGEN4arn1YVzJZ5OdG7UHyJ3FJglYQx4qy4YJ3qsAXx8Bp3v6i9YIP JA/+Od6xdoc07BbbteQ4ppBllyyW+H491A0dASPDGuqM9ihrfGjSazrZPiEuAbbfsZc6 QzlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Vs9sG7s6MeYW2A5vbVtnVpL0Bh1V9MsdKTew1m2DIps=; b=sMdVNI2qBLCFVl3ScPFaRTBzh2jxkDQCKW9DMxfLrmnHN5eWQcng04O9OgFNzYxOFe aHeo2CABfTfVe4N8lUihbwyJIK1qs4aMNtCsbH5yJIMp1ovGoME5VSTIkDNhJ/XaOgJ/ LjgLZJp7NMwBKZxJYJAZFF6IKwQZEdC/NUzovVGANX1iWy8Aq8lXyM3vNGQlcQx1/seV s5LWRZOtj1ldcAK8WIjBOeDqy/e3GcmELix0o/E4jxDU42skuu28KIIZDb5/AJcAQFvA prIN+XOPCTCBJqfGgVPVEbQ6pWLoS6txF4cXBQDgj4iOj5UeFB7+SLEUWMyVnFkATkBG +sYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rXV+yjAJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q18-20020a631f52000000b0043447486c84si17789343pgm.875.2022.10.19.04.18.15; Wed, 19 Oct 2022 04:18:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rXV+yjAJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234104AbiJSLDR (ORCPT + 99 others); Wed, 19 Oct 2022 07:03:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234008AbiJSLC4 (ORCPT ); Wed, 19 Oct 2022 07:02: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 61906F9845; Wed, 19 Oct 2022 03:32:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D408CB8249A; Wed, 19 Oct 2022 09:07:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A06BC433D7; Wed, 19 Oct 2022 09:07:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170438; bh=KvQZonaXioxuXtOo2BbMDpsB5CZbGTXaJcnvg8fKL1k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rXV+yjAJCUZtOy+fh23HmsItgqWW734ReJSe2JFprLQkuLamBn63aoZhqp+IIBrou DtmYFacJMZAOG9odoRvELiZX+/XNlu8mYMdSi3pbowNEB41S3zoSKb4KOkpHlAjjUQ YrFqWnN8/W0dyga/nhRRydxOvl9VKno/ddGvGxu0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Damian Muszynski , Giovanni Cabiddu , Herbert Xu , Sasha Levin Subject: [PATCH 6.0 638/862] crypto: qat - fix DMA transfer direction Date: Wed, 19 Oct 2022 10:32:05 +0200 Message-Id: <20221019083318.127644268@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114592722717994?= X-GMAIL-MSGID: =?utf-8?q?1747114592722717994?= From: Damian Muszynski [ Upstream commit cf5bb835b7c8a5fee7f26455099cca7feb57f5e9 ] When CONFIG_DMA_API_DEBUG is selected, while running the crypto self test on the QAT crypto algorithms, the function add_dma_entry() reports a warning similar to the one below, saying that overlapping mappings are not supported. This occurs in tests where the input and the output scatter list point to the same buffers (i.e. two different scatter lists which point to the same chunks of memory). The logic that implements the mapping uses the flag DMA_BIDIRECTIONAL for both the input and the output scatter lists which leads to overlapped write mappings. These are not supported by the DMA layer. Fix by specifying the correct DMA transfer directions when mapping buffers. For in-place operations where the input scatter list matches the output scatter list, buffers are mapped once with DMA_BIDIRECTIONAL, otherwise input buffers are mapped using the flag DMA_TO_DEVICE and output buffers are mapped with DMA_FROM_DEVICE. Overlapping a read mapping with a write mapping is a valid case in dma-coherent devices like QAT. The function that frees and unmaps the buffers, qat_alg_free_bufl() has been changed accordingly to the changes to the mapping function. DMA-API: 4xxx 0000:06:00.0: cacheline tracking EEXIST, overlapping mappings aren't supported WARNING: CPU: 53 PID: 4362 at kernel/dma/debug.c:570 add_dma_entry+0x1e9/0x270 ... Call Trace: dma_map_page_attrs+0x82/0x2d0 ? preempt_count_add+0x6a/0xa0 qat_alg_sgl_to_bufl+0x45b/0x990 [intel_qat] qat_alg_aead_dec+0x71/0x250 [intel_qat] crypto_aead_decrypt+0x3d/0x70 test_aead_vec_cfg+0x649/0x810 ? number+0x310/0x3a0 ? vsnprintf+0x2a3/0x550 ? scnprintf+0x42/0x70 ? valid_sg_divisions.constprop.0+0x86/0xa0 ? test_aead_vec+0xdf/0x120 test_aead_vec+0xdf/0x120 alg_test_aead+0x185/0x400 alg_test+0x3d8/0x500 ? crypto_acomp_scomp_free_ctx+0x30/0x30 ? __schedule+0x32a/0x12a0 ? ttwu_queue_wakelist+0xbf/0x110 ? _raw_spin_unlock_irqrestore+0x23/0x40 ? try_to_wake_up+0x83/0x570 ? _raw_spin_unlock_irqrestore+0x23/0x40 ? __set_cpus_allowed_ptr_locked+0xea/0x1b0 ? crypto_acomp_scomp_free_ctx+0x30/0x30 cryptomgr_test+0x27/0x50 kthread+0xe6/0x110 ? kthread_complete_and_exit+0x20/0x20 ret_from_fork+0x1f/0x30 Fixes: d370cec ("crypto: qat - Intel(R) QAT crypto interface") Link: https://lore.kernel.org/linux-crypto/20220223080400.139367-1-gilad@benyossef.com/ Signed-off-by: Damian Muszynski Signed-off-by: Giovanni Cabiddu Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/qat/qat_common/qat_algs.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/crypto/qat/qat_common/qat_algs.c b/drivers/crypto/qat/qat_common/qat_algs.c index fb45fa83841c..cad9c58caab1 100644 --- a/drivers/crypto/qat/qat_common/qat_algs.c +++ b/drivers/crypto/qat/qat_common/qat_algs.c @@ -673,11 +673,14 @@ static void qat_alg_free_bufl(struct qat_crypto_instance *inst, dma_addr_t blpout = qat_req->buf.bloutp; size_t sz = qat_req->buf.sz; size_t sz_out = qat_req->buf.sz_out; + int bl_dma_dir; int i; + bl_dma_dir = blp != blpout ? DMA_TO_DEVICE : DMA_BIDIRECTIONAL; + for (i = 0; i < bl->num_bufs; i++) dma_unmap_single(dev, bl->bufers[i].addr, - bl->bufers[i].len, DMA_BIDIRECTIONAL); + bl->bufers[i].len, bl_dma_dir); dma_unmap_single(dev, blp, sz, DMA_TO_DEVICE); @@ -691,7 +694,7 @@ static void qat_alg_free_bufl(struct qat_crypto_instance *inst, for (i = bufless; i < blout->num_bufs; i++) { dma_unmap_single(dev, blout->bufers[i].addr, blout->bufers[i].len, - DMA_BIDIRECTIONAL); + DMA_FROM_DEVICE); } dma_unmap_single(dev, blpout, sz_out, DMA_TO_DEVICE); @@ -716,6 +719,7 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, struct scatterlist *sg; size_t sz_out, sz = struct_size(bufl, bufers, n); int node = dev_to_node(&GET_DEV(inst->accel_dev)); + int bufl_dma_dir; if (unlikely(!n)) return -EINVAL; @@ -733,6 +737,8 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, qat_req->buf.sgl_src_valid = true; } + bufl_dma_dir = sgl != sglout ? DMA_TO_DEVICE : DMA_BIDIRECTIONAL; + for_each_sg(sgl, sg, n, i) bufl->bufers[i].addr = DMA_MAPPING_ERROR; @@ -744,7 +750,7 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, bufl->bufers[y].addr = dma_map_single(dev, sg_virt(sg), sg->length, - DMA_BIDIRECTIONAL); + bufl_dma_dir); bufl->bufers[y].len = sg->length; if (unlikely(dma_mapping_error(dev, bufl->bufers[y].addr))) goto err_in; @@ -787,7 +793,7 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, bufers[y].addr = dma_map_single(dev, sg_virt(sg), sg->length, - DMA_BIDIRECTIONAL); + DMA_FROM_DEVICE); if (unlikely(dma_mapping_error(dev, bufers[y].addr))) goto err_out; bufers[y].len = sg->length; @@ -817,7 +823,7 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, if (!dma_mapping_error(dev, buflout->bufers[i].addr)) dma_unmap_single(dev, buflout->bufers[i].addr, buflout->bufers[i].len, - DMA_BIDIRECTIONAL); + DMA_FROM_DEVICE); if (!qat_req->buf.sgl_dst_valid) kfree(buflout); @@ -831,7 +837,7 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, if (!dma_mapping_error(dev, bufl->bufers[i].addr)) dma_unmap_single(dev, bufl->bufers[i].addr, bufl->bufers[i].len, - DMA_BIDIRECTIONAL); + bufl_dma_dir); if (!qat_req->buf.sgl_src_valid) kfree(bufl); From patchwork Wed Oct 19 08:32:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4825 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223505wrs; Wed, 19 Oct 2022 02:37:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6yFsPESbMOTwnFZ1401YPZy14dFXQF7qRbmzhkzb1mdxoK3tw/i0+PC6RxTeksb1tiHl8i X-Received: by 2002:a17:903:1211:b0:178:9353:9e42 with SMTP id l17-20020a170903121100b0017893539e42mr7597409plh.45.1666172260724; Wed, 19 Oct 2022 02:37:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172260; cv=none; d=google.com; s=arc-20160816; b=HYckHFPOEBlopVuen8ouldIeHsO14LcNUxMUZ5qKosWlZqpPbXH26ngKhAzZ0wBPrd 8ggLYNv5boYYsJ32rK3lRrexyhXnmvUm9VXbtEyRqX4hKV0ojugaHDfOBB9yEDYmU44f z2edDd+xpQhyUzcFgPH4lZ3xP9qbZXleSrv3oa0H9APunH8Y9GK79iCm16XXuL2NKGr+ 4XLYQfaojOl/IjUhD2Xfml+j8WzPl3LFOKQSvYf8ONarFWURV6OfUapUIZnkSIzjBT5z wNU2Y+IHYB50iMJ869uwZSbr+RAT2vf42jMInhcg2aixdUnlwQzKpG7Cr2X3wr7MIb/m OErw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BZKF+1UKxVg2bixsMw+juhPTNVYe2lU1afz31OQY59s=; b=jK7sigPCDEZvDYwPbf0b6/tkS/Q085u/RBnm6WKqXaQhhJ2j/zY70ktjy3glrklC4O eKSgcXW+C1UYEl6RKxNTTa092Sk/BR+ICZT3MgwGoVilvlFLZ3LJ3csJlbVQ5sApFD/v Tf9ZG/7Xt6pzLjm08MKQpHXnfOPa8SS+lFgqtk5k7qVrD2KholGLUmTQ7MxTP7P2KeO+ cRnC3zTKZgC0lyT6jTP3NB/yF9EFBYaZ1yKylBxmtz/Braqvobn0/Xm586uyPD3T4TEM u1oXPcH/3uvLWPBB9h/EDz+OXis2T+02qmLJVVMUaDAmfOE4yh1XX30M6Od0Gwi7j96y IL5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xjJO+cO7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j10-20020a170902da8a00b0017f97fe778dsi19896116plx.126.2022.10.19.02.37.27; Wed, 19 Oct 2022 02:37: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=xjJO+cO7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233253AbiJSJXG (ORCPT + 99 others); Wed, 19 Oct 2022 05:23:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232882AbiJSJV7 (ORCPT ); Wed, 19 Oct 2022 05:21: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 0E32372B66; Wed, 19 Oct 2022 02:10:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 511C3617F1; Wed, 19 Oct 2022 09:07:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C4F7C433D7; Wed, 19 Oct 2022 09:07:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170467; bh=RGwrKnkrt+w/nHMKlIsALNrzbvtZrXpoRBaBl2bJTIg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xjJO+cO7V57mrH7uRl65DC+/Grj18uQxhZuHe8En9ynIYR/06cSjgQWBPhS63aVo0 awlksJ1Tr23IOEfUsiWl6iGSvkmf0saegBWu/TaVzeR+4qxa2Tg5L4YgJrrjO1FAb6 kUVWVzm8kxQM8L0rEnByeb9JcT8xxYVjfZH2Q0aI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kunkun Jiang , Marc Zyngier , Oliver Upton , Daniel Lezcano , Sasha Levin Subject: [PATCH 6.0 639/862] clocksource/drivers/arm_arch_timer: Fix handling of ARM erratum 858921 Date: Wed, 19 Oct 2022 10:32:06 +0200 Message-Id: <20221019083318.160511306@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108244419116722?= X-GMAIL-MSGID: =?utf-8?q?1747108244419116722?= From: Kunkun Jiang [ Upstream commit 6c3b62d93e195f78c1437c8fa7581e9b2f00886e ] The commit a38b71b0833e ("clocksource/drivers/arm_arch_timer: Move system register timer programming over to CVAL") moves the programming of the timers from the countdown timer (TVAL) over to the comparator (CVAL). This makes it necessary to read the counter when programming next event. However, the workaround of Cortex-A73 erratum 858921 does not set the corresponding set_next_event_phys and set_next_event_virt. Add the appropriate hooks to apply the erratum mitigation when programming the next timer event. Fixes: a38b71b0833e ("clocksource/drivers/arm_arch_timer: Move system register timer programming over to CVAL") Signed-off-by: Kunkun Jiang Acked-by: Marc Zyngier Reviewed-by: Oliver Upton Link: https://lore.kernel.org/r/20220914061424.1260-1-jiangkunkun@huawei.com Signed-off-by: Daniel Lezcano Signed-off-by: Sasha Levin --- drivers/clocksource/arm_arch_timer.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c index 8122a1646925..a7ff77550e17 100644 --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c @@ -473,6 +473,8 @@ static const struct arch_timer_erratum_workaround ool_workarounds[] = { .desc = "ARM erratum 858921", .read_cntpct_el0 = arm64_858921_read_cntpct_el0, .read_cntvct_el0 = arm64_858921_read_cntvct_el0, + .set_next_event_phys = erratum_set_next_event_phys, + .set_next_event_virt = erratum_set_next_event_virt, }, #endif #ifdef CONFIG_SUN50I_ERRATUM_UNKNOWN1 From patchwork Wed Oct 19 08:32:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4897 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225370wrs; Wed, 19 Oct 2022 02:42:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6xIMRbunLroS3Ab7Oy5cyPAh/uUCSicF4uESB81/GrsfQgLg7GCAnHcAlTzZkeve61KUya X-Received: by 2002:a17:906:eecb:b0:73c:5c85:142b with SMTP id wu11-20020a170906eecb00b0073c5c85142bmr5956489ejb.433.1666172579441; Wed, 19 Oct 2022 02:42:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172579; cv=none; d=google.com; s=arc-20160816; b=sZOjhNXi0qAXUZSpNMimadRT7pdhIfvuH5J3Q6gmTR6m9+5qB2GrUKqj+MOTUKs3xD KfJU5ctV3MenUDQ8pX3Hq/xPKzthoayhmFigZkBs7spvxyW0YmWzSRNllVu94oCe8FoX JXH8QZG4M/JtAzLyrAW59SG8SVNq7PW8gOBNogWRHTHZSx0EGMTh9rXa5LGv9zn9O+wl NjJVcdf5/7jRQBUJPJ/eXUxsNkgTEZZy3MQ561s0LJpJ2Rl6SPhqlmsgcJfOSUdPvNHx nrF03Cagu57Rryf0hiiQM9Ui3jQ6KItY+VDSrXkmoeqixiqg5cjUN31epIRiwLARW/b4 B8Bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3NVHu8D43K6DlPVGRW9e7kWOFKqnCWmQnn3uBDk2xvM=; b=BHSKAj4zmG51ThxpObSS7hTg/kvwMH3HOCQZtTAjV74eOQPAgFcE7VeaMe41D7cpN6 3KFJ1k2mNSl3++Tl3W6ylb9TPDe3/I4cPE17sXNBK0+WuQIP18sbbShUinygN6wNGmR3 klcoGFj6jSnMLGwunaBVjmqh+1QgLjH/XjoT/tGFcZ9Q+yo27/rxeR6lIMIGDVcbr2LY 7CikSxhf9ZNb8/WClNQ3UMElFg30MjsQw0vP/vH1MRKg12a1tTabqyCt0EX+ZObDeLnQ eP4NydsnbXtb7ul5WSPnwvW8d/zHbcmYINP+o+fxwlYwlDJFNgrTV4tA0AQQrsiDCknL VZXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vCtufBv9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a101-20020a509eee000000b00457f5aa9dc6si13265961edf.528.2022.10.19.02.42.33; Wed, 19 Oct 2022 02:42: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=vCtufBv9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231347AbiJSJc3 (ORCPT + 99 others); Wed, 19 Oct 2022 05:32:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233487AbiJSJ2h (ORCPT ); Wed, 19 Oct 2022 05:28:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5C2CE6F6B; Wed, 19 Oct 2022 02:12:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 13A416182F; Wed, 19 Oct 2022 09:08:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26617C433D6; Wed, 19 Oct 2022 09:08:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170483; bh=wpNuhBG9/6aQ2W+7cbuETNqCLtVcvtJT1YSt5RjOQ6M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vCtufBv9LIRRgLq0F3T+DsJmUAjZrsZjD7C2wYZ4ucA4Y6fZUQei/uhpjrkmgVQDX 1xguqL4tV+It8NlcS9tMtGXGjXw3lldaNgjVFgkfkELLOUSNuUHzetXq4/CufiWv7z riLHZna7RO924B8wkfxzwTzDCbacCMW5+z3CVsCs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lin Yujun , Daniel Lezcano , Sasha Levin Subject: [PATCH 6.0 640/862] clocksource/drivers/timer-gxp: Add missing error handling in gxp_timer_probe Date: Wed, 19 Oct 2022 10:32:07 +0200 Message-Id: <20221019083318.199357367@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108578568782685?= X-GMAIL-MSGID: =?utf-8?q?1747108578568782685?= From: Lin Yujun [ Upstream commit 0e2c8e6d769bcdc4f6634a02c545356282275e68 ] Add platform_device_put() to make sure to free the platform device in the event platform_device_add() fails. Fixes: 5184f4bf151b ("clocksource/drivers/timer-gxp: Add HPE GXP Timer") Signed-off-by: Lin Yujun Link: https://lore.kernel.org/r/20220914033018.97484-1-linyujun809@huawei.com Signed-off-by: Daniel Lezcano Signed-off-by: Sasha Levin --- drivers/clocksource/timer-gxp.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/clocksource/timer-gxp.c b/drivers/clocksource/timer-gxp.c index 8b38b3212388..fe4fa8d7b3f1 100644 --- a/drivers/clocksource/timer-gxp.c +++ b/drivers/clocksource/timer-gxp.c @@ -171,6 +171,7 @@ static int gxp_timer_probe(struct platform_device *pdev) { struct platform_device *gxp_watchdog_device; struct device *dev = &pdev->dev; + int ret; if (!gxp_timer) { pr_err("Gxp Timer not initialized, cannot create watchdog"); @@ -187,7 +188,11 @@ static int gxp_timer_probe(struct platform_device *pdev) gxp_watchdog_device->dev.platform_data = gxp_timer->counter; gxp_watchdog_device->dev.parent = dev; - return platform_device_add(gxp_watchdog_device); + ret = platform_device_add(gxp_watchdog_device); + if (ret) + platform_device_put(gxp_watchdog_device); + + return ret; } static const struct of_device_id gxp_timer_of_match[] = { From patchwork Wed Oct 19 08:32: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: 4831 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223642wrs; Wed, 19 Oct 2022 02:38:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7A+PqzuIRIIKuR7SW9JfvQVrZk8SGBlmj052xd5hs8FF1Aqg86hXR8jv27OOStY+uhuk7Z X-Received: by 2002:a17:906:db07:b0:77b:82cf:54af with SMTP id xj7-20020a170906db0700b0077b82cf54afmr6141040ejb.666.1666172283332; Wed, 19 Oct 2022 02:38:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172283; cv=none; d=google.com; s=arc-20160816; b=k59ljDTnaPtsc6C9JKcawg/jXsQn8xubEQF+bl1GGYqmAVDU0KYcJ2Zv3hK/DDhxmJ j24BOEleqMrnCRmTwQBCsZRdYI9G6zPCnTBP6W8pjQ4ArfkayqFoKR+v6Sc1sDy6bwsx BaCBGFZS8SiinBwikVFkiB1p6d30/y9DR5/tsHtCvZpJXil8irsLLNflEtzbQQE7cTfc 1EI3RMa5EZvIfzrFvLJ8l3n9fJgDxzm6CTZOzPucuu2OmaUk5sUgXHMhefFAGwt+cO7x B3tujYRkBK/mU43mz5gJmP/3K6iFcCTr4oCPOFVrZQSeYXsV0NcsIAvI26PKvXwueGWc uzVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2oNjCqn/eoTLT2FY1YTlQgdtXPjjAcVnXOuOqEr5nt8=; b=thq3gDhNqrhKgpQ870KiUnURla+Cji+HXdMjPKYzfULcuNQDQG1kf2AGAPJR0q5NjO JUAnaxjzDrPrA6JzAdqV8t2z/G2qtyJXfh00bbUpNmVWpIugztCzi27Lxjc8lGI+UQ2k YtrSqLd2pDro4p3N+aJFH2T24+SBU6qDw+gab782/LZ9OLnvJ+ZFPVROqtcm6EptG41E N/5kB08UAjEhEJhSCaw98GVnYUUduddZ2Mco29uAQMg4/ci3wdVY+obGieaFaOHVdu3C FRkKr4l14PxhvFDk1UTTC+mNZ+q5NUUU4+8pqrcJewoKuqaH2p+DXscYDx3xIl9udnME dDDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ow8nXXCF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a17090676c600b0078da414a7cesi11731704ejn.149.2022.10.19.02.37.35; Wed, 19 Oct 2022 02:38: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=ow8nXXCF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232825AbiJSJZB (ORCPT + 99 others); Wed, 19 Oct 2022 05:25:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233349AbiJSJXJ (ORCPT ); Wed, 19 Oct 2022 05:23:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 100F432ECA; Wed, 19 Oct 2022 02:10:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id ADC2D6187E; Wed, 19 Oct 2022 09:08:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BDC12C433D6; Wed, 19 Oct 2022 09:08:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170486; bh=MKoBh82UrCikpRPp+3I9KxQVcYkaIfYhH8SFNWI3dfs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ow8nXXCFdEwNB4Zu29z7v/szyNj7MZi6YzdrBU8yRNS/h1Xv6HDX6vo7Ea02S5D2y wQxp9bmkLXJH/YI5INT4q5DaEYfNiJBzegSfCuFqF9GIZK5JXT/GXZmBT0lIMaYyEj 5GnpgxRnqZkTexN9soqmPxfGV9EoS+S1TGm0cUXE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ronnie Sahlberg , Enzo Matsumiya , Steve French , Sasha Levin Subject: [PATCH 6.0 641/862] cifs: return correct error in ->calc_signature() Date: Wed, 19 Oct 2022 10:32:08 +0200 Message-Id: <20221019083318.246791597@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108268033771364?= X-GMAIL-MSGID: =?utf-8?q?1747108268033771364?= From: Enzo Matsumiya [ Upstream commit 09a1f9a168ae1f69f701689429871793174417d2 ] If an error happens while getting the key or session in the ->calc_signature implementations, 0 (success) is returned. Fix it by returning a proper error code. Since it seems to be highly unlikely to happen wrap the rc check in unlikely() too. Reviewed-by: Ronnie Sahlberg Fixes: 32811d242ff6 ("cifs: Start using per session key for smb2/3 for signature generation") Signed-off-by: Enzo Matsumiya Signed-off-by: Steve French Signed-off-by: Sasha Levin --- fs/cifs/smb2transport.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/fs/cifs/smb2transport.c b/fs/cifs/smb2transport.c index 1a5fc3314dbf..4640fc4a8b13 100644 --- a/fs/cifs/smb2transport.c +++ b/fs/cifs/smb2transport.c @@ -225,9 +225,9 @@ smb2_calc_signature(struct smb_rqst *rqst, struct TCP_Server_Info *server, struct smb_rqst drqst; ses = smb2_find_smb_ses(server, le64_to_cpu(shdr->SessionId)); - if (!ses) { + if (unlikely(!ses)) { cifs_server_dbg(VFS, "%s: Could not find session\n", __func__); - return 0; + return -ENOENT; } memset(smb2_signature, 0x0, SMB2_HMACSHA256_SIZE); @@ -557,8 +557,10 @@ smb3_calc_signature(struct smb_rqst *rqst, struct TCP_Server_Info *server, u8 key[SMB3_SIGN_KEY_SIZE]; rc = smb2_get_sign_key(le64_to_cpu(shdr->SessionId), server, key); - if (rc) - return 0; + if (unlikely(rc)) { + cifs_server_dbg(VFS, "%s: Could not get signing key\n", __func__); + return rc; + } if (allocate_crypto) { rc = cifs_alloc_hash("cmac(aes)", &hash, &sdesc); From patchwork Wed Oct 19 08:32: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: 5166 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp253908wrs; Wed, 19 Oct 2022 03:58:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6jqHRR5+TZrtyn6eEkuzF/T/pjLOXL0301/nQiNyHse2o5bQFpGD9p+5cfzAqwplXIU7b0 X-Received: by 2002:a63:cf48:0:b0:439:7d1c:fedc with SMTP id b8-20020a63cf48000000b004397d1cfedcmr6805371pgj.281.1666177122171; Wed, 19 Oct 2022 03:58:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666177122; cv=none; d=google.com; s=arc-20160816; b=dku6nQzkNRQNbZZyym2ludvSFR9hHErejfaJzOyzPK6VZkRwwNgPCzYQ/SZEHz7qqv WNW8WtKDRJk9oKkMUfVlQWhO5pEiJAUY8XTzONFCVN73fcj3VN/xt5WRqBDzkFvuYMPt C7/mamV3hgQUiyww5MAPZGEbvxQBsgin0aD5OxI9fayN2XCh+vU8t2GTgifSqjYEa9WK 3qJmS7Shq4R7QJ0Gz7zTFDVSXz2NKl/lJI5OYEhfFVzdYdu8N86hONYrGJf/e/u4hE+a +zAN8vx1UlEhY+3v8Om6ZVu0ddi+/MpnxnnVU1qpeXz5IU0jJyE+B3OYdSppB/t7dHPy ClhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=75D//KZgHpYEcOwXlamXNLfZpo2zN1wlZC84KO2X8vY=; b=mKLJMQ4Jmco6jQe3ARfLAMRHvPtIEptkZnV/eQm4djxPcKut3HOKCHGr5eY4otQXMh r9VKnnqnlPlNTk7WJwbHSDPpj93K/C52nt5ZVwuMHnFpxWSxQ2U93/p2C1e2R4crdSQV J2slPZLM8Ge5hRWfuOHVaSBsXEP9l3QHrP7g/aicJSqWLzaHYqoSw4WwCayqCrbMLjb6 wWxcN/KPjbXOzRYJrxWPAQ4q5J90cFslXBxqD+ffBA2BLu/nXkaajo4Q4AKPuFJSL2fC oS41IDoHUkUfAD9OmXEvOI4a19BSRaG8LYJRfSK7q4F13oQReImJY09r94FujUqRD4JI LKUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KXZzLOs1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q12-20020a638c4c000000b0046b08e9060fsi18324840pgn.485.2022.10.19.03.58.29; Wed, 19 Oct 2022 03:58: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=KXZzLOs1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234688AbiJSK6A (ORCPT + 99 others); Wed, 19 Oct 2022 06:58:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234738AbiJSK4i (ORCPT ); Wed, 19 Oct 2022 06:56:38 -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 5452B125020; Wed, 19 Oct 2022 03:27: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 ams.source.kernel.org (Postfix) with ESMTPS id E6AFBB82499; Wed, 19 Oct 2022 09:08:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50C63C43470; Wed, 19 Oct 2022 09:08:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170488; bh=5Yd5FDDaRj03dfa4ccEHYsYfRgXcz6zUyLgXc1qtPKY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KXZzLOs1AarKEfiCVyE2FSuvtfXl4vpMnUpC6GC/gQXNWBQtIg4cda2lSYjX8k0aK y9XXR+1fiE3wm29Wtf9yFCWnMc6N7fnEQ24Av3TgLndYPsvYq/4jdd5qudAEEXBIyr Cv0ODjYaf6Arqr0p+9ckFRj5aVX4+/YdGnvqN0nM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thierry Reding , John Garry , Robin Murphy , Thierry Reding , Joerg Roedel , Sasha Levin Subject: [PATCH 6.0 642/862] iommu/iova: Fix module config properly Date: Wed, 19 Oct 2022 10:32:09 +0200 Message-Id: <20221019083318.289016215@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747113341742370730?= X-GMAIL-MSGID: =?utf-8?q?1747113341742370730?= From: Robin Murphy [ Upstream commit 4f58330fcc8482aa90674e1f40f601e82f18ed4a ] IOMMU_IOVA is intended to be an optional library for users to select as and when they desire. Since it can be a module now, this means that built-in code which has chosen not to select it should not fail to link if it happens to have selected as a module by someone else. Replace IS_ENABLED() with IS_REACHABLE() to do the right thing. CC: Thierry Reding Reported-by: John Garry Fixes: 15bbdec3931e ("iommu: Make the iova library a module") Signed-off-by: Robin Murphy Reviewed-by: Thierry Reding Link: https://lore.kernel.org/r/548c2f683ca379aface59639a8f0cccc3a1ac050.1663069227.git.robin.murphy@arm.com Signed-off-by: Joerg Roedel Signed-off-by: Sasha Levin --- include/linux/iova.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/iova.h b/include/linux/iova.h index c6ba6d95d79c..83c00fac2acb 100644 --- a/include/linux/iova.h +++ b/include/linux/iova.h @@ -75,7 +75,7 @@ static inline unsigned long iova_pfn(struct iova_domain *iovad, dma_addr_t iova) return iova >> iova_shift(iovad); } -#if IS_ENABLED(CONFIG_IOMMU_IOVA) +#if IS_REACHABLE(CONFIG_IOMMU_IOVA) int iova_cache_get(void); void iova_cache_put(void); From patchwork Wed Oct 19 08:32: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: 4832 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223659wrs; Wed, 19 Oct 2022 02:38:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5TeB3Tt5Lyf2IRcRkelhqTRjVnlt2DHfcc8t58rQUvIQ7d/uX2KS316MmK1DzUawPg6ef2 X-Received: by 2002:a05:6402:28ca:b0:43b:5235:f325 with SMTP id ef10-20020a05640228ca00b0043b5235f325mr6512891edb.320.1666172286154; Wed, 19 Oct 2022 02:38:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172286; cv=none; d=google.com; s=arc-20160816; b=raiOK+qPpkOD4MIdLVk7sLylN9Z4+QPlRL9EvhIOXy1bept6K6p6t4gciNO2wremYq HaDeoQUlIcQ5miYQWNDy3fIPYtSQi1KLRXAheXO0q18w0iL14bH714xYyTNzfHBVS1C6 cZBQdGCqfWFwfYIPD0CMWHQLvPGA7pQ4a0Hltw+K38Z7pyVCsupNU8MOnTKV028lF51e 1s/9xFkIEKcwvOfKpGxcVRGbMUuMatQjqyE2IwA7WXBwmhVEWZtJGw5lKSb6nseDLjcx Nw0CxNyE3l6QarVPq07/k4i4qQtqSy+HxLtygwJMvgXlJMWTMe2Zw+6JUukmWcWCfNTU 0hOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=KCkiCwAeM0DC4G4M8RXTYA9/YX5WvLBhBfIsZNV29lU=; b=b6GtTzMenQBjNUoC8cgvhSLOiazsO32rYKbU2MjOOMBgNxo3EO0ZlFEuumSDUZmSXr D2pIeKwgwd37RonBbJYDMFzMm0dUhIbl5LhysX7x1ChTkkZtQ41H1RcebFtYO7yT5YPw 8q6fdGX+5tfyAwiMvD4UecuAWkGGRRa4huqonRERjZxlSn2j0eFT/zMaEgGpdiwQjAPu 1PkEiPGjyupUcR3cWl3nCKE0vgLWOaObziytTsrj1ep/abbQGOWgNv1CrnEjagsGGxep PSZZ+j2BQBJObpyfTVa+FAMp0q8LTSW5+HvU7oZjHOrye3sykWvAuzg1wYPwgF+NEkVp JZhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WlS9awD2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g11-20020a17090669cb00b0073d710fec77si12492214ejs.251.2022.10.19.02.37.38; Wed, 19 Oct 2022 02:38: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=WlS9awD2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233168AbiJSJZF (ORCPT + 99 others); Wed, 19 Oct 2022 05:25:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230348AbiJSJXc (ORCPT ); Wed, 19 Oct 2022 05:23:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06F2AB56F2; Wed, 19 Oct 2022 02:10: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 E4C1A6185F; Wed, 19 Oct 2022 09:08:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1B48C433D7; Wed, 19 Oct 2022 09:08:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170491; bh=G2L0nwBjn5VtTyRobVNartiz1/0xuFjNYrEZ5NJlSKU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WlS9awD2OpdCmAms7Qro9y4Vr8NcIvMcsX3H7rdw+Wz3+nPn8g235zoZ78XrxsAgt 0Z/gjkFMA1AUwVuS7mTGrJRr6wNEM5MMD4m1ifhnXLMCaZLd5K4f4Few9gf4Earxqd kq5h+2q17hjGArztcJHcYJluCRsWtgW9Ma6tDMPw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, linux-riscv@lists.infradead.org, mingo@redhat.com, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, zanussi@kernel.org, liaochang1@huawei.com, chris.zjh@huawei.com, Yipeng Zou , "Masami Hiramatsu (Google)" , "Steven Rostedt (Google)" , Sasha Levin Subject: [PATCH 6.0 643/862] tracing: kprobe: Fix kprobe event gen test module on exit Date: Wed, 19 Oct 2022 10:32:10 +0200 Message-Id: <20221019083318.337377248@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108271249038063?= X-GMAIL-MSGID: =?utf-8?q?1747108271249038063?= From: Yipeng Zou [ Upstream commit ac48e189527fae87253ef2bf58892e782fb36874 ] Correct gen_kretprobe_test clr event para on module exit. This will make it can't to delete. Link: https://lkml.kernel.org/r/20220919125629.238242-2-zouyipeng@huawei.com Cc: Cc: Cc: Cc: Cc: Cc: Cc: Cc: Fixes: 64836248dda2 ("tracing: Add kprobe event command generation test module") Signed-off-by: Yipeng Zou Acked-by: Masami Hiramatsu (Google) Signed-off-by: Steven Rostedt (Google) Signed-off-by: Sasha Levin --- kernel/trace/kprobe_event_gen_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/trace/kprobe_event_gen_test.c b/kernel/trace/kprobe_event_gen_test.c index 18b0f1cbb947..e023154be0f8 100644 --- a/kernel/trace/kprobe_event_gen_test.c +++ b/kernel/trace/kprobe_event_gen_test.c @@ -206,7 +206,7 @@ static void __exit kprobe_event_gen_test_exit(void) WARN_ON(kprobe_event_delete("gen_kprobe_test")); /* Disable the event or you can't remove it */ - WARN_ON(trace_array_set_clr_event(gen_kprobe_test->tr, + WARN_ON(trace_array_set_clr_event(gen_kretprobe_test->tr, "kprobes", "gen_kretprobe_test", false)); From patchwork Wed Oct 19 08:32: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: 5158 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp253650wrs; Wed, 19 Oct 2022 03:57:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5L+YLtcjDSwJ23BgBt6UkLfdRJufC/Yre0/u4n8GESrHqnw9tYB82V+AXhQB4R8PDy4dhQ X-Received: by 2002:a63:2318:0:b0:452:598a:92de with SMTP id j24-20020a632318000000b00452598a92demr6866240pgj.73.1666177069206; Wed, 19 Oct 2022 03:57:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666177069; cv=none; d=google.com; s=arc-20160816; b=gsnwDXca6EivqJiKhoa0Wbgk3kjPsDbxBy1ugU7lctJgvsSxOZdEmjihPmyHEtRIlG ZRGmDU6yT59QyC4DIEbPSlGZoRd/lINLpSO5J3++F3hBwi5IZj7LqT2ZojHQp5n73mMv 9vYZB8oGgAIRVIx0WynmD3h8z/G3SlaWJEjdvy2kH/ThzfW4FWR2PJKZlAhQs3X13yrt MwdXtQ872K6RYk/OLxHs1k51i6q3fmN7NNADzXs8bqVku2LiJp09IgU4Lp8tG4nE1/9+ mEUucTeERr9vfeJZBayRoiZyywzHbVy/Qk7IBqns88JHddMCVBin91uwzShU99kFeC0V UCvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=svhPfyiBknFcdK9Jb03uX0IgjMsCSeIO5LuOUGYZPMQ=; b=nDys59LqwL3s49ttlP3Gbzu1kdbHrrmPUguGnEJ2m/YS2FiyO0GSmd5r5GewjshAw2 MCR+E+K3RGRaowBKKCvV7ONkHpHb33THyGlRl0LewwlZ+oWvubNUPxb72m5d+ATOBwMB 2FweYC/a6ZAzCFNg3nusfTmIjyw/Ft4ZbC9JAcYeXoXbTj8R3PJMh2N/kWg5yvTjUIrq CB14lfhKOjJ5oZ6jyKajk8T0ow7kQwa9OaEMtQNSFnheE1ZlRak3V6TyR7nx4878ps7r ahm9cPtWAjehpSixshZyD7Q307Tj20FNiPMzXSegOvSCB93DIspDTA3k51/m83HboH4s ovHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Bdo2h2kO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170902cf0300b0017833671bc7si19601392plg.619.2022.10.19.03.57.34; Wed, 19 Oct 2022 03:57: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=Bdo2h2kO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234314AbiJSK4z (ORCPT + 99 others); Wed, 19 Oct 2022 06:56:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234669AbiJSK4J (ORCPT ); Wed, 19 Oct 2022 06:56: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 B5AE1106E24; Wed, 19 Oct 2022 03:27: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 49E51B8249F; Wed, 19 Oct 2022 09:08:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 72FB6C433D6; Wed, 19 Oct 2022 09:08:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170494; bh=Xz/JYnNX+bv4d5sNBNrD5dHf4bfzzM5L7MEjHHLxJTw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bdo2h2kOyIwqT5X3ec7HmtT9zFHkpMZnleKyT7jkUiEJu+z43Xu2Yw/9oIKm0cO4i cqmDXRVxRpIObpH/vtEywOX8ck4+DIwXKBeSWWO744mmGqsdZ+OvlYosLOaLNWeF9c GSkFQTBQvQLKGonxEWHb+f0e9bk2gpud3Ux5nlJs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, linux-riscv@lists.infradead.org, mingo@redhat.com, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, zanussi@kernel.org, liaochang1@huawei.com, chris.zjh@huawei.com, Yipeng Zou , "Masami Hiramatsu (Google)" , "Steven Rostedt (Google)" , Sasha Levin Subject: [PATCH 6.0 644/862] tracing: kprobe: Make gen test module work in arm and riscv Date: Wed, 19 Oct 2022 10:32:11 +0200 Message-Id: <20221019083318.377867133@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747113286579360885?= X-GMAIL-MSGID: =?utf-8?q?1747113286579360885?= From: Yipeng Zou [ Upstream commit d8ef45d66c01425ff748e13ef7dd1da7a91cc93c ] For now, this selftest module can only work in x86 because of the kprobe cmd was fixed use of x86 registers. This patch adapted to register names under arm and riscv, So that this module can be worked on those platform. Link: https://lkml.kernel.org/r/20220919125629.238242-3-zouyipeng@huawei.com Cc: Cc: Cc: Cc: Cc: Cc: Cc: Cc: Fixes: 64836248dda2 ("tracing: Add kprobe event command generation test module") Signed-off-by: Yipeng Zou Acked-by: Masami Hiramatsu (Google) Signed-off-by: Steven Rostedt (Google) Signed-off-by: Sasha Levin --- kernel/trace/kprobe_event_gen_test.c | 47 +++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 4 deletions(-) diff --git a/kernel/trace/kprobe_event_gen_test.c b/kernel/trace/kprobe_event_gen_test.c index e023154be0f8..80e04a1e1977 100644 --- a/kernel/trace/kprobe_event_gen_test.c +++ b/kernel/trace/kprobe_event_gen_test.c @@ -35,6 +35,45 @@ static struct trace_event_file *gen_kprobe_test; static struct trace_event_file *gen_kretprobe_test; +#define KPROBE_GEN_TEST_FUNC "do_sys_open" + +/* X86 */ +#if defined(CONFIG_X86_64) || defined(CONFIG_X86_32) +#define KPROBE_GEN_TEST_ARG0 "dfd=%ax" +#define KPROBE_GEN_TEST_ARG1 "filename=%dx" +#define KPROBE_GEN_TEST_ARG2 "flags=%cx" +#define KPROBE_GEN_TEST_ARG3 "mode=+4($stack)" + +/* ARM64 */ +#elif defined(CONFIG_ARM64) +#define KPROBE_GEN_TEST_ARG0 "dfd=%x0" +#define KPROBE_GEN_TEST_ARG1 "filename=%x1" +#define KPROBE_GEN_TEST_ARG2 "flags=%x2" +#define KPROBE_GEN_TEST_ARG3 "mode=%x3" + +/* ARM */ +#elif defined(CONFIG_ARM) +#define KPROBE_GEN_TEST_ARG0 "dfd=%r0" +#define KPROBE_GEN_TEST_ARG1 "filename=%r1" +#define KPROBE_GEN_TEST_ARG2 "flags=%r2" +#define KPROBE_GEN_TEST_ARG3 "mode=%r3" + +/* RISCV */ +#elif defined(CONFIG_RISCV) +#define KPROBE_GEN_TEST_ARG0 "dfd=%a0" +#define KPROBE_GEN_TEST_ARG1 "filename=%a1" +#define KPROBE_GEN_TEST_ARG2 "flags=%a2" +#define KPROBE_GEN_TEST_ARG3 "mode=%a3" + +/* others */ +#else +#define KPROBE_GEN_TEST_ARG0 NULL +#define KPROBE_GEN_TEST_ARG1 NULL +#define KPROBE_GEN_TEST_ARG2 NULL +#define KPROBE_GEN_TEST_ARG3 NULL +#endif + + /* * Test to make sure we can create a kprobe event, then add more * fields. @@ -58,14 +97,14 @@ static int __init test_gen_kprobe_cmd(void) * fields. */ ret = kprobe_event_gen_cmd_start(&cmd, "gen_kprobe_test", - "do_sys_open", - "dfd=%ax", "filename=%dx"); + KPROBE_GEN_TEST_FUNC, + KPROBE_GEN_TEST_ARG0, KPROBE_GEN_TEST_ARG1); if (ret) goto free; /* Use kprobe_event_add_fields to add the rest of the fields */ - ret = kprobe_event_add_fields(&cmd, "flags=%cx", "mode=+4($stack)"); + ret = kprobe_event_add_fields(&cmd, KPROBE_GEN_TEST_ARG2, KPROBE_GEN_TEST_ARG3); if (ret) goto free; @@ -128,7 +167,7 @@ static int __init test_gen_kretprobe_cmd(void) * Define the kretprobe event. */ ret = kretprobe_event_gen_cmd_start(&cmd, "gen_kretprobe_test", - "do_sys_open", + KPROBE_GEN_TEST_FUNC, "$retval"); if (ret) goto free; From patchwork Wed Oct 19 08:32: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: 4892 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225511wrs; Wed, 19 Oct 2022 02:43:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6tJvqXxjG2A5kjDgJuOv79vIACs4nAheChVqI+cCNam9BLTMQ1W5u42W0z8m1lYQFMJwp/ X-Received: by 2002:a17:906:7952:b0:787:a14d:65a7 with SMTP id l18-20020a170906795200b00787a14d65a7mr6113382ejo.108.1666172599043; Wed, 19 Oct 2022 02:43:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172599; cv=none; d=google.com; s=arc-20160816; b=v/dPJ/zVJm0Gr7MEzZ1IzWKNqabyjONSX34J6UUUvY1AHrWLfM6mp0w2y650pPQcm5 HPpvuhOl9ea7CuAQIgv0G/P1I+Sx/6S4yWESau3qS7wMovLAekFLndpuMoELE5ibMonl UgS+xXb2DUJRBdh2hunfDZSeksDI0Wpjyq1ItOwadVZZtcJ5PrR2dgRchy16SiCnyavf XWdIhZx/kkPK3E715uemz7pOdD9Nt/S883PTIs89l5qmXzh+TBeL9lxodbdBRAnOCUOD Yb0rf9X+5eyNdTFELFGaiDXteYpovlREOIhMbb4xc2QrrCyVNk5cIKiP4BLxjHIYTIPx t/jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=G8XAnjqPKg/5aTCwdOonfTc/QL7bk9dvwrxJiGYcME0=; b=ISisTKzz0Ewca8Bchhf909mH7EheEVfn9yypQeSAid+NgvSkqDToeNke+yBo9HfiQW sCQAWlSj1d1dTMR4+tgYXFjPvXf+1QfNz7T0ee5rVTPAJOm07AI+st6KJdN33KdZsJNn RdHFWm5WC+lJJqE45woGooWIpGFosdbRdimXWhbg4cnAyfuyhtNsn7ztVtexLBxgYCcc bzei+u3TTBCdHL2F/gI3WxD/Fg8G+26VptYxJflwudaTDR9pRd1f3Gn96EAb3LKrYxAQ V4c+ykJJpKZiR/rZubUXa2OAqlc8n0bU7JJ1Dr+ZATPTWthyxDkPbtIfh65XwkMSfciu mCZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jK84knL9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a17090716a000b0078ddd8656d9si14806570ejc.9.2022.10.19.02.42.53; Wed, 19 Oct 2022 02:43: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=jK84knL9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233915AbiJSJeA (ORCPT + 99 others); Wed, 19 Oct 2022 05:34:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233771AbiJSJ3Y (ORCPT ); Wed, 19 Oct 2022 05:29:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2C26C58BE; Wed, 19 Oct 2022 02:12: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 2CEC661886; Wed, 19 Oct 2022 09:08:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 405E4C43144; Wed, 19 Oct 2022 09:08:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170496; bh=CM0lsX2xNuDhqw6knoqtt6uLkfZ93Q02MCIk5faF5dE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jK84knL91kszEr50fLxA3xwU0z4n7zg4kM9luGiCByChmSXXjsWMmAdjlqFYLhSiQ leeWYjYcx19R3AepVzsLENSzb0igJ8JUsa1li2D/jO4GVGlnjvgSpYQ5Pywdde4a0s Xxgq2ObgCazgC+eYiksLYeSrY8lF6m6nN5CN9n10= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nico Pache , Daniel Bristot de Oliveira , "Steven Rostedt (Google)" , Sasha Levin Subject: [PATCH 6.0 645/862] tracing/osnoise: Fix possible recursive locking in stop_per_cpu_kthreads Date: Wed, 19 Oct 2022 10:32:12 +0200 Message-Id: <20221019083318.425224404@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108599153121135?= X-GMAIL-MSGID: =?utf-8?q?1747108599153121135?= From: Nico Pache [ Upstream commit 99ee9317a1305cd5626736785c8cb38b0e47686c ] There is a recursive lock on the cpu_hotplug_lock. In kernel/trace/trace_osnoise.c:_per_cpu_kthreads: - start_per_cpu_kthreads calls cpus_read_lock() and if start_kthreads returns a error it will call stop_per_cpu_kthreads. - stop_per_cpu_kthreads then calls cpus_read_lock() again causing deadlock. Fix this by calling cpus_read_unlock() before calling stop_per_cpu_kthreads. This behavior can also be seen in commit f46b16520a08 ("trace/hwlat: Implement the per-cpu mode"). This error was noticed during the LTP ftrace-stress-test: WARNING: possible recursive locking detected -------------------------------------------- sh/275006 is trying to acquire lock: ffffffffb02f5400 (cpu_hotplug_lock){++++}-{0:0}, at: stop_per_cpu_kthreads but task is already holding lock: ffffffffb02f5400 (cpu_hotplug_lock){++++}-{0:0}, at: start_per_cpu_kthreads other info that might help us debug this: Possible unsafe locking scenario: CPU0 ---- lock(cpu_hotplug_lock); lock(cpu_hotplug_lock); *** DEADLOCK *** May be due to missing lock nesting notation 3 locks held by sh/275006: #0: ffff8881023f0470 (sb_writers#24){.+.+}-{0:0}, at: ksys_write #1: ffffffffb084f430 (trace_types_lock){+.+.}-{3:3}, at: rb_simple_write #2: ffffffffb02f5400 (cpu_hotplug_lock){++++}-{0:0}, at: start_per_cpu_kthreads Link: https://lkml.kernel.org/r/20220919144932.3064014-1-npache@redhat.com Fixes: c8895e271f79 ("trace/osnoise: Support hotplug operations") Signed-off-by: Nico Pache Acked-by: Daniel Bristot de Oliveira Signed-off-by: Steven Rostedt (Google) Signed-off-by: Sasha Levin --- kernel/trace/trace_osnoise.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c index 313439920a8c..78d536d3ff3d 100644 --- a/kernel/trace/trace_osnoise.c +++ b/kernel/trace/trace_osnoise.c @@ -1786,8 +1786,9 @@ static int start_per_cpu_kthreads(void) for_each_cpu(cpu, current_mask) { retval = start_kthread(cpu); if (retval) { + cpus_read_unlock(); stop_per_cpu_kthreads(); - break; + return retval; } } From patchwork Wed Oct 19 08:32: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: 5188 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp263879wrs; Wed, 19 Oct 2022 04:18:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM767U/54IPZW0oQmUHv55aKviQFF+6iZeIDk1NDd1A63PBg9ssKUM4WJwMbjlv9f8eUr928 X-Received: by 2002:aa7:8f04:0:b0:563:1a66:9f with SMTP id x4-20020aa78f04000000b005631a66009fmr7863267pfr.75.1666178335937; Wed, 19 Oct 2022 04:18:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178335; cv=none; d=google.com; s=arc-20160816; b=qM1CksH6e4eFjudnNERAz+oVJzuxSMqny3QRTSNNb+F+EtWW7VVpz7bwqCcTIDKPN0 l9Ou+8m4Eqzivi/0r5kQl68uACi5SOQVZcKRrlw+gGXdMpwbNp9kz/7x5qBWNBdzuwAN POqwVmic8cOuLjVbVD1Gp1xP8q8efCf5rmb7qroGXojCuq3d5l2WRWZqdyCc/e5X2HZn QfX+2UoY7QhOlA8uZlulZ3iI0E3CIY6zF4y3EV/KkH1/1Q9Ygb7z3KdN7pEVa1IBt70L kvBVv72l9QQVkP2MPOyP4Wt64RgU0Z34x/cAd3Xnuu30XQHej+/xn5R5A/xkFsz82C9V nwvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=igg0TL9Di0hDkiK3uCuUU4m/tQnmYgSb0gNUMuxK2FE=; b=qTrGhLrXEjU/0kyQo/r7QMRYh0hQujvpWnZ9QPszqgzkxZUnAW27ulfoN2dRntgLXC QQg0dSgCe7I5r2gzACaXReITt3rjYTkbC9qd9oVxmylQHKmEjLEiOvT9DAZlZimBML9K uhNah4WH1+EzmJBADg/UXz8afWAGiVGpZpji63nhJDOafOPB4sQCFy9GtTbTDK97mSeF 4XgTGCRtVbAEhhd6QcgNucIplwhud3ia3hkT1vXqIZQk1WRoV22Zn8yaC7oWmhfS2dbi HiQHKXAJIOK9jqu7X1kNHa2T7LLy3uXTuKzDLhkt6dBIucPAuqS1jL5uAhAv7eI7lsr2 HH1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tBHluHFF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i12-20020a170902c94c00b001755d722578si20134541pla.524.2022.10.19.04.18.37; Wed, 19 Oct 2022 04:18: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=tBHluHFF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229930AbiJSLFj (ORCPT + 99 others); Wed, 19 Oct 2022 07:05:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234880AbiJSLEL (ORCPT ); Wed, 19 Oct 2022 07:04: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 ADB1914DF0B; Wed, 19 Oct 2022 03: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 dfw.source.kernel.org (Postfix) with ESMTPS id 9CE8E6187A; Wed, 19 Oct 2022 09:06:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4F4AC433D6; Wed, 19 Oct 2022 09:06:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170412; bh=VHFS+tnidvdu/bK8WD7Sf1hdnURQhrZG9a3fUJ2k0dc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tBHluHFFnEizbPAcmCVtVvFgxgp4GM5i4+UjOkbPIX+EGGWGNOCGiQxYvwjE7q0G+ xXbeTztZ0dmt0IPhKWQ3vraNzvwXqXV+7kkGTLECoc5P8No4i294qV539k1BAjgWK6 797FTz1uSf7UNI+g813l0QYG7RWPazmPaDF0rpME= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Song Liu , "Steven Rostedt (Google)" , Sasha Levin , "Naveen N . Rao" Subject: [PATCH 6.0 646/862] ftrace: Fix recursive locking direct_mutex in ftrace_modify_direct_caller Date: Wed, 19 Oct 2022 10:32:13 +0200 Message-Id: <20221019083318.458903314@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114614933074978?= X-GMAIL-MSGID: =?utf-8?q?1747114614933074978?= From: Song Liu [ Upstream commit 9d2ce78ddcee159eb6a97449e9c68b6d60b9cec4 ] Naveen reported recursive locking of direct_mutex with sample ftrace-direct-modify.ko: [ 74.762406] WARNING: possible recursive locking detected [ 74.762887] 6.0.0-rc6+ #33 Not tainted [ 74.763216] -------------------------------------------- [ 74.763672] event-sample-fn/1084 is trying to acquire lock: [ 74.764152] ffffffff86c9d6b0 (direct_mutex){+.+.}-{3:3}, at: \ register_ftrace_function+0x1f/0x180 [ 74.764922] [ 74.764922] but task is already holding lock: [ 74.765421] ffffffff86c9d6b0 (direct_mutex){+.+.}-{3:3}, at: \ modify_ftrace_direct+0x34/0x1f0 [ 74.766142] [ 74.766142] other info that might help us debug this: [ 74.766701] Possible unsafe locking scenario: [ 74.766701] [ 74.767216] CPU0 [ 74.767437] ---- [ 74.767656] lock(direct_mutex); [ 74.767952] lock(direct_mutex); [ 74.768245] [ 74.768245] *** DEADLOCK *** [ 74.768245] [ 74.768750] May be due to missing lock nesting notation [ 74.768750] [ 74.769332] 1 lock held by event-sample-fn/1084: [ 74.769731] #0: ffffffff86c9d6b0 (direct_mutex){+.+.}-{3:3}, at: \ modify_ftrace_direct+0x34/0x1f0 [ 74.770496] [ 74.770496] stack backtrace: [ 74.770884] CPU: 4 PID: 1084 Comm: event-sample-fn Not tainted ... [ 74.771498] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), ... [ 74.772474] Call Trace: [ 74.772696] [ 74.772896] dump_stack_lvl+0x44/0x5b [ 74.773223] __lock_acquire.cold.74+0xac/0x2b7 [ 74.773616] lock_acquire+0xd2/0x310 [ 74.773936] ? register_ftrace_function+0x1f/0x180 [ 74.774357] ? lock_is_held_type+0xd8/0x130 [ 74.774744] ? my_tramp2+0x11/0x11 [ftrace_direct_modify] [ 74.775213] __mutex_lock+0x99/0x1010 [ 74.775536] ? register_ftrace_function+0x1f/0x180 [ 74.775954] ? slab_free_freelist_hook.isra.43+0x115/0x160 [ 74.776424] ? ftrace_set_hash+0x195/0x220 [ 74.776779] ? register_ftrace_function+0x1f/0x180 [ 74.777194] ? kfree+0x3e1/0x440 [ 74.777482] ? my_tramp2+0x11/0x11 [ftrace_direct_modify] [ 74.777941] ? __schedule+0xb40/0xb40 [ 74.778258] ? register_ftrace_function+0x1f/0x180 [ 74.778672] ? my_tramp1+0xf/0xf [ftrace_direct_modify] [ 74.779128] register_ftrace_function+0x1f/0x180 [ 74.779527] ? ftrace_set_filter_ip+0x33/0x70 [ 74.779910] ? __schedule+0xb40/0xb40 [ 74.780231] ? my_tramp1+0xf/0xf [ftrace_direct_modify] [ 74.780678] ? my_tramp2+0x11/0x11 [ftrace_direct_modify] [ 74.781147] ftrace_modify_direct_caller+0x5b/0x90 [ 74.781563] ? 0xffffffffa0201000 [ 74.781859] ? my_tramp1+0xf/0xf [ftrace_direct_modify] [ 74.782309] modify_ftrace_direct+0x1b2/0x1f0 [ 74.782690] ? __schedule+0xb40/0xb40 [ 74.783014] ? simple_thread+0x2a/0xb0 [ftrace_direct_modify] [ 74.783508] ? __schedule+0xb40/0xb40 [ 74.783832] ? my_tramp2+0x11/0x11 [ftrace_direct_modify] [ 74.784294] simple_thread+0x76/0xb0 [ftrace_direct_modify] [ 74.784766] kthread+0xf5/0x120 [ 74.785052] ? kthread_complete_and_exit+0x20/0x20 [ 74.785464] ret_from_fork+0x22/0x30 [ 74.785781] Fix this by using register_ftrace_function_nolock in ftrace_modify_direct_caller. Link: https://lkml.kernel.org/r/20220927004146.1215303-1-song@kernel.org Fixes: 53cd885bc5c3 ("ftrace: Allow IPMODIFY and DIRECT ops on the same function") Reported-and-tested-by: Naveen N. Rao Signed-off-by: Song Liu Signed-off-by: Steven Rostedt (Google) Signed-off-by: Sasha Levin --- kernel/trace/ftrace.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 2edda4962367..83362a155791 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -5439,6 +5439,8 @@ static struct ftrace_ops stub_ops = { * it is safe to modify the ftrace record, where it should be * currently calling @old_addr directly, to call @new_addr. * + * This is called with direct_mutex locked. + * * Safety checks should be made to make sure that the code at * @rec->ip is currently calling @old_addr. And this must * also update entry->direct to @new_addr. @@ -5451,6 +5453,8 @@ int __weak ftrace_modify_direct_caller(struct ftrace_func_entry *entry, unsigned long ip = rec->ip; int ret; + lockdep_assert_held(&direct_mutex); + /* * The ftrace_lock was used to determine if the record * had more than one registered user to it. If it did, @@ -5473,7 +5477,7 @@ int __weak ftrace_modify_direct_caller(struct ftrace_func_entry *entry, if (ret) goto out_lock; - ret = register_ftrace_function(&stub_ops); + ret = register_ftrace_function_nolock(&stub_ops); if (ret) { ftrace_set_filter_ip(&stub_ops, ip, 1, 0); goto out_lock; From patchwork Wed Oct 19 08:32: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: 4837 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223692wrs; Wed, 19 Oct 2022 02:38:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5AePNsbtUn5GK8qe31ZU7FmQYqqm/SvtoEB49a1zro80b5ZlDvNUrfkBDaW8Vp9cPo2hmM X-Received: by 2002:a17:906:fd82:b0:770:7e61:3707 with SMTP id xa2-20020a170906fd8200b007707e613707mr5714365ejb.143.1666172292288; Wed, 19 Oct 2022 02:38:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172292; cv=none; d=google.com; s=arc-20160816; b=XJqmFnNktUPkF5By8BwcHGF4BUjhy921VGZ7pE3ovf2qQytl2qgH1GLlk/vexqS9zG ZWihdkQSIpjh0vmHf57g1Y5NUk7GyYQfrnyqh1DzcRV4N0TN1iyic89GC/l3vHrz4kEx cEXgbW11x1XSRQ62e0DSxJe2lYzkuYrw1EWnfRP8lTCIFmdMoHxaJ9tdzxmXojoYarOe WueuPc59zZYa0OYnQnfgfBjp58Y+lyjmjrmHW+nUlo87DXjYvS85JJ/mtRwloD465tRh g3iqid49BTbb+66GxtIkjpY2MjFKGeWA5y0tge5cW5/TZUwHWZqS+miDkuqXlS46VNMl TIaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MGkREK5j0NpiRsplELJW6baWyQju9VVa+gsLkZantVc=; b=A79G0HFYYKCtT459CjtFICGppkg8X70P4C6hyIe3jEIpWNMBLx5d4QZQ8Sb7MpntQk /nBhcwE5swUalrci4gi9dqIH9scuc7Lb7d0ISoErKve9xHvavavMR39AZoP7YEx7yJCC dV885AgZFbZVKCRy/vA68C2yDPw9+WAE+d3rwE66cnqI1jUCvzST3EUoGPES7k+3ZgPN eEt+Xl80Z1CTKrodWlNBUlk4FaMAXyaaXqy+31iwG+nz9vf9TmXD8NeBib6IjNj4FfrB 3fW3su0oWJ+lJH5xLJMpMcYEgRBvkF20vF617hUgGXWm8+fYmfdlit38GYB6TLPymzmM ljHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="sPz/hL+2"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cm25-20020a0564020c9900b0045d50ef116esi8790717edb.392.2022.10.19.02.37.43; Wed, 19 Oct 2022 02:38: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="sPz/hL+2"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233464AbiJSJZb (ORCPT + 99 others); Wed, 19 Oct 2022 05:25:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233624AbiJSJYP (ORCPT ); Wed, 19 Oct 2022 05:24:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D53DE0707; Wed, 19 Oct 2022 02:10: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 2843A6183D; Wed, 19 Oct 2022 09:06:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F2DDC433D6; Wed, 19 Oct 2022 09:06:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170414; bh=r1uSprv05uRiiOBGa4ahdssT8plV/zjFxqe8j0cDwak=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sPz/hL+2l0BWLCkQv53zWaIEC5WKn9KzWIXrZ33p6UjebHoLg1VP5CPqIht83ciqf mtauZgXMbfWmNHVVxC19p2cMKFp+oC426GFkWTF2dUvNmGaBg4NW368hgFtEHBv/7x 4W+ZGT7AX0iQf6nUEMgzWK8RujFtuzHEXqPYVfhc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ingo Molnar , Rob Herring , Masahiro Yamada , Nicolas Schier , Sasha Levin Subject: [PATCH 6.0 647/862] kbuild: remove the target in signal traps when interrupted Date: Wed, 19 Oct 2022 10:32:14 +0200 Message-Id: <20221019083318.509231970@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108277759052512?= X-GMAIL-MSGID: =?utf-8?q?1747108277759052512?= From: Masahiro Yamada [ Upstream commit a7f3257da8a86b96fb9bf1bba40ae0bbd7f1885a ] When receiving some signal, GNU Make automatically deletes the target if it has already been changed by the interrupted recipe. If the target is possibly incomplete due to interruption, it must be deleted so that it will be remade from scratch on the next run of make. Otherwise, the target would remain corrupted permanently because its timestamp had already been updated. Thanks to this behavior of Make, you can stop the build any time by pressing Ctrl-C, and just run 'make' to resume it. Kbuild also relies on this feature, but it is equivalently important for any build systems that make decisions based on timestamps (if you want to support Ctrl-C reliably). However, this does not always work as claimed; Make immediately dies with Ctrl-C if its stderr goes into a pipe. [Test Makefile] foo: echo hello > $@ sleep 3 echo world >> $@ [Test Result] $ make # hit Ctrl-C echo hello > foo sleep 3 ^Cmake: *** Deleting file 'foo' make: *** [Makefile:3: foo] Interrupt $ make 2>&1 | cat # hit Ctrl-C echo hello > foo sleep 3 ^C$ # 'foo' is often left-over The reason is because SIGINT is sent to the entire process group. In this example, SIGINT kills 'cat', and 'make' writes the message to the closed pipe, then dies with SIGPIPE before cleaning the target. A typical bad scenario (as reported by [1], [2]) is to save build log by using the 'tee' command: $ make 2>&1 | tee log This can be problematic for any build systems based on Make, so I hope it will be fixed in GNU Make. The maintainer of GNU Make stated this is a long-standing issue and difficult to fix [3]. It has not been fixed yet as of writing. So, we cannot rely on Make cleaning the target. We can do it by ourselves, in signal traps. As far as I understand, Make takes care of SIGHUP, SIGINT, SIGQUIT, and SITERM for the target removal. I added the traps for them, and also for SIGPIPE just in case cmd_* rule prints something to stdout or stderr (but I did not observe an actual case where SIGPIPE was triggered). [Note 1] The trap handler might be worth explaining. rm -f $@; trap - $(sig); kill -s $(sig) $$ This lets the shell kill itself by the signal it caught, so the parent process can tell the child has exited on the signal. Generally, this is a proper manner for handling signals, in case the calling program (like Bash) may monitor WIFSIGNALED() and WTERMSIG() for WCE although this may not be a big deal here because GNU Make handles SIGHUP, SIGINT, SIGQUIT in WUE and SIGTERM in IUE. IUE - Immediate Unconditional Exit WUE - Wait and Unconditional Exit WCE - Wait and Cooperative Exit For details, see "Proper handling of SIGINT/SIGQUIT" [4]. [Note 2] Reverting 392885ee82d3 ("kbuild: let fixdep directly write to .*.cmd files") would directly address [1], but it only saves if_changed_dep. As reported in [2], all commands that use redirection can potentially leave an empty (i.e. broken) target. [Note 3] Another (even safer) approach might be to always write to a temporary file, and rename it to $@ at the end of the recipe. > $(tmp-target) mv $(tmp-target) $@ It would require a lot of Makefile changes, and result in ugly code, so I did not take it. [Note 4] A little more thoughts about a pattern rule with multiple targets (or a grouped target). %.x %.y: %.z When interrupted, GNU Make deletes both %.x and %.y, while this solution only deletes $@. Probably, this is not a big deal. The next run of make will execute the rule again to create $@ along with the other files. [1]: https://lore.kernel.org/all/YLeot94yAaM4xbMY@gmail.com/ [2]: https://lore.kernel.org/all/20220510221333.2770571-1-robh@kernel.org/ [3]: https://lists.gnu.org/archive/html/help-make/2021-06/msg00001.html [4]: https://www.cons.org/cracauer/sigint.html Fixes: 392885ee82d3 ("kbuild: let fixdep directly write to .*.cmd files") Reported-by: Ingo Molnar Reported-by: Rob Herring Signed-off-by: Masahiro Yamada Tested-by: Ingo Molnar Reviewed-by: Nicolas Schier Signed-off-by: Sasha Levin --- scripts/Kbuild.include | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index ece44b735061..2bc08ace38a3 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -100,8 +100,29 @@ echo-cmd = $(if $($(quiet)cmd_$(1)),\ quiet_redirect := silent_redirect := exec >/dev/null; +# Delete the target on interruption +# +# GNU Make automatically deletes the target if it has already been changed by +# the interrupted recipe. So, you can safely stop the build by Ctrl-C (Make +# will delete incomplete targets), and resume it later. +# +# However, this does not work when the stderr is piped to another program, like +# $ make >&2 | tee log +# Make dies with SIGPIPE before cleaning the targets. +# +# To address it, we clean the target in signal traps. +# +# Make deletes the target when it catches SIGHUP, SIGINT, SIGQUIT, SIGTERM. +# So, we cover them, and also SIGPIPE just in case. +# +# Of course, this is unneeded for phony targets. +delete-on-interrupt = \ + $(if $(filter-out $(PHONY), $@), \ + $(foreach sig, HUP INT QUIT TERM PIPE, \ + trap 'rm -f $@; trap - $(sig); kill -s $(sig) $$$$' $(sig);)) + # printing commands -cmd = @set -e; $(echo-cmd) $($(quiet)redirect) $(cmd_$(1)) +cmd = @set -e; $(echo-cmd) $($(quiet)redirect) $(delete-on-interrupt) $(cmd_$(1)) ### # if_changed - execute command if any prerequisite is newer than From patchwork Wed Oct 19 08:32: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: 5211 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp264739wrs; Wed, 19 Oct 2022 04:20:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7tz/DQQnYG1RNq+gRHqYQhG1K8uCfrApIqFNb3DCnPOA7K6HpAlv8rI7UFDWQ/vv/UxYRU X-Received: by 2002:a17:903:258e:b0:17b:a251:c80a with SMTP id jb14-20020a170903258e00b0017ba251c80amr8016295plb.110.1666178448444; Wed, 19 Oct 2022 04:20:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178448; cv=none; d=google.com; s=arc-20160816; b=ihvCj47u3A++3XTLW1s8D9YyUcDfFM3jicxN18tEbajsj8A11GO+rfoJmyuCjAnnts DoUYNMSOY0rR8s3pN5edUGLrTjfAjUBZfZAeOnhBrl/JVTh5GSzVpEgqliFBVV+NZYMN PC41+jzQyt5DVGsry5NpNmZNMAMc3zYqWMoc//jdlVRmrU+30ZlhKKo8PEL8OcmZahSR OMmQGtpB2z+mhbar6ZmNA2aYR+X4zRZtV2TmCEvjyGte2JZ4RHN1VaHG9zP5dvLP2Eoz 1xz9sGM8D2ldTJK1k6oYRNQMIcTB6tPaMiLcQBmzQu6n7QVK2gdlwRbLRCWGPRa8sg64 nYFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=EwC22GEKUDudLWUoYsqY6JUPbS1ZmXWczO/JHYxxqPs=; b=MFX4ZSrcO7m2xJAjdkO2xTAd2S5HHmhfZ2B3IqNJOjlE5I8NbEBaUyf9ZsjTTZbJnv +YPPyaU0p+rJ4tH+nIyARljxsbijjOVbL1cGPpCaLsM8pMbP4qfnDEx9VqVIUZM7OKzF 74kJvIdphNbgWFFFAPAt/SUe4ZWeIX4DcCLvlCFMYkpX5NfwaPwyMXh2KEMJHW2uOA9o oICP15+LR5GUvaHNa7JXbjLInpEg2ly5aFxX1uaYRj/oCvYDeaJXyxi1P+eAQ4fOynAv FFFQhp5RcyRB2jTNwSE+AIH2JoEm0a+oKh4L+cNYbwkBZ/WqoRhKKpCBIClvcX4qRUUX V4RQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qHIOTEOp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f70-20020a636a49000000b0042b9117b723si17440502pgc.794.2022.10.19.04.20.33; Wed, 19 Oct 2022 04:20: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=qHIOTEOp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232310AbiJSLLA (ORCPT + 99 others); Wed, 19 Oct 2022 07:11:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232369AbiJSLJt (ORCPT ); Wed, 19 Oct 2022 07:09:49 -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 1935E107CC4; Wed, 19 Oct 2022 03:38:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6AC17B823A7; Wed, 19 Oct 2022 09:06:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7783C433D7; Wed, 19 Oct 2022 09:06:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170417; bh=WsLm7DULaSh3XLEUh8TtPER6hSxauw/5gTEcKzR+ymA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qHIOTEOpCU7XnUUeOprUAYxWyjdvPt9t3kOs2xqhLLMnUvOsUF4W/ZpeqBehBx0Dl +Qk/qrfOu+42JgWLgRcWCd2w4CmYwCKh6NwKjz7C/aBgREzCf8Ymv0YAJaPDlWUQo6 niFb8ZXJAsZzkSzhBDxVsl30/NHp4OZvhZAGGJXQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yann Sionneau , Masahiro Yamada , Sasha Levin Subject: [PATCH 6.0 648/862] linux/export: use inline assembler to populate symbol CRCs Date: Wed, 19 Oct 2022 10:32:15 +0200 Message-Id: <20221019083318.553316034@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114733203028259?= X-GMAIL-MSGID: =?utf-8?q?1747114733203028259?= From: Masahiro Yamada [ Upstream commit f3304ecd7f060db1d4197fbdce5a503259f770d3 ] Since commit 7b4537199a4a ("kbuild: link symbol CRCs at final link, removing CONFIG_MODULE_REL_CRCS"), the module versioning on the (non-upstreamed-yet) kvx Linux port is broken due to unexpected padding for __crc_* symbols. The kvx GCC adds padding so u32 gets 8-byte alignment instead of 4. I do not know if this happens for upstream architectures in general, but any compiler has the freedom to insert padding for faster access. Use the inline assembler to directly specify the wanted data layout. This is how we previously did before the breakage. Link: https://lore.kernel.org/lkml/20220817161438.32039-1-ysionneau@kalray.eu/ Link: https://lore.kernel.org/linux-kbuild/31ce5305-a76b-13d7-ea55-afca82c46cf2@kalray.eu/ Fixes: 7b4537199a4a ("kbuild: link symbol CRCs at final link, removing CONFIG_MODULE_REL_CRCS") Reported-by: Yann Sionneau Signed-off-by: Masahiro Yamada Tested-by: Yann Sionneau Signed-off-by: Sasha Levin --- include/linux/export-internal.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/linux/export-internal.h b/include/linux/export-internal.h index c2b1d4fd5987..fe7e6ba918f1 100644 --- a/include/linux/export-internal.h +++ b/include/linux/export-internal.h @@ -10,8 +10,10 @@ #include #include -/* __used is needed to keep __crc_* for LTO */ #define SYMBOL_CRC(sym, crc, sec) \ - u32 __section("___kcrctab" sec "+" #sym) __used __crc_##sym = crc + asm(".section \"___kcrctab" sec "+" #sym "\",\"a\"" "\n" \ + "__crc_" #sym ":" "\n" \ + ".long " #crc "\n" \ + ".previous" "\n") #endif /* __LINUX_EXPORT_INTERNAL_H__ */ From patchwork Wed Oct 19 08:32: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: 5216 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp265096wrs; Wed, 19 Oct 2022 04:21:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4TWVP+e2OKqmsbTtq+Q9NiQOUpoO5iLRoiPrJcSAzneWBa1y4rzTN7saVQ6Ror0jZpcU1V X-Received: by 2002:a17:902:ccc4:b0:17c:7cc1:a401 with SMTP id z4-20020a170902ccc400b0017c7cc1a401mr8085712ple.58.1666178497907; Wed, 19 Oct 2022 04:21:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178497; cv=none; d=google.com; s=arc-20160816; b=mb4PJYXmsCeqa9VAqYzQ5LcmeUOZnogJYG0pdZ09jetygsNLx2dG9OfOREehtjXDtl e4Q70D7xOARxh/GDffboyT6U5y33k6ZS/tD3uKb/VQuj5+BG8vrqxlc13+tgvauvsX0O D7RSEh//4qy++fny6O2WpwM9fpMaoBav+AAdLtEk3sihHEGPAljnKdslIyvkvgsF0a0n KUY6YHMI2a5frT1D6C2vD1AL4WyR1b+iB3RLJSfSDRLXcXN72VFjZKsyOtThoZc+XINQ RwbwmF8SxkvJK/DpJZ65fs+XeY97GNU1Sxmly62++uIdLTXGCuKln6jw1T694yDHZIHR Yjyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=j0WOnwDy/fHsUWAAM66E0e+NGaMU5a+QE38xdWa/NgQ=; b=miHfY1jKPuIZOw/mtYG3k6Aq/runMlFZm070bO5aKLxmq2FKp/Ffzo8XHrgk0TzeEt Fn24/o11d6zrrPDFGNp+iOwnhCOjQ8m2TZfykePCit4nfKv4Q3+GivEJse0zPJMGJv6m 3DIXdBlqFbmFXYPq+247GNy0YqDFfMpfNNHBWaLaZ/8eGFjCCAgfDhM8XvdJ3b80QNUv 5F1PjN2W9GCZaa9doae6uISddKn+mdIb0bDSFPUP6s8efm8npcwFV00PDaIQagA1kS+C 8cahjqJ5d4gN1vm7xuXQQmFi7GDArrpNBAQScxjbf/8IjPInQe3apzCRJdNGlIfaf80q 7cvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ltzt+PwS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w4-20020a656944000000b004370503d42dsi17900529pgq.554.2022.10.19.04.21.20; Wed, 19 Oct 2022 04:21:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ltzt+PwS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230215AbiJSLLj (ORCPT + 99 others); Wed, 19 Oct 2022 07:11:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230303AbiJSLKs (ORCPT ); Wed, 19 Oct 2022 07:10:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E71B818025A; Wed, 19 Oct 2022 03:38: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 14D70B8232F; Wed, 19 Oct 2022 09:07:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80912C433D6; Wed, 19 Oct 2022 09:06:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170419; bh=hpikQfhX5UrpbE7p8rotxFJp1nvp1LtV7VllHI95oG4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ltzt+PwSVw4qunJBt+RlmkGB6mLqW8qsHLx2QJWlrjEbC0L/KvkDEbIVoEuUIznpJ c1EkGEFVsOwcyr9yRfQ17OuNETZd6uZSdjPFDwwgjASpA8tFjvV2ZJ+v4TuUqG6Iy+ 02KfsBEsAvyieDo/HmMvW4UrygizrxPK8c6OO+Bk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Janis Schoetterl-Glausch , Masahiro Yamada , Sasha Levin Subject: [PATCH 6.0 649/862] kbuild: rpm-pkg: fix breakage when V=1 is used Date: Wed, 19 Oct 2022 10:32:16 +0200 Message-Id: <20221019083318.600727235@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114784316700926?= X-GMAIL-MSGID: =?utf-8?q?1747114784316700926?= From: Janis Schoetterl-Glausch [ Upstream commit 2e07005f4813a9ff6e895787e0c2d1fea859b033 ] Doing make V=1 binrpm-pkg results in: Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.EgV6qJ + umask 022 + cd . + /bin/rm -rf /home/scgl/rpmbuild/BUILDROOT/kernel-6.0.0_rc5+-1.s390x + /bin/mkdir -p /home/scgl/rpmbuild/BUILDROOT + /bin/mkdir /home/scgl/rpmbuild/BUILDROOT/kernel-6.0.0_rc5+-1.s390x + mkdir -p /home/scgl/rpmbuild/BUILDROOT/kernel-6.0.0_rc5+-1.s390x/boot + make -f ./Makefile image_name + cp test -e include/generated/autoconf.h -a -e include/config/auto.conf || ( \ echo >&2; \ echo >&2 " ERROR: Kernel configuration is invalid."; \ echo >&2 " include/generated/autoconf.h or include/config/auto.conf are missing.";\ echo >&2 " Run 'make oldconfig && make prepare' on kernel src to fix it."; \ echo >&2 ; \ /bin/false) arch/s390/boot/bzImage /home/scgl/rpmbuild/BUILDROOT/kernel-6.0.0_rc5+-1.s390x/boot/vmlinuz-6.0.0-rc5+ cp: invalid option -- 'e' Try 'cp --help' for more information. error: Bad exit status from /var/tmp/rpm-tmp.EgV6qJ (%install) Because the make call to get the image name is verbose and prints additional information. Fixes: 993bdde94547 ("kbuild: add image_name to no-sync-config-targets") Signed-off-by: Janis Schoetterl-Glausch Signed-off-by: Masahiro Yamada Signed-off-by: Sasha Levin --- scripts/package/mkspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/package/mkspec b/scripts/package/mkspec index 8fa7c5b8a1a1..c920c1b18e7a 100755 --- a/scripts/package/mkspec +++ b/scripts/package/mkspec @@ -88,10 +88,10 @@ $S mkdir -p %{buildroot}/boot %ifarch ia64 mkdir -p %{buildroot}/boot/efi - cp \$($MAKE image_name) %{buildroot}/boot/efi/vmlinuz-$KERNELRELEASE + cp \$($MAKE -s image_name) %{buildroot}/boot/efi/vmlinuz-$KERNELRELEASE ln -s efi/vmlinuz-$KERNELRELEASE %{buildroot}/boot/ %else - cp \$($MAKE image_name) %{buildroot}/boot/vmlinuz-$KERNELRELEASE + cp \$($MAKE -s image_name) %{buildroot}/boot/vmlinuz-$KERNELRELEASE %endif $M $MAKE %{?_smp_mflags} INSTALL_MOD_PATH=%{buildroot} modules_install $MAKE %{?_smp_mflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install From patchwork Wed Oct 19 08:32: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: 4870 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp224141wrs; Wed, 19 Oct 2022 02:39:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7zih8qUD2l3n9aPNo0qADmLBqp+51cp+xNYycz77gO+rPqhtzkR2ig/Yl4GTNdxpxxJfya X-Received: by 2002:aa7:c041:0:b0:45c:1584:23db with SMTP id k1-20020aa7c041000000b0045c158423dbmr6566192edo.184.1666172373372; Wed, 19 Oct 2022 02:39:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172373; cv=none; d=google.com; s=arc-20160816; b=sXgyBsEmZO0RP22lZFjD1gG8+3TJooYn98gKpzgCEx6fqQplBYd/219LpCrqylrA16 B6b+mb7gzz7mwlviRDjaDOqQuLhyVdIrJ44llTJBLHX970+kg4V5bFEyNP6rhs45GaTJ TEwglL6YnmCE2nS7xwOTWBr14JFt2ddDVfJCyEh3O5GPHXFj5z6lTv0VTQ3czFDRKwWJ SnYnDRQJF5hSKmRw5ahwyrcnLHS4it7q7HAJ6p3UCbt0KtEj5D1ptTtqpLKfjtO7/1WG 3fVLZOe1USRpla2vnQ0W2Lq8uk3vM1r78Piz1YR/h8w/WUze7Ce95Jkjgz6Ondi3NHFr lCIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VJ+Rg+1xcgXv+IYAaiAFf0JVtaFhhpPuyaFYntOWOtM=; b=e07N07+ClijThYNiyrF4saAakGorbnYrfOrIKtdhTNL79Gr/7v8qW/NGt6jrl9YgTN u1OEzYwJsTO3H47yH54AKOYwbpZc4U0Kt6gE7T1t7yS1OnIsIL01nGfyKGvbvIrh7yFq M0xNxIWiX9rlUZ+VE5g8tJG14UVYlCb5aN8lrIEtfA4q85MzEGqdsPmcIDpBLprwz1Jf kSwhCOVOTO7JYhGed1AaPpoPWZs8La8SF16K9o4Gm7f+x967KumGjhD76vrsHapqZnwx /f4Lceahssp4cfxiTetpr//2wmLSDlfUQGXva9uWCkSsvGb7Kcs0pjY44KgQvTDz0taa +t1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jdKqn1AH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cw10-20020a170906478a00b007897abccc6bsi17056768ejc.484.2022.10.19.02.39.09; Wed, 19 Oct 2022 02:39: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=jdKqn1AH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233234AbiJSJUT (ORCPT + 99 others); Wed, 19 Oct 2022 05:20:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233072AbiJSJSx (ORCPT ); Wed, 19 Oct 2022 05:18:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23F8EDAC75; Wed, 19 Oct 2022 02:07: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 dfw.source.kernel.org (Postfix) with ESMTPS id 2613661888; Wed, 19 Oct 2022 09:07:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 356CDC433D7; Wed, 19 Oct 2022 09:07:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170422; bh=tzkFWHdBR1QJkTnAVZrUmtw9WJSWAiTSqmAiaamAgSg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jdKqn1AHvAz7x5CL0OCQMf4yLrXtjvvYjz/2PD4sFqgQ92KXALrxXrpXVdbPnZ2y/ ZEqLwvYbB5TxkVihPznK+jIzQKteTfSK41b5sCHraUs1mXA1XSWO7RIQ7z3BvqE0Xu AJ1JCUdVsiS6r0G+cGNTQK07BGF28WnJJcE/fTz0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Herbert Xu , Sasha Levin Subject: [PATCH 6.0 650/862] crypto: marvell/octeontx - prevent integer overflows Date: Wed, 19 Oct 2022 10:32:17 +0200 Message-Id: <20221019083318.650728241@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108362356575857?= X-GMAIL-MSGID: =?utf-8?q?1747108362356575857?= From: Dan Carpenter [ Upstream commit caca37cf6c749ff0303f68418cfe7b757a4e0697 ] The "code_length" value comes from the firmware file. If your firmware is untrusted realistically there is probably very little you can do to protect yourself. Still we try to limit the damage as much as possible. Also Smatch marks any data read from the filesystem as untrusted and prints warnings if it not capped correctly. The "code_length * 2" can overflow. The round_up(ucode_size, 16) + sizeof() expression can overflow too. Prevent these overflows. Fixes: d9110b0b01ff ("crypto: marvell - add support for OCTEON TX CPT engine") Signed-off-by: Dan Carpenter Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- .../crypto/marvell/octeontx/otx_cptpf_ucode.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/marvell/octeontx/otx_cptpf_ucode.c b/drivers/crypto/marvell/octeontx/otx_cptpf_ucode.c index 40b482198ebc..a765eefb18c2 100644 --- a/drivers/crypto/marvell/octeontx/otx_cptpf_ucode.c +++ b/drivers/crypto/marvell/octeontx/otx_cptpf_ucode.c @@ -286,6 +286,7 @@ static int process_tar_file(struct device *dev, struct tar_ucode_info_t *tar_info; struct otx_cpt_ucode_hdr *ucode_hdr; int ucode_type, ucode_size; + unsigned int code_length; /* * If size is less than microcode header size then don't report @@ -303,7 +304,13 @@ static int process_tar_file(struct device *dev, if (get_ucode_type(ucode_hdr, &ucode_type)) return 0; - ucode_size = ntohl(ucode_hdr->code_length) * 2; + code_length = ntohl(ucode_hdr->code_length); + if (code_length >= INT_MAX / 2) { + dev_err(dev, "Invalid code_length %u\n", code_length); + return -EINVAL; + } + + ucode_size = code_length * 2; if (!ucode_size || (size < round_up(ucode_size, 16) + sizeof(struct otx_cpt_ucode_hdr) + OTX_CPT_UCODE_SIGN_LEN)) { dev_err(dev, "Ucode %s invalid size\n", filename); @@ -886,6 +893,7 @@ static int ucode_load(struct device *dev, struct otx_cpt_ucode *ucode, { struct otx_cpt_ucode_hdr *ucode_hdr; const struct firmware *fw; + unsigned int code_length; int ret; set_ucode_filename(ucode, ucode_filename); @@ -896,7 +904,13 @@ static int ucode_load(struct device *dev, struct otx_cpt_ucode *ucode, ucode_hdr = (struct otx_cpt_ucode_hdr *) fw->data; memcpy(ucode->ver_str, ucode_hdr->ver_str, OTX_CPT_UCODE_VER_STR_SZ); ucode->ver_num = ucode_hdr->ver_num; - ucode->size = ntohl(ucode_hdr->code_length) * 2; + code_length = ntohl(ucode_hdr->code_length); + if (code_length >= INT_MAX / 2) { + dev_err(dev, "Ucode invalid code_length %u\n", code_length); + ret = -EINVAL; + goto release_fw; + } + ucode->size = code_length * 2; if (!ucode->size || (fw->size < round_up(ucode->size, 16) + sizeof(struct otx_cpt_ucode_hdr) + OTX_CPT_UCODE_SIGN_LEN)) { dev_err(dev, "Ucode %s invalid size\n", ucode_filename); From patchwork Wed Oct 19 08:32: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: 5384 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp302860wrs; Wed, 19 Oct 2022 05:39:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4yVNYxCYaTu8kyrAOf7s3U3K7NuF3OavU8iyR6TQAhSDorvdovWhebpiPH2lBAyvjRScb1 X-Received: by 2002:a17:902:b942:b0:178:4a7e:da04 with SMTP id h2-20020a170902b94200b001784a7eda04mr8292964pls.8.1666183187994; Wed, 19 Oct 2022 05:39:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666183187; cv=none; d=google.com; s=arc-20160816; b=vOI5W1WHn6jOKRcOuceotu9HkA4WwXco4T1FwwAegAnDPBcVEgY2Ah8SgzkrOtRtIM v3TUaQqLFT4ZoTSxDGZX2IeVCQdT+sgYNWUKVUzXuCVCGwaXHTTaCh3F9ZIOl8TPQ1yj XUKxdsVU1PJXqedUduKGhiybVFV5wV23EVy3oyMjOo3kEcCOJyWw5Eb3JpPVrGoul2rW fwAjJbRhGjIL1Yc1nNZnU/ueOS4/piK0JFTe5y4qhedx5pkeMlXoU+Aps1B9VeykAnrv JFInnnYWf6HOMPLS4A1eLcQZkQeIcnfdMqcd5OgL11JNYkHDOhxQXLEBtfzoGViilkhA 2BPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hJv7IUM6kJVsPIVNE+HRCOwEHEJ86PcnO/llMYLz+4M=; b=sJqMjokhF5x7IoW+sB5NU1BhqYWJl5hEs+sbpzlFTE9Nj44BauwnTs5GGXvDtl6n8O w+ZxuxoA6IfYLcwCr1OqN11BrtAaxHKq5bfQ/EJW22baSzQ1uoerUwW9sNvJ9AHCjmsj srelTOCg/+sjGYBVgrPY/+cagas8PKU8IK0LhqFW3G+jFkTHb7O7RD80E3Pnr+8taoY2 K47eVQ0cVt7/VhfoJUmcgNZvofxf8o/k5VPPx1BVUREvViTlaS648qRhcNU0mJQoI5zA dAEj1vpuLL7TY0UgutDdXTE4FOm+5WBqx2tgELBRazb1FWyZIr5qDRvP/KRmGYFxeEjB 5qHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WMtQrTq5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a63fb4c000000b0043541f027e0si17361099pgj.877.2022.10.19.05.39.29; Wed, 19 Oct 2022 05:39: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=WMtQrTq5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231709AbiJSMeh (ORCPT + 99 others); Wed, 19 Oct 2022 08:34:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231608AbiJSMeO (ORCPT ); Wed, 19 Oct 2022 08:34: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 D4381106923; Wed, 19 Oct 2022 05:14: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 F0BF761852; Wed, 19 Oct 2022 09:07:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E195C433B5; Wed, 19 Oct 2022 09:07:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170425; bh=R5xFzSHogEP2NN2e/wL2tnIj+3tgTrpSBrWmiZXApdA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WMtQrTq5MwDsvEYRTkXFEQq5DtFqXMgOcdA7LpYhJ51qsL1mIV82P+do+VIATsmzn +emrgSRX/BGMS3hbWEFdEZKwZyqHC+QEgHT2FGin3RVFpI1WYtepcYKJ/nuD2pizss GZkgbeEK7d8bs5W9kbrUP/kFfSNw0CNSoyNdrAlQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Herbert Xu , Sasha Levin Subject: [PATCH 6.0 651/862] crypto: cavium - prevent integer overflow loading firmware Date: Wed, 19 Oct 2022 10:32:18 +0200 Message-Id: <20221019083318.699495645@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747119702636879822?= X-GMAIL-MSGID: =?utf-8?q?1747119702636879822?= From: Dan Carpenter [ Upstream commit 2526d6bf27d15054bb0778b2f7bc6625fd934905 ] The "code_length" value comes from the firmware file. If your firmware is untrusted realistically there is probably very little you can do to protect yourself. Still we try to limit the damage as much as possible. Also Smatch marks any data read from the filesystem as untrusted and prints warnings if it not capped correctly. The "ntohl(ucode->code_length) * 2" multiplication can have an integer overflow. Fixes: 9e2c7d99941d ("crypto: cavium - Add Support for Octeon-tx CPT Engine") Signed-off-by: Dan Carpenter Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/cavium/cpt/cptpf_main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/cavium/cpt/cptpf_main.c b/drivers/crypto/cavium/cpt/cptpf_main.c index 8c32d0eb8fcf..6872ac344001 100644 --- a/drivers/crypto/cavium/cpt/cptpf_main.c +++ b/drivers/crypto/cavium/cpt/cptpf_main.c @@ -253,6 +253,7 @@ static int cpt_ucode_load_fw(struct cpt_device *cpt, const u8 *fw, bool is_ae) const struct firmware *fw_entry; struct device *dev = &cpt->pdev->dev; struct ucode_header *ucode; + unsigned int code_length; struct microcode *mcode; int j, ret = 0; @@ -263,11 +264,12 @@ static int cpt_ucode_load_fw(struct cpt_device *cpt, const u8 *fw, bool is_ae) ucode = (struct ucode_header *)fw_entry->data; mcode = &cpt->mcode[cpt->next_mc_idx]; memcpy(mcode->version, (u8 *)fw_entry->data, CPT_UCODE_VERSION_SZ); - mcode->code_size = ntohl(ucode->code_length) * 2; - if (!mcode->code_size) { + code_length = ntohl(ucode->code_length); + if (code_length == 0 || code_length >= INT_MAX / 2) { ret = -EINVAL; goto fw_release; } + mcode->code_size = code_length * 2; mcode->is_ae = is_ae; mcode->core_mask = 0ULL; From patchwork Wed Oct 19 08:32: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: 4833 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223660wrs; Wed, 19 Oct 2022 02:38:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4pxSGA3sElmUpU3W0LFSe7QsHBLRLdyXQisNEwP7msq644uydz8DaKg8w2kBOwyKXyMLG3 X-Received: by 2002:a17:90b:4d0c:b0:20b:c983:2d85 with SMTP id mw12-20020a17090b4d0c00b0020bc9832d85mr44909023pjb.45.1666172286398; Wed, 19 Oct 2022 02:38:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172286; cv=none; d=google.com; s=arc-20160816; b=wVDpPwbfFcdMynzXx3/r/ZoCPyErtrS+QgdOEg6QLAR1koTHYnwO/gd0WUKnDM5OTh PlEJGThhoZ0MVNPv7McVd6N+NzfeXJr+Glf/HKYGiZOEVb5YktbsAIA47wMcVAqIC5iQ L5Kx6ytS61hKn83PAoe/1PCTOdKwIG3DM0qx/jMwE3K+QIybrH6ULr3KtqCmKU5jyAe2 ThGzvk72MujdQ6LK0nuObkaLsLCYjGRd924+YohlTNvO2yVElnVHTdKLbnODEhYXyXus 4V9jIBETk5iHKJp3xtQeGnwiNBrgNLFGTXuy7eTbX+Hhoo3FXfWenJFND6A+KQ1VEKou P0sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8RBzZXfFsXoaDF0cuHBCRrFrYa2uH463JaD/dSWbTKc=; b=AiyCr+ZzLU466kyNJMmEFEf1iLaMghfj289YnxLnJRbfh9uE5p/pF4fcXGs3kC1KxJ iTJpWLZUdpS+iDGod44sl4FKsSrByXZLPVvDRgBeFxfwpx7gpmmRxPNueh4L5zVVW5lg VI1Q3tlPGeUzZ38aT4hTRnXD1CqAU9TcobaPUi5tackkS205aH9xjV5+fXQU8OE1fHRA DN0oLYg4+dUXnPtHDVh+iUYQOAT2cyfqSNc8jStj7YGfcNypGdZdkDGqzMWzi+UQXI08 NpTsUsb289RWGCtEVnZuBa5qhPs0pQRb4YsBBG+PSwbQroata2NFbijuFkhvSrsWEBex AVrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Yk1vgJG3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b5-20020a170902e94500b0017c9ffbab0fsi17004362pll.152.2022.10.19.02.37.50; Wed, 19 Oct 2022 02:38: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=Yk1vgJG3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233555AbiJSJ03 (ORCPT + 99 others); Wed, 19 Oct 2022 05:26:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233791AbiJSJY6 (ORCPT ); Wed, 19 Oct 2022 05:24:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9925E09FA; Wed, 19 Oct 2022 02:11: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 9FB216186A; Wed, 19 Oct 2022 09:07:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B708DC433D6; Wed, 19 Oct 2022 09:07:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170428; bh=3Gfi9agU9cU+uff4O12IY+gLmC0ZvLn3iv815Gceu7s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yk1vgJG3QqXONevtsnu0Q2QKCmVG0dHDb4rrKGcUU6wsR3/G5Rb8uw07rFODAVVuf Q6J2ISnjT4T1VSN5Qd97NJEPTNpuR5MCLeSAYISdpW+7EHJ63bHEJVJ3Sz2B3i+uHN NFp50uSFb6sY3+N/Tdgx2d58D/YO94Q1uupmSse0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dominik Brodowski , Sebastian Andrzej Siewior , Sultan Alsawaf , "Jason A. Donenfeld" , Sasha Levin Subject: [PATCH 6.0 652/862] random: schedule jitter credit for next jiffy, not in two jiffies Date: Wed, 19 Oct 2022 10:32:19 +0200 Message-Id: <20221019083318.739414078@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108271176277234?= X-GMAIL-MSGID: =?utf-8?q?1747108271176277234?= From: Jason A. Donenfeld [ Upstream commit 122733471384be8c23f019fbbd46bdf7be561dcd ] Counterintuitively, mod_timer(..., jiffies + 1) will cause the timer to fire not in the next jiffy, but in two jiffies. The way to cause the timer to fire in the next jiffy is with mod_timer(..., jiffies). Doing so then lets us bump the upper bound back up again. Fixes: 50ee7529ec45 ("random: try to actively add entropy rather than passively wait for it") Fixes: 829d680e82a9 ("random: cap jitter samples per bit to factor of HZ") Cc: Dominik Brodowski Cc: Sebastian Andrzej Siewior Cc: Sultan Alsawaf Signed-off-by: Jason A. Donenfeld Signed-off-by: Sasha Levin --- drivers/char/random.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/char/random.c b/drivers/char/random.c index 060f999dcffb..46d6100fa3a7 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -1195,7 +1195,7 @@ static void __cold entropy_timer(struct timer_list *timer) */ static void __cold try_to_generate_entropy(void) { - enum { NUM_TRIAL_SAMPLES = 8192, MAX_SAMPLES_PER_BIT = HZ / 30 }; + enum { NUM_TRIAL_SAMPLES = 8192, MAX_SAMPLES_PER_BIT = HZ / 15 }; struct entropy_timer_state stack; unsigned int i, num_different = 0; unsigned long last = random_get_entropy(); @@ -1214,7 +1214,7 @@ static void __cold try_to_generate_entropy(void) timer_setup_on_stack(&stack.timer, entropy_timer, 0); while (!crng_ready() && !signal_pending(current)) { if (!timer_pending(&stack.timer)) - mod_timer(&stack.timer, jiffies + 1); + mod_timer(&stack.timer, jiffies); mix_pool_bytes(&stack.entropy, sizeof(stack.entropy)); schedule(); stack.entropy = random_get_entropy(); From patchwork Wed Oct 19 08:32: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: 4844 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223785wrs; Wed, 19 Oct 2022 02:38:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5cTVvpwwHXOG8jghtjKbdXcSJgRdywylQk6eGUekZGP0CjeycyL5t0WaLqu6h8u4Wk+5dF X-Received: by 2002:a05:6a00:1781:b0:561:7f7f:dc38 with SMTP id s1-20020a056a00178100b005617f7fdc38mr7836021pfg.42.1666172308804; Wed, 19 Oct 2022 02:38:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172308; cv=none; d=google.com; s=arc-20160816; b=bHHbkIlV+MCWSynHj5O2IN6HkVYkmyZ2h/G5a+uSvBe3mdT4rwCXkoeM+1lg6FpJ8F crxhoIWCNrs7SyaIuu6WMC4hJBowS89QsroM/xArqKV4/DcaxyhzTJnH0hmBVZo+5uTC VwoWxYuH79rlmA/mUGbLQfTi0HpXgVyJVTSXwit9PRHJJxPJIKfFnI9U4M2v4VUjxmov hBrtPODfIeI+G4ALNkrE0A74UuU/IZcOq8ynF8KUBwWCdlqmJjbWw8yGugzEDThaM2l7 djUJ4eJjR6G88OjxAJlZieoqLQGv+JwCDmYyacDw5c/i8PxjMKzlRIcTI3EGfD1EWau9 wVnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=oBrT6TR0WFZr08DQddYVyvrUM6feAxRhSk2hEnX4FZk=; b=Wdfvm9kHd4y+M26CK4VbNVHowyuEeayuGMWe2xsw1iT8y73zl4S7kjOJAMxTjwndKq 4xMtiCk7ARJ+JJG0UF6+Uit3yl8NuZWjyfQnKwAvl/wnCcNFeQ+TWterP/6VBEWaC80e +fkeeJMEM05ct7Kcmo4UmmO9in9JtrnSOSj1Ffg80BcNAGeaKVnfhSOZmF+hGnb43bBd SX5GpeEoCNhUxCXdze/22is+eOPqp+hVw7vxgUOnwVXzT2oqT37C07mSNabpE3q3j1zm B+UCE1HLIlw+0yzeqt+EiNCY3uh8c1lHyWNOy9sw/CpS8Fx+0dbvAkv4o4DouEPeIESk 5vhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iSj2wHnc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s187-20020a632cc4000000b0045e96393e37si17643564pgs.20.2022.10.19.02.38.16; Wed, 19 Oct 2022 02:38: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=iSj2wHnc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233277AbiJSJU2 (ORCPT + 99 others); Wed, 19 Oct 2022 05:20:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233455AbiJSJTR (ORCPT ); Wed, 19 Oct 2022 05:19: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 DB4CFDCACD; Wed, 19 Oct 2022 02:08: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 40DE761880; Wed, 19 Oct 2022 09:07:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51B09C433D7; Wed, 19 Oct 2022 09:07:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170430; bh=EToABdKvy4XhxuhBiW5VUN7zQrDrFjx5hkuwfUdi6NE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iSj2wHncG2xXVg5AtClwlA8CZH5HeXyjL0reFSNJLpYckrxHyb1srOCEIQjbiX5Lq jY6AqHnsEwxGfxl1DKPrkGO98NAzN3JklDrQlrOoSH3QVCLT+JDILC0igqRTOrsBLp OgCKmfY+Txhn0KXOCaCrmJN8Pz4uNikR/6hheP8k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vincent Knecht , Dmitry Baryshkov , Bjorn Andersson , Bryan ODonoghue , Daniel Lezcano , Sasha Levin Subject: [PATCH 6.0 653/862] thermal/drivers/qcom/tsens-v0_1: Fix MSM8939 fourth sensor hw_id Date: Wed, 19 Oct 2022 10:32:20 +0200 Message-Id: <20221019083318.788220703@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108294969362449?= X-GMAIL-MSGID: =?utf-8?q?1747108294969362449?= From: Vincent Knecht [ Upstream commit b0c883e900702f408d62cf92b0ef01303ed69be9 ] Reading temperature from this sensor fails with 'Invalid argument'. Looking at old vendor dts [1], its hw_id should be 3 instead of 4. Change this hw_id accordingly. [1] https://github.com/msm8916-mainline/android_kernel_qcom_msm8916/blob/master/arch/arm/boot/dts/qcom/msm8939-common.dtsi#L511 Fixes: 332bc8ebab2c ("thermal: qcom: tsens-v0_1: Add support for MSM8939") Signed-off-by: Vincent Knecht Reviewed-by: Dmitry Baryshkov Reviewed-by: Bjorn Andersson Reviewed-by: Bryan O'Donoghue Link: https://lore.kernel.org/r/20220811105014.7194-1-vincent.knecht@mailoo.org Signed-off-by: Daniel Lezcano Signed-off-by: Sasha Levin --- drivers/thermal/qcom/tsens-v0_1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/thermal/qcom/tsens-v0_1.c b/drivers/thermal/qcom/tsens-v0_1.c index f136cb350238..327f37202c69 100644 --- a/drivers/thermal/qcom/tsens-v0_1.c +++ b/drivers/thermal/qcom/tsens-v0_1.c @@ -604,7 +604,7 @@ static const struct tsens_ops ops_8939 = { struct tsens_plat_data data_8939 = { .num_sensors = 10, .ops = &ops_8939, - .hw_ids = (unsigned int []){ 0, 1, 2, 4, 5, 6, 7, 8, 9, 10 }, + .hw_ids = (unsigned int []){ 0, 1, 2, 3, 5, 6, 7, 8, 9, 10 }, .feat = &tsens_v0_1_feat, .fields = tsens_v0_1_regfields, From patchwork Wed Oct 19 08:32: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: 5148 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp253305wrs; Wed, 19 Oct 2022 03:57:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5f8OBrK9rt6wlVNTamKyDuiI2riUBWCGrdY3QmZoSFisYX0XyAOocVZO//PyC9xGW/YFcU X-Received: by 2002:a17:907:3c81:b0:77a:327a:815f with SMTP id gl1-20020a1709073c8100b0077a327a815fmr6300216ejc.422.1666177020130; Wed, 19 Oct 2022 03:57:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666177020; cv=none; d=google.com; s=arc-20160816; b=uMRdc1FCkSybQey7hzROzaGqyOFXGNfQCLRF1CMZtkVUZlHbdceObkIoyPMiVAr2fI DNfYfjr4tXm2enSVPPz2mFSIjpqj4RRRcoo3Ja94ijBKxQyp1IA2E/lLSXWpZ7VS9bB6 rOtfuIF3N9q5G41BBuMjMIeKOGe5z5SkfpLjE7yqkacFhbbOCEeXGS9N90d1AeZ9DFUF DghGbJLK1opN8uk5X9vJPc/ImdPZfiENB7qXD2XtlfY2NfEUF1aVj0amnyWuI26EC7fI STeCVZxhDoGCGxJM+G59TM0eu1+ghqcULs1nZZafNfPHIOBPLpsoM//t0CAgjYIjHQra S8Mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Hvs4hgilptgO+/i38adUEuP5+Rgjnez5emDoQYy+TTc=; b=a0LdIwHRTiwCilBs+AmmQspcuuFPhILiefdZT+87eAHpe2RUm1gFVbtMQLHpMDSCOM Uezq1yFoIimcCvW4Zfo6duHqlIgU/Tsh5ih+VDNYbg588jD19MSvzy1JSWKvzdKojY0j pDmhLBhQvnSCsvl3+2jj49RkMTvXqw6zQrQ83pRNCsCJUOkaIvKe5hgpiVNV1qtrMElf T6Qe6IhDYOKqXOKSM/pvoTxnZkk5ITtqY/aOrnrm+JJCdV9pwvUx9/k0R8YB/aDOaThc LQyMnNRDLSSqfYlRLSQYGXHCW2wZOo0F9laYjuIy1g/xkhaEOGZ/slvle5PCBZS7oJ/y 2q1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lAeYbyW0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u2-20020a50eac2000000b004513a465ec6si12794811edp.94.2022.10.19.03.56.35; Wed, 19 Oct 2022 03: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=lAeYbyW0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234657AbiJSK4I (ORCPT + 99 others); Wed, 19 Oct 2022 06:56:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235165AbiJSKzU (ORCPT ); Wed, 19 Oct 2022 06:55: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 3C50A162513; Wed, 19 Oct 2022 03:26:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7906FB82392; Wed, 19 Oct 2022 09:07:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7446C433B5; Wed, 19 Oct 2022 09:07:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170433; bh=gQ9uhgSJYlR3is3lDutdEcOjJQsBHpKOa3lCfgM3yUc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lAeYbyW0jW8vwGnz3c0oDnH646WLr2bNry/+T/PymK2e906OAIYurHo6oW5iUKCl8 scvPLWREK1h9C32ZO5+eYwL45FfxuTQcVx/n7kogGyVKGGX8kpfhzqFO49tkLv9xo9 IP69LppB1MLlk4K5lpbNxTD2rHsb3Y+tSljEgNmg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shuai Xue , Tony Luck , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 6.0 654/862] ACPI: APEI: do not add task_work to kernel thread to avoid memory leak Date: Wed, 19 Oct 2022 10:32:21 +0200 Message-Id: <20221019083318.839392843@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747113235179371582?= X-GMAIL-MSGID: =?utf-8?q?1747113235179371582?= From: Shuai Xue [ Upstream commit 415fed694fe11395df56e05022d6e7cee1d39dd3 ] If an error is detected as a result of user-space process accessing a corrupt memory location, the CPU may take an abort. Then the platform firmware reports kernel via NMI like notifications, e.g. NOTIFY_SEA, NOTIFY_SOFTWARE_DELEGATED, etc. For NMI like notifications, commit 7f17b4a121d0 ("ACPI: APEI: Kick the memory_failure() queue for synchronous errors") keep track of whether memory_failure() work was queued, and make task_work pending to flush out the queue so that the work is processed before return to user-space. The code use init_mm to check whether the error occurs in user space: if (current->mm != &init_mm) The condition is always true, becase _nobody_ ever has "init_mm" as a real VM any more. In addition to abort, errors can also be signaled as asynchronous exceptions, such as interrupt and SError. In such case, the interrupted current process could be any kind of thread. When a kernel thread is interrupted, the work ghes_kick_task_work deferred to task_work will never be processed because entry_handler returns to call ret_to_kernel() instead of ret_to_user(). Consequently, the estatus_node alloced from ghes_estatus_pool in ghes_in_nmi_queue_one_entry() will not be freed. After around 200 allocations in our platform, the ghes_estatus_pool will run of memory and ghes_in_nmi_queue_one_entry() returns ENOMEM. As a result, the event failed to be processed. sdei: event 805 on CPU 113 failed with error: -2 Finally, a lot of unhandled events may cause platform firmware to exceed some threshold and reboot. The condition should generally just do if (current->mm) as described in active_mm.rst documentation. Then if an asynchronous error is detected when a kernel thread is running, (e.g. when detected by a background scrubber), do not add task_work to it as the original patch intends to do. Fixes: 7f17b4a121d0 ("ACPI: APEI: Kick the memory_failure() queue for synchronous errors") Signed-off-by: Shuai Xue Reviewed-by: Tony Luck Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/acpi/apei/ghes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c index d91ad378c00d..80ad530583c9 100644 --- a/drivers/acpi/apei/ghes.c +++ b/drivers/acpi/apei/ghes.c @@ -985,7 +985,7 @@ static void ghes_proc_in_irq(struct irq_work *irq_work) ghes_estatus_cache_add(generic, estatus); } - if (task_work_pending && current->mm != &init_mm) { + if (task_work_pending && current->mm) { estatus_node->task_work.func = ghes_kick_task_work; estatus_node->task_work_cpu = smp_processor_id(); ret = task_work_add(current, &estatus_node->task_work, From patchwork Wed Oct 19 08:32: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: 5163 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp253793wrs; Wed, 19 Oct 2022 03:58:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6PRzkD6bhccVe1zQxPyU8O1Et53vlxmSRl2F/QqxjRLjNVfcR+/cirgewQ6+XK+BeP7ACE X-Received: by 2002:aa7:8893:0:b0:563:89e0:2d43 with SMTP id z19-20020aa78893000000b0056389e02d43mr7608188pfe.25.1666177097450; Wed, 19 Oct 2022 03:58:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666177097; cv=none; d=google.com; s=arc-20160816; b=C/s/JIIGSPxw54O2Grfz7fgSen9G/A4mbE3o4YlTY9jiaJ+h0t2uuFlaq/AISNaP9y WeJEALGpE8j6snGFK4ZYYD4F/jWtmbHwqhkzqzFQa/NcVuXVmi857tSgHefIpPQAU0mY 97JoG6VINn2fxNtVcg1lS1kaCdCmOVKQpBzLHoKaInS9/2It703rMXT7B9sk37MncW6W p+tPKCwGH6nrcgW2oungAVcZK4WvpGlMOKCwN96JIwU/NO9CON/3dCPFXwfsWX8Kpc7R 6bDAAnhC0c3/qWbsiXs7twabDa7AXqVnURE588p7CS1m+TDlYxd2OnJie0cUZpkQrRLK AYjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=mRjNevsjHmu6soZypnH8AnuQIel6+ino/dMijUWye8w=; b=XQP0/MeCyASZuNEI1g11HW+1moVCFZcz9qj+AQdJ+BbuvrSMG1lGaNeaaxRzOsdOo0 W1AnMW72AKorsBJAen9CmXe1ung+ixHELe5j8vsFOue+5mNdo+Jer5GQMspeUXYLlLll K3ptcOrEtLyONaNGH8cPzsbFptAk2Vbzbmda+Gz7P0MJEnl1xOOv8xO0jhq2nxSA+lA7 5H+deeJd+fCbzyWrhCTXYaJ5bgwey9ehDnhjGIr14qeT4IjkW3KMzs38utu7TUljkoXN LBxHy1391e4NeeRADGAznesvMmWGlS1qtKERml1lpwsicL0wsIZNP5y0PX/2qvIHdgD8 wF7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZDsRjMuf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i21-20020aa787d5000000b00557c5641be2si15656316pfo.248.2022.10.19.03.58.04; Wed, 19 Oct 2022 03:58: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=ZDsRjMuf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234716AbiJSK5Z (ORCPT + 99 others); Wed, 19 Oct 2022 06:57:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231625AbiJSK43 (ORCPT ); Wed, 19 Oct 2022 06:56: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 4D5DFF6C16; Wed, 19 Oct 2022 03:27:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 30BF2B82487; Wed, 19 Oct 2022 09:07:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 870FCC433B5; Wed, 19 Oct 2022 09:07:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170435; bh=VvCdVM0o6p1PxXk6TZ1vPl1OdkJWcfXxLrIRwfpPLSI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZDsRjMufKt3839bql0sNPPOqH6LE1sFAIYJrtUoR4ewgjyxptHKfQbbwRSJaiTuxG vK/tidnewu2EzimXWJbDI4/Z0YbpxKwD1DeWgLE5WxkQ3Vc31WVv125mjIGnlqA+gn kSIZT7yNes9YgmqMQsXEv4p6mprn1mKVieurRCi0= 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 6.0 655/862] f2fs: fix race condition on setting FI_NO_EXTENT flag Date: Wed, 19 Oct 2022 10:32:22 +0200 Message-Id: <20221019083318.888624637@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747113316324783929?= X-GMAIL-MSGID: =?utf-8?q?1747113316324783929?= 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 866e72b29bd5..761fd42c93f2 100644 --- a/fs/f2fs/extent_cache.c +++ b/fs/f2fs/extent_cache.c @@ -804,9 +804,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); if (et->largest.len) { et->largest.len = 0; From patchwork Wed Oct 19 08:32: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: 5191 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp263934wrs; Wed, 19 Oct 2022 04:19:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4bbo243AL/tsiF8X96QSsXY9PfAqXzdHV89MY5Y1CKweYsBuaEd/sc0wCZ4fO4H76gj18m X-Received: by 2002:a63:fa4f:0:b0:438:e26d:5ec with SMTP id g15-20020a63fa4f000000b00438e26d05ecmr6810804pgk.361.1666178344860; Wed, 19 Oct 2022 04:19:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178344; cv=none; d=google.com; s=arc-20160816; b=DaV/olzPKN1Ef434oeNhrj8hqPca2FSnSHnGzYYTH8nPjF7xXvM7fWtQAWDcVpb7TG WEQGWIK/rAZXiYsniNnMsZEnYHyLzHHOWvH3RCqd+5p+hcNAZb0MJqMC0r+WPh6NoicI TF94ocr4kp/gYiIa04P/TbMs+fUTCaTGQpRNuU3FCLks+hpsjYoKjoyj7c8vbPWSBCPQ +drlJUEysHXB6Owonbp00y0pdbXXgWHMUmZNprfHlF7iHaePpqbavCLGQVhkdkE5Code VTynZSWRoaXg3PTsnhAKbX4j9DOKweb4CFkIHJa3nMxJm1TOSxOm80mMQFoAx/I3Wnvx F+Yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OMCeEa1Gu6ZEWxOVzCA886TAxMLjvrkHNxDgFQnL5Zc=; b=hVUwH0dDG6Unh+iMhXwhmpdBC7j8ynAlQbRp87V2/7lZr0PoxKpUGJp6vlhPSV0edt 7c+6RsqRaNc8ZI2WxPhxtdgKDOkyYWIlAVb+VDkZ2Vmc7X+v81TzCuiJuPUe7V4xJeuI X4LM69jZoc2VjMQ1Fb5wKdX1MvSWRMQtz0OUekl24LRL9zOWuj19XpGwYol3bemNkNcu tVDQfXSzrRoaw4XCaYKEafmwG3oNrZDxM2vqIZKNILrVi0vaq6Y5RaqWUDf6TMeE3Z1p 60vLewkVsH49v4pes8n2yVQ/bbnNoHxjxh0WgyfP4JIYG8D1H5TnJV/GRO7U7muHxtv0 kScg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kQ3mIr2o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lr1-20020a17090b4b8100b002034e5450f0si26925324pjb.131.2022.10.19.04.18.43; Wed, 19 Oct 2022 04:19:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kQ3mIr2o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231531AbiJSLDa (ORCPT + 99 others); Wed, 19 Oct 2022 07:03:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234760AbiJSLC7 (ORCPT ); Wed, 19 Oct 2022 07:02: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 99CCD2496B; Wed, 19 Oct 2022 03:32: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 8A256B82498; Wed, 19 Oct 2022 09:07:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD4A1C433D6; Wed, 19 Oct 2022 09:07:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170441; bh=fsU/NIhV6UV2C5uJfH6d7QtH0kxG2G+HJD0NXYBrLi0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kQ3mIr2oiSeR8vo/vRUMb8qd/fgi4bzfz4Odv6ERSS5uZJrdDPaS2Hycssp8hDDv5 4VNqJuuhvNL9q9DYLh/653gNZXtTO3eAFACbsJ9pr5blVfkggNpmTyPQKMY3CKTIx/ URqT+DCkjQHuLloH5AMAEw/kg4GpEzd1XF5/pI4w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chao Yu , Jaegeuk Kim , Sasha Levin Subject: [PATCH 6.0 656/862] f2fs: fix to account FS_CP_DATA_IO correctly Date: Wed, 19 Oct 2022 10:32:23 +0200 Message-Id: <20221019083318.937593962@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114624157428006?= X-GMAIL-MSGID: =?utf-8?q?1747114624157428006?= From: Chao Yu [ Upstream commit d80afefb17e01aa0c46a8eebc01882e0ebd8b0f6 ] f2fs_inode_info.cp_task was introduced for FS_CP_DATA_IO accounting since commit b0af6d491a6b ("f2fs: add app/fs io stat"). However, cp_task usage coverage has been increased due to below commits: commit 040d2bb318d1 ("f2fs: fix to avoid deadloop if data_flush is on") commit 186857c5a14a ("f2fs: fix potential recursive call when enabling data_flush") So that, if data_flush mountoption is on, when data flush was triggered from background, the IO from data flush will be accounted as checkpoint IO type incorrectly. In order to fix this issue, this patch splits cp_task into two: a) cp_task: used for IO accounting b) wb_task: used to avoid deadlock Fixes: 040d2bb318d1 ("f2fs: fix to avoid deadloop if data_flush is on") Fixes: 186857c5a14a ("f2fs: fix potential recursive call when enabling data_flush") Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin --- fs/f2fs/checkpoint.c | 13 +++++++++---- fs/f2fs/data.c | 4 ++-- fs/f2fs/f2fs.h | 4 +++- fs/f2fs/segment.c | 2 +- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index f051a73e464a..e04ed60cc9e2 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c @@ -1061,7 +1061,8 @@ void f2fs_remove_dirty_inode(struct inode *inode) spin_unlock(&sbi->inode_lock[type]); } -int f2fs_sync_dirty_inodes(struct f2fs_sb_info *sbi, enum inode_type type) +int f2fs_sync_dirty_inodes(struct f2fs_sb_info *sbi, enum inode_type type, + bool from_cp) { struct list_head *head; struct inode *inode; @@ -1096,11 +1097,15 @@ int f2fs_sync_dirty_inodes(struct f2fs_sb_info *sbi, enum inode_type type) if (inode) { unsigned long cur_ino = inode->i_ino; - F2FS_I(inode)->cp_task = current; + if (from_cp) + F2FS_I(inode)->cp_task = current; + F2FS_I(inode)->wb_task = current; filemap_fdatawrite(inode->i_mapping); - F2FS_I(inode)->cp_task = NULL; + F2FS_I(inode)->wb_task = NULL; + if (from_cp) + F2FS_I(inode)->cp_task = NULL; iput(inode); /* We need to give cpu to another writers. */ @@ -1229,7 +1234,7 @@ static int block_operations(struct f2fs_sb_info *sbi) /* write all the dirty dentry pages */ if (get_pages(sbi, F2FS_DIRTY_DENTS)) { f2fs_unlock_all(sbi); - err = f2fs_sync_dirty_inodes(sbi, DIR_INODE); + err = f2fs_sync_dirty_inodes(sbi, DIR_INODE, true); if (err) return err; cond_resched(); diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index aa3ccddfa037..5e88272d94e4 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -2856,7 +2856,7 @@ int f2fs_write_single_data_page(struct page *page, int *submitted, } unlock_page(page); if (!S_ISDIR(inode->i_mode) && !IS_NOQUOTA(inode) && - !F2FS_I(inode)->cp_task && allow_balance) + !F2FS_I(inode)->wb_task && allow_balance) f2fs_balance_fs(sbi, need_balance_fs); if (unlikely(f2fs_cp_error(sbi))) { @@ -3156,7 +3156,7 @@ static inline bool __should_serialize_io(struct inode *inode, struct writeback_control *wbc) { /* to avoid deadlock in path of data flush */ - if (F2FS_I(inode)->cp_task) + if (F2FS_I(inode)->wb_task) return false; if (!S_ISREG(inode->i_mode)) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 30fdda714e95..1e57b11ffe2a 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -786,6 +786,7 @@ struct f2fs_inode_info { unsigned int clevel; /* maximum level of given file name */ struct task_struct *task; /* lookup and create consistency */ struct task_struct *cp_task; /* separate cp/wb IO stats*/ + struct task_struct *wb_task; /* indicate inode is in context of writeback */ nid_t i_xattr_nid; /* node id that contains xattrs */ loff_t last_disk_size; /* lastly written file size */ spinlock_t i_size_lock; /* protect last_disk_size */ @@ -3741,7 +3742,8 @@ int f2fs_recover_orphan_inodes(struct f2fs_sb_info *sbi); int f2fs_get_valid_checkpoint(struct f2fs_sb_info *sbi); void f2fs_update_dirty_folio(struct inode *inode, struct folio *folio); void f2fs_remove_dirty_inode(struct inode *inode); -int f2fs_sync_dirty_inodes(struct f2fs_sb_info *sbi, enum inode_type type); +int f2fs_sync_dirty_inodes(struct f2fs_sb_info *sbi, enum inode_type type, + bool from_cp); void f2fs_wait_on_all_pages(struct f2fs_sb_info *sbi, int type); u64 f2fs_get_sectors_written(struct f2fs_sb_info *sbi); int f2fs_write_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc); diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 0de21f82d7bc..84bad18ce13d 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -476,7 +476,7 @@ void f2fs_balance_fs_bg(struct f2fs_sb_info *sbi, bool from_bg) mutex_lock(&sbi->flush_lock); blk_start_plug(&plug); - f2fs_sync_dirty_inodes(sbi, FILE_INODE); + f2fs_sync_dirty_inodes(sbi, FILE_INODE, false); blk_finish_plug(&plug); mutex_unlock(&sbi->flush_lock); From patchwork Wed Oct 19 08:32: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: 4822 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223436wrs; Wed, 19 Oct 2022 02:37:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7bdjyY1zgQBQ5Q7C3dLhXdmQDEhB6fI/ISPl/0l2ROSK9tBujqVz0+l8yRFcIjf8CkrbIp X-Received: by 2002:a05:6402:2552:b0:45d:ecf:b23 with SMTP id l18-20020a056402255200b0045d0ecf0b23mr6537361edb.255.1666172250521; Wed, 19 Oct 2022 02:37:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172250; cv=none; d=google.com; s=arc-20160816; b=lhA5KQZgNo5rz07IZ4ubEZHN2VzhgEO6suhMbJjv6SbzWPyn58jPFtkJAVs8KWU8LW 73VkcyQ0ZcLnHL3DEJQa7Rs5n3JJs05tY/16DDbNILezqyCHiIShDrqMT7M4jaV1L2G3 s+4AHnVTRaqMLh6pvfSQiGUJzpg2KzNVGfHTT+N0e0UFcKG9/6zkWIjvKbdUGREUSb4D cwnHXBpK9Cfgd7ZB3KZggYmRxR2/F/DCrknSW55zFVG8tTlZVhuQuf+mva6dYdB/gpD+ ZeNkK4w3BgjnjUeRF9BxaoDQSCGU25wl+lwwzhwvCQbjgwG5WMMYNISwOXFUerCQtIjf j1Mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Z+mgeY0NBF7ms7WW8XX9ye01kwCfYzAN3ty1cL3dAa8=; b=c7ohLZGz5XlcqEEpFrWLwUZaZiTzvM0ryoBi78HYU5t9j7YG7+ug7rHEfaQGsn9u7x zVOAMXnSQfFNxKLhX12pEZwvjlbdt8eriO5aRjs1/73zSgJs3bFNcVMsRDxbgxHPE3VP Jz3+ynyTwcAXy1tZrAcyMQIQDglyLHPhE+9jg4F0tbMQPbq/GS8mr4fph0oVRnN0u98F BAueKvmC1YvAUiPpCgrMQZohyY6ZCieLclOC2GkIJrIhMkNfeXJZ/uaaFLy+rT6+q5hV 4omGw86Lqe1k0w9cay1Fb6wO/x7CWgVdVP81ibe28flj3KYH8iC1p9lWl/lWCWLSb4Wz 31oQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kvZXu4Pi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l9-20020a1709062a8900b00780a3097d20si11384963eje.180.2022.10.19.02.37.05; Wed, 19 Oct 2022 02:37: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=kvZXu4Pi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233318AbiJSJUb (ORCPT + 99 others); Wed, 19 Oct 2022 05:20:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233465AbiJSJTT (ORCPT ); Wed, 19 Oct 2022 05:19:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED807DCE8D; Wed, 19 Oct 2022 02:08:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 720F161825; Wed, 19 Oct 2022 09:07:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A413C433D7; Wed, 19 Oct 2022 09:07:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170443; bh=BdUT6MVBWP9eWHoam61ekkpWBMFDaB0rW36JYnis4qU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kvZXu4Pimo1U3TIJO77OdgYVS9AFruhx/3Yr1lxxGyKwZCUg5Jforx2XqdU0IwlMo fQBIh8uiFEPXvcs8wZ4SEQtj/nxDXutR8/1ZTXGJNk9YZlQerVAArgx2GKnHe+vze3 PFIbN6IA+Q3H/xbcKYqx7vs0NOYsInobvtvyGETQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Rui , Wang Wendy , Len Brown , Sasha Levin Subject: [PATCH 6.0 657/862] tools/power turbostat: Use standard Energy Unit for SPR Dram RAPL domain Date: Wed, 19 Oct 2022 10:32:24 +0200 Message-Id: <20221019083318.988379410@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108233856121125?= X-GMAIL-MSGID: =?utf-8?q?1747108233856121125?= From: Zhang Rui [ Upstream commit b2d433ae637626d44c9d4a75dd3330cf68fed9de ] Intel Xeon servers used to use a fixed energy resolution (15.3uj) for Dram RAPL domain. But on SPR, Dram RAPL domain follows the standard energy resolution as described in MSR_RAPL_POWER_UNIT. Remove the SPR rapl_dram_energy_units quirk. Fixes: e7af1ed3fa47 ("tools/power turbostat: Support additional CPU model numbers") Signed-off-by: Zhang Rui Tested-by: Wang Wendy Signed-off-by: Len Brown Signed-off-by: Sasha Levin --- tools/power/x86/turbostat/turbostat.c | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 831dc32d45fa..b7d2a0cd0ac2 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -4560,7 +4560,6 @@ static double rapl_dram_energy_units_probe(int model, double rapl_energy_units) case INTEL_FAM6_SKYLAKE_X: /* SKX */ case INTEL_FAM6_XEON_PHI_KNL: /* KNL */ case INTEL_FAM6_ICELAKE_X: /* ICX */ - case INTEL_FAM6_SAPPHIRERAPIDS_X: /* SPR */ return (rapl_dram_energy_units = 15.3 / 1000000); default: return (rapl_energy_units); From patchwork Wed Oct 19 08:32: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: 5145 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp253286wrs; Wed, 19 Oct 2022 03:56:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5yq0/OEV0+rE1JxDM5p77f0OrsU5dr6Gfws3mtaOnysUgqCvWOa0zlHPl/EiBAu+KHLczp X-Received: by 2002:a17:907:7b8b:b0:78d:cee5:3145 with SMTP id ne11-20020a1709077b8b00b0078dcee53145mr5946966ejc.537.1666177017141; Wed, 19 Oct 2022 03:56:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666177017; cv=none; d=google.com; s=arc-20160816; b=eZMrW2C+CxvU8z2WDpHY2L/VNDqOk2gRmCdyijZGRnaWnzanov05T6xK7i5Nhuzad8 fbaMaK60cmALENA44baih91gH+kCTz4/LkQ1fH15ezSIzlSfLvgrQIPIwqHkatQbn03E vZso0NDxqDWMfYUGkcvdhP+0jANaYRHt7DjJVUZrikWrfl7i0lrXFe3N5BuSU5dA7tbx C7B9Cj+XY0/feRvuTb/yDTYnWUHPlf6e6ZYl0ZBn8cbipQdvd5Nx7AHkmYRecyPFljFo qtj6STmRbj29gVbF7WFHlndLJ6W48ne0UbswBBs84txw3QHeM3g+qBHHtcT3zu9wpL4+ hB0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4vRJUTUzwjYB2roPGkBz4trD4wxoeZa0gezVN8vh6Qc=; b=vsh29L90VEDG3kPwMV1orqBwSt36j+G4rON9uMLauCaxydz+hyDOJC8rUBvpEZx6Ip 3HjpB2KTCypYZFWGofWWOMyNnJwhQGpj3Qv+0lXvd18L9r2FTyKctWimWyZMVO7+OABM 6qTZQBZo1UyMJlOGcy6O6EKuOTi5fL4lR5FZ1xAucWAoKJrsd+xPr9JUUcg2JS7Rz2FN OXK9kyZ/KRoNQQTherkZtBoGpD+c9BYY4N1mSpLkODH/G7XPo/XWAT8C7NFpeZgCN3F+ XT7N1hsAca97fUdAGk9M6MpUXKDHvZy9Fyjs6dkrPZ7TWRJpbpGyhxwF5rlz8PIy6wWu SjXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rCQFj+ur; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dp18-20020a170906c15200b0078bec673145si13661098ejc.519.2022.10.19.03.56.31; Wed, 19 Oct 2022 03:56: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=rCQFj+ur; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234505AbiJSKz7 (ORCPT + 99 others); Wed, 19 Oct 2022 06:55:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235073AbiJSKzE (ORCPT ); Wed, 19 Oct 2022 06:55: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 428E616087A; Wed, 19 Oct 2022 03:26: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 ams.source.kernel.org (Postfix) with ESMTPS id D5CB1B82491; Wed, 19 Oct 2022 09:07:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3E71AC433D7; Wed, 19 Oct 2022 09:07:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170446; bh=X1wE11PrAAWw40XctTtBRMrMg9csj3krl4R38bk5NqQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rCQFj+urJjHODUMVjRzI/X/dNQItzdRh/ycpQd3Y4Ljqulm03BMDIUNs7GO4ckYsQ IcHVQhCHXFg13RFKVbfvApU/87afXvMV193LZBkxum9+FZdT4rYVAUcAOoL+mBt3KP My5u6YD8+7D2bujuprMYFFckZZiKjiEPQJ4LUtZQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shuah Khan , linux-kselftest@vger.kernel.org, Jarkko Sakkinen , Stefan Berger , Sasha Levin Subject: [PATCH 6.0 658/862] selftest: tpm2: Add Client.__del__() to close /dev/tpm* handle Date: Wed, 19 Oct 2022 10:32:25 +0200 Message-Id: <20221019083319.039227250@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747113231614670128?= X-GMAIL-MSGID: =?utf-8?q?1747113231614670128?= From: Stefan Berger [ Upstream commit 2d869f0b458547386fbcd8cf3004b271b7347b7f ] The following output can bee seen when the test is executed: test_flush_context (tpm2_tests.SpaceTest) ... \ /usr/lib64/python3.6/unittest/case.py:605: ResourceWarning: \ unclosed file <_io.FileIO name='/dev/tpmrm0' mode='rb+' closefd=True> An instance of Client does not implicitly close /dev/tpm* handle, once it gets destroyed. Close the file handle in the class destructor Client.__del__(). Fixes: 6ea3dfe1e0732 ("selftests: add TPM 2.0 tests") Cc: Shuah Khan Cc: linux-kselftest@vger.kernel.org Cc: Jarkko Sakkinen Signed-off-by: Stefan Berger Reviewed-by: Jarkko Sakkinen Signed-off-by: Jarkko Sakkinen Signed-off-by: Sasha Levin --- tools/testing/selftests/tpm2/tpm2.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/testing/selftests/tpm2/tpm2.py b/tools/testing/selftests/tpm2/tpm2.py index 057a4f49c79d..c7363c6764fc 100644 --- a/tools/testing/selftests/tpm2/tpm2.py +++ b/tools/testing/selftests/tpm2/tpm2.py @@ -371,6 +371,10 @@ class Client: fcntl.fcntl(self.tpm, fcntl.F_SETFL, flags) self.tpm_poll = select.poll() + def __del__(self): + if self.tpm: + self.tpm.close() + def close(self): self.tpm.close() From patchwork Wed Oct 19 08:32:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4829 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223614wrs; Wed, 19 Oct 2022 02:37:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4jW+aPrveF2ow0kgakceYCQq8I+VNqzVGj4Jvf28eliewPSDG7EcqqnRtW1l2y4k1D6g0W X-Received: by 2002:a05:6a00:acc:b0:530:e79e:fc27 with SMTP id c12-20020a056a000acc00b00530e79efc27mr7792178pfl.61.1666172279193; Wed, 19 Oct 2022 02:37:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172279; cv=none; d=google.com; s=arc-20160816; b=qc2S0AcAS1xGgCgF3gLc298haoVLj02dGi9C8vz/0qChpuoaJmhtKKD5+6iUMeerUF DEB/2lOqG5MY5h8eC1O5c4tWFRwOIN1m1reO0iFQOLV0uwZMXUtGc2gMAO+3w+2U6ScO UXCZnYvmmC5BhZlhQuBEpi+2zewi92U8WYboP+hCLHvzjtgcbIoDPYdezPVUS90hVZvt 7h/2dIcNKX81VGYms8UPaxgEJc9uveP695rLQdzpi0A7I0i5YWMR0TD8T1N3o/uxP3wM r9MssTDxd32X1YTXFf8UJ3GeL24zIgxqpKpyXk7BXkypyOnwUko7TDEw5mFOopY/zDqE puMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Nn1bq1XydD7Av+Tg0eY7e6rQp/IqgnDFMJNB5XDygVc=; b=nfWE7kUZ+jJMaqEI7MHixwXC5josuOn8drZnAVAnK1htCAeI0VEcwkLrh2jNn+zn/Z RyoN5Rb0Huf20LRAwl9LEvZJxYalLEjCcbbwIwRJjCtgZPyU9EhHmTPfArIrOr73KavX vKVUHRpDL5e6fZyoaqoS4fd4v//KDi+KW3p7TvKq5o55sTF/kcGo5aqAucg2l0fPOFRj WhakJGFmGwTks/t3M6XPgdG69knIwCVgngeJc+h4sEFQNQ47rb1UuN2DOFT8g3HhTVU8 UY7XbgTySLPodsMVnG7RU9Z7yXl/3VyMNvA6CS5oM3UA3JA5uFqGGpJp9+HguNFoRvyN G+mQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FeNp7U5k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b16-20020a630c10000000b0043ce223c86dsi19838951pgl.843.2022.10.19.02.37.44; Wed, 19 Oct 2022 02:37: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=FeNp7U5k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233481AbiJSJZi (ORCPT + 99 others); Wed, 19 Oct 2022 05:25:38 -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 S233675AbiJSJYZ (ORCPT ); Wed, 19 Oct 2022 05:24:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EDFE2C4D9A; Wed, 19 Oct 2022 02:11:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C597B61750; Wed, 19 Oct 2022 09:07:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD321C433D7; Wed, 19 Oct 2022 09:07:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170449; bh=CDFKxDXed4seug1ukSk9Zm+SmC8qh5flXF0DuqIbwBM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FeNp7U5kpEwGIQSux/oUB7J9rZ1sgOgQJ+3A/cQqS7aS4e13GoNXxTYzfK3Qmz5uT c7G2ThgjRlE1UoZxg3o570gtgCgtXdAW4TsMx6lDTTf31b+K+5hRUp1ezG3uNs+21v 6T73J3U44xhRWO4EX8OHrC/fTOHLsdWGKuDGf8tk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Marek_Beh=C3=BAn?= , Christoph Hellwig , "Russell King (Oracle)" , Sasha Levin Subject: =?utf-8?b?W1BBVENIIDYuMCA2NTkvODYyXSA9P1VURi04P3E/QVJNL2RtYS1tYXBw?= =?utf-8?b?PUQxPTk2bmc6PTIwZG9udD0yMG92ZXJyaWRlPTIwLT5kbWE9NUZjb2hlPz0gPT9V?= =?utf-8?b?VEYtOD9xP3JlbnQ9MjB3aGVuPTIwc2V0PTIwZnJvbT0yMGE9MjBidXM9MjBub3Rp?= =?utf-8?b?Zmllcj89?= Date: Wed, 19 Oct 2022 10:32:26 +0200 Message-Id: <20221019083319.087440003@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108263458293945?= X-GMAIL-MSGID: =?utf-8?q?1747108263458293945?= From: Christoph Hellwig [ Upstream commit 49bc8bebae79c8516cb12f91818f3a7907e3ebce ] Commit ae626eb97376 ("ARM/dma-mapping: use dma-direct unconditionally") caused a regression on the mvebu platform, wherein devices that are dma-coherent are marked as dma-noncoherent, because although mvebu_hwcc_notifier() after that commit still marks then as coherent, the arm_coherent_dma_ops() function, which is called later, overwrites this setting, since it is being called from drivers/of/device.c with coherency parameter determined by of_dma_is_coherent(), and the device-trees do not declare the 'dma-coherent' property. Fix this by defaulting never clearing the dma_coherent flag in arm_coherent_dma_ops(). Fixes: ae626eb97376 ("ARM/dma-mapping: use dma-direct unconditionally") Reported-by: Marek Behún Signed-off-by: Christoph Hellwig Reviewed-by: Russell King (Oracle) Tested-by: Marek Behún Signed-off-by: Sasha Levin --- arch/arm/mm/dma-mapping.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index 089c9c644cce..bfc7476f1411 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -1769,8 +1769,16 @@ static void arm_teardown_iommu_dma_ops(struct device *dev) { } void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, const struct iommu_ops *iommu, bool coherent) { - dev->archdata.dma_coherent = coherent; - dev->dma_coherent = coherent; + /* + * Due to legacy code that sets the ->dma_coherent flag from a bus + * notifier we can't just assign coherent to the ->dma_coherent flag + * here, but instead have to make sure we only set but never clear it + * for now. + */ + if (coherent) { + dev->archdata.dma_coherent = true; + dev->dma_coherent = true; + } /* * Don't override the dma_ops if they have already been set. Ideally From patchwork Wed Oct 19 08:32: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: 4835 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223675wrs; Wed, 19 Oct 2022 02:38:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5DZvrmqy4PSr3Ee/PJi5W4iRNAQpNiJcHQQ+YauRhPL7JLKw0/Y685SZzO5YFKJlfPF6js X-Received: by 2002:a17:907:847:b0:77f:f489:cc25 with SMTP id ww7-20020a170907084700b0077ff489cc25mr5946765ejb.80.1666172289793; Wed, 19 Oct 2022 02:38:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172289; cv=none; d=google.com; s=arc-20160816; b=F5nsjSPtt5OtSjukEVeFKF/dY/xE1L17yEGqvkoDE5ycaGWI77SjMTBAZp1KgSIKLQ 9Eoray6Jw/OwjxqsfPkoTl74Rb9FGhYwkkXudO8Ex/Qp53+SLEwvQxRLmt4jfgpsyn9l SQVb5Npfr/L1XgE6twiVFSHO3kTZxf69b5s7uxTfQr+dO6QCKcB86764ks5HRRfCHTcR rocVTMWrCekp0sZ7jIe3DxE+9a1eiL4/DgR3uk50TUMZkUOatr00+p20Sa2O7x5OsK9m q+nUx05WxK/2Y86lJvua8FTaN/ldklsg2atFugyRufoYthJ7O3g+76mQwkrN4fjBj+1D 7SEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=I8DkjVnHvipYjZWYYer0sDnqPw4kNhj2E0HivcOn//s=; b=SGdWsSTeGa6HsiPF75/iIZSe+hZ+/MnuPwSSd/FCS5ae7KY9gEXEP3vnKgBN22hNTz f6cxvE1Ia2oezKvdswhBBJbZ5Kj/Tb8Pb+WgIdC0pPEMpLKxNjVQejYrlcW+M7zSqacy 3rRLuStQaWZ0GMx8SZR3NEJt1LsfIzR+9YxN4uw+l2GhHaNnD5RK5whHPO51ZiTv/8Pa 8HGY2oUGmGiSRwTl8DueEpGAQepF7zyNzIFhDTxLFrR/HGf2kickMcfw2+h5z0PWNaFr y6yb2gVoNe3GLrgh4q/XKgMMsRp5nUCVCQ0d1CKtE3jv9V6f5daZoZ0L4T/ipwl8MV8T SX1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PyXAqdqa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gn22-20020a1709070d1600b007429f0c69ccsi16860588ejc.579.2022.10.19.02.37.42; Wed, 19 Oct 2022 02:38: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=PyXAqdqa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233403AbiJSJVR (ORCPT + 99 others); Wed, 19 Oct 2022 05:21:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233681AbiJSJTx (ORCPT ); Wed, 19 Oct 2022 05:19:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EBA8DBE7C; Wed, 19 Oct 2022 02:08: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 6E5516187F; Wed, 19 Oct 2022 09:07:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8061AC433D6; Wed, 19 Oct 2022 09:07:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170451; bh=vu7rJYj1z+XfoxBx4lR0BrFlu16v+YMPOdlO7pyXxkc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PyXAqdqac90ZmB1MepO//b2fHO5VewApjA0nM1EdRMLgyMBM+NOR9jt7FlypDYvV0 FB365IlwZBwif0uMjxkE9XU9jJbEgeP5bhg0jnL+rsHf52Oq96H8dB1wZSbMeZTyfj r0tWp4gSTD4r1JA6305ZH5Jccpb6tgND98xH2s0E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexey Dobriyan , Aaron Tomlin , Luis Chamberlain , Linus Torvalds , Sasha Levin Subject: [PATCH 6.0 660/862] module: tracking: Keep a record of tainted unloaded modules only Date: Wed, 19 Oct 2022 10:32:27 +0200 Message-Id: <20221019083319.135652075@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108275054985084?= X-GMAIL-MSGID: =?utf-8?q?1747108275054985084?= From: Aaron Tomlin [ Upstream commit 47cc75aa92837a9d3f15157d6272ff285585d75d ] This ensures that no module record/or entry is added to the unloaded_tainted_modules list if it does not carry a taint. Reported-by: Alexey Dobriyan Fixes: 99bd9956551b ("module: Introduce module unload taint tracking") Signed-off-by: Aaron Tomlin Acked-by: Luis Chamberlain Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- kernel/module/tracking.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/module/tracking.c b/kernel/module/tracking.c index 7f8133044d09..af52cabfe632 100644 --- a/kernel/module/tracking.c +++ b/kernel/module/tracking.c @@ -21,6 +21,9 @@ int try_add_tainted_module(struct module *mod) module_assert_mutex_or_preempt(); + if (!mod->taints) + goto out; + list_for_each_entry_rcu(mod_taint, &unloaded_tainted_modules, list, lockdep_is_held(&module_mutex)) { if (!strcmp(mod_taint->name, mod->name) && From patchwork Wed Oct 19 08:32: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: 5171 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp254533wrs; Wed, 19 Oct 2022 04:00:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6jRju5+nY3xdkoyoDM7h0bupVjdu0q1rUMPfHlk5TGMPaYsFFhfJEWUD897ANiiMvHGy4I X-Received: by 2002:a17:902:da90:b0:185:5537:f388 with SMTP id j16-20020a170902da9000b001855537f388mr8097828plx.113.1666177217155; Wed, 19 Oct 2022 04:00:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666177217; cv=none; d=google.com; s=arc-20160816; b=zBkscKry3L3wnvL1L5ffzWTwatz9y7aBynFvrmrHBYZXCYo7VvUjHF2oCU/ir44POF rnBrU/44jP4a8wIGrn/LxdBRFi7zgobDsZhgBHlqhHlRAKITwiv82Hu6n0BHJUDQ93xt DKH9qKHgYirn/E5gAAYyEBktVGZeEVPy5WhT8yAMzcGctKI+HfBdNVesd/8/KVudB/wb 2taAhV7UPoVl1TnfKtSLTl1LBXCckrl4uUE73MIY/jekrfDOx/SsBmC2MwVTGDkzvh71 zkZ75BrK427qZjuBt7cRngfcm0XrOP1BNDstxSdgEc66Svo5cUodVhKSsHy8HWrLC8VV usyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6Y7qx812EDDtwRlyYtx3XEQ/DJZbWX+9L/UTJHZ/WQw=; b=YqsIV04IspHflWZC6K0h0K96nH6VTewNPn7ITZK3D/WhLkd4pDAKnWhzSDti8ACyFo rupIv0SEREackDT4DPVgekRlg8HLLOdGqbhSUyuyJbnR1/+Y2b1gJCL/l0qMVUZ3occH PcLHobg4glKBx6sgtUoqPcB+/5Ck8tF0S6EE27s50XOsuzggLpoOOM3UIEeJEt/WoRjv jHfkkkg8MHJZkeof3HeMfVUUKssEFuz4V53PrLTQ4tlgvsFSCbkRzI22Vh97juPcnLby D+EHGQgtFX/fAlNtPk92uCI0wcPzhVUDY/rAGXo0yTbcJwyIjywZTCV/GhaRc27m8VEk wCWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yRjRYy2T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k30-20020a63ff1e000000b004600ab82237si17975940pgi.293.2022.10.19.04.00.03; Wed, 19 Oct 2022 04:00: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=yRjRYy2T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234708AbiJSK6c (ORCPT + 99 others); Wed, 19 Oct 2022 06:58:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234764AbiJSK5J (ORCPT ); Wed, 19 Oct 2022 06:57: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 F01D912741C; Wed, 19 Oct 2022 03:27: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 D062CB82494; Wed, 19 Oct 2022 09:07:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C35EC433D7; Wed, 19 Oct 2022 09:07:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170454; bh=/sSVDk38i6IX0EUR76GfCtC4FXi07BSGvo1EG+db8yY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yRjRYy2Tt0uiGthqZjIcqeNE5pFwC6ui/9sqLWqz8PxsMv/XgTt3ua6MFX8b9QDDe muOc9Za+zD9O1XYt3yAloUPXDZlI+EekbYD3GA6capfnoY+ctQIuF44xQ9CTxkrqoj KegTwxD3K108sGFfxXdDEGPyMtPbdohxSx/8H5oc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Aring , David Teigland , Sasha Levin Subject: [PATCH 6.0 661/862] fs: dlm: fix race in lowcomms Date: Wed, 19 Oct 2022 10:32:28 +0200 Message-Id: <20221019083319.182788995@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747113442006209365?= X-GMAIL-MSGID: =?utf-8?q?1747113442006209365?= From: Alexander Aring [ Upstream commit 30ea3257e8766027c4d8d609dcbd256ff9a76073 ] This patch fixes a race between queue_work() in _dlm_lowcomms_commit_msg() and srcu_read_unlock(). The queue_work() can take the final reference of a dlm_msg and so msg->idx can contain garbage which is signaled by the following warning: [ 676.237050] ------------[ cut here ]------------ [ 676.237052] WARNING: CPU: 0 PID: 1060 at include/linux/srcu.h:189 dlm_lowcomms_commit_msg+0x41/0x50 [ 676.238945] Modules linked in: dlm_locktorture torture rpcsec_gss_krb5 intel_rapl_msr intel_rapl_common iTCO_wdt iTCO_vendor_support qxl kvm_intel drm_ttm_helper vmw_vsock_virtio_transport kvm vmw_vsock_virtio_transport_common ttm irqbypass crc32_pclmul joydev crc32c_intel serio_raw drm_kms_helper vsock virtio_scsi virtio_console virtio_balloon snd_pcm drm syscopyarea sysfillrect sysimgblt snd_timer fb_sys_fops i2c_i801 lpc_ich snd i2c_smbus soundcore pcspkr [ 676.244227] CPU: 0 PID: 1060 Comm: lock_torture_wr Not tainted 5.19.0-rc3+ #1546 [ 676.245216] Hardware name: Red Hat KVM/RHEL-AV, BIOS 1.16.0-2.module+el8.7.0+15506+033991b0 04/01/2014 [ 676.246460] RIP: 0010:dlm_lowcomms_commit_msg+0x41/0x50 [ 676.247132] Code: fe ff ff ff 75 24 48 c7 c6 bd 0f 49 bb 48 c7 c7 38 7c 01 bd e8 00 e7 ca ff 89 de 48 c7 c7 60 78 01 bd e8 42 3d cd ff 5b 5d c3 <0f> 0b eb d8 66 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 55 48 [ 676.249253] RSP: 0018:ffffa401c18ffc68 EFLAGS: 00010282 [ 676.249855] RAX: 0000000000000001 RBX: 00000000ffff8b76 RCX: 0000000000000006 [ 676.250713] RDX: 0000000000000000 RSI: ffffffffbccf3a10 RDI: ffffffffbcc7b62e [ 676.251610] RBP: ffffa401c18ffc70 R08: 0000000000000001 R09: 0000000000000001 [ 676.252481] R10: 0000000000000001 R11: 0000000000000001 R12: 0000000000000005 [ 676.253421] R13: ffff8b76786ec370 R14: ffff8b76786ec370 R15: ffff8b76786ec480 [ 676.254257] FS: 0000000000000000(0000) GS:ffff8b7777800000(0000) knlGS:0000000000000000 [ 676.255239] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 676.255897] CR2: 00005590205d88b8 CR3: 000000017656c003 CR4: 0000000000770ee0 [ 676.256734] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 676.257567] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 676.258397] PKRU: 55555554 [ 676.258729] Call Trace: [ 676.259063] [ 676.259354] dlm_midcomms_commit_mhandle+0xcc/0x110 [ 676.259964] queue_bast+0x8b/0xb0 [ 676.260423] grant_pending_locks+0x166/0x1b0 [ 676.261007] _unlock_lock+0x75/0x90 [ 676.261469] unlock_lock.isra.57+0x62/0xa0 [ 676.262009] dlm_unlock+0x21e/0x330 [ 676.262457] ? lock_torture_stats+0x80/0x80 [dlm_locktorture] [ 676.263183] torture_unlock+0x5a/0x90 [dlm_locktorture] [ 676.263815] ? preempt_count_sub+0xba/0x100 [ 676.264361] ? complete+0x1d/0x60 [ 676.264777] lock_torture_writer+0xb8/0x150 [dlm_locktorture] [ 676.265555] kthread+0x10a/0x130 [ 676.266007] ? kthread_complete_and_exit+0x20/0x20 [ 676.266616] ret_from_fork+0x22/0x30 [ 676.267097] [ 676.267381] irq event stamp: 9579855 [ 676.267824] hardirqs last enabled at (9579863): [] __up_console_sem+0x58/0x60 [ 676.268896] hardirqs last disabled at (9579872): [] __up_console_sem+0x3d/0x60 [ 676.270008] softirqs last enabled at (9579798): [] __do_softirq+0x349/0x4c7 [ 676.271438] softirqs last disabled at (9579897): [] irq_exit_rcu+0xb0/0xf0 [ 676.272796] ---[ end trace 0000000000000000 ]--- I reproduced this warning with dlm_locktorture test which is currently not upstream. However this patch fix the issue by make a additional refcount between dlm_lowcomms_new_msg() and dlm_lowcomms_commit_msg(). In case of the race the kref_put() in dlm_lowcomms_commit_msg() will be the final put. Signed-off-by: Alexander Aring Signed-off-by: David Teigland Signed-off-by: Sasha Levin --- fs/dlm/lowcomms.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index a4e84e8d94c8..59f64c596233 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c @@ -1336,6 +1336,8 @@ struct dlm_msg *dlm_lowcomms_new_msg(int nodeid, int len, gfp_t allocation, return NULL; } + /* for dlm_lowcomms_commit_msg() */ + kref_get(&msg->ref); /* we assume if successful commit must called */ msg->idx = idx; return msg; @@ -1375,6 +1377,8 @@ void dlm_lowcomms_commit_msg(struct dlm_msg *msg) { _dlm_lowcomms_commit_msg(msg); srcu_read_unlock(&connections_srcu, msg->idx); + /* because dlm_lowcomms_new_msg() */ + kref_put(&msg->ref, dlm_msg_release); } #endif From patchwork Wed Oct 19 08:32: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: 5169 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp254033wrs; Wed, 19 Oct 2022 03:59:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6T2fKiqzFCTXiAg1F57LuWXT/Cn3Nb04F4hO+Z3A7dp4usVqJtkAybjAB1Px2/MiFsGEnn X-Received: by 2002:a63:64d:0:b0:46b:158f:102e with SMTP id 74-20020a63064d000000b0046b158f102emr6985426pgg.150.1666177143315; Wed, 19 Oct 2022 03:59:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666177143; cv=none; d=google.com; s=arc-20160816; b=Omh3qQvYnTPctZO7gdxtKhFRhOkl6/ekejCGN7mXXnBCO/kQv5lNBi6eNBa1VyXQkL DrqwBg1+i+APRryrl8/xZH9hP+6K1QfOVY13/ezGi9cGDbebXsE/daR/0OddXpzckvj7 CTopEKfAoVfIfGNuSiGp6mr2eFQZqJ9eJKWm/wsbvu2q7XWSWECt+OAxok730jcCPPPI mkx8RpkEjHhtPfnaE4JjeStPd9IHfLsORQjFZU+ZTw5AugSoFX/+SUsBFZYxNpBJcOCq N0FhmaMr6VDS9Jpl7Y9bsSRsckQ5cYh3WEahoK15BNGSFRQ2bedS2PNSDpQQzmP2Ado9 clCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kWwOZrZQOK+oucO2EIYPto+uUZRa4HfJbdSUU2Wgpxc=; b=na2C4d3Ym/N7khT8bnnVhCye0ztmEdj86hWcXjFgH7YYbf7ltCNKDGz95+oaKsnoLX gQ/9msMlbDHYEN0+l49nT/PRidiK6UwZ8cS8VUwY49xwLqNvHjeqhBf50Yk6F9dl5mR/ gF/FcyvoP3FvYsXdqKKotN4jWrw4gy+ZTcRqgEYLOyGpISZYRDYE9WAfikLjENNJP3mY M+kkMCYWvGONbb6oNxakMYSDLp4K/UL2tmDgBJwnOLW1BRpjABnQWPLmgSs+cvRJSEeP xA02RqyZ965j8bTkdc1JaMAqn2qvTrmlKvQZYu6kTCphCgkFQo95Odsx6Z6uBj5zE9yw 3M4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="ahEE6/0u"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z1-20020a170903018100b0017336c464ecsi19583222plg.407.2022.10.19.03.58.50; Wed, 19 Oct 2022 03:59: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="ahEE6/0u"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234850AbiJSK6P (ORCPT + 99 others); Wed, 19 Oct 2022 06:58:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234748AbiJSK4p (ORCPT ); Wed, 19 Oct 2022 06:56:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B79A7BB2; Wed, 19 Oct 2022 03:27: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 615E9B82400; Wed, 19 Oct 2022 09:07:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA2C5C433D6; Wed, 19 Oct 2022 09:07:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170457; bh=EpH8F25ftH4qXMt5E1/aEv6zxIBXRJCjac9DWYRJ0Jc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ahEE6/0ubT+ZsrDMqXgYRehTmoCwCckBwG+Drr5loJ2osrBiXwEm9tZTHut123VOH DhQUGUGMF+k0YGBOU6W+gzTdTfueRAXSSqupZrOQzevA7+dpLu5DL3QqOpnVkWhcNK ySiQbpUkBuIGCOR20GR5SVjNUxTIgx88fjWf/Jzo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zqiang , "Paul E. McKenney" , Sasha Levin Subject: [PATCH 6.0 662/862] rcu: Avoid triggering strict-GP irq-work when RCU is idle Date: Wed, 19 Oct 2022 10:32:29 +0200 Message-Id: <20221019083319.221155015@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747113364275440551?= X-GMAIL-MSGID: =?utf-8?q?1747113364275440551?= From: Zqiang [ Upstream commit 621189a1fe93cb2b34d62c5cdb9e258bca044813 ] Kernels built with PREEMPT_RCU=y and RCU_STRICT_GRACE_PERIOD=y trigger irq-work from rcu_read_unlock(), and the resulting irq-work handler invokes rcu_preempt_deferred_qs_handle(). The point of this triggering is to force grace periods to end quickly in order to give tools like KASAN a better chance of detecting RCU usage bugs such as leaking RCU-protected pointers out of an RCU read-side critical section. However, this irq-work triggering is unconditional. This works, but there is no point in doing this irq-work unless the current grace period is waiting on the running CPU or task, which is not the common case. After all, in the common case there are many rcu_read_unlock() calls per CPU per grace period. This commit therefore triggers the irq-work only when the current grace period is waiting on the running CPU or task. This change was tested as follows on a four-CPU system: echo rcu_preempt_deferred_qs_handler > /sys/kernel/debug/tracing/set_ftrace_filter echo 1 > /sys/kernel/debug/tracing/function_profile_enabled insmod rcutorture.ko sleep 20 rmmod rcutorture.ko echo 0 > /sys/kernel/debug/tracing/function_profile_enabled echo > /sys/kernel/debug/tracing/set_ftrace_filter This procedure produces results in this per-CPU set of files: /sys/kernel/debug/tracing/trace_stat/function* Sample output from one of these files is as follows: Function Hit Time Avg s^2 -------- --- ---- --- --- rcu_preempt_deferred_qs_handle 838746 182650.3 us 0.217 us 0.004 us The baseline sum of the "Hit" values (the number of calls to this function) was 3,319,015. With this commit, that sum was 1,140,359, for a 2.9x reduction. The worst-case variance across the CPUs was less than 25%, so this large effect size is statistically significant. The raw data is available in the Link: URL. Link: https://lore.kernel.org/all/20220808022626.12825-1-qiang1.zhang@intel.com/ Signed-off-by: Zqiang Signed-off-by: Paul E. McKenney Signed-off-by: Sasha Levin --- kernel/rcu/tree_plugin.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h index 438ecae6bd7e..49468b4d1b43 100644 --- a/kernel/rcu/tree_plugin.h +++ b/kernel/rcu/tree_plugin.h @@ -641,7 +641,8 @@ static void rcu_read_unlock_special(struct task_struct *t) expboost = (t->rcu_blocked_node && READ_ONCE(t->rcu_blocked_node->exp_tasks)) || (rdp->grpmask & READ_ONCE(rnp->expmask)) || - IS_ENABLED(CONFIG_RCU_STRICT_GRACE_PERIOD) || + (IS_ENABLED(CONFIG_RCU_STRICT_GRACE_PERIOD) && + ((rdp->grpmask & READ_ONCE(rnp->qsmask)) || t->rcu_blocked_node)) || (IS_ENABLED(CONFIG_RCU_BOOST) && irqs_were_disabled && t->rcu_blocked_node); // Need to defer quiescent state until everything is enabled. From patchwork Wed Oct 19 08:32: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: 5168 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp253982wrs; Wed, 19 Oct 2022 03:58:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6lA84I3coRDtK03xFtTc80Y2GaY6cFWSI5p5vq8skmK/47EwjbtoSIszefTV96X+nTTWaQ X-Received: by 2002:a17:903:2449:b0:186:1269:929c with SMTP id l9-20020a170903244900b001861269929cmr7987741pls.37.1666177133859; Wed, 19 Oct 2022 03:58:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666177133; cv=none; d=google.com; s=arc-20160816; b=ixKRxNxpL6q5rpM+7B3ph5blUHGRle5ElwxJNvRXVqWcNllRYTldFtRZ+8ruQpYLRO TorvlngzPDJi+yjrBLWm1vrOR9/HURy1XA29bVKop7vhnIv/FVxjpDvd3mYeNDvjIpGv OIxRAHi/lkdxsmsYPMFPh+788UUPlDCasKm0VKHv6p9hpcpSGpVQj096jdsQjRZF1TzR VC2+lIsgqm3vHUtcVAm2SZQGc32+W8HNcney/4r/x8wPjU59uMxDDK7o+UMQ80/LGZb9 Hs9xcpEitjJCf7KaaVbnil50W8J2UBs1mbxKoKURN70TAmw9XhcudgaD/WhbbeKtSV44 tgfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+Hh8j/ZjXiGwG1MV+LqN/xTN8LGsCyWrYfmIFEeenvw=; b=0egmeXDpqbHNvG3NT7cDtP1wylB8pGni+CyETIvBmkRQ/Ufks9O8lKrhzXXWXiQAbw tFS1gXfVWHUGM2TYQA7CB+DNovkoGqM/NBkBG8+pA0d1O1R0Ng+Zh2icccwfl9zusd1V naJ3vBA2XDsHMfQmOi5AsqkHpOpyPO8WVyK4nEH0V1RKbhHjAwE61uFyT+bFsXnyhRf3 wVpzRleKquyLW6SpfEBDtPeygBntqDlQg3U5Lky7q8eYL9eI/Q2hlSG9lKF6+YbCgiBH CJcS4cG3Zbe+Pa950PJxy8DL399MF7E6koNqwKo4lFHWuYKUPGoDUpqmyH7xN6PmtF4c bQHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mC6Frnnq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020aa78b43000000b0054764d871b5si16129485pfd.230.2022.10.19.03.58.40; Wed, 19 Oct 2022 03:58: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=mC6Frnnq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234548AbiJSK6V (ORCPT + 99 others); Wed, 19 Oct 2022 06:58:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234687AbiJSK5I (ORCPT ); Wed, 19 Oct 2022 06:57: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 C0629108DF7; Wed, 19 Oct 2022 03:27: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 1CB47B8249C; Wed, 19 Oct 2022 09:07:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6424EC433D6; Wed, 19 Oct 2022 09:07:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170459; bh=LOQm+b4gdhndYidtU+rnK72Qvs2MOTXXFuDNLCJmht0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mC6FrnnqJZQbP8ggrxdb+cHvWHIpdq8HJTiRKQQUk4im/IoC8XWRWc+xr5jf2Vnht 8ca4zDtR9rsoYIx2Dj/obDDvf1L0NKMZHOrv7+//OemqcRI4Je+5thoZrn+mHfrLIX 2CoEv8oZHGFaZ5VmMyUVJq77OKRMxmQstalTvk6E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Uladzislau Rezki (Sony)" , "Paul E. McKenney" , Frederic Weisbecker , Neeraj Upadhyay , Josh Triplett , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , Joel Fernandes , Michal Hocko , Sasha Levin Subject: [PATCH 6.0 663/862] rcu: Back off upon fill_page_cache_func() allocation failure Date: Wed, 19 Oct 2022 10:32:30 +0200 Message-Id: <20221019083319.261237319@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747113354296298575?= X-GMAIL-MSGID: =?utf-8?q?1747113354296298575?= From: Michal Hocko [ Upstream commit 093590c16b447f53e66771c8579ae66c96f6ef61 ] The fill_page_cache_func() function allocates couple of pages to store kvfree_rcu_bulk_data structures. This is a lightweight (GFP_NORETRY) allocation which can fail under memory pressure. The function will, however keep retrying even when the previous attempt has failed. This retrying is in theory correct, but in practice the allocation is invoked from workqueue context, which means that if the memory reclaim gets stuck, these retries can hog the worker for quite some time. Although the workqueues subsystem automatically adjusts concurrency, such adjustment is not guaranteed to happen until the worker context sleeps. And the fill_page_cache_func() function's retry loop is not guaranteed to sleep (see the should_reclaim_retry() function). And we have seen this function cause workqueue lockups: kernel: BUG: workqueue lockup - pool cpus=93 node=1 flags=0x1 nice=0 stuck for 32s! [...] kernel: pool 74: cpus=37 node=0 flags=0x1 nice=0 hung=32s workers=2 manager: 2146 kernel: pwq 498: cpus=249 node=1 flags=0x1 nice=0 active=4/256 refcnt=5 kernel: in-flight: 1917:fill_page_cache_func kernel: pending: dbs_work_handler, free_work, kfree_rcu_monitor Originally, we thought that the root cause of this lockup was several retries with direct reclaim, but this is not yet confirmed. Furthermore, we have seen similar lockups without any heavy memory pressure. This suggests that there are other factors contributing to these lockups. However, it is not really clear that endless retries are desireable. So let's make the fill_page_cache_func() function back off after allocation failure. Cc: Uladzislau Rezki (Sony) Cc: "Paul E. McKenney" Cc: Frederic Weisbecker Cc: Neeraj Upadhyay Cc: Josh Triplett Cc: Steven Rostedt Cc: Mathieu Desnoyers Cc: Lai Jiangshan Cc: Joel Fernandes Signed-off-by: Michal Hocko Reviewed-by: Uladzislau Rezki (Sony) Signed-off-by: Paul E. McKenney Signed-off-by: Sasha Levin --- kernel/rcu/tree.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 79aea7df4345..eb435941e92f 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -3183,15 +3183,16 @@ static void fill_page_cache_func(struct work_struct *work) bnode = (struct kvfree_rcu_bulk_data *) __get_free_page(GFP_KERNEL | __GFP_NORETRY | __GFP_NOMEMALLOC | __GFP_NOWARN); - if (bnode) { - raw_spin_lock_irqsave(&krcp->lock, flags); - pushed = put_cached_bnode(krcp, bnode); - raw_spin_unlock_irqrestore(&krcp->lock, flags); + if (!bnode) + break; - if (!pushed) { - free_page((unsigned long) bnode); - break; - } + raw_spin_lock_irqsave(&krcp->lock, flags); + pushed = put_cached_bnode(krcp, bnode); + raw_spin_unlock_irqrestore(&krcp->lock, flags); + + if (!pushed) { + free_page((unsigned long) bnode); + break; } } From patchwork Wed Oct 19 08:32: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: 4827 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223527wrs; Wed, 19 Oct 2022 02:37:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Cw+CePcq8TVbBQ8qfqgqMI+948ld7GoxUmlUiXQg8q00p6f2653CBIuiTp85+yuxY9O+S X-Received: by 2002:aa7:958f:0:b0:563:6987:8b88 with SMTP id z15-20020aa7958f000000b0056369878b88mr7642848pfj.31.1666172263424; Wed, 19 Oct 2022 02:37:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172263; cv=none; d=google.com; s=arc-20160816; b=aOIHaaeivRuiI5kDYFL5xJUkvBaMdcSYAgSIWfqcFAYaqji9h0/0z+9agN91r5jMdM tDL3Zlm/ChtsNET77qf9fpSywVSLQqc09MrkamOhLEc1PuTsdZvmq+1ieFNAq1oMP6qY YO6veUFKgYghudM13cnrx96poU5poMMCWUSBiGVS6Q4TfJ1hB6niHhjJciBy2tpZf5FL 4AN87+3+CY+4ov2qY+Bis10mgWz3Jgpcl81YVQKxRSrJsXUtOaySol3vOkp0d49KGWwJ Lhjp+DOclP1odytKHfou+Gr75i022w8LytUU5Yb9ES9yda68xW7vUp4nTlJQyzScSS8i xZUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=g4ZZsynwQTcvHoBLIjcDjw43A9FRmZY0dyCIrQgSFkk=; b=N5jN8QWAMVa/kd3kiGrvsSJhCoLJLPaE6Wzzk/Y8dXjFaxT7rBtHrhaBHJLBo8lbFE vrmlLcYkTslx+oTiB++VvoIWMoJkicZshKSMnZhyPw1uyFRD8zMD7CYmcibWPDsqyr0X QjNfoddigPGEnePFFzXuWZSyTO2xWm6O1KSlqWvtjOOW5VMcaLt2JK40L5dvJnV4mGQg BabM3iOCrZ1xiYgmGNmgshxtHljlv06fuNbPtUBrwxBbmyAc2njNoz3Sny+81hAU9Uo0 spD4IJQbJsg4Yu3WnhC26A9TfsCIn1dM2SZrC7jno5ENY9qbXF3CB0kD3RIITS5ZcKCD Z//A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1evZLMOG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a056a00181f00b00562a1693523si18341475pfa.20.2022.10.19.02.37.30; Wed, 19 Oct 2022 02:37: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=1evZLMOG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233479AbiJSJXX (ORCPT + 99 others); Wed, 19 Oct 2022 05:23:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233507AbiJSJWM (ORCPT ); Wed, 19 Oct 2022 05:22:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FA8D63F16; Wed, 19 Oct 2022 02:10: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 12ADA61843; Wed, 19 Oct 2022 09:07:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26D16C433B5; Wed, 19 Oct 2022 09:07:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170462; bh=XzQgB09SlnH/faR3zeTC49E6Tva+tqGeBKYN7Hl/Dcg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1evZLMOG7VafyY5fAG2mUTlRkZPg1BTO/Oe/yhkeLZsV6tNra577xO/RH2wArIYnP Tgk1xUwK0YeRwfnx4vv1sAdDA+JnAPR+6QZ5gBPTMD3fpbS4rLiqirt1Y/Xci3iqLK BvqeOAcfpQvLi5vPVsVsb3HoErtRyoEfFf1CXhdY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zqiang , "Paul E. McKenney" , Sasha Levin Subject: [PATCH 6.0 664/862] rcu-tasks: Convert RCU_LOCKDEP_WARN() to WARN_ONCE() Date: Wed, 19 Oct 2022 10:32:31 +0200 Message-Id: <20221019083319.310438424@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108246779548209?= X-GMAIL-MSGID: =?utf-8?q?1747108246779548209?= From: Zqiang [ Upstream commit fcd53c8a4dfa38bafb89efdd0b0f718f3a03f884 ] Kernels built with CONFIG_PROVE_RCU=y and CONFIG_DEBUG_LOCK_ALLOC=y attempt to emit a warning when the synchronize_rcu_tasks_generic() function is called during early boot while the rcu_scheduler_active variable is RCU_SCHEDULER_INACTIVE. However the warnings is not actually be printed because the debug_lockdep_rcu_enabled() returns false, exactly because the rcu_scheduler_active variable is still equal to RCU_SCHEDULER_INACTIVE. This commit therefore replaces RCU_LOCKDEP_WARN() with WARN_ONCE() to force these warnings to actually be printed. Signed-off-by: Zqiang Signed-off-by: Paul E. McKenney Signed-off-by: Sasha Levin --- kernel/rcu/tasks.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h index 83c7e6620d40..469bf2a3b505 100644 --- a/kernel/rcu/tasks.h +++ b/kernel/rcu/tasks.h @@ -560,7 +560,7 @@ static int __noreturn rcu_tasks_kthread(void *arg) static void synchronize_rcu_tasks_generic(struct rcu_tasks *rtp) { /* Complain if the scheduler has not started. */ - RCU_LOCKDEP_WARN(rcu_scheduler_active == RCU_SCHEDULER_INACTIVE, + WARN_ONCE(rcu_scheduler_active == RCU_SCHEDULER_INACTIVE, "synchronize_rcu_tasks called too soon"); // If the grace-period kthread is running, use it. From patchwork Wed Oct 19 08:32: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: 5173 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp254897wrs; Wed, 19 Oct 2022 04:00:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM773HG5xENvpSlMfjQ/OWOIIDDajJifFSKtI+cN2dBnjHxUJqj6YL8yUd91gbcdQYHDDrYK X-Received: by 2002:a05:6a00:150e:b0:563:b133:2932 with SMTP id q14-20020a056a00150e00b00563b1332932mr7688516pfu.37.1666177253129; Wed, 19 Oct 2022 04:00:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666177253; cv=none; d=google.com; s=arc-20160816; b=YHESgsW7fL5+pR0lab3CuqsACpR26/uXIrAFhmejL3N3w3P4pIq9qmVC3AX+7LOzG3 +V/fTaGLbHolXJiBKMtsdLN9UYIG7RU3zzXJI+CvhciWhHB1usLdeOVU8Q44Wea2uVgE ll3VpXTc9wtM7vMu4/ToIHXnOg3+f+IxUAx38KLjO7IhRHynwR+tITU9H68gS5FXdWoJ 4l3RSCyQALpJ0ftocHcBn5yd3NY6RDe4D5050H6TX+b7DId2Hif4Jvd0affBB+/3gxYS /NYk/YqL+CtM9fu7YH7NioDyq2npQ2SNTw8Y1zmNHxninIMxV2YGkrG5LIn2ZrnPMvp1 Ce+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=GG7wgfKYXKbe5fHQU5xQgbfbxWXEwKp0JBKtXuDNvM4=; b=JaQDWt/ryHZ5Q0hbyb7p8D6RNFCru+7TdBw2dKkb+33TaHhZlpPYDEyu+LtAVT87zT 42DHhSXqxGhBXq4IMh4WDbKANA6CSEpTD5mT+PXAOKkp5IVD7y4YyyMecIcPXnTb61P5 fNuV4g+9BUdcIRGvpFhTpfegk5GMVN/gc0wq4SnYxLoP7vqNrClbDPvEjXeuUyMA4SZA mgOHiYio3450q/EL/8clvhoMhuW6Xo2pfDUFWxpGmXpZbkLqB9yjVgQ/nKQywhaLSMUT IQCQsT9tLgJzpjO1sZNxuFfhI/fVrZbORMOLi9xg4nyZ46yQDmk9jS0uqGTSCcPA9x8P 0L0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cZvymSGN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e31-20020a63545f000000b0045c19daabbesi17146134pgm.133.2022.10.19.04.00.39; Wed, 19 Oct 2022 04:00:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cZvymSGN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234175AbiJSLAD (ORCPT + 99 others); Wed, 19 Oct 2022 07:00:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234778AbiJSK6z (ORCPT ); Wed, 19 Oct 2022 06:58: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 EA4D932EE8; Wed, 19 Oct 2022 03:28: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 ams.source.kernel.org (Postfix) with ESMTPS id 47D80B824A0; Wed, 19 Oct 2022 09:07:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7613C433D7; Wed, 19 Oct 2022 09:07:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170465; bh=+6glP5M4U/7tjSVd6yGESzZeKOqk1AlOfccyrLxid58=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cZvymSGNM6aRXwGqQuQVZ8V1YQcUw3OgQbRHWDcmSZ4vhQ1QswrJ/d96n8rX0Cfz4 OFmyeGOR12HoALsakWtKsGYqIsFko5PLUJcJGcOHN/F+Kd1rdjTXgeM7sLhy+I9hM4 O/xepoN9ks2XSb4vgwZ5b60SxuaNpSCcVkSZVhBc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Paul E. McKenney" , Sasha Levin Subject: [PATCH 6.0 665/862] rcu-tasks: Ensure RCU Tasks Trace loops have quiescent states Date: Wed, 19 Oct 2022 10:32:32 +0200 Message-Id: <20221019083319.352145512@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747113479630809348?= X-GMAIL-MSGID: =?utf-8?q?1747113479630809348?= From: Paul E. McKenney [ Upstream commit d6ad60635cafe900bcd11ad588d8accb36c36b1b ] The RCU Tasks Trace grace-period kthread loops across all CPUs, and there can be quite a few CPUs, with some commercially available systems sporting well over a thousand of them. Some of these loops can feature IPIs, which can take some time. This commit therefore places a call to cond_resched_tasks_rcu_qs() in each such loop. Link: https://docs.google.com/document/d/1V0YnG1HTWMt9WHJjroiJL9lf-hMrud4v8Fn3fhyY0cI/edit?usp=sharing Signed-off-by: Paul E. McKenney Signed-off-by: Sasha Levin --- kernel/rcu/tasks.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h index 469bf2a3b505..f5bf6fb430da 100644 --- a/kernel/rcu/tasks.h +++ b/kernel/rcu/tasks.h @@ -1500,6 +1500,7 @@ static void rcu_tasks_trace_pregp_step(struct list_head *hop) if (rcu_tasks_trace_pertask_prep(t, true)) trc_add_holdout(t, hop); rcu_read_unlock(); + cond_resched_tasks_rcu_qs(); } // Only after all running tasks have been accounted for is it @@ -1520,6 +1521,7 @@ static void rcu_tasks_trace_pregp_step(struct list_head *hop) raw_spin_lock_irqsave_rcu_node(rtpcp, flags); } raw_spin_unlock_irqrestore_rcu_node(rtpcp, flags); + cond_resched_tasks_rcu_qs(); } // Re-enable CPU hotplug now that the holdout list is populated. @@ -1619,6 +1621,7 @@ static void check_all_holdout_tasks_trace(struct list_head *hop, trc_del_holdout(t); else if (needreport) show_stalled_task_trace(t, firstreport); + cond_resched_tasks_rcu_qs(); } // Re-enable CPU hotplug now that the holdout list scan has completed. From patchwork Wed Oct 19 08:32: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: 5194 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp264016wrs; Wed, 19 Oct 2022 04:19:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4t9i1BRuAH4wFzLnrVr51vNkAjfeNyamSLMPu0Hc+q8wFSh846zoR2GhecOmaCZDjzA3rw X-Received: by 2002:a05:6402:159a:b0:458:d744:8975 with SMTP id c26-20020a056402159a00b00458d7448975mr7011290edv.200.1666178352828; Wed, 19 Oct 2022 04:19:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178352; cv=none; d=google.com; s=arc-20160816; b=yCuuPjSJ1incCIQcYeeggBEOM7B5Cu22NiheC5pQdRUXj1xcztmmENgi9s8o98s4nW VQ4LI8D0hhI8l5+YoEftOWXu3mSl9hej75AcNG93Tu8Krfs5KsvgVnrwxY7TGjr3rWqV F8UXPR1XdCA1fmJIRpn5SYtFMu9Nx4hqltcDIq0lzueondmbWPGLclF/IyxEkKargRMA lMu7wYF/mlJBf8dhsAezryr+9Ry754NrlDvhM286bjp4FelUs3lUIBkb0DaFxg806lfE TBqAXitKNLw29SZNeAloX2b96CJfVQnfELQo+RWTCGfHfk5hyt/I0twJC073h5rJ6aay tCTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=56JKciz4SiEApXUJTwD43HaUclDvuqghf+HfwdyEQPc=; b=xJXmCr5mEvvaJ66yqc5Owbce7uJ+dRJ+48iu8fVhm0NT8fMd6y6ga+r+co1SN7VHn+ J4f2+30aPwJpeFl+5CwQI8FqlBOgsCoKXgCCNyEr9jnnbW8D9iKdj8Hnel14JGClrNFR yzg8sSHRb8Qc0Pj74MAaseBxkTOdwuGCteXHcw/5z/nr11MFzANFaPNNWpREafnYJTpM aLOFZZf9N3ysmDo9QNqpdLa4ALaYO9cv5vGuQ2U5NQducfM1S9rcqJ5adyPu5eLfHu99 qmzwJvp/0TIr3pMry0vCS4cwdlioLv2xkOId69J4a+xtZX62zx4BgoKsCux2ihzaVLDK +7bQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GZpVM1VA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z22-20020a05640235d600b00458d43beac7si17228840edc.41.2022.10.19.04.18.17; Wed, 19 Oct 2022 04:19: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=GZpVM1VA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230118AbiJSLDX (ORCPT + 99 others); Wed, 19 Oct 2022 07:03:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234770AbiJSLC7 (ORCPT ); Wed, 19 Oct 2022 07:02: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 D17BA171CCF; Wed, 19 Oct 2022 03:32: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 8AF86B8249D; Wed, 19 Oct 2022 09:07:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9DF5C433D6; Wed, 19 Oct 2022 09:07:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170470; bh=GYMheR2uDf5Pu2mG9xm6Hst+j27aQrPCPR8epawv2K8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GZpVM1VASNxlV9WB3gSaYFs9If9Leo8Kd1EVovpCa4Lkp5mTH4QQEB7yA8oLbX/oD gBm25XdOmRkS/3mtNUx75wM8rpFch+5su6fQ9jEDpZT1NdOW9mW8EYS+vDZEjw+Fh/ 545m5uzeI7CKXhdzgOlb31iH2U6HlhoQf1mKVJ24= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Huang Rui , Viresh Kumar , Perry Yuan , Su Jinzhou , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 6.0 666/862] cpufreq: amd_pstate: fix wrong lowest perf fetch Date: Wed, 19 Oct 2022 10:32:33 +0200 Message-Id: <20221019083319.391323874@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114632660404658?= X-GMAIL-MSGID: =?utf-8?q?1747114632660404658?= From: Perry Yuan [ Upstream commit b185c5053c65b7704ead4537e4d4d9b33dc398dc ] Fix the wrong lowest perf value reading which is used for new des_perf calculation by governor requested, the incorrect min_perf will get incorrect des_perf to be set , that will cause the system frequency changing unexpectedly. Reviewed-by: Huang Rui Acked-by: Viresh Kumar Signed-off-by: Perry Yuan Signed-off-by: Su Jinzhou Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/cpufreq/amd-pstate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 365f3ad166a7..d63a28c5f95a 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -322,7 +322,7 @@ static int amd_pstate_target(struct cpufreq_policy *policy, return -ENODEV; cap_perf = READ_ONCE(cpudata->highest_perf); - min_perf = READ_ONCE(cpudata->lowest_nonlinear_perf); + min_perf = READ_ONCE(cpudata->lowest_perf); max_perf = cap_perf; freqs.old = policy->cur; From patchwork Wed Oct 19 08:32: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: 5159 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp253662wrs; Wed, 19 Oct 2022 03:57:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6soY/sGerNPqxJdIr26lTs775x9v68vZDgo5n9H+3JC0mNZJswNPAI1NeDbUxEvWelLa1j X-Received: by 2002:a17:90b:4b4b:b0:20a:926f:3c2e with SMTP id mi11-20020a17090b4b4b00b0020a926f3c2emr8827215pjb.87.1666177060059; Wed, 19 Oct 2022 03:57:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666177060; cv=none; d=google.com; s=arc-20160816; b=RzCe9PactlLg9DOOlTjgFuPmhuyG0mMiuxYXsdqQqE4UD6aaWWtvsT1VjHFM5VJnFZ eb8kxDLKTnOKKDJblOMzEjr5ly2YF7ToYpQWDTkcteShWGPisN6uszlp5HFgUTAnt/Lu XBIi5TBoI2E38mk7M/GsjZYfkJ+E0aXGo7plBL61zHo+QI0+mGtnuaB/qmhGEYYZdaQ4 d7M2ta0cFoUx0bPPBnnDU7Z6gn5c1XjYPYyh2cWjC2maldEigRI5L6HszyZdvPvlu0z4 RZCN0INdjJrnAHvw16FLKtGlQJYERjY8N4yo00jatA1eD22crKUrh7ZdeG9KcLu2ZiRC XnDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8riVefyqXzxZ8hVXhHS1RDtXUPJxTdHsZ6uJ2Q6NjDU=; b=vlOMeq9HhXw8UnVCQqmncFqEJ5sIXIC8O1mpYhKJXa+RcDe+iTybI86H/AbMhab0XI ANl3e/umthF9V8dz28sPJ4A5VupryGhwbDWB/4t6uHZkNCVeRGmdr6Avz4oKIxQ7raH6 tG5WKIH+iF1O2mwFd6+1S5mAUGKLNy5CgQ1SURxx2IUHISWjemzS9MWldJuxWwve96bf 6iBZiXJ3y3K6dimgrAaSWBXVFTeeSC+d36lXLtb76Q6e/fn0+iCNBJhyuHjCEPFkzr8w UXYImEtcP9zECEXTU5XMtvL2DLfWOLffyxVh6ZVJC26ayYePBChWq3rsMxIS2Os20lN5 g5gA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iu1mTpn+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r29-20020a638f5d000000b0045fe8462bf5si18085938pgn.226.2022.10.19.03.57.27; Wed, 19 Oct 2022 03:57: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=iu1mTpn+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234737AbiJSK5F (ORCPT + 99 others); Wed, 19 Oct 2022 06:57:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234687AbiJSK4L (ORCPT ); Wed, 19 Oct 2022 06:56:11 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E77A127438; Wed, 19 Oct 2022 03:27: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 173E6B82495; Wed, 19 Oct 2022 09:07:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B73CC433D7; Wed, 19 Oct 2022 09:07:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170472; bh=0yH2tHsi0KT7BCp2zt5FOnIEX15voda8qCVI6xMl8fQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iu1mTpn+gVJ+T5HdbKqsh9BIL9aQaKMsmKHmhZBY37p3qKqvGhtQjlhEyew8Iri1S J0RlYGfi1NyNH6acnMI7nn/9fJpVMLtiURYM6NozL5hUkOiWXjJJAf6vBJVLTvmvzM TBREp/juT/2+47mVmx2GSEdt4vJDDVLgAEOvQF5M= 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 6.0 667/862] ACPI: video: Add Toshiba Satellite/Portege Z830 quirk Date: Wed, 19 Oct 2022 10:32:34 +0200 Message-Id: <20221019083319.430613846@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747113276766005959?= X-GMAIL-MSGID: =?utf-8?q?1747113276766005959?= 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 5cbe2196176d..2a4990733cf0 100644 --- a/drivers/acpi/acpi_video.c +++ b/drivers/acpi/acpi_video.c @@ -496,6 +496,22 @@ static const struct dmi_system_id video_dmi_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "SATELLITE R830"), }, }, + { + .callback = video_disable_backlight_sysfs_if, + .ident = "Toshiba Satellite Z830", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), + DMI_MATCH(DMI_PRODUCT_NAME, "SATELLITE Z830"), + }, + }, + { + .callback = video_disable_backlight_sysfs_if, + .ident = "Toshiba Portege Z830", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), + DMI_MATCH(DMI_PRODUCT_NAME, "PORTEGE Z830"), + }, + }, /* * Some machine's _DOD IDs don't have bit 31(Device ID Scheme) set * but the IDs actually follow the Device ID Scheme. From patchwork Wed Oct 19 08:32: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: 5146 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp253284wrs; Wed, 19 Oct 2022 03:56:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6RPSnRaBM2yVG8eeA126uZgd+pTIhxmiEsA1vPcuRFNm1K9zf41Q6vqcNrd3C/v9HXLuMz X-Received: by 2002:a17:907:d26:b0:78e:20c6:9f77 with SMTP id gn38-20020a1709070d2600b0078e20c69f77mr6092106ejc.243.1666177017150; Wed, 19 Oct 2022 03:56:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666177017; cv=none; d=google.com; s=arc-20160816; b=dJQjrgdeWcHxUqlAobE5/k2Cx+yGQ9CcKbTcJdQUimcQvnnk9kp/3NCLkzZNPcz+x9 2jiiAZU1f2ZUA3GVOJdOPrwvkuQoQ4D9NpWB1FIUBoJzpe3GZLHnpbnN91z8KIPlmEtL jTl1T+A7PuBnKv3n3YEcuSJpeduCgX//9uPa/q+yh8G4maNLZ4NGcSn+oPyQDlrTwmTa N7+ZZZsG8xQXIEGLsCfpnD9k4fvAyz7ItU8XM5c6V4NqWEQ69543Q9ttHh1qWxjUh2+0 998VDjj5qvGwecCFmVgmmGW9yijtaL4PTWyp95kK+fVb+d233yWmEAPbm8N4q6rxg8xY lxQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=LG7kQDXSgEdPfkLBqJx8Jeea0WzstOnh63KhBlYLm9Q=; b=dIdIUxuJ03N1hX3Fo40j2re55xgpV+iWtMm+3IblJaJFwn96q+o0S7nEEeC+AEmCjj PiEksvZHrCjfE7QS3UTuAwWlUKLF3HuJRuHae4n00yQoJLmoaitqH1sfxObZjGALzRCo Q1i+yiGE2Zzt6CiBBwLEWLMicrP9AuUYTrRPHP2SZGKME6GfFU86s2oytOBjVm2hw7tr PS1BCGn9keMxnKfmnijmZdCAbFtbaSxoYTNautDc0PX4m6HK0gcnac7ERWLaSi+sYHs1 bRkVkDZiZjeeCSHSojMKwULD4ndx7O4qrSkj61rYCaQMq5lcgrVSVfFVOYJEg1BSXKCn iuIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aP5Zn1SK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d12-20020a170906304c00b00781e568f39bsi12287334ejd.308.2022.10.19.03.56.16; Wed, 19 Oct 2022 03:56: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=aP5Zn1SK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234410AbiJSKzo (ORCPT + 99 others); Wed, 19 Oct 2022 06:55:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235019AbiJSKy4 (ORCPT ); Wed, 19 Oct 2022 06:54: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 01C9F1633AE; Wed, 19 Oct 2022 03:26:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D8940B8249E; Wed, 19 Oct 2022 09:07:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1565FC433D7; Wed, 19 Oct 2022 09:07:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170475; bh=hzbiDCjgP4PWpxtEpRK2mCWbxYUpFdc6paCISbBKNxg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aP5Zn1SK9z8B6dSkbPmRbDIJV1LQD90djpZKfjIU3I1+wtdJ5BJgZZfLLXMj5N8+c Xg8110o38O1r/XDeL/hytAl1Vct10HwUrEd5BYWG1K8gbkYkDHcxdmQb+Nlur5OOGe CK/fFgPIHb4EmUgwuGohz7I7ae5uY8spPvGuTtQY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Chancellor , Tom Rix , Andrew Morton , Vlastimil Babka , "Steven Rostedt (Google)" , David Gow , Yury Norov , Masami Hiramatsu , Sander Vanheule , linux-hardening@vger.kernel.org, llvm@lists.linux.dev, Nick Desaulniers , Kees Cook , Sasha Levin Subject: [PATCH 6.0 668/862] fortify: Fix __compiletime_strlen() under UBSAN_BOUNDS_LOCAL Date: Wed, 19 Oct 2022 10:32:35 +0200 Message-Id: <20221019083319.471583012@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747113231955365401?= X-GMAIL-MSGID: =?utf-8?q?1747113231955365401?= From: Kees Cook [ Upstream commit d07c0acb4f41cc42a0d97530946965b3e4fa68c1 ] With CONFIG_FORTIFY=y and CONFIG_UBSAN_LOCAL_BOUNDS=y enabled, we observe a runtime panic while running Android's Compatibility Test Suite's (CTS) android.hardware.input.cts.tests. This is stemming from a strlen() call in hidinput_allocate(). __compiletime_strlen() is implemented in terms of __builtin_object_size(), then does an array access to check for NUL-termination. A quirk of __builtin_object_size() is that for strings whose values are runtime dependent, __builtin_object_size(str, 1 or 0) returns the maximum size of possible values when those sizes are determinable at compile time. Example: static const char *v = "FOO BAR"; static const char *y = "FOO BA"; unsigned long x (int z) { // Returns 8, which is: // max(__builtin_object_size(v, 1), __builtin_object_size(y, 1)) return __builtin_object_size(z ? v : y, 1); } So when FORTIFY_SOURCE is enabled, the current implementation of __compiletime_strlen() will try to access beyond the end of y at runtime using the size of v. Mixed with UBSAN_LOCAL_BOUNDS we get a fault. hidinput_allocate() has a local C string whose value is control flow dependent on a switch statement, so __builtin_object_size(str, 1) evaluates to the maximum string length, making all other cases fault on the last character check. hidinput_allocate() could be cleaned up to avoid runtime calls to strlen() since the local variable can only have literal values, so there's no benefit to trying to fortify the strlen call site there. Perform a __builtin_constant_p() check against index 0 earlier in the macro to filter out the control-flow-dependant case. Add a KUnit test for checking the expected behavioral characteristics of FORTIFY_SOURCE internals. Cc: Nathan Chancellor Cc: Tom Rix Cc: Andrew Morton Cc: Vlastimil Babka Cc: "Steven Rostedt (Google)" Cc: David Gow Cc: Yury Norov Cc: Masami Hiramatsu Cc: Sander Vanheule Cc: linux-hardening@vger.kernel.org Cc: llvm@lists.linux.dev Reviewed-by: Nick Desaulniers Tested-by: Android Treehugger Robot Link: https://android-review.googlesource.com/c/kernel/common/+/2206839 Co-developed-by: Nick Desaulniers Signed-off-by: Nick Desaulniers Signed-off-by: Kees Cook Signed-off-by: Sasha Levin --- include/linux/fortify-string.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/linux/fortify-string.h b/include/linux/fortify-string.h index 3b401fa0f374..fce2fb2fc962 100644 --- a/include/linux/fortify-string.h +++ b/include/linux/fortify-string.h @@ -19,7 +19,8 @@ void __write_overflow_field(size_t avail, size_t wanted) __compiletime_warning(" unsigned char *__p = (unsigned char *)(p); \ size_t __ret = (size_t)-1; \ size_t __p_size = __builtin_object_size(p, 1); \ - if (__p_size != (size_t)-1) { \ + if (__p_size != (size_t)-1 && \ + __builtin_constant_p(*__p)) { \ size_t __p_len = __p_size - 1; \ if (__builtin_constant_p(__p[__p_len]) && \ __p[__p_len] == '\0') \ From patchwork Wed Oct 19 08:32: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: 5376 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp301227wrs; Wed, 19 Oct 2022 05:35:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6q395skve66+eAqUH7SVQScf7v1bZDzO/DBlbNYJ64II2Vs/C7+ZsYLfM30av4R1Y1PviW X-Received: by 2002:a63:2f82:0:b0:460:8786:5b91 with SMTP id v124-20020a632f82000000b0046087865b91mr6919567pgv.422.1666182957708; Wed, 19 Oct 2022 05:35:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666182957; cv=none; d=google.com; s=arc-20160816; b=ugHBO0FgZnsLLQnm1njH5fpIw1KSKu0P8Tf2UOcWCujMgt1Odcc8fvVr9XOVInUEPU s0kP8d1eaFbtkmRiV6R2DmuqUt9V5sFp0z5WAV0wCYkK8/LwZmc5CKoWVTJaOJtcG8VP mb3TlxHN4YQNYKnzfEPlR13GwB1KYwgQJ6/w+Tj8AOqUKqJs07Uyk1hIOkTpn2i+Y/gG 2ao4x2xPbSSKykXv5WksYdjZE+4Op9rEWNxLjUNrL6+ofnvua897bjDe1CUKXLyfrXfO 0NaJ1y89fWNQqfbdQfLp3tec7fOTXbfLS7nIhP2aJhBhQgiRm+A/qFcgdT4NmYHOAESC R3QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5UU1faRhyva+hrnjpUGx4UiOlTv45d8qgEQyvdFa5ls=; b=jfISlMhYD+SQ2lZw8J7SVoPWcB49RGpRzSlsibvjbE1W6bRaC/sy/OVux53ImRzivk 3klJY6jC0QPi/GKH2boO794FtgJY4J96ZsX6hJm8bN8v05nJBg9jQz+Qizl5QNUujUll 4jR0ybvaPMA2pPq8UbrDeAs0aMGawWcwYgAhRAG6dQRiGXvVCV2tWK1qvvspZY5wUh1U +94icOxaIQ/PJaFEyfeeTa5JEg8DC/cjVPwQgEdPvy0a+JNii4LnvSfXWkMJ6k54c7NV H2BbYAZm8dmYA67iR0zvgykiuCxJBDpxacINdHhxmF4+4CCUt/AiS5Fjunsgf6lCcTVp 5JGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jjXQXHSL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n28-20020a635c5c000000b004404705691dsi18585139pgm.487.2022.10.19.05.35.40; Wed, 19 Oct 2022 05:35: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=jjXQXHSL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233028AbiJSMW1 (ORCPT + 99 others); Wed, 19 Oct 2022 08:22:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233110AbiJSMWL (ORCPT ); Wed, 19 Oct 2022 08:22:11 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 303571B8640; Wed, 19 Oct 2022 04:56: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 0C7C6CE2185; Wed, 19 Oct 2022 09:08:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7DCBC433D6; Wed, 19 Oct 2022 09:07:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170478; bh=VV1OpKp2yHPswDsQUvrr44yQuL620U4g+koU7ZS60sw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jjXQXHSLtSECwJ50G78SSyJpPHk/uxszbqAPEOtezYh9a9U0YuV20t0yzYdhqLqli G9nrL8DOTz0f+sgnYS8ktYofe9aIj2yBvp05gC3YgvCWjPkhdOCKAVWdrk8hIFa7G2 grmSs8YJdbQJ4ew9toB/6jP5QPDgo5vFHUQ5W5qA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 6.0 669/862] ACPI: tables: FPDT: Dont call acpi_os_map_memory() on invalid phys address Date: Wed, 19 Oct 2022 10:32:36 +0200 Message-Id: <20221019083319.511522596@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747119461381841170?= X-GMAIL-MSGID: =?utf-8?q?1747119461381841170?= From: Hans de Goede [ Upstream commit 211391bf04b3c74e250c566eeff9cf808156c693 ] On a Packard Bell Dot SC (Intel Atom N2600 model) there is a FPDT table which contains invalid physical addresses, with high bits set which fall outside the range of the CPU-s supported physical address range. Calling acpi_os_map_memory() on such an invalid phys address leads to the below WARN_ON in ioremap triggering resulting in an oops/stacktrace. Add code to verify the physical address before calling acpi_os_map_memory() to fix / avoid the oops. [ 1.226900] ioremap: invalid physical address 3001000000000000 [ 1.226949] ------------[ cut here ]------------ [ 1.226962] WARNING: CPU: 1 PID: 1 at arch/x86/mm/ioremap.c:200 __ioremap_caller.cold+0x43/0x5f [ 1.226996] Modules linked in: [ 1.227016] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 6.0.0-rc3+ #490 [ 1.227029] Hardware name: Packard Bell dot s/SJE01_CT, BIOS V1.10 07/23/2013 [ 1.227038] RIP: 0010:__ioremap_caller.cold+0x43/0x5f [ 1.227054] Code: 96 00 00 e9 f8 af 24 ff 89 c6 48 c7 c7 d8 0c 84 99 e8 6a 96 00 00 e9 76 af 24 ff 48 89 fe 48 c7 c7 a8 0c 84 99 e8 56 96 00 00 <0f> 0b e9 60 af 24 ff 48 8b 34 24 48 c7 c7 40 0d 84 99 e8 3f 96 00 [ 1.227067] RSP: 0000:ffffb18c40033d60 EFLAGS: 00010286 [ 1.227084] RAX: 0000000000000032 RBX: 3001000000000000 RCX: 0000000000000000 [ 1.227095] RDX: 0000000000000001 RSI: 00000000ffffdfff RDI: 00000000ffffffff [ 1.227105] RBP: 3001000000000000 R08: 0000000000000000 R09: ffffb18c40033c18 [ 1.227115] R10: 0000000000000003 R11: ffffffff99d62fe8 R12: 0000000000000008 [ 1.227124] R13: 0003001000000000 R14: 0000000000001000 R15: 3001000000000000 [ 1.227135] FS: 0000000000000000(0000) GS:ffff913a3c080000(0000) knlGS:0000000000000000 [ 1.227146] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 1.227156] CR2: 0000000000000000 CR3: 0000000018c26000 CR4: 00000000000006e0 [ 1.227167] Call Trace: [ 1.227176] [ 1.227185] ? acpi_os_map_iomem+0x1c9/0x1e0 [ 1.227215] ? kmem_cache_alloc_trace+0x187/0x370 [ 1.227254] acpi_os_map_iomem+0x1c9/0x1e0 [ 1.227288] acpi_init_fpdt+0xa8/0x253 [ 1.227308] ? acpi_debugfs_init+0x1f/0x1f [ 1.227339] do_one_initcall+0x5a/0x300 [ 1.227406] ? rcu_read_lock_sched_held+0x3f/0x80 [ 1.227442] kernel_init_freeable+0x28b/0x2cc [ 1.227512] ? rest_init+0x170/0x170 [ 1.227538] kernel_init+0x16/0x140 [ 1.227552] ret_from_fork+0x1f/0x30 [ 1.227639] [ 1.227647] irq event stamp: 186819 [ 1.227656] hardirqs last enabled at (186825): [] __up_console_sem+0x5e/0x70 [ 1.227672] hardirqs last disabled at (186830): [] __up_console_sem+0x43/0x70 [ 1.227686] softirqs last enabled at (186576): [] __irq_exit_rcu+0xed/0x160 [ 1.227701] softirqs last disabled at (186569): [] __irq_exit_rcu+0xed/0x160 [ 1.227715] ---[ end trace 0000000000000000 ]--- Signed-off-by: Hans de Goede Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/acpi/acpi_fpdt.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/acpi/acpi_fpdt.c b/drivers/acpi/acpi_fpdt.c index 6922a44b3ce7..a2056c4c8cb7 100644 --- a/drivers/acpi/acpi_fpdt.c +++ b/drivers/acpi/acpi_fpdt.c @@ -143,6 +143,23 @@ static const struct attribute_group boot_attr_group = { static struct kobject *fpdt_kobj; +#if defined CONFIG_X86 && defined CONFIG_PHYS_ADDR_T_64BIT +#include +static bool fpdt_address_valid(u64 address) +{ + /* + * On some systems the table contains invalid addresses + * with unsuppored high address bits set, check for this. + */ + return !(address >> boot_cpu_data.x86_phys_bits); +} +#else +static bool fpdt_address_valid(u64 address) +{ + return true; +} +#endif + static int fpdt_process_subtable(u64 address, u32 subtable_type) { struct fpdt_subtable_header *subtable_header; @@ -151,6 +168,11 @@ static int fpdt_process_subtable(u64 address, u32 subtable_type) u32 length, offset; int result; + if (!fpdt_address_valid(address)) { + pr_info(FW_BUG "invalid physical address: 0x%llx!\n", address); + return -EINVAL; + } + subtable_header = acpi_os_map_memory(address, sizeof(*subtable_header)); if (!subtable_header) return -ENOMEM; From patchwork Wed Oct 19 08:32: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: 4928 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225977wrs; Wed, 19 Oct 2022 02:44:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7x4RThlMpIqhw+Vqg+LP5Dkz0rGeNk5Skqa0KtGMqC+47SW3p3wVBu1Qe5Hb43nmWrRJrc X-Received: by 2002:a17:906:5dac:b0:78d:fc53:7db1 with SMTP id n12-20020a1709065dac00b0078dfc537db1mr5770834ejv.99.1666172579725; Wed, 19 Oct 2022 02:42:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172579; cv=none; d=google.com; s=arc-20160816; b=qJ0YkHoGYiYYwSUY9QZSnR5iWlWV7vNwxhYOnSsW34buqcB3LDFarcSaCbf24l9JqK SmXR75ktitGB67EyH80Zh4kIe1G4sd6ZT351spgfUtXDMIYclI2JtWnpPypo0dlIPNmL WoaCaaY6jS3c1EqNIqx0bQsNbR4mO4mJ1DJkbZ5uqL4aZaQqE51aTh3ogZxlutftQ1Ta 5/GoZSJbdU/iyuEC90pSuzWNhjMJFMpO8roUQq2yKH0gCfBGEPzbJec8YB4Qa9mV+1Xb gNdZkFpua2K/GRhUyvSqbaaxG/IVZCdp1NbxVH0+te7jXh7rzvH9S4Z6JuPPz2hlPgfW rmYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=CZSjt032K0LHwvApGfEfA8wqmT/MRIyCh5n5MoAqxJk=; b=snLaIMPuWZik6om0CjM6aNtIXPDU24cEBEM3ISmnWtqJ4d5Rvobsvs1eoIHb8vqAnI 4uLpcwk0+JF47LvxkXa/vQZt7oEm7KjPIM+DFJUZEU8TxMFUxOAAL7U6AhwZ3BqkHMeB AnyyQ1kVChSKPxkyk6aKRBKF03eU/qs8FPNJ/+pdZrH2aqqcKqx7Vu1X6EbsWNJunKoM qtLYIB1mrNr1T5dQkLTxjhpR/PTZbZ8SMA9rOmzRV3+a4oyo4bKYpsLlAT/oRL3/hLQV 7aQNRTuLROFsuF56Ag3m7zxRhqEyfCsFcNafkvsH8kabyQAT0hCmJ2sgcwL0tFHiskaE rpVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=f44t+Ukn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qa43-20020a17090786ab00b007826e727aeasi14387690ejc.44.2022.10.19.02.42.32; Wed, 19 Oct 2022 02:42: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=f44t+Ukn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233451AbiJSJXj (ORCPT + 99 others); Wed, 19 Oct 2022 05:23:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233434AbiJSJWw (ORCPT ); Wed, 19 Oct 2022 05:22: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 20B52A46C; Wed, 19 Oct 2022 02:10: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 6C6FC61883; Wed, 19 Oct 2022 09:08:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83DFAC43151; Wed, 19 Oct 2022 09:08:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170480; bh=PU8iaCs2iWQxeCCZgNEo4F7oo3UpqlSd8bf4uBmxP6E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f44t+UknV8umQghKnCptTrP4KsBheOel/wepXPv5+QBgwEVzqxOWH5c8B2LBVBLeq gufbUjRv4oqGiyAW8xQmcLkjNU6HBGrKOLbUQajzdwIhqgtbcwzL/Q1iK36pt6rghX FeuPeG1pVASk/kXWJEdQ+t5iyZuxd+bqBV3/LGrA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Doug Smythies , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 6.0 670/862] cpufreq: intel_pstate: Add Tigerlake support in no-HWP mode Date: Wed, 19 Oct 2022 10:32:37 +0200 Message-Id: <20221019083319.564436329@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108578964041748?= X-GMAIL-MSGID: =?utf-8?q?1747108578964041748?= From: Doug Smythies [ Upstream commit 71bb5c82aaaea007167f3ba68d3a669c74d7d55d ] Users may disable HWP in firmware, in which case intel_pstate wouldn't load unless the CPU model is explicitly supported. Add TIGERLAKE to the list of CPUs that can register intel_pstate while not advertising the HWP capability. Without this change, an TIGERLAKE in no-HWP mode could only use the acpi_cpufreq frequency scaling driver. See also commits: d8de7a44e11f: cpufreq: intel_pstate: Add Skylake servers support fbdc21e9b038: cpufreq: intel_pstate: Add Icelake servers support in no-HWP mode 706c5328851d: cpufreq: intel_pstate: Add Cometlake support in no-HWP mode Reported by: M. Cargi Ari Signed-off-by: Doug Smythies Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/cpufreq/intel_pstate.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index 57cdb3679885..fc3ebeb0bbe5 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c @@ -2416,6 +2416,7 @@ static const struct x86_cpu_id intel_pstate_cpu_ids[] = { X86_MATCH(SKYLAKE_X, core_funcs), X86_MATCH(COMETLAKE, core_funcs), X86_MATCH(ICELAKE_X, core_funcs), + X86_MATCH(TIGERLAKE, core_funcs), {} }; MODULE_DEVICE_TABLE(x86cpu, intel_pstate_cpu_ids); From patchwork Wed Oct 19 08:32:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5170 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp254516wrs; Wed, 19 Oct 2022 04:00:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5EaVpMQymEEkkQJ54VUDcoe1PRmy0vfUw6e9HlIpS4RKPq+MhK/LcLvQa42iCQiZBd7jYH X-Received: by 2002:a17:903:41ce:b0:182:a32f:4dde with SMTP id u14-20020a17090341ce00b00182a32f4ddemr7634705ple.47.1666177214986; Wed, 19 Oct 2022 04:00:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666177214; cv=none; d=google.com; s=arc-20160816; b=osfEBjjrMSRmVnpI6iNUqxOk+M723cqX8rMG6YVV7xy8XRbvbdvBLlYJ24KBakc27p ALLn8BxcjrgISl4O0K6b5plHoGlttRkMvUAF8zqsW0PVQbs6XFafmHzkMT7UljQ8GQf1 LZZh8BInhwwB65a+vErC1MFjEB097nn8F+07MljvhyQfNd5Twy5hKGxsfLfIhMij9L2t 7IX3cf598BjMioiQPO2vcbLqyVlrgBXvTpsDnHUf60SGYrirXejGrw2VLbGFr0uGIU3Y dERmyvi3nuwBFw5YpBPkIwgMgCYw9U5SqexmPX746VSOOOrseyyCOETG61dOuvwKL2hw F4eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dn40mAEd+ueLEc57uBzBl/9DVPEVHFPbbZQ1FkYTyKw=; b=NnQuIalfTvaMAX9Gd1zkG0cesNmyc5Hs1+DpjsZ80tZIfcks2BJIS8yz89zvFpVXVk HDMg+pVN9r08WVOHVHOhTsZeAlOcAhpcVbYbwiTNFxWKDCj+3Y4azKakZ7o47UT9lD1d 5RwdUleLUZBurscp4zKrlVO4yNW7cxqwa+iU25pbazUmtiGb5h+960ggWqjoz+NFTQow L6TnDssoFVBbbYdRyGu1bLyTosvMpHExZurOALXaLOTWgCWIm71VSzQBVJ5Kyls2r2vG AGpzuh6i1EPvcO7Qhs+VngLWTdriXvMPYqfcZN7JW4XtpE0PcTHlRXOSV8Ac1hCPLT0l mu0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=b7rPBevF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l11-20020a170902f68b00b0017f7f68da4esi11217661plg.334.2022.10.19.04.00.00; Wed, 19 Oct 2022 04:00: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=b7rPBevF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234667AbiJSK63 (ORCPT + 99 others); Wed, 19 Oct 2022 06:58:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233118AbiJSK5M (ORCPT ); Wed, 19 Oct 2022 06:57: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 CA6EDF53C9; Wed, 19 Oct 2022 03:27:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2BF33B824B3; Wed, 19 Oct 2022 09:09:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 505C9C433D6; Wed, 19 Oct 2022 09:09:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170592; bh=SLEl1ykAV5RDsgLc/AeCBHJhHpc6G+47h6ZWYxuzlL0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b7rPBevF4BAmii9z0JKcKKfeLsKndZp/XOU6zDNuQGxWlBvpSxZkcOe+GDKx8I4wf AI0YKn31hrIgk098m6DSkWO19WTeLFCHgUTo/xZRrUpjw2w/8Jaxqh4BozpQUZQJh1 Xtd9RZSDEojEGcgJPIeznTt9ieNip3v4L6UC5SvY= 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 6.0 671/862] MIPS: BCM47XX: Cast memcmp() of function to (void *) Date: Wed, 19 Oct 2022 10:32:38 +0200 Message-Id: <20221019083319.597586557@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747113439145522240?= X-GMAIL-MSGID: =?utf-8?q?1747113439145522240?= 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 ab203e66ba0d..a9bea411d928 100644 --- a/arch/mips/bcm47xx/prom.c +++ b/arch/mips/bcm47xx/prom.c @@ -86,7 +86,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; @@ -159,7 +159,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 Wed Oct 19 08:32: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: 5454 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp329638wrs; Wed, 19 Oct 2022 06:33:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6fd8mOBbFQF/xcFNz35VucprpBiIcF55FXe8B5mfO8BJwXI/J9lBi2EWVQDaCJT0OQyDL3 X-Received: by 2002:a63:82c6:0:b0:46a:deff:7691 with SMTP id w189-20020a6382c6000000b0046adeff7691mr7368094pgd.214.1666186395950; Wed, 19 Oct 2022 06:33:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666186395; cv=none; d=google.com; s=arc-20160816; b=AhXsATkx0yATvtMEJ4cBvo4FuOPsiP8+6ZFBuP5PfLj4bo+LtyncNBFCVxZ55iTMIR p1aaPmk/CaIphEmzN6EK9AU8W0J1DJpLsl94Ul3vffFMnpPzRVxw/aSRBdLXsBwieEkz /06V2CRPkvTHGoaIbUovq4ule4C97z0ZDDXxZeTI3nNGaTKoRpVfTesfXIZ4Ij+BB1XX 0/kwbr8lc13n/T4hYut8YI4tF9cR+pdzoLUkeEZ+sD1faDdR4DO47WyKMXtyJS9/xK67 onqyKaGT8fpOFuZvrvhad4Qaci5C9PQ2RKv+gCcy/fg1aMRjTpsQfMJ1Ud+sCaQdqRcc i2Qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JmAKnMZg75teQOjPbZwCL9oaXyCVokPiAv84dwVUck0=; b=Xfq2TsHeJX0+VkuxD1eqDgnHN2tzYDZ+Fv+ISLMUBWPo3hpOKDBNxhzW0SwszYqa3q QRE3+mplgU2rUUirzA3MrE2l8KPJ0/GbZiwD93IEiSqWeC5FJoGuZtiOXRa8rEzANCFM xujHBHeo3Xu+qvDTVSw08dfKRaBdktwtbru7+FIuVGGju4GqW1QwKOuS/sxNO0l4Xn5y e5aE8gDi12scdcC4E2pKu9oQ85hfRL8dX9Ghzok+KV9GSY9Yf7BKuhKDcZ5ozRBY+4+Y xK5jqf+3Akq9wC/5TlkRedmXOF1jx5/vMhoPaAiobF/jy3F/rrwwRGwobX0x+cUzfaHb VstA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fHA5DtW3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fh7-20020a17090b034700b0020b22ffcbabsi16258287pjb.179.2022.10.19.06.33.02; Wed, 19 Oct 2022 06:33: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=fHA5DtW3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232481AbiJSNUv (ORCPT + 99 others); Wed, 19 Oct 2022 09:20:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231642AbiJSNUK (ORCPT ); Wed, 19 Oct 2022 09:20:10 -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 5BB4D1DD893; Wed, 19 Oct 2022 06:05: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 sin.source.kernel.org (Postfix) with ESMTPS id B7837CE2188; Wed, 19 Oct 2022 09:08:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB922C433D6; Wed, 19 Oct 2022 09:08:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170502; bh=if9Z3iTCK9QwPI7zMtkYtKKyLz8fKtzTU9GSQ7AW/0Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fHA5DtW3h9zXvCWEGoSih0gaYU7Xp19f9cVAMJQr8WBWVoK6T/V51jL5d5qHpmuVd OA3K71pQclLKKnBnIB6T01otq1Mpuo2p5FJ9yKLKY/4dH9yYsIqY0p9ebiqZOx6zUb H+DkFvOXOBdXRaFJ2gFxlhYTvWyt8sFW2fTNIvgc= 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 6.0 672/862] powercap: intel_rapl: fix UBSAN shift-out-of-bounds issue Date: Wed, 19 Oct 2022 10:32:39 +0200 Message-Id: <20221019083319.648230836@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123066500166285?= X-GMAIL-MSGID: =?utf-8?q?1747123066500166285?= 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_common.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/powercap/intel_rapl_common.c b/drivers/powercap/intel_rapl_common.c index a2a2f4351463..33a3ca35cda0 100644 --- a/drivers/powercap/intel_rapl_common.c +++ b/drivers/powercap/intel_rapl_common.c @@ -994,6 +994,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 Wed Oct 19 08:32: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: 4967 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp226796wrs; Wed, 19 Oct 2022 02:46:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5fFtfQl03G0OoaU4AzJ6GAxOcOLcu59sywUatW+cukf0G8wiY0zD3gqEEerrUCCOOp/Myc X-Received: by 2002:a63:d1b:0:b0:42b:828b:f14a with SMTP id c27-20020a630d1b000000b0042b828bf14amr6571433pgl.235.1666172815306; Wed, 19 Oct 2022 02:46:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172815; cv=none; d=google.com; s=arc-20160816; b=NgFaxvdBizpAtO2UrpHeyh0lp4PoO4LWpdFzMTqBf27w6Xiqif+x9GlIEmN5bGidGh 5Y4TXCLBc5lrn96/n35nEYn4gr3fsxFB6ioB1d2Cte4w1X62gvXy7NxjiAJX7oamF0cn lMVknntR+nNxpsElke/O3BSjYVBXSJzUPdWNDw7alRe8zn0GLhWD+AZIMEdRnQUC4YdX oN6z6EK2rBiHbwZgKMdaou5qPv24TZgVcwXBSPy1oODBnVFMf22CC0ake2q2J/IlFHK5 mkAv+FX9b2p6TMWylVAZqMbwy5chPNoFrnLUnwu1efP66Sm/mz9KpKKysTPfTHqH7Brd /TTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ma9FpLCpZxntQhjPvuA56EGCf9dh3cQ9rCzxLDKkr34=; b=s5F8KPbxppwvmaYZkVbD7/ftaFQaQhHoTmfi71sIN7hxM/2ls+uRq0H60XbaicfqzX rDife+Lcj8KpbEbPPQcRt9NcLx5NSh6Al+QEF9JlcC48GLg1gVdDOy57km7oMqmEPJtJ KFy0l1hweIKP97R8sadN82RlzWOhe9V9+CfYGSnnCBXydAngHNCPmpIboJzZqoCCcy3C XgGxKuooqJfGf4WDAZ15ulI+x3253rH2ciyHcoPc3yqaA3bc4DoN4JmFW+O/FS8lZbcD SDXNhbZwAvyskOwHJx5NLzWGuxkAzsXELii5AWuIGT0XHExWwoZkWbD59NCsR30z4P5S jwyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vc77MsHj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id px4-20020a17090b270400b002008d0b0838si17076451pjb.178.2022.10.19.02.46.42; Wed, 19 Oct 2022 02:46: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=vc77MsHj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234517AbiJSJoX (ORCPT + 99 others); Wed, 19 Oct 2022 05:44:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234704AbiJSJlI (ORCPT ); Wed, 19 Oct 2022 05:41:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD6A6F41B7; Wed, 19 Oct 2022 02:17: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 9F6FB6187C; Wed, 19 Oct 2022 09:08:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3E3DC433D6; Wed, 19 Oct 2022 09:08:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170531; bh=sO3qeFRmk2abLCeiuvM40rE2MlBvScvIuhhFNrA1ZVU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vc77MsHjGvsReZkXN0OSzxOv63afc4eWctSKx5Dl4PYM/lYPxKXx5+oQbvxui/Jlz IyjK3U+xPygGI5q/xycHwJz5fBsY5qiPO2V1BHYSyc18Wox86zfBb57bwchJ3/T9D1 zS1rzBYhbgMQj9+Qm4plJK/YdFaZG3uqgx+o2WM4= 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 6.0 673/862] thermal: intel_powerclamp: Use get_cpu() instead of smp_processor_id() to avoid crash Date: Wed, 19 Oct 2022 10:32:40 +0200 Message-Id: <20221019083319.696819430@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108826033934437?= X-GMAIL-MSGID: =?utf-8?q?1747108826033934437?= 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/intel_powerclamp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/intel/intel_powerclamp.c b/drivers/thermal/intel/intel_powerclamp.c index c841ab37e7c6..46cd799af148 100644 --- a/drivers/thermal/intel/intel_powerclamp.c +++ b/drivers/thermal/intel/intel_powerclamp.c @@ -532,8 +532,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 Wed Oct 19 08:32: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: 4848 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223821wrs; Wed, 19 Oct 2022 02:38:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6JsfV2gmiE4YeEF4O0a9se5AhW3G2/N/xVSScIVtuZtUolwBJi0tBSJsxfNfNvnXQLTB2X X-Received: by 2002:aa7:c698:0:b0:458:8274:12ac with SMTP id n24-20020aa7c698000000b00458827412acmr6610059edq.351.1666172315017; Wed, 19 Oct 2022 02:38:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172315; cv=none; d=google.com; s=arc-20160816; b=AC8YR9SlSLufI95bzQqUsNDq/09dkbae8hv09CH26dYmdoCKGu6WdrsOw2ZzHoJHlW OCI7Ch8D5fdnk1wdNzdZRrGwRlo5DxjC0aTDQ6FfGGIq0ykiGtzTSSlAQ/OoYvv2H+gS 8CmUQjhpdV3aI+PFg+txhn6tGe4yN1azFjZO7tD78tHlsTt4yp+2KBIyf6LBM0d/8qnQ d+IPJMnUv19dttdnOrxV0q+S8+SABD5vlfLY38jw/K19vVnAVawVXo07WR9wTf0AQ+GX +6AReZ0ygIVShisiXQ5Q1f/TuQDAEyI6zCUYS849CuhJkklqpWCsnIrqv1AWTZlm3gyq NJDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=O8rtQZvCK3QrKkEijY70c3BNQMjq20RYlITf+boiZWE=; b=r4tETVRVgaoaRV195obDFtWmPAU4miVx7aU/Luhqnt1vXA0AxJ2HJIgfxJVhilN6aj bBPxaXzygc9fekD/UAYcotq2rtLPjggIqTxcgfezEleyF9f8kYDdfyWTXGx80YfR9u8Y /VFQoGa3iTr0K3kvwgBPFw1WuvAgwClBrRR7tWELlZGjQ9pXxonZ2+OxAvSuLo1e67je 6k/qx4zSfyP+cOf85xJk1pkH7VqE6cpm/1+gaHC52aCSpqc17aTfx613T56LkK6/1ryw U2I4uQYtkArq5cHYlWU6CVePfcskB8M9Sej0k+SE9snd1wfvcAP7u84ZKuMHq3DmAimx g57Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ecTx8Qns; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l13-20020a170906794d00b00781d6cda765si15089082ejo.913.2022.10.19.02.38.10; Wed, 19 Oct 2022 02: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=ecTx8Qns; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233598AbiJSJ10 (ORCPT + 99 others); Wed, 19 Oct 2022 05:27:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233552AbiJSJ02 (ORCPT ); Wed, 19 Oct 2022 05:26:28 -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 086C1DEF39; Wed, 19 Oct 2022 02:11: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 A9B7561866; Wed, 19 Oct 2022 09:09:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB96CC433D6; Wed, 19 Oct 2022 09:09:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170561; bh=KJQPpJ32UIqN4u7A8mzjqm34rg4kJPRAbyTUOPAsbIY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ecTx8QnsGYvMZ06Z476vbfHu10D5Vg5TwyAj5YTXJwmakUuIX1eJnvMRREWr/PL1X SCp4zexjTngytuFJ1w/0lx214ggSG8BScasZuNkfx3oWB+54mCsM9DU8pLRAoHb4Th YlRfgBB1NhyzjSUn/ISoCghoMO9kZKC4f6OkT1/E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Russell King , linux-arm-kernel@lists.infradead.org, Kees Cook , Sasha Levin Subject: [PATCH 6.0 674/862] ARM: decompressor: Include .data.rel.ro.local Date: Wed, 19 Oct 2022 10:32:41 +0200 Message-Id: <20221019083319.746621086@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108301492521550?= X-GMAIL-MSGID: =?utf-8?q?1747108301492521550?= From: Kees Cook [ Upstream commit 1b64daf413acd86c2c13f5443f6b4ef3690c8061 ] The .data.rel.ro.local section has the same semantics as .data.rel.ro here, so include it in the .rodata section of the decompressor. Additionally since the .printk_index section isn't usable outside of the core kernel, discard it in the decompressor. Avoids these warnings: arm-linux-gnueabi-ld: warning: orphan section `.data.rel.ro.local' from `arch/arm/boot/compressed/fdt_rw.o' being placed in section `.data.rel.ro.local' arm-linux-gnueabi-ld: warning: orphan section `.printk_index' from `arch/arm/boot/compressed/fdt_rw.o' being placed in section `.printk_index' Reported-by: kernel test robot Link: https://lore.kernel.org/linux-mm/202209080545.qMIVj7YM-lkp@intel.com Cc: Russell King Cc: linux-arm-kernel@lists.infradead.org Signed-off-by: Kees Cook Signed-off-by: Sasha Levin --- arch/arm/boot/compressed/vmlinux.lds.S | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/boot/compressed/vmlinux.lds.S b/arch/arm/boot/compressed/vmlinux.lds.S index 1bcb68ac4b01..3fcb3e62dc56 100644 --- a/arch/arm/boot/compressed/vmlinux.lds.S +++ b/arch/arm/boot/compressed/vmlinux.lds.S @@ -23,6 +23,7 @@ SECTIONS *(.ARM.extab*) *(.note.*) *(.rel.*) + *(.printk_index) /* * Discard any r/w data - this produces a link error if we have any, * which is required for PIC decompression. Local data generates @@ -57,6 +58,7 @@ SECTIONS *(.rodata) *(.rodata.*) *(.data.rel.ro) + *(.data.rel.ro.*) } .piggydata : { *(.piggydata) From patchwork Wed Oct 19 08:32: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: 5161 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp253679wrs; Wed, 19 Oct 2022 03:57:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4YvxWkNftpUxF0G2KhV5EnA3MeIRqU00ltT6vt5RKF+AbBX1yztDApyt06o2NYykwM0pKZ X-Received: by 2002:a63:1d22:0:b0:439:3e7c:8af7 with SMTP id d34-20020a631d22000000b004393e7c8af7mr6743941pgd.78.1666177075224; Wed, 19 Oct 2022 03:57:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666177075; cv=none; d=google.com; s=arc-20160816; b=C69lWoX52FcFH7LVU3gxmFtwAy+6yFCuPI1puxmy0Kwd1FP+lVE3yC41yTQc2H2WTP PuAzSlM7q9wNUJdkHDlCBcsSuDtUIgBDq8IEimSHNQMkv+5RpFRnY2xtNXbLh4yWHCPN AH2EXzmAHKcpn0Bh+qiXm1yZv+uEhtWxbbimGRTmlFskm9tSGrnDx3G0woqlZ7jqJKMi Vv2Gpd7OxyKquLhUy5iiPKfQMLCHZ6PVdwkzqXm3E/HdKf3xVP1yrlYK7oLoXH9dPRLZ jPZkJjL90hInqSCWCw1kBqYQSuPU3NLdGekxvafSdY2nMw3d2C0UAK7pik17fbR5pHi+ wJKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UBym0VXSnLeYoMgTFdL3ZmoKoU+5/HKxdD3hjJz0Diw=; b=j0UWf5QC2YxK8jAerEeLC8xzC0zQsxIPWDHM0QOnm8/GfrDN/ujkgHAP7uoFy66qO6 2WYSI+5UdpMIUWlE0Mh6nLfcG++GujvqQdR2AQ48GiLExlxvaxovol/maPjU3LN6NS+C NZgrvQeHwiomEjyaR0ZohL45Jx7n28E+YUS4dvikGzbWODw1z68AmMKL/f/xgldzJnJp jQnpN0ajLFLrm9r1aML69PCD+iNLqStwN2ZG5V04DfVBgC0N+o9keaH+6dCPSV9WYM1U kBLIrsehrZWSrqI2TKuTiGlQ7ol2T+B2qSAbVLy1kg7Gas2MyZmz+NWuMe3GzJ8aXvp0 s+iQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SL9NtCnk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c4-20020a170902aa4400b0018262dc4e92si17585123plr.241.2022.10.19.03.57.40; Wed, 19 Oct 2022 03:57: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=SL9NtCnk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234461AbiJSK5S (ORCPT + 99 others); Wed, 19 Oct 2022 06:57:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233644AbiJSK40 (ORCPT ); Wed, 19 Oct 2022 06:56:26 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 356A7367A5; Wed, 19 Oct 2022 03:27: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 692B0B824AA; Wed, 19 Oct 2022 09:09:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5DDBC433D6; Wed, 19 Oct 2022 09:09:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170577; bh=psaJ9l6m2dT3AwTJ14Cd2vhLcC+Ys2U7Ajn7QpIyigg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SL9NtCnkYbSUn2+AjoEoi+lh9TkgUYUM5afS1vQ9EFTD6fT+WEG+rOg2Tm/GO+RTM oE/k28HMwVU/LUNr2tzixuijSx4ymRh9rBnSb/nyLIShZsYVzU5W4j2/q2Ho5u04WP X3LmhsSPO/XbUMfIgRGanmr2stbbCiXwiXa1ILCQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mario Limonciello , Hans de Goede , "Rafael J. Wysocki" , Sasha Levin , Luya Tshimbalanga Subject: [PATCH 6.0 675/862] ACPI: x86: Add a quirk for Dell Inspiron 14 2-in-1 for StorageD3Enable Date: Wed, 19 Oct 2022 10:32:42 +0200 Message-Id: <20221019083319.797692735@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747113292957537808?= X-GMAIL-MSGID: =?utf-8?q?1747113292957537808?= From: Mario Limonciello [ Upstream commit 018d6711c26e4bd26e20a819fcc7f8ab902608f3 ] Dell Inspiron 14 2-in-1 has two ACPI nodes under GPP1 both with _ADR of 0, both without _HID. It's ambiguous which the kernel should take, but it seems to take "DEV0". Unfortunately "DEV0" is missing the device property `StorageD3Enable` which is present on "NVME". To avoid this causing problems for suspend, add a quirk for this system to behave like `StorageD3Enable` property was found. Link: https://bugzilla.kernel.org/show_bug.cgi?id=216440 Reported-and-tested-by: Luya Tshimbalanga Signed-off-by: Mario Limonciello Reviewed-by: Hans de Goede Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/acpi/x86/utils.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/x86/utils.c b/drivers/acpi/x86/utils.c index 664070fc8349..d7cdd8406c84 100644 --- a/drivers/acpi/x86/utils.c +++ b/drivers/acpi/x86/utils.c @@ -207,9 +207,26 @@ static const struct x86_cpu_id storage_d3_cpu_ids[] = { {} }; +static const struct dmi_system_id force_storage_d3_dmi[] = { + { + /* + * _ADR is ambiguous between GPP1.DEV0 and GPP1.NVME + * but .NVME is needed to get StorageD3Enable node + * https://bugzilla.kernel.org/show_bug.cgi?id=216440 + */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 14 7425 2-in-1"), + } + }, + {} +}; + bool force_storage_d3(void) { - return x86_match_cpu(storage_d3_cpu_ids); + const struct dmi_system_id *dmi_id = dmi_first_match(force_storage_d3_dmi); + + return dmi_id || x86_match_cpu(storage_d3_cpu_ids); } /* From patchwork Wed Oct 19 08:32: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: 4855 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223868wrs; Wed, 19 Oct 2022 02:38:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6lEB3ucKzCr9tdTLTaX0n38dfTWpZb82XBbz8K+cl/hnc9/q+QxAekbvcJPF1ZQkW0u/cu X-Received: by 2002:a17:906:4fca:b0:78d:b042:eeca with SMTP id i10-20020a1709064fca00b0078db042eecamr5782046ejw.685.1666172324209; Wed, 19 Oct 2022 02:38:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172324; cv=none; d=google.com; s=arc-20160816; b=qX5M3gU23XyvbS447ZUCKKlvfzIKgv+wXOkYK1epMi15mDCS0vXGMig8Buee067VwU egpGzqyXZPtWDm3cktDIOETG2D6HSpqOXNxOS3yJYQ3d1BSSLhh4d1I+BRq7bJK/WuXF Gygz1FKdYCEoobBnpqrYWGt182DaU1Tu6eYIJyk3Co6zNS4k8UIJND3fyGD4IAPo2mAw NewagUKLOy38ey3jmkFnZf8smFEK5Cq1FYjMuVtiQQhv17l0IDR0REpilxh/+X7U8heQ 5vAlF4rdyeJeJjPJrRcgOGL5zHVuoRiGzM3ZAioPI90g+PRnDS2NXlhrHGsk1wJK9DQV jhyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vuA9a6t3fOnapTOTnGUH/1TrbgIT7put1zz010HiY+U=; b=DEDwMlk1UTtMcSaErbwf4vvfjR931wSrXnXzRluPSOh+5hcfT8B0WsgZnj0HQf7FB/ bb4LgGY4bJn1gf1JiIy9BC0cnNRCjQ2OG+xiYq4G+24AFkRjkm5fKFZgCh6S8RVEnaZn 1t2dWcQytqwA4sIaXt+QuJ3xWAe9OUg++sImojL9K1SYF2Z/wm1DMbD//VXO4P5tcwml wuBVBnanpabYHDF9gjqEanfrmKFpT5T1QeKNbow0p63HXNhOL3Rz9HHJBeWFVoY3RVCf y6G3oA89PLbXEOMCTy/G7WJ15FcOLhYOBSxMsX5oKhvfBN9nVueZsPrFKu1/0qQ9Xp+H 7uPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FKrkq4mx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gb22-20020a170907961600b00734b2821879si15382674ejc.898.2022.10.19.02.38.17; Wed, 19 Oct 2022 02:38: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=FKrkq4mx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233349AbiJSJ1x (ORCPT + 99 others); Wed, 19 Oct 2022 05:27:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233565AbiJSJ0d (ORCPT ); Wed, 19 Oct 2022 05:26:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D02EBE52F8; Wed, 19 Oct 2022 02:11:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5E86261831; Wed, 19 Oct 2022 09:09:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49A47C433D7; Wed, 19 Oct 2022 09:09:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170579; bh=WOtLqPtfTzhG6xYKuXLzf9SXFlrNx350kTurMW1iEWw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FKrkq4mxl7UzWAyUXth0fYW43x5dhgids6rAsLpKKl9ExuG+YJ4gAIe3baLB+TKdo MGfLJ1/67Ht6N1AARsFqPu0sLeL3Vbzpd4C1gmpx5Fp/LPj0oJIBqdBPVugqUUP/LH gPNcImneQBiLWeW697ON9gShNI+BBoJCeoxOyoa4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Juergen Gross , Boris Ostrovsky , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , xen-devel@lists.xenproject.org, Kees Cook , Sasha Levin Subject: [PATCH 6.0 676/862] x86/entry: Work around Clang __bdos() bug Date: Wed, 19 Oct 2022 10:32:43 +0200 Message-Id: <20221019083319.836953318@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108311014785001?= X-GMAIL-MSGID: =?utf-8?q?1747108311014785001?= From: Kees Cook [ Upstream commit 3e1730842f142add55dc658929221521a9ea62b6 ] Clang produces a false positive when building with CONFIG_FORTIFY_SOURCE=y and CONFIG_UBSAN_BOUNDS=y when operating on an array with a dynamic offset. Work around this by using a direct assignment of an empty instance. Avoids this warning: ../include/linux/fortify-string.h:309:4: warning: call to __write_overflow_field declared with 'warn ing' attribute: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Wat tribute-warning] __write_overflow_field(p_size_field, size); ^ which was isolated to the memset() call in xen_load_idt(). Note that this looks very much like another bug that was worked around: https://github.com/ClangBuiltLinux/linux/issues/1592 Cc: Juergen Gross Cc: Boris Ostrovsky Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: x86@kernel.org Cc: "H. Peter Anvin" Cc: xen-devel@lists.xenproject.org Reviewed-by: Boris Ostrovsky Link: https://lore.kernel.org/lkml/41527d69-e8ab-3f86-ff37-6b298c01d5bc@oracle.com Signed-off-by: Kees Cook Signed-off-by: Sasha Levin --- arch/x86/xen/enlighten_pv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c index 0ed2e487a693..9b1a58dda935 100644 --- a/arch/x86/xen/enlighten_pv.c +++ b/arch/x86/xen/enlighten_pv.c @@ -765,6 +765,7 @@ static void xen_load_idt(const struct desc_ptr *desc) { static DEFINE_SPINLOCK(lock); static struct trap_info traps[257]; + static const struct trap_info zero = { }; unsigned out; trace_xen_cpu_load_idt(desc); @@ -774,7 +775,7 @@ static void xen_load_idt(const struct desc_ptr *desc) memcpy(this_cpu_ptr(&idt_desc), desc, sizeof(idt_desc)); out = xen_convert_trap_info(desc, traps, false); - memset(&traps[out], 0, sizeof(traps[0])); + traps[out] = zero; xen_mc_flush(); if (HYPERVISOR_set_trap_table(traps)) From patchwork Wed Oct 19 08:32: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: 4867 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp224031wrs; Wed, 19 Oct 2022 02:39:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7HVsj6uZTHJS5xN9PMZzquArqVrS8k7+t04FDTNRjtWPfwZUrYucrsrSaXgGTUONtrgSLC X-Received: by 2002:a05:6402:1555:b0:458:ed89:24e9 with SMTP id p21-20020a056402155500b00458ed8924e9mr6706004edx.55.1666172350142; Wed, 19 Oct 2022 02:39:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172350; cv=none; d=google.com; s=arc-20160816; b=Ja/QCIfmZptlI2t+ynnnnqsJVT8ZmBs3euqBNqj6WePe0UMVk5z3F8pzHpkNCEY1BG CrvizO0y2QkJJcuDURRgXrP4SROkD8OkndYx416uNnNAokdYEA2KdAIQ4y7tQYp3UbiV 9UJWSaE0N6lM5tv2U2Q2RYysNERrZqgznK0y+16EnTYfbdSsZJbJVDI2+CtOJiCry0J4 QWdLPvGbKjNpWtbVdyixbwDfkpBBhWxEYGu0HGh9sDaHy03ziJnU4If1XZXeG+j0lp52 Tthb7WKtq8CrRdE1J0O0D2TcePKhApbrDndbXHx2yJ9R/EeLO3LcHlBGoC82rvQdWkJs s0jA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3SqRgJt00H2mfMMvvWdbwlSViR9gidGMtnS4Levsksk=; b=dqn1kUugz6ONqqCCnVbgqSRTaJZef3wg4ivLQC2ACKoKAJNF8cKM5sxTvFnfiO4ZaC UA0E+PqtP84ZLOcUL0Pjv0YNPb6uN8XYQEbJ2reoQCYDYqyGvcMyVQ+PnfOyKXM4Z9+m /vpNPXnOV0pnMuVtkeuRHSoZuq7834WMD4l1aUqblc9Syvr3or2VhoQxSYr4geOGt+/t r6+9et99NKLdDiB/m+yDViAKJFU39oduoCgtObbe+VBKO3jSi4fWfs4ivUVMaSisleqU sIay/sC3jR8rosfJCjJvtqryy4spCkk/ZuvYEXwkn1UQa943M8pgebSWs/WvNHEqrfwP Hrjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vcBksNqI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dt4-20020a170907728400b00791a2a7e578si2736698ejc.641.2022.10.19.02.38.45; Wed, 19 Oct 2022 02:39: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=vcBksNqI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233404AbiJSJ2M (ORCPT + 99 others); Wed, 19 Oct 2022 05:28:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233335AbiJSJ0q (ORCPT ); Wed, 19 Oct 2022 05:26:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34B21E5EE2; Wed, 19 Oct 2022 02:12: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 018016188A; Wed, 19 Oct 2022 09:09:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16930C433B5; Wed, 19 Oct 2022 09:09:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170582; bh=7xZ7rHr01eEXncxS5mJsDxFL7Ztrh49ewCaAO1obong=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vcBksNqIbne99Km2bgnU4fSqheRaZexoJ2xiqPZt7SnF7629kYPUZgzmr7x3abfT7 Jn8JJUIMq4KedH0T2+2YtvstYs47xikz4Y9NcZPNRN9gSFoHplEbkIYRbfsa63VQD6 eIJAeJqO4IrLo0EZWWin97H2ljoCXO4mqKv4oB9w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anna Schumaker , Chuck Lever , Sasha Levin Subject: [PATCH 6.0 677/862] NFSD: Return nfserr_serverfault if splice_ok but buf->pages have data Date: Wed, 19 Oct 2022 10:32:44 +0200 Message-Id: <20221019083319.883708577@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108338316278053?= X-GMAIL-MSGID: =?utf-8?q?1747108338316278053?= From: Anna Schumaker [ Upstream commit 06981d560606ac48d61e5f4fff6738b925c93173 ] This was discussed with Chuck as part of this patch set. Returning nfserr_resource was decided to not be the best error message here, and he suggested changing to nfserr_serverfault instead. Signed-off-by: Anna Schumaker Link: https://lore.kernel.org/linux-nfs/20220907195259.926736-1-anna@kernel.org/T/#t Signed-off-by: Chuck Lever Signed-off-by: Sasha Levin --- fs/nfsd/nfs4xdr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index ac1b03cf05a5..2960d0a8e8f9 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c @@ -3988,7 +3988,7 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, __be32 nfserr, } if (resp->xdr->buf->page_len && splice_ok) { WARN_ON_ONCE(1); - return nfserr_resource; + return nfserr_serverfault; } xdr_commit_encode(xdr); From patchwork Wed Oct 19 08:32: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: 4875 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225349wrs; Wed, 19 Oct 2022 02:42:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6g1tWuNQM84nNbIcYVREdy45//YiT/AiUXpx9nsDx479zQtezo17qWvnsKdm8we0Mk0mPy X-Received: by 2002:a63:18f:0:b0:43c:24d2:c0f7 with SMTP id 137-20020a63018f000000b0043c24d2c0f7mr6540261pgb.470.1666172577272; Wed, 19 Oct 2022 02:42:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172577; cv=none; d=google.com; s=arc-20160816; b=hgKffn5tSKE4wr+C0nxO5KhVQvtDiFSaFpQSWTvxI3Z/qQt0fHRYVKRSwryzLmjMmM /sIR9CAS5fgcZKF3oJXNMgCrzZsbi6r4BqxsrFRiZ4bU/fqXeGs1jhdG2OiVAXvT6Q9T 5jsI4IkWwpIxH2u7k4gaLZIreMWE3HwwR9oeFsFuRRe0nPsADHOn926zvNkrV8znPbAn 3cN54mTn/xrCPUmivlcd8qboA2Vp5VwHEYcqtlcL+8S/U6RkXNBUjRQtN1kVegCt/aV2 SVRkQ70sMcicqv1av+BVJCcPKLTr2kTqx9fljy6WrW21620A/x/UvukcJeivHESNtCnj rKCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ali2am9izUw7tv2jjZQOU8F3ey0iu1Dm0KbapjOUk0c=; b=LGm8vDly5Rn8IYTFHyf90cVnXoYdIkEygW1yTATZbUV8QRFMCJ3yIJJ5BiGwevJ3Dp lBIkg3Nhhrmhm1b4fyqnvv1EP0rS2r0zpf8HJ9mrpQyL6ef4SD7GnH5G0PRGyEelUGwL 7ffhnPv2hu8H7RWFJf5ZtRimie+pHNIKr+z0Y1l5xNPDtva+a9AaGEFeeGZXGhuxtJx2 aAnjraPxWBdzPPWw49ROJMJYTY8TZojSy4LmR6gfYVs9uG235NC00L1PiyXjjId8n5Jx 47GJeAWOt2XJQDGlbMrr8Ie4Xb+1BD3+sCDVYvhqoCkqwxzcq38vHczzZ70ASdFJnpF7 hF5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ULtxpYMU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pw18-20020a17090b279200b002009ed52bf6si16285082pjb.19.2022.10.19.02.42.44; Wed, 19 Oct 2022 02:42: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=ULtxpYMU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233419AbiJSJ2R (ORCPT + 99 others); Wed, 19 Oct 2022 05:28:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233399AbiJSJ0v (ORCPT ); Wed, 19 Oct 2022 05:26:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D06BE5EEF; Wed, 19 Oct 2022 02:12: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 81F14617DE; Wed, 19 Oct 2022 09:09:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 96C7DC433D7; Wed, 19 Oct 2022 09:09:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170585; bh=+pLaFWlsF+KOAjZAyo/mGe/F2d+gV7atMKM+wOKakCo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ULtxpYMUQqpWgZN1yCm1fmjFImBTTKSairsh4qxnSlEs7p9m/9qhjHvMKDq1axCLf xJ/VntgVV0u+5ce6j3AwCrRv8qmwGHm2CHDQdncfkv8u5TLvewIyuKqMM5NsNqpGHW D844OHitkg7Os3m+6GKgCT+z+eE2JRUX1L2qlaiA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dai Ngo , Chuck Lever , Sasha Levin Subject: [PATCH 6.0 678/862] NFSD: fix use-after-free on source server when doing inter-server copy Date: Wed, 19 Oct 2022 10:32:45 +0200 Message-Id: <20221019083319.933818704@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108576103754937?= X-GMAIL-MSGID: =?utf-8?q?1747108576103754937?= From: Dai Ngo [ Upstream commit 019805fea91599b22dfa62ffb29c022f35abeb06 ] Use-after-free occurred when the laundromat tried to free expired cpntf_state entry on the s2s_cp_stateids list after inter-server copy completed. The sc_cp_list that the expired copy state was inserted on was already freed. When COPY completes, the Linux client normally sends LOCKU(lock_state x), FREE_STATEID(lock_state x) and CLOSE(open_state y) to the source server. The nfs4_put_stid call from nfsd4_free_stateid cleans up the copy state from the s2s_cp_stateids list before freeing the lock state's stid. However, sometimes the CLOSE was sent before the FREE_STATEID request. When this happens, the nfsd4_close_open_stateid call from nfsd4_close frees all lock states on its st_locks list without cleaning up the copy state on the sc_cp_list list. When the time the FREE_STATEID arrives the server returns BAD_STATEID since the lock state was freed. This causes the use-after-free error to occur when the laundromat tries to free the expired cpntf_state. This patch adds a call to nfs4_free_cpntf_statelist in nfsd4_close_open_stateid to clean up the copy state before calling free_ol_stateid_reaplist to free the lock state's stid on the reaplist. Signed-off-by: Dai Ngo Signed-off-by: Chuck Lever Signed-off-by: Sasha Levin --- fs/nfsd/nfs4state.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index c5d199d7e6b4..0bc36472f8b7 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -1049,6 +1049,7 @@ static struct nfs4_ol_stateid * nfs4_alloc_open_stateid(struct nfs4_client *clp) static void nfs4_free_deleg(struct nfs4_stid *stid) { + WARN_ON(!list_empty(&stid->sc_cp_list)); kmem_cache_free(deleg_slab, stid); atomic_long_dec(&num_delegations); } @@ -1462,6 +1463,7 @@ static void nfs4_free_ol_stateid(struct nfs4_stid *stid) release_all_access(stp); if (stp->st_stateowner) nfs4_put_stateowner(stp->st_stateowner); + WARN_ON(!list_empty(&stid->sc_cp_list)); kmem_cache_free(stateid_slab, stid); } @@ -6684,6 +6686,7 @@ static void nfsd4_close_open_stateid(struct nfs4_ol_stateid *s) struct nfs4_client *clp = s->st_stid.sc_client; bool unhashed; LIST_HEAD(reaplist); + struct nfs4_ol_stateid *stp; spin_lock(&clp->cl_lock); unhashed = unhash_open_stateid(s, &reaplist); @@ -6692,6 +6695,8 @@ static void nfsd4_close_open_stateid(struct nfs4_ol_stateid *s) if (unhashed) put_ol_stateid_locked(s, &reaplist); spin_unlock(&clp->cl_lock); + list_for_each_entry(stp, &reaplist, st_locks) + nfs4_free_cpntf_statelist(clp->net, &stp->st_stid); free_ol_stateid_reaplist(&reaplist); } else { spin_unlock(&clp->cl_lock); From patchwork Wed Oct 19 08:32:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4883 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225433wrs; Wed, 19 Oct 2022 02:43:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM41sAr5/pRFUBCDKciK7fa6FV8998+v/PDRAW2YrcvKnkhFmhQJz0Gl8/bJAaUeoANh5KqD X-Received: by 2002:a05:6402:847:b0:45c:c716:4b76 with SMTP id b7-20020a056402084700b0045cc7164b76mr6643625edz.113.1666172579439; Wed, 19 Oct 2022 02:42:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172579; cv=none; d=google.com; s=arc-20160816; b=fi3DfLJIYt9YR2Oulyqm9K8djNZN/Io1lO26PKYvzma1+xmWlxYqyeQHDgn2vuG0Z0 ybxinPnfUQ+gnJHi7Dd+obwsu28pqD354LQ7lGmfvSadF1noJnJvygeWV0JkVa/MeETw QZ5dq+WohV3ZWWBZoR4gvZOcFv2smLEBTTFexgmAyLdn8BQexAZceDfWD1Raa1SCBzSg h0rdjYPcaPIm7Lil0QAb3y8batrT1NbkPpYJWsaWkLe1NGc2fCrSSEwEi7uzBIQVmV5z dMQliP7y1k6qAbKX6As5PcRluPgwBYQYwCZpvQIi/XTYiL4E/LOAKKt3QxVt8Pq08wp7 29VA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Wq0CIqaYruMU16t98Pzv7b4LP8eDxU11VThtbZ3c3aI=; b=NNEJJRxbUqOA09mWegsHwjI6JNV5yxNqHBL1Xp0eHevHKczrc9qfUg98JUtW70eFk0 D7KIIl5aILNOZltsJC5Zm1LxnZ54AkRNSa+pF8JaxoXj3JnccP/PFI+Q9ZGAwBfmAG2e nyi7/ZkLGYUSWhG7EVwAYsHsw7tNvAmStAsIULxQu7VjXCxj476ouuhy+LzJcS2iunqx qXszxzcunLxBxUpCOS47JNDNixVM4hNeDK5TV6ViT3CPK8EMnAnQj8GFKjPIFc8HoKS7 NBJlEJTfu7Hy12IzzCYhIMb4YI4fIrUG3ztJEe0xiPuDtLMBWTpVIjbQsOAXgCEcFKYK FuOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GNF178qw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gb6-20020a170907960600b0078d25914115si16604781ejc.570.2022.10.19.02.42.33; Wed, 19 Oct 2022 02:42: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=GNF178qw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233779AbiJSJcY (ORCPT + 99 others); Wed, 19 Oct 2022 05:32:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233489AbiJSJ2c (ORCPT ); Wed, 19 Oct 2022 05:28:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7AC90E6F47; Wed, 19 Oct 2022 02:12:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2CDCF617E4; Wed, 19 Oct 2022 09:09:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43D54C433D6; Wed, 19 Oct 2022 09:09:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170587; bh=NmkV02RavlMQ+igL7eQ1dCawCYrpnBKKw3h9lmSN8yo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GNF178qwxVM43I0cd7rJVOe3uzHCnPkL3LhqruwY7oETJ9oHBHtYxlTrhAEz6k4XX 9HNM8Tx7SixgJttcBkH96xK/+CuPZSxSWsBs1flod+CwNpiEUDyGRmked1kEe1qr60 CdL1cYydFotd+VvMU85u2W/nDhTfBRTN2jzjSpNc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, James Hilliard , Andrii Nakryiko , Jiri Olsa , Sasha Levin Subject: [PATCH 6.0 679/862] libbpf: Ensure functions with always_inline attribute are inline Date: Wed, 19 Oct 2022 10:32:46 +0200 Message-Id: <20221019083319.983036570@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108578674424309?= X-GMAIL-MSGID: =?utf-8?q?1747108578674424309?= From: James Hilliard [ Upstream commit d25f40ff68aa61c838947bb9adee6c6b36e77453 ] GCC expects the always_inline attribute to only be set on inline functions, as such we should make all functions with this attribute use the __always_inline macro which makes the function inline and sets the attribute. Fixes errors like: /home/buildroot/bpf-next/tools/testing/selftests/bpf/tools/include/bpf/bpf_tracing.h:439:1: error: ‘always_inline’ function might not be inlinable [-Werror=attributes] 439 | ____##name(unsigned long long *ctx, ##args) | ^~~~ Signed-off-by: James Hilliard Signed-off-by: Andrii Nakryiko Acked-by: Jiri Olsa Link: https://lore.kernel.org/bpf/20220803151403.793024-1-james.hilliard1@gmail.com Signed-off-by: Sasha Levin --- tools/lib/bpf/bpf_tracing.h | 14 +++++++------- tools/lib/bpf/usdt.bpf.h | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tools/lib/bpf/bpf_tracing.h b/tools/lib/bpf/bpf_tracing.h index 43ca3aff2292..5fdb93da423b 100644 --- a/tools/lib/bpf/bpf_tracing.h +++ b/tools/lib/bpf/bpf_tracing.h @@ -426,7 +426,7 @@ struct pt_regs; */ #define BPF_PROG(name, args...) \ name(unsigned long long *ctx); \ -static __attribute__((always_inline)) typeof(name(0)) \ +static __always_inline typeof(name(0)) \ ____##name(unsigned long long *ctx, ##args); \ typeof(name(0)) name(unsigned long long *ctx) \ { \ @@ -435,7 +435,7 @@ typeof(name(0)) name(unsigned long long *ctx) \ return ____##name(___bpf_ctx_cast(args)); \ _Pragma("GCC diagnostic pop") \ } \ -static __attribute__((always_inline)) typeof(name(0)) \ +static __always_inline typeof(name(0)) \ ____##name(unsigned long long *ctx, ##args) struct pt_regs; @@ -460,7 +460,7 @@ struct pt_regs; */ #define BPF_KPROBE(name, args...) \ name(struct pt_regs *ctx); \ -static __attribute__((always_inline)) typeof(name(0)) \ +static __always_inline typeof(name(0)) \ ____##name(struct pt_regs *ctx, ##args); \ typeof(name(0)) name(struct pt_regs *ctx) \ { \ @@ -469,7 +469,7 @@ typeof(name(0)) name(struct pt_regs *ctx) \ return ____##name(___bpf_kprobe_args(args)); \ _Pragma("GCC diagnostic pop") \ } \ -static __attribute__((always_inline)) typeof(name(0)) \ +static __always_inline typeof(name(0)) \ ____##name(struct pt_regs *ctx, ##args) #define ___bpf_kretprobe_args0() ctx @@ -484,7 +484,7 @@ ____##name(struct pt_regs *ctx, ##args) */ #define BPF_KRETPROBE(name, args...) \ name(struct pt_regs *ctx); \ -static __attribute__((always_inline)) typeof(name(0)) \ +static __always_inline typeof(name(0)) \ ____##name(struct pt_regs *ctx, ##args); \ typeof(name(0)) name(struct pt_regs *ctx) \ { \ @@ -540,7 +540,7 @@ static __always_inline typeof(name(0)) ____##name(struct pt_regs *ctx, ##args) #define BPF_KSYSCALL(name, args...) \ name(struct pt_regs *ctx); \ extern _Bool LINUX_HAS_SYSCALL_WRAPPER __kconfig; \ -static __attribute__((always_inline)) typeof(name(0)) \ +static __always_inline typeof(name(0)) \ ____##name(struct pt_regs *ctx, ##args); \ typeof(name(0)) name(struct pt_regs *ctx) \ { \ @@ -555,7 +555,7 @@ typeof(name(0)) name(struct pt_regs *ctx) \ return ____##name(___bpf_syscall_args(args)); \ _Pragma("GCC diagnostic pop") \ } \ -static __attribute__((always_inline)) typeof(name(0)) \ +static __always_inline typeof(name(0)) \ ____##name(struct pt_regs *ctx, ##args) #define BPF_KPROBE_SYSCALL BPF_KSYSCALL diff --git a/tools/lib/bpf/usdt.bpf.h b/tools/lib/bpf/usdt.bpf.h index 4f2adc0bd6ca..fdfd235e52c4 100644 --- a/tools/lib/bpf/usdt.bpf.h +++ b/tools/lib/bpf/usdt.bpf.h @@ -232,7 +232,7 @@ long bpf_usdt_cookie(struct pt_regs *ctx) */ #define BPF_USDT(name, args...) \ name(struct pt_regs *ctx); \ -static __attribute__((always_inline)) typeof(name(0)) \ +static __always_inline typeof(name(0)) \ ____##name(struct pt_regs *ctx, ##args); \ typeof(name(0)) name(struct pt_regs *ctx) \ { \ @@ -241,7 +241,7 @@ typeof(name(0)) name(struct pt_regs *ctx) \ return ____##name(___bpf_usdt_args(args)); \ _Pragma("GCC diagnostic pop") \ } \ -static __attribute__((always_inline)) typeof(name(0)) \ +static __always_inline typeof(name(0)) \ ____##name(struct pt_regs *ctx, ##args) #endif /* __USDT_BPF_H__ */ From patchwork Wed Oct 19 08:32: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: 5176 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp263312wrs; Wed, 19 Oct 2022 04:17:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4E+GXmUMxtkfSOZW0DudyTIGZrqDg3W/VJIJaNc3pi0P5HjSjSCy1XvFdnI4SVGkmbil+b X-Received: by 2002:a17:902:6b88:b0:17e:f177:400 with SMTP id p8-20020a1709026b8800b0017ef1770400mr8099559plk.72.1666178268732; Wed, 19 Oct 2022 04:17:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178268; cv=none; d=google.com; s=arc-20160816; b=NWhujjfGv5A/PZGfaXED1eIE1hAFfGyFxKUW1k5Hija0xZ4B4rOzbFPYqZQEqctQ4S F5YJSeaXKEi2L9BxiCDMq4XzYLJwCN7LUWonsTo3/61NJVZ4Lj1cJsuK0gJ85Zn2cM/o j4HGy+czi1rFZhlUNeBRIMs13I3bMwFTmhJ6fBJM0uWQMgWW1UnpvT9XVnApwgtZgqJC iz7suXVTO74UUOzqIPnc/aXwcCnqW+vpgXHiet/Oo4gdOibrP9Iw/Pi9T0jjIjZqK/bi ZZv9Kgc3bu5mFdzkV/fVt6DyFkyczQv7ohoRUmfx1bjvKXG1CgAmeFIeZqFtnebhGZaG O0Rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=A542ofY7gZrMwXmPtbt2afpPGQOb8oRq6zVNIkCWupY=; b=tDXouBKNVRa8S80gTFpgSKkLnDoC86/KA7iCZo1hkYwmVeNL3m8R4KdCbCU5nbMm9R CYo/hMNCb/MpAdhLu67JHQ53WWYJTn2QiFwV1qEItByQLKjsYPMBpYjrQQNkvjpNq07V dUDhB0LcLX8V30Tb7tufnV9x20f7nPCikHKAzB9jSG7L8VPZV3TbI//EL7wpUWqsDsJu UQgiMDNIfpzcjCOvRckKDeDkOIaurTz+PE3SiUGqUvt2RC6YF/PGqZb+ACP8fgyh0l1W twt5v5efdorQ/WBhetBRPDPoQWrTfnX3JO2N9wFENfg4jjYGoHwbQ3gFeLpOQ50Bv1Jk XFvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="U/wul6mN"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f1-20020a637541000000b0045a2b6e23b6si18560809pgn.290.2022.10.19.04.17.04; Wed, 19 Oct 2022 04: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="U/wul6mN"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234799AbiJSLDC (ORCPT + 99 others); Wed, 19 Oct 2022 07:03:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234791AbiJSLCj (ORCPT ); Wed, 19 Oct 2022 07:02: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 9DCD0AE86A; Wed, 19 Oct 2022 03:32:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 81632B824AC; Wed, 19 Oct 2022 09:09:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D94EAC433D7; Wed, 19 Oct 2022 09:09:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170590; bh=ViUItGQxEFe5clm+nOnl0yUEomw7O/ntvn4zFXwEoTs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U/wul6mNsT4M/WLJKotjcoXs18B+ZrXfyZNIODJpDMRxg0Y4wt+YYVh/Gvv6Q7C8F kgAVWYwlGZPjG0lOLFRXZoQTbARXDVYkJ0FEjdSczZKlFz+/Jjkys5M/aqN/0KyUn+ rXnOxkkZNZqvZH/3mCI5FkvbfMYxCLHct4exXcSg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Goro Fuji , Hengqi Chen , Andrii Nakryiko , Sasha Levin Subject: [PATCH 6.0 680/862] libbpf: Do not require executable permission for shared libraries Date: Wed, 19 Oct 2022 10:32:47 +0200 Message-Id: <20221019083320.022071682@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114544486159703?= X-GMAIL-MSGID: =?utf-8?q?1747114544486159703?= From: Hengqi Chen [ Upstream commit 9e32084ef1c33a87a736d6ce3fcb95b60dac9aa1 ] Currently, resolve_full_path() requires executable permission for both programs and shared libraries. This causes failures on distos like Debian since the shared libraries are not installed executable and Linux is not requiring shared libraries to have executable permissions. Let's remove executable permission check for shared libraries. Reported-by: Goro Fuji Signed-off-by: Hengqi Chen Signed-off-by: Andrii Nakryiko Link: https://lore.kernel.org/bpf/20220806102021.3867130-1-hengqi.chen@gmail.com Signed-off-by: Sasha Levin --- tools/lib/bpf/libbpf.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -10667,15 +10667,17 @@ static const char *arch_specific_lib_pat static int resolve_full_path(const char *file, char *result, size_t result_sz) { const char *search_paths[3] = {}; - int i; + int i, perm; if (str_has_sfx(file, ".so") || strstr(file, ".so.")) { search_paths[0] = getenv("LD_LIBRARY_PATH"); search_paths[1] = "/usr/lib64:/usr/lib"; search_paths[2] = arch_specific_lib_paths(); + perm = R_OK; } else { search_paths[0] = getenv("PATH"); search_paths[1] = "/usr/bin:/usr/sbin"; + perm = R_OK | X_OK; } for (i = 0; i < ARRAY_SIZE(search_paths); i++) { @@ -10694,8 +10696,8 @@ static int resolve_full_path(const char if (!seg_len) continue; snprintf(result, result_sz, "%.*s/%s", seg_len, s, file); - /* ensure it is an executable file/link */ - if (access(result, R_OK | X_OK) < 0) + /* ensure it has required permissions */ + if (access(result, perm) < 0) continue; pr_debug("resolved '%s' to '%s'\n", file, result); return 0; From patchwork Wed Oct 19 08:32: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: 5167 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp253927wrs; Wed, 19 Oct 2022 03:58:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM52EgWnIHMjktgEpnCIT9C5PbccbhqltDi1DUVbIOwBYMgjI/pR3woOPGOW6lohSgj+9odt X-Received: by 2002:a17:902:968f:b0:180:a7ff:78ba with SMTP id n15-20020a170902968f00b00180a7ff78bamr8022484plp.87.1666177125540; Wed, 19 Oct 2022 03:58:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666177125; cv=none; d=google.com; s=arc-20160816; b=bBzzUkNkUP5RzanUC8/U8NaE7PPxxFCeZsU7ES+RZtmyT39QO3dUT0pHxSdpWou8PI /FgZigKPCFPJmb3c/8YMNX3gCt3Fj0VJzPTpIUSaBo4dtH9omPXNCVP6amwPnPeOC2zv jai2MrLHS2PDDzhLIhGfd5f2DWG8Wt74zRlv/2NvELF42OvJ11VDln6IrOfX6bObBYdi iYoSyqx/leY2YLD6Zot9q0rU55ABkYTWVNWPj2E432ZTU4hSIEN6nancidIBHCfXRBGP H8PPYwuDxNLVar36mHw4pbU/cfyPHIdwZLITqKJ3TlYNsaUb4s9nfk9IOF80/McI3H2M v/Lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=CTeRUvJWkfXGble7UiMc6/n6FoijzHVjA4Q+mFTyZ/0=; b=OwE9rA/mmJA0vRTId1rlU52XbjET7AHlw5r2x8GHTt1Y+dBsJJFakSNvoTM53rQGoy xXhZpaFLdeuSaWmS274wlRPUB7+RkXgAgIhJrn2NrLh21YvSrDx84F3di9Gjt7lQ1SDj NAyR1f/9hI/01wiMNW5P2YOkxn2/1jHKCUCATeyEB7j/dwvRL10jXCPyf8wZ0oRMsckD rte3ojN/85vmVDZvZCm6o4nEBbVY4gleaANENSrZJbvpy6avgSvYr7/LCldMuZjlpBLM 9sjk7FAAu0L1NDUm5Y1iSsjerYiYPDJtjRbRA+FjsSkXE8ELWERPQ73wcI0a4iTPRFRe U2wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IDTwW+07; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g7-20020a056a000b8700b00565ba4c501asi20494821pfj.276.2022.10.19.03.58.31; Wed, 19 Oct 2022 03:58: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=IDTwW+07; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234702AbiJSK5h (ORCPT + 99 others); Wed, 19 Oct 2022 06:57:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234711AbiJSK4a (ORCPT ); Wed, 19 Oct 2022 06:56:30 -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 E8A47D2CD5; Wed, 19 Oct 2022 03:27:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DF064B824A8; Wed, 19 Oct 2022 09:08:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5B83CC433D6; Wed, 19 Oct 2022 09:08:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170504; bh=xtM5s+f3529j7nQlyo4YPIfMABIDOHknGrVRtsueMpY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IDTwW+07U3G+7kEbANJmwQ5E8u1Bg6O5yL5UpcH1ZMjS3VjdVMivFdP4Y4lOsAAXr 1b8QQm6WM9//uOpXhWjI52uyJN1vv4Wc4KhV5o10bLHP8oOkLfNzjtzdHRM2aVd/G3 yf5qUo/Idnkp6F+ZkvM3EM+QoKTFZY00gznAjWHI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zong-Zhe Yang , Ping-Ke Shih , Kalle Valo , Sasha Levin Subject: [PATCH 6.0 681/862] wifi: rtw88: phy: fix warning of possible buffer overflow Date: Wed, 19 Oct 2022 10:32:48 +0200 Message-Id: <20221019083320.063888989@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747113345854839557?= X-GMAIL-MSGID: =?utf-8?q?1747113345854839557?= From: Zong-Zhe Yang [ Upstream commit 86331c7e0cd819bf0c1d0dcf895e0c90b0aa9a6f ] reported by smatch phy.c:854 rtw_phy_linear_2_db() error: buffer overflow 'db_invert_table[i]' 8 <= 8 (assuming for loop doesn't break) However, it seems to be a false alarm because we prevent it originally via if (linear >= db_invert_table[11][7]) return 96; /* maximum 96 dB */ Still, we adjust the code to be more readable and avoid smatch warning. Signed-off-by: Zong-Zhe Yang Signed-off-by: Ping-Ke Shih Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220727065003.28340-5-pkshih@realtek.com Signed-off-by: Sasha Levin --- drivers/net/wireless/realtek/rtw88/phy.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw88/phy.c b/drivers/net/wireless/realtek/rtw88/phy.c index 8982e0c98dac..da1efec0aa85 100644 --- a/drivers/net/wireless/realtek/rtw88/phy.c +++ b/drivers/net/wireless/realtek/rtw88/phy.c @@ -816,23 +816,18 @@ static u8 rtw_phy_linear_2_db(u64 linear) u8 j; u32 dB; - if (linear >= db_invert_table[11][7]) - return 96; /* maximum 96 dB */ - for (i = 0; i < 12; i++) { - if (i <= 2 && (linear << FRAC_BITS) <= db_invert_table[i][7]) - break; - else if (i > 2 && linear <= db_invert_table[i][7]) - break; + for (j = 0; j < 8; j++) { + if (i <= 2 && (linear << FRAC_BITS) <= db_invert_table[i][j]) + goto cnt; + else if (i > 2 && linear <= db_invert_table[i][j]) + goto cnt; + } } - for (j = 0; j < 8; j++) { - if (i <= 2 && (linear << FRAC_BITS) <= db_invert_table[i][j]) - break; - else if (i > 2 && linear <= db_invert_table[i][j]) - break; - } + return 96; /* maximum 96 dB */ +cnt: if (j == 0 && i == 0) goto end; From patchwork Wed Oct 19 08:32:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5009 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp244375wrs; Wed, 19 Oct 2022 03:32:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6vy34mF37K3gx0r+yMLr3EQ6eHf6YuLDBbwuI2+iILlhzpqxU/KOnhJvqxQqEEdTnAC+kg X-Received: by 2002:a17:907:97d4:b0:78e:1b8f:5767 with SMTP id js20-20020a17090797d400b0078e1b8f5767mr6177119ejc.473.1666175572319; Wed, 19 Oct 2022 03:32:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666175572; cv=none; d=google.com; s=arc-20160816; b=x7eMOIdMh6g6fYL/dzdhcprwcznGWmq1ojtTy1abcBhDeYX0PmheSzfoF7gq/7P1UA 7hgRxs96RY2bffMv8np784fQXY2QA2vuKUSCX0RvVCFlXs4l+h6WZA8BO/c/EMROf94J v92DvxDlI/RaKPlfd6G4qpcCJjNK4UGqLlUHq4WwqGLI2nloZaDF3SYv1j2aUWPNd7FW abEac3PG+94c8EdjCOviZ/X6jvIRl0+60SAQpW9lyGxDLZjZQtwdrWfPeVb81Bi6IG8w BukTXQOr5DEjd8f4Y4h1pJcHNu7syn6lB0O8bnhZ2sCmEsHFtHcn8MEdlDDZZhXksIEH CSXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3FDYm5qWRAQ5l345ryfobEqKAwddUGp/eoaICeD9bzg=; b=wgkyWKamNYJw9uvA3EZBfIMqgKu7bXxPUWhznrQ+X2OM6rfOwj7b6iFdJGS+Pzz7Og JkHh4qvCAyniuugEL4YW8baWENenYEXsIakvI0UMk1ipxnfn1X3Qv4RVAdSQUtbUy3zi khQKYSfprNp/wBvQUd55kOFb9f8SIikOkZE2rD/EozJtoD6++4I0+KKQoZNkH/f387NX SRSYgVgVw1X85RX6pDqkbnYtBc9DBGUpo9mn4cVsMpYGh5aYWhLzcub6OTvCzE42i4ia FaC8Li78YNOCs3EWWahwnWKD5W6P0DvR5b1L7j8crANv+PtnkekWFCkLqeDIbdXu8C0o 6cYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="G+Rs1p/u"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fj3-20020a1709069c8300b0078d0a31f987si15549622ejc.755.2022.10.19.03.32.26; Wed, 19 Oct 2022 03:32: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="G+Rs1p/u"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229718AbiJSKIe (ORCPT + 99 others); Wed, 19 Oct 2022 06:08:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231200AbiJSKIL (ORCPT ); Wed, 19 Oct 2022 06:08:11 -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 5203A147042; Wed, 19 Oct 2022 02:46: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 sin.source.kernel.org (Postfix) with ESMTPS id 11A87CE2190; Wed, 19 Oct 2022 09:08:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E5EBC433D6; Wed, 19 Oct 2022 09:08:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170507; bh=bPQpXuTiwSD2XHaeEE3f7S0MAGju3li9gNzgfMUaygQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G+Rs1p/uWynsj1YKpLV2CPzLXefnbBO+0SWcPRSOa8mGvlv48wo9u0BmVIR0vkTwF 5cAj93aDB4eLbpWpc1EBIepd43hjgVGDIj0Et0adhOAxjJXRJ82wlfAONzjZuVHqdj NSlHtZ3akwxJcBOXYQjKqcurWIYS8JCBeUHKz/Uo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wright Feng , Chi-hsien Lin , Ahmad Fatoum , =?utf-8?q?Alvin_=C5=A0ipraga?= , Kalle Valo , Sasha Levin Subject: [PATCH 6.0 682/862] wifi: brcmfmac: fix invalid address access when enabling SCAN log level Date: Wed, 19 Oct 2022 10:32:49 +0200 Message-Id: <20221019083320.112516924@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747111716690978649?= X-GMAIL-MSGID: =?utf-8?q?1747111716690978649?= From: Wright Feng [ Upstream commit aa666b68e73fc06d83c070d96180b9010cf5a960 ] The variable i is changed when setting random MAC address and causes invalid address access when printing the value of pi->reqs[i]->reqid. We replace reqs index with ri to fix the issue. [ 136.726473] Unable to handle kernel access to user memory outside uaccess routines at virtual address 0000000000000000 [ 136.737365] Mem abort info: [ 136.740172] ESR = 0x96000004 [ 136.743359] Exception class = DABT (current EL), IL = 32 bits [ 136.749294] SET = 0, FnV = 0 [ 136.752481] EA = 0, S1PTW = 0 [ 136.755635] Data abort info: [ 136.758514] ISV = 0, ISS = 0x00000004 [ 136.762487] CM = 0, WnR = 0 [ 136.765522] user pgtable: 4k pages, 48-bit VAs, pgdp = 000000005c4e2577 [ 136.772265] [0000000000000000] pgd=0000000000000000 [ 136.777160] Internal error: Oops: 96000004 [#1] PREEMPT SMP [ 136.782732] Modules linked in: brcmfmac(O) brcmutil(O) cfg80211(O) compat(O) [ 136.789788] Process wificond (pid: 3175, stack limit = 0x00000000053048fb) [ 136.796664] CPU: 3 PID: 3175 Comm: wificond Tainted: G O 4.19.42-00001-g531a5f5 #1 [ 136.805532] Hardware name: Freescale i.MX8MQ EVK (DT) [ 136.810584] pstate: 60400005 (nZCv daif +PAN -UAO) [ 136.815429] pc : brcmf_pno_config_sched_scans+0x6cc/0xa80 [brcmfmac] [ 136.821811] lr : brcmf_pno_config_sched_scans+0x67c/0xa80 [brcmfmac] [ 136.828162] sp : ffff00000e9a3880 [ 136.831475] x29: ffff00000e9a3890 x28: ffff800020543400 [ 136.836786] x27: ffff8000b1008880 x26: ffff0000012bf6a0 [ 136.842098] x25: ffff80002054345c x24: ffff800088d22400 [ 136.847409] x23: ffff0000012bf638 x22: ffff0000012bf6d8 [ 136.852721] x21: ffff8000aced8fc0 x20: ffff8000ac164400 [ 136.858032] x19: ffff00000e9a3946 x18: 0000000000000000 [ 136.863343] x17: 0000000000000000 x16: 0000000000000000 [ 136.868655] x15: ffff0000093f3b37 x14: 0000000000000050 [ 136.873966] x13: 0000000000003135 x12: 0000000000000000 [ 136.879277] x11: 0000000000000000 x10: ffff000009a61888 [ 136.884589] x9 : 000000000000000f x8 : 0000000000000008 [ 136.889900] x7 : 303a32303d726464 x6 : ffff00000a1f957d [ 136.895211] x5 : 0000000000000000 x4 : ffff00000e9a3942 [ 136.900523] x3 : 0000000000000000 x2 : ffff0000012cead8 [ 136.905834] x1 : ffff0000012bf6d8 x0 : 0000000000000000 [ 136.911146] Call trace: [ 136.913623] brcmf_pno_config_sched_scans+0x6cc/0xa80 [brcmfmac] [ 136.919658] brcmf_pno_start_sched_scan+0xa4/0x118 [brcmfmac] [ 136.925430] brcmf_cfg80211_sched_scan_start+0x80/0xe0 [brcmfmac] [ 136.931636] nl80211_start_sched_scan+0x140/0x308 [cfg80211] [ 136.937298] genl_rcv_msg+0x358/0x3f4 [ 136.940960] netlink_rcv_skb+0xb4/0x118 [ 136.944795] genl_rcv+0x34/0x48 [ 136.947935] netlink_unicast+0x264/0x300 [ 136.951856] netlink_sendmsg+0x2e4/0x33c [ 136.955781] __sys_sendto+0x120/0x19c Signed-off-by: Wright Feng Signed-off-by: Chi-hsien Lin Signed-off-by: Ahmad Fatoum Signed-off-by: Alvin Šipraga Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220722115632.620681-4-alvin@pqrs.dk Signed-off-by: Sasha Levin --- .../net/wireless/broadcom/brcm80211/brcmfmac/pno.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c index fabfbb0b40b0..d0a7465be586 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c @@ -158,12 +158,12 @@ static int brcmf_pno_set_random(struct brcmf_if *ifp, struct brcmf_pno_info *pi) struct brcmf_pno_macaddr_le pfn_mac; u8 *mac_addr = NULL; u8 *mac_mask = NULL; - int err, i; + int err, i, ri; - for (i = 0; i < pi->n_reqs; i++) - if (pi->reqs[i]->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) { - mac_addr = pi->reqs[i]->mac_addr; - mac_mask = pi->reqs[i]->mac_addr_mask; + for (ri = 0; ri < pi->n_reqs; ri++) + if (pi->reqs[ri]->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) { + mac_addr = pi->reqs[ri]->mac_addr; + mac_mask = pi->reqs[ri]->mac_addr_mask; break; } @@ -185,7 +185,7 @@ static int brcmf_pno_set_random(struct brcmf_if *ifp, struct brcmf_pno_info *pi) pfn_mac.mac[0] |= 0x02; brcmf_dbg(SCAN, "enabling random mac: reqid=%llu mac=%pM\n", - pi->reqs[i]->reqid, pfn_mac.mac); + pi->reqs[ri]->reqid, pfn_mac.mac); err = brcmf_fil_iovar_data_set(ifp, "pfn_macaddr", &pfn_mac, sizeof(pfn_mac)); if (err) From patchwork Wed Oct 19 08:32: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: 5150 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp253406wrs; Wed, 19 Oct 2022 03:57:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM41fwIAnBnsotzJzvKDx49BUa95MWZQwISr4XM4K3t3wupqAIzRS6uPPmxyjoraa5wKJW4K X-Received: by 2002:a05:6402:254d:b0:45d:3ed3:8aa9 with SMTP id l13-20020a056402254d00b0045d3ed38aa9mr6693151edb.157.1666177028866; Wed, 19 Oct 2022 03:57:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666177028; cv=none; d=google.com; s=arc-20160816; b=qwd6i9S45UQktzOQHPplluWHrIcC2uVWawnyZPvXraV/M/gipN5IZsY3B9+eIRPoKD SwFvpsZsqnrMg48xvXFnBf9iJ33NR3M4eXWzV7fJyBUGDC83fxPPRcUv8Ma4GjiVJRFz S7LNRluyUGVkRuL/NSJwm6q9nMqBsmNtocEnGVQ1WK1DcOGQ1Y3oczcOSwDaXfXs3u90 D5A6dWzEyCasSvfcWtodZmYrwSip8bXmIw45mE6LSx2PAVndEIKEPQCla97+le3PHsgU roZ7bQCRw3wtBDAJMe2V42JLxuI/qMGhE1Q+JLNrQGixYUoXpEFxypJ9VMZQJGQuwdy4 YDfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bS7GMCwTOsRT8Iyvlthz16Lg0wMkLiPypLN2pT9/fqk=; b=DG3zJfKlBlANILh/Y58E6hGpJ7QwC7NbKgW9jUY1gBXK/5oCCZeggjeJ6NqFrohY26 xKAK3p+rwq/APiRm1/cOszVrt0Oswn3ZW1GG+hNgnupNL/H4J88eyO+t9im7qUiXcq80 RT9n1/mFd0+9t8KVMLSjjB7EdlyIoOtbNstrljEDHKJC4cXfrtdZPVmlNT6o6VIn2P76 MV1DHIzWKkPYrAJgMxKhQYRyMm5Yr7K0LcpwNdy9BCi3cGMzAj4eBFwWXCQcgTgx8dkK MpOHODIeCGq4l2JYtTgDaQVV/syYX+gSXlSqCSoMrKtGrtOhR9cH0CX0PBI0vAnhgEgi pYyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="UBsqIuz/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o10-20020a50fd8a000000b00458896ae248si11268687edt.474.2022.10.19.03.56.44; Wed, 19 Oct 2022 03: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="UBsqIuz/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234695AbiJSK4P (ORCPT + 99 others); Wed, 19 Oct 2022 06:56:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235179AbiJSKzX (ORCPT ); Wed, 19 Oct 2022 06: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 A16EAA484F; Wed, 19 Oct 2022 03:27: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 53C7CB824A9; Wed, 19 Oct 2022 09:08:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B56FFC433D7; Wed, 19 Oct 2022 09:08:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170510; bh=x0O9W2XoIIMXYnl74aXnnkx0BzJcyvrdEjk6w1tkkfU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UBsqIuz/S+dGbp4ftv400cXJWGnasiSE/L07hqYH0g75AivSoDVFkFK2pV8C38vXN c2PmswNTaajqcMhHCXranir98jFSqi06PhNRGZwbXgrKLlNH3k7/Mg1/d7hD8xfX6D QH883SClFr61EW4e7UcT4wvLqRiDI2xRRxR3wGbA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Quentin Monnet , Daniel Borkmann , Sasha Levin Subject: [PATCH 6.0 683/862] bpftool: Clear errno after libcaps checks Date: Wed, 19 Oct 2022 10:32:50 +0200 Message-Id: <20221019083320.160230685@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747113244313669656?= X-GMAIL-MSGID: =?utf-8?q?1747113244313669656?= From: Quentin Monnet [ Upstream commit cea558855c39b7f1f02ff50dcf701ca6596bc964 ] When bpftool is linked against libcap, the library runs a "constructor" function to compute the number of capabilities of the running kernel [0], at the beginning of the execution of the program. As part of this, it performs multiple calls to prctl(). Some of these may fail, and set errno to a non-zero value: # strace -e prctl ./bpftool version prctl(PR_CAPBSET_READ, CAP_MAC_OVERRIDE) = 1 prctl(PR_CAPBSET_READ, 0x30 /* CAP_??? */) = -1 EINVAL (Invalid argument) prctl(PR_CAPBSET_READ, CAP_CHECKPOINT_RESTORE) = 1 prctl(PR_CAPBSET_READ, 0x2c /* CAP_??? */) = -1 EINVAL (Invalid argument) prctl(PR_CAPBSET_READ, 0x2a /* CAP_??? */) = -1 EINVAL (Invalid argument) prctl(PR_CAPBSET_READ, 0x29 /* CAP_??? */) = -1 EINVAL (Invalid argument) ** fprintf added at the top of main(): we have errno == 1 ./bpftool v7.0.0 using libbpf v1.0 features: libbfd, libbpf_strict, skeletons +++ exited with 0 +++ This has been addressed in libcap 2.63 [1], but until this version is available everywhere, we can fix it on bpftool side. Let's clean errno at the beginning of the main() function, to make sure that these checks do not interfere with the batch mode, where we error out if errno is set after a bpftool command. [0] https://git.kernel.org/pub/scm/libs/libcap/libcap.git/tree/libcap/cap_alloc.c?h=libcap-2.65#n20 [1] https://git.kernel.org/pub/scm/libs/libcap/libcap.git/commit/?id=f25a1b7e69f7b33e6afb58b3e38f3450b7d2d9a0 Signed-off-by: Quentin Monnet Signed-off-by: Daniel Borkmann Link: https://lore.kernel.org/bpf/20220815162205.45043-1-quentin@isovalent.com Signed-off-by: Sasha Levin --- tools/bpf/bpftool/main.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/bpf/bpftool/main.c b/tools/bpf/bpftool/main.c index 451cefc2d0da..ccd7457f92bf 100644 --- a/tools/bpf/bpftool/main.c +++ b/tools/bpf/bpftool/main.c @@ -435,6 +435,16 @@ int main(int argc, char **argv) setlinebuf(stdout); +#ifdef USE_LIBCAP + /* Libcap < 2.63 hooks before main() to compute the number of + * capabilities of the running kernel, and doing so it calls prctl() + * which may fail and set errno to non-zero. + * Let's reset errno to make sure this does not interfere with the + * batch mode. + */ + errno = 0; +#endif + last_do_help = do_help; pretty_output = false; json_output = false; From patchwork Wed Oct 19 08:32: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: 5175 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp259022wrs; Wed, 19 Oct 2022 04:08:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4tC2fWxy4cNNVvXGJYsZUTCAqZgkJ8teWxz2xmbrhaKMFt9Q2cpnzj6W+4WaoGiozx1Ma2 X-Received: by 2002:a17:906:9b93:b0:78d:eb36:1ce7 with SMTP id dd19-20020a1709069b9300b0078deb361ce7mr6283799ejc.621.1666177732066; Wed, 19 Oct 2022 04:08:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666177732; cv=none; d=google.com; s=arc-20160816; b=ykAhWq6fRI2qSnFaTFB0DvZCBiiyrp0vIDBn5fhnFkz1gVHOWaPlBI7aYVIJ7IJWxL 3f3iosf7xlBRI3mzYimuXzj/UECn2h9AKT6gEc1G1/tqZvr7jlqRhmuc6KY4Bi5BKAl8 +kii7bOTZzPMseH8VIKCVvPz5A8uPBsGBqDpbs338kO+roMgxeXKrkXyS0+ryQeuFo4y cJRMHXNtqPMfCtbGyE2uzVpUmg+7/Woc0/C+BB7xEwckqtnJG86swyH9TXLPI6EevCvL +cCQR6/nwHueOrWxcOQLlWit7ttlQR85gIhdBSsPB0A7q4i8aQ5eanmaFTzIs/9gZlFV 1LjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TeD+YD02Jhho6Ns51bPfr5Lcm+93eTOD5sXLOo/WmTI=; b=S7zqLiNhXOhkK6MjZPvFXjzEJ0nBZ0Io699MM6zVX4N60S6lLzqQf+t9sO2YgF7fXs q+L4UGyX5wMHTLuj2Jgm9B4riSWbkjCImwkZlgW2c2YoUdW7awA9Ve0zzdGfUdQnK6qp QrAfb5fcwmgOZzPOQo1ohWEMT79mssdxHpSSZCtW5c2XC+95QC6ccKZbZGSMjHx/Rd3U 04t414528kw3nJbe/loPMFvTvWy/43k6CO1KkFXCSINV+7r6pxkXtCMl5PTpt5c5HMo1 JogsG+3LOy84/fKnKx/ymfz5elDckTAobCdY9dG4M3uv/7hemrDR8r9Fq7iQn08whTBp w1rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lhwaVZlY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a05640250cd00b00458ac23f0b8si16427490edb.399.2022.10.19.04.08.18; Wed, 19 Oct 2022 04:08: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=lhwaVZlY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234755AbiJSLAP (ORCPT + 99 others); Wed, 19 Oct 2022 07:00:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234814AbiJSK66 (ORCPT ); Wed, 19 Oct 2022 06:58:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5643B120EDD; Wed, 19 Oct 2022 03:28: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 C92A8B824A7; Wed, 19 Oct 2022 09:08:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49961C433D7; Wed, 19 Oct 2022 09:08:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170512; bh=vT7Q6sU90rduuqxqS5trs7s3dVF0Knuk5sg5ohmKtRw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lhwaVZlYVc1n82Ji30bmF/DJvRRC1EX1BEtfpbQjZR6ed3h+V9lE4uZ02DnUy15nL I8ZLAh5IeLrO0xmZqDeY1ZgFr1dDzvUSjijKhzfr1jRtaqbWjDrxwNkZZ3pox/KazA PD2Oqbo83LHsyU0k2ziM4HCjkvbuMPplbvbXeNlo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ravi Gunasekaran , kernel test robot , Andrew Lunn , "David S. Miller" , Sasha Levin Subject: [PATCH 6.0 684/862] net: ethernet: ti: davinci_mdio: Add workaround for errata i2329 Date: Wed, 19 Oct 2022 10:32:51 +0200 Message-Id: <20221019083320.199624517@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747113981097356550?= X-GMAIL-MSGID: =?utf-8?q?1747113981097356550?= From: Ravi Gunasekaran [ Upstream commit d04807b80691c6041ca8e3dcf1870d1bf1082c22 ] On the CPSW and ICSS peripherals, there is a possibility that the MDIO interface returns corrupt data on MDIO reads or writes incorrect data on MDIO writes. There is also a possibility for the MDIO interface to become unavailable until the next peripheral reset. The workaround is to configure the MDIO in manual mode and disable the MDIO state machine and emulate the MDIO protocol by reading and writing appropriate fields in MDIO_MANUAL_IF_REG register of the MDIO controller to manipulate the MDIO clock and data pins. More details about the errata i2329 and the workaround is available in: https://www.ti.com/lit/er/sprz487a/sprz487a.pdf Add implementation to disable MDIO state machine, configure MDIO in manual mode and achieve MDIO read and writes via MDIO Bitbanging Signed-off-by: Ravi Gunasekaran Reported-by: kernel test robot Reviewed-by: Andrew Lunn Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/ti/davinci_mdio.c | 242 +++++++++++++++++++++++-- 1 file changed, 231 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/ti/davinci_mdio.c b/drivers/net/ethernet/ti/davinci_mdio.c index ea3772618043..946b9753ccfb 100644 --- a/drivers/net/ethernet/ti/davinci_mdio.c +++ b/drivers/net/ethernet/ti/davinci_mdio.c @@ -26,6 +26,8 @@ #include #include #include +#include +#include /* * This timeout definition is a worst-case ultra defensive measure against @@ -41,6 +43,7 @@ struct davinci_mdio_of_param { int autosuspend_delay_ms; + bool manual_mode; }; struct davinci_mdio_regs { @@ -49,6 +52,15 @@ struct davinci_mdio_regs { #define CONTROL_IDLE BIT(31) #define CONTROL_ENABLE BIT(30) #define CONTROL_MAX_DIV (0xffff) +#define CONTROL_CLKDIV GENMASK(15, 0) + +#define MDIO_MAN_MDCLK_O BIT(2) +#define MDIO_MAN_OE BIT(1) +#define MDIO_MAN_PIN BIT(0) +#define MDIO_MANUALMODE BIT(31) + +#define MDIO_PIN 0 + u32 alive; u32 link; @@ -59,7 +71,9 @@ struct davinci_mdio_regs { u32 userintmasked; u32 userintmaskset; u32 userintmaskclr; - u32 __reserved_1[20]; + u32 manualif; + u32 poll; + u32 __reserved_1[18]; struct { u32 access; @@ -79,6 +93,7 @@ static const struct mdio_platform_data default_pdata = { struct davinci_mdio_data { struct mdio_platform_data pdata; + struct mdiobb_ctrl bb_ctrl; struct davinci_mdio_regs __iomem *regs; struct clk *clk; struct device *dev; @@ -90,6 +105,7 @@ struct davinci_mdio_data { */ bool skip_scan; u32 clk_div; + bool manual_mode; }; static void davinci_mdio_init_clk(struct davinci_mdio_data *data) @@ -128,9 +144,122 @@ static void davinci_mdio_enable(struct davinci_mdio_data *data) writel(data->clk_div | CONTROL_ENABLE, &data->regs->control); } -static int davinci_mdio_reset(struct mii_bus *bus) +static void davinci_mdio_disable(struct davinci_mdio_data *data) +{ + u32 reg; + + /* Disable MDIO state machine */ + reg = readl(&data->regs->control); + + reg &= ~CONTROL_CLKDIV; + reg |= data->clk_div; + + reg &= ~CONTROL_ENABLE; + writel(reg, &data->regs->control); +} + +static void davinci_mdio_enable_manual_mode(struct davinci_mdio_data *data) +{ + u32 reg; + /* set manual mode */ + reg = readl(&data->regs->poll); + reg |= MDIO_MANUALMODE; + writel(reg, &data->regs->poll); +} + +static void davinci_set_mdc(struct mdiobb_ctrl *ctrl, int level) +{ + struct davinci_mdio_data *data; + u32 reg; + + data = container_of(ctrl, struct davinci_mdio_data, bb_ctrl); + reg = readl(&data->regs->manualif); + + if (level) + reg |= MDIO_MAN_MDCLK_O; + else + reg &= ~MDIO_MAN_MDCLK_O; + + writel(reg, &data->regs->manualif); +} + +static void davinci_set_mdio_dir(struct mdiobb_ctrl *ctrl, int output) +{ + struct davinci_mdio_data *data; + u32 reg; + + data = container_of(ctrl, struct davinci_mdio_data, bb_ctrl); + reg = readl(&data->regs->manualif); + + if (output) + reg |= MDIO_MAN_OE; + else + reg &= ~MDIO_MAN_OE; + + writel(reg, &data->regs->manualif); +} + +static void davinci_set_mdio_data(struct mdiobb_ctrl *ctrl, int value) +{ + struct davinci_mdio_data *data; + u32 reg; + + data = container_of(ctrl, struct davinci_mdio_data, bb_ctrl); + reg = readl(&data->regs->manualif); + + if (value) + reg |= MDIO_MAN_PIN; + else + reg &= ~MDIO_MAN_PIN; + + writel(reg, &data->regs->manualif); +} + +static int davinci_get_mdio_data(struct mdiobb_ctrl *ctrl) +{ + struct davinci_mdio_data *data; + unsigned long reg; + + data = container_of(ctrl, struct davinci_mdio_data, bb_ctrl); + reg = readl(&data->regs->manualif); + return test_bit(MDIO_PIN, ®); +} + +static int davinci_mdiobb_read(struct mii_bus *bus, int phy, int reg) +{ + int ret; + + ret = pm_runtime_resume_and_get(bus->parent); + if (ret < 0) + return ret; + + ret = mdiobb_read(bus, phy, reg); + + pm_runtime_mark_last_busy(bus->parent); + pm_runtime_put_autosuspend(bus->parent); + + return ret; +} + +static int davinci_mdiobb_write(struct mii_bus *bus, int phy, int reg, + u16 val) +{ + int ret; + + ret = pm_runtime_resume_and_get(bus->parent); + if (ret < 0) + return ret; + + ret = mdiobb_write(bus, phy, reg, val); + + pm_runtime_mark_last_busy(bus->parent); + pm_runtime_put_autosuspend(bus->parent); + + return ret; +} + +static int davinci_mdio_common_reset(struct davinci_mdio_data *data) { - struct davinci_mdio_data *data = bus->priv; u32 phy_mask, ver; int ret; @@ -138,6 +267,11 @@ static int davinci_mdio_reset(struct mii_bus *bus) if (ret < 0) return ret; + if (data->manual_mode) { + davinci_mdio_disable(data); + davinci_mdio_enable_manual_mode(data); + } + /* wait for scan logic to settle */ msleep(PHY_MAX_ADDR * data->access_time); @@ -171,6 +305,23 @@ static int davinci_mdio_reset(struct mii_bus *bus) return 0; } +static int davinci_mdio_reset(struct mii_bus *bus) +{ + struct davinci_mdio_data *data = bus->priv; + + return davinci_mdio_common_reset(data); +} + +static int davinci_mdiobb_reset(struct mii_bus *bus) +{ + struct mdiobb_ctrl *ctrl = bus->priv; + struct davinci_mdio_data *data; + + data = container_of(ctrl, struct davinci_mdio_data, bb_ctrl); + + return davinci_mdio_common_reset(data); +} + /* wait until hardware is ready for another user access */ static inline int wait_for_user_access(struct davinci_mdio_data *data) { @@ -318,6 +469,28 @@ static int davinci_mdio_probe_dt(struct mdio_platform_data *data, return 0; } +struct k3_mdio_soc_data { + bool manual_mode; +}; + +static const struct k3_mdio_soc_data am65_mdio_soc_data = { + .manual_mode = true, +}; + +static const struct soc_device_attribute k3_mdio_socinfo[] = { + { .family = "AM62X", .revision = "SR1.0", .data = &am65_mdio_soc_data }, + { .family = "AM64X", .revision = "SR1.0", .data = &am65_mdio_soc_data }, + { .family = "AM64X", .revision = "SR2.0", .data = &am65_mdio_soc_data }, + { .family = "AM65X", .revision = "SR1.0", .data = &am65_mdio_soc_data }, + { .family = "AM65X", .revision = "SR2.0", .data = &am65_mdio_soc_data }, + { .family = "J7200", .revision = "SR1.0", .data = &am65_mdio_soc_data }, + { .family = "J7200", .revision = "SR2.0", .data = &am65_mdio_soc_data }, + { .family = "J721E", .revision = "SR1.0", .data = &am65_mdio_soc_data }, + { .family = "J721E", .revision = "SR2.0", .data = &am65_mdio_soc_data }, + { .family = "J721S2", .revision = "SR1.0", .data = &am65_mdio_soc_data}, + { /* sentinel */ }, +}; + #if IS_ENABLED(CONFIG_OF) static const struct davinci_mdio_of_param of_cpsw_mdio_data = { .autosuspend_delay_ms = 100, @@ -331,6 +504,14 @@ static const struct of_device_id davinci_mdio_of_mtable[] = { MODULE_DEVICE_TABLE(of, davinci_mdio_of_mtable); #endif +static const struct mdiobb_ops davinci_mdiobb_ops = { + .owner = THIS_MODULE, + .set_mdc = davinci_set_mdc, + .set_mdio_dir = davinci_set_mdio_dir, + .set_mdio_data = davinci_set_mdio_data, + .get_mdio_data = davinci_get_mdio_data, +}; + static int davinci_mdio_probe(struct platform_device *pdev) { struct mdio_platform_data *pdata = dev_get_platdata(&pdev->dev); @@ -345,7 +526,26 @@ static int davinci_mdio_probe(struct platform_device *pdev) if (!data) return -ENOMEM; - data->bus = devm_mdiobus_alloc(dev); + data->manual_mode = false; + data->bb_ctrl.ops = &davinci_mdiobb_ops; + + if (IS_ENABLED(CONFIG_OF) && dev->of_node) { + const struct soc_device_attribute *soc_match_data; + + soc_match_data = soc_device_match(k3_mdio_socinfo); + if (soc_match_data && soc_match_data->data) { + const struct k3_mdio_soc_data *socdata = + soc_match_data->data; + + data->manual_mode = socdata->manual_mode; + } + } + + if (data->manual_mode) + data->bus = alloc_mdio_bitbang(&data->bb_ctrl); + else + data->bus = devm_mdiobus_alloc(dev); + if (!data->bus) { dev_err(dev, "failed to alloc mii bus\n"); return -ENOMEM; @@ -371,11 +571,20 @@ static int davinci_mdio_probe(struct platform_device *pdev) } data->bus->name = dev_name(dev); - data->bus->read = davinci_mdio_read; - data->bus->write = davinci_mdio_write; - data->bus->reset = davinci_mdio_reset; + + if (data->manual_mode) { + data->bus->read = davinci_mdiobb_read; + data->bus->write = davinci_mdiobb_write; + data->bus->reset = davinci_mdiobb_reset; + + dev_info(dev, "Configuring MDIO in manual mode\n"); + } else { + data->bus->read = davinci_mdio_read; + data->bus->write = davinci_mdio_write; + data->bus->reset = davinci_mdio_reset; + data->bus->priv = data; + } data->bus->parent = dev; - data->bus->priv = data; data->clk = devm_clk_get(dev, "fck"); if (IS_ERR(data->clk)) { @@ -433,9 +642,13 @@ static int davinci_mdio_remove(struct platform_device *pdev) { struct davinci_mdio_data *data = platform_get_drvdata(pdev); - if (data->bus) + if (data->bus) { mdiobus_unregister(data->bus); + if (data->manual_mode) + free_mdio_bitbang(data->bus); + } + pm_runtime_dont_use_autosuspend(&pdev->dev); pm_runtime_disable(&pdev->dev); @@ -452,7 +665,9 @@ static int davinci_mdio_runtime_suspend(struct device *dev) ctrl = readl(&data->regs->control); ctrl &= ~CONTROL_ENABLE; writel(ctrl, &data->regs->control); - wait_for_idle(data); + + if (!data->manual_mode) + wait_for_idle(data); return 0; } @@ -461,7 +676,12 @@ static int davinci_mdio_runtime_resume(struct device *dev) { struct davinci_mdio_data *data = dev_get_drvdata(dev); - davinci_mdio_enable(data); + if (data->manual_mode) { + davinci_mdio_disable(data); + davinci_mdio_enable_manual_mode(data); + } else { + davinci_mdio_enable(data); + } return 0; } #endif From patchwork Wed Oct 19 08:32: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: 5178 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp263400wrs; Wed, 19 Oct 2022 04:17:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM63JLSxBKqiKjbjSoeacaz9SyDeOfHglIr7j6O3rAywhLBiJFtIAmQRlB+1p3p9y3J494fP X-Received: by 2002:a17:90b:1e04:b0:20d:90b3:45e5 with SMTP id pg4-20020a17090b1e0400b0020d90b345e5mr42866673pjb.113.1666178278470; Wed, 19 Oct 2022 04:17:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178278; cv=none; d=google.com; s=arc-20160816; b=IXVSAZClZ657LOparPxrARZRTqiwsQfgb2ucd3hvHaarG7sB8vu4k9eotv1XIUf+2i NIuIqpyHusa7BZuuCDaGd7F8VRuH2e8733k0loXEuHUs/C/n3dZgQaKUIobnfilNhs6K tpE2lAGzLawJwi7x5dOkt63bwZK7cKs3f3Os0z5dWsideCQqjh8t5crgR+SGTzur+t7z E/lJKB83qQjLoU/BnCUiFmAJscaeanNkvHigzxp6K+sytnJExMFw6CVwGJ1wfasMbiV4 hTv/EwARPP7a7OgnM6t5ChdTNSmNGlC0FmDTbfjNZ/8tAchgDEfFxjmIlyT0CDzwHALT Sqeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=s2JYHE3jzH5G/wVhhmK7HeNfmDBc7ddkfQJqVQ/4540=; b=S1nWCQsmt68xM25gLOO415/wUHsVxU+co+x8EPIfX5E/nBKAljzTqISk7Aslpuy5ho +jHCfylFkUx00j7f8ifaaCPsIpB+iyVPluwkVcZs0fcxoqP+jxY8pDSI4wNgGBDaOxDf BSRhXoDmLfon8c/N9OYR6YzhIdDBHWEmzV/Wfb1CsbFZ/r922mzOQSR2E0zp4ntFLRrL WU/ZcuMZ9bwVSFA+st1qjT37HJANmWF2W/zkvI1+D6NVJe7nZ2p6K067N2CNI3JiyfUg yeZDJBnqqzjUHTyhcoxOb1Gt1FtR5L+9wTmTxFQyP2EU+cTr0qAgw8L1zFYF86pXWTCj RrhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=o84krziJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y23-20020a17090aa41700b0020ae29877besi15951094pjp.20.2022.10.19.04.17.22; Wed, 19 Oct 2022 04:17:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=o84krziJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233990AbiJSLFq (ORCPT + 99 others); Wed, 19 Oct 2022 07:05:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234881AbiJSLEL (ORCPT ); Wed, 19 Oct 2022 07:04: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 B02D215201C; Wed, 19 Oct 2022 03:33:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DA85B61880; Wed, 19 Oct 2022 09:08:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB619C433D6; Wed, 19 Oct 2022 09:08:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170515; bh=YIPJ25ERBUQJfRKFkqLFPqinasOAti3V9lF/D6mb+20=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o84krziJgvAJSl08T/Atb2MlDX5og1S+e7s2+OMx0zZBD0uOQCa2luG9TbZ+Du39I m6ctXuRZYrC1ZvI1U6v4q9oSQS393nUPu72bDVIh5n8JRe5zOtSinljirQsadOdV8A 0PEaRJ1YrCi1fjY0zkL49no2QFFEZjGBUIy5/AJM= 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 6.0 685/862] openvswitch: Fix double reporting of drops in dropwatch Date: Wed, 19 Oct 2022 10:32:52 +0200 Message-Id: <20221019083320.248592352@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114554717991010?= X-GMAIL-MSGID: =?utf-8?q?1747114554717991010?= 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 6c9d153afbee..b68ba3c72519 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c @@ -252,10 +252,17 @@ void ovs_dp_process_packet(struct sk_buff *skb, struct sw_flow_key *key) 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 Wed Oct 19 08:32: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: 5174 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp255185wrs; Wed, 19 Oct 2022 04:01:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4FzJp8w0ELe0LEFr2Elua1ppVpFmA1+5BUKSxSoI4cLOIqzrjgXMXjlrRFjmmE/1OPLs8C X-Received: by 2002:a63:4c17:0:b0:43b:e31c:efd0 with SMTP id z23-20020a634c17000000b0043be31cefd0mr6782973pga.213.1666177281584; Wed, 19 Oct 2022 04:01:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666177281; cv=none; d=google.com; s=arc-20160816; b=RiU0WZYNzgCELSQQBxxKVPy15Ws7Bw8bqloHBr2sCO3RfsHvGFfLzlPKExgdGy/els gcHbLL+Abl3eUCO+oZNLy6JD04olS8g3w2i4N0HUJW18pFsc9waeWFf5sbpn16jYtwXi TGkQfvxkZGzfqWbx0sCquSqIpZCoFCwoEsslvw3OP3ObW4192OcifmLHs3DTHvysT4wE P+ij+Z9we5jxgFuVedw74e3Hvr5AZIPRz813FP1NjGwZkYr4TVwNqpNd8SnnD5LiEbcB 2dOhi0ZYzyS8vs/LY0SDg8X32ioFHDA2NNElyljmQM+K9Y1s7eJa/LQaYEt/FIm0ZJDF +CBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=upLYNCXacljai2OhbOt70SA01rjVr9a4nZA4cUWx1uU=; b=oxAfK2NOaRJVWafehRlDRXoFnQu32mi2FZZLR0yaSvikmuBGydLqQkwNaDhm+ZHJ/9 KPE5XaWMp/ytyV8fbK1eEC+RVffo0uHgPCL1BSMaB9b4b5Pq++hINfRutyPmqx01sHV/ wwGUUJF+erlrXwm7wRgEfFV8t71mB0ieMpccnQsi5WiupyTx01oGCi3priXgL8a3hIly 8GSkGt0kO/7S2tHYi28klevdk/3xXKpeFFOOX4Ayh+4KXwImjZFEf6aOfJV234r4s9mb wPuOZJH5gt4Nysy4Z3nx4Go6cD8vHhyJE3AAz/hubRFT3MkK59x9KtVWJlKWzhIvQtpx XwZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ORSPEH+l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u7-20020a170902e80700b001786d7bc2dfsi16984537plg.400.2022.10.19.04.01.07; Wed, 19 Oct 2022 04:01:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ORSPEH+l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234736AbiJSLAL (ORCPT + 99 others); Wed, 19 Oct 2022 07:00:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234864AbiJSK7B (ORCPT ); Wed, 19 Oct 2022 06:59:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 618B7169CC1; Wed, 19 Oct 2022 03:28: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 166E0B824A6; Wed, 19 Oct 2022 09:08:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C767C433D6; Wed, 19 Oct 2022 09:08:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170517; bh=F91BAdOXkp+xhwYRMD0QHptsZMxc0ARjOGzeltr8YbA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ORSPEH+lKHqonU4LO7/hZG2t52IKRnBr8Dy2BGItcLwQQCmT3RLhJ43BAf01or4XA 0c20p5pP3OPUL2LTguWZ81aOGV620iC1QdkAIbDWbQcwxZlgk2EUPemuY81io8VLKs 4s9PxUjBbir8tXK/kwZXMAaRtL2SwoGXLWcl509Y= 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 6.0 686/862] openvswitch: Fix overreporting of drops in dropwatch Date: Wed, 19 Oct 2022 10:32:53 +0200 Message-Id: <20221019083320.298823380@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747113509526560618?= X-GMAIL-MSGID: =?utf-8?q?1747113509526560618?= 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 b68ba3c72519..93c596e3b22b 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c @@ -558,8 +558,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 Wed Oct 19 08:32: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: 4846 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223814wrs; Wed, 19 Oct 2022 02:38:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM67svQ+Vsq3Z+58c4rbm/87M81vKcLIZT5jsHCpkYvdSnQC0D++ZF4qtNbbftNwvN3M86c9 X-Received: by 2002:a17:907:7f07:b0:779:7f94:d259 with SMTP id qf7-20020a1709077f0700b007797f94d259mr5863265ejc.525.1666172314478; Wed, 19 Oct 2022 02:38:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172314; cv=none; d=google.com; s=arc-20160816; b=hYxiPGFCTT4x0Sahg+iSNWoHJLznBHBWyCrlyRVTI+5CiAu3lg1Wf/7/Px2nG2s+QX 2DvM8pu+B3f4ewjm/tebOZg+gujKy6TtQV4F9CUKi5Wa/Szsvo+/btSQX13wSQoEylAT ODiU+MW4UNMFK7k1PakMnuDc3xFqs8zpt2OzEpykfr4F8A+B26je8gqaY6JPw8TV6lCo eqb6qPKNIyy2tRlTIsGWssGlrnAXq1y96Mg2c1+bSZjxuIykboWKLXHu2SUJwTF5LckC klkVq1RmwvOw64V4EorRSUZqoN8MKdaUhd1AH82kRFHt4VLNxR8RrllvQ+MUQzBIb4cl r2/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=6sGY368LlqREylzMH0NWWXArdZTalId9jynhcl5ezZo=; b=uiX/R8qFDjPyt6B5HAwaH/eCQOdKUd8catpSuNorwqA57p+vhcaExPC3Te9xYap//t yY2W9GVXyD+f2EzXkZVsGlQG/o1av9vM2MtnoL2zSGRfn2t4+feJf622gfInFn3odhSu HZg+BHCHOM+UCNSwZurYSWvb/vUiiLKtD3rYv9zQyEyuyQfkilm7MFSRyiobBm5uFV/v NBiO+/YVUX2g5z8Hk2FVhfg4pGFNp8Gs3nPYuow0I4c9Kb3f+8C5R1EMN3hfIgzlkH+r t5UuBUOvVm2nwv3NOCbWZARXbBxMKeHdFcP/cV7xEXkQ1c2Way7JQsgzNofLCSXXSIsL 0NTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xn1BQo7W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cs19-20020a170906dc9300b0072fb108db55si9561881ejc.895.2022.10.19.02.38.07; Wed, 19 Oct 2022 02:38:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xn1BQo7W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233252AbiJSJZL (ORCPT + 99 others); Wed, 19 Oct 2022 05:25:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233469AbiJSJXw (ORCPT ); Wed, 19 Oct 2022 05:23: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 136698307D; Wed, 19 Oct 2022 02:10: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 212376174B; Wed, 19 Oct 2022 09:08:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 33653C433D7; Wed, 19 Oct 2022 09:08:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170520; bh=YJW838ei9dUw8KV2RE3LIsOoRby+bBUkYxhtb2Aj2+A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xn1BQo7WV7bsioPuIUux4hiCjojjGL/kv9NFKwZQBaQKcaH3N1g4iDI/Ocrc/DHGK ObFsHK+2+cO/wjFCdE9gTreNd2/ll3loRpqvaQP1Ii9wHidmdqMNvk0LJdEbg69BJg cbx3fzeZFhSEQX/Dff1I4YDCaNqe7EjOAtURPWp8= 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 6.0 687/862] tcp: annotate data-race around tcp_md5sig_pool_populated Date: Wed, 19 Oct 2022 10:32:54 +0200 Message-Id: <20221019083320.336216418@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108300975050035?= X-GMAIL-MSGID: =?utf-8?q?1747108300975050035?= 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 997a80ce1e13..5f1d84d901c7 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -4444,12 +4444,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) { @@ -4460,7 +4464,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); @@ -4476,7 +4481,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 Wed Oct 19 08:32: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: 4866 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223994wrs; Wed, 19 Oct 2022 02:39:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7+XkP8YOvKSXcVykxPpEZoNrxIlzr4YO20VMMG6ajwm2J/vZWcR+ptVvmzlco4qvtjw1/X X-Received: by 2002:a05:6a00:acc:b0:530:e79e:fc27 with SMTP id c12-20020a056a000acc00b00530e79efc27mr7796028pfl.61.1666172343660; Wed, 19 Oct 2022 02:39:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172343; cv=none; d=google.com; s=arc-20160816; b=Ve+UU2M+aDQ4KN0Zq3Bg9I5MyLtPcz0Wncqtmncdikxm64KVJOQrbIo20facEX86sm Wh49Pzq73BH9EopjfdsbJmhQafd6x9v9u6cof2NqmI30UrO8Ya715inpJHVXe50BN11g hOQmRNA4ZOa79fC82ke9G8LYvHH2uR7RYw/dE7i0pZ7iDAueTOfPmW/E6DQ/LXD98ihR jlihwlKVHseAjxB8sWuKRoq+k9Ec/hktQh5DMzwXBcgZLhm5kyw/nuzRUQCLCS3+LQfS /dgoptcEx6kV2eaoYpsIluBbVNMqNUTMG1IqNHLhyV7JNGrSJzLAsquOWaP8MUrD3z/B Hayw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=A+noVsxBQRrRt1rEKLR1y1koYzp4cSkSddtGXmTg9TI=; b=az7tj2cgw3kZgaWovoNOsEECeGI6n629sh+pXxC4ygxGuMC+3B/y0Hr/o5pYElMMrE OqsIkDHFvJwehDPyLzJ/KTqymPgtIDtoDStEUgzvv11Rx+m5/THW5xjHQRayzQs1nd8W ChaUwsTM6dJBSxAifuAlrPqX/AVzWAOKol3tLMhrCTaJiS/QY1O6KOqy3F8NeeI3EPWC IPvI1WpcFJoPjTKT0JH49CTepv8iCizPjpZ4neGpTQl+Nm3p7bFhMhU6u6xfI2zRhv9T TaOxHNE8KJgMuTmDFjf9kD+H2IyOglrIW7toTpjXuxCTroae7VjjWL9MH+n/bQjJMoFn wI5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KZvWdf5f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a056a00180f00b0052abf46260dsi20074937pfa.25.2022.10.19.02.38.51; Wed, 19 Oct 2022 02:39: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=KZvWdf5f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233445AbiJSJZW (ORCPT + 99 others); Wed, 19 Oct 2022 05:25:22 -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 S233582AbiJSJYJ (ORCPT ); Wed, 19 Oct 2022 05:24:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8244C512C; Wed, 19 Oct 2022 02:10: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 B9DBF61881; Wed, 19 Oct 2022 09:08:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CCE78C433D6; Wed, 19 Oct 2022 09:08:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170523; bh=Kh8Sla+Un1KkjfHIh8LWbAk/NpfHmZyyc25lnnifXUI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KZvWdf5fteZLWm92HtK/gkC+EEh8tHLxc5ZWTc3oFGo+UfJU1Wr6taiZJAAfMVpfu qxFz8Pc9m9cEp+5G/Q0OHtCEIHHNaPlmyZJsADwXJ9a/q52aJwQwOHzLSUviPVy9/7 NXtreP4JNzTU+11Xe/UaxXss0r+hjOEBiQBefwzk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jerry Ray , "David S. Miller" , Sasha Levin Subject: [PATCH 6.0 688/862] micrel: ksz8851: fixes struct pointer issue Date: Wed, 19 Oct 2022 10:32:55 +0200 Message-Id: <20221019083320.383736530@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108331319671440?= X-GMAIL-MSGID: =?utf-8?q?1747108331319671440?= From: Jerry Ray [ Upstream commit fef5de753ff01887cfa50990532c3890fccb9338 ] Issue found during code review. This bug has no impact as long as the ks8851_net structure is the first element of the ks8851_net_spi structure. As long as the offset to the ks8851_net struct is zero, the container_of() macro is subtracting 0 and therefore no damage done. But if the ks8851_net_spi struct is ever modified such that the ks8851_net struct within it is no longer the first element of the struct, then the bug would manifest itself and cause problems. struct ks8851_net is contained within ks8851_net_spi. ks is contained within kss. kss is the priv_data of the netdev structure. Signed-off-by: Jerry Ray Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/micrel/ks8851_spi.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/micrel/ks8851_spi.c b/drivers/net/ethernet/micrel/ks8851_spi.c index 82d55fc27edc..70bc7253454f 100644 --- a/drivers/net/ethernet/micrel/ks8851_spi.c +++ b/drivers/net/ethernet/micrel/ks8851_spi.c @@ -413,7 +413,8 @@ static int ks8851_probe_spi(struct spi_device *spi) spi->bits_per_word = 8; - ks = netdev_priv(netdev); + kss = netdev_priv(netdev); + ks = &kss->ks8851; ks->lock = ks8851_lock_spi; ks->unlock = ks8851_unlock_spi; @@ -433,8 +434,6 @@ static int ks8851_probe_spi(struct spi_device *spi) IRQ_RXPSI) /* RX process stop */ ks->rc_ier = STD_IRQ; - kss = to_ks8851_spi(ks); - kss->spidev = spi; mutex_init(&kss->lock); INIT_WORK(&kss->tx_work, ks8851_tx_work); From patchwork Wed Oct 19 08:32: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: 4919 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225812wrs; Wed, 19 Oct 2022 02:44:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM66wX2oadiJqW1g0wPhMnOGh87k959ZHkLieVuM2jSdezGYRAS62Clpc+aKBGN6ImDclClB X-Received: by 2002:a05:6402:3641:b0:45c:4231:ddcc with SMTP id em1-20020a056402364100b0045c4231ddccmr6531886edb.224.1666172646481; Wed, 19 Oct 2022 02:44:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172646; cv=none; d=google.com; s=arc-20160816; b=CqiP2EdtMco59j+CUpuNc8oR+DePnUYwh+E4VuNk8IGRizwNktbDd6xqq7UjYZM8SB m5ZgUy8bxOIe2oqBQJsaMmPTxjI1ovAfXclAtnBPu/91NqxQp+IGBX5Lnqm99COfJy/K zrJiIINwPDFRy1oamlP52VtPubGIK15pKARzetNDQfL7gRikC1K4T155Engc7BDLQVbP N2E+2Kymrl7RsVwNn/T954W3V3HUgNoq4DRbxHdDNG8Y3ddYEMWfHLUkCZroub7+wPg2 G7MM+jT08cudFEHSXF1e7/s2zldlek3Gb6/WSKgOTPkBMWRkGUzHVfgz+ML5FbjqP324 x1Dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=C2vsMQmSkKcT6ybv+UrPf2nhzmBo1UjZHef9Zt8iSDA=; b=HPn3IrUypoKadh+pDbe8mrVbgWPOfNzOu+SW81S6/hdZ8qWDRjAjEfEK/9E5xBMyvL VI82cZTARPzLcS3yPkD5/jJpIkX1tAOP8AYuIjFcTQzgq4KnGuJbYEFL5f56ykzmtdTK B3CGNOYrLJvOne4+j+Rfpzr7NC3HSOJ9b4pZz/+OBe/+6yVxwkN2+gQ4r33UA4tHEL7N WD9g8iYK6BUtNSxQ22m86UvRK3e0+cx3CW5Kb1qDrnIRUXp2dYzrWIuNQOg5ovHJV7q8 /0iDErLiQk2mHgmyWnAUdZ5LKWOfvRtIJSFDSsCcHImXlrZMZyNPVSHIUuf4R5Z7Jmet VxLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SNMoodGS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o10-20020aa7dd4a000000b0045c42a9f588si12618553edw.408.2022.10.19.02.43.32; Wed, 19 Oct 2022 02:44: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=SNMoodGS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232493AbiJSJgw (ORCPT + 99 others); Wed, 19 Oct 2022 05:36:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233962AbiJSJaD (ORCPT ); Wed, 19 Oct 2022 05:30:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C9B2EE089; Wed, 19 Oct 2022 02:13: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 5FE7761882; Wed, 19 Oct 2022 09:08:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77F79C433D7; Wed, 19 Oct 2022 09:08:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170525; bh=m4KrS+f91Bw2+wpxolcuqnxHD4V0hk/Zrm3h5a6H50c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SNMoodGSxgXSrmUXYnu0CBwWyMj5WBP1eX1rrtevsOPUCsVowiRC6M3HPr9r1363w o3Gd35WV2Gwi/v0N/cRcvojzmGJWDttyWDo/Iqpas1zJnfZ2euybW1hH/IP6e0N9a3 G83j2Nix4jZssT/UU0Di6D584bnYIqAkRO+P548U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johannes Berg , Sasha Levin Subject: [PATCH 6.0 689/862] wifi: mac80211: accept STA changes without link changes Date: Wed, 19 Oct 2022 10:32:56 +0200 Message-Id: <20221019083320.429793127@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108649036935362?= X-GMAIL-MSGID: =?utf-8?q?1747108649036935362?= From: Johannes Berg [ Upstream commit b303835dabe0340f932ebb4e260d2229f79b0684 ] If there's no link ID, then check that there are no changes to the link, and if so accept them, unless a new link is created. While at it, reject creating a new link without an address. This fixes authorizing an MLD (peer) that has no link 0. Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- net/mac80211/cfg.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index e5239a17a875..65f34945a767 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -1610,6 +1610,18 @@ static int sta_link_apply_parameters(struct ieee80211_local *local, rcu_dereference_protected(sta->link[link_id], lockdep_is_held(&local->sta_mtx)); + /* + * If there are no changes, then accept a link that doesn't exist, + * unless it's a new link. + */ + if (params->link_id < 0 && !new_link && + !params->link_mac && !params->txpwr_set && + !params->supported_rates_len && + !params->ht_capa && !params->vht_capa && + !params->he_capa && !params->eht_capa && + !params->opmode_notif_used) + return 0; + if (!link || !link_sta) return -EINVAL; @@ -1625,6 +1637,8 @@ static int sta_link_apply_parameters(struct ieee80211_local *local, params->link_mac)) { return -EINVAL; } + } else if (new_link) { + return -EINVAL; } if (params->txpwr_set) { From patchwork Wed Oct 19 08:32: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: 5453 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp329626wrs; Wed, 19 Oct 2022 06:33:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6CnYdIuQw15wEbp7VPqQTt6dQ6axHY+7xrJp+L3Fhi3cVGQCGDgMq8+jhtdw0VYkEwspuW X-Received: by 2002:a17:90b:17c7:b0:20d:7862:778e with SMTP id me7-20020a17090b17c700b0020d7862778emr9683571pjb.91.1666186395090; Wed, 19 Oct 2022 06:33:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666186395; cv=none; d=google.com; s=arc-20160816; b=K2I4hInCyW0crMo1jmgAPb4fRe0BbtCLqYan5mDhnIMB1F/M2YmVa9IM4uySGRyP5K ibnHVNqU6lUlcEkzODYNVTsUwxewc+md+sss92AqRGWmBqp1IG928ZXV0zf1G4BZSqLp bf+W86TLXQiov7xJeerFizUCgARTFoCblL5voOACXyUCLoVGr7ApG1YnaOEW8w/fuMHS r1wt4pGKt8K5pdgDBeMCa76Ch1UPcyfyaefO7wG85Ekj/S5iY3GsXY+t1u/KsIwf68Bo +fKEcvX5r3o5Xt9Q+1YacxDxTHhmdEp6RNANuDATKONrW5416OvnQ49h6mk8Cwlb5p6t iwqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=srna4Sr+Pg4Z+QZaPAmMHxutexXuQK+Be7sKBmRqIYA=; b=GoQQOJUZvW9/qXMFi/zhv3PlC7O8OXOnbWRzhFIcziaxBicfe+uVIh+cRseM45FsAG VhR+eUXx7U3MjwV7WgEyg2VM1NWMgSKpxVTrNaQ9KGREwAgHbJDSlovLn+t/OjoFoI2d SdaG2XNucOUG74BCv81EM4HtLTQIVvLAlwroNUTlKzpbxqUBpJLqVdPK82LiNnFff/CY 0IMA3gLb5BmxVr44rZ+sw78hfY2BBrN7B6RvIUFYzAj0Z+trzdZCNv6HQQZdImcwUI3t 5NNfYe+wTJrcymIqycEe8eupFuYhDAmwtVLWmD2SmoosQViFOPehai9CoDXlvGhyRm+S OgSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rB0537pB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c3-20020a170902b68300b001782ecb617dsi17459480pls.412.2022.10.19.06.33.00; Wed, 19 Oct 2022 06:33: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=rB0537pB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232361AbiJSNUo (ORCPT + 99 others); Wed, 19 Oct 2022 09:20:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231622AbiJSNUK (ORCPT ); Wed, 19 Oct 2022 09:20:10 -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 B96331DD899; Wed, 19 Oct 2022 06:05: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 sin.source.kernel.org (Postfix) with ESMTPS id 1407DCE2194; Wed, 19 Oct 2022 09:08:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12502C433D7; Wed, 19 Oct 2022 09:08:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170528; bh=/LmuOibYq4SSvlEYG9tQkbKyOyx/DdrdHV6RwtqcukY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rB0537pB9N1dC7LasLnpDzK39952jc4GcxHfRUj9SdxE/Z58io3bXlz+2i1ZtvoFT 15oOoOm2/5bQ6MWMhjWt+pLeQuCuLFAT7yQ/5MkLkFg5fCQ885w4i3RNecRNPNliBR 9YG4dLHiU6NbeC+LbUEU9MnoSE1Iw3WjzNq7Diqk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jane Chu , Borislav Petkov , Dan Williams , Ingo Molnar , Sasha Levin Subject: [PATCH 6.0 690/862] x86/mce: Retrieve poison range from hardware Date: Wed, 19 Oct 2022 10:32:57 +0200 Message-Id: <20221019083320.470023711@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123065099589091?= X-GMAIL-MSGID: =?utf-8?q?1747123065099589091?= From: Jane Chu [ Upstream commit f9781bb18ed828e7b83b7bac4a4ad7cd497ee7d7 ] When memory poison consumption machine checks fire, MCE notifier handlers like nfit_handle_mce() record the impacted physical address range which is reported by the hardware in the MCi_MISC MSR. The error information includes data about blast radius, i.e. how many cachelines did the hardware determine are impacted. A recent change 7917f9cdb503 ("acpi/nfit: rely on mce->misc to determine poison granularity") updated nfit_handle_mce() to stop hard coding the blast radius value of 1 cacheline, and instead rely on the blast radius reported in 'struct mce' which can be up to 4K (64 cachelines). It turns out that apei_mce_report_mem_error() had a similar problem in that it hard coded a blast radius of 4K rather than reading the blast radius from the error information. Fix apei_mce_report_mem_error() to convey the proper poison granularity. Signed-off-by: Jane Chu Signed-off-by: Borislav Petkov Reviewed-by: Dan Williams Reviewed-by: Ingo Molnar Link: https://lore.kernel.org/r/7ed50fd8-521e-cade-77b1-738b8bfb8502@oracle.com Link: https://lore.kernel.org/r/20220826233851.1319100-1-jane.chu@oracle.com Signed-off-by: Sasha Levin --- arch/x86/kernel/cpu/mce/apei.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/mce/apei.c b/arch/x86/kernel/cpu/mce/apei.c index 717192915f28..8ed341714686 100644 --- a/arch/x86/kernel/cpu/mce/apei.c +++ b/arch/x86/kernel/cpu/mce/apei.c @@ -29,15 +29,26 @@ void apei_mce_report_mem_error(int severity, struct cper_sec_mem_err *mem_err) { struct mce m; + int lsb; if (!(mem_err->validation_bits & CPER_MEM_VALID_PA)) return; + /* + * Even if the ->validation_bits are set for address mask, + * to be extra safe, check and reject an error radius '0', + * and fall back to the default page size. + */ + if (mem_err->validation_bits & CPER_MEM_VALID_PA_MASK) + lsb = find_first_bit((void *)&mem_err->physical_addr_mask, PAGE_SHIFT); + else + lsb = PAGE_SHIFT; + mce_setup(&m); m.bank = -1; /* Fake a memory read error with unknown channel */ m.status = MCI_STATUS_VAL | MCI_STATUS_EN | MCI_STATUS_ADDRV | MCI_STATUS_MISCV | 0x9f; - m.misc = (MCI_MISC_ADDR_PHYS << 6) | PAGE_SHIFT; + m.misc = (MCI_MISC_ADDR_PHYS << 6) | lsb; if (severity >= GHES_SEV_RECOVERABLE) m.status |= MCI_STATUS_UC; From patchwork Wed Oct 19 08:32:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5180 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp263587wrs; Wed, 19 Oct 2022 04:18:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7RdvbgIdMHJ3El1V9542uysVh7R1pbbLusjb3TLO3sZ8bcsuVgJoQHR7EyrcNJVdXJgcRr X-Received: by 2002:a63:290:0:b0:43c:20be:9f48 with SMTP id 138-20020a630290000000b0043c20be9f48mr6569498pgc.388.1666178301511; Wed, 19 Oct 2022 04:18:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178301; cv=none; d=google.com; s=arc-20160816; b=h+t5cFzDSZY0DLAduOw/2f/3B9Htgv9/NSZ8ZwzMqo5bB9TT7RmxWXbeiiE2XRQHqe CAaBkmRRBF/jgn9TbyzsOI7pc7S1kINoH0z0zSi6wk2iEPkKzIPSyqMLN8a0xIQ3xzMf lvJyabRbpe8VuuQfNlvNOSTj5NDkFIhtpJkvFvtL9ZIC8o5Lc5tMNin+VYQbC99Zb8dS /LeAbLCxd7nG7MmgPfIX0yVLFq4cDs/UDlI/kRfohK0vL2hyYl/7Ad/tqYhtcsYrds7i Ns2ZpiIgh9q7ovuC8fbrSpHXusKostK8WuG7pRXvDql8aJAT5F/ZApoNbUXvTZBz64AG /2Og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+B3kq4N4BrCK/RESHisUCjbzyKU4QB7y1C7UtMGW+4s=; b=WtyrEzN3KY5K2qwkJGjPQvZLZkX8JOUXhX2XunQaLtFHUPOv6R3ODAUDC2ao6ejNoR Z32EOL0cHem/KMNoUFAWWGkiTZAU4ms/OYr5Q8EQj/vYQGFPCSR8dlHFcwCJBr/agbq1 5tXov1i0LS5Lk8Qtb1CZu+E6QsmZ9zWctLYWmPGK8tbmbozaQ4yVTPZ4/JbLGYugOi1I 2hmIv7Na0dd6/5vC987OH7C08766PFu4a5eEV9qvn6no4iBWbJehUhcNiKonlc2fFPzs OEWNwkAPQUHegVEoCCl/OixCPo429RTtNbjIcexQlTZjAx21DVt35dTkYLMXtMuafqtf PSDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UaFouskb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170902ec8600b0017535568d5dsi21191960plg.256.2022.10.19.04.17.57; Wed, 19 Oct 2022 04:18:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UaFouskb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232973AbiJSLHl (ORCPT + 99 others); Wed, 19 Oct 2022 07:07:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232185AbiJSLHJ (ORCPT ); Wed, 19 Oct 2022 07:07:09 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D4759FEB; Wed, 19 Oct 2022 03:36: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 sin.source.kernel.org (Postfix) with ESMTPS id 2EC90CE2195; Wed, 19 Oct 2022 09:08:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49EB7C433D7; Wed, 19 Oct 2022 09:08:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170533; bh=uFZzpqGeI0F+s1iei+vQqMl4q+FdPp2Sji8X1gj9HgQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UaFouskbfCQ1j85YJW47pJEvo99Mbvh5NsVF0UX9gvbJixbiQACUZABAFe5RCh2vi fEjGRJ6RvBYup38xYLGjfbldGIWRLbG+jTQOlnn/0nnx3Fz9U3v3hFijnpESkc1mhZ b9O6pdkRfwH8ET3yvfyQAa0V2XcKwVtJJDP4emmk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot , Tetsuo Handa , =?utf-8?q?Toke_H=C3=B8il?= =?utf-8?q?and-J=C3=B8rgensen?= , Kalle Valo , Sasha Levin Subject: [PATCH 6.0 691/862] wifi: ath9k: avoid uninit memory read in ath9k_htc_rx_msg() Date: Wed, 19 Oct 2022 10:32:58 +0200 Message-Id: <20221019083320.517498663@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114579108530458?= X-GMAIL-MSGID: =?utf-8?q?1747114579108530458?= From: Tetsuo Handa [ Upstream commit b383e8abed41cc6ff1a3b34de75df9397fa4878c ] syzbot is reporting uninit value at ath9k_htc_rx_msg() [1], for ioctl(USB_RAW_IOCTL_EP_WRITE) can call ath9k_hif_usb_rx_stream() with pkt_len = 0 but ath9k_hif_usb_rx_stream() uses __dev_alloc_skb(pkt_len + 32, GFP_ATOMIC) based on an assumption that pkt_len is valid. As a result, ath9k_hif_usb_rx_stream() allocates skb with uninitialized memory and ath9k_htc_rx_msg() is reading from uninitialized memory. Since bytes accessed by ath9k_htc_rx_msg() is not known until ath9k_htc_rx_msg() is called, it would be difficult to check minimal valid pkt_len at "if (pkt_len > 2 * MAX_RX_BUF_SIZE) {" line in ath9k_hif_usb_rx_stream(). We have two choices. One is to workaround by adding __GFP_ZERO so that ath9k_htc_rx_msg() sees 0 if pkt_len is invalid. The other is to let ath9k_htc_rx_msg() validate pkt_len before accessing. This patch chose the latter. Note that I'm not sure threshold condition is correct, for I can't find details on possible packet length used by this protocol. Link: https://syzkaller.appspot.com/bug?extid=2ca247c2d60c7023de7f [1] Reported-by: syzbot Signed-off-by: Tetsuo Handa Acked-by: Toke Høiland-Jørgensen Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/7acfa1be-4b5c-b2ce-de43-95b0593fb3e5@I-love.SAKURA.ne.jp Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath9k/htc_hst.c | 43 +++++++++++++++--------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/htc_hst.c b/drivers/net/wireless/ath/ath9k/htc_hst.c index 994ec48b2f66..ca05b07a45e6 100644 --- a/drivers/net/wireless/ath/ath9k/htc_hst.c +++ b/drivers/net/wireless/ath/ath9k/htc_hst.c @@ -364,33 +364,27 @@ void ath9k_htc_txcompletion_cb(struct htc_target *htc_handle, } static void ath9k_htc_fw_panic_report(struct htc_target *htc_handle, - struct sk_buff *skb) + struct sk_buff *skb, u32 len) { uint32_t *pattern = (uint32_t *)skb->data; - switch (*pattern) { - case 0x33221199: - { + if (*pattern == 0x33221199 && len >= sizeof(struct htc_panic_bad_vaddr)) { struct htc_panic_bad_vaddr *htc_panic; htc_panic = (struct htc_panic_bad_vaddr *) skb->data; dev_err(htc_handle->dev, "ath: firmware panic! " "exccause: 0x%08x; pc: 0x%08x; badvaddr: 0x%08x.\n", htc_panic->exccause, htc_panic->pc, htc_panic->badvaddr); - break; - } - case 0x33221299: - { + return; + } + if (*pattern == 0x33221299) { struct htc_panic_bad_epid *htc_panic; htc_panic = (struct htc_panic_bad_epid *) skb->data; dev_err(htc_handle->dev, "ath: firmware panic! " "bad epid: 0x%08x\n", htc_panic->epid); - break; - } - default: - dev_err(htc_handle->dev, "ath: unknown panic pattern!\n"); - break; + return; } + dev_err(htc_handle->dev, "ath: unknown panic pattern!\n"); } /* @@ -411,16 +405,26 @@ void ath9k_htc_rx_msg(struct htc_target *htc_handle, if (!htc_handle || !skb) return; + /* A valid message requires len >= 8. + * + * sizeof(struct htc_frame_hdr) == 8 + * sizeof(struct htc_ready_msg) == 8 + * sizeof(struct htc_panic_bad_vaddr) == 16 + * sizeof(struct htc_panic_bad_epid) == 8 + */ + if (unlikely(len < sizeof(struct htc_frame_hdr))) + goto invalid; htc_hdr = (struct htc_frame_hdr *) skb->data; epid = htc_hdr->endpoint_id; if (epid == 0x99) { - ath9k_htc_fw_panic_report(htc_handle, skb); + ath9k_htc_fw_panic_report(htc_handle, skb, len); kfree_skb(skb); return; } if (epid < 0 || epid >= ENDPOINT_MAX) { +invalid: if (pipe_id != USB_REG_IN_PIPE) dev_kfree_skb_any(skb); else @@ -432,21 +436,30 @@ void ath9k_htc_rx_msg(struct htc_target *htc_handle, /* Handle trailer */ if (htc_hdr->flags & HTC_FLAGS_RECV_TRAILER) { - if (be32_to_cpu(*(__be32 *) skb->data) == 0x00C60000) + if (be32_to_cpu(*(__be32 *) skb->data) == 0x00C60000) { /* Move past the Watchdog pattern */ htc_hdr = (struct htc_frame_hdr *)(skb->data + 4); + len -= 4; + } } /* Get the message ID */ + if (unlikely(len < sizeof(struct htc_frame_hdr) + sizeof(__be16))) + goto invalid; msg_id = (__be16 *) ((void *) htc_hdr + sizeof(struct htc_frame_hdr)); /* Now process HTC messages */ switch (be16_to_cpu(*msg_id)) { case HTC_MSG_READY_ID: + if (unlikely(len < sizeof(struct htc_ready_msg))) + goto invalid; htc_process_target_rdy(htc_handle, htc_hdr); break; case HTC_MSG_CONNECT_SERVICE_RESPONSE_ID: + if (unlikely(len < sizeof(struct htc_frame_hdr) + + sizeof(struct htc_conn_svc_rspmsg))) + goto invalid; htc_process_conn_rsp(htc_handle, htc_hdr); break; default: From patchwork Wed Oct 19 08:32: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: 5451 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp329299wrs; Wed, 19 Oct 2022 06:32:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5fkhtUxac2F5HuPMGJW6DkTw5SmNtnFgG8Ih4V4tjlM1Eco/nkfSNHjW9wCy4Sq+uUq6RP X-Received: by 2002:a17:90b:1bc9:b0:20d:75b8:ee5d with SMTP id oa9-20020a17090b1bc900b0020d75b8ee5dmr10100227pjb.147.1666186351419; Wed, 19 Oct 2022 06:32:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666186351; cv=none; d=google.com; s=arc-20160816; b=LSkCBNOrbHgxSVBMkwCsGhnY6lb1eNLV6WTMIqm8MbLHTkaQrV4GMyrdZrayxbUqJo xjrIULc3v1duJnwpaFu7osRh3h64eKk4x6FW/gyCh+IN+HjdzR+7+VXOTm85fBZ/N/7x CtW4AqfhVQu7gcG4t9Kcd7pFCgfbe85rMeFNBESDCdDdCvhb+VAFeR+SK93yVVSwnxnb n/XUIEFzJC4LGFc3lZyr73hLi9Gc+J9TNj6Z8xFY40dbgzM+k9B1GQhIUCsBICazKCDw XTmAJuh3qT/oOzPELwmVw85+EHYXzgpRY0MJOmOmKMvboK5AlQ8gaCz6JwOjroQvN7cE aYRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+yS+tIdqcl5z0Yb9EwV6GoeGnEwmzsqGEOkCyMIM5Ew=; b=YHlOcUBaFx13jYwCeV300r8PvwJj6FWxDzVIFwDbH7azR9lEhRTT+x5ALYbRPZ4YXN JaCCXU6qAi8HOUvtA4ui78TAuzZN91DmdurZAzi4vWwnJtyd6gYmgazrVli6mPwCqybi XS1WQpZxxt223DOjADH8lfLfSBmTz8pJwj+eDSfM4jw9m6rD8RxY9vkTyvgCAbd63rK+ UN91L14p1fKIzF7UA/8N2/qXs7tS1PnxIgE+iyrhsQaQPoIi4/qQ/hyqWRzyYcIwwkIy 93jKLCIqDzJ4TF9vEGM+HaOZuT0F0WprIIu1EGqO/4U9cBCjDCv7P0fPdodFQUkpAmww norA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ELtYB6az; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n8-20020a63a508000000b0044d72a10ab0si20501267pgf.342.2022.10.19.06.32.17; Wed, 19 Oct 2022 06:32: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=ELtYB6az; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229752AbiJSNUN (ORCPT + 99 others); Wed, 19 Oct 2022 09:20:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231793AbiJSNTo (ORCPT ); Wed, 19 Oct 2022 09:19:44 -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 C05431DD884; Wed, 19 Oct 2022 06:05:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id D23E4CE219C; Wed, 19 Oct 2022 09:08:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D737AC433D7; Wed, 19 Oct 2022 09:08:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170536; bh=r85VRtW2vzTGHkgz/5r6B0X8eKc5Xa42RRq8MtDaW+M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ELtYB6azO1NhZzOgF/bwxIraRtY0IWiMvesHEucC3NLjXq9A/ZCZt6BPuB5U3apVy LHcf+ooOADks09YN5mmtjaWw5IFtDGkg6MZe/2s4ZTKiSuSZPkBZV8Ngp8g/P4Mphd z2SuOS2jXZtN771E5oGywo7LbQqIyBbC2vmMz15c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mika Westerberg , "David S. Miller" , Sasha Levin Subject: [PATCH 6.0 692/862] thunderbolt: Add back Intel Falcon Ridge end-to-end flow control workaround Date: Wed, 19 Oct 2022 10:32:59 +0200 Message-Id: <20221019083320.551484003@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123019783639190?= X-GMAIL-MSGID: =?utf-8?q?1747123019783639190?= From: Mika Westerberg [ Upstream commit 54669e2f17cb5a4c41ade89427f074dc22cecb17 ] As we are now enabling full end-to-end flow control to the Thunderbolt networking driver, in order for it to work properly on second generation Thunderbolt hardware (Falcon Ridge), we need to add back the workaround that was removed with commit 53f13319d131 ("thunderbolt: Get rid of E2E workaround"). However, this time we only apply it for Falcon Ridge controllers as a form of an additional quirk. For non-Falcon Ridge this does nothing. While there fix a typo 'reqister' -> 'register' in the comment. Signed-off-by: Mika Westerberg Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/thunderbolt/nhi.c | 49 +++++++++++++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 7 deletions(-) diff --git a/drivers/thunderbolt/nhi.c b/drivers/thunderbolt/nhi.c index cb8c9c4ae93a..b5cd9673e15d 100644 --- a/drivers/thunderbolt/nhi.c +++ b/drivers/thunderbolt/nhi.c @@ -28,7 +28,11 @@ #define RING_TYPE(ring) ((ring)->is_tx ? "TX ring" : "RX ring") #define RING_FIRST_USABLE_HOPID 1 - +/* + * Used with QUIRK_E2E to specify an unused HopID the Rx credits are + * transferred. + */ +#define RING_E2E_RESERVED_HOPID RING_FIRST_USABLE_HOPID /* * Minimal number of vectors when we use MSI-X. Two for control channel * Rx/Tx and the rest four are for cross domain DMA paths. @@ -38,7 +42,9 @@ #define NHI_MAILBOX_TIMEOUT 500 /* ms */ +/* Host interface quirks */ #define QUIRK_AUTO_CLEAR_INT BIT(0) +#define QUIRK_E2E BIT(1) static int ring_interrupt_index(struct tb_ring *ring) { @@ -458,8 +464,18 @@ static void ring_release_msix(struct tb_ring *ring) static int nhi_alloc_hop(struct tb_nhi *nhi, struct tb_ring *ring) { + unsigned int start_hop = RING_FIRST_USABLE_HOPID; int ret = 0; + if (nhi->quirks & QUIRK_E2E) { + start_hop = RING_FIRST_USABLE_HOPID + 1; + if (ring->flags & RING_FLAG_E2E && !ring->is_tx) { + dev_dbg(&nhi->pdev->dev, "quirking E2E TX HopID %u -> %u\n", + ring->e2e_tx_hop, RING_E2E_RESERVED_HOPID); + ring->e2e_tx_hop = RING_E2E_RESERVED_HOPID; + } + } + spin_lock_irq(&nhi->lock); if (ring->hop < 0) { @@ -469,7 +485,7 @@ static int nhi_alloc_hop(struct tb_nhi *nhi, struct tb_ring *ring) * Automatically allocate HopID from the non-reserved * range 1 .. hop_count - 1. */ - for (i = RING_FIRST_USABLE_HOPID; i < nhi->hop_count; i++) { + for (i = start_hop; i < nhi->hop_count; i++) { if (ring->is_tx) { if (!nhi->tx_rings[i]) { ring->hop = i; @@ -484,6 +500,11 @@ static int nhi_alloc_hop(struct tb_nhi *nhi, struct tb_ring *ring) } } + if (ring->hop > 0 && ring->hop < start_hop) { + dev_warn(&nhi->pdev->dev, "invalid hop: %d\n", ring->hop); + ret = -EINVAL; + goto err_unlock; + } if (ring->hop < 0 || ring->hop >= nhi->hop_count) { dev_warn(&nhi->pdev->dev, "invalid hop: %d\n", ring->hop); ret = -EINVAL; @@ -1097,12 +1118,26 @@ static void nhi_shutdown(struct tb_nhi *nhi) static void nhi_check_quirks(struct tb_nhi *nhi) { - /* - * Intel hardware supports auto clear of the interrupt status - * reqister right after interrupt is being issued. - */ - if (nhi->pdev->vendor == PCI_VENDOR_ID_INTEL) + if (nhi->pdev->vendor == PCI_VENDOR_ID_INTEL) { + /* + * Intel hardware supports auto clear of the interrupt + * status register right after interrupt is being + * issued. + */ nhi->quirks |= QUIRK_AUTO_CLEAR_INT; + + switch (nhi->pdev->device) { + case PCI_DEVICE_ID_INTEL_FALCON_RIDGE_2C_NHI: + case PCI_DEVICE_ID_INTEL_FALCON_RIDGE_4C_NHI: + /* + * Falcon Ridge controller needs the end-to-end + * flow control workaround to avoid losing Rx + * packets when RING_FLAG_E2E is set. + */ + nhi->quirks |= QUIRK_E2E; + break; + } + } } static int nhi_check_iommu_pdev(struct pci_dev *pdev, void *data) From patchwork Wed Oct 19 08:33: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: 4840 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223749wrs; Wed, 19 Oct 2022 02:38:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM42HSp70h5z8HqInOcRPDrIWBAmBGdHsTIiP2rZq1Mpsmgoc/etAXMPC7RbsYnG0foLvFPM X-Received: by 2002:a17:907:7f25:b0:78d:e76a:ef18 with SMTP id qf37-20020a1709077f2500b0078de76aef18mr5867148ejc.378.1666172302333; Wed, 19 Oct 2022 02:38:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172302; cv=none; d=google.com; s=arc-20160816; b=Zzi/Y654fFfRTZN9ewIFpvy+zijCHIC7DyNSOg0S2wB8lL2pcCTClGLRIXJS585Hgt x7FhWTCZJNgOHD2HFWSMuhwhZxRam2Q7UTeK+t/LKIcCsctydYljLv5HVWpgnCmhLtB8 y6/UkPhGrpC4pB/uGdFZ5CCue5PagYyEwFSgLNSRhWiXV/sT7lbljMhPpCIsYEX6nTYR /Lk/AkzBJAKiWYduosQ8LIVULRxfBZWXUImPeKel5xe5K73evwCV7o8Xtcz3qCWzXrJW etAxk1BUt5HCc7VxLkV5yrnEjC2qc1G70ppYXyGba6Z0/7oZPsco04XiU09bZ7QnR9i2 vt1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=SypgHWzDVrjCOskq+/eec/SSmis91nrWLgYl9xZcaFw=; b=Vb4Odln+dawwniK0ke91oyDf+jDmFGcWbDUuqRJQtcHJz0i43Q5HewFnMoxR0/zqxd TrLYbkdbTsuYW0cm1oaGpmbCdOHxgBgx9xWKjPIVGKcanEzUU/NvGOJnLVnZY9AtbK/h 3vIkCPm5amIet6duQYvleAfkYgegxz3Z6Msleq68NzhDQ58dkMJlw4N6gNu+8W2dIDA+ GxVb0r3XUtuh2AKcpxNHMbqPakzznVqNPmcDsUGzZH6+wXu1tlUBEf/OB4RqCKr4caeZ DKjtDFiJn5r2BmqnpWN05tSCbfn3b5zZk7ias23N0a25GKc78Fj9cAyS2C+PqBhhY9ED 9xTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ix1ily4U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id du17-20020a17090772d100b00783ca4d1c74si14067958ejc.520.2022.10.19.02.37.53; Wed, 19 Oct 2022 02:38: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=Ix1ily4U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233480AbiJSJ0y (ORCPT + 99 others); Wed, 19 Oct 2022 05:26:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233421AbiJSJZS (ORCPT ); Wed, 19 Oct 2022 05:25: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 285BBE09E1; Wed, 19 Oct 2022 02:11:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 787E761851; Wed, 19 Oct 2022 09:08:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8AB18C433D6; Wed, 19 Oct 2022 09:08:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170538; bh=qsJ5r+UWQAT9I+BtLd+LlxD1anjr0Hmry+7Ipw0+Uew=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ix1ily4UzZR/Dlg7W7QG2/VLATh/87FgSSbLHBMH5kllGG7DdombPMiZYyOiPQd9W 1Q4TtlLZzowMPq1wzWt1HM8f0GL5gMPqwJZbC1CO+faEw21ldDO92d8tF1lQ6vNpzr lka0jA70lM+MgTm0PvE8E++R6Q1n4sBkzbKEORfM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Sneddon , Dave Hansen , Neelima Krishnan , Sasha Levin Subject: [PATCH 6.0 693/862] x86/apic: Dont disable x2APIC if locked Date: Wed, 19 Oct 2022 10:33:00 +0200 Message-Id: <20221019083320.592790450@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108287996651962?= X-GMAIL-MSGID: =?utf-8?q?1747108287996651962?= From: Daniel Sneddon [ Upstream commit b8d1d163604bd1e600b062fb00de5dc42baa355f ] The APIC supports two modes, legacy APIC (or xAPIC), and Extended APIC (or x2APIC). X2APIC mode is mostly compatible with legacy APIC, but it disables the memory-mapped APIC interface in favor of one that uses MSRs. The APIC mode is controlled by the EXT bit in the APIC MSR. The MMIO/xAPIC interface has some problems, most notably the APIC LEAK [1]. This bug allows an attacker to use the APIC MMIO interface to extract data from the SGX enclave. Introduce support for a new feature that will allow the BIOS to lock the APIC in x2APIC mode. If the APIC is locked in x2APIC mode and the kernel tries to disable the APIC or revert to legacy APIC mode a GP fault will occur. Introduce support for a new MSR (IA32_XAPIC_DISABLE_STATUS) and handle the new locked mode when the LEGACY_XAPIC_DISABLED bit is set by preventing the kernel from trying to disable the x2APIC. On platforms with the IA32_XAPIC_DISABLE_STATUS MSR, if SGX or TDX are enabled the LEGACY_XAPIC_DISABLED will be set by the BIOS. If legacy APIC is required, then it SGX and TDX need to be disabled in the BIOS. [1]: https://aepicleak.com/aepicleak.pdf Signed-off-by: Daniel Sneddon Signed-off-by: Dave Hansen Acked-by: Dave Hansen Tested-by: Neelima Krishnan Link: https://lkml.kernel.org/r/20220816231943.1152579-1-daniel.sneddon@linux.intel.com Signed-off-by: Sasha Levin --- .../admin-guide/kernel-parameters.txt | 4 ++ arch/x86/Kconfig | 7 ++- arch/x86/include/asm/cpu.h | 2 + arch/x86/include/asm/msr-index.h | 13 ++++++ arch/x86/kernel/apic/apic.c | 44 +++++++++++++++++-- 5 files changed, 65 insertions(+), 5 deletions(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 426fa892d311..2bc11a61c4d0 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -3805,6 +3805,10 @@ nox2apic [X86-64,APIC] Do not enable x2APIC mode. + NOTE: this parameter will be ignored on systems with the + LEGACY_XAPIC_DISABLED bit set in the + IA32_XAPIC_DISABLE_STATUS MSR. + nps_mtm_hs_ctr= [KNL,ARC] This parameter sets the maximum duration, in cycles, each HW thread of the CTOP can run diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index f9920f1341c8..159c025ebb03 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -448,6 +448,11 @@ config X86_X2APIC This allows 32-bit apic IDs (so it can support very large systems), and accesses the local apic via MSRs not via mmio. + Some Intel systems circa 2022 and later are locked into x2APIC mode + and can not fall back to the legacy APIC modes if SGX or TDX are + enabled in the BIOS. They will be unable to boot without enabling + this option. + If you don't know what to do here, say N. config X86_MPPARSE @@ -1919,7 +1924,7 @@ endchoice config X86_SGX bool "Software Guard eXtensions (SGX)" - depends on X86_64 && CPU_SUP_INTEL + depends on X86_64 && CPU_SUP_INTEL && X86_X2APIC depends on CRYPTO=y depends on CRYPTO_SHA256=y select SRCU diff --git a/arch/x86/include/asm/cpu.h b/arch/x86/include/asm/cpu.h index 8cbf623f0ecf..b472ef76826a 100644 --- a/arch/x86/include/asm/cpu.h +++ b/arch/x86/include/asm/cpu.h @@ -94,4 +94,6 @@ static inline bool intel_cpu_signatures_match(unsigned int s1, unsigned int p1, return p1 & p2; } +extern u64 x86_read_arch_cap_msr(void); + #endif /* _ASM_X86_CPU_H */ diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h index 6674bdb096f3..1e086b37a307 100644 --- a/arch/x86/include/asm/msr-index.h +++ b/arch/x86/include/asm/msr-index.h @@ -155,6 +155,11 @@ * Return Stack Buffer Predictions. */ +#define ARCH_CAP_XAPIC_DISABLE BIT(21) /* + * IA32_XAPIC_DISABLE_STATUS MSR + * supported + */ + #define MSR_IA32_FLUSH_CMD 0x0000010b #define L1D_FLUSH BIT(0) /* * Writeback and invalidate the @@ -1054,4 +1059,12 @@ #define MSR_IA32_HW_FEEDBACK_PTR 0x17d0 #define MSR_IA32_HW_FEEDBACK_CONFIG 0x17d1 +/* x2APIC locked status */ +#define MSR_IA32_XAPIC_DISABLE_STATUS 0xBD +#define LEGACY_XAPIC_DISABLED BIT(0) /* + * x2APIC mode is locked and + * disabling x2APIC will cause + * a #GP + */ + #endif /* _ASM_X86_MSR_INDEX_H */ diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index 6d303d1d276c..c6876d3ea4b1 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c @@ -61,6 +61,7 @@ #include #include #include +#include unsigned int num_processors; @@ -1751,11 +1752,26 @@ EXPORT_SYMBOL_GPL(x2apic_mode); enum { X2APIC_OFF, - X2APIC_ON, X2APIC_DISABLED, + /* All states below here have X2APIC enabled */ + X2APIC_ON, + X2APIC_ON_LOCKED }; static int x2apic_state; +static bool x2apic_hw_locked(void) +{ + u64 ia32_cap; + u64 msr; + + ia32_cap = x86_read_arch_cap_msr(); + if (ia32_cap & ARCH_CAP_XAPIC_DISABLE) { + rdmsrl(MSR_IA32_XAPIC_DISABLE_STATUS, msr); + return (msr & LEGACY_XAPIC_DISABLED); + } + return false; +} + static void __x2apic_disable(void) { u64 msr; @@ -1793,6 +1809,10 @@ static int __init setup_nox2apic(char *str) apicid); return 0; } + if (x2apic_hw_locked()) { + pr_warn("APIC locked in x2apic mode, can't disable\n"); + return 0; + } pr_warn("x2apic already enabled.\n"); __x2apic_disable(); } @@ -1807,10 +1827,18 @@ early_param("nox2apic", setup_nox2apic); void x2apic_setup(void) { /* - * If x2apic is not in ON state, disable it if already enabled + * Try to make the AP's APIC state match that of the BSP, but if the + * BSP is unlocked and the AP is locked then there is a state mismatch. + * Warn about the mismatch in case a GP fault occurs due to a locked AP + * trying to be turned off. + */ + if (x2apic_state != X2APIC_ON_LOCKED && x2apic_hw_locked()) + pr_warn("x2apic lock mismatch between BSP and AP.\n"); + /* + * If x2apic is not in ON or LOCKED state, disable it if already enabled * from BIOS. */ - if (x2apic_state != X2APIC_ON) { + if (x2apic_state < X2APIC_ON) { __x2apic_disable(); return; } @@ -1831,6 +1859,11 @@ static __init void x2apic_disable(void) if (x2apic_id >= 255) panic("Cannot disable x2apic, id: %08x\n", x2apic_id); + if (x2apic_hw_locked()) { + pr_warn("Cannot disable locked x2apic, id: %08x\n", x2apic_id); + return; + } + __x2apic_disable(); register_lapic_address(mp_lapic_addr); } @@ -1889,7 +1922,10 @@ void __init check_x2apic(void) if (x2apic_enabled()) { pr_info("x2apic: enabled by BIOS, switching to x2apic ops\n"); x2apic_mode = 1; - x2apic_state = X2APIC_ON; + if (x2apic_hw_locked()) + x2apic_state = X2APIC_ON_LOCKED; + else + x2apic_state = X2APIC_ON; } else if (!boot_cpu_has(X86_FEATURE_X2APIC)) { x2apic_state = X2APIC_DISABLED; } From patchwork Wed Oct 19 08:33: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: 4838 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223705wrs; Wed, 19 Oct 2022 02:38:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7YG/gCiKuSTGbOoDcYvtYthPWs60DYcSRz1pVytxllbT9arzs+hvo4GrGe0++d00upoq83 X-Received: by 2002:a17:907:2c74:b0:78d:b3ae:8408 with SMTP id ib20-20020a1709072c7400b0078db3ae8408mr6032513ejc.172.1666172294998; Wed, 19 Oct 2022 02:38:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172294; cv=none; d=google.com; s=arc-20160816; b=a5xwxXeYMcx3MsajWvBe4vSzo5KMy6UPy6Ehy4oot+248H5fnEpHtpN/s2r9W/YK6t Su4TqwBJ7engC3Xls+K8eopkAz9I5Ynp37XNQxwpJddgRhkRToL40nifsRwZAsvLHc8j NrQF8il99EhmDUAmOdtUZVvVjnfR3/wKYRWZ0ZX+g8Aq5sa5Bj7RbxEEY8RCTCRm0vpF S/C1//e52vrqzPXW+8IqmeZRngXe6ztTm8Shk1MPkitSDf3WY19p6KuMrYQ7dKQfaJOH 8Pd46gRaMMyRran/c2cRGh991UIOJxnDueRk6allamfFcVbNoKIGkS6XPIToxGur3k9x 1nhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=G1e35DXQJqXbfULylnFzTSbfk+vTJgLZZ7QdIiRJDvI=; b=i1DG8Z5RRT8hV07oVKe6FfTPXsrucGH70E/q+OYBgcRaywJhDf4L79yd3qiOzuyj8H T2Z8Z6CLgCKWOfc+rDxUea1Mu/tIbv6dNMzqbQXR1dYxWRCbcCGvfw26o5FLMuObdzej DCRuhR/jOQ3srSKnvBVMzSGMhrVhyEyiIbrLZN2DL5QWFyYRovxYqldU+CDSVJ3KMC+r FvmH/zg70lK5tJqS+K3hxwoTWDaH1Ts2N2Uwfah6CK1khEOGAcfXQrtW56UMiNKR0afO NpBXFkAifnwo409ocDgLq9IoG2+gZzIcZ04ooqZxBiGETa2g3O31z3BNFJWFz4dm6KRJ DfJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LxVmLgTi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hr42-20020a1709073faa00b0078de51e658esi14824575ejc.208.2022.10.19.02.37.48; Wed, 19 Oct 2022 02:38: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=LxVmLgTi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233524AbiJSJ0E (ORCPT + 99 others); Wed, 19 Oct 2022 05:26:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233764AbiJSJYp (ORCPT ); Wed, 19 Oct 2022 05:24:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7441E09BE; Wed, 19 Oct 2022 02:11:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3AFD961874; Wed, 19 Oct 2022 09:09:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18E7AC433D6; Wed, 19 Oct 2022 09:09:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170542; bh=R9mXsIyShsVWJOH9MSgqLniCVDqACxw0AMWjzPQJhRE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LxVmLgTiKxL7WZvXqywOMilAus+0/BX3YrPVrAwSVtKvqTRp5Yh7rEOLeHcU7gHYS H8YTkJpj4tqxuxgfdxQoLwFDlz/oxiUVqazfdQJ8sMwKgpGV7/HGXBlgNv0wcatAJB jK5EjaMWWtXzQaHxVeU9zDFpqyjPWs9JPZ3/O9/o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert Hancock , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.0 694/862] net: axienet: Switch to 64-bit RX/TX statistics Date: Wed, 19 Oct 2022 10:33:01 +0200 Message-Id: <20221019083320.639353868@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108280481735617?= X-GMAIL-MSGID: =?utf-8?q?1747108280481735617?= From: Robert Hancock [ Upstream commit cb45a8bf4693965e89d115cd2c510f12bc127c37 ] The RX and TX byte/packet statistics in this driver could be overflowed relatively quickly on a 32-bit platform. Switch these stats to use the u64_stats infrastructure to avoid this. Signed-off-by: Robert Hancock Link: https://lore.kernel.org/r/20220829233901.3429419-1-robert.hancock@calian.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/xilinx/xilinx_axienet.h | 12 ++++++ .../net/ethernet/xilinx/xilinx_axienet_main.c | 37 +++++++++++++++++-- 2 files changed, 45 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet.h b/drivers/net/ethernet/xilinx/xilinx_axienet.h index f2e2261b4b7d..8ff4333de2ad 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet.h +++ b/drivers/net/ethernet/xilinx/xilinx_axienet.h @@ -402,6 +402,9 @@ struct axidma_bd { * @rx_bd_num: Size of RX buffer descriptor ring * @rx_bd_ci: Stores the index of the Rx buffer descriptor in the ring being * accessed currently. + * @rx_packets: RX packet count for statistics + * @rx_bytes: RX byte count for statistics + * @rx_stat_sync: Synchronization object for RX stats * @napi_tx: NAPI TX control structure * @tx_dma_cr: Nominal content of TX DMA control register * @tx_bd_v: Virtual address of the TX buffer descriptor ring @@ -411,6 +414,9 @@ struct axidma_bd { * complete. Only updated at runtime by TX NAPI poll. * @tx_bd_tail: Stores the index of the next Tx buffer descriptor in the ring * to be populated. + * @tx_packets: TX packet count for statistics + * @tx_bytes: TX byte count for statistics + * @tx_stat_sync: Synchronization object for TX stats * @dma_err_task: Work structure to process Axi DMA errors * @tx_irq: Axidma TX IRQ number * @rx_irq: Axidma RX IRQ number @@ -458,6 +464,9 @@ struct axienet_local { dma_addr_t rx_bd_p; u32 rx_bd_num; u32 rx_bd_ci; + u64_stats_t rx_packets; + u64_stats_t rx_bytes; + struct u64_stats_sync rx_stat_sync; struct napi_struct napi_tx; u32 tx_dma_cr; @@ -466,6 +475,9 @@ struct axienet_local { u32 tx_bd_num; u32 tx_bd_ci; u32 tx_bd_tail; + u64_stats_t tx_packets; + u64_stats_t tx_bytes; + struct u64_stats_sync tx_stat_sync; struct work_struct dma_err_task; diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c index 1760930ec0c4..9262988d26a3 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -752,8 +752,10 @@ static int axienet_tx_poll(struct napi_struct *napi, int budget) if (lp->tx_bd_ci >= lp->tx_bd_num) lp->tx_bd_ci %= lp->tx_bd_num; - ndev->stats.tx_packets += packets; - ndev->stats.tx_bytes += size; + u64_stats_update_begin(&lp->tx_stat_sync); + u64_stats_add(&lp->tx_packets, packets); + u64_stats_add(&lp->tx_bytes, size); + u64_stats_update_end(&lp->tx_stat_sync); /* Matches barrier in axienet_start_xmit */ smp_mb(); @@ -984,8 +986,10 @@ static int axienet_rx_poll(struct napi_struct *napi, int budget) cur_p = &lp->rx_bd_v[lp->rx_bd_ci]; } - lp->ndev->stats.rx_packets += packets; - lp->ndev->stats.rx_bytes += size; + u64_stats_update_begin(&lp->rx_stat_sync); + u64_stats_add(&lp->rx_packets, packets); + u64_stats_add(&lp->rx_bytes, size); + u64_stats_update_end(&lp->rx_stat_sync); if (tail_p) axienet_dma_out_addr(lp, XAXIDMA_RX_TDESC_OFFSET, tail_p); @@ -1292,10 +1296,32 @@ static int axienet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) return phylink_mii_ioctl(lp->phylink, rq, cmd); } +static void +axienet_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) +{ + struct axienet_local *lp = netdev_priv(dev); + unsigned int start; + + netdev_stats_to_stats64(stats, &dev->stats); + + do { + start = u64_stats_fetch_begin_irq(&lp->rx_stat_sync); + stats->rx_packets = u64_stats_read(&lp->rx_packets); + stats->rx_bytes = u64_stats_read(&lp->rx_bytes); + } while (u64_stats_fetch_retry_irq(&lp->rx_stat_sync, start)); + + do { + start = u64_stats_fetch_begin_irq(&lp->tx_stat_sync); + stats->tx_packets = u64_stats_read(&lp->tx_packets); + stats->tx_bytes = u64_stats_read(&lp->tx_bytes); + } while (u64_stats_fetch_retry_irq(&lp->tx_stat_sync, start)); +} + static const struct net_device_ops axienet_netdev_ops = { .ndo_open = axienet_open, .ndo_stop = axienet_stop, .ndo_start_xmit = axienet_start_xmit, + .ndo_get_stats64 = axienet_get_stats64, .ndo_change_mtu = axienet_change_mtu, .ndo_set_mac_address = netdev_set_mac_address, .ndo_validate_addr = eth_validate_addr, @@ -1850,6 +1876,9 @@ static int axienet_probe(struct platform_device *pdev) lp->rx_bd_num = RX_BD_NUM_DEFAULT; lp->tx_bd_num = TX_BD_NUM_DEFAULT; + u64_stats_init(&lp->rx_stat_sync); + u64_stats_init(&lp->tx_stat_sync); + netif_napi_add(ndev, &lp->napi_rx, axienet_rx_poll, NAPI_POLL_WEIGHT); netif_napi_add(ndev, &lp->napi_tx, axienet_tx_poll, NAPI_POLL_WEIGHT); From patchwork Wed Oct 19 08:33: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: 5184 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp263710wrs; Wed, 19 Oct 2022 04:18:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7pVOmtpV6Jbxsfp7hzGNxS0Knm0ZrukmW1w0sKs37fShoyVxc/iuFvOu3TeSgZYJxmjuhw X-Received: by 2002:a17:90b:1e4b:b0:20d:8cf0:1a3c with SMTP id pi11-20020a17090b1e4b00b0020d8cf01a3cmr9395062pjb.172.1666178316466; Wed, 19 Oct 2022 04:18:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178316; cv=none; d=google.com; s=arc-20160816; b=n7k9xcj3ZzN+sdJElmxHnrjoCQAaazGPnfYOfwVT+PsQAA4eydw9EtuHObWftZIS+Y Cg1tw9/CJkbs6ZUjaGmmIoeatpE/naNOFXh7lJQ6n0T38Cy9NCpwj4Zke0rhxjfpU5dv 5ViOvapIYm7K/k0lJYqXqIvDp0fTXq5oOLwcwbM+wd9gWso6/jIxtZezfLvNY4/XsGxO zENWdeCuj0v0CeBORfH35ubJjdF9Of3c1H5taLZSVJLRcS0B3ZeIeb1yD3yjnUoU6SMq FGiY2UirNmMFJs27UqahFxLdxi/dC+1ho1CBV8V4Gi/1rhdQY/L//OECvHBcD6XJmfyl 2+5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BYMNpoEQ7NvbPSF1yibyBNPhMaS2p0TyDYcsjJ1RzN8=; b=w+gOIBKal8iG/7MZcS+PGuOjb93iQ9lv65jktMOnFm99JeZzkuaI5r/iYbTcObfjez cggrzA316exyl3EK7bo7OAPWC+m2+XsHmocX5ciN0wPeKt0kn3XpUc1ftqKCXWbNyYhp wmb3PtJt4+nHPxqjTPyjYQU8iF6hNfhAjUgqDtTFBomydA+0m73nz5yQRsObll6wK1pp aV0C+FzTmvmzQ1q/sHFpiGsxX20dCHtC5wpNgokUdPG55cyubU/Vws6/aI93pD5mxan1 RG4zqnkFYJTGQe32NbuALCDqhJS56Ye/g2ioOtYz0pbfh6dwXT4efi4U2hw0+dFBDaai jcPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HVaRyJ4b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oj15-20020a17090b4d8f00b001f335a72172si27630667pjb.62.2022.10.19.04.18.15; Wed, 19 Oct 2022 04:18: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=HVaRyJ4b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234797AbiJSLCj (ORCPT + 99 others); Wed, 19 Oct 2022 07:02:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234827AbiJSLCW (ORCPT ); Wed, 19 Oct 2022 07:02:22 -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 6DCD0D2CEA; Wed, 19 Oct 2022 03:31: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 sin.source.kernel.org (Postfix) with ESMTPS id EA896CE219D; Wed, 19 Oct 2022 09:09:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7257C433D7; Wed, 19 Oct 2022 09:09:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170545; bh=xklVpIJmlttcbRUn9vRu+iL6LZXyO7Eb5rTig1bQAy4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HVaRyJ4bP0O7+a00/ITGSwNF8zCH6EJUAx/qljK0Yd4okQo9zvIHXAMk7eBWdtkJd 4F2aPa2N6nyxIXjkXogcUvARNMQRcRAT5qBxhE4mup6zvDUVoKYjuG9+lWSYYp9mOI awAtBjhqOj5D2E7kXlOz/ePACLYCaY9fqmCHeOW4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Richard Gobert , David Ahern , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.0 695/862] net-next: Fix IP_UNICAST_IF option behavior for connected sockets Date: Wed, 19 Oct 2022 10:33:02 +0200 Message-Id: <20221019083320.684858586@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114594429801905?= X-GMAIL-MSGID: =?utf-8?q?1747114594429801905?= From: Richard Gobert [ Upstream commit 0e4d354762cefd3e16b4cff8988ff276e45effc4 ] The IP_UNICAST_IF socket option is used to set the outgoing interface for outbound packets. The IP_UNICAST_IF socket option was added as it was needed by the Wine project, since no other existing option (SO_BINDTODEVICE socket option, IP_PKTINFO socket option or the bind function) provided the needed characteristics needed by the IP_UNICAST_IF socket option. [1] The IP_UNICAST_IF socket option works well for unconnected sockets, that is, the interface specified by the IP_UNICAST_IF socket option is taken into consideration in the route lookup process when a packet is being sent. However, for connected sockets, the outbound interface is chosen when connecting the socket, and in the route lookup process which is done when a packet is being sent, the interface specified by the IP_UNICAST_IF socket option is being ignored. This inconsistent behavior was reported and discussed in an issue opened on systemd's GitHub project [2]. Also, a bug report was submitted in the kernel's bugzilla [3]. To understand the problem in more detail, we can look at what happens for UDP packets over IPv4 (The same analysis was done separately in the referenced systemd issue). When a UDP packet is sent the udp_sendmsg function gets called and the following happens: 1. The oif member of the struct ipcm_cookie ipc (which stores the output interface of the packet) is initialized by the ipcm_init_sk function to inet->sk.sk_bound_dev_if (the device set by the SO_BINDTODEVICE socket option). 2. If the IP_PKTINFO socket option was set, the oif member gets overridden by the call to the ip_cmsg_send function. 3. If no output interface was selected yet, the interface specified by the IP_UNICAST_IF socket option is used. 4. If the socket is connected and no destination address is specified in the send function, the struct ipcm_cookie ipc is not taken into consideration and the cached route, that was calculated in the connect function is being used. Thus, for a connected socket, the IP_UNICAST_IF sockopt isn't taken into consideration. This patch corrects the behavior of the IP_UNICAST_IF socket option for connect()ed sockets by taking into consideration the IP_UNICAST_IF sockopt when connecting the socket. In order to avoid reconnecting the socket, this option is still ignored when applied on an already connected socket until connect() is called again by the Richard Gobert. Change the __ip4_datagram_connect function, which is called during socket connection, to take into consideration the interface set by the IP_UNICAST_IF socket option, in a similar way to what is done in the udp_sendmsg function. [1] https://lore.kernel.org/netdev/1328685717.4736.4.camel@edumazet-laptop/T/ [2] https://github.com/systemd/systemd/issues/11935#issuecomment-618691018 [3] https://bugzilla.kernel.org/show_bug.cgi?id=210255 Signed-off-by: Richard Gobert Reviewed-by: David Ahern Link: https://lore.kernel.org/r/20220829111554.GA1771@debian Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/ipv4/datagram.c | 2 ++ tools/testing/selftests/net/fcnal-test.sh | 30 +++++++++++++++++++++++ tools/testing/selftests/net/nettest.c | 16 ++++++++++-- 3 files changed, 46 insertions(+), 2 deletions(-) diff --git a/net/ipv4/datagram.c b/net/ipv4/datagram.c index ffd57523331f..405a8c2aea64 100644 --- a/net/ipv4/datagram.c +++ b/net/ipv4/datagram.c @@ -42,6 +42,8 @@ int __ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len oif = inet->mc_index; if (!saddr) saddr = inet->mc_addr; + } else if (!oif) { + oif = inet->uc_index; } fl4 = &inet->cork.fl.u.ip4; rt = ip_route_connect(fl4, usin->sin_addr.s_addr, saddr, oif, diff --git a/tools/testing/selftests/net/fcnal-test.sh b/tools/testing/selftests/net/fcnal-test.sh index 03b586760164..31c3b6ebd388 100755 --- a/tools/testing/selftests/net/fcnal-test.sh +++ b/tools/testing/selftests/net/fcnal-test.sh @@ -1466,6 +1466,13 @@ ipv4_udp_novrf() run_cmd nettest -D -r ${a} -d ${NSA_DEV} -S -0 ${NSA_IP} log_test_addr ${a} $? 0 "Client, device bind via IP_UNICAST_IF" + log_start + run_cmd_nsb nettest -D -s & + sleep 1 + run_cmd nettest -D -r ${a} -d ${NSA_DEV} -S -0 ${NSA_IP} -U + log_test_addr ${a} $? 0 "Client, device bind via IP_UNICAST_IF, with connect()" + + log_start show_hint "Should fail 'Connection refused'" run_cmd nettest -D -r ${a} @@ -1525,6 +1532,13 @@ ipv4_udp_novrf() run_cmd nettest -D -d ${NSA_DEV} -S -r ${a} log_test_addr ${a} $? 0 "Global server, device client via IP_UNICAST_IF, local connection" + log_start + run_cmd nettest -s -D & + sleep 1 + run_cmd nettest -D -d ${NSA_DEV} -S -r ${a} -U + log_test_addr ${a} $? 0 "Global server, device client via IP_UNICAST_IF, local connection, with connect()" + + # IPv4 with device bind has really weird behavior - it overrides the # fib lookup, generates an rtable and tries to send the packet. This # causes failures for local traffic at different places @@ -1550,6 +1564,15 @@ ipv4_udp_novrf() sleep 1 run_cmd nettest -D -r ${a} -d ${NSA_DEV} -S log_test_addr ${a} $? 1 "Global server, device client via IP_UNICAST_IF, local connection" + + log_start + show_hint "Should fail since addresses on loopback are out of device scope" + run_cmd nettest -D -s & + sleep 1 + run_cmd nettest -D -r ${a} -d ${NSA_DEV} -S -U + log_test_addr ${a} $? 1 "Global server, device client via IP_UNICAST_IF, local connection, with connect()" + + done a=${NSA_IP} @@ -3157,6 +3180,13 @@ ipv6_udp_novrf() sleep 1 run_cmd nettest -6 -D -r ${a} -d ${NSA_DEV} -S log_test_addr ${a} $? 1 "Global server, device client via IP_UNICAST_IF, local connection" + + log_start + show_hint "Should fail 'No route to host' since addresses on loopback are out of device scope" + run_cmd nettest -6 -D -s & + sleep 1 + run_cmd nettest -6 -D -r ${a} -d ${NSA_DEV} -S -U + log_test_addr ${a} $? 1 "Global server, device client via IP_UNICAST_IF, local connection, with connect()" done a=${NSA_IP6} diff --git a/tools/testing/selftests/net/nettest.c b/tools/testing/selftests/net/nettest.c index d9a6fd2cd9d3..7900fa98eccb 100644 --- a/tools/testing/selftests/net/nettest.c +++ b/tools/testing/selftests/net/nettest.c @@ -127,6 +127,9 @@ struct sock_args { /* ESP in UDP encap test */ int use_xfrm; + + /* use send() and connect() instead of sendto */ + int datagram_connect; }; static int server_mode; @@ -979,6 +982,11 @@ static int send_msg(int sd, void *addr, socklen_t alen, struct sock_args *args) log_err_errno("write failed sending msg to peer"); return 1; } + } else if (args->datagram_connect) { + if (send(sd, msg, msglen, 0) < 0) { + log_err_errno("send failed sending msg to peer"); + return 1; + } } else if (args->ifindex && args->use_cmsg) { if (send_msg_cmsg(sd, addr, alen, args->ifindex, args->version)) return 1; @@ -1659,7 +1667,7 @@ static int connectsock(void *addr, socklen_t alen, struct sock_args *args) if (args->has_local_ip && bind_socket(sd, args)) goto err; - if (args->type != SOCK_STREAM) + if (args->type != SOCK_STREAM && !args->datagram_connect) goto out; if (args->password && tcp_md5sig(sd, addr, alen, args)) @@ -1854,7 +1862,7 @@ static int ipc_parent(int cpid, int fd, struct sock_args *args) return client_status; } -#define GETOPT_STR "sr:l:c:p:t:g:P:DRn:M:X:m:d:I:BN:O:SCi6xL:0:1:2:3:Fbqf" +#define GETOPT_STR "sr:l:c:p:t:g:P:DRn:M:X:m:d:I:BN:O:SUCi6xL:0:1:2:3:Fbqf" #define OPT_FORCE_BIND_KEY_IFINDEX 1001 #define OPT_NO_BIND_KEY_IFINDEX 1002 @@ -1891,6 +1899,7 @@ static void print_usage(char *prog) " -I dev bind socket to given device name - server mode\n" " -S use setsockopt (IP_UNICAST_IF or IP_MULTICAST_IF)\n" " to set device binding\n" + " -U Use connect() and send() for datagram sockets\n" " -f bind socket with the IP[V6]_FREEBIND option\n" " -C use cmsg and IP_PKTINFO to specify device binding\n" "\n" @@ -2074,6 +2083,9 @@ int main(int argc, char *argv[]) case 'x': args.use_xfrm = 1; break; + case 'U': + args.datagram_connect = 1; + break; default: print_usage(argv[0]); return 1; From patchwork Wed Oct 19 08:33: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: 5162 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp253772wrs; Wed, 19 Oct 2022 03:58:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5gVH+4UxbUwzuDfEiuoUwRN9FOvtfUZqO0+BEda3VXDmkgIddGYVsVhF/cyBOw9d282r59 X-Received: by 2002:a17:903:22d2:b0:17f:7dea:985f with SMTP id y18-20020a17090322d200b0017f7dea985fmr7916231plg.68.1666177091973; Wed, 19 Oct 2022 03:58:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666177091; cv=none; d=google.com; s=arc-20160816; b=U2ebrRtJZ3obmChFk9EWRVlzkrvwvNhl9PM2BuniY1nVw47E4WEhbL/a48ZxkjFkfV BUw1uAyLggpSXs+R4IKqwq8Ssw/3Dz0981hYTU33JjK0KvyCUenc+YmB9nsDYyQAZ+ty LoiIB4Ivjw78aMTtjWmHxLFhqBC67gFqGLxIQu/nYTHEOZQKyEuEpgPzMWqs0PdDetqe lfmnX3GypUPi2SX5k2vzDJUAKZBcnFpK7wiNCGxZ96cRm1isKiLPVUoVCpouMwoWqGPy mxi/bMHs+E/5q7McIwm3F95PT9a0CDDIsPhv+KVxrzkgLgS8seEyVpn09jP+JsalzDmF VA1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9R3SVjxd/uFQX/hq2iVgj/y4Cke6BXejPQ59Zwficek=; b=JpFcgvdo7ssdKcBhLIhV1MTi+58+iz+I50AwbFEhhXJeBs5Xt4FI6dcN3HeWK2M2xh rb0uJZGphka4zGqpQUHkmX0b7s5X/Uj7HRalP336RVZu0hxX3KD8yOckRX69CIunvwYP MNjzxKkxwaY4cxkQiIr2fcot2kRyq5oEIJOE/YMswl2VWdc4vHVtKOaFyt00xbSlcwXX HaGfDCZW/bE8c6EW0GWdh+bYdz/u2WOt2FLEK3Wmn/9Gj6x+cDjXN0h+16yFvxT2vlnf CWqWHD540G7SUusJVka5T3tSVIqRPETAZMiWaUEhCggkg22XfzwJUsaaY4hk4P1OtQpK eldQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=P33CsgQr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c19-20020a63ea13000000b00434dfe7b75esi16594042pgi.223.2022.10.19.03.57.58; Wed, 19 Oct 2022 03:58: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=P33CsgQr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234718AbiJSK5V (ORCPT + 99 others); Wed, 19 Oct 2022 06:57:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234710AbiJSK43 (ORCPT ); Wed, 19 Oct 2022 06:56: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 DBCBD4BD03; Wed, 19 Oct 2022 03:27: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 16819B824A4; Wed, 19 Oct 2022 09:09:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80D5FC433D6; Wed, 19 Oct 2022 09:09:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170547; bh=0yRnkpEfxS7tWFboF4T+L+HG5P/SvlF22wbvGiSDb4M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P33CsgQrc1pEfq2TT84O8Yet7B/OrLa3r2QhN/O1xB9cEPA596Ajw4n8x2A1OFUhF oH6rxeB1fk09M4mdO8vi8AUnJxf2MAeThamxsOUi/5JtcWqu0w7BLrWNwzSes1MZXk pVoSnROtb8yXKomKaWbu4r4xdP5r4I5OSb2EVaCs= 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 6.0 696/862] xfrm: Update ipcomp_scratches with NULL when freed Date: Wed, 19 Oct 2022 10:33:03 +0200 Message-Id: <20221019083320.733613690@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747113310237672085?= X-GMAIL-MSGID: =?utf-8?q?1747113310237672085?= 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 cb40ff0ff28d..92ad336a83ab 100644 --- a/net/xfrm/xfrm_ipcomp.c +++ b/net/xfrm/xfrm_ipcomp.c @@ -203,6 +203,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 Wed Oct 19 08:33: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: 4845 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223798wrs; Wed, 19 Oct 2022 02:38:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6kjF/OhQHJyIQ8YJPHbOZx1gRPiTXdH8hzzfcwLsWv86XW8C056u8GS3mCMF46uzU/gO4Z X-Received: by 2002:a17:907:7b86:b0:78d:cb21:da0c with SMTP id ne6-20020a1709077b8600b0078dcb21da0cmr6144396ejc.24.1666172311115; Wed, 19 Oct 2022 02:38:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172311; cv=none; d=google.com; s=arc-20160816; b=RZCEy0xP1B9vpddxVT8SWpF5MJFl7irvDCGWaPhFGECL+H8/XrCo9tBriJr0wXXVta 28yydpBYXwDtCD8VuW6jbnXqR7nWh04ZW1l6Lx3h/jA+kc8ndkYlPh8ay9C01Rk1Pf9B fGlI+KFQ/Z3WK2hhIVfO8N0RSBzKUox5YMRIp+lz9EPq03TPlo8JqhLVMLZ0lLqxbjkU 3dchQ26iHipdRxutDBQimjxcrl98ltqajXNtHLTpdS9J45hR4D/Dng4Nj1rnjRBcyy6H Og1aQZ0enARvZVAY0/fwivmDHl0MyYMyVqiutK/KAbER0M/0v0q3Hfwto9HZzK2TQutN 5xBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=O8QzU4wOugLM2c+UwnV1t3hcUYd1ETRM6lFKrcTpOmo=; b=ebcYzhZbO9wBEkRnPRAOJ/ibXlyQS4S666CT/cXex5trMfuvrZQbxiRGcWudgWU8Tj 0zi7MAJzzfwonuSXElrshiHRS8McGhEpKpxS1qmwgLFBMrar4gNqzNr2+xcLFYcDVKTo DTpLIcR7clkOWQw2UlrTmluQWdCWbjSNKgSk6/35Er9jp9WAb2c78+NkY4MjesBHU3kk ukvkjiqujF/jcHJAeja486BI78S370H6ortPnHDbZpFUb1IQIZKgxvedr/3/bM2O/Ww4 qlP/hR3jDW8ucGAZ27FoOE/ZzDTAOcrhcZi3nZD64SfcqcBNsUqkqMHPDt3aGDKWziK7 jsAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UaC9FGlS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t11-20020aa7d4cb000000b0044d7a93e44dsi12446052edr.579.2022.10.19.02.38.06; Wed, 19 Oct 2022 02:38: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=UaC9FGlS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233484AbiJSJ1E (ORCPT + 99 others); Wed, 19 Oct 2022 05:27:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233485AbiJSJZw (ORCPT ); Wed, 19 Oct 2022 05:25: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 BC202E4E43; Wed, 19 Oct 2022 02:11: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 1492661800; Wed, 19 Oct 2022 09:09:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F2F4C433D7; Wed, 19 Oct 2022 09:09:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170550; bh=giegFir8SL6JfqRM8O19b4x4heEB9JoQAO77iyXbpSQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UaC9FGlSUUTbkFPbzs3ykr7y8jvcdk9nV9TWCRlfGl1g8qU4MnRUzcIVD8nevtCtY AiQhVvUHF+sGeQO6qcA0lT2LzEwT/Vt1o9dM41LCX6yVqm+itTWVAOSeMD5tsLuaW3 u59a7hp8RRSrrhLT+6jP4oBWuVhl6hXc0JcTSMsM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Manikanta Pubbisetty , Kalle Valo , Sasha Levin Subject: [PATCH 6.0 697/862] wifi: ath11k: Register shutdown handler for WCN6750 Date: Wed, 19 Oct 2022 10:33:04 +0200 Message-Id: <20221019083320.774950987@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108297688519718?= X-GMAIL-MSGID: =?utf-8?q?1747108297688519718?= From: Manikanta Pubbisetty [ Upstream commit ac41c2b642b136a1e633379fcb87a9db0ee07f5b ] When the system shuts down, SMMU driver will be stopped and will not assist in IOVA translations. SMMU driver expects all of its consumers to shutdown before shutting down itself. WCN6750 being one of the consumer device should not perform any DMA operations after the SMMU has shutdown which will otherwise result in SMMU faults. SMMU driver will call the shutdown() callback of all its consumer devices and the consumers shall stop further DMA activity after the invocation of their respective shutdown() callbacks. Register the shutdown() callback to the platform core for WCN6750. Change will not impact other AHB ath11k devices. Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1 Signed-off-by: Manikanta Pubbisetty Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220720134710.15523-1-quic_mpubbise@quicinc.com Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath11k/ahb.c | 58 ++++++++++++++++++++------ drivers/net/wireless/ath/ath11k/core.c | 2 + 2 files changed, 47 insertions(+), 13 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/ahb.c b/drivers/net/wireless/ath/ath11k/ahb.c index c47414710138..911eee9646a4 100644 --- a/drivers/net/wireless/ath/ath11k/ahb.c +++ b/drivers/net/wireless/ath/ath11k/ahb.c @@ -1088,20 +1088,10 @@ static int ath11k_ahb_probe(struct platform_device *pdev) return ret; } -static int ath11k_ahb_remove(struct platform_device *pdev) +static void ath11k_ahb_remove_prepare(struct ath11k_base *ab) { - struct ath11k_base *ab = platform_get_drvdata(pdev); unsigned long left; - if (test_bit(ATH11K_FLAG_QMI_FAIL, &ab->dev_flags)) { - ath11k_ahb_power_down(ab); - ath11k_debugfs_soc_destroy(ab); - ath11k_qmi_deinit_service(ab); - goto qmi_fail; - } - - reinit_completion(&ab->driver_recovery); - if (test_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags)) { left = wait_for_completion_timeout(&ab->driver_recovery, ATH11K_AHB_RECOVERY_TIMEOUT); @@ -1111,19 +1101,60 @@ static int ath11k_ahb_remove(struct platform_device *pdev) set_bit(ATH11K_FLAG_UNREGISTERING, &ab->dev_flags); cancel_work_sync(&ab->restart_work); + cancel_work_sync(&ab->qmi.event_work); +} + +static void ath11k_ahb_free_resources(struct ath11k_base *ab) +{ + struct platform_device *pdev = ab->pdev; - ath11k_core_deinit(ab); -qmi_fail: ath11k_ahb_free_irq(ab); ath11k_hal_srng_deinit(ab); ath11k_ahb_fw_resource_deinit(ab); ath11k_ce_free_pipes(ab); ath11k_core_free(ab); platform_set_drvdata(pdev, NULL); +} + +static int ath11k_ahb_remove(struct platform_device *pdev) +{ + struct ath11k_base *ab = platform_get_drvdata(pdev); + + if (test_bit(ATH11K_FLAG_QMI_FAIL, &ab->dev_flags)) { + ath11k_ahb_power_down(ab); + ath11k_debugfs_soc_destroy(ab); + ath11k_qmi_deinit_service(ab); + goto qmi_fail; + } + + ath11k_ahb_remove_prepare(ab); + ath11k_core_deinit(ab); + +qmi_fail: + ath11k_ahb_free_resources(ab); return 0; } +static void ath11k_ahb_shutdown(struct platform_device *pdev) +{ + struct ath11k_base *ab = platform_get_drvdata(pdev); + + /* platform shutdown() & remove() are mutually exclusive. + * remove() is invoked during rmmod & shutdown() during + * system reboot/shutdown. + */ + ath11k_ahb_remove_prepare(ab); + + if (!(test_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags))) + goto free_resources; + + ath11k_core_deinit(ab); + +free_resources: + ath11k_ahb_free_resources(ab); +} + static struct platform_driver ath11k_ahb_driver = { .driver = { .name = "ath11k", @@ -1131,6 +1162,7 @@ static struct platform_driver ath11k_ahb_driver = { }, .probe = ath11k_ahb_probe, .remove = ath11k_ahb_remove, + .shutdown = ath11k_ahb_shutdown, }; static int ath11k_ahb_init(void) diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/ath/ath11k/core.c index c3e9e4f7bc24..9df6aaae8a44 100644 --- a/drivers/net/wireless/ath/ath11k/core.c +++ b/drivers/net/wireless/ath/ath11k/core.c @@ -1563,6 +1563,8 @@ static void ath11k_core_pre_reconfigure_recovery(struct ath11k_base *ab) wake_up(&ab->wmi_ab.tx_credits_wq); wake_up(&ab->peer_mapping_wq); + + reinit_completion(&ab->driver_recovery); } static void ath11k_core_post_reconfigure_recovery(struct ath11k_base *ab) From patchwork Wed Oct 19 08:33: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: 5151 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp253471wrs; Wed, 19 Oct 2022 03:57:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM42XNh4GLu0H4o27NhPp9K1XkrX5xXa/XlDxuNI6RigBz5SzY4/4UtxaU0doPjnAAkzF799 X-Received: by 2002:aa7:da03:0:b0:458:e117:28d8 with SMTP id r3-20020aa7da03000000b00458e11728d8mr6805695eds.387.1666177037854; Wed, 19 Oct 2022 03:57:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666177037; cv=none; d=google.com; s=arc-20160816; b=IISe0TQqpoPmle0Berkli7aJUTh9eM22ZYfXsyqOzrjam/pQNWDwqkrhJLj48cQPOj Y4GphgjrEaFBIJF6YC7MeUst1SOZC7zrNf0E2jVoOHdfy+Et1QeyvEMzPZaXkml/GYDa YFEbrMW6Tw6yQzfjIX/TUbWOzNkk557gJuTefoslXdBiEIPLRIWELz0hqMGterPbeOLo i4fqA3b8lLPxFJA9EgRwgArqD3DLYd3/+ZsuP53AW/ORodwPCtS0L3WoAN1Goo78ka8D 6Rtuk5dorKEl/SQ19xqQr3crlqK3/ehe1qpXYECa3ad9vVBQlD3bRW2TvEfhREbP4GLL Fnew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Fet8feqtE+ttmxPjGOKOnMdhMPUaOEnZi4Do4BdkLVE=; b=T63Sj9C+fY2NERiowa3t4Ww1HFBLXLGrMpaJV6jj4JOchExWsdcsi+8YaGueGGhwJV sxfwmJ4Vk4VJNc+waYKrXKdnMCKbmgPtdZb3nIg6LJhO/QdGbOBU1QZoM55QMmhKIihz xzUAIh0XDD0fatSGgXmjywBLEi8p3qKt74PhMSwbjZynPvEjrVk4DM7kHsbMYEMsZmY1 9cGk1qxYVUbsnrW2D19FDQt83Owx46Fzvggm03by8zjdQ+SU/YHQGlygDFZO/xyHeC6R ZuHebYLfZZ77CrwzqysmX29KtrmvH+R8GqMkziMgLmjklPELVzfwpURsTdep1/0cb3E8 O05g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yBy0Aa6m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g15-20020a1709065d0f00b007306ac0faa0si15018077ejt.615.2022.10.19.03.56.53; Wed, 19 Oct 2022 03:57: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=yBy0Aa6m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234276AbiJSK4a (ORCPT + 99 others); Wed, 19 Oct 2022 06:56:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233665AbiJSKzj (ORCPT ); Wed, 19 Oct 2022 06:55: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 4BB96165520; Wed, 19 Oct 2022 03:27: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 5C541B824AE; Wed, 19 Oct 2022 09:09:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA1B3C433D7; Wed, 19 Oct 2022 09:09:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170553; bh=Rsz9rKTGJKYtTSkNCLrjg0+4EQ57GBD6604qCTdupwE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yBy0Aa6m3OI+slWiVJKq01i7kNtnqE/Bx2HnPC9648vZ4rVrs+u/IeHEzanUcpNhr TtOqT6fiy6af3vnHhxD/20NTl7r0YgIToff4ciern2HtRamiOUMo+pE87QJ/s92sTB OFbNc8ZpMx+wZkcm9+cGU5bp3yt+ggCVR9Kpn1gc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zong-Zhe Yang , Ping-Ke Shih , Kalle Valo , Sasha Levin Subject: [PATCH 6.0 698/862] rtw89: ser: leave lps with mutex Date: Wed, 19 Oct 2022 10:33:05 +0200 Message-Id: <20221019083320.822897769@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747113253959004048?= X-GMAIL-MSGID: =?utf-8?q?1747113253959004048?= From: Zong-Zhe Yang [ Upstream commit 8676031bae1c91037d06341214f4150b33707c68 ] Calling rtw89_leave_lps() should hold rtwdev::mutex. So, fix it. Signed-off-by: Zong-Zhe Yang Signed-off-by: Ping-Ke Shih Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220704023453.19935-5-pkshih@realtek.com Signed-off-by: Sasha Levin --- drivers/net/wireless/realtek/rtw89/ser.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/wireless/realtek/rtw89/ser.c b/drivers/net/wireless/realtek/rtw89/ser.c index 726223f25dc6..7240364e8f7d 100644 --- a/drivers/net/wireless/realtek/rtw89/ser.c +++ b/drivers/net/wireless/realtek/rtw89/ser.c @@ -152,7 +152,10 @@ static void ser_state_run(struct rtw89_ser *ser, u8 evt) rtw89_debug(rtwdev, RTW89_DBG_SER, "ser: %s receive %s\n", ser_st_name(ser), ser_ev_name(ser, evt)); + mutex_lock(&rtwdev->mutex); rtw89_leave_lps(rtwdev); + mutex_unlock(&rtwdev->mutex); + ser->st_tbl[ser->state].st_func(ser, evt); } From patchwork Wed Oct 19 08:33: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: 4841 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223751wrs; Wed, 19 Oct 2022 02:38:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5RHQ/oikNijHCQ850yjfmw+b6EAl2npJomP4kazui5RGAIuPRSOFCV7YhtjuMGg5GbwgMt X-Received: by 2002:a17:902:d544:b0:17d:318a:adf7 with SMTP id z4-20020a170902d54400b0017d318aadf7mr7741737plf.148.1666172302362; Wed, 19 Oct 2022 02:38:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172302; cv=none; d=google.com; s=arc-20160816; b=Z/CceJT9uLcJcRL0qgMZCTe7P86YhaNt12iqKT1WVcnJaKCMQxwUreZUBFRQQ1w4d8 gb1xtaJdN54ZrCp8nBF8lCcWQdNwRO6F7+tAdL9VqUpF1fwWlcdJDRUUAX8JlDXeyejR GMnh3jdAH2Updh9jOdrsDwTKvun6K8VAu9sdf9+wA4zFqiBKwAjCKcRNzypU1i4L4TQH QePGQ2OKUkYmqei3gBMCxmQ+lhe+Fo3V28fGC9twVbwrIqwSD48usP3DMZwKFNK9F0kC Hr0M1fpf+c16xBC0taBMUyWfSOomuHjzcz0cTceVQQtiA4tqhBIt1Zknuhrpaoto5Gh4 8pEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=h6Af/bWMPTPTczassFg0BYd5wZxN+IW7rU8K3m2EOMk=; b=1B8nbMAY9RHSTfLxyvliZFKAyirEjFzPSCA4NY5R36PD5bExSxqCzQ9gXR6kYbGdjV hO0Jc7us8w8pzZbxqJZ0+pMMJxzjy7jkHfcD7CX89+Tm0CKeA+BUKqws4bDXM7ZWVH8I BoQJLOX5ASvGeLNLHbGM2OyN3TUkF7LHDzd81VRC268tYvFsR0zETS2jDGxCcuIIBXfL G+hzTMxkC1uzdBDabeYcq3qVp2YJ/J57NKGyp11s0f7n9aMw8vSVn7OwKsiXksV+jBPB WWG90v0tZcKajZ+9w9JmBN5LYEXgQnRorNFJlL1bz6k687eRRbarkSKSuA6DfBPaMxkt AJJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XQeRc8gN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m10-20020a638c0a000000b0045650af278bsi22342019pgd.817.2022.10.19.02.38.09; Wed, 19 Oct 2022 02:38: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=XQeRc8gN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233518AbiJSJ1R (ORCPT + 99 others); Wed, 19 Oct 2022 05:27:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233510AbiJSJ0B (ORCPT ); Wed, 19 Oct 2022 05:26:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A014E4E6F; Wed, 19 Oct 2022 02:11: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 57F3261884; Wed, 19 Oct 2022 09:09:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68ECDC433D6; Wed, 19 Oct 2022 09:09:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170555; bh=5JkOB+HsRfMjF6JdEuT30fBWd/b3+QMJryRmJUvtxG8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XQeRc8gNnkWmDxKsFpvk5BxtBFOLgjfE07Y7RVAeMEe5WLV2Kvc/zL71LbAao1P2H Y5Uje9JNtvUXbcvH3/3qjzTH5MMMKD+BFair7wDyh7BWm8DC4peTkqEAUmzqmhxb6n QltuGxCPhllbDvQPqJtA4tCsyCYRWguaAtRelytk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sergei Antonov , Andrew Lunn , Paolo Abeni , Sasha Levin Subject: [PATCH 6.0 699/862] net: ftmac100: fix endianness-related issues from sparse Date: Wed, 19 Oct 2022 10:33:06 +0200 Message-Id: <20221019083320.869376559@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108288272070252?= X-GMAIL-MSGID: =?utf-8?q?1747108288272070252?= From: Sergei Antonov [ Upstream commit 9df696b3b3a4c96c3219eb87c7bf03fb50e490b8 ] Sparse found a number of endianness-related issues of these kinds: .../ftmac100.c:192:32: warning: restricted __le32 degrades to integer .../ftmac100.c:208:23: warning: incorrect type in assignment (different base types) .../ftmac100.c:208:23: expected unsigned int rxdes0 .../ftmac100.c:208:23: got restricted __le32 [usertype] .../ftmac100.c:249:23: warning: invalid assignment: &= .../ftmac100.c:249:23: left side has type unsigned int .../ftmac100.c:249:23: right side has type restricted __le32 .../ftmac100.c:527:16: warning: cast to restricted __le32 Change type of some fields from 'unsigned int' to '__le32' to fix it. Signed-off-by: Sergei Antonov Reviewed-by: Andrew Lunn Link: https://lore.kernel.org/r/20220902113749.1408562-1-saproj@gmail.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- drivers/net/ethernet/faraday/ftmac100.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/faraday/ftmac100.h b/drivers/net/ethernet/faraday/ftmac100.h index fe986f1673fc..8af32f9070f4 100644 --- a/drivers/net/ethernet/faraday/ftmac100.h +++ b/drivers/net/ethernet/faraday/ftmac100.h @@ -122,9 +122,9 @@ * Transmit descriptor, aligned to 16 bytes */ struct ftmac100_txdes { - unsigned int txdes0; - unsigned int txdes1; - unsigned int txdes2; /* TXBUF_BADR */ + __le32 txdes0; + __le32 txdes1; + __le32 txdes2; /* TXBUF_BADR */ unsigned int txdes3; /* not used by HW */ } __attribute__ ((aligned(16))); @@ -143,9 +143,9 @@ struct ftmac100_txdes { * Receive descriptor, aligned to 16 bytes */ struct ftmac100_rxdes { - unsigned int rxdes0; - unsigned int rxdes1; - unsigned int rxdes2; /* RXBUF_BADR */ + __le32 rxdes0; + __le32 rxdes1; + __le32 rxdes2; /* RXBUF_BADR */ unsigned int rxdes3; /* not used by HW */ } __attribute__ ((aligned(16))); From patchwork Wed Oct 19 08:33: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: 4847 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223816wrs; Wed, 19 Oct 2022 02:38:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6zZkwzrNLhkvOBMRXLOkGbUDYprgVQy0wwFv4+tQ41cR6LIosQlEfNYfXMzfgSQJzyCr6o X-Received: by 2002:a17:907:a4e:b0:77d:94d:8148 with SMTP id be14-20020a1709070a4e00b0077d094d8148mr5764368ejc.607.1666172314483; Wed, 19 Oct 2022 02:38:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172314; cv=none; d=google.com; s=arc-20160816; b=keQQuHHgrMpHQ3mPu3uv6EFzrGUXB8AU8nuaUgTyc0OsyN6BGzLDCcNqihld451+qB hyEvfLvJLHBQBnRoBN1pYNp6nagvqrPMZWUodjzHV5Jmj6udv1s1tL7+KPiLu8ZVvC/B L1SySeIAO0hCHxWC3fkRBRpTfmgkW9d2Z/QGMazvjNNixte1MJp9ib3EaJFnKyvr/iJb PuCW+Mq+eOO0ZuQyJIjxZbr2q9DZYW+eulZZ1paxGTsbCxGWaG/z2dzgvS+Mbbv41z6A Z9hEe0P6aijmcADz1CZHrAJ4kvAmuhSgdJjvQfIVxb7stzc4yvLYQxHlG0uoGLetDxlO buNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YkyDIg43tr/8915PWPN5OT2IcMr5LQkAnkOwlu1rj5M=; b=QDR3hGv+zo3yzFAR9bouoAzcJKS12qDlUB9LACFjnKrpobdzWQH5gRLJbBf7XNSh8a FKOLqCV1R/xWezl++rZccqgDMndKA4CNtNHFfEhLmw0tkdee5IY+/O7KMfg5NsC11eU+ Zy7Z2o0T51C+OkfauGKWQyCmYjDU3R6sNUAAjmhGVOgEljs3/OR8rxxXivMJSanV3Q24 XFb8IOUGgSIqT9cqjLbYf8HnExS1d97iv5Qo6A3eXBOOrQ5QfFEDpicS4FixWn0OAZKI wU+KhhHehkblDqYzeTdWjds/QVmqhDT0RTybz5cuxsLLXskXX3YCuGA+He3bWNaEuBKr BTSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iYm1VPf2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dn3-20020a17090794c300b007806a130086si13097207ejc.302.2022.10.19.02.38.09; Wed, 19 Oct 2022 02:38:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iYm1VPf2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233542AbiJSJ1V (ORCPT + 99 others); Wed, 19 Oct 2022 05:27:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233523AbiJSJ0E (ORCPT ); Wed, 19 Oct 2022 05:26:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32224E52C2; Wed, 19 Oct 2022 02:11: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 1E06161888; Wed, 19 Oct 2022 09:09:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C1B1C433B5; Wed, 19 Oct 2022 09:09:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170558; bh=eQuQU7YwXmUE8zmXo83zt+GNgUpqtZ8BhxffiEe7Qfk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iYm1VPf22yiUdyQ6sU80oCxwRGyUYoPTFW7JgQKVo/1IqgQnEA56S2RkKxrkVKvQB SnJDNc+bGlixn8cFLSVCTWzLTtjZS35eCGXgxkQNZZh6r/cQ4+5u8r8kx3WU80+MqX U0pVEPhCJsZ2swZOJD16WQpCeMlgI/hGQsA/sT0o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michal Jaron , Mateusz Palczewski , Konrad Jankowski , Tony Nguyen , Sasha Levin Subject: [PATCH 6.0 700/862] iavf: Fix race between iavf_close and iavf_reset_task Date: Wed, 19 Oct 2022 10:33:07 +0200 Message-Id: <20221019083320.921656361@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108300956914349?= X-GMAIL-MSGID: =?utf-8?q?1747108300956914349?= From: Michal Jaron [ Upstream commit 11c12adcbc1598d91e73ab6ddfa41d25a01478ed ] During stress tests with adding VF to namespace and changing vf's trust there was a race between iavf_reset_task and iavf_close. Sometimes when IAVF_FLAG_AQ_DISABLE_QUEUES from iavf_close was sent to PF after reset and before IAVF_AQ_GET_CONFIG was sent then PF returns error IAVF_NOT_SUPPORTED to disable queues request and following requests. There is need to get_config before other aq_required will be send but iavf_close clears all flags, if get_config was not sent before iavf_close, then it will not be send at all. In case when IAVF_FLAG_AQ_GET_OFFLOAD_VLAN_V2_CAPS was sent before IAVF_FLAG_AQ_DISABLE_QUEUES then there was rtnl_lock deadlock between iavf_close and iavf_adminq_task until iavf_close timeouts and disable queues was sent after iavf_close ends. There was also a problem with sending delete/add filters. Sometimes when filters was not yet added to PF and in iavf_close all filters was set to remove there might be a try to remove nonexistent filters on PF. Add aq_required_tmp to save aq_required flags and send them after disable_queues will be handled. Clear flags given to iavf_down different than IAVF_FLAG_AQ_GET_CONFIG as this flag is necessary to sent other aq_required. Remove some flags that we don't want to send as we are in iavf_close and we want to disable interface. Remove filters which was not yet sent and send del filters flags only when there are filters to remove. Signed-off-by: Michal Jaron Signed-off-by: Mateusz Palczewski Tested-by: Konrad Jankowski Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/iavf/iavf_main.c | 177 ++++++++++++++++---- 1 file changed, 141 insertions(+), 36 deletions(-) diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c index 0c89f16bf1e2..79fef8c59d65 100644 --- a/drivers/net/ethernet/intel/iavf/iavf_main.c +++ b/drivers/net/ethernet/intel/iavf/iavf_main.c @@ -1267,66 +1267,138 @@ static void iavf_up_complete(struct iavf_adapter *adapter) } /** - * iavf_down - Shutdown the connection processing + * iavf_clear_mac_vlan_filters - Remove mac and vlan filters not sent to PF + * yet and mark other to be removed. * @adapter: board private structure - * - * Expects to be called while holding the __IAVF_IN_CRITICAL_TASK bit lock. **/ -void iavf_down(struct iavf_adapter *adapter) +static void iavf_clear_mac_vlan_filters(struct iavf_adapter *adapter) { - struct net_device *netdev = adapter->netdev; - struct iavf_vlan_filter *vlf; - struct iavf_cloud_filter *cf; - struct iavf_fdir_fltr *fdir; - struct iavf_mac_filter *f; - struct iavf_adv_rss *rss; - - if (adapter->state <= __IAVF_DOWN_PENDING) - return; - - netif_carrier_off(netdev); - netif_tx_disable(netdev); - adapter->link_up = false; - iavf_napi_disable_all(adapter); - iavf_irq_disable(adapter); + struct iavf_vlan_filter *vlf, *vlftmp; + struct iavf_mac_filter *f, *ftmp; spin_lock_bh(&adapter->mac_vlan_list_lock); - /* clear the sync flag on all filters */ __dev_uc_unsync(adapter->netdev, NULL); __dev_mc_unsync(adapter->netdev, NULL); /* remove all MAC filters */ - list_for_each_entry(f, &adapter->mac_filter_list, list) { - f->remove = true; + list_for_each_entry_safe(f, ftmp, &adapter->mac_filter_list, + list) { + if (f->add) { + list_del(&f->list); + kfree(f); + } else { + f->remove = true; + } } /* remove all VLAN filters */ - list_for_each_entry(vlf, &adapter->vlan_filter_list, list) { - vlf->remove = true; + list_for_each_entry_safe(vlf, vlftmp, &adapter->vlan_filter_list, + list) { + if (vlf->add) { + list_del(&vlf->list); + kfree(vlf); + } else { + vlf->remove = true; + } } - spin_unlock_bh(&adapter->mac_vlan_list_lock); +} + +/** + * iavf_clear_cloud_filters - Remove cloud filters not sent to PF yet and + * mark other to be removed. + * @adapter: board private structure + **/ +static void iavf_clear_cloud_filters(struct iavf_adapter *adapter) +{ + struct iavf_cloud_filter *cf, *cftmp; /* remove all cloud filters */ spin_lock_bh(&adapter->cloud_filter_list_lock); - list_for_each_entry(cf, &adapter->cloud_filter_list, list) { - cf->del = true; + list_for_each_entry_safe(cf, cftmp, &adapter->cloud_filter_list, + list) { + if (cf->add) { + list_del(&cf->list); + kfree(cf); + adapter->num_cloud_filters--; + } else { + cf->del = true; + } } spin_unlock_bh(&adapter->cloud_filter_list_lock); +} + +/** + * iavf_clear_fdir_filters - Remove fdir filters not sent to PF yet and mark + * other to be removed. + * @adapter: board private structure + **/ +static void iavf_clear_fdir_filters(struct iavf_adapter *adapter) +{ + struct iavf_fdir_fltr *fdir, *fdirtmp; /* remove all Flow Director filters */ spin_lock_bh(&adapter->fdir_fltr_lock); - list_for_each_entry(fdir, &adapter->fdir_list_head, list) { - fdir->state = IAVF_FDIR_FLTR_DEL_REQUEST; + list_for_each_entry_safe(fdir, fdirtmp, &adapter->fdir_list_head, + list) { + if (fdir->state == IAVF_FDIR_FLTR_ADD_REQUEST) { + list_del(&fdir->list); + kfree(fdir); + adapter->fdir_active_fltr--; + } else { + fdir->state = IAVF_FDIR_FLTR_DEL_REQUEST; + } } spin_unlock_bh(&adapter->fdir_fltr_lock); +} + +/** + * iavf_clear_adv_rss_conf - Remove adv rss conf not sent to PF yet and mark + * other to be removed. + * @adapter: board private structure + **/ +static void iavf_clear_adv_rss_conf(struct iavf_adapter *adapter) +{ + struct iavf_adv_rss *rss, *rsstmp; /* remove all advance RSS configuration */ spin_lock_bh(&adapter->adv_rss_lock); - list_for_each_entry(rss, &adapter->adv_rss_list_head, list) - rss->state = IAVF_ADV_RSS_DEL_REQUEST; + list_for_each_entry_safe(rss, rsstmp, &adapter->adv_rss_list_head, + list) { + if (rss->state == IAVF_ADV_RSS_ADD_REQUEST) { + list_del(&rss->list); + kfree(rss); + } else { + rss->state = IAVF_ADV_RSS_DEL_REQUEST; + } + } spin_unlock_bh(&adapter->adv_rss_lock); +} + +/** + * iavf_down - Shutdown the connection processing + * @adapter: board private structure + * + * Expects to be called while holding the __IAVF_IN_CRITICAL_TASK bit lock. + **/ +void iavf_down(struct iavf_adapter *adapter) +{ + struct net_device *netdev = adapter->netdev; + + if (adapter->state <= __IAVF_DOWN_PENDING) + return; + + netif_carrier_off(netdev); + netif_tx_disable(netdev); + adapter->link_up = false; + iavf_napi_disable_all(adapter); + iavf_irq_disable(adapter); + + iavf_clear_mac_vlan_filters(adapter); + iavf_clear_cloud_filters(adapter); + iavf_clear_fdir_filters(adapter); + iavf_clear_adv_rss_conf(adapter); if (!(adapter->flags & IAVF_FLAG_PF_COMMS_FAILED)) { /* cancel any current operation */ @@ -1335,11 +1407,16 @@ void iavf_down(struct iavf_adapter *adapter) * here for this to complete. The watchdog is still running * and it will take care of this. */ - adapter->aq_required = IAVF_FLAG_AQ_DEL_MAC_FILTER; - adapter->aq_required |= IAVF_FLAG_AQ_DEL_VLAN_FILTER; - adapter->aq_required |= IAVF_FLAG_AQ_DEL_CLOUD_FILTER; - adapter->aq_required |= IAVF_FLAG_AQ_DEL_FDIR_FILTER; - adapter->aq_required |= IAVF_FLAG_AQ_DEL_ADV_RSS_CFG; + if (!list_empty(&adapter->mac_filter_list)) + adapter->aq_required |= IAVF_FLAG_AQ_DEL_MAC_FILTER; + if (!list_empty(&adapter->vlan_filter_list)) + adapter->aq_required |= IAVF_FLAG_AQ_DEL_VLAN_FILTER; + if (!list_empty(&adapter->cloud_filter_list)) + adapter->aq_required |= IAVF_FLAG_AQ_DEL_CLOUD_FILTER; + if (!list_empty(&adapter->fdir_list_head)) + adapter->aq_required |= IAVF_FLAG_AQ_DEL_FDIR_FILTER; + if (!list_empty(&adapter->adv_rss_list_head)) + adapter->aq_required |= IAVF_FLAG_AQ_DEL_ADV_RSS_CFG; adapter->aq_required |= IAVF_FLAG_AQ_DISABLE_QUEUES; } @@ -4178,6 +4255,7 @@ static int iavf_open(struct net_device *netdev) static int iavf_close(struct net_device *netdev) { struct iavf_adapter *adapter = netdev_priv(netdev); + u64 aq_to_restore; int status; mutex_lock(&adapter->crit_lock); @@ -4190,6 +4268,29 @@ static int iavf_close(struct net_device *netdev) set_bit(__IAVF_VSI_DOWN, adapter->vsi.state); if (CLIENT_ENABLED(adapter)) adapter->flags |= IAVF_FLAG_CLIENT_NEEDS_CLOSE; + /* We cannot send IAVF_FLAG_AQ_GET_OFFLOAD_VLAN_V2_CAPS before + * IAVF_FLAG_AQ_DISABLE_QUEUES because in such case there is rtnl + * deadlock with adminq_task() until iavf_close timeouts. We must send + * IAVF_FLAG_AQ_GET_CONFIG before IAVF_FLAG_AQ_DISABLE_QUEUES to make + * disable queues possible for vf. Give only necessary flags to + * iavf_down and save other to set them right before iavf_close() + * returns, when IAVF_FLAG_AQ_DISABLE_QUEUES will be already sent and + * iavf will be in DOWN state. + */ + aq_to_restore = adapter->aq_required; + adapter->aq_required &= IAVF_FLAG_AQ_GET_CONFIG; + + /* Remove flags which we do not want to send after close or we want to + * send before disable queues. + */ + aq_to_restore &= ~(IAVF_FLAG_AQ_GET_CONFIG | + IAVF_FLAG_AQ_ENABLE_QUEUES | + IAVF_FLAG_AQ_CONFIGURE_QUEUES | + IAVF_FLAG_AQ_ADD_VLAN_FILTER | + IAVF_FLAG_AQ_ADD_MAC_FILTER | + IAVF_FLAG_AQ_ADD_CLOUD_FILTER | + IAVF_FLAG_AQ_ADD_FDIR_FILTER | + IAVF_FLAG_AQ_ADD_ADV_RSS_CFG); iavf_down(adapter); iavf_change_state(adapter, __IAVF_DOWN_PENDING); @@ -4213,6 +4314,10 @@ static int iavf_close(struct net_device *netdev) msecs_to_jiffies(500)); if (!status) netdev_warn(netdev, "Device resources not yet released\n"); + + mutex_lock(&adapter->crit_lock); + adapter->aq_required |= aq_to_restore; + mutex_unlock(&adapter->crit_lock); return 0; } From patchwork Wed Oct 19 08:33: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: 5186 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp263852wrs; Wed, 19 Oct 2022 04:18:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Dv1rwsH0WKTOMRoANtoLlcUZWezXAYRGYuO6b9EF+tQXDM1o+pw4NZBOd4rmSIXCn6PNm X-Received: by 2002:a05:6a02:190:b0:43c:7997:4d69 with SMTP id bj16-20020a056a02019000b0043c79974d69mr6721229pgb.15.1666178332656; Wed, 19 Oct 2022 04:18:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178332; cv=none; d=google.com; s=arc-20160816; b=v60ka+h0aAwdYl8osPRp403ghW8JzrpnyYY8VYLHnEtUfM7XQT4Nb29c+7zDl4hgC4 WsJZDBgDTr92frMtTlfB7s6YE1r5DQJN0xuz0BCmjwvzC0739v6X9dmAhGxhAYD/rZuk mwjFD/wGQYn6+equHjFSPafQgd3KAL7galRT7pYp3/FlBXmDqyES4lH2X5eFl9h9jy5p WwmOI2geP5dZ70SZ+PfDlwcQl0DUQ6XsSsjQQLt2l5G6bZxHJ30fvyKIm/EIodS2Surw JGPAFPSD5NFhFQQ07ynST2AFMU5JMiUvtFZnENIUHGad86C809Owyz8Tp10zZ2x0xIVb Ie9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Iw4lN+/36o3NS5aoDIDfFN19/7tRNFrr2DYKSt+2YmU=; b=hqNp7a20nq4xQuizMsirDr2PSfNPNorgnPGxQTU9QDQ45ZjkF+wZz1nlbi08fErTSb uCwRU8U9Qcg2U0s/uru10UGOL5GuoTFTxdABPaClhPv+2dz6l7t7eDklFzojYV3QeAT9 5uNWH1lORxO21YbN3qjNBm7Of+2+t4V0Dbwqk72fDKu6LwOV/qhd9rCHKlu1H5NWixX1 VuyNYmTSvh6e0S1C5TTh4H3bORo8S+5TgnaNT18xyhXUOFx7Sp9xqANCgAukNCraBUa5 y7Az84oCS9wLNid2K/GPrj3OsqwfUFzpKIhKvAq2wNRKjPCAYLiZ1mBEREt8/b4z02o4 Gfxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="EGk7N3G/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d29-20020a631d1d000000b0042b52f42418si18293048pgd.227.2022.10.19.04.18.35; Wed, 19 Oct 2022 04:18: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="EGk7N3G/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231224AbiJSLF2 (ORCPT + 99 others); Wed, 19 Oct 2022 07:05:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234879AbiJSLEL (ORCPT ); Wed, 19 Oct 2022 07:04: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 9F919FBCE9; Wed, 19 Oct 2022 03:33: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 C3772B824A5; Wed, 19 Oct 2022 09:09:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47CBFC433B5; Wed, 19 Oct 2022 09:09:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170563; bh=G/Wogf9G1qxuIOV9JNYiBrFnBN7xaecrKSrL+5yFH84=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EGk7N3G/JeMuQPN0vGaCETHHFSMdfIOhYecbL8xxoEFl+4Kppjbcu51YRKL+U8pIO 8i1uleTzeSzF9JECjr8beSPhj4RUIbTR+0C87CHlmp9ctglm8G85g1/aG2lDSoxeYp 881SFTCJvpRWNMjUXapSiDyHZX6iZviJed7FdZOE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Coffin , Kalle Valo , Sasha Levin Subject: [PATCH 6.0 701/862] wifi: brcmfmac: fix use-after-free bug in brcmf_netdev_start_xmit() Date: Wed, 19 Oct 2022 10:33:08 +0200 Message-Id: <20221019083320.970473246@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114611056187502?= X-GMAIL-MSGID: =?utf-8?q?1747114611056187502?= From: Alexander Coffin [ Upstream commit 3f42faf6db431e04bf942d2ebe3ae88975723478 ] > ret = brcmf_proto_tx_queue_data(drvr, ifp->ifidx, skb); may be schedule, and then complete before the line > ndev->stats.tx_bytes += skb->len; [ 46.912801] ================================================================== [ 46.920552] BUG: KASAN: use-after-free in brcmf_netdev_start_xmit+0x718/0x8c8 [brcmfmac] [ 46.928673] Read of size 4 at addr ffffff803f5882e8 by task systemd-resolve/328 [ 46.935991] [ 46.937514] CPU: 1 PID: 328 Comm: systemd-resolve Tainted: G O 5.4.199-[REDACTED] #1 [ 46.947255] Hardware name: [REDACTED] [ 46.954568] Call trace: [ 46.957037] dump_backtrace+0x0/0x2b8 [ 46.960719] show_stack+0x24/0x30 [ 46.964052] dump_stack+0x128/0x194 [ 46.967557] print_address_description.isra.0+0x64/0x380 [ 46.972877] __kasan_report+0x1d4/0x240 [ 46.976723] kasan_report+0xc/0x18 [ 46.980138] __asan_report_load4_noabort+0x18/0x20 [ 46.985027] brcmf_netdev_start_xmit+0x718/0x8c8 [brcmfmac] [ 46.990613] dev_hard_start_xmit+0x1bc/0xda0 [ 46.994894] sch_direct_xmit+0x198/0xd08 [ 46.998827] __qdisc_run+0x37c/0x1dc0 [ 47.002500] __dev_queue_xmit+0x1528/0x21f8 [ 47.006692] dev_queue_xmit+0x24/0x30 [ 47.010366] neigh_resolve_output+0x37c/0x678 [ 47.014734] ip_finish_output2+0x598/0x2458 [ 47.018927] __ip_finish_output+0x300/0x730 [ 47.023118] ip_output+0x2e0/0x430 [ 47.026530] ip_local_out+0x90/0x140 [ 47.030117] igmpv3_sendpack+0x14c/0x228 [ 47.034049] igmpv3_send_cr+0x384/0x6b8 [ 47.037895] igmp_ifc_timer_expire+0x4c/0x118 [ 47.042262] call_timer_fn+0x1cc/0xbe8 [ 47.046021] __run_timers+0x4d8/0xb28 [ 47.049693] run_timer_softirq+0x24/0x40 [ 47.053626] __do_softirq+0x2c0/0x117c [ 47.057387] irq_exit+0x2dc/0x388 [ 47.060715] __handle_domain_irq+0xb4/0x158 [ 47.064908] gic_handle_irq+0x58/0xb0 [ 47.068581] el0_irq_naked+0x50/0x5c [ 47.072162] [ 47.073665] Allocated by task 328: [ 47.077083] save_stack+0x24/0xb0 [ 47.080410] __kasan_kmalloc.isra.0+0xc0/0xe0 [ 47.084776] kasan_slab_alloc+0x14/0x20 [ 47.088622] kmem_cache_alloc+0x15c/0x468 [ 47.092643] __alloc_skb+0xa4/0x498 [ 47.096142] igmpv3_newpack+0x158/0xd78 [ 47.099987] add_grhead+0x210/0x288 [ 47.103485] add_grec+0x6b0/0xb70 [ 47.106811] igmpv3_send_cr+0x2e0/0x6b8 [ 47.110657] igmp_ifc_timer_expire+0x4c/0x118 [ 47.115027] call_timer_fn+0x1cc/0xbe8 [ 47.118785] __run_timers+0x4d8/0xb28 [ 47.122457] run_timer_softirq+0x24/0x40 [ 47.126389] __do_softirq+0x2c0/0x117c [ 47.130142] [ 47.131643] Freed by task 180: [ 47.134712] save_stack+0x24/0xb0 [ 47.138041] __kasan_slab_free+0x108/0x180 [ 47.142146] kasan_slab_free+0x10/0x18 [ 47.145904] slab_free_freelist_hook+0xa4/0x1b0 [ 47.150444] kmem_cache_free+0x8c/0x528 [ 47.154292] kfree_skbmem+0x94/0x108 [ 47.157880] consume_skb+0x10c/0x5a8 [ 47.161466] __dev_kfree_skb_any+0x88/0xa0 [ 47.165598] brcmu_pkt_buf_free_skb+0x44/0x68 [brcmutil] [ 47.171023] brcmf_txfinalize+0xec/0x190 [brcmfmac] [ 47.176016] brcmf_proto_bcdc_txcomplete+0x1c0/0x210 [brcmfmac] [ 47.182056] brcmf_sdio_sendfromq+0x8dc/0x1e80 [brcmfmac] [ 47.187568] brcmf_sdio_dpc+0xb48/0x2108 [brcmfmac] [ 47.192529] brcmf_sdio_dataworker+0xc8/0x238 [brcmfmac] [ 47.197859] process_one_work+0x7fc/0x1a80 [ 47.201965] worker_thread+0x31c/0xc40 [ 47.205726] kthread+0x2d8/0x370 [ 47.208967] ret_from_fork+0x10/0x18 [ 47.212546] [ 47.214051] The buggy address belongs to the object at ffffff803f588280 [ 47.214051] which belongs to the cache skbuff_head_cache of size 208 [ 47.227086] The buggy address is located 104 bytes inside of [ 47.227086] 208-byte region [ffffff803f588280, ffffff803f588350) [ 47.238814] The buggy address belongs to the page: [ 47.243618] page:ffffffff00dd6200 refcount:1 mapcount:0 mapping:ffffff804b6bf800 index:0xffffff803f589900 compound_mapcount: 0 [ 47.255007] flags: 0x10200(slab|head) [ 47.258689] raw: 0000000000010200 ffffffff00dfa980 0000000200000002 ffffff804b6bf800 [ 47.266439] raw: ffffff803f589900 0000000080190018 00000001ffffffff 0000000000000000 [ 47.274180] page dumped because: kasan: bad access detected [ 47.279752] [ 47.281251] Memory state around the buggy address: [ 47.286051] ffffff803f588180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 47.293277] ffffff803f588200: fb fb fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 47.300502] >ffffff803f588280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 47.307723] ^ [ 47.314343] ffffff803f588300: fb fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc [ 47.321569] ffffff803f588380: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb [ 47.328789] ================================================================== Signed-off-by: Alexander Coffin Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220808174925.3922558-1-alex.coffin@matician.com Signed-off-by: Sasha Levin --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c index bd164a0821f9..ca95b02962ef 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c @@ -292,6 +292,7 @@ static netdev_tx_t brcmf_netdev_start_xmit(struct sk_buff *skb, struct brcmf_pub *drvr = ifp->drvr; struct ethhdr *eh; int head_delta; + unsigned int tx_bytes = skb->len; brcmf_dbg(DATA, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx); @@ -366,7 +367,7 @@ static netdev_tx_t brcmf_netdev_start_xmit(struct sk_buff *skb, ndev->stats.tx_dropped++; } else { ndev->stats.tx_packets++; - ndev->stats.tx_bytes += skb->len; + ndev->stats.tx_bytes += tx_bytes; } /* Return ok: we always eat the packet */ From patchwork Wed Oct 19 08:33: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: 4850 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223835wrs; Wed, 19 Oct 2022 02:38:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7IRIRXlpbFPmuQeww6bYQh6tQ8Wmgv/CDxbm1g0Uhl4w7gZl3S9lWsMwdEI34oRTaJ89KR X-Received: by 2002:a17:902:a70b:b0:181:d20e:6565 with SMTP id w11-20020a170902a70b00b00181d20e6565mr7727077plq.66.1666172319115; Wed, 19 Oct 2022 02:38:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172319; cv=none; d=google.com; s=arc-20160816; b=sSuJN7oKmcVnSx0Km2zJK0gSgfQBIo91RKuJIjvG4HXXT7T/+X6wSSsH5dyZQIcaKV C1zCmU5M76O9s8jOYgNEsDsLTEuQTVlbA6qqce4PP9MsydnqEEoavZlnJi+BRpSqP5fb 6QqD+QS//xQfnxtTRn0UpXZTVxDujoKNGqAX0kRxNaVdnTnEBah5HPkWu5n7/m9IgkOu jh48yihY9xkMD4eemNLYQmWSeGLeiWDooThKp5KGpveJ2Vulxau2zIoaxRztQhxX7btZ 3j6FKMG/DbbR3lNKNOWtXTWWS11KQxyXvjgFFxN+OjC+McDM7S3zaPFeJT+53ic3XLiO B9Fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8+1rqTQTPVNCkRIel0xMlChNibIJqrOfisvBx5QqSgY=; b=yWVTPSa77AESVoEXL27o9xBVZ4nyFQmY1uMhsIhCpIAoJusiPp3gMac+KmB+ZmTz0Y cI279S86vRdPN+pwGioOT8XNmpULMVmFa3PwTteLXqyFmj9fftrzCAvifo4WKtXQy/kw dFp5+SDAdI0DYl3g3JQTp7+d7K1RBBEUj8jVquV4MV/Q6eissDVjo49uwB+PDTPjKDeY 3+8Uh3xMdRpl23cC7Aqrg97MQtlRg3twrVvEayDiGUR3gptHiqrF9+juEzfqt79VWTgB SbbmRel6P8PRaAgYfI0HN7XFzdvoaXTZRkESl8Lm8v3mamlG+ADm3pHcRkBVmfjSYSLT RtJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DJMH0EtC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g18-20020a63e612000000b0045b0a113f6asi18579819pgh.846.2022.10.19.02.38.26; Wed, 19 Oct 2022 02:38: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=DJMH0EtC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231612AbiJSJ1n (ORCPT + 99 others); Wed, 19 Oct 2022 05:27:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233563AbiJSJ0c (ORCPT ); Wed, 19 Oct 2022 05:26:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8C76E52F6; Wed, 19 Oct 2022 02:11:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 87866617E9; Wed, 19 Oct 2022 09:09:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2C41C433D7; Wed, 19 Oct 2022 09:09:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170566; bh=td0Bgb5k/mqBqt6ZeCIVd7jIB7tIe/i82PmDKrXTogw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DJMH0EtCcgPezfuKSvisfFT6U1EqAVuq3xGnXNLftNOUAOzjRcl+d8K1tX2OKPi+b r49m60TXyi46a53f7gaRW0Mzf33mQ3Rj27fk1s2BfQ2Nvfz4rPBq2oH77VvS96fVkv 9IaEcYI/W+aGCFzUL3XReX2+dQEm4cKuJhKQ1ldo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kiran K , Chethan T N , Luiz Augusto von Dentz , Sasha Levin Subject: [PATCH 6.0 702/862] Bluetooth: btintel: Mark Intel controller to support LE_STATES quirk Date: Wed, 19 Oct 2022 10:33:09 +0200 Message-Id: <20221019083321.020300983@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108305401841353?= X-GMAIL-MSGID: =?utf-8?q?1747108305401841353?= From: Kiran K [ Upstream commit dd0a1794f4334ddbf9b7c5e7d642aaffff38c69b ] HarrrisonPeak, CyclonePeak, SnowFieldPeak and SandyPeak controllers are marked to support HCI_QUIRK_LE_STATES. Signed-off-by: Kiran K Signed-off-by: Chethan T N Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin --- drivers/bluetooth/btintel.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c index 818681c89db8..d44a96667517 100644 --- a/drivers/bluetooth/btintel.c +++ b/drivers/bluetooth/btintel.c @@ -2439,15 +2439,20 @@ static int btintel_setup_combined(struct hci_dev *hdev) INTEL_ROM_LEGACY_NO_WBS_SUPPORT)) set_bit(HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED, &hdev->quirks); + if (ver.hw_variant == 0x08 && ver.fw_variant == 0x22) + set_bit(HCI_QUIRK_VALID_LE_STATES, + &hdev->quirks); err = btintel_legacy_rom_setup(hdev, &ver); break; case 0x0b: /* SfP */ - case 0x0c: /* WsP */ case 0x11: /* JfP */ case 0x12: /* ThP */ case 0x13: /* HrP */ case 0x14: /* CcP */ + set_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks); + fallthrough; + case 0x0c: /* WsP */ /* Apply the device specific HCI quirks * * All Legacy bootloader devices support WBS @@ -2455,11 +2460,6 @@ static int btintel_setup_combined(struct hci_dev *hdev) set_bit(HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED, &hdev->quirks); - /* Valid LE States quirk for JfP/ThP familiy */ - if (ver.hw_variant == 0x11 || ver.hw_variant == 0x12) - set_bit(HCI_QUIRK_VALID_LE_STATES, - &hdev->quirks); - /* Setup MSFT Extension support */ btintel_set_msft_opcode(hdev, ver.hw_variant); @@ -2530,9 +2530,8 @@ static int btintel_setup_combined(struct hci_dev *hdev) */ set_bit(HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED, &hdev->quirks); - /* Valid LE States quirk for JfP/ThP familiy */ - if (ver.hw_variant == 0x11 || ver.hw_variant == 0x12) - set_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks); + /* Set Valid LE States quirk */ + set_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks); /* Setup MSFT Extension support */ btintel_set_msft_opcode(hdev, ver.hw_variant); From patchwork Wed Oct 19 08:33: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: 5181 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp263656wrs; Wed, 19 Oct 2022 04:18:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM52uV0gax36O1CRTqRcYYXEns8DNtSzjCQCn5FYoD+XBQHeOZ9nIb1O6+lhW0AdNCuQddk2 X-Received: by 2002:a17:907:1b1c:b0:72f:9aac:ee41 with SMTP id mp28-20020a1709071b1c00b0072f9aacee41mr6340280ejc.56.1666178309133; Wed, 19 Oct 2022 04:18:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178309; cv=none; d=google.com; s=arc-20160816; b=esjIRBUOK/JVJXTmtxI51HPQqOd/0zXlLLBtOpjC3CRVXvowNvXJ+KGbIEY++ptgwf enYFbIPgA1KrdoAoCo5cNyfhb+VaUkcMcX3gt8qrPnTOr5lkprznjagfO77vKUu6MWoN UrQ8/Ms9JHrXd2zN2SvH/DokRJpvMmuOeB3OdpoAEGfb8RLudlKS5f/rG8DUJNSpvQN4 xW2nrhjAASwZ2lCzaM/upxlZEjKexBJuEX7c6hjEqn5UginAmR0L/bDjCP0A/hrnxhqp /DYSlEjajFK4PHeXrdlRzjurOi8HKibrhgzHu3VIjQ3URbdkm2hKDgat7kzLX1nHL7k6 zM1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=j54LxoE0bbC3aDOjIHAmzD1Sy1EUsR1wlh666B/z1+U=; b=aURLPsewIacieFtrRQPk3BWXNVJ55znultmfDv0p8UNKpMPZFzaHdYuY+Or5r48lhW ocv6mfrcpPFwmkjTMNZImI2//QcEh4Pjpe0XQpd7JbLnnpbkb3Qm2kE8ByxcTHA7nW6z wRrCidqhnDJ7PaXp+8VS7b1mgpTUh8MfCCt6I/s5VM64QDYnmLFXQMkty8umfXkh8KmQ LqwnBF8YcCRWLM6p0lZ2FnubxtUeM/iY7k8Ajbily/oPFfIYZukzl/iXMKuamjRzvbox JdvFzO5dYiB9Qdi9zKEjas+Bd3c+99xto2Y05VCj3FAMLI94CQGTf2ayrFOaL4iHHZ8L nKSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jwgSrylH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cw10-20020a170906478a00b00773b8e3b6a1si16974500ejc.805.2022.10.19.04.17.48; Wed, 19 Oct 2022 04:18: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=jwgSrylH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230134AbiJSLHj (ORCPT + 99 others); Wed, 19 Oct 2022 07:07:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234008AbiJSLHH (ORCPT ); Wed, 19 Oct 2022 07:07: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 A05A22408C; Wed, 19 Oct 2022 03:36: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 E2C96CE218C; Wed, 19 Oct 2022 09:09:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A739C433D7; Wed, 19 Oct 2022 09:09:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170569; bh=7+9iLh8rQ4HHyOSIN1Pqo+gNYTzhMkFpZiwMptBxaMw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jwgSrylHOCjnvrOQyAz1pPLxeG38w2vNao7DZFkvyjCzotsyt+AbfXRFq5HTgl4FE 9VdOY9NsR1xEYRkTSn6kqnd6H00crRA8pRpjPsIK6+bdw2b4KYRWC+FoAjFGcbvwSe E31jyBc7FOu+D7Hmjjgd61LszShUjbMlFuFQ3kQ4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Patrick Rudolph , Mark Brown , Sasha Levin Subject: [PATCH 6.0 703/862] regulator: core: Prevent integer underflow Date: Wed, 19 Oct 2022 10:33:10 +0200 Message-Id: <20221019083321.051979568@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114586874782793?= X-GMAIL-MSGID: =?utf-8?q?1747114586874782793?= From: Patrick Rudolph [ Upstream commit 8d8e16592022c9650df8aedfe6552ed478d7135b ] By using a ratio of delay to poll_enabled_time that is not integer time_remaining underflows and does not exit the loop as expected. As delay could be derived from DT and poll_enabled_time is defined in the driver this can easily happen. Use a signed iterator to make sure that the loop exits once the remaining time is negative. Signed-off-by: Patrick Rudolph Link: https://lore.kernel.org/r/20220909125954.577669-1-patrick.rudolph@9elements.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/regulator/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index d3e8dc32832d..c3871565fd7d 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -2681,7 +2681,7 @@ static int _regulator_do_enable(struct regulator_dev *rdev) * return -ETIMEDOUT. */ if (rdev->desc->poll_enabled_time) { - unsigned int time_remaining = delay; + int time_remaining = delay; while (time_remaining > 0) { _regulator_delay_helper(rdev->desc->poll_enabled_time); From patchwork Wed Oct 19 08:33: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: 5224 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp265652wrs; Wed, 19 Oct 2022 04:22:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM63HQY51NKQXYBp6tHcsw08tCrtBUcTjeL9Ui1tASgJBbVciDodoOaQMo+oLnzpOcigAVph X-Received: by 2002:a17:907:a044:b0:78d:b569:b891 with SMTP id gz4-20020a170907a04400b0078db569b891mr6098785ejc.224.1666178573845; Wed, 19 Oct 2022 04:22:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178573; cv=none; d=google.com; s=arc-20160816; b=qMTgEagqMvIOhJFtDtsi1tX0RUDDxVK+0dgboGNCNPjVEGofJ3s5ixW8Q2hiTVVIyY lZVoB2kw2c9cAHoAmawtYaBRnEC4Uc3E1YNjhS9qC91YtefkUbcmkS+NWLxOHG+o3euN wPE0Z1bHn09GZKlMzINy+SP6v9NzJJvIamkny3OnafMj5YpWVR3iuAe+l78c235k9Xup oyT3WsgXh6Op4rVShQQ4WvnsFWzjqO6M6AiDTJUPoTnoRlL/8YxXCnlQxwsXcx/9+hbo NPkGljlx4wQ2WIAjgaxq6pzAfNIPpI/MWGmhpXH1EEKyLJYLEzgy195zkavAP0C5Fhbi xevQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2VOXCrhkt3yMI2X3yLDsiYR4GyOqlswowtkIaYtOYnE=; b=ywd0ijHOhkmUc6xK9BIdftwvD03eD3MBYQeBdb9s6+DvSZbhFTt8fSITX4+aoMHGZY X6iya2IknLBGP8zZho1W/ieUXtKi1tV6wjAO8sdd4Tfe0xHdszH2LuOMSF9haWhayFjm 0J9ydQmYcZkph5wKKLKRWBy9k+VGWIpzLm4ug8Y6widXSYyAGbJVJpcIFzDK/s4UxmMl 7EsHN+/4Kw5E05Jlhv4XGWaM89oMKfN/rhAmVvpVhFUkynaUvbTz0dyWes/Acz899ELo IC7PLSMqibMmoFk3sGHjDGlfuYJJ8XO/yrUPMpo1wAt5DV3/eu1NcZFZ2uhE2t4AGsFz KDsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cDTynyAK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l20-20020aa7cad4000000b0045bc92ef2c0si12266456edt.195.2022.10.19.04.22.29; Wed, 19 Oct 2022 04:22: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=cDTynyAK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231601AbiJSLKv (ORCPT + 99 others); Wed, 19 Oct 2022 07:10:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230363AbiJSLJX (ORCPT ); Wed, 19 Oct 2022 07:09:23 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E925917FD68; Wed, 19 Oct 2022 03:37: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 314E3CE2193; Wed, 19 Oct 2022 09:09:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0205C433D6; Wed, 19 Oct 2022 09:09:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170572; bh=KwB7yzHmIKvJrXcnQgncUVi1felkVMXMpemxmBu6DsM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cDTynyAKgDHr5rWF1WyloNQ8pl1QMj2G04eHzKXSBW8S4TbH4e2PYKt+g5XgCKQvm guT98zFdvzTwSsRvQbsjt2/XWWDrtkLbEPMBN2S/ASd1HO5PGX/E6ifhaLARiXsUfQ Gc+9HBDYryQSlGJmPb7YT2F9c8WTd51aiN521PWk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jianglei Nie , Jeff Johnson , Kalle Valo , Sasha Levin Subject: [PATCH 6.0 704/862] wifi: ath11k: mhi: fix potential memory leak in ath11k_mhi_register() Date: Wed, 19 Oct 2022 10:33:11 +0200 Message-Id: <20221019083321.099861809@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114864670420213?= X-GMAIL-MSGID: =?utf-8?q?1747114864670420213?= From: Jianglei Nie [ Upstream commit 43e7c3505ec70db3d3c6458824d5fa40f62e3e7b ] mhi_alloc_controller() allocates a memory space for mhi_ctrl. When gets some error, mhi_ctrl should be freed with mhi_free_controller(). But when ath11k_mhi_read_addr_from_dt() fails, the function returns without calling mhi_free_controller(), which will lead to a memory leak. We can fix it by calling mhi_free_controller() when ath11k_mhi_read_addr_from_dt() fails. Signed-off-by: Jianglei Nie Reviewed-by: Jeff Johnson Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220907073704.58806-1-niejianglei2021@163.com Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath11k/mhi.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/mhi.c b/drivers/net/wireless/ath/ath11k/mhi.c index c44df17719f6..86995e8dc913 100644 --- a/drivers/net/wireless/ath/ath11k/mhi.c +++ b/drivers/net/wireless/ath/ath11k/mhi.c @@ -402,8 +402,7 @@ int ath11k_mhi_register(struct ath11k_pci *ab_pci) ret = ath11k_mhi_get_msi(ab_pci); if (ret) { ath11k_err(ab, "failed to get msi for mhi\n"); - mhi_free_controller(mhi_ctrl); - return ret; + goto free_controller; } if (!test_bit(ATH11K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags)) @@ -412,7 +411,7 @@ int ath11k_mhi_register(struct ath11k_pci *ab_pci) if (test_bit(ATH11K_FLAG_FIXED_MEM_RGN, &ab->dev_flags)) { ret = ath11k_mhi_read_addr_from_dt(mhi_ctrl); if (ret < 0) - return ret; + goto free_controller; } else { mhi_ctrl->iova_start = 0; mhi_ctrl->iova_stop = 0xFFFFFFFF; @@ -440,18 +439,22 @@ int ath11k_mhi_register(struct ath11k_pci *ab_pci) default: ath11k_err(ab, "failed assign mhi_config for unknown hw rev %d\n", ab->hw_rev); - mhi_free_controller(mhi_ctrl); - return -EINVAL; + ret = -EINVAL; + goto free_controller; } ret = mhi_register_controller(mhi_ctrl, ath11k_mhi_config); if (ret) { ath11k_err(ab, "failed to register to mhi bus, err = %d\n", ret); - mhi_free_controller(mhi_ctrl); - return ret; + goto free_controller; } return 0; + +free_controller: + mhi_free_controller(mhi_ctrl); + ab_pci->mhi_ctrl = NULL; + return ret; } void ath11k_mhi_unregister(struct ath11k_pci *ab_pci) From patchwork Wed Oct 19 08:33: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: 5202 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp264500wrs; Wed, 19 Oct 2022 04:20:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Hx+qSP4uTEpZtlC2DK43G/I/wXU4JjOOIbuGRkakrJCDqFzP0JQkH5NOA9HGcb+fAYX+w X-Received: by 2002:a17:907:1c10:b0:791:a716:5089 with SMTP id nc16-20020a1709071c1000b00791a7165089mr2431847ejc.672.1666178411024; Wed, 19 Oct 2022 04:20:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178411; cv=none; d=google.com; s=arc-20160816; b=daeR+5NyPlHqnwbhnWirQIRui3qaHoY7wUwo0RX7UFOUrkQaJ68/HgmnLvQ5J4Ki5F 4XCGsQ5vNnOZbfNiPbQMNFHbVcj5zZ/mWsmun3LVtPvLgziLedwCJgoqq5DbXAWGoBvO qNL4ElUbKnvOjglUsrBvHpIYjZsji4vUfMti3xV8W3Qnkw36UlDWsV2BBFAwYDn6W7Q6 stfNDHqIycoFrwh/90NZMo2QPduPSv3LSnp6INq66dukawh1Q6OYgJ535hdPe6hT9SQO ojmNRTpJBAic5LRaZ3/Pt3zhIix01hS0KA2jai/K8eyTwwvpvqJ3UrvHz7zJWAQHCjjp nCKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=c3RbG7qa4nQ5MH7NC/284ld2Lhr8MU00QkcaiX4DYxI=; b=okPzjGnGTwAhqEgWYs5MdUXxMmjemdE/62kbSl5hmX0dlffUzEWZBDdqRi77KWB7SX 8xkkxJ8DDijCEECVQ4QQsGTbHmlw2hkNUYz/A3nAhTgbzfs5JHzqwSf5DIPNaJ+Pb46R KgFOYCTgOPoHGxpz32V20dpWOVlDI4ZBDCAViU8y9UqgAKBs3rX7vVyFrh1ZIlVP3WPT V7NAN7E4Lo1FdcuAeGSwJcdtGX8f4xnZ2+gXU7AYGp2w0RuRfzCtD6secgDYO3EW7ofb UcTJeIh2ai9q5I6uzcHmABWoSFDN2qLpq9YTzKk1P8ZdKr+9QGS70RPks9u6U8WY5mln nyjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SHoYWs0H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bb12-20020a1709070a0c00b00791a6455597si1768393ejc.955.2022.10.19.04.19.45; Wed, 19 Oct 2022 04:20: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=SHoYWs0H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231476AbiJSLJi (ORCPT + 99 others); Wed, 19 Oct 2022 07:09:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233658AbiJSLIn (ORCPT ); Wed, 19 Oct 2022 07:08: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 C363317C55F; Wed, 19 Oct 2022 03:37:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 5D6C0CE2199; Wed, 19 Oct 2022 09:09:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 406FAC433D7; Wed, 19 Oct 2022 09:09:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170574; bh=kYbcxYIw+yCUgffkCbhQJb60wyUnI1h9lAGAtY8xe0g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SHoYWs0HspIzeQ0+BWK7DUmvq4U36dXGWnOQeIO2MwSAPGY8xBL1Pem5Lrv0Y9l1U e/fGOgmjSvtMXX4xk4AY2azmuukwaDYGbsZZcn+gNlZony0lBAUdG4wy2S39ugICFK EWpILNQKRVsOgTwEA8H3wC057OxVVMgrijmDQSeQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, YN Chen , Sean Wang , Felix Fietkau , Sasha Levin Subject: [PATCH 6.0 705/862] wifi: mt76: mt7921: reset msta->airtime_ac while clearing up hw value Date: Wed, 19 Oct 2022 10:33:12 +0200 Message-Id: <20221019083321.139598633@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114693069511017?= X-GMAIL-MSGID: =?utf-8?q?1747114693069511017?= From: Sean Wang [ Upstream commit 1bf66dc31032ff5292f4d5b76436653f269fcfbd ] We should reset mstat->airtime_ac along with clear up the entries in the hardware WLAN table for the Rx and Rx accumulative airtime. Otherwsie, the value msta->airtime_ac - [tx, rx]_last may be a negative and that is not the actual airtime the device took in the last run. Reported-by: YN Chen Signed-off-by: Sean Wang Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt7921/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c index 7214735011d0..c9e9a533289f 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c @@ -752,6 +752,7 @@ void mt7921_mac_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif, mt7921_mac_wtbl_update(dev, msta->wcid.idx, MT_WTBL_UPDATE_ADM_COUNT_CLEAR); + memset(msta->airtime_ac, 0, sizeof(msta->airtime_ac)); mt7921_mcu_sta_update(dev, sta, vif, true, MT76_STA_INFO_STATE_ASSOC); From patchwork Wed Oct 19 08:33: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: 4886 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225367wrs; Wed, 19 Oct 2022 02:42:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5wBc+29ymmMMFUvFVfxL/J7BUP+JyMoF7LVzVVLmANmvqQCg5NQtAR1fGCMNR/r7UhPkUa X-Received: by 2002:a17:907:2dab:b0:78d:fc4b:7e31 with SMTP id gt43-20020a1709072dab00b0078dfc4b7e31mr5668949ejc.531.1666172579344; Wed, 19 Oct 2022 02:42:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172579; cv=none; d=google.com; s=arc-20160816; b=thhRaSRxlESDyPwDpms1ocKtsXRO6SdDgbcXXB4+2izfiL56D6PUFRcXxBWYFnozj1 YQJAmoXfsDeSZyy8E68Uc/w1Pgja1QJtRdhOoY8wRmSv+T5xmQ0JooCFRt3N/WgHjRNW oa+/VAK48E0eQ04UIb6o8WREoVfh4M4h5iCpyK5lczgwlyFzo+7nNgRvIcwyEUmwSc8/ Sit9rHNiWM7XIiU2JrYcuu4fG9Q9li9KzEBe3WGqYVSbAkSPUrgpMkZ6pQ9/xq0G+VIC t8OfnWsFh1Hyd9E/KwmVI5UaIX9mhSAL9Ebh/hOcmdqwvEj7PgH8gKQXDAQ2aw2OeOjb PA/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=LUt6br25yqJT0y4vTguy18zRcVgEnJo82l83DKnuIPE=; b=gcTH9jtH+w1RSbZj+VTCvgv7XsjwE+iohCZZs5pttcZpLMxihlfB8AGOwwAv8QqP7Y 80A9CqI79ohsdL9Fg5Hr1LY86nm3JtOLLyR0KJtUDBilb2aygZzDd6tOgD9E3mPpXMbj erkVRCJ094Wp6tnZI1Bt86W5mwB6ZRwGyGZrMy5Pg6uP9zl42mHCEUVTAjcVPGwn85F4 uD7M25vaB4BSH7pGrvFx1+st/gnr3leEoSGQl3utJxtc2k/mD0Kl2rM5wrHPmV2SzQ2D ksd6G/f2AMzkhDblJVDbcPaK117Rpzcfy6q0/+KFMK1yJtrnEqqLiKmDxH67hfMlwb3v fWqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Vf87kxdG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t11-20020a1709067c0b00b0078a3ef9f092si12056533ejo.998.2022.10.19.02.42.33; Wed, 19 Oct 2022 02:42: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=Vf87kxdG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233776AbiJSJcT (ORCPT + 99 others); Wed, 19 Oct 2022 05:32:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229489AbiJSJ2c (ORCPT ); Wed, 19 Oct 2022 05:28:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6E2CE8ABA; Wed, 19 Oct 2022 02:12:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 678D46183D; Wed, 19 Oct 2022 09:11:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79782C433D6; Wed, 19 Oct 2022 09:11:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170690; bh=qgniTSF+OJAJ5oQQqmSqvcCBvyeFINIUvqYDGmh5u6Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vf87kxdGBGyDX1vfq1dtL0QQcHEu8tC8Ceg4xzIFPr6+SG/TAIkrsxSvZvuhk0LNo b4iaOlzZf4+QWJeFQYokHPFyHixbkiGAPxiEWrCP1l6K+eYuSFpeKL9RUHQxWWvN4N mO0cG/31MbrBmRpBKFxBN0TFBW/P8UkAW7uFiqqY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Po-Hao Huang , Ping-Ke Shih , Kalle Valo , Sasha Levin Subject: [PATCH 6.0 706/862] wifi: rtw89: free unused skb to prevent memory leak Date: Wed, 19 Oct 2022 10:33:13 +0200 Message-Id: <20221019083321.171162167@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108578629956529?= X-GMAIL-MSGID: =?utf-8?q?1747108578629956529?= From: Po-Hao Huang [ Upstream commit eae672f386049146058b9e5d3d33e9e4af9dca1d ] This avoid potential memory leak under power saving mode. Signed-off-by: Po-Hao Huang Signed-off-by: Ping-Ke Shih Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220916033811.13862-6-pkshih@realtek.com Signed-off-by: Sasha Levin --- drivers/net/wireless/realtek/rtw89/core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c index a5880a54812e..8b338e5ce364 100644 --- a/drivers/net/wireless/realtek/rtw89/core.c +++ b/drivers/net/wireless/realtek/rtw89/core.c @@ -872,6 +872,7 @@ int rtw89_h2c_tx(struct rtw89_dev *rtwdev, rtw89_debug(rtwdev, RTW89_DBG_FW, "ignore h2c due to power is off with firmware state=%d\n", test_bit(RTW89_FLAG_FW_RDY, rtwdev->flags)); + dev_kfree_skb(skb); return 0; } From patchwork Wed Oct 19 08:33: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: 5012 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp244659wrs; Wed, 19 Oct 2022 03:33:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5AFSnTdPwm/Qib3tX9pcTIfgfBsvc+eO1xL0gN/nsssn8EdkKgJf8gigKPVrWqTxsFNGXR X-Received: by 2002:a05:6402:1356:b0:459:3c9e:81d4 with SMTP id y22-20020a056402135600b004593c9e81d4mr6894495edw.148.1666175610592; Wed, 19 Oct 2022 03:33:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666175610; cv=none; d=google.com; s=arc-20160816; b=LxsDQiPzGTCXwI+3mVk+aYtUPFxlF/L8zbRhCbVnDdbUdWogf96KEMfThwdcgdQ977 KuROyTQf0gaFiIDcspBcpksBNTcTkvxIlTMtrddcpXu52M3ZdkBO+ACtyURq/xKnfrzE bbDmVk5SMXj3R5MXCPbCE/UcoDyFG1GxIGTRje91ZHleQuFYRwuLuVtg7GC78286lCTf 4d4Xi4/nyv+927iTMdTc2jF2kJLwwrbsYbMyD3+YSFsoJn+3bRhanl0L7Ah2b5Tyv81G WvXAu9YIiXnJnqLpDJ7ykJcuPjP6avsZH226OuB4FG5TMWO9YHEwDb89gDVtAKL78y8l MgCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Fu5f7y3OX1CXfpf+0Y2nRBjO6dnJzN7cHmwtPGvoLQE=; b=bhILrfwRhRxucf+wAa1aJpHjMl0EuGgXJGWiyG0T7GinB1g/ZTfAive3aB4oa/Ztdy zvdcyJNiRHX3+BGh9kJLnqHU991i+EL9nzTMNqPW4iu5HcYprwwErbpCxSGSOEFGDIUs a1FP2LG54HCr4So2TPnGZljrHT70cfdaqrKY93eAmlPJ/YHKwWr2qK13wPPLJ8Oxoj1S rF2jTDKPrcNbWh6l9FHajrjw1uVbuq0M5L/ct9QD1UWyGAL27ZkSGKj6Idd8/drSxhDK dTq4/FrqLKM5XGjBhaCYC+V5ZDpcVnN8vyJyfj4D0fBXffYhnR5mW/M8sXMSVaiUdITP xIow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rOa9WMUB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sz15-20020a1709078b0f00b0078ddc074afdsi10828451ejc.577.2022.10.19.03.33.03; Wed, 19 Oct 2022 03:33: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=rOa9WMUB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230183AbiJSKNB (ORCPT + 99 others); Wed, 19 Oct 2022 06:13:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232151AbiJSKMd (ORCPT ); Wed, 19 Oct 2022 06:12:33 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C68CE09C4; Wed, 19 Oct 2022 02:52: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 sin.source.kernel.org (Postfix) with ESMTPS id 16B65CE21A3; Wed, 19 Oct 2022 09:09:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B89CC433B5; Wed, 19 Oct 2022 09:09:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170595; bh=44uRYNzLL2dyaeADFwbtAehncvGKf6ItaLtVtAl1DKk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rOa9WMUBAm2LNOfyNlwnnp0ebKdGdaPzWYuPk+R1kXxZe/1c7NrSd0+37hLTcEHNM wwT48trz+E9eJLZ2dDYCE1zZTJcoihgjL/In5Tw0Col1Oe4kBQcMxcRUaCSlhz7TN6 WcesL+OwyTyIr1JxPwQzOuA5gCdlLlrboqH5z9aU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Po-Hao Huang , Ping-Ke Shih , Kalle Valo , Sasha Levin Subject: [PATCH 6.0 707/862] wifi: rtw89: fix rx filter after scan Date: Wed, 19 Oct 2022 10:33:14 +0200 Message-Id: <20221019083321.204392155@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747111757191144552?= X-GMAIL-MSGID: =?utf-8?q?1747111757191144552?= From: Po-Hao Huang [ Upstream commit 812825c2b204c491f1a5586c602e4ac75060493a ] In monitor mode we should be able to received all packets even if it's not destined to us. But after scan, the configuration was wrongly set, so we fix it. Signed-off-by: Po-Hao Huang Signed-off-by: Ping-Ke Shih Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220916033811.13862-7-pkshih@realtek.com Signed-off-by: Sasha Levin --- drivers/net/wireless/realtek/rtw89/fw.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless/realtek/rtw89/fw.c index 6473015a6b2a..c993fe9cf6b4 100644 --- a/drivers/net/wireless/realtek/rtw89/fw.c +++ b/drivers/net/wireless/realtek/rtw89/fw.c @@ -2289,6 +2289,7 @@ void rtw89_hw_scan_start(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif, { struct rtw89_vif *rtwvif = (struct rtw89_vif *)vif->drv_priv; struct cfg80211_scan_request *req = &scan_req->req; + u32 rx_fltr = rtwdev->hal.rx_fltr; u8 mac_addr[ETH_ALEN]; rtwdev->scan_info.scanning_vif = vif; @@ -2303,13 +2304,13 @@ void rtw89_hw_scan_start(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif, ether_addr_copy(mac_addr, vif->addr); rtw89_core_scan_start(rtwdev, rtwvif, mac_addr, true); - rtwdev->hal.rx_fltr &= ~B_AX_A_BCN_CHK_EN; - rtwdev->hal.rx_fltr &= ~B_AX_A_BC; - rtwdev->hal.rx_fltr &= ~B_AX_A_A1_MATCH; + rx_fltr &= ~B_AX_A_BCN_CHK_EN; + rx_fltr &= ~B_AX_A_BC; + rx_fltr &= ~B_AX_A_A1_MATCH; rtw89_write32_mask(rtwdev, rtw89_mac_reg_by_idx(R_AX_RX_FLTR_OPT, RTW89_MAC_0), B_AX_RX_FLTR_CFG_MASK, - rtwdev->hal.rx_fltr); + rx_fltr); } void rtw89_hw_scan_complete(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif, @@ -2323,9 +2324,6 @@ void rtw89_hw_scan_complete(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif, if (!vif) return; - rtwdev->hal.rx_fltr |= B_AX_A_BCN_CHK_EN; - rtwdev->hal.rx_fltr |= B_AX_A_BC; - rtwdev->hal.rx_fltr |= B_AX_A_A1_MATCH; rtw89_write32_mask(rtwdev, rtw89_mac_reg_by_idx(R_AX_RX_FLTR_OPT, RTW89_MAC_0), B_AX_RX_FLTR_CFG_MASK, From patchwork Wed Oct 19 08:33: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: 4865 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223979wrs; Wed, 19 Oct 2022 02:39:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4uQzRoUpEDZiScFs7bJ1kwXGGsK2qwpKSxEprgoUn9G1LBUbiTORemjpLfHBPKHiNUWbcM X-Received: by 2002:aa7:c58a:0:b0:459:1511:6cff with SMTP id g10-20020aa7c58a000000b0045915116cffmr6635024edq.27.1666172340693; Wed, 19 Oct 2022 02:39:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172340; cv=none; d=google.com; s=arc-20160816; b=cUHj0NuLsBL2BlAxMc4TTf5lP1jGaRz/drZDEJ8sM1aqwQrzQE8/Si077nQrfB9MST N6kS4anO2ZpnUo9QzS8LB8sSQcuZfKdw2Sj4ideOh1jwTp7gX7moWxIC+n+XVFHZVxCg j3Y2M0rchvt2XjQHIvkclfzgkQ1vaM+iqwOMN67ufN6iK6GmEGv/wk/p5JL2a1B35NGb Ltx0vYiJuJVNboFvVkQfVOE06PlJe2ZKr+2vVraOAoCNnFM0o0QrLWTjO3e2iWueWL1m r0CvnYgdsWdnch1J4/ctlRYTnDzodNGEvlopdAOBIkYu9Puy7pijGoG0++atPZsXaBWr 4QDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=n7G6QeBJWNK7LCG912/6gUUEmSVRY4BCXKoyiuL9ouQ=; b=wkrtjN9qEoAqMTK0YSJODNVxtpoCwcfNL7zCntnEXmpBEeTFxqjuH4BG4+64NNAKW9 di5fQ3yjI35nXYVLI8KkF5cNWwx78woLMi6pzEGVgx2bvUnJAPvqBc8CwS59deKW0LJE 74f0+EyI1h/opRER9J0yD2s740YOtVWJMR1Dol6rdryJDEG1BWf/4kbqn7nGe+7pwpJK 6qJ83RblKiU+aa+wqVvCBtuqCgZa9TOg0fSN7DjE/d+bp5a87iN4QVWhiAoldTCSxSbG Hk3B5yX5XyPWKLNux6WULNrgRkzX3I0oIBFHSRTlRI+bfVD6aTrgsFY89hoTxKPWSd+j TXzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=R1AO3kf9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z21-20020a05640235d500b0045d073d7ca5si13879565edc.339.2022.10.19.02.38.36; Wed, 19 Oct 2022 02:39: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=R1AO3kf9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233590AbiJSJ27 (ORCPT + 99 others); Wed, 19 Oct 2022 05:28:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233512AbiJSJ1Q (ORCPT ); Wed, 19 Oct 2022 05:27:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECB00E52E2; Wed, 19 Oct 2022 02:12: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 BEEA661843; Wed, 19 Oct 2022 09:10:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D390DC433D6; Wed, 19 Oct 2022 09:10:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170624; bh=C0chszaV7MjF4tzyFjt3te2p553hPsz6RhT2J+josWc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R1AO3kf9aJcUC3sPuAgNf15KISTUcqHGAXDkQehiQaLziBMmQKzCuRBSLT5c+LGK2 Hx+Ure/PJD1ClWAUflLgU8DfRMpFyU7pOJaxUIlTtQ6m+0uNcVFtsnioKLzTekSvtB nLFUlhmPfSgFld79UBeknBUSu8/wW8FYJgqq7ddU= 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 6.0 708/862] Bluetooth: L2CAP: initialize delayed works at l2cap_chan_create() Date: Wed, 19 Oct 2022 10:33:15 +0200 Message-Id: <20221019083321.252675098@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108328159029506?= X-GMAIL-MSGID: =?utf-8?q?1747108328159029506?= 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 2c9de67daadc..770891f68703 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -61,6 +61,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) { @@ -476,6 +479,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; @@ -3320,10 +3326,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 Wed Oct 19 08:33: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: 5201 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp264493wrs; Wed, 19 Oct 2022 04:20:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7HYQWP+LqNqstwatyFzN6Oy50Yq2qRwsRjS7cLN/2epFBQCfSChou2jxhbJTq4MEiJmfqZ X-Received: by 2002:a17:907:6e09:b0:78d:a326:49c6 with SMTP id sd9-20020a1709076e0900b0078da32649c6mr6241461ejc.507.1666178409325; Wed, 19 Oct 2022 04:20:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178409; cv=none; d=google.com; s=arc-20160816; b=T3kV1fxX4g2kYpN+hMRIOj44kUPLPjP6VvgeOmG8Q/ZNlPeVGtTd7XlH9x1bRADDWQ ARrPnbSvaYhtuGH75iJNC03pg3st8zCveFwg+QQ5FoquVYP9rG2qphKyTLve3kk2SHQE Pf8BX1dakjL/zDJmLOp/Ka0F6qFhO4Ipfs/EGDn118K08ElpVL5U9+olcy4CP3B57tAE ymFnhKZBBn/ObpT4V6pyavxOUu3NFFzjdBmmMi9tyefz6MepmcgIyxkHVtNL/OvKHXkx xCEQ3VztxunaJ8PkWfJ6ijuJozTROE0jvrvnInbbPh2pDU35LEZ92U210nQuRnsazl75 rpGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NJZfZNdcqE3SrvhkFsD6A4LRPV71IaZuZ5cU8F13qXA=; b=AplTD9wKG2tJqj/NWgLBibaqU8yReljZoIDHoDAgJVQsGueadko5iX5GjZnLpY87e7 VuT39tGiiqPSEtRlNpNv5LEEsbQSPnI+bEctPPSPapZ+MFmNYRTNMTXnjDhQQC1k2prf lp+7QqsA6+y/Tu9oX3gch/nuRlkT3viNoKcPCZlvDtqDGB5fWTpipjap2uU6HrQ5KwN8 qRIV/ksaUmASmIg/btPUwGrg9HXTLP0oerjwGIPXgEFTtAofI4uNPGykvpUmEOPdvxTj Nw9AbdRfIEB6QLPce2+M8Rd8LO/5Skmf1rpQw2IJhxWQGw45T1wP7+PMm1sVwDZ6HK9B VKHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="M//dTP9J"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qa16-20020a170907869000b007877b1c7f27si12758221ejc.829.2022.10.19.04.19.43; Wed, 19 Oct 2022 04:20: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="M//dTP9J"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231313AbiJSLJd (ORCPT + 99 others); Wed, 19 Oct 2022 07:09:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232959AbiJSLIm (ORCPT ); Wed, 19 Oct 2022 07:08:42 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22C142A246; Wed, 19 Oct 2022 03:37: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 B7C9CCE21A0; Wed, 19 Oct 2022 09:10:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AFB82C433C1; Wed, 19 Oct 2022 09:10:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170653; bh=Qq/nS/EG95y0I/Z0ahk81L6aZDYvt5NYsst/VyPOYko=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M//dTP9Jw++yYqUKymDiKi7OKGzXR0i75avDlZjvdrOeOZj/13/cUUdolxpYunrce D/o2c5DiPMEs0pjZXGHAFb+Ww5e+LTnjx94rZkM/csHqGwYuSABLYNnxgjLrQzcmms tMqgCUMK1K7hZ4Iu0wu1Qj0oJAQyv3aMjcmhmLn4= 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 6.0 709/862] Bluetooth: hci_sysfs: Fix attempting to call device_add multiple times Date: Wed, 19 Oct 2022 10:33:16 +0200 Message-Id: <20221019083321.288699533@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114691623857512?= X-GMAIL-MSGID: =?utf-8?q?1747114691623857512?= 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 4e3e0451b08c..08542dfc2dc5 100644 --- a/net/bluetooth/hci_sysfs.c +++ b/net/bluetooth/hci_sysfs.c @@ -48,6 +48,9 @@ void hci_conn_add_sysfs(struct hci_conn *conn) BT_DBG("conn %p", conn); + if (device_is_registered(&conn->dev)) + return; + dev_set_name(&conn->dev, "%s:%d", hdev->name, conn->handle); if (device_add(&conn->dev) < 0) { From patchwork Wed Oct 19 08:33: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: 4872 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225282wrs; Wed, 19 Oct 2022 02:42:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6ErpSM/g89dD57hShq4lxgP8TyVk8nsF/8EF7qJLggDws4UcOZUFvT3JEq9WLoKUulo/A7 X-Received: by 2002:aa7:8741:0:b0:562:bacb:136a with SMTP id g1-20020aa78741000000b00562bacb136amr7725517pfo.46.1666172566688; Wed, 19 Oct 2022 02:42:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172566; cv=none; d=google.com; s=arc-20160816; b=gorQKZGj5vISeFdsrhkysTqPkXqMEGihUKryhge/3/J22Zu5U4vx4fKaFuqnyzThKV /awAPTPNJa3zczCZrnMXP43gZZLxSgp6kgWGEJWODQsbX755eso1Q2FwMLdezmLnqiuq 0UFjr2t+QqhHop1UwUp20KMqfHntILx1OHU5dclj4/D7VlJ18WZg7+0bdj0Ssg/3QThs W51Jp93x3C6dhqlWsPz8GdEXA48PaZlokVUnYYtisZW9DjPyLNrJse0mmc8dN9E5APvU 3vxdxk46vCtDv1G5lddODotRTi3O8qOms5N554kGOleHb4w7stPR8ioBwpSQ6grRc1pn DLew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kGKu++jowVTyKza00MJkr9STy6L1hBrq/Vx4o9GAo3g=; b=GHWmcY2x1siGmrCLREN4M3oRI+4WJf79paHRUKHoc6YXEerH4Onmc/jChPKKfF4h/V zfpXBoSZKfWNBwxBGmQRl4QLmP+C/jGCov9vHKuIjOBXZkYjA253vX1H2simpam9IvNi 8ycqDSm+zy3SvVsRrxRXLcTYtiSSEyNgZ3dpbWyxECqIZlq7ej51VrN2huemdWqrrphH h9gcVFNRpr+eYPrpTgk2YnWNWS1p9dCLEr82z6wTxnPVgfTFzkstA0/YrJP75RXbOoCm Pv36cv4lFnC7QYd9V0MkH2RDM1WckHkJKvjEDI/OeTlZU86IAEC+QAW5JNL3z5zIVl3S zMTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=E6EL5pi7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b16-20020a630c10000000b0043ce223c86dsi19838951pgl.843.2022.10.19.02.42.33; Wed, 19 Oct 2022 02:42: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=E6EL5pi7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233747AbiJSJcC (ORCPT + 99 others); Wed, 19 Oct 2022 05:32:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233410AbiJSJ2N (ORCPT ); Wed, 19 Oct 2022 05:28:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85205E8AA4; Wed, 19 Oct 2022 02:12: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 63DA761890; Wed, 19 Oct 2022 09:11:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79029C433D6; Wed, 19 Oct 2022 09:11:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170673; bh=nqnzV76i/7+Dexr0VLbVB6a6AGYIYb3csiWZnBgbDck=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E6EL5pi7bX2FjNV9kQuTzCqH/8kfaXQgi0LRaj6D7woTdt6dIpBASa7Ww2FBLZfJ4 HJK+yxFKhZsSDD8yN8O/wBXmoAnsGJvrQvnJ5IYbqqp/7LYo2NLbkNeSYsbQYgUw0T tBkUEwQIwUKXr9lMZtL9cXUengOgJtlMO/BcBg2g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Luiz Augusto von Dentz , Sasha Levin Subject: [PATCH 6.0 710/862] Bluetooth: hci_event: Make sure ISO events dont affect non-ISO connections Date: Wed, 19 Oct 2022 10:33:17 +0200 Message-Id: <20221019083321.320060597@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108565267123316?= X-GMAIL-MSGID: =?utf-8?q?1747108565267123316?= From: Luiz Augusto von Dentz [ Upstream commit ed680f925aea76ac666f34d9923cb40558f4e97b ] ISO events (CIS/BIS) shall only be relevant for connection with link type of ISO_LINK, otherwise the controller is probably buggy or it is the result of fuzzer tools such as syzkaller. Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin --- net/bluetooth/hci_event.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index d6f0e6ca0e7e..ab79a978deb5 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -6778,6 +6778,13 @@ static void hci_le_cis_estabilished_evt(struct hci_dev *hdev, void *data, goto unlock; } + if (conn->type != ISO_LINK) { + bt_dev_err(hdev, + "Invalid connection link type handle 0x%4.4x", + handle); + goto unlock; + } + if (conn->role == HCI_ROLE_SLAVE) { __le32 interval; @@ -6898,6 +6905,13 @@ static void hci_le_create_big_complete_evt(struct hci_dev *hdev, void *data, if (!conn) goto unlock; + if (conn->type != ISO_LINK) { + bt_dev_err(hdev, + "Invalid connection link type handle 0x%2.2x", + ev->handle); + goto unlock; + } + if (ev->num_bis) conn->handle = __le16_to_cpu(ev->bis_handle[0]); From patchwork Wed Oct 19 08:33: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: 5141 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp252074wrs; Wed, 19 Oct 2022 03:53:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4gXejwORYPLRSjhkkrNRTQ+x6l+SstrAmruekExjNU0KXGn9U2Xn3CockENsBeIYJFLilT X-Received: by 2002:a17:906:8a79:b0:78d:9c52:2196 with SMTP id hy25-20020a1709068a7900b0078d9c522196mr6304383ejc.328.1666176808744; Wed, 19 Oct 2022 03:53:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176808; cv=none; d=google.com; s=arc-20160816; b=B/kCkKGbFJd1C7uHQcW9s7j8ry5QCBdB86wZbWY4QvHg1In5LEB1UbC6Ka1Yi4B326 xOPW8oysGCmW/MMNUgGNqxktPGppb2p7O0zJ/2D2a7OHN7REzgr2GqHCURyLr+A3FcdL e+xcYSrZL6Q0hqXIockYANoslqMaV45TJQIEs7zdt9azfhMQNIyQt7qY4o0rPY+h6bPv LkRnuLrhKB/FrTAWkcnC6i/h78POHGKCzhZKFnwwm0mlMeEkxrjrzBmYHSJHgZLgb6wq a1Jnjf2XyrSch/Jb0feXSO6EkZ4eWZjoHrnUZe+kTdt5AWS0EdveTL5RaLZ6fKlE0rV0 Bk5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=u95MpHAAfzf6FFlDZJUXEyDup8IeV4MZHMz1A7Ogets=; b=Zch3QfPX/uTWyxG72/YikeYqLc6N+94f7UCOdIV/UZdKO+PUzLlwF/ZAdYWsDuLQGx eq68sKgp7YZqJ+FMwus5qL35gqOD3o9o7JjD3E97ymk5oga4+qmXaV+kkPGaUiZOdsu8 2uvj956lE6Q7MMntnRISptB0TabS9VWW056yJFYEkcdhih3UF6zU6Kgj1w7ROn6Cit8R TJ+5K7ouHzcaVHFHT0AVaa6Cq8JbEfCpak3s70ICdNLa5idgtQofFJWXhkltvdLWeMX+ 5gSVH8JfofrQFwARY6cb4aEYvCeuXSZhl+xyIO1ysZYBWVrckUPDKTT3O46EaY9Zlo8N SaBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TRaxY+nT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jg15-20020a170907970f00b0077ccad53173si14930195ejc.277.2022.10.19.03.53.04; Wed, 19 Oct 2022 03:53: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=TRaxY+nT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232253AbiJSKvo (ORCPT + 99 others); Wed, 19 Oct 2022 06:51:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234577AbiJSKtc (ORCPT ); Wed, 19 Oct 2022 06:49:32 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E0E511A979; Wed, 19 Oct 2022 03:22: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 C1D59B824B4; Wed, 19 Oct 2022 09:11:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 275F9C433D6; Wed, 19 Oct 2022 09:11:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170676; bh=YHvVHIJX2HPHSLT4eGLhe20mkccL+miqWFxNvBZc7ac=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TRaxY+nTAH1QeTJ8BG6T1OfZoC/RXEP5s8sVEThS9re9LYkrXGm+QEP6MucfvBNVF oSbj1/Ob+x/yAOJhIDGerHfwvyHS6vidGqFLCMEwaIIyRh5om08CoYfH1tKUfe8RoF KipfUZlf3+paDM3JYemLcfgKWAnCoBH0L1X/M47c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Richard Cochran , Vadim Fedorenko , Michael Chan , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.0 711/862] bnxt_en: replace reset with config timestamps Date: Wed, 19 Oct 2022 10:33:18 +0200 Message-Id: <20221019083321.353699696@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747113013386505536?= X-GMAIL-MSGID: =?utf-8?q?1747113013386505536?= From: Vadim Fedorenko [ Upstream commit 8db3d514e96715c897fe793c4d5fc0fd86aca517 ] Any change to the hardware timestamps configuration triggers nic restart, which breaks transmition and reception of network packets for a while. But there is no need to fully restart the device because while configuring hardware timestamps. The code for changing configuration runs after all of the initialisation, when the NIC is actually up and running. This patch changes the code that ioctl will only update configuration registers and will not trigger carrier status change, but in case of timestamps for all rx packetes it fallbacks to close()/open() sequnce because of synchronization issues in the hardware. Tested on BCM57504. Cc: Richard Cochran Signed-off-by: Vadim Fedorenko Reviewed-by: Michael Chan Link: https://lore.kernel.org/r/20220922191038.29921-1-vfedorenko@novek.ru Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c index 8e316367f6ce..2132ce63193c 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c @@ -505,9 +505,13 @@ static int bnxt_hwrm_ptp_cfg(struct bnxt *bp) ptp->tstamp_filters = flags; if (netif_running(bp->dev)) { - rc = bnxt_close_nic(bp, false, false); - if (!rc) - rc = bnxt_open_nic(bp, false, false); + if (ptp->rx_filter == HWTSTAMP_FILTER_ALL) { + rc = bnxt_close_nic(bp, false, false); + if (!rc) + rc = bnxt_open_nic(bp, false, false); + } else { + bnxt_ptp_cfg_tstamp_filters(bp); + } if (!rc && !ptp->tstamp_filters) rc = -EIO; } From patchwork Wed Oct 19 08:33: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: 5133 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp251806wrs; Wed, 19 Oct 2022 03:52:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5kRg9+aJfqV1wmOHRg87YDWS/7Cx2L1OXrpE9jw7neCalfObMU/Vg0AwGyV0ONKgicXA0T X-Received: by 2002:a05:6402:50cf:b0:45c:dfce:66ae with SMTP id h15-20020a05640250cf00b0045cdfce66aemr6555536edb.370.1666176763277; Wed, 19 Oct 2022 03:52:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176763; cv=none; d=google.com; s=arc-20160816; b=ebp88ILRMYT2v7Yv/ULVbWLjZ29WydvWMuB7HTfihj6Hg+7d2qoq8qVG/nJkeD55gV B3QRoU2CFhIHSwTgGjx1QX0HyuW9GYGU/Bs/PpUiFfHTtQ5zI4BJUzK/063PFQ6q80Bz e1N1WyPtpPjpxgc/xmjiRSe2XKv79xqH77cPlnSdiwB0UmuNua5iB5bJ4uy0M2GfOKqP hQTw3/gKRURi/t880PpOt41yvafgd2ErSmftmCZ7RGDei3C84WhWo01QObMKNUZ4hnqg zZWmBsMN5ovKF9xPkHKZzBF/l5/FBBL4ssPz5LyOUyRoc1mBUMc2ue8m1l/9lO1lQsr1 KbHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rdvUq6oC8llHPyJjqCSd1Mf00yHM3GF5rj9xuUaHSKA=; b=K+9X68HzNVQ+8VGlo0kZYjyS6EZPYeFXI4xTxo9Glca9cPOsxvMUOyZp7XE3tOlNhw pmZIORLTdBzng+7IX4U2MabB/0vqeTydAEDKgy/AEaN4CZr3vV3eVqFYd8Z+WTD2rnF/ cZS2Zge/w6rG1pjyjHcRjDo8KBTLYBEjZ+mgnz38Ka+k5TUurLpYgl4rPd63K5IFmEwP 26+6O+XvwSW6K7bvOhx3KoF8qbHxTviNIO9J2a7bQq2zN9db9iM5ws+NC8aqscmMAfTI 38NYevLxslXJfutErLCi0cszxQd2+vvRUvsJTK82a4uQl4WAsjMYFDgXc+84zMqaTeqn iwOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yiIXr9o6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ho34-20020a1709070ea200b0078db3ce1e59si16686766ejc.38.2022.10.19.03.52.19; Wed, 19 Oct 2022 03:52: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=yiIXr9o6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234526AbiJSKvM (ORCPT + 99 others); Wed, 19 Oct 2022 06:51:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234520AbiJSKtX (ORCPT ); Wed, 19 Oct 2022 06:49:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C749D26578; Wed, 19 Oct 2022 03:22: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 40062B824C6; Wed, 19 Oct 2022 09:11:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AFE6DC433C1; Wed, 19 Oct 2022 09:11:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170679; bh=sExncP2vEI4lKfEjoGTg9PlosArh89bqCxfpK8p7bwI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yiIXr9o65sfXknTT59iBiMYcEVBqi2F3Ff2Eii/Qv7xpmHRMN2AfHRWv484ObohNL YGglSnk+Sh9LtoIrBo1DzT4tus4F4c/QDZuUlM8v2YELL/3rLkDrVpJADaSA5zTbMn 27oKynSgABNKhuOURhpJGQdv4wYgZFyggNNFPrXE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hou Tao , Martin KaFai Lau , Sasha Levin Subject: [PATCH 6.0 712/862] selftests/bpf: Free the allocated resources after test case succeeds Date: Wed, 19 Oct 2022 10:33:19 +0200 Message-Id: <20221019083321.394063761@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112965415075258?= X-GMAIL-MSGID: =?utf-8?q?1747112965415075258?= From: Hou Tao [ Upstream commit 103d002fb7d548fb1187e350f2b73788558128b9 ] Free the created fd or allocated bpf_object after test case succeeds, else there will be resource leaks. Spotted by using address sanitizer and checking the content of /proc/$pid/fd directory. Signed-off-by: Hou Tao Link: https://lore.kernel.org/r/20220921070035.2016413-3-houtao@huaweicloud.com Signed-off-by: Martin KaFai Lau Signed-off-by: Sasha Levin --- .../bpf/map_tests/array_map_batch_ops.c | 2 ++ .../bpf/map_tests/htab_map_batch_ops.c | 2 ++ .../bpf/map_tests/lpm_trie_map_batch_ops.c | 2 ++ tools/testing/selftests/bpf/test_maps.c | 24 ++++++++++++------- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/tools/testing/selftests/bpf/map_tests/array_map_batch_ops.c b/tools/testing/selftests/bpf/map_tests/array_map_batch_ops.c index 78c76496b14a..b595556315bc 100644 --- a/tools/testing/selftests/bpf/map_tests/array_map_batch_ops.c +++ b/tools/testing/selftests/bpf/map_tests/array_map_batch_ops.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -137,6 +138,7 @@ static void __test_map_lookup_and_update_batch(bool is_pcpu) free(keys); free(values); free(visited); + close(map_fd); } static void array_map_batch_ops(void) diff --git a/tools/testing/selftests/bpf/map_tests/htab_map_batch_ops.c b/tools/testing/selftests/bpf/map_tests/htab_map_batch_ops.c index f807d53fd8dd..1230ccf90128 100644 --- a/tools/testing/selftests/bpf/map_tests/htab_map_batch_ops.c +++ b/tools/testing/selftests/bpf/map_tests/htab_map_batch_ops.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -255,6 +256,7 @@ void __test_map_lookup_and_delete_batch(bool is_pcpu) free(visited); if (!is_pcpu) free(values); + close(map_fd); } void htab_map_batch_ops(void) diff --git a/tools/testing/selftests/bpf/map_tests/lpm_trie_map_batch_ops.c b/tools/testing/selftests/bpf/map_tests/lpm_trie_map_batch_ops.c index 87d07b596e17..b66d56ddb7ef 100644 --- a/tools/testing/selftests/bpf/map_tests/lpm_trie_map_batch_ops.c +++ b/tools/testing/selftests/bpf/map_tests/lpm_trie_map_batch_ops.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -150,4 +151,5 @@ void test_lpm_trie_map_batch_ops(void) free(keys); free(values); free(visited); + close(map_fd); } diff --git a/tools/testing/selftests/bpf/test_maps.c b/tools/testing/selftests/bpf/test_maps.c index cbebfaa7c1e8..4d42ffea0038 100644 --- a/tools/testing/selftests/bpf/test_maps.c +++ b/tools/testing/selftests/bpf/test_maps.c @@ -658,13 +658,13 @@ static void test_sockmap(unsigned int tasks, void *data) { struct bpf_map *bpf_map_rx, *bpf_map_tx, *bpf_map_msg, *bpf_map_break; int map_fd_msg = 0, map_fd_rx = 0, map_fd_tx = 0, map_fd_break; + struct bpf_object *parse_obj, *verdict_obj, *msg_obj; int ports[] = {50200, 50201, 50202, 50204}; int err, i, fd, udp, sfd[6] = {0xdeadbeef}; u8 buf[20] = {0x0, 0x5, 0x3, 0x2, 0x1, 0x0}; int parse_prog, verdict_prog, msg_prog; struct sockaddr_in addr; int one = 1, s, sc, rc; - struct bpf_object *obj; struct timeval to; __u32 key, value; pid_t pid[tasks]; @@ -760,6 +760,7 @@ static void test_sockmap(unsigned int tasks, void *data) i, udp); goto out_sockmap; } + close(udp); /* Test update without programs */ for (i = 0; i < 6; i++) { @@ -822,27 +823,27 @@ static void test_sockmap(unsigned int tasks, void *data) /* Load SK_SKB program and Attach */ err = bpf_prog_test_load(SOCKMAP_PARSE_PROG, - BPF_PROG_TYPE_SK_SKB, &obj, &parse_prog); + BPF_PROG_TYPE_SK_SKB, &parse_obj, &parse_prog); if (err) { printf("Failed to load SK_SKB parse prog\n"); goto out_sockmap; } err = bpf_prog_test_load(SOCKMAP_TCP_MSG_PROG, - BPF_PROG_TYPE_SK_MSG, &obj, &msg_prog); + BPF_PROG_TYPE_SK_MSG, &msg_obj, &msg_prog); if (err) { printf("Failed to load SK_SKB msg prog\n"); goto out_sockmap; } err = bpf_prog_test_load(SOCKMAP_VERDICT_PROG, - BPF_PROG_TYPE_SK_SKB, &obj, &verdict_prog); + BPF_PROG_TYPE_SK_SKB, &verdict_obj, &verdict_prog); if (err) { printf("Failed to load SK_SKB verdict prog\n"); goto out_sockmap; } - bpf_map_rx = bpf_object__find_map_by_name(obj, "sock_map_rx"); + bpf_map_rx = bpf_object__find_map_by_name(verdict_obj, "sock_map_rx"); if (!bpf_map_rx) { printf("Failed to load map rx from verdict prog\n"); goto out_sockmap; @@ -854,7 +855,7 @@ static void test_sockmap(unsigned int tasks, void *data) goto out_sockmap; } - bpf_map_tx = bpf_object__find_map_by_name(obj, "sock_map_tx"); + bpf_map_tx = bpf_object__find_map_by_name(verdict_obj, "sock_map_tx"); if (!bpf_map_tx) { printf("Failed to load map tx from verdict prog\n"); goto out_sockmap; @@ -866,7 +867,7 @@ static void test_sockmap(unsigned int tasks, void *data) goto out_sockmap; } - bpf_map_msg = bpf_object__find_map_by_name(obj, "sock_map_msg"); + bpf_map_msg = bpf_object__find_map_by_name(verdict_obj, "sock_map_msg"); if (!bpf_map_msg) { printf("Failed to load map msg from msg_verdict prog\n"); goto out_sockmap; @@ -878,7 +879,7 @@ static void test_sockmap(unsigned int tasks, void *data) goto out_sockmap; } - bpf_map_break = bpf_object__find_map_by_name(obj, "sock_map_break"); + bpf_map_break = bpf_object__find_map_by_name(verdict_obj, "sock_map_break"); if (!bpf_map_break) { printf("Failed to load map tx from verdict prog\n"); goto out_sockmap; @@ -1124,7 +1125,9 @@ static void test_sockmap(unsigned int tasks, void *data) } close(fd); close(map_fd_rx); - bpf_object__close(obj); + bpf_object__close(parse_obj); + bpf_object__close(msg_obj); + bpf_object__close(verdict_obj); return; out: for (i = 0; i < 6; i++) @@ -1282,8 +1285,11 @@ static void test_map_in_map(void) printf("Inner map mim.inner was not destroyed\n"); goto out_map_in_map; } + + close(fd); } + bpf_object__close(obj); return; out_map_in_map: From patchwork Wed Oct 19 08:33: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: 5140 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp252066wrs; Wed, 19 Oct 2022 03:53:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5CHj046NzXEzVcTEsJtDlixBK1XfPGaq1PXTjeKNePeK36LoWyNQZ8cVkIHzhFgb9C7pN5 X-Received: by 2002:a17:907:3e0f:b0:791:9529:3674 with SMTP id hp15-20020a1709073e0f00b0079195293674mr6050116ejc.503.1666176807239; Wed, 19 Oct 2022 03:53:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176807; cv=none; d=google.com; s=arc-20160816; b=RTUw6WFS1roCVHdCog53kjAWlGC1SI1YXeI5THOtn+pWD8j7eEM3W821iFMSH32eJD IITvgGtcAkU1r1IWokZCYDgX6xXxt92rLwFxBMdzUFPXwZgVsHPxgNn6enGj9BSMLzkP HmAG8A1Q2SMSIAm/VSbbVzRKftjibZooZeQew89taHsSWVEsuSuA7zYgbnIpEstJcdS5 ZwWmkidZkxHaogt3xZG0614Hz4iGItlxNZ9woe9Z5xUqC/UWI2jplB+mH1nSpYtjAMub /FUgVylyk0Pw02XjIUWJZPAM/2CMY60IKxUsK75rynI4DIiiXguP6+Jmby2ALJCAUk39 Uv5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Bvop/fiX8oo9wmbXwfDKLsyD0kIhNNKOKZW1TjHzQEc=; b=kQjnea2It21JQf3dlAF/izOpRWiJxbXUEESNK6MvND35lYJq+Zq36E17cgAPsP/dOE pBx9MKtyNjGFg6X5v+X6juAHzOYdxHrF4AzEjVlGY3XJWjOTWTaVruS54+RPsM9YJ4uv eSQNF5LgKPHi97JpgcveYvMGIDK1yoZ1frAzxJB0c21Ujwszwz5kA1pNYDJTU972QAIu Y3O9dS8VVPHPvaJ86KKs5N0SwwR86fMlCR2cX3YP4/SREfw6HvMg+pTwti4C5fsqO4iF SYNk8dEPjbcor2rZIUDQhrti0r0+y+hIGkpHdSEquhQ1dkVHquU/Nf3x3R2B1aZHU8tD kQ9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eKVReiPA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y4-20020aa7ce84000000b0045c29d74fd0si12586903edv.291.2022.10.19.03.53.03; Wed, 19 Oct 2022 03:53: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=eKVReiPA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234592AbiJSKvj (ORCPT + 99 others); Wed, 19 Oct 2022 06:51:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234572AbiJSKta (ORCPT ); Wed, 19 Oct 2022 06:49:30 -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 C54C215A335; Wed, 19 Oct 2022 03:22: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 D467AB824C5; Wed, 19 Oct 2022 09:11:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4FA9CC433C1; Wed, 19 Oct 2022 09:11:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170681; bh=Cq0O6Lq0YGpcmM8L/xBbBUGYACre6Ya9iOwxDcgfiwU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eKVReiPAVG9Jhd5gqZMiiK0NQFtTU/1fbN5yl/CjRlYiXaAklmkHV9RVz8VZrLMBw HGtDdkdmIa7SWGV7gL40VEXZ/uk2wMolvL8wGKlyorGn3TCHNp9BOx8ycbBP/s7mlv tUohhIzLzCCZRF2eAvURLD/6z/Ww4TEnVxqB5r8M= 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 6.0 713/862] can: bcm: check the result of can_send() in bcm_can_tx() Date: Wed, 19 Oct 2022 10:33:20 +0200 Message-Id: <20221019083321.432851272@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747113011829282997?= X-GMAIL-MSGID: =?utf-8?q?1747113011829282997?= 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 e60161bec850..f16271a7ae2e 100644 --- a/net/can/bcm.c +++ b/net/can/bcm.c @@ -274,6 +274,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) @@ -298,11 +299,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 Wed Oct 19 08:33: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: 4873 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225339wrs; Wed, 19 Oct 2022 02:42:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7giP2mxa7jq+2Ny+/NKtuS+lHI6WLQ1WFXAS/VRe+a2up2H1MxTVe+cuCzz9hFaA7479gr X-Received: by 2002:a05:6402:f24:b0:45c:d71c:7f62 with SMTP id i36-20020a0564020f2400b0045cd71c7f62mr6696554eda.416.1666172576652; Wed, 19 Oct 2022 02:42:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172576; cv=none; d=google.com; s=arc-20160816; b=pXHFbGmiVwIOGnYi0N5zxWdMgL8A5Zvm1oGrr1sM+QJVQPfmXO42AxAfcDFl8a7J64 iektTinRmMcS6nIctkqFOx3BCUkPtmcNqNMuI531DD0N+k7LNMP92wPuaucwAprbae1r mzQRbeG6UILYZPMSJAnHiELcOfVfMgKdc59/zAH3SFTOdlkfeK9YtoYE4MPV4zJ6MSaf JYm5ECAHeW97TLCtaXnn8HnGFMJTut+56V4drWY+emXkEC+0/naGxfNU8Sa5J2u59Gyw gLZWWlNfAQLXTQWxxzbpNH0wF4H479xB48+wt4aAHQB+YXwlnmib1xxvuf16pLA8On4x y/kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=V1DW926xrDLD0odpYwAuqoFBPROg9W5scnIjfab8m9o=; b=F72XjaigDGdupQtzO3Hun20x5luzUtKUW95ru5fMhHDmxR20TqdujwaDrhGZXOXpGX hjryq5mI7yAgwuNgtF58vILhUN9wK3urm8SqwlHlmDzDBEfw1hzLbVdKr7VTIdruaQi/ /2c3nmYUPGCYx6UlXTEEyJ1Uyd9o/Y9QQLep4+MwVJ/Ty7kQDCL6VhuNS7/YQTBVDpOo 2jYAT+YYt7kf9iEoRX4+5rGc4FDVCkf6PCNVUrXEQk03xgm8/pY/8ySJZFjfDd1LIcKE tUAqWjKMYJuaup2A3NPpLdZ8d4P+YKG/X9s+froMtpRAwhhSS9UxdsVor9arn2q5zlIF Awgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Q0R7Rg0M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dn12-20020a17090794cc00b0077912fb01ddsi15720548ejc.613.2022.10.19.02.42.31; Wed, 19 Oct 2022 02:42:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Q0R7Rg0M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233573AbiJSJbF (ORCPT + 99 others); Wed, 19 Oct 2022 05:31:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233540AbiJSJ1U (ORCPT ); Wed, 19 Oct 2022 05:27:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68778E4C33; Wed, 19 Oct 2022 02:12:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D7EB96174B; Wed, 19 Oct 2022 09:11:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E84E5C433C1; Wed, 19 Oct 2022 09:11:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170684; bh=Nf/HQ7h/Z5nwQBjoAMYb7EpY/DT/8776VVnjScGaUA8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q0R7Rg0MJfcgplWFV8uLphZA6LzaHh6ilyFT+9U+KoM/7IQXgELKrSGTzD4pxzegm FVF3TEE4AG/jkT8HSG6Y7mwnJSCIHAjyn8WPli7nudZjmKLsq5q3XkpVF7Y2O95l+L pyhi4xD9AAKtVSo78VmSVpHc8JwztMHa0eUTFElY= 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 6.0 714/862] wifi: rt2x00: dont run Rt5592 IQ calibration on MT7620 Date: Wed, 19 Oct 2022 10:33:21 +0200 Message-Id: <20221019083321.481998077@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108575474526461?= X-GMAIL-MSGID: =?utf-8?q?1747108575474526461?= 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 18102fbe36d6..de81b6060359 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c @@ -4365,7 +4365,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); } bbp = rt2800_bbp_read(rt2x00dev, 4); From patchwork Wed Oct 19 08:33: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: 5129 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp251600wrs; Wed, 19 Oct 2022 03:52:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5L9o6KLIGIzfFwwbq3oVAKdwz1ia/WQJiD5XYWlOULIy72cWGi8AmwLPyJR3rUfcVt8Xrg X-Received: by 2002:a17:907:7245:b0:78d:ec9c:e743 with SMTP id ds5-20020a170907724500b0078dec9ce743mr6288130ejc.466.1666176727211; Wed, 19 Oct 2022 03:52:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176727; cv=none; d=google.com; s=arc-20160816; b=QrixOvAGayDcKvavvbe0Yv+4fNAfezowx6s3X2jWxk3lhjgLUkWvVk/1xxd+6LJjyF iVFobMZvP3Nq15Tj7wW/ZooM0pfyqcQObjz19VkSjhmsdwXLMagMHPx17C9e/37ucHa+ mG2iu7vp50kdnlEbF/0kJJc9sam5vm3OCFVw/NT26StJbSv9eWbTUbZThtJlNqtwr4r7 0ulyJTKnKEQ3kY7uSw//LyxppCwY3iz1QWLsUCdodIiGF997v4TlyWXE7nY+XRSv1dhl 4QYpkG7oEcBDLguxfTFgrPWKWXUtmQvwayD7WSafABK1CPUEYOcnrCTUuph9epwTFYDX EVjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HwVk8TraOSGJiT/2FBELSmU/AZiU77kfE1YTFLRgS+8=; b=LVTt4UfHtCRcrpKZP0g3RJbijuzqtlm8lI2SWUdKnreYngfIHflDwIjAyIaN83Tp3W 2SLPwE3TozIetr0m59V4m0y//Qi5BuBVoyPEax7rQipC+O2GpSY9JxUXZgvuD8/Zn593 QHja1CcUg5wSG7vTOtJFWjk7vDm/WPtRbZ64H+dMHKn/DWgGEpLYHo/oWtYjVuBRPIPf OHOoQSD6pB64C76MELH85Eu9tCKL7tbSyRk8PNNmKW7XHVT1W4QlFm+G5qWBnLEGxZUW eX/XBB5AjRGxrHqtk57I2GyoKUs91p7dIUe07UedCOlMG5JMMn5rOfgFSBMxO2K+LoW/ 6Fhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RgvXyWSz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m10-20020a50cc0a000000b00458d94f1a45si12264012edi.413.2022.10.19.03.51.42; Wed, 19 Oct 2022 03:52: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=RgvXyWSz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234490AbiJSKvB (ORCPT + 99 others); Wed, 19 Oct 2022 06:51:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234429AbiJSKtC (ORCPT ); Wed, 19 Oct 2022 06:49:02 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1A07120EDC; Wed, 19 Oct 2022 03:22:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3C21EB823A9; Wed, 19 Oct 2022 09:11:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA7D1C433C1; Wed, 19 Oct 2022 09:11:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170687; bh=OAml6ui7Hgris0BznGN0f8ZBUbQ59U544//4SVvW1go=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RgvXyWSzPKzB0MPYlLZFhY6iuHYe02VUugFPLtB2/Q2acvstYvDFtham2u/vH5JXE HOmv/WKVM4/9jzn9D8DKgN1rfG5OiGqGXsOgwlww8nFqXX8qHKmL0EwA7d/97sTtSa xOVdNV6EArRUTcXy6ODwWM0fhJikQCDaJVtbHQQg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Serge Vasilugin , Daniel Golle , Stanislaw Gruszka , Kalle Valo , Sasha Levin Subject: [PATCH 6.0 715/862] wifi: rt2x00: set correct TX_SW_CFG1 MAC register for MT7620 Date: Wed, 19 Oct 2022 10:33:22 +0200 Message-Id: <20221019083321.533865529@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112928125481304?= X-GMAIL-MSGID: =?utf-8?q?1747112928125481304?= From: Daniel Golle [ Upstream commit eeb50acf15762b61921f9df18663f839f387c054 ] Set correct TX_SW_CFG1 MAC register as it is done also in v3 of the vendor driver[1]. [1]: https://gitlab.com/dm38/padavan-ng/-/blob/master/trunk/proprietary/rt_wifi/rtpci/3.0.X.X/mt76x2/chips/rt6352.c#L531 Reported-by: Serge Vasilugin Signed-off-by: Daniel Golle Acked-by: Stanislaw Gruszka Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/4be38975ce600a34249e12d09a3cb758c6e71071.1663445157.git.daniel@makrotopia.org Signed-off-by: Sasha Levin --- drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c index de81b6060359..5e7bca935dd4 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c @@ -5868,7 +5868,7 @@ static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev) rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404); } else if (rt2x00_rt(rt2x00dev, RT6352)) { rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000401); - rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x000C0000); + rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x000C0001); rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000); rt2800_register_write(rt2x00dev, TX_ALC_VGA3, 0x00000000); rt2800_register_write(rt2x00dev, TX0_BB_GAIN_ATTEN, 0x0); From patchwork Wed Oct 19 08:33: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: 5215 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp265061wrs; Wed, 19 Oct 2022 04:21:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7t7G7y0aTCKOIbVVKCrf1/JGw6hAKy0RQ+pRaz0WlCnv7Qcfow4kITqm8TogDRF3bYX5ve X-Received: by 2002:a05:6402:5206:b0:45d:88f:4f00 with SMTP id s6-20020a056402520600b0045d088f4f00mr6994509edd.130.1666178493351; Wed, 19 Oct 2022 04:21:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178493; cv=none; d=google.com; s=arc-20160816; b=Gp2dfvogMTum1qO1gLc2tCMcrINJQTb0wt6urL0vyqrQx7bAn/nSCp5MPxyktqfRao nGQ2S1P+vOpeL/bptdD08VELNRKXYdwGjt3LXgi2Ucb5PSE8ZVz1v6s87B/CezrCd8Hl 0l/rcAZshEF9SmhyQlT0jU1yCeq+AGb6T45MvPOVoigy2nMIhUlq3JUTNFaZU3G77+le 2x1hUCeeRqf84q6IGHrPSkEW1wbJis2/xHzlgKRfC+xMgj71wsaHsWKlwYgOoukh9f2f vDc5o2O0NbB70X6PJqyrBZxFiNQX6FdBE/NwkG+oGJTZCmQEaYEMUPFJlTG3xpm9fZgo ntGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7M9/MteVM8rw1Pl+651l0LPRBPxzZyIGhlIRFtMaDMg=; b=HC+6cN0nU1vGJVE5JD5nftRhxtsWcyfm+uht9UK1gLHJTvBJDd5ILWWwAEUknUZyBb 0rz9U8jjqjgkfNV+TQb5aRkD2hwhx1zz5APCoPHHrEtCHnI01ZrXcPNg6PEuYp2UGqg5 +Hv5/blg4DSGgvhxyws7TyIL8sOIqFwMLnFEa5ARU1XlnMp/Yad8I/hM+tlxyX5cIM+a soq6jLjnaxjDX6A2Dedmh+2+YhDbVxuElu+a9uRa3ynMsXPhlaLfMUm4JwcYqcxPUKMU cMthioQ1eHydW58px/aM23C7grpy8hJezGdK1GST2RQkFz36IFNoDab3lca730awWR2u iWlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eg60sjGk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hs40-20020a1709073ea800b0078df2f22f80si14830710ejc.647.2022.10.19.04.21.02; Wed, 19 Oct 2022 04:21: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=eg60sjGk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229945AbiJSLJ5 (ORCPT + 99 others); Wed, 19 Oct 2022 07:09:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232803AbiJSLIw (ORCPT ); Wed, 19 Oct 2022 07:08:52 -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 D917E32DBE; Wed, 19 Oct 2022 03:37: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 sin.source.kernel.org (Postfix) with ESMTPS id B4D3FCE21A1; Wed, 19 Oct 2022 09:09:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5729C433D6; Wed, 19 Oct 2022 09:09:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170598; bh=OgQjpOolkW7jauhX45LnxD4niW+zPKmRX1OZN/8owKE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eg60sjGkPdfNsgoWhDI6+M/S8uWXyA2Oe9YOiL9cvQHNmgUt5rpTKnQkJ1MprRiFZ +164VuDvEbv7/IuggMLG4n9OXoQWIWNhEi8rrTD3ui1vHBIEocnYV9A6c1YTRe0F8f c4FW11ibS4S+rd9OjpXLbh0qdfNVcoGicDsUh2dM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Serge Vasilugin , Daniel Golle , Stanislaw Gruszka , Kalle Valo , Sasha Levin Subject: [PATCH 6.0 716/862] wifi: rt2x00: set VGC gain for both chains of MT7620 Date: Wed, 19 Oct 2022 10:33:23 +0200 Message-Id: <20221019083321.575106496@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114779792390147?= X-GMAIL-MSGID: =?utf-8?q?1747114779792390147?= From: Daniel Golle [ Upstream commit 0e09768c085709e10ece3b68f6ac921d3f6a9caa ] Set bbp66 for all chains of the MT7620. Reported-by: Serge Vasilugin Signed-off-by: Daniel Golle Acked-by: Stanislaw Gruszka Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/29e161397e5c9d9399da0fe87d44458aa2b90a78.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 5e7bca935dd4..fec85db7dbc7 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c @@ -5645,7 +5645,8 @@ static inline void rt2800_set_vgc(struct rt2x00_dev *rt2x00dev, if (qual->vgc_level != vgc_level) { if (rt2x00_rt(rt2x00dev, RT3572) || rt2x00_rt(rt2x00dev, RT3593) || - rt2x00_rt(rt2x00dev, RT3883)) { + rt2x00_rt(rt2x00dev, RT3883) || + rt2x00_rt(rt2x00dev, RT6352)) { rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, vgc_level); } else if (rt2x00_rt(rt2x00dev, RT5592)) { From patchwork Wed Oct 19 08:33: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: 5205 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp264526wrs; Wed, 19 Oct 2022 04:20:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7ejEtFgxyN+C2QOedLTMdmU+qdTL1baYb88Rfixr2oMx6CqikByP77jyqhpkxg32l+JZz0 X-Received: by 2002:a50:9991:0:b0:458:a612:bf5a with SMTP id m17-20020a509991000000b00458a612bf5amr7022001edb.22.1666178416191; Wed, 19 Oct 2022 04:20:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178416; cv=none; d=google.com; s=arc-20160816; b=i3RCsJxepF3iCj3CT4BVNxgDjYpOSj9N9cm8P07GBXlpOxQZWPPUYd1+1BqAdihoTb 9eQOh6urUTqiCsZo8q0D5kt50OdIuKlhdMlDoxHXr7e0WiR+K4WdfjYhjDjA+yg5gNiz MFWZEeP730wfrbtLltXyGuzNyZp9MJTmne9oIBTzNmI6lFjh6U5PVYYT7QsVjFGSWHZ7 0P7mky9qvi5hEub82MdzvDMqM8/5DARn2xXsESOwtnsq6Xez1LTN6RoB0vikx28DnlRk oEb9RutfzfsGA+7wbRD4MKSVarlgPHTndlIKz1wAvHU5dy0Gmw84/PwGd9d2/OrXGOI8 XvJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=frTGj75I2Ahm7oCZKwpuW8FqOVBP+w9ThXFlOjCJiVY=; b=vm0EXaHZ+fNmDBRvxfxdJGSDG1Twp/M+sl3sgEzNwaANDvI2l/o4/1KP4thvfuLoX1 Dg918N4HjoGx8XxO5l6Nex0/7E47RgIqz7IghmNKmGugQry6VkcTVd8ZiwPoqZ3Wn7Ar JFGUV2NQI5el3L5raUeCa7QBAdU24ZIyR9avzv4LSzwLBXOD43p8lbUqfObF73673pEF +tBsWoYwyVwvsCo8HczWhFpRw8QVuvTy6op/WPw31V2r26JhWCfoLxa1d8zsZTR+VA77 8jiHSxdgVG6OKWkYZI8tYaFj3TeDLrOrkKntwKbVbDaNUBqtEwTds2U4Q2QEVvy8fI8B JMHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RJS3Bap6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dr8-20020a170907720800b00781b6ce15e1si14748778ejc.101.2022.10.19.04.19.50; Wed, 19 Oct 2022 04:20: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=RJS3Bap6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231145AbiJSLJl (ORCPT + 99 others); Wed, 19 Oct 2022 07:09:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231266AbiJSLIq (ORCPT ); Wed, 19 Oct 2022 07:08: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 8A8AB616F; Wed, 19 Oct 2022 03:37: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 6D2A2CE219E; Wed, 19 Oct 2022 09:10:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3E4F8C433B5; Wed, 19 Oct 2022 09:10:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170600; bh=5c7vIPknLGWDgnfWcLuRVY7n/9ucMfEhHISPPQPSWSI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RJS3Bap6lMjGQ6+hW5R9lhna5YroWoHJaeEAbPCplrS3t05Vg5oNeLZIYFFyKTqL8 GP4A21N35x4Y4Wvwjaq+wV6gwpoNRDDrXbSLfuX8upnMFddQzoTJ1Y0Srvcu4PxN+E CosxBjFzzjEF4W/AoD7gVfq457SJsIGxO/FWXdxI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Serge Vasilugin , Daniel Golle , Stanislaw Gruszka , Kalle Valo , Sasha Levin Subject: [PATCH 6.0 717/862] wifi: rt2x00: set SoC wmac clock register Date: Wed, 19 Oct 2022 10:33:24 +0200 Message-Id: <20221019083321.623667120@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114698878101270?= X-GMAIL-MSGID: =?utf-8?q?1747114698878101270?= From: Daniel Golle [ Upstream commit cbde6ed406a51092d9e8a2df058f5f8490f27443 ] Instead of using the default value 33 (pci), set US_CYC_CNT init based on Programming guide: If available, set chipset bus clock with fallback to cpu clock/3. Reported-by: Serge Vasilugin Signed-off-by: Daniel Golle Acked-by: Stanislaw Gruszka Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/3e275d259f476f597dab91a9c395015ef3fe3284.1663445157.git.daniel@makrotopia.org Signed-off-by: Sasha Levin --- .../net/wireless/ralink/rt2x00/rt2800lib.c | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c index fec85db7dbc7..b30b062243bb 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c @@ -6131,6 +6131,27 @@ static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev) reg = rt2800_register_read(rt2x00dev, US_CYC_CNT); rt2x00_set_field32(®, US_CYC_CNT_CLOCK_CYCLE, 125); rt2800_register_write(rt2x00dev, US_CYC_CNT, reg); + } else if (rt2x00_is_soc(rt2x00dev)) { + struct clk *clk = clk_get_sys("bus", NULL); + int rate; + + if (IS_ERR(clk)) { + clk = clk_get_sys("cpu", NULL); + + if (IS_ERR(clk)) { + rate = 125; + } else { + rate = clk_get_rate(clk) / 3000000; + clk_put(clk); + } + } else { + rate = clk_get_rate(clk) / 1000000; + clk_put(clk); + } + + reg = rt2800_register_read(rt2x00dev, US_CYC_CNT); + rt2x00_set_field32(®, US_CYC_CNT_CLOCK_CYCLE, rate); + rt2800_register_write(rt2x00dev, US_CYC_CNT, reg); } reg = rt2800_register_read(rt2x00dev, HT_FBK_CFG0); From patchwork Wed Oct 19 08:33: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: 5189 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp263880wrs; Wed, 19 Oct 2022 04:18:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7OE0RcYMsoaNyqrf/L+X9rXq1W5axJJsV5KP0v0027Ix9vRQ2oV3ZwQDdzGeI2zF6LEUi5 X-Received: by 2002:a17:902:c209:b0:17f:7da5:b884 with SMTP id 9-20020a170902c20900b0017f7da5b884mr7918796pll.26.1666178336302; Wed, 19 Oct 2022 04:18:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178336; cv=none; d=google.com; s=arc-20160816; b=YvVBEh2pm8THrPnwIP+BrFF+WLbjb/6EV0WLECOx2D4MSmPpCoCKXm87La9ykBP18u Dr3DN8KkcDqq7gP1ARP758/qo9Qp5KGAulIv8McXUWHuOd2Nx+8Cyv86FIsPRBfoDhDT YLL9+N8Jh0+ErfiMJLVlvBRbKPxn5qU+UajE//KrkJJbxVbl2X1pQfl0UPpnF8IVsvw2 jfd+KbI0g2ko4xGoGGdBX7cyOrCJKnDM8XXDoEIbF13Q2cVmWJGzPzAbkJWHtvvn8Fs1 n0JZOVuHMtYllX7YbtujBXwlx3Rap+pEGnzOpyyTS6imbW6ByYEkjjCsbIoiPrEwBUCt vphg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vvOhcqCmSA9yyygbd0mmKNgRuP2F4IXCtetDuXReK20=; b=Kh5+9HQIr2MrMazLoTh0AOut5IyRSxT03dB/rggIF4TJHa61nFKvXNP46suFEKjevi 6fpa6V8qSCv6q5XG3lD0uMdwB95mjHC19ACuddxBbyhoF9ZI7IQo7KNYJxgrac4ipWgD ohPs0ELLHf5dNQo0fOyZ68XshCS3rUecdm0ta88jBqBNqg4TjizM1ARMBdY/M1w4dvxc rTkqnQuLhHMcHx9hjp9KiVEOiS1MpzdsyZ30SdA13jg779S7+WOJwkhUpe1bh8mmyJ8N I7tpWOfyKic0hTH/p0uErISTekYcnujmPhzagPCB6PJv+9Bb7wHBtZLkzjvH5b6RGKyf tCow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tTLgkvbs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bf6-20020a170902b90600b00176b26d519dsi16690208plb.350.2022.10.19.04.18.38; Wed, 19 Oct 2022 04:18: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=tTLgkvbs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233589AbiJSLFe (ORCPT + 99 others); Wed, 19 Oct 2022 07:05:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234872AbiJSLEJ (ORCPT ); Wed, 19 Oct 2022 07:04: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 798F59DDB2; Wed, 19 Oct 2022 03:33: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 91C3BB824B0; Wed, 19 Oct 2022 09:10:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4148C433D6; Wed, 19 Oct 2022 09:10:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170603; bh=rfhGV7N9C6ZVl3JruPAcA6LKfJ3cyhGgcnuyB098JMM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tTLgkvbstUV8N5ULN7WFEghY+nTY4q47uNeWwaB+Db5bISgWOLo1fDIUoc2ryRIro /MCkNlTbYHZYVMhhnhs0X3g4mzuBI+kYJ8br7XQvuvhB5ROxR5tdN+HWzyqz2qEZl3 IVZ0L/IhVFCyZHbehfClw2sp1HMEOA2s2XlMizn8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Serge Vasilugin , Daniel Golle , Stanislaw Gruszka , Kalle Valo , Sasha Levin Subject: [PATCH 6.0 718/862] wifi: rt2x00: correctly set BBP register 86 for MT7620 Date: Wed, 19 Oct 2022 10:33:25 +0200 Message-Id: <20221019083321.671530813@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114615146741791?= X-GMAIL-MSGID: =?utf-8?q?1747114615146741791?= From: Daniel Golle [ Upstream commit c9aada64fe6493461127f1522d7e2f01792d2424 ] Instead of 0 set the correct value for BBP register 86 for MT7620. Reported-by: Serge Vasilugin Signed-off-by: Daniel Golle Acked-by: Stanislaw Gruszka Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/257267247ee4fa7ebc6a5d0c4948b3f8119c0d77.1663445157.git.daniel@makrotopia.org Signed-off-by: Sasha Levin --- drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c index b30b062243bb..1a9e27a6d636 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c @@ -4164,7 +4164,10 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev, rt2800_bbp_write(rt2x00dev, 62, 0x37 - rt2x00dev->lna_gain); rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain); rt2800_bbp_write(rt2x00dev, 64, 0x37 - rt2x00dev->lna_gain); - rt2800_bbp_write(rt2x00dev, 86, 0); + if (rt2x00_rt(rt2x00dev, RT6352)) + rt2800_bbp_write(rt2x00dev, 86, 0x38); + else + rt2800_bbp_write(rt2x00dev, 86, 0); } if (rf->channel <= 14) { From patchwork Wed Oct 19 08:33: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: 5165 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp253876wrs; Wed, 19 Oct 2022 03:58:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5s9I7+X8oyIm7XoDFec0p8vszUF5sKrBgtnrPHb+u9OZGvAwg2Sff3ZFDzNcKalWxwjXmv X-Received: by 2002:a17:902:6945:b0:17b:f38b:900f with SMTP id k5-20020a170902694500b0017bf38b900fmr7748311plt.85.1666177118486; Wed, 19 Oct 2022 03:58:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666177118; cv=none; d=google.com; s=arc-20160816; b=uzl+dlWcSnfWqg37wsrb9hKz5mJLsbGnXqxf7uVVNMAkRtNr9rcO1CXENDLrI80l5h sz8FWCo2dstv3sPyGkqpiDEtGAfAyn2Z/oGj8ffqrXlMkKuVYNmdzfYo9ne9/Yl4uKo5 NZzRZ5v62DsWnZ/V86E0KnyiDeoqSlDnaVtSlTIgYhMgWrvKtrbyTt3jpHPJTiXinZyr K/V09HGAk6MO8wxXyllo0Ccv45RBkf42HMBeAh2l3dppecm8/wHeo58jhK6SytCrxPIk EpVQXUPM+f7dSZ1v/xMzOZeVNl7P7Dd/Ia4acXSlRQPynmpFFI7qGkRnS5MGhrIzsMRx GiYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wdSy2AMLBHsR0r0O87E+S3p7TRRvKcKur5NO1csm2CM=; b=iPmp7iu5QG0P21ZhqDbuw6aa4SnU+dbQT2azBjkQv/8ttK6NVCh027/y/YLcVz19WM YLUDrW3bqHYrbpWlBnffOzIxLHaPNEaYWk0NmiXU3JpgBwNC4oN5vvUcBHNROUDMOrnE dXNEtwdNsOF4Mg706DedcrC+QVh04sos9nIW0mLbAm4WMs7YaJBxaMC+Dg3+G4H2+3Mv iVW2qfkNpnDjtvARpV8RVo3On8rCpSgAoRHxqG6rNSBbuGfImQd0zC3awnpMt+3y1t5B DgKxZC7b0csqUdXEwfrOOB8Xzeq8ev/8Ckwdubz4GMGg/tqinojkRFR05n/Px84eHjho UvHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Vko1kLCk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b22-20020a63d316000000b004636ce58db2si17697616pgg.776.2022.10.19.03.58.22; Wed, 19 Oct 2022 03:58: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=Vko1kLCk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234792AbiJSK5k (ORCPT + 99 others); Wed, 19 Oct 2022 06:57:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234548AbiJSK4b (ORCPT ); Wed, 19 Oct 2022 06:56:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C03FE15708; Wed, 19 Oct 2022 03:27: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 1A5DDB824B1; Wed, 19 Oct 2022 09:10:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7BE4EC433D6; Wed, 19 Oct 2022 09:10:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170605; bh=k3ZzKbC9zNarUtRLUEgprjT0EFS8qIm+is5xwTEYpXA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vko1kLCkPNpA4L/G7nh2Mv51uAkqP+FOU7pbc1Pr6BGSiTaDWduVLWhXSEBtxVuPa 7ox0QSeHURnfdYPs77do1nHIAPwDeXtCCKqMEB+D1+euUrf+Cc049ppW6e5luGZsFZ oZuiBaB37jB//A52rkwJA3vmv+M2ZOU8jfRXRQoA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Jason A. Donenfeld" , Guenter Roeck , Sasha Levin Subject: [PATCH 6.0 719/862] hwmon: (sht4x) do not overflow clamping operation on 32-bit platforms Date: Wed, 19 Oct 2022 10:33:26 +0200 Message-Id: <20221019083321.710685275@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747113338145669753?= X-GMAIL-MSGID: =?utf-8?q?1747113338145669753?= From: Jason A. Donenfeld [ Upstream commit f9c0cf8f26de367c58e48b02b1cdb9c377626e6f ] On 32-bit platforms, long is 32 bits, so (long)UINT_MAX is less than (long)SHT4X_MIN_POLL_INTERVAL, which means the clamping operation is bogus. Fix this by clamping at INT_MAX, so that the upperbound is the same on all platforms. Signed-off-by: Jason A. Donenfeld Link: https://lore.kernel.org/r/20220924101151.4168414-1-Jason@zx2c4.com Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin --- drivers/hwmon/sht4x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hwmon/sht4x.c b/drivers/hwmon/sht4x.c index c19df3ade48e..13ac2d8f22c7 100644 --- a/drivers/hwmon/sht4x.c +++ b/drivers/hwmon/sht4x.c @@ -129,7 +129,7 @@ static int sht4x_read_values(struct sht4x_data *data) static ssize_t sht4x_interval_write(struct sht4x_data *data, long val) { - data->update_interval = clamp_val(val, SHT4X_MIN_POLL_INTERVAL, UINT_MAX); + data->update_interval = clamp_val(val, SHT4X_MIN_POLL_INTERVAL, INT_MAX); return 0; } From patchwork Wed Oct 19 08:33: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: 5152 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp253516wrs; Wed, 19 Oct 2022 03:57:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7g8FwgYLz9L4aiVcTPHfRXgEWMkEyV5zGrLYCLwsey/I89IjmVG2LXi1Ag1kQfr4JwpXzB X-Received: by 2002:a17:902:8a93:b0:17f:66ae:b6c with SMTP id p19-20020a1709028a9300b0017f66ae0b6cmr7784370plo.94.1666177044471; Wed, 19 Oct 2022 03:57:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666177044; cv=none; d=google.com; s=arc-20160816; b=IYntqLCJDARkDTwlc15Pd63MkRYq4RuKLCra6mNABoM/eEcK3fQ0+OBDNaax2Hne1e VUh2+al42SY+XDKDObBB5ib8USRqglRt2bLRfNIOb6rXgk9LWumYGmQvOLR0OibHkaHc DdWJp9afk727ZwasBW+UgHSauZPp2F5aQv0wBf6/VEhP1jQrb8QEsh81oxtzIx5SE3cj uYj+mQE1RvmCkfEUvFWFCT/hEyTdUakd8jf1wn2JhgxZ+qa+CP2UHMTZAZmbIXTMrsJB gcAGE+U7YJLXEYyj6/v4EGPW9F4KyuCQxvj15anY3Ih/yGe0L12z/hKTBf+xeNRIN7ub MGEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XozG7UYcoR7QoiWwKppmgOjm3sB4aLC33v+1YqmsP3g=; b=hu+RMtuTbzagehOL9Cxhqw3AMAZE8mXJ1GGF+RhcjgWEVMYRveBJXZOwXaacl3swna Ktc52VQsWbyNfR1mM99fIXwCzxlfJxhIfkO+OqGFQ5GzVdG99gvjIPWobtk3DrehCzRl Ax34RKXKLzfQRqIFSqhSfGdt10l8a/a7/RYykbDBlfRd4vCVjlXYsmgZOp4bcxQYJJmI Whgpko9WEZR4gMmFsC7COPg3aerXWJe3baJH4ZLw8dZOxoFjXrpFHXpgTXrmH8wPlCTJ BArW99zI14siMwgFNVsJR3BLNNuA9nKagtMuIRRSoRUL4qmYaSxvxedGDwqD+CrwqWni 48vA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iPiIDWtx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k193-20020a636fca000000b00439e9308a40si17222355pgc.443.2022.10.19.03.57.11; Wed, 19 Oct 2022 03: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=iPiIDWtx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234656AbiJSK4m (ORCPT + 99 others); Wed, 19 Oct 2022 06:56:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234637AbiJSK4G (ORCPT ); Wed, 19 Oct 2022 06:56:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D37D4164BE9; Wed, 19 Oct 2022 03:27: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 D1201B824B6; Wed, 19 Oct 2022 09:10:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2DFCBC433B5; Wed, 19 Oct 2022 09:10:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170608; bh=M3JkTWTLC3RdhvEFrlNL9DYet52opleSNkWm+4Lv/LA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iPiIDWtxaHKjvcanmd5bD/hXwTzEiQzequRy/1vKtYCB9B6T3W0/t8iInGeLokods q4sCbl/EYv0ojLAtXmgsyUDDAtt61x6jxTWTtSCfTRTa4KV97RP3kcT6AMRVlHU0nh HnJZgFfntaiU/AnTV33co2h929vC6Cm7CfmszXpI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jakub Sitnicki , Liu Jian , Daniel Borkmann , John Fastabend , Eric Dumazet , Sasha Levin Subject: [PATCH 6.0 720/862] net: If sock is dead dont access socks sk_wq in sk_stream_wait_memory Date: Wed, 19 Oct 2022 10:33:27 +0200 Message-Id: <20221019083321.749798567@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747113260421878839?= X-GMAIL-MSGID: =?utf-8?q?1747113260421878839?= From: Liu Jian [ Upstream commit 3f8ef65af927db247418d4e1db49164d7a158fc5 ] Fixes the below NULL pointer dereference: [...] [ 14.471200] Call Trace: [ 14.471562] [ 14.471882] lock_acquire+0x245/0x2e0 [ 14.472416] ? remove_wait_queue+0x12/0x50 [ 14.473014] ? _raw_spin_lock_irqsave+0x17/0x50 [ 14.473681] _raw_spin_lock_irqsave+0x3d/0x50 [ 14.474318] ? remove_wait_queue+0x12/0x50 [ 14.474907] remove_wait_queue+0x12/0x50 [ 14.475480] sk_stream_wait_memory+0x20d/0x340 [ 14.476127] ? do_wait_intr_irq+0x80/0x80 [ 14.476704] do_tcp_sendpages+0x287/0x600 [ 14.477283] tcp_bpf_push+0xab/0x260 [ 14.477817] tcp_bpf_sendmsg_redir+0x297/0x500 [ 14.478461] ? __local_bh_enable_ip+0x77/0xe0 [ 14.479096] tcp_bpf_send_verdict+0x105/0x470 [ 14.479729] tcp_bpf_sendmsg+0x318/0x4f0 [ 14.480311] sock_sendmsg+0x2d/0x40 [ 14.480822] ____sys_sendmsg+0x1b4/0x1c0 [ 14.481390] ? copy_msghdr_from_user+0x62/0x80 [ 14.482048] ___sys_sendmsg+0x78/0xb0 [ 14.482580] ? vmf_insert_pfn_prot+0x91/0x150 [ 14.483215] ? __do_fault+0x2a/0x1a0 [ 14.483738] ? do_fault+0x15e/0x5d0 [ 14.484246] ? __handle_mm_fault+0x56b/0x1040 [ 14.484874] ? lock_is_held_type+0xdf/0x130 [ 14.485474] ? find_held_lock+0x2d/0x90 [ 14.486046] ? __sys_sendmsg+0x41/0x70 [ 14.486587] __sys_sendmsg+0x41/0x70 [ 14.487105] ? intel_pmu_drain_pebs_core+0x350/0x350 [ 14.487822] do_syscall_64+0x34/0x80 [ 14.488345] entry_SYSCALL_64_after_hwframe+0x63/0xcd [...] The test scenario has the following flow: thread1 thread2 ----------- --------------- tcp_bpf_sendmsg tcp_bpf_send_verdict tcp_bpf_sendmsg_redir sock_close tcp_bpf_push_locked __sock_release tcp_bpf_push //inet_release do_tcp_sendpages sock->ops->release sk_stream_wait_memory // tcp_close sk_wait_event sk->sk_prot->close release_sock(__sk); *** lock_sock(sk); __tcp_close sock_orphan(sk) sk->sk_wq = NULL release_sock **** lock_sock(__sk); remove_wait_queue(sk_sleep(sk), &wait); sk_sleep(sk) //NULL pointer dereference &rcu_dereference_raw(sk->sk_wq)->wait While waiting for memory in thread1, the socket is released with its wait queue because thread2 has closed it. This caused by tcp_bpf_send_verdict didn't increase the f_count of psock->sk_redir->sk_socket->file in thread1. We should check if SOCK_DEAD flag is set on wakeup in sk_stream_wait_memory before accessing the wait queue. Suggested-by: Jakub Sitnicki Signed-off-by: Liu Jian Signed-off-by: Daniel Borkmann Acked-by: John Fastabend Cc: Eric Dumazet Link: https://lore.kernel.org/bpf/20220823133755.314697-2-liujian56@huawei.com Signed-off-by: Sasha Levin --- net/core/stream.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/core/stream.c b/net/core/stream.c index ccc083cdef23..1105057ce00a 100644 --- a/net/core/stream.c +++ b/net/core/stream.c @@ -159,7 +159,8 @@ int sk_stream_wait_memory(struct sock *sk, long *timeo_p) *timeo_p = current_timeo; } out: - remove_wait_queue(sk_sleep(sk), &wait); + if (!sock_flag(sk, SOCK_DEAD)) + remove_wait_queue(sk_sleep(sk), &wait); return err; do_error: From patchwork Wed Oct 19 08:33: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: 5200 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp264471wrs; Wed, 19 Oct 2022 04:20:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4bv+rb5NTg7sxTObohYV4FR0HR4+KEms2gua0HOzR2j+8lgwtrmAZPrMg8v/W+qiDdDwhF X-Received: by 2002:a17:907:a04a:b0:78d:cef2:b219 with SMTP id gz10-20020a170907a04a00b0078dcef2b219mr6199866ejc.735.1666178406497; Wed, 19 Oct 2022 04:20:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178406; cv=none; d=google.com; s=arc-20160816; b=DA3FyYz+U75uhWBgOPUzBHBwtRJJT9PDBOa/B63PW4jhsdrUPiR3H9UQYuyZNpaBHD OX3Gzpoj22inL0BXLypcvmcnAom6FqekbLTyyvX2qtBYKyFO++rkNP5ogeBxWCGswfTz 2ynC/NU0A1DQ60T8qUqpjlhGU9iz0kcKVw70HsRUAn+jHTFFYugNsedmhplQCaDMARaq vFNCFknSzLHmpr1SJXoAzH0I4nEbRGGiXCay/tJaL/+AuCIXY8+rRbmqk+mg9K6L9LMD vSs9FDY8HznNUZqEFkRje3/Q3uDunXe/9Eo9BHChdRIJ32JTGTyYeC/ls9tLmH/yprGj QmaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6ETHH/QP7yJKEZZS7nfI37KLU7RDdD1as3fm1y3y3cw=; b=vvRihdAwrQPIrRCX0Ev/ejyOKFW23jDFoqPMyyQRsuJvfUgQQqfnjs5phB7OEuEKb4 KlV5hQty/JAj/7GSXXYA0klOBC6d4UGGH4DE+reZYyMIBvBWVEmJ4Z4djJa1LY9FUp/v 2YLBtqkRs/G7AXJlAtqHRgALgmP8neEZTmE4WDxELdpHYJuZ42VNhiH0t2LJVv+tFDAF N3w30j81/aeg5vMcSI1UaaBj5S5uONlfh5BVSM1GNJFBWGAV+mMmcZxBqUTW4tG3ws9z XAkvZjQ/TzeN3CIjgau8zWh162UiqLx8toirJClLITdDWLB76hB+9KKtYOhrKwGP5Pi7 miZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JoZXQjmw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t20-20020a1709066bd400b00783698dd8b4si12219641ejs.722.2022.10.19.04.19.41; Wed, 19 Oct 2022 04:20: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=JoZXQjmw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229491AbiJSLJX (ORCPT + 99 others); Wed, 19 Oct 2022 07:09:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230428AbiJSLIe (ORCPT ); Wed, 19 Oct 2022 07:08:34 -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 25C0648A25; Wed, 19 Oct 2022 03:37: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 sin.source.kernel.org (Postfix) with ESMTPS id CF87BCE21A7; Wed, 19 Oct 2022 09:10:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2FA6C433B5; Wed, 19 Oct 2022 09:10:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170611; bh=In2aSrHdCfyGPlB+8GUQrvSWW/PSrZOKUxsOPPibnjA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JoZXQjmwttbLpATq+rjeG5BPJfYvrCEt/bcEx9u055jbX9h1MPVHqwPw6aqNABBoQ nwJrcfkQ98pBb8LbgeEGU9+yZAhMRK8CbaU1GuhV2H+4cTGI3SLeFBgQgpDdlN95AN iUIPt5yzi3xxGQjVX0s3IVVG+G4+uRjL2+d2ifwc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Zijlstra , Martynas Pumputis , Andrii Nakryiko , Jiri Olsa , Alexei Starovoitov , Sasha Levin Subject: [PATCH 6.0 721/862] bpf: Adjust kprobe_multi entry_ip for CONFIG_X86_KERNEL_IBT Date: Wed, 19 Oct 2022 10:33:28 +0200 Message-Id: <20221019083321.790642633@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114688734413555?= X-GMAIL-MSGID: =?utf-8?q?1747114688734413555?= From: Jiri Olsa [ Upstream commit c09eb2e578eb1668bbc84dc07e8d8bd6f04b9a02 ] Martynas reported bpf_get_func_ip returning +4 address when CONFIG_X86_KERNEL_IBT option is enabled. When CONFIG_X86_KERNEL_IBT is enabled we'll have endbr instruction at the function entry, which screws return value of bpf_get_func_ip() helper that should return the function address. There's short term workaround for kprobe_multi bpf program made by Alexei [1], but we need this fixup also for bpf_get_attach_cookie, that returns cookie based on the entry_ip value. Moving the fixup in the fprobe handler, so both bpf_get_func_ip and bpf_get_attach_cookie get expected function address when CONFIG_X86_KERNEL_IBT option is enabled. Also renaming kprobe_multi_link_handler entry_ip argument to fentry_ip so it's clearer this is an ftrace __fentry__ ip. [1] commit 7f0059b58f02 ("selftests/bpf: Fix kprobe_multi test.") Cc: Peter Zijlstra Reported-by: Martynas Pumputis Acked-by: Andrii Nakryiko Signed-off-by: Jiri Olsa Link: https://lore.kernel.org/r/20220926153340.1621984-5-jolsa@kernel.org Signed-off-by: Alexei Starovoitov Signed-off-by: Sasha Levin --- kernel/trace/bpf_trace.c | 20 +++++++++++++++++-- .../selftests/bpf/progs/kprobe_multi.c | 4 +--- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c index 68e5cdd24cef..b1daf7c9b895 100644 --- a/kernel/trace/bpf_trace.c +++ b/kernel/trace/bpf_trace.c @@ -1026,6 +1026,22 @@ static const struct bpf_func_proto bpf_get_func_ip_proto_tracing = { .arg1_type = ARG_PTR_TO_CTX, }; +#ifdef CONFIG_X86_KERNEL_IBT +static unsigned long get_entry_ip(unsigned long fentry_ip) +{ + u32 instr; + + /* Being extra safe in here in case entry ip is on the page-edge. */ + if (get_kernel_nofault(instr, (u32 *) fentry_ip - 1)) + return fentry_ip; + if (is_endbr(instr)) + fentry_ip -= ENDBR_INSN_SIZE; + return fentry_ip; +} +#else +#define get_entry_ip(fentry_ip) fentry_ip +#endif + BPF_CALL_1(bpf_get_func_ip_kprobe, struct pt_regs *, regs) { struct kprobe *kp = kprobe_running(); @@ -2414,13 +2430,13 @@ kprobe_multi_link_prog_run(struct bpf_kprobe_multi_link *link, } static void -kprobe_multi_link_handler(struct fprobe *fp, unsigned long entry_ip, +kprobe_multi_link_handler(struct fprobe *fp, unsigned long fentry_ip, struct pt_regs *regs) { struct bpf_kprobe_multi_link *link; link = container_of(fp, struct bpf_kprobe_multi_link, fp); - kprobe_multi_link_prog_run(link, entry_ip, regs); + kprobe_multi_link_prog_run(link, get_entry_ip(fentry_ip), regs); } static int symbols_cmp_r(const void *a, const void *b, const void *priv) diff --git a/tools/testing/selftests/bpf/progs/kprobe_multi.c b/tools/testing/selftests/bpf/progs/kprobe_multi.c index 08f95a8155d1..98c3399e15c0 100644 --- a/tools/testing/selftests/bpf/progs/kprobe_multi.c +++ b/tools/testing/selftests/bpf/progs/kprobe_multi.c @@ -36,15 +36,13 @@ __u64 kretprobe_test6_result = 0; __u64 kretprobe_test7_result = 0; __u64 kretprobe_test8_result = 0; -extern bool CONFIG_X86_KERNEL_IBT __kconfig __weak; - static void kprobe_multi_check(void *ctx, bool is_return) { if (bpf_get_current_pid_tgid() >> 32 != pid) return; __u64 cookie = test_cookie ? bpf_get_attach_cookie(ctx) : 0; - __u64 addr = bpf_get_func_ip(ctx) - (CONFIG_X86_KERNEL_IBT ? 4 : 0); + __u64 addr = bpf_get_func_ip(ctx); #define SET(__var, __addr, __cookie) ({ \ if (((const void *) addr == __addr) && \ From patchwork Wed Oct 19 08:33: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: 4862 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223952wrs; Wed, 19 Oct 2022 02:38:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5vvkZnqylBiAIxsa8KlMd+GtGzeLcZgdim+ZnNYOYmog7C4R/e+Eu4FyfVe73lByCemJcd X-Received: by 2002:a17:907:6d84:b0:78d:f2b0:14c8 with SMTP id sb4-20020a1709076d8400b0078df2b014c8mr5902603ejc.749.1666172335702; Wed, 19 Oct 2022 02:38:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172335; cv=none; d=google.com; s=arc-20160816; b=fC+IjJ3lb9AXc/VqOLkBSoU/ygZJvB2nNm8pPJ/FIaYq/4t/X6ZjyxqivDKsdPUao0 efMPK7LnXA82Gc4Yy6d4HPAIVdgsbycSfCJeXLsnfAvY0LCmaXq1NrUcKLfvGNPjUPt3 hTgjwVtKX/0A7k3iQ+geJJdsIBANKcV+DPY3jr9/7Foffc/EWTNto45Uim9AzPn2em1o 6AksVz5mF5OPP/anW14d//utnw5plmyg7dHzZn+VgUb8A/7js2ZSzawgw6EyeM4r726i oTjvt90uFPxXktgmG2hdP+r/CgEefQHzilF0lQ2pY25mcEiQMGqoWDCZXBt930JtjrvO Ofgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ihIW162zf0JBnYmpZGRWO8fc/m9UCfapvWBcKOVysTg=; b=y9WFfJS5BLkK06qU+jPgi2hTHt+Hcb32bBoprHujKrgXRc6AFClOCMtvb2A8kujeM4 PjgFylDo8w51al9STjeQTFftYZh5n9BuutggI9EZukJ8NOrVqWw08g3RtogUFF6XcqOJ z0HOh4he95FBcyoF88wtonoO3qtBoFdYT/j425IBLWxY/ugweJLgLoiUjMd1G7UetmoZ T/H34k21JDquJWSRNowOOfICaFHGy2IxmH4lMrWmpkHgt7x5V+WRKeYzypx6cFCWsvDF 8N6IwYODGJ1fZxNxFOW7xacfnQ1+lQWp7PL8dngHxU84bszBOT0FqnmGytlBAYO6N/mq xdbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IJsW2WZV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z4-20020a056402274400b00447eb58b921si16198695edd.38.2022.10.19.02.38.30; Wed, 19 Oct 2022 02:38: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=IJsW2WZV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231633AbiJSJ2m (ORCPT + 99 others); Wed, 19 Oct 2022 05:28:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233506AbiJSJ1N (ORCPT ); Wed, 19 Oct 2022 05:27:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65E22C4C3E; Wed, 19 Oct 2022 02:12: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 723C6617F1; Wed, 19 Oct 2022 09:10:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87E60C433D6; Wed, 19 Oct 2022 09:10:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170613; bh=5ZwiKBpt66QQzKYWNPKO+qqLmMbhb/Jt6M0bY8B6cNk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IJsW2WZVLTZ0rLs5iNH2lDIXLuDWRXAnkQeBatvno/MeNZ8IHPuwK0j6yn+TJbrYM 5M+QiK7fmWZGo07l2Pw2hJYWBXZ3HwcIqPWBNCoVAPDRIbY71jjH46cKsDbmtoJNT3 5SLtcVWJKYqhLa6BXntOgfafkJjqENB/6BKx0i5w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Song Liu , Alexei Starovoitov , Sasha Levin Subject: [PATCH 6.0 722/862] bpf: use bpf_prog_pack for bpf_dispatcher Date: Wed, 19 Oct 2022 10:33:29 +0200 Message-Id: <20221019083321.829806385@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108323494170075?= X-GMAIL-MSGID: =?utf-8?q?1747108323494170075?= From: Song Liu [ Upstream commit 19c02415da2345d0dda2b5c4495bc17cc14b18b5 ] Allocate bpf_dispatcher with bpf_prog_pack_alloc so that bpf_dispatcher can share pages with bpf programs. arch_prepare_bpf_dispatcher() is updated to provide a RW buffer as working area for arch code to write to. This also fixes CPA W^X warnning like: CPA refuse W^X violation: 8000000000000163 -> 0000000000000163 range: ... Signed-off-by: Song Liu Link: https://lore.kernel.org/r/20220926184739.3512547-2-song@kernel.org Signed-off-by: Alexei Starovoitov Signed-off-by: Sasha Levin --- arch/x86/net/bpf_jit_comp.c | 16 ++++++++-------- include/linux/bpf.h | 3 ++- include/linux/filter.h | 5 +++++ kernel/bpf/core.c | 9 +++++++-- kernel/bpf/dispatcher.c | 27 +++++++++++++++++++++------ 5 files changed, 43 insertions(+), 17 deletions(-) diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c index c1f6c1c51d99..362562c832e6 100644 --- a/arch/x86/net/bpf_jit_comp.c +++ b/arch/x86/net/bpf_jit_comp.c @@ -2209,7 +2209,7 @@ int arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *image, void *i return ret; } -static int emit_bpf_dispatcher(u8 **pprog, int a, int b, s64 *progs) +static int emit_bpf_dispatcher(u8 **pprog, int a, int b, s64 *progs, u8 *image, u8 *buf) { u8 *jg_reloc, *prog = *pprog; int pivot, err, jg_bytes = 1; @@ -2225,12 +2225,12 @@ static int emit_bpf_dispatcher(u8 **pprog, int a, int b, s64 *progs) EMIT2_off32(0x81, add_1reg(0xF8, BPF_REG_3), progs[a]); err = emit_cond_near_jump(&prog, /* je func */ - (void *)progs[a], prog, + (void *)progs[a], image + (prog - buf), X86_JE); if (err) return err; - emit_indirect_jump(&prog, 2 /* rdx */, prog); + emit_indirect_jump(&prog, 2 /* rdx */, image + (prog - buf)); *pprog = prog; return 0; @@ -2255,7 +2255,7 @@ static int emit_bpf_dispatcher(u8 **pprog, int a, int b, s64 *progs) jg_reloc = prog; err = emit_bpf_dispatcher(&prog, a, a + pivot, /* emit lower_part */ - progs); + progs, image, buf); if (err) return err; @@ -2269,7 +2269,7 @@ static int emit_bpf_dispatcher(u8 **pprog, int a, int b, s64 *progs) emit_code(jg_reloc - jg_bytes, jg_offset, jg_bytes); err = emit_bpf_dispatcher(&prog, a + pivot + 1, /* emit upper_part */ - b, progs); + b, progs, image, buf); if (err) return err; @@ -2289,12 +2289,12 @@ static int cmp_ips(const void *a, const void *b) return 0; } -int arch_prepare_bpf_dispatcher(void *image, s64 *funcs, int num_funcs) +int arch_prepare_bpf_dispatcher(void *image, void *buf, s64 *funcs, int num_funcs) { - u8 *prog = image; + u8 *prog = buf; sort(funcs, num_funcs, sizeof(funcs[0]), cmp_ips, NULL); - return emit_bpf_dispatcher(&prog, 0, num_funcs - 1, funcs); + return emit_bpf_dispatcher(&prog, 0, num_funcs - 1, funcs, image, buf); } struct x64_jit_data { diff --git a/include/linux/bpf.h b/include/linux/bpf.h index 20c26aed7896..80fc8a88c610 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h @@ -891,6 +891,7 @@ struct bpf_dispatcher { struct bpf_dispatcher_prog progs[BPF_DISPATCHER_MAX]; int num_progs; void *image; + void *rw_image; u32 image_off; struct bpf_ksym ksym; }; @@ -909,7 +910,7 @@ int bpf_trampoline_unlink_prog(struct bpf_tramp_link *link, struct bpf_trampolin struct bpf_trampoline *bpf_trampoline_get(u64 key, struct bpf_attach_target_info *tgt_info); void bpf_trampoline_put(struct bpf_trampoline *tr); -int arch_prepare_bpf_dispatcher(void *image, s64 *funcs, int num_funcs); +int arch_prepare_bpf_dispatcher(void *image, void *buf, s64 *funcs, int num_funcs); #define BPF_DISPATCHER_INIT(_name) { \ .mutex = __MUTEX_INITIALIZER(_name.mutex), \ .func = &_name##_func, \ diff --git a/include/linux/filter.h b/include/linux/filter.h index a5f21dc3c432..f2c47df5ad2a 100644 --- a/include/linux/filter.h +++ b/include/linux/filter.h @@ -1018,6 +1018,8 @@ extern long bpf_jit_limit_max; typedef void (*bpf_jit_fill_hole_t)(void *area, unsigned int size); +void bpf_jit_fill_hole_with_zero(void *area, unsigned int size); + struct bpf_binary_header * bpf_jit_binary_alloc(unsigned int proglen, u8 **image_ptr, unsigned int alignment, @@ -1030,6 +1032,9 @@ void bpf_jit_free(struct bpf_prog *fp); struct bpf_binary_header * bpf_jit_binary_pack_hdr(const struct bpf_prog *fp); +void *bpf_prog_pack_alloc(u32 size, bpf_jit_fill_hole_t bpf_fill_ill_insns); +void bpf_prog_pack_free(struct bpf_binary_header *hdr); + static inline bool bpf_prog_kallsyms_verify_off(const struct bpf_prog *fp) { return list_empty(&fp->aux->ksym.lnode) || diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c index 3d9eb3ae334c..c4600a5781de 100644 --- a/kernel/bpf/core.c +++ b/kernel/bpf/core.c @@ -825,6 +825,11 @@ struct bpf_prog_pack { unsigned long bitmap[]; }; +void bpf_jit_fill_hole_with_zero(void *area, unsigned int size) +{ + memset(area, 0, size); +} + #define BPF_PROG_SIZE_TO_NBITS(size) (round_up(size, BPF_PROG_CHUNK_SIZE) / BPF_PROG_CHUNK_SIZE) static DEFINE_MUTEX(pack_mutex); @@ -864,7 +869,7 @@ static struct bpf_prog_pack *alloc_new_pack(bpf_jit_fill_hole_t bpf_fill_ill_ins return pack; } -static void *bpf_prog_pack_alloc(u32 size, bpf_jit_fill_hole_t bpf_fill_ill_insns) +void *bpf_prog_pack_alloc(u32 size, bpf_jit_fill_hole_t bpf_fill_ill_insns) { unsigned int nbits = BPF_PROG_SIZE_TO_NBITS(size); struct bpf_prog_pack *pack; @@ -905,7 +910,7 @@ static void *bpf_prog_pack_alloc(u32 size, bpf_jit_fill_hole_t bpf_fill_ill_insn return ptr; } -static void bpf_prog_pack_free(struct bpf_binary_header *hdr) +void bpf_prog_pack_free(struct bpf_binary_header *hdr) { struct bpf_prog_pack *pack = NULL, *tmp; unsigned int nbits; diff --git a/kernel/bpf/dispatcher.c b/kernel/bpf/dispatcher.c index 2444bd15cc2d..fa64b80b8bca 100644 --- a/kernel/bpf/dispatcher.c +++ b/kernel/bpf/dispatcher.c @@ -85,12 +85,12 @@ static bool bpf_dispatcher_remove_prog(struct bpf_dispatcher *d, return false; } -int __weak arch_prepare_bpf_dispatcher(void *image, s64 *funcs, int num_funcs) +int __weak arch_prepare_bpf_dispatcher(void *image, void *buf, s64 *funcs, int num_funcs) { return -ENOTSUPP; } -static int bpf_dispatcher_prepare(struct bpf_dispatcher *d, void *image) +static int bpf_dispatcher_prepare(struct bpf_dispatcher *d, void *image, void *buf) { s64 ips[BPF_DISPATCHER_MAX] = {}, *ipsp = &ips[0]; int i; @@ -99,12 +99,12 @@ static int bpf_dispatcher_prepare(struct bpf_dispatcher *d, void *image) if (d->progs[i].prog) *ipsp++ = (s64)(uintptr_t)d->progs[i].prog->bpf_func; } - return arch_prepare_bpf_dispatcher(image, &ips[0], d->num_progs); + return arch_prepare_bpf_dispatcher(image, buf, &ips[0], d->num_progs); } static void bpf_dispatcher_update(struct bpf_dispatcher *d, int prev_num_progs) { - void *old, *new; + void *old, *new, *tmp; u32 noff; int err; @@ -117,8 +117,14 @@ static void bpf_dispatcher_update(struct bpf_dispatcher *d, int prev_num_progs) } new = d->num_progs ? d->image + noff : NULL; + tmp = d->num_progs ? d->rw_image + noff : NULL; if (new) { - if (bpf_dispatcher_prepare(d, new)) + /* Prepare the dispatcher in d->rw_image. Then use + * bpf_arch_text_copy to update d->image, which is RO+X. + */ + if (bpf_dispatcher_prepare(d, new, tmp)) + return; + if (IS_ERR(bpf_arch_text_copy(new, tmp, PAGE_SIZE / 2))) return; } @@ -140,9 +146,18 @@ void bpf_dispatcher_change_prog(struct bpf_dispatcher *d, struct bpf_prog *from, mutex_lock(&d->mutex); if (!d->image) { - d->image = bpf_jit_alloc_exec_page(); + d->image = bpf_prog_pack_alloc(PAGE_SIZE, bpf_jit_fill_hole_with_zero); if (!d->image) goto out; + d->rw_image = bpf_jit_alloc_exec(PAGE_SIZE); + if (!d->rw_image) { + u32 size = PAGE_SIZE; + + bpf_arch_text_copy(d->image, &size, sizeof(size)); + bpf_prog_pack_free((struct bpf_binary_header *)d->image); + d->image = NULL; + goto out; + } bpf_image_ksym_add(d->image, &d->ksym); } From patchwork Wed Oct 19 08:33: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: 4868 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp224114wrs; Wed, 19 Oct 2022 02:39:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7OFm0fTzj0e48/FHKcyJypuDD/EUfPyr/JaQO4awq6mvxh/BBaM7N1T5gTCB3Taoeg5+mE X-Received: by 2002:a17:906:730e:b0:78d:94ab:77c2 with SMTP id di14-20020a170906730e00b0078d94ab77c2mr5972112ejc.639.1666172366220; Wed, 19 Oct 2022 02:39:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172366; cv=none; d=google.com; s=arc-20160816; b=PN+bCWnv6rk6DR+eMsCq4asAiTmQeZtZqOYeGaiwUlmSH1viwv+CEYLOnu4ijnYEdL ev46aaWLW04wPeEDnJllgcCFqkAPL2FFbqu1R+4C9obbnQL8ARpXevDs4QaZk4yNj9Oi Ua0ob+zPLB8UfrqCkmvidF7DU07U8VUK8r0pIH6YMqvdhWksaRnodEa2kPjichLBoDaq dtS+KSj/VTTGUCQkqzesFRKU+rY52RookDCibexcJXEUc0TPa+UinC2BoZ1tEgmjhfZ2 GIT041AP2+xngCgq2FeMmO4GlFONTGUCeSY0K8ChWnzMhrDveTnYTxjnkQ/x7zcMY8xe e6mA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JYy/cfgJipBUWZK6N2+sye3/4gsGYkjBBSeohR2679I=; b=xRezGAzg1bF/glmHUbm7ObL3X1BeOrXTDQpFADz8k6FbeHkGyJpD4hh7KHCQlYfV5+ wms4LAarT1nfh6bIFzKfUvN2EzeKPRamngmXn7bsdeYBzbkcRknYYEpHrTIgbffPe/dt cGYMyefgXR/KzUW3KdyBdP8VmsfHyAEES3NcPTbfIfI1jRUpw18TLS9h/lhqOCm/xNfD WHXQ5ozG7J2b3SxJagm8fiGh5fl1u3YuB3BsqOe9MTHUrtu/MEx8PC+KVVd62M0gNX4q ANFovIpBetZMI/NKALsUOA+Lbji4hWMwhw4Q2Ef2YsC5UrM1Cb2KmTGxtdUqxi98SLbn yJoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JKIPBJO5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w19-20020a1709062f9300b007803b5893f2si12565748eji.672.2022.10.19.02.39.01; Wed, 19 Oct 2022 02:39: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=JKIPBJO5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233513AbiJSJ2r (ORCPT + 99 others); Wed, 19 Oct 2022 05:28:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233508AbiJSJ1O (ORCPT ); Wed, 19 Oct 2022 05:27:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01123C6962; Wed, 19 Oct 2022 02:12: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 1595661840; Wed, 19 Oct 2022 09:10:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 257BBC43470; Wed, 19 Oct 2022 09:10:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170616; bh=a00U9GHBoFljlewPFnHrOgja+rsegUW3jaFRMRIvNCM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JKIPBJO5kw5sqCwxmSEI6JNuDXVkKgyiJfjHlwFJn48remV6h3E+rlHDEFvg8rG4M uKunx1n+FlzRXfEISBd4j2rehRM4Dtmcc+/4FSx0P11V46F4pU+KuHZLLjZjEW7dH2 q+vOFjd2e57KmEJeV5GXi2HbnsDSTuvBRYrzrO2s= 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 6.0 723/862] Bluetooth: L2CAP: Fix user-after-free Date: Wed, 19 Oct 2022 10:33:30 +0200 Message-Id: <20221019083321.870305290@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108354859481923?= X-GMAIL-MSGID: =?utf-8?q?1747108354859481923?= 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 770891f68703..1f34b82ca0ec 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -4309,6 +4309,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); @@ -4338,6 +4344,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 Wed Oct 19 08:33: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: 5197 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp264121wrs; Wed, 19 Oct 2022 04:19:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Rm3nneGg/8Ks99M14p/e2MmNWuiwNG3xoC8299h5yZs1eBwRW6+aLJwj7qmzv2gbEUs3u X-Received: by 2002:a17:902:d510:b0:185:475a:4057 with SMTP id b16-20020a170902d51000b00185475a4057mr8067010plg.54.1666178363438; Wed, 19 Oct 2022 04:19:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178363; cv=none; d=google.com; s=arc-20160816; b=pnJUryovwaIX9aaIrVgGLRR68giLRf/Y3rwqR7Ep3XkWnrhKNKT77z0VK0sgh5ru/8 o7MkuxyJDqB2gkFpU0O2fqjedBprLgMid6yO2SmIsRXZm/3SnepIzoN5bpcpZpUihwcu JlIxQwVRuZIw+Hsae7qjcUw2SEWGzSXu5iQ0rdOEyQ+iECtdkAJwudDkJOUB3CJ+54Yu kSht7WqZVPmzD7lgjPrTxPCfBjgR2y+SgdvM+4Je1XlbPGat/DuV2UhHLjA92ulM84ym lguA9wXkvRRRvc6JS+keF0THjqNPLBWGl6eUqRImBWTuYXp25Qu23R6L7yboiY0yNlvK ksew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Dmk4YtFe5IzmJJw+G5uKafH2x7SXdsNJo1qt/XGLU/I=; b=HQAuWJzDz6koTX1dDhYme6fQ4yvTinpxSL4qiJ+n7ZRFItcJnLQ21nf34zd1d0XHZd VJLI+cKrn1LPI6EJAZl46ryoveAuUIolmhn2jbk0LAC942jSZ1CUpaP13MZiIZSqd2Y0 GX0gMpNMJAXzDIbzxxiIzzNsNMNi5mm0w8sHS77cQU7WrsYshSvOkvFw2Xkulr+mfnc4 dop8Quj2Q1VT+aEpyz8I/Asq/PzbRTYaaSwIFXlnOJHjtDKucJkR9JtdZRtzUBYOV29O h6F670IYfENH0UH0pJf/XDlkI+O+FIEaEuqWucflzpMwHvhMNOFnKY1aGDQphNi4CQ2a GZog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=USL62Fon; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v190-20020a6389c7000000b0046b30704f89si14811191pgd.675.2022.10.19.04.19.09; Wed, 19 Oct 2022 04:19:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=USL62Fon; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230389AbiJSLIx (ORCPT + 99 others); Wed, 19 Oct 2022 07:08:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231835AbiJSLI2 (ORCPT ); Wed, 19 Oct 2022 07:08:28 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE54017C542; Wed, 19 Oct 2022 03:37: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 sin.source.kernel.org (Postfix) with ESMTPS id C3B57CE21AC; Wed, 19 Oct 2022 09:10:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE5FAC433D7; Wed, 19 Oct 2022 09:10:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170619; bh=f33ezdzKDOq2FUj87Tg0YqhnSXpQQOcpgP0oUn0mnp8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=USL62FonUgQmdZ69OG47s1aus2MzQ5qAcrlcFpK1fuUpPAa6YHh62k6S4o3pofQWE m8pdrobiLZ5sxEricJFzou0ujHpFYzgl16UEHYARvXUnQXtSmup4VI8oth7lt9e/nH 5Jj6smG2KOGp54Oq8TRIQO/+dmqnGVDr0QAE6DJE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Cong Wang , Jiri Pirko , syzbot+a2c4601efc75848ba321@syzkaller.appspotmail.com, Kees Cook , Jamal Hadi Salim , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.0 724/862] net: sched: cls_u32: Avoid memcpy() false-positive warning Date: Wed, 19 Oct 2022 10:33:31 +0200 Message-Id: <20221019083321.919155785@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114643614250766?= X-GMAIL-MSGID: =?utf-8?q?1747114643614250766?= From: Kees Cook [ Upstream commit 7cba18332e3635aaae60e4e7d4e52849de50d91b ] To work around a misbehavior of the compiler's ability to see into composite flexible array structs (as detailed in the coming memcpy() hardening series[1]), use unsafe_memcpy(), as the sizing, bounds-checking, and allocation are all very tightly coupled here. This silences the false-positive reported by syzbot: memcpy: detected field-spanning write (size 80) of single field "&n->sel" at net/sched/cls_u32.c:1043 (size 16) [1] https://lore.kernel.org/linux-hardening/20220901065914.1417829-2-keescook@chromium.org Cc: Cong Wang Cc: Jiri Pirko Reported-by: syzbot+a2c4601efc75848ba321@syzkaller.appspotmail.com Link: https://lore.kernel.org/lkml/000000000000a96c0b05e97f0444@google.com/ Signed-off-by: Kees Cook Reviewed-by: Jamal Hadi Salim Link: https://lore.kernel.org/r/20220927153700.3071688-1-keescook@chromium.org Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/sched/cls_u32.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c index 4d27300c287c..5f33472aad36 100644 --- a/net/sched/cls_u32.c +++ b/net/sched/cls_u32.c @@ -1040,7 +1040,11 @@ static int u32_change(struct net *net, struct sk_buff *in_skb, } #endif - memcpy(&n->sel, s, sel_size); + unsafe_memcpy(&n->sel, s, sel_size, + /* A composite flex-array structure destination, + * which was correctly sized with struct_size(), + * bounds-checked against nla_len(), and allocated + * above. */); RCU_INIT_POINTER(n->ht_up, ht); n->handle = handle; n->fshift = s->hmask ? ffs(ntohl(s->hmask)) - 1 : 0; From patchwork Wed Oct 19 08:33: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: 4863 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223969wrs; Wed, 19 Oct 2022 02:38:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7yLjxlY3FTEJhDFMQriq0LlTONTibB9YaVvpvtq7koPN5KVh2B04L26Kx4fP6InagBa/24 X-Received: by 2002:a17:907:7d8f:b0:78e:2cba:560f with SMTP id oz15-20020a1709077d8f00b0078e2cba560fmr5998050ejc.173.1666172338908; Wed, 19 Oct 2022 02:38:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172338; cv=none; d=google.com; s=arc-20160816; b=GfE2Fjo4/bXepSdZShSJ+53YSIBFB6Xx1HxI3Q2RCU5e2JK5zNHjDbcQOv/7i9a0Z4 VZBzKX1otwxRhhYNZMpInGxgnu+Es5mJaG2phcBBLzUpB+IcfN34rEdK0N1W5YCR3df1 OOJI4ubUHlTJeUNzGXPSbdG8NHeEU83l3J6rwzAgyMLBsPyyFomlYtiD1eaPBJKxYFJG fGs5RfDmSsiLnjoXmLQot+o18BgIUcSs8Ez2AAZPkB+hb6tE6dhFZsGXbwVkPrblkiJx uU1Hg67st6XkvH3LYNj77zJCI3uUjU3A8mP+/op2a7v+2tXBA+WRrTNqEudlIzH2Eyye 5gCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HVOWa+6MXo9LYGClhBmlkarfC9QJVJ5D0fBxPIu/o1o=; b=spbR1dDn51VdZECVRQ83UE/zw2YxoK7RiIBrsbbH8CHm99pb/LeDY/p+F6qdT2dgdL tMsmLzkJQc8yqiEv9hzjY646taN/t1PO2YLnXVvUa2Xel5KcfTGPzA4+wUwPCzWRwV23 yg6/V/MMmAlzoppDC8Fx+4MHa6brk/vRlZDKgH5xcsMSWWAvajCsrMBjqSXqKaw7hb+a KPx9RSzAEhouUaylLtDZJ+C736Yk002TBlCzluO8kxoeJpk5AekaSfa4athMsW/hDXLC Q937AyL+tYM/HEVdDkjzb/xMOzKiWEX4ZdAfoEd3tRaOFLoAGA1RgX/3J4cEIPd6Goj3 l4KQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AKaEDWYV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cz3-20020a0564021ca300b00459be46b0f4si11928480edb.131.2022.10.19.02.38.34; Wed, 19 Oct 2022 02:38: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=AKaEDWYV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233661AbiJSJ2w (ORCPT + 99 others); Wed, 19 Oct 2022 05:28:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233586AbiJSJ1P (ORCPT ); Wed, 19 Oct 2022 05:27:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02305E09EC; Wed, 19 Oct 2022 02:12: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 414DF617E3; Wed, 19 Oct 2022 09:10:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51FA7C433D7; Wed, 19 Oct 2022 09:10:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170621; bh=iOp5sUohYYKlU8xKhB8swSLrL8/OASDUJXxbMxBidxc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AKaEDWYVkGUh+ir7ix4PYaO2n7LqBmC/BlzgvPid65FDMX9IgbgCWgyDYQvfPZXuY 9wBdqdoSu5jzycDX6dRJHE8qsoko0e2sDrDKkT6WqsX1478eQPhx3lqpGWtarZcSpf PkLMK+mweNN/tyqgR7AaVdnfRT5SsQalM1DFsPUk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xin Liu , Andrii Nakryiko , Sasha Levin Subject: [PATCH 6.0 725/862] libbpf: Fix overrun in netlink attribute iteration Date: Wed, 19 Oct 2022 10:33:32 +0200 Message-Id: <20221019083321.967563918@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108326215287232?= X-GMAIL-MSGID: =?utf-8?q?1747108326215287232?= From: Xin Liu [ Upstream commit 51e05a8cf8eb34da7473823b7f236a77adfef0b4 ] I accidentally found that a change in commit 1045b03e07d8 ("netlink: fix overrun in attribute iteration") was not synchronized to the function `nla_ok` in tools/lib/bpf/nlattr.c, I think it is necessary to modify, this patch will do it. Signed-off-by: Xin Liu Signed-off-by: Andrii Nakryiko Link: https://lore.kernel.org/bpf/20220930090708.62394-1-liuxin350@huawei.com Signed-off-by: Sasha Levin --- tools/lib/bpf/nlattr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/lib/bpf/nlattr.c b/tools/lib/bpf/nlattr.c index f57e77a6e40f..3900d052ed19 100644 --- a/tools/lib/bpf/nlattr.c +++ b/tools/lib/bpf/nlattr.c @@ -32,7 +32,7 @@ static struct nlattr *nla_next(const struct nlattr *nla, int *remaining) static int nla_ok(const struct nlattr *nla, int remaining) { - return remaining >= sizeof(*nla) && + return remaining >= (int)sizeof(*nla) && nla->nla_len >= sizeof(*nla) && nla->nla_len <= remaining; } From patchwork Wed Oct 19 08:33: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: 5217 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp265180wrs; Wed, 19 Oct 2022 04:21:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4DpfXKce8eCrnflEH6Z6eHatI3uPqCW2qn2CAKfxCf3tE+alucRdU6tCwg+nKVkvIm67qM X-Received: by 2002:a17:902:d4c5:b0:183:6e51:503 with SMTP id o5-20020a170902d4c500b001836e510503mr7876208plg.84.1666178508643; Wed, 19 Oct 2022 04:21:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178508; cv=none; d=google.com; s=arc-20160816; b=xw/2oMJpDfVNmhrzYPFGApDqkI5ozGfRt9uY3ymiSHyGJjHxT89aQB2FpStOPCZS2h 5lAFwzAEkNyqPm5CgYrUxOLaQ7EUdELSFkxGIxrvVPenTyE3DVUVja8oD9FYkLB+AD/i OTnsQu9SxyksNYZBelikmylzc89Ca5dLhL+bfoBK24eZNiev+5Zk5nLw8J3KbA4RjFZ5 EnbfkzTtZfMG0jkUQDXtfjKMmphxOMXgl+3GLEjbmGEmOQjdg9hNePXZidcAaenlazov 6IJpUVxkfA8D9t0hi3IWgpWT1Slyenb6ws2lvrwqjpHPT/kxE+qq6y8/ksGkbwEl+RIy uAtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2MAEoHH6W1OVf/XG1TWO/OngIIi9aLMr3pc7Y+hGwYQ=; b=cexvrts2Wdga/GzkiBB7bsoL4NRsk0fd9Cl5qqJkcg0O2IWZuepiHqN3n6404oE6zW vl66ylPWx1/7Ju8N0tc1/Op/Q9bWLMorw2MGMM39CrEr+mL1hIbTKFd7ZBhlaflWgoBY 04mNGJhLCddm9ITl2ThZ8SQkfcv02GzrjwzWQhvRD0/H4MuAY4wlAmMVvwEzhmOVgbsA EOcKuEEI6WFO9dWn1n97d8t9+dA+Sbg1XqKHkZeTrQXTHSlk3bSGSWzehVDk+O+wFYsl wUgDxNRCUgmTlmvVVErRoLAMKaC/m/c7y188YfOVaj3ITBwHYt7CUczOeteZf5fgLgi1 BPkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vMJY1SKN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z21-20020aa78895000000b0056353f0bd40si18527613pfe.29.2022.10.19.04.21.26; Wed, 19 Oct 2022 04:21: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=vMJY1SKN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229775AbiJSLKP (ORCPT + 99 others); Wed, 19 Oct 2022 07:10:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234639AbiJSLJG (ORCPT ); Wed, 19 Oct 2022 07:09:06 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CCE1717FD72; Wed, 19 Oct 2022 03:37: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 sin.source.kernel.org (Postfix) with ESMTPS id 674B5CE21A8; Wed, 19 Oct 2022 09:10:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 61F0FC433D7; Wed, 19 Oct 2022 09:10:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170626; bh=6I0oFww5l0V1IzzU+8y7drAJe30wzaT6tIKTcnOoUOg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vMJY1SKNMNuAJiDTIVqV2YD7QwVYKTx1FT9qN711DSLfEDw3+PigTrmzQVg92UrNT p5vb5dpVJU2xPJwMLQi0qe87RQTKEOHDFodtZz1d1OmUVcJGdePC8OwmvC6Oc8JLPV yX1pr2vE/UYTvihhuTbR7Q9iyWxHG58vej7k8Y9w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Shevchenko , Jarkko Nikula , Wolfram Sang , Sasha Levin Subject: [PATCH 6.0 726/862] i2c: designware-pci: Group AMD NAVI quirk parts together Date: Wed, 19 Oct 2022 10:33:33 +0200 Message-Id: <20221019083322.017596727@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114795777842263?= X-GMAIL-MSGID: =?utf-8?q?1747114795777842263?= From: Andy Shevchenko [ Upstream commit 65769162ae4b7f2d82e54998be446226b05fcd8f ] The code is ogranized in a way that all related parts to the certain platform quirk go together. This is not the case for AMD NAVI. Shuffle code to make it happen. While at it, drop the frequency definition and use hard coded value as it's done for other platforms and add a comment to the PCI ID list. Signed-off-by: Andy Shevchenko Acked-by: Jarkko Nikula Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-designware-pcidrv.c | 30 +++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c index 608e61209455..ca368482b246 100644 --- a/drivers/i2c/busses/i2c-designware-pcidrv.c +++ b/drivers/i2c/busses/i2c-designware-pcidrv.c @@ -27,7 +27,6 @@ #include "i2c-ccgx-ucsi.h" #define DRIVER_NAME "i2c-designware-pci" -#define AMD_CLK_RATE_HZ 100000 enum dw_pci_ctl_id_t { medfield, @@ -100,11 +99,6 @@ static u32 mfld_get_clk_rate_khz(struct dw_i2c_dev *dev) return 25000; } -static u32 navi_amd_get_clk_rate_khz(struct dw_i2c_dev *dev) -{ - return AMD_CLK_RATE_HZ; -} - static int mfld_setup(struct pci_dev *pdev, struct dw_pci_controller *c) { struct dw_i2c_dev *dev = dev_get_drvdata(&pdev->dev); @@ -126,15 +120,6 @@ static int mfld_setup(struct pci_dev *pdev, struct dw_pci_controller *c) return -ENODEV; } -static int navi_amd_setup(struct pci_dev *pdev, struct dw_pci_controller *c) -{ - struct dw_i2c_dev *dev = dev_get_drvdata(&pdev->dev); - - dev->flags |= MODEL_AMD_NAVI_GPU; - dev->timings.bus_freq_hz = I2C_MAX_STANDARD_MODE_FREQ; - return 0; -} - static int mrfld_setup(struct pci_dev *pdev, struct dw_pci_controller *c) { /* @@ -159,6 +144,20 @@ static u32 ehl_get_clk_rate_khz(struct dw_i2c_dev *dev) return 100000; } +static u32 navi_amd_get_clk_rate_khz(struct dw_i2c_dev *dev) +{ + return 100000; +} + +static int navi_amd_setup(struct pci_dev *pdev, struct dw_pci_controller *c) +{ + struct dw_i2c_dev *dev = dev_get_drvdata(&pdev->dev); + + dev->flags |= MODEL_AMD_NAVI_GPU; + dev->timings.bus_freq_hz = I2C_MAX_STANDARD_MODE_FREQ; + return 0; +} + static struct dw_pci_controller dw_pci_controllers[] = { [medfield] = { .bus_num = -1, @@ -389,6 +388,7 @@ static const struct pci_device_id i2_designware_pci_ids[] = { { PCI_VDEVICE(INTEL, 0x4bbe), elkhartlake }, { PCI_VDEVICE(INTEL, 0x4bbf), elkhartlake }, { PCI_VDEVICE(INTEL, 0x4bc0), elkhartlake }, + /* AMD NAVI */ { PCI_VDEVICE(ATI, 0x7314), navi_amd }, { PCI_VDEVICE(ATI, 0x73a4), navi_amd }, { PCI_VDEVICE(ATI, 0x73e4), navi_amd }, From patchwork Wed Oct 19 08:33: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: 5155 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp253535wrs; Wed, 19 Oct 2022 03:57:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4yfKdncDY7hH5hLiTphRIHkfP3YZnyij6Cv7aVUl9RnRgfQuAP9BaWioJRKjfOVA0uYJII X-Received: by 2002:aa7:db4d:0:b0:458:908f:a372 with SMTP id n13-20020aa7db4d000000b00458908fa372mr6854543edt.248.1666177047865; Wed, 19 Oct 2022 03:57:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666177047; cv=none; d=google.com; s=arc-20160816; b=cdnW6HF/hpatdNcKWgyw0MyZOCvU0iWHaiWEBKSA+QFnOFaIrblW70HghzoGkpCT5Q 6lL6YgKk8CpANjCrkpTGeGx+0oK8In7YMp24frZnZPsTVP8KE0+F62rBtLkIgiDdymrk l49fLQ57McGz2bLFXjftkM7EA2akdDBWumKyfQdtvaxOuKb2shLByjLaY29eoPDbajrP 3gMYtyLYX9uBRZZEtK7btCBV0PWatSBLN7uu98Z1jGM4tHkvMK355q0VivO29CxTiyWH yAHf8FeJkcaEpRWLKXE4sJlwM/l6IEKdK+MyCKc/By0gMzQizIoxIWcmxdvPcuBVkf86 3LHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2QcH7gw8Ij3inVsPITSl4QwAPCmbzyaRHL4uOpRaQzQ=; b=a4SnlCERZkQeTJVAzO/THypCgZ7KcYEEvTSWdHGUqOsmBSrxdMOS5GxRtFiZtJ2J3N 9BCaLzswNCfnrQQwU4RB5WcxvpcvnUhdjG/8MdrXubDCS0DWp68Iuj7gVdgsBkSmLOhs 0mW+7VZ+v3SaIdSYGgpzi2lo89nawN6LWZCHHEYpsEw5XOhvVWgjytGepnx6FmhzEEBw l/26fDVYi+gHb3OcCY4L5ZRslImj5KKcUF8U/jK8Id//2Iwy2Zu4Xq0lTwxMeWRQ/yXH 1Ms/ilkZ9iC5oXUd2jDBzVvc8Ld42JjZLEB+EQBt8Dp1ZODP9ZbOuV9LGzobMU8fRGSq ddrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XGFDHqgx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jz18-20020a17090775f200b0078d00203ab4si10844701ejc.691.2022.10.19.03.57.03; Wed, 19 Oct 2022 03:57:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XGFDHqgx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234633AbiJSK4f (ORCPT + 99 others); Wed, 19 Oct 2022 06:56:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234500AbiJSKz4 (ORCPT ); Wed, 19 Oct 2022 06: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 C72EA164BEF; Wed, 19 Oct 2022 03:27: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 A4751B824B5; Wed, 19 Oct 2022 09:10:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09AC8C433D7; Wed, 19 Oct 2022 09:10:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170629; bh=Q7nL0WEUtaTUZsGTu8PhNbsvfvjXK7qqWWgILZtc6rQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XGFDHqgxLKOeq0qN+lTbz+LsweL4Uu+I3W1WLuxtq0GKMQhtFQ0ytQQPvJZtt5pAq l/CRLhCOEFGURDoQXQSMtC71w3j5HjRMYYk9uN31UuW6w9ikLR4JEQJuShj+/0Me1P b23VSmH9Q0g58PYaxQBydGKNKKZKhbZi2ShUW0Pc= 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 6.0 727/862] r8152: Rate limit overflow messages Date: Wed, 19 Oct 2022 10:33:34 +0200 Message-Id: <20221019083322.055021094@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747113264101775137?= X-GMAIL-MSGID: =?utf-8?q?1747113264101775137?= 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 688905ea0a6d..e7b0b59e2bc8 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -1874,7 +1874,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 Wed Oct 19 08:33: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: 4861 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223948wrs; Wed, 19 Oct 2022 02:38:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5MPiLrFBsKXZnBGJYdWE6ZIF/4GgDDZ7emqi2ieHyRf7EuvbjKmaPOYUIc7XHCBKDQlQjE X-Received: by 2002:a17:90a:5892:b0:20a:9cf5:c13c with SMTP id j18-20020a17090a589200b0020a9cf5c13cmr43901957pji.63.1666172335054; Wed, 19 Oct 2022 02:38:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172335; cv=none; d=google.com; s=arc-20160816; b=hicU85loRkQ4W9uOXYyyQSpj8KEpazlSMlqXcC0GtbHknz0VmmplC1jYVQNiF/ds8t RkXRCmtqrGDTolHbAbX4eGMMFSyxPz1f38tlueQ0oEyZRVshk5wpT5G7iUna+6N2Zix9 H6tsM9ygHtvow86nYqElS23RyDJ7Gz0heO+6kI02GBl9VY+JenKmTgwpoLIyQJSlLmHR b1Mr2a8rLQQb/qVLCOAitUg8N+ReEHnbl0mWLyXANZxVrJgn85NTeObg1mqn/S+mXXly hybx09CR8pif5l6M2GemZXVoft72a/8UBcns9BSp4oKbelLuvJReC5CfbzZVJySviK5U ByZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=cm2Cbrlx9CimVZApLwOlsEj0o1/rhbQ4NGL5EXn5/m8=; b=VfWleHouCWquF6bB/zblOph/97E2uV0sGCzBAG5UPGalocQ648OqKRRoXT0rHJugG/ xekdbC+DXI2hBiBHIFQM6lYRCILuMBNXaD9h3IhcIYMIfv2L1r1xPc0hA5iEH4Y1lrmO h5HxRyB0B1ss7hDehWqEYEzEWlzmt9Pjn/7PZyEQfnUhikyIdEPyz9LoS/GCRfvFmXLX 2Vp3QyFxQWTWiIj2eYeDIvGNjWN7BhCqDD3H/c5ctxWm+HMFu6N+2x8uOPMKcyg2YhTb DTPrg72HU+VFZtQhhTShvgjon00sxdHJekb9vyejMiHotlQULvYS9YR9arAT37l0MBgP LSRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hDtaTrfT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j10-20020a170902da8a00b0017f97fe778dsi19896116plx.126.2022.10.19.02.38.42; Wed, 19 Oct 2022 02:38: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=hDtaTrfT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233424AbiJSJav (ORCPT + 99 others); Wed, 19 Oct 2022 05:30:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231578AbiJSJ1R (ORCPT ); Wed, 19 Oct 2022 05:27: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 24C05E6F58; Wed, 19 Oct 2022 02:12: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 7B66061807; Wed, 19 Oct 2022 09:10:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93925C433D6; Wed, 19 Oct 2022 09:10:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170631; bh=Pn90kuPbeK/qdV/mITnz331Ur07Ew6mzmpWUpHOoTiM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hDtaTrfTX5s5HVvw9yojzucV9cM0XDJ7rwixJu7Fx4NVl2HpkREhdL4SlyLS96iTM p84leraiXaexKpAdhdrNUSOGFWBausy0MJ5ysLt27QTaW3oHearTNIrE+IcLVGKttR g5k+GydlHANQmCplEcVjE4JH34BJC9X8wu+M9HdQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jianglei Nie , Lyude Paul , Sasha Levin Subject: [PATCH 6.0 728/862] drm/nouveau/nouveau_bo: fix potential memory leak in nouveau_bo_alloc() Date: Wed, 19 Oct 2022 10:33:35 +0200 Message-Id: <20221019083322.097159643@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108322322113932?= X-GMAIL-MSGID: =?utf-8?q?1747108322322113932?= From: Jianglei Nie [ Upstream commit 6dc548745d5b5102e3c53dc5097296ac270b6c69 ] nouveau_bo_alloc() allocates a memory chunk for "nvbo" with kzalloc(). When some error occurs, "nvbo" should be released. But when WARN_ON(pi < 0)) equals true, the function return ERR_PTR without releasing the "nvbo", which will lead to a memory leak. We should release the "nvbo" with kfree() if WARN_ON(pi < 0)) equals true. Signed-off-by: Jianglei Nie Signed-off-by: Lyude Paul Reviewed-by: Lyude Paul Link: https://patchwork.freedesktop.org/patch/msgid/20220705094306.2244103-1-niejianglei2021@163.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/nouveau/nouveau_bo.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index e29175e4b44c..07a327ad5e2a 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c @@ -281,8 +281,10 @@ nouveau_bo_alloc(struct nouveau_cli *cli, u64 *size, int *align, u32 domain, break; } - if (WARN_ON(pi < 0)) + if (WARN_ON(pi < 0)) { + kfree(nvbo); return ERR_PTR(-EINVAL); + } /* Disable compression if suitable settings couldn't be found. */ if (nvbo->comp && !vmm->page[pi].comp) { From patchwork Wed Oct 19 08:33: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: 4927 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225959wrs; Wed, 19 Oct 2022 02:44:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6qmVEQuxwAaNQ5bnSn/lYAD8EG6QEY3rKBLR5ABCF7R0dYvCnPSfkG5Wq1TxN3NvXMdzai X-Received: by 2002:a05:6402:27c7:b0:45d:45f0:e6c4 with SMTP id c7-20020a05640227c700b0045d45f0e6c4mr6469224ede.325.1666172670471; Wed, 19 Oct 2022 02:44:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172670; cv=none; d=google.com; s=arc-20160816; b=FMQMHp8gYxazSnNK/rHAVKH6ZK5YwYyKwSomWVqREVkvbmg+dzXKlCs5DxamI8+/ca U7AzhdhRcxTrobBImBIZbyNH9mxUtKXpVEnyLYgAyZqmULNxFh4kE8AaB4xggz2uLV6M 5pfydOknMZyu23inAlTZZjdAa65LiUvKk38mRcBMRwz7teTtLL49sBFhgZiBgka4g4RL Y7kZMz+TkroWY+TclfCYwsUfCI/KtDrE8c95GSKas5Q/jXZMyEaibnZAJqki4N5YkCou 8zrdIaWhH8X4Rc3Gm3YHTzfs9fQWEV4I8fFFzbAlxfw1Tq5ISaJYrxfc1QXqmWtSevEv audg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=A2hJUiK1YRKOZ3P4kX++exJfL9AzW8nZy2zW81ljdU4=; b=EuEo4hWqmykZLMlQK91c1YmSHlLAT8GM3MA4ORn53oMAXHcu9BMBuuS/Dg/6EE2vAh nNDNeJPL0Gs7hfCMBmG76o+6Fmilu4fZXbsG3fP/rSHbjZU9NxzlgBL66/zMDWUIYhyB TVsdhfgN8nqVzYckmbyyzhvRmp72cTdavEMKdzr+SnFvath8arwqGN6TgLoMcHAntcOB Y0G3eDo8QpDeeFRgQBgKrCZMwji5kVfY+j2TiT1BvxEQhUU3CzrD1mPl2+Mdu4EfRVsm FPDTTmz2/VTFXpdOq1aZIAiQuiPv4cTKVCsP1h+TGni3SgLPc/mxstZw9/pFgx66j+Bm /4qA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LUW3NpQN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gb22-20020a170907961600b00734b2821879si15382734ejc.898.2022.10.19.02.43.54; Wed, 19 Oct 2022 02:44: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=LUW3NpQN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233537AbiJSJa6 (ORCPT + 99 others); Wed, 19 Oct 2022 05:30:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233510AbiJSJ1T (ORCPT ); Wed, 19 Oct 2022 05:27:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E966E6F6E; Wed, 19 Oct 2022 02:12:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 21A966189B; Wed, 19 Oct 2022 09:10:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3097FC43149; Wed, 19 Oct 2022 09:10:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170634; bh=utuW3Bx0FnIKs6KiWMfFJsXZhlnXTIJMMLWht0Y6V40=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LUW3NpQN3MCbhnS/HI2m6TvCLLIlnQSeF0CT923/hfxbi6qAIITVuJ3XQh5YHTQZh hpeADh5vW8ND4zUZnyqqp+INlD+0X9cbXFLUsmXCP9v3z03Ebw5nxlaVaytJDLn7KA q0K5lp4DZ3pEtgDcUNJaZgfDMmhKL68qaqywUrYo= 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 6.0 729/862] drm: Use size_t type for len variable in drm_copy_field() Date: Wed, 19 Oct 2022 10:33:36 +0200 Message-Id: <20221019083322.146268079@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108674486160175?= X-GMAIL-MSGID: =?utf-8?q?1747108674486160175?= 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 8faad23dc1d8..e1b9a03e619c 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c @@ -472,7 +472,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 Wed Oct 19 08:33: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: 5203 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp264497wrs; Wed, 19 Oct 2022 04:20:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5/Pgf24+uaDhHCvZcTlRnsvZ5TnDfo5xgXirREelfNO0zxsstz3fEd0LJZZBf/KciVuqoV X-Received: by 2002:a17:902:f64f:b0:179:edcc:2bf4 with SMTP id m15-20020a170902f64f00b00179edcc2bf4mr7980441plg.70.1666178410675; Wed, 19 Oct 2022 04:20:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178410; cv=none; d=google.com; s=arc-20160816; b=Wmt64CXAw5KNr3wnlbYG3+oXFJ+DZTAPp+2XlRbYiEuacMNtskt7nVG0pg9UMUNQ8C c55QLIurXCRIbZ933KwgwotuPiQUKAYW2PEQzzIfAJLIFM4UA5SGu6776BazDncCtDkV JpGHrOPR9wLKpqlotB3Ng+pixYkEwyNrpfitDc4n4RrTtJ6FhDLKaEjWCDBsaMYH/UyT HYJ4fQtafu4MdrxW6Y8++PA6/LOnp4XhXkKmHF5sn28j1BXKDE2KATNh+2+LHTMlhWeS 0RejzaL/P+om3Xq8oVLmbbRvM/3loFE7hk6+sSmSBIt0WAPaxFF3YhalPdMII4P9HM6n x6LA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MFNPnTLzVEGLs7lLoB19/sjOs1lol6HbUhO69lcmW8k=; b=RCMuMwIA55fv4Ej3as+Jpg0PqsP5kD0WihrDnrcmsU8nJyRt7KQDOLRByDPpnKpHuA 1aEMnUrZZBhyNxljAQ33khmPwIPAQQ11iPMJNMbnMOu26dfxZ8SBCWnl8WkR3cYF1GvJ RPsLRSn44KcoRz2DPOleIGbzYsjZm8Yt+l9baZIn+yJ4M7Tm1EuoSzSnK4hLxkwLko9G gFjy8GY+6tFpUSegDm5dRnSoxtzRxhcJ3bPJROFn+Qey/n4srgaKtT1J9PpF8LrK0H2r RXVOO90lVkkozY7ounnULqt3+AcpIvrwd51n7gJb0sqmK8ROIvCwoeIG7jByFDHG97cm Qdeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KzpmpueJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v22-20020a17090a899600b0020a5121be54si21389492pjn.23.2022.10.19.04.19.56; Wed, 19 Oct 2022 04:20: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=KzpmpueJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232152AbiJSLJs (ORCPT + 99 others); Wed, 19 Oct 2022 07:09:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230137AbiJSLIv (ORCPT ); Wed, 19 Oct 2022 07:08:51 -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 19E7217D854; Wed, 19 Oct 2022 03:37:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id D2732CE21AF; Wed, 19 Oct 2022 09:10:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CABD3C433B5; Wed, 19 Oct 2022 09:10:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170637; bh=S/I8Db7hLIbRM3PUf798Ca3ZgHM9rw+HgU88xibN3X0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KzpmpueJJSo8t6jqZvYumt9GshB6PuqtZYZbIb8aGRnVIbeU1z1w9pBPGOmc3flAv WXEMkBDQeUj1GcSeSyixCHW8Kfz/t2rVJGgz7wzJjgn0hDODYgRKM9c/bSmisUZ8pC JWvgX7DzbhKZuJuXOpoT1ibWPcd/8EIqaC0JSbMY= 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 6.0 730/862] drm: Prevent drm_copy_field() to attempt copying a NULL pointer Date: Wed, 19 Oct 2022 10:33:37 +0200 Message-Id: <20221019083322.183470346@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114693435875677?= X-GMAIL-MSGID: =?utf-8?q?1747114693435875677?= 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 e1b9a03e619c..ca2a6e6101dc 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c @@ -474,6 +474,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 Wed Oct 19 08:33: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: 5164 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp253822wrs; Wed, 19 Oct 2022 03:58:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4pdtKJrfpN06pxw4W1oKKCqBA271BJjWcvVbhbc4ocxwZgWld09DoCDccQQho3bVXi+e9q X-Received: by 2002:a17:90b:3d8b:b0:20d:3e7f:32d3 with SMTP id pq11-20020a17090b3d8b00b0020d3e7f32d3mr8930761pjb.22.1666177106997; Wed, 19 Oct 2022 03:58:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666177106; cv=none; d=google.com; s=arc-20160816; b=OC3dQBFja3bS6CS50LiOOxFfqsTrHP5e8U+/apxWkh6EOkYJzL+3tslwhV4Xjp05aV lyXu1JvWo4DSJKUkk28NXQhsNGzM2CiMK/nPcu/BpF3/UrFGaXnuPLJD1EIRqaPz90Mu 3XdDh5QrXu/20aDFacq63T+WRB1epzpznQ93bAaGgKGOme6dm3WzdKlgBIVYsgtwBG6K 8/9go52pgePxJ5gnHzvxNJQub1prT5TH3Jj1vLo8TI2ynEYLXIPTIVdTherV90SMa+Py Hb2QKtfLBl2YsxNwdMOJBgd0SuxS0Pkg1iAN9jlF/DuON04AtmIPv5qn9TDnR0kzMVdn bm2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DDC3xJFMSZxh+HNp8d8hzKHaSWQ/f9Q+BH+BdxLKTB8=; b=q2HPCKMgNquC0BBQxiluUxYjTwhNjjbzpAgyrDrDS4yuC/I+kEDY0ClvGYhw7dWz6q 4gxizOaas0LMjzGtZ+nzSgModbI8wNSyqWwP7YzAgBePtWyoBFeXuAgG3nmppc2vXN23 Co1qtW5yhYWpPLK+PqorI4U7dTd0f/UhEHCbfxWUjsetpPlefqFBp4spvtrBgQm+g5T3 ZrWC4peOpRapwH38tHtJVT2m7GD8Ph/0qOxKBuW3ykumBuFkae0e6IkKy50kyUnKNgwM kSiVEZ7Ifi85Q24qdJ1RZUuGseQi9nagYcK4GRnBtXdwyPB1KPeJanDLGCo/dumEimq3 EKbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=r7F1a51X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a16-20020a17090abe1000b0020d5c7ae3cbsi15769943pjs.38.2022.10.19.03.58.13; Wed, 19 Oct 2022 03:58: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=r7F1a51X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234685AbiJSK53 (ORCPT + 99 others); Wed, 19 Oct 2022 06:57:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234483AbiJSK4a (ORCPT ); Wed, 19 Oct 2022 06:56:30 -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 37DE7127422; Wed, 19 Oct 2022 03:27:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 107BDB824B9; Wed, 19 Oct 2022 09:10:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6A278C433D6; Wed, 19 Oct 2022 09:10:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170639; bh=QXcBMzebHoL91pIygKKq4BACg8oie/iIyZvGUNaBrXc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r7F1a51XNceMwvil0K9HqrYzvtGor+6pVxKss/lWWTVcDZjUnBVSr7AmH+4KD/OSG LatMGGkGecauApGsa8Q0fVtT4O7MJfXslCkhDU/U2CLVKf+lUHYybc8DF3cbavrxUq YwLs0UTdc4E6VbEIU7WxuJyNBLbnxi6gaOw2/oe4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Carsten Haitzler , Liviu Dudau , Sasha Levin Subject: [PATCH 6.0 731/862] drm/komeda: Fix handling of atomic commits in the atomic_commit_tail hook Date: Wed, 19 Oct 2022 10:33:38 +0200 Message-Id: <20221019083322.234974098@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747113326358910599?= X-GMAIL-MSGID: =?utf-8?q?1747113326358910599?= From: Liviu Dudau [ Upstream commit eaa225b6b52233d45457fd33730e1528c604d92d ] Komeda driver relies on the generic DRM atomic helper functions to handle commits. It only implements an atomic_commit_tail hook for the mode_config_helper_funcs and even that one is pretty close to the generic implementation with the exception of additional dma_fence signalling. What the generic helper framework doesn't do is waiting for the actual hardware to signal that the commit parameters have been written into the appropriate registers. As we signal CRTC events only on the irq handlers, we need to flush the configuration and wait for the hardware to respond. Add the Komeda specific implementation for atomic_commit_hw_done() that flushes and waits for flip done before calling drm_atomic_helper_commit_hw_done(). The fix was prompted by a patch from Carsten Haitzler where he was trying to solve the same issue but in a different way that I think can lead to wrong event signaling to userspace. Reported-by: Carsten Haitzler Tested-by: Carsten Haitzler Reviewed-by: Carsten Haitzler Signed-off-by: Liviu Dudau Link: https://patchwork.freedesktop.org/patch/msgid/20220722122139.288486-1-liviu.dudau@arm.com Signed-off-by: Sasha Levin --- .../gpu/drm/arm/display/komeda/komeda_crtc.c | 4 ++-- .../gpu/drm/arm/display/komeda/komeda_kms.c | 21 ++++++++++++++++++- .../gpu/drm/arm/display/komeda/komeda_kms.h | 2 ++ 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c index 59172acb9738..292f533d8cf0 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c @@ -235,7 +235,7 @@ void komeda_crtc_handle_event(struct komeda_crtc *kcrtc, crtc->state->event = NULL; drm_crtc_send_vblank_event(crtc, event); } else { - DRM_WARN("CRTC[%d]: FLIP happen but no pending commit.\n", + DRM_WARN("CRTC[%d]: FLIP happened but no pending commit.\n", drm_crtc_index(&kcrtc->base)); } spin_unlock_irqrestore(&crtc->dev->event_lock, flags); @@ -286,7 +286,7 @@ komeda_crtc_atomic_enable(struct drm_crtc *crtc, komeda_crtc_do_flush(crtc, old); } -static void +void komeda_crtc_flush_and_wait_for_flip_done(struct komeda_crtc *kcrtc, struct completion *input_flip_done) { diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c index 93b7f09b96ca..327051bba5b6 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c @@ -69,6 +69,25 @@ static const struct drm_driver komeda_kms_driver = { .minor = 1, }; +static void komeda_kms_atomic_commit_hw_done(struct drm_atomic_state *state) +{ + struct drm_device *dev = state->dev; + struct komeda_kms_dev *kms = to_kdev(dev); + int i; + + for (i = 0; i < kms->n_crtcs; i++) { + struct komeda_crtc *kcrtc = &kms->crtcs[i]; + + if (kcrtc->base.state->active) { + struct completion *flip_done = NULL; + if (kcrtc->base.state->event) + flip_done = kcrtc->base.state->event->base.completion; + komeda_crtc_flush_and_wait_for_flip_done(kcrtc, flip_done); + } + } + drm_atomic_helper_commit_hw_done(state); +} + static void komeda_kms_commit_tail(struct drm_atomic_state *old_state) { struct drm_device *dev = old_state->dev; @@ -81,7 +100,7 @@ static void komeda_kms_commit_tail(struct drm_atomic_state *old_state) drm_atomic_helper_commit_modeset_enables(dev, old_state); - drm_atomic_helper_commit_hw_done(old_state); + komeda_kms_atomic_commit_hw_done(old_state); drm_atomic_helper_wait_for_flip_done(dev, old_state); diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_kms.h b/drivers/gpu/drm/arm/display/komeda/komeda_kms.h index 7889e380ab23..7339339ef6b8 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_kms.h +++ b/drivers/gpu/drm/arm/display/komeda/komeda_kms.h @@ -183,6 +183,8 @@ void komeda_kms_cleanup_private_objs(struct komeda_kms_dev *kms); void komeda_crtc_handle_event(struct komeda_crtc *kcrtc, struct komeda_events *evts); +void komeda_crtc_flush_and_wait_for_flip_done(struct komeda_crtc *kcrtc, + struct completion *input_flip_done); struct komeda_kms_dev *komeda_kms_attach(struct komeda_dev *mdev); void komeda_kms_detach(struct komeda_kms_dev *kms); From patchwork Wed Oct 19 08:33: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: 4860 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223941wrs; Wed, 19 Oct 2022 02:38:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7oxzm1tFJyI4SJCajaI0U/3MlaeBvxxkvyuBBy4xGXOgtk8+FoaS48Hp883n5OPIJGhtjp X-Received: by 2002:a17:907:7292:b0:78e:2eb5:6af2 with SMTP id dt18-20020a170907729200b0078e2eb56af2mr6008511ejc.261.1666172332398; Wed, 19 Oct 2022 02:38:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172332; cv=none; d=google.com; s=arc-20160816; b=GDmPi/+GzW9+5FgLPuLz9bSF/tv1xkF8UxcX0OGpfABaV+WG+Djca1jPADXx+sbGjT KVlDoHj+RWLSPEJK1VuqC6/0pbNCvzc2sosXB14lW8gCZTbCoYwnjpD8R6soJlCewORv gJBKngFVahABEgW30ZDrJoUGyTpelTMsVfXJyIxKwv5TAOqPCQvOZ+kNO5jbp/w2cZBk EiIqcwp2DTkYEsY+NSeJSLW62oBUJy9xsL17lyr3Ev1xx5xAIX+iPew2ihavSbgv2Mg8 D0bqMIYv/C1Td+LEHq0ZPUEUXebjL1JeCr6TWKn1oH6u5vLsCGuZJ0H7yRxrKCXuEtIp QSlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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+z4HvNPynwS3nx5IAIbiDv73MJKdhHjdjHbHBZcu00=; b=QjcieRUS6Se1wI+0kPPgfI32XUgqZS7Uv6zI35Woge3iB6d5s2ctBJLJ5FbOWjkTKP cgq02g3I4LuErRLMGKfZD3QVCjkEXKJkXJS1+pbtnseIwOXhtUuoKRFfP9cea2oIFl93 BvTr1fF6uFDTsj+6ponBPISalE7yIarMtSPPwm2TOxO++03KuJb5gZ8wEVROMvFg1mSq T3Qlr45ZHRM2qpsnNknrFtel7+EBqHXnGr4eFHkwygCKB6EAskbmB1LQY79zLF9AafW5 USoriWK7sjeh6ySj/iUafbGCqAC4pT/Zli2QpCMEF6rBXtfaXqKVSELk3GjdPVONzPij BhGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uNnDSRxq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m7-20020a1709061ec700b0078d4cf8de04si11943015ejj.380.2022.10.19.02.38.27; Wed, 19 Oct 2022 02:38: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=uNnDSRxq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233577AbiJSJ2d (ORCPT + 99 others); Wed, 19 Oct 2022 05:28:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233487AbiJSJ0z (ORCPT ); Wed, 19 Oct 2022 05:26:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C89EE6F79; Wed, 19 Oct 2022 02:12:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1403B6178B; Wed, 19 Oct 2022 09:10:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25715C433D6; Wed, 19 Oct 2022 09:10:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170642; bh=/7mFFmnD5ORcDhB0aTlr6PsMjGLmulXKt1omuQvE+lQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uNnDSRxqvjLifKyXk3QzyZ1IxZmiz2WHIK96ajaO9Na6v1I7u0GiInrQqq2AaveUb 0463bJl4NERKZ5e4kxJo1v8mdSf8OhvYesnJZisz2L3H0nG6DwYi+Cvuo+dUNiD0Ay SLtSnM1v1FKHL2OGRGNeWOO7q1f/CbWJRT3KsciA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zeng Jingxiang , Robert Foss , Sasha Levin Subject: [PATCH 6.0 732/862] gpu: lontium-lt9611: Fix NULL pointer dereference in lt9611_connector_init() Date: Wed, 19 Oct 2022 10:33:39 +0200 Message-Id: <20221019083322.286124999@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108319328614659?= X-GMAIL-MSGID: =?utf-8?q?1747108319328614659?= From: Zeng Jingxiang [ Upstream commit ef8886f321c5dab8124b9153d25afa2a71d05323 ] A NULL check for bridge->encoder shows that it may be NULL, but it already been dereferenced on all paths leading to the check. 812 if (!bridge->encoder) { Dereference the pointer bridge->encoder. 810 drm_connector_attach_encoder(<9611->connector, bridge->encoder); Signed-off-by: Zeng Jingxiang Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20220727073119.1578972-1-zengjx95@gmail.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/bridge/lontium-lt9611.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c index 8a60e83482a0..5fccacc159f0 100644 --- a/drivers/gpu/drm/bridge/lontium-lt9611.c +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c @@ -813,13 +813,14 @@ static int lt9611_connector_init(struct drm_bridge *bridge, struct lt9611 *lt961 drm_connector_helper_add(<9611->connector, <9611_bridge_connector_helper_funcs); - drm_connector_attach_encoder(<9611->connector, bridge->encoder); if (!bridge->encoder) { DRM_ERROR("Parent encoder object not found"); return -ENODEV; } + drm_connector_attach_encoder(<9611->connector, bridge->encoder); + return 0; } From patchwork Wed Oct 19 08:33:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4899 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225568wrs; Wed, 19 Oct 2022 02:43:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM64NGnCnIwqzfW5MpSOwGIwd9/CvlEKqZayd4d3BlJguNvc3sVK2tzmr+Z/E4vVNhzcG4F1 X-Received: by 2002:a17:906:8a52:b0:78d:b6db:149d with SMTP id gx18-20020a1709068a5200b0078db6db149dmr5892290ejc.733.1666172606069; Wed, 19 Oct 2022 02:43:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172606; cv=none; d=google.com; s=arc-20160816; b=ESQRNVSV4iNLVTcyHOiaABLp3EinNcd73jlLv97bQnB4cZo/G3JbRsRvDkh4zP+m4i iKrIld8aAAWwQbkGD9n8OZ/TiK0SEaz3T+Wib+yv1QAkMQ7eGIeZLbJoYA0LpaTiNMtz PH2PcHRRTKgJugpH2Omkxhs7SHoUySSkZAMTxoLdOnuuFPDGhgMrQZkJAjHt2+/czRlo gyiuLZoycwCphCDypyxZcwdgD91m6hfFnazzixs2Spgv+Sm+7zJrYF5EaldLMuP1qQqB ScQ4Temk7bv4VrAqhGrGfe2n/N4gom/Mjpgvw7vrASRpzKh19M59u4comBL6q1Mr10ig RtrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YyopP+EbhMsXY87INQd8mfSPbYfh92OsPAQumiSylqY=; b=FfKoWpZlM9NMWeIVa9mBKDs8T8W3e3qDDO/xrB7A1nhIa/wUuwbJguDUqnBB710X/D hY3Kd1gD27j0rr/oCcgWJQBGEdYSWMiHlDLeSALHvoAb4GSvYRw0XfBP3oW0ksD9N+Ea DFGvYuq/K6QOuKx62/jjCZXvDK7J42NR9E88dQBWsMwMiz/uZAH+dbadl2SHMPHLMpQk gjjw0LbPzGToBTtTYWMfIlj4HCFjbbaYOIn3vODrs17hzOZiDuHrxZiwT+39bnTLwph3 28o67IRVZMCCjO0kkZ/1iir9mNejfNiEMoOyihszt9jSvTWOjmx5as4IyPjlboLd5Y9x rr9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VkSHH1Vq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ec12-20020a0564020d4c00b00459779478absi11695490edb.186.2022.10.19.02.42.58; Wed, 19 Oct 2022 02:43: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=VkSHH1Vq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233680AbiJSJbU (ORCPT + 99 others); Wed, 19 Oct 2022 05:31:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233607AbiJSJ1j (ORCPT ); Wed, 19 Oct 2022 05:27:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FD03E77A0; Wed, 19 Oct 2022 02:12: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 AF9F56185F; Wed, 19 Oct 2022 09:10:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD6D7C433D6; Wed, 19 Oct 2022 09:10:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170645; bh=Bl4G7PhvvFyNlas+R2mIUh5HCYKgCqnCPCHdtZQ7cm4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VkSHH1VqtLGq3plhapVtGV+n3lH1O+zSrWbMFhDlFqQbaqskONM6uPnkrvlv0ixp6 zQpeuVKN2+OLWdI7k0XC3H15MvAb1U7QltXqY66Un8be/4Z/LutE3EJpgd8PxduuOU 1npNXgJ2H6bBxg25dlD31cLIo9t2AvetcCdy/8FI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Gow , Tales Aparecida , Alex Deucher , Sasha Levin Subject: [PATCH 6.0 733/862] drm/amd/display: fix overflow on MIN_I64 definition Date: Wed, 19 Oct 2022 10:33:40 +0200 Message-Id: <20221019083322.330191882@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108606960746470?= X-GMAIL-MSGID: =?utf-8?q?1747108606960746470?= From: David Gow [ Upstream commit 6ae0632d17759852c07e2d1e0a31c728eb6ba246 ] The definition of MIN_I64 in bw_fixed.c can cause gcc to whinge about integer overflow, because it is treated as a positive value, which is then negated. The temporary positive value is not necessarily representable. This causes the following warning: ../drivers/gpu/drm/amd/amdgpu/../display/dc/dml/calcs/bw_fixed.c:30:19: warning: integer overflow in expression ‘-9223372036854775808’ of type ‘long long int’ results in ‘-9223372036854775808’ [-Woverflow] 30 | (int64_t)(-(1LL << 63)) | ^ Writing out (-MAX_I64 - 1) works instead. Signed-off-by: David Gow Signed-off-by: Tales Aparecida Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/dc/dml/calcs/bw_fixed.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/dml/calcs/bw_fixed.c b/drivers/gpu/drm/amd/display/dc/dml/calcs/bw_fixed.c index 6ca288fb5fb9..2d46bc527b21 100644 --- a/drivers/gpu/drm/amd/display/dc/dml/calcs/bw_fixed.c +++ b/drivers/gpu/drm/amd/display/dc/dml/calcs/bw_fixed.c @@ -26,12 +26,12 @@ #include "bw_fixed.h" -#define MIN_I64 \ - (int64_t)(-(1LL << 63)) - #define MAX_I64 \ (int64_t)((1ULL << 63) - 1) +#define MIN_I64 \ + (-MAX_I64 - 1) + #define FRACTIONAL_PART_MASK \ ((1ULL << BW_FIXED_BITS_PER_FRACTIONAL_PART) - 1) From patchwork Wed Oct 19 08:33: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: 5326 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp285875wrs; Wed, 19 Oct 2022 05:08:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5mPg/XH/5JNMRjjgDsjkZCwN+u1fpQaOAGL4yCZ6USwABuUOJFAnamb1LCUygvfwkHCOrt X-Received: by 2002:a05:6402:1a33:b0:458:a00a:80a with SMTP id be19-20020a0564021a3300b00458a00a080amr7158684edb.378.1666181320449; Wed, 19 Oct 2022 05:08:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666181320; cv=none; d=google.com; s=arc-20160816; b=jG2zVAOJLzyyl7r2MNRmva9I0Xnrw0mtiho++ugZdiK8J7XcTkTFP8RfVjKWlcSD2d CfwrxKdT8iOHSOXj9UsfOX35Ta44FPa5H7cHN33H+ZUxUn28CK1/3AAdIG8/lMdXesUW 6XHhoC44qBBzqJlXIpFKtQrJrBe3d7EmGE0o9fJueoliyVmKVPcGv1t+P6P98Sj//FOR xvenG16rVHkpyJyyqvp5YsLPo6/ZJ6BfC5Va1aeqohOiB8Gu9LoYNY+sUmN8s8jwjX2k xYiQ3UQd8lj0gdfAqn14wzIwpFAzniP7EUcPhArJrNIMWhpbE8Oj8q7ghBw9FZsttOlv rVpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=h1EuxK6HYlgGwTppQowMKAf8rYnfW66GGWqdHYB6GiY=; b=vB4cjRS/NJ36le3G1kQHCl5LMJRq8easCWmZvcif59slPtB06ysbKAj+Hi6cWmrCdm jHncpzXPuiuQLaYzqtRFjnATJLWAzv6jWYoPW2XRaP9iuUTqzjrDabpEwyOv/nZi2A+N PW49Y/4uVnRCrXa1U4VpZWmofc9Efb1X911LmfiTjf2jdM8LVqOnNFcnM+bnCEhCuDBP bJ0UamKkhy08WTa431f82EaHDr51VAcr5PZN91W3It5hGnxJx4E+c9ZSqFTl4rEKse9G xLzYEM0xKR0LLQXJgVYy/LXq00YB0uzm0a2DrhQulvu28PzJ/YHs/yDKWJqZHBPxTuZY IkUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OAHCO7Jm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n29-20020a50935d000000b0045725a5b76csi13006190eda.294.2022.10.19.05.08.11; Wed, 19 Oct 2022 05:08: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=OAHCO7Jm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231782AbiJSMHA (ORCPT + 99 others); Wed, 19 Oct 2022 08:07:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232503AbiJSMGi (ORCPT ); Wed, 19 Oct 2022 08:06:38 -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 3FF2DF708B; Wed, 19 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 ams.source.kernel.org (Postfix) with ESMTPS id F0AE7B824B8; Wed, 19 Oct 2022 09:10:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70B5BC43470; Wed, 19 Oct 2022 09:10:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170647; bh=DBhVd95XpZutQyzgeXjErPc70e6GrTLKwZc/rk2PCZI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OAHCO7Jm2Am2p/oqKAlWv+/YzHOp+1l4fIdMie2aSdh5E1D6fxrrsUqMjIdlLAADH oo/YjsFCA9qg8yvA+RTsQNgSvuFcGDAJoKxuZJrDDPVRRhZWpMqHzcFXkSrU/Xul95 smrUhZrKQg5OvzQwGuSCaS/1u2l/1WKP96gNZu9k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kai Vehmanen , Pierre-Louis Bossart , Cezary Rojewski , Takashi Iwai , Sasha Levin Subject: [PATCH 6.0 734/862] ALSA: hda: Fix page fault in snd_hda_codec_shutdown() Date: Wed, 19 Oct 2022 10:33:41 +0200 Message-Id: <20221019083322.381422903@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747117744325675003?= X-GMAIL-MSGID: =?utf-8?q?1747117744325675003?= From: Cezary Rojewski [ Upstream commit f2bd1c5ae2cb0cf9525c9bffc0038c12dd7e1338 ] If early probe of HDAudio bus driver fails e.g.: due to missing firmware file, snd_hda_codec_shutdown() ends in manipulating uninitialized codec->pcm_list_head causing page fault. Initialization of HDAudio codec in ASoC is split in two: - snd_hda_codec_device_init() - snd_hda_codec_device_new() snd_hda_codec_device_init() is called during probe_codecs() by HDAudio bus driver while snd_hda_codec_device_new() is called by codec-component's ->probe(). The second call will not happen until all components required by related sound card are present within the ASoC framework. With firmware failing to load during the PCI's deferred initialization i.e.: probe_work(), no platform components are ever registered. HDAudio codec enumeration is done at that point though, so the codec components became registered to ASoC framework, calling snd_hda_codec_device_init() in the process. Now, during platform reboot snd_hda_codec_shutdown() is called for every codec found on the HDAudio bus causing oops if any of them has not completed both of their initialization steps. Relocating field initialization fixes the issue. Reviewed-by: Kai Vehmanen Reviewed-by: Pierre-Louis Bossart Signed-off-by: Cezary Rojewski Link: https://lore.kernel.org/r/20220816111727.3218543-7-cezary.rojewski@intel.com Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/pci/hda/hda_codec.c | 41 +++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 384426d7e9dd..4ae8b9574778 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -931,8 +931,28 @@ snd_hda_codec_device_init(struct hda_bus *bus, unsigned int codec_addr, } codec->bus = bus; + codec->depop_delay = -1; + codec->fixup_id = HDA_FIXUP_ID_NOT_SET; + codec->core.dev.release = snd_hda_codec_dev_release; + codec->core.exec_verb = codec_exec_verb; codec->core.type = HDA_DEV_LEGACY; + mutex_init(&codec->spdif_mutex); + mutex_init(&codec->control_mutex); + snd_array_init(&codec->mixers, sizeof(struct hda_nid_item), 32); + snd_array_init(&codec->nids, sizeof(struct hda_nid_item), 32); + snd_array_init(&codec->init_pins, sizeof(struct hda_pincfg), 16); + snd_array_init(&codec->driver_pins, sizeof(struct hda_pincfg), 16); + snd_array_init(&codec->cvt_setups, sizeof(struct hda_cvt_setup), 8); + snd_array_init(&codec->spdif_out, sizeof(struct hda_spdif_out), 16); + snd_array_init(&codec->jacktbl, sizeof(struct hda_jack_tbl), 16); + snd_array_init(&codec->verbs, sizeof(struct hda_verb *), 8); + INIT_LIST_HEAD(&codec->conn_list); + INIT_LIST_HEAD(&codec->pcm_list_head); + INIT_DELAYED_WORK(&codec->jackpoll_work, hda_jackpoll_work); + refcount_set(&codec->pcm_ref, 1); + init_waitqueue_head(&codec->remove_sleep); + return codec; } EXPORT_SYMBOL_GPL(snd_hda_codec_device_init); @@ -985,29 +1005,8 @@ int snd_hda_codec_device_new(struct hda_bus *bus, struct snd_card *card, if (snd_BUG_ON(codec_addr > HDA_MAX_CODEC_ADDRESS)) return -EINVAL; - codec->core.dev.release = snd_hda_codec_dev_release; - codec->core.exec_verb = codec_exec_verb; - codec->card = card; codec->addr = codec_addr; - mutex_init(&codec->spdif_mutex); - mutex_init(&codec->control_mutex); - snd_array_init(&codec->mixers, sizeof(struct hda_nid_item), 32); - snd_array_init(&codec->nids, sizeof(struct hda_nid_item), 32); - snd_array_init(&codec->init_pins, sizeof(struct hda_pincfg), 16); - snd_array_init(&codec->driver_pins, sizeof(struct hda_pincfg), 16); - snd_array_init(&codec->cvt_setups, sizeof(struct hda_cvt_setup), 8); - snd_array_init(&codec->spdif_out, sizeof(struct hda_spdif_out), 16); - snd_array_init(&codec->jacktbl, sizeof(struct hda_jack_tbl), 16); - snd_array_init(&codec->verbs, sizeof(struct hda_verb *), 8); - INIT_LIST_HEAD(&codec->conn_list); - INIT_LIST_HEAD(&codec->pcm_list_head); - refcount_set(&codec->pcm_ref, 1); - init_waitqueue_head(&codec->remove_sleep); - - INIT_DELAYED_WORK(&codec->jackpoll_work, hda_jackpoll_work); - codec->depop_delay = -1; - codec->fixup_id = HDA_FIXUP_ID_NOT_SET; #ifdef CONFIG_PM codec->power_jiffies = jiffies; From patchwork Wed Oct 19 08:33: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: 5011 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp244487wrs; Wed, 19 Oct 2022 03:33:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM46wvEaM2ZIOoH8gzXLbPU3wJ+VUCRHGtBiRKF+yNFYdjqJf/6wtWWrG8KHGSzWd7uioTaK X-Received: by 2002:a17:907:2da5:b0:78e:1208:8783 with SMTP id gt37-20020a1709072da500b0078e12088783mr6185334ejc.743.1666175586906; Wed, 19 Oct 2022 03:33:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666175586; cv=none; d=google.com; s=arc-20160816; b=zwLj6Vt2MjI95fXgp6rihzi6UXGlxbdXGPRQNoM3cGhmOMIyPfvvqU/XXZVO2xxL3q G7qs9q76djhdPj49mcUgwztss0hrd9zPMccia5y/7FPnMwDCoSnsiYcSEMum0Yaopc4+ mOXQsHk7Ml1u8caL/Hw2vagVeOCACqWbh0aP/NKOjp+Lzblw1+t4ksl91mcbG6O9KNUU xoOf26eGwQxTRNZdGKCPzTEOnuNhGzC3pT2vmbS4s+4L/sIrvgjvMhW2pkWI9DlBPVCh PXhyNsdWT0d7PjdNfmuNCVe+xgeVlrAQ/qhZYCoLJQgf+qViRDIeDwjDXudkkBO1h+aE dl8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=upBKJ8A3MRhccMpmC1Gd2hn72/gSwbYIo/TSAg/njSs=; b=vC3Gk1ya/nRiQrsQe5HRfTQJ2XZRMu1bkcvbgyv531laFFA0XtO+f81/RE34LccSV0 VTDOL51mTgBxX+/vBI1ADRUhdOQesvJWEjJ9gCq7t9lDimddPmmsdA4nsVb5z//6IAMO vl3y9FkI0FSsY6AV3qku1vNCAndbBGk5/oXAI5hPieqbjSE6ZNL8adCEpC9CaArAmPGJ 1aVLYO2+mj/MihSC9OZiEVK134BQcn0wq47aonFctpeqn1hs/EJs5Vr/p68ZzKe6sn7B +L3hsdmvXv1fG1YozzR/MFzRhjsLic5WsEvruDjemvdPdCqG6TgD/wTnu8y7JSDEoKPN vFSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="c/10FefH"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y3-20020aa7c243000000b00457263f9ee0si11706798edo.93.2022.10.19.03.32.28; Wed, 19 Oct 2022 03:33: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="c/10FefH"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231719AbiJSKIo (ORCPT + 99 others); Wed, 19 Oct 2022 06:08:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231688AbiJSKIP (ORCPT ); Wed, 19 Oct 2022 06:08:15 -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 AA45514705A; Wed, 19 Oct 2022 02:46: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 sin.source.kernel.org (Postfix) with ESMTPS id 278B5CE21AA; Wed, 19 Oct 2022 09:10:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D834C433D7; Wed, 19 Oct 2022 09:10:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170650; bh=IUpuJLyLUQd1BoDEG1IqdNAmx4Mwk+yPRjQw2dQF9bI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c/10FefHcJOaWnSiPM5OJ75sDvKnqLOFCg9z9IvM6kXv/DNo1FkVAPQ1V/OT+UBGf qeSMdskN2zs2Tpq9rVR3CMJo2J/6uBF3muXh5uPULKEmDssHOOVw7uTpi3EPLduZUo YIAazrciLL/kmRnT/tzc44PDUckcdpHYTuaxCZU0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Conner Knox , Takashi Iwai , Sasha Levin Subject: [PATCH 6.0 735/862] ALSA: usb-audio: Add quirk to enable Avid Mbox 3 support Date: Wed, 19 Oct 2022 10:33:42 +0200 Message-Id: <20221019083322.429850866@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747111732214213899?= X-GMAIL-MSGID: =?utf-8?q?1747111732214213899?= From: Conner Knox [ Upstream commit b01104fc62b6194c852124f6c6df1c0a5c031fc1 ] Add support for Avid Mbox3 USB audio interface at 48kHz Signed-off-by: Conner Knox Link: https://lore.kernel.org/r/20220818201433.16360-1-mbarriolinares@gmail.com Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/usb/quirks-table.h | 76 ++++++++++ sound/usb/quirks.c | 302 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 378 insertions(+) diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h index f93201a830b5..06dfdd45cff8 100644 --- a/sound/usb/quirks-table.h +++ b/sound/usb/quirks-table.h @@ -2985,6 +2985,82 @@ YAMAHA_DEVICE(0x7010, "UB99"), } } }, +/* DIGIDESIGN MBOX 3 */ +{ + USB_DEVICE(0x0dba, 0x5000), + .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { + .vendor_name = "Digidesign", + .product_name = "Mbox 3", + .ifnum = QUIRK_ANY_INTERFACE, + .type = QUIRK_COMPOSITE, + .data = (const struct snd_usb_audio_quirk[]) { + { + .ifnum = 0, + .type = QUIRK_IGNORE_INTERFACE + }, + { + .ifnum = 1, + .type = QUIRK_IGNORE_INTERFACE + }, + { + .ifnum = 2, + .type = QUIRK_AUDIO_FIXED_ENDPOINT, + .data = &(const struct audioformat) { + .formats = SNDRV_PCM_FMTBIT_S24_3LE, + .channels = 4, + .iface = 2, + .altsetting = 1, + .altset_idx = 1, + .attributes = 0x00, + .endpoint = 0x01, + .ep_attr = USB_ENDPOINT_XFER_ISOC | + USB_ENDPOINT_SYNC_ASYNC, + .rates = SNDRV_PCM_RATE_48000, + .rate_min = 48000, + .rate_max = 48000, + .nr_rates = 1, + .rate_table = (unsigned int[]) { + 48000 + } + } + }, + { + .ifnum = 3, + .type = QUIRK_AUDIO_FIXED_ENDPOINT, + .data = &(const struct audioformat) { + .formats = SNDRV_PCM_FMTBIT_S24_3LE, + .channels = 4, + .iface = 3, + .altsetting = 1, + .altset_idx = 1, + .endpoint = 0x81, + .attributes = 0x00, + .ep_attr = USB_ENDPOINT_XFER_ISOC | + USB_ENDPOINT_SYNC_ASYNC, + .maxpacksize = 0x009c, + .rates = SNDRV_PCM_RATE_48000, + .rate_min = 48000, + .rate_max = 48000, + .nr_rates = 1, + .rate_table = (unsigned int[]) { + 48000 + } + } + }, + { + .ifnum = 4, + .type = QUIRK_MIDI_FIXED_ENDPOINT, + .data = &(const struct snd_usb_midi_endpoint_info) { + .out_cables = 0x0001, + .in_cables = 0x0001 + } + }, + { + .ifnum = -1 + } + } + } +}, { /* Tascam US122 MKII - playback-only support */ USB_DEVICE_VENDOR_SPEC(0x0644, 0x8021), diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index 5b4d8f5eade2..194c75c45628 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c @@ -1020,6 +1020,304 @@ static int snd_usb_axefx3_boot_quirk(struct usb_device *dev) return 0; } +static void mbox3_setup_48_24_magic(struct usb_device *dev) +{ + /* The Mbox 3 is "little endian" */ + /* max volume is: 0x0000. */ + /* min volume is: 0x0080 (shown in little endian form) */ + + + /* Load 48000Hz rate into buffer */ + u8 com_buff[4] = {0x80, 0xbb, 0x00, 0x00}; + + /* Set 48000Hz sample rate */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 0x01, 0x21, 0x0100, 0x0001, &com_buff, 4); //Is this really needed? + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 0x01, 0x21, 0x0100, 0x8101, &com_buff, 4); + + /* Deactivate Tuner */ + /* on = 0x01*/ + /* off = 0x00*/ + com_buff[0] = 0x00; + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 0x01, 0x21, 0x0003, 0x2001, &com_buff, 1); + + /* Set clock source to Internal (as opposed to S/PDIF) */ + com_buff[0] = 0x01; + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0100, 0x8001, &com_buff, 1); + + /* Mute the hardware loopbacks to start the device in a known state. */ + com_buff[0] = 0x00; + com_buff[1] = 0x80; + /* Analogue input 1 left channel: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0110, 0x4001, &com_buff, 2); + /* Analogue input 1 right channel: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0111, 0x4001, &com_buff, 2); + /* Analogue input 2 left channel: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0114, 0x4001, &com_buff, 2); + /* Analogue input 2 right channel: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0115, 0x4001, &com_buff, 2); + /* Analogue input 3 left channel: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0118, 0x4001, &com_buff, 2); + /* Analogue input 3 right channel: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0119, 0x4001, &com_buff, 2); + /* Analogue input 4 left channel: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x011c, 0x4001, &com_buff, 2); + /* Analogue input 4 right channel: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x011d, 0x4001, &com_buff, 2); + + /* Set software sends to output */ + com_buff[0] = 0x00; + com_buff[1] = 0x00; + /* Analogue software return 1 left channel: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0100, 0x4001, &com_buff, 2); + com_buff[0] = 0x00; + com_buff[1] = 0x80; + /* Analogue software return 1 right channel: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0101, 0x4001, &com_buff, 2); + com_buff[0] = 0x00; + com_buff[1] = 0x80; + /* Analogue software return 2 left channel: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0104, 0x4001, &com_buff, 2); + com_buff[0] = 0x00; + com_buff[1] = 0x00; + /* Analogue software return 2 right channel: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0105, 0x4001, &com_buff, 2); + + com_buff[0] = 0x00; + com_buff[1] = 0x80; + /* Analogue software return 3 left channel: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0108, 0x4001, &com_buff, 2); + /* Analogue software return 3 right channel: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0109, 0x4001, &com_buff, 2); + /* Analogue software return 4 left channel: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x010c, 0x4001, &com_buff, 2); + /* Analogue software return 4 right channel: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x010d, 0x4001, &com_buff, 2); + + /* Return to muting sends */ + com_buff[0] = 0x00; + com_buff[1] = 0x80; + /* Analogue fx return left channel: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0120, 0x4001, &com_buff, 2); + /* Analogue fx return right channel: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0121, 0x4001, &com_buff, 2); + + /* Analogue software input 1 fx send: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0100, 0x4201, &com_buff, 2); + /* Analogue software input 2 fx send: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0101, 0x4201, &com_buff, 2); + /* Analogue software input 3 fx send: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0102, 0x4201, &com_buff, 2); + /* Analogue software input 4 fx send: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0103, 0x4201, &com_buff, 2); + /* Analogue input 1 fx send: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0104, 0x4201, &com_buff, 2); + /* Analogue input 2 fx send: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0105, 0x4201, &com_buff, 2); + /* Analogue input 3 fx send: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0106, 0x4201, &com_buff, 2); + /* Analogue input 4 fx send: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0107, 0x4201, &com_buff, 2); + + /* Toggle allowing host control */ + com_buff[0] = 0x02; + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 3, 0x21, 0x0000, 0x2001, &com_buff, 1); + + /* Do not dim fx returns */ + com_buff[0] = 0x00; + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 3, 0x21, 0x0002, 0x2001, &com_buff, 1); + + /* Do not set fx returns to mono */ + com_buff[0] = 0x00; + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 3, 0x21, 0x0001, 0x2001, &com_buff, 1); + + /* Mute the S/PDIF hardware loopback + * same odd volume logic here as above + */ + com_buff[0] = 0x00; + com_buff[1] = 0x80; + /* S/PDIF hardware input 1 left channel */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0112, 0x4001, &com_buff, 2); + /* S/PDIF hardware input 1 right channel */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0113, 0x4001, &com_buff, 2); + /* S/PDIF hardware input 2 left channel */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0116, 0x4001, &com_buff, 2); + /* S/PDIF hardware input 2 right channel */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0117, 0x4001, &com_buff, 2); + /* S/PDIF hardware input 3 left channel */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x011a, 0x4001, &com_buff, 2); + /* S/PDIF hardware input 3 right channel */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x011b, 0x4001, &com_buff, 2); + /* S/PDIF hardware input 4 left channel */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x011e, 0x4001, &com_buff, 2); + /* S/PDIF hardware input 4 right channel */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x011f, 0x4001, &com_buff, 2); + /* S/PDIF software return 1 left channel */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0102, 0x4001, &com_buff, 2); + /* S/PDIF software return 1 right channel */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0103, 0x4001, &com_buff, 2); + /* S/PDIF software return 2 left channel */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0106, 0x4001, &com_buff, 2); + /* S/PDIF software return 2 right channel */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0107, 0x4001, &com_buff, 2); + + com_buff[0] = 0x00; + com_buff[1] = 0x00; + /* S/PDIF software return 3 left channel */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x010a, 0x4001, &com_buff, 2); + + com_buff[0] = 0x00; + com_buff[1] = 0x80; + /* S/PDIF software return 3 right channel */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x010b, 0x4001, &com_buff, 2); + /* S/PDIF software return 4 left channel */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x010e, 0x4001, &com_buff, 2); + + com_buff[0] = 0x00; + com_buff[1] = 0x00; + /* S/PDIF software return 4 right channel */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x010f, 0x4001, &com_buff, 2); + + com_buff[0] = 0x00; + com_buff[1] = 0x80; + /* S/PDIF fx returns left channel */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0122, 0x4001, &com_buff, 2); + /* S/PDIF fx returns right channel */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0123, 0x4001, &com_buff, 2); + + /* Set the dropdown "Effect" to the first option */ + /* Room1 = 0x00 */ + /* Room2 = 0x01 */ + /* Room3 = 0x02 */ + /* Hall 1 = 0x03 */ + /* Hall 2 = 0x04 */ + /* Plate = 0x05 */ + /* Delay = 0x06 */ + /* Echo = 0x07 */ + com_buff[0] = 0x00; + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0200, 0x4301, &com_buff, 1); /* max is 0xff */ + /* min is 0x00 */ + + + /* Set the effect duration to 0 */ + /* max is 0xffff */ + /* min is 0x0000 */ + com_buff[0] = 0x00; + com_buff[1] = 0x00; + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0400, 0x4301, &com_buff, 2); + + /* Set the effect volume and feedback to 0 */ + /* max is 0xff */ + /* min is 0x00 */ + com_buff[0] = 0x00; + /* feedback: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0500, 0x4301, &com_buff, 1); + /* volume: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0300, 0x4301, &com_buff, 1); + + /* Set soft button hold duration */ + /* 0x03 = 250ms */ + /* 0x05 = 500ms DEFAULT */ + /* 0x08 = 750ms */ + /* 0x0a = 1sec */ + com_buff[0] = 0x05; + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 3, 0x21, 0x0005, 0x2001, &com_buff, 1); + + /* Use dim LEDs for button of state */ + com_buff[0] = 0x00; + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 3, 0x21, 0x0004, 0x2001, &com_buff, 1); +} + +#define MBOX3_DESCRIPTOR_SIZE 464 + +static int snd_usb_mbox3_boot_quirk(struct usb_device *dev) +{ + struct usb_host_config *config = dev->actconfig; + int err; + int descriptor_size; + + descriptor_size = le16_to_cpu(get_cfg_desc(config)->wTotalLength); + + if (descriptor_size != MBOX3_DESCRIPTOR_SIZE) { + dev_err(&dev->dev, "Invalid descriptor size=%d.\n", descriptor_size); + return -ENODEV; + } + + dev_dbg(&dev->dev, "device initialised!\n"); + + err = usb_get_descriptor(dev, USB_DT_DEVICE, 0, + &dev->descriptor, sizeof(dev->descriptor)); + config = dev->actconfig; + if (err < 0) + dev_dbg(&dev->dev, "error usb_get_descriptor: %d\n", err); + + err = usb_reset_configuration(dev); + if (err < 0) + dev_dbg(&dev->dev, "error usb_reset_configuration: %d\n", err); + dev_dbg(&dev->dev, "mbox3_boot: new boot length = %d\n", + le16_to_cpu(get_cfg_desc(config)->wTotalLength)); + + mbox3_setup_48_24_magic(dev); + dev_info(&dev->dev, "Digidesign Mbox 3: 24bit 48kHz"); + + return 0; /* Successful boot */ +} #define MICROBOOK_BUF_SIZE 128 @@ -1324,6 +1622,10 @@ int snd_usb_apply_boot_quirk(struct usb_device *dev, case USB_ID(0x0dba, 0x3000): /* Digidesign Mbox 2 */ return snd_usb_mbox2_boot_quirk(dev); + case USB_ID(0x0dba, 0x5000): + /* Digidesign Mbox 3 */ + return snd_usb_mbox3_boot_quirk(dev); + case USB_ID(0x1235, 0x0010): /* Focusrite Novation Saffire 6 USB */ case USB_ID(0x1235, 0x0018): /* Focusrite Novation Twitch */ From patchwork Wed Oct 19 08:33: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: 4877 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225363wrs; Wed, 19 Oct 2022 02:42:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4hOLgBAFdfdDjH8Ye9R38siS8qsR0HrPJ3G6QQ/0vrzbZKmZbFi/cXLsqalIuBhb+ERDbm X-Received: by 2002:a05:6402:5191:b0:45c:dea0:2c7 with SMTP id q17-20020a056402519100b0045cdea002c7mr6441028edd.239.1666172579436; Wed, 19 Oct 2022 02:42:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172579; cv=none; d=google.com; s=arc-20160816; b=1DZw52AAKRSNrU1nPk7fyHbPoGA0MsMeEHuqLeaMSga6vUAIkUkcxJt/9oi6abc96H yjmjptzF0zLU2wSbmAFnmC358mBM5Tb8Qw07LOU3niwlmwbiQdx5FSSWmiyMC9zvgVkI 6pRWX8FrLGSaynGC7egWANYoY3/W1VOeekHodH3xJmdeoIrLm6e/LWG4BqiTOsMFPn5z iaJJE4C3sxDqY4fCHmS4ZkUODCdMS3Wp7KkrrilD/maQ/MWvPr+Aenql/CbugUNKi4oq TfYbzv/2WgRRW2KwKAjBRIduuwCSNmeE+q69edcT6M+/AnbKQJvE0EjunSFobK7yqXKD BA7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XBp/6Qeck/3GIwSMAQqqqmzOfe3TYLRh9WmIS0BGw8M=; b=Pnrto2moYjiibgHvu8djjSi6xElMbwReOlqGo/v3EpqCkOqRrUR/5KF4MWdNZCTmDh 2r9s4C+Jn1OkJB3mi9qnBj1lLbF/574XRQ/m7xe2wy0Z43FPX6vNYeB07dMVshSTsRiH DV1/xhtqH/AjSlbttPh+01NNjmZmgrgcI+m0AFfNLsJK5dQG/panxHFasXbf2qC1IlFT ezDqQAs1o2Df18yLGwOgFH2RlnhKfHOxf6P75BL2uoXYQvaumMDNrOenYGKt3aIwWVmw 2hc3B//JuymPwG6x0+IOyXKxT0f25qv2NRiLJeE5i5yuKy8UweK9daI/+dYHTciUeLP4 givQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1t+M6rie; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w13-20020a50fa8d000000b00459b0e0e04bsi12247738edr.199.2022.10.19.02.42.33; Wed, 19 Oct 2022 02:42: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=1t+M6rie; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230152AbiJSJbu (ORCPT + 99 others); Wed, 19 Oct 2022 05:31:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233631AbiJSJ2K (ORCPT ); Wed, 19 Oct 2022 05:28:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F3C0E8A88; Wed, 19 Oct 2022 02:12: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 44A8261889; Wed, 19 Oct 2022 09:10:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A631C433C1; Wed, 19 Oct 2022 09:10:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170655; bh=yxGkSTZYL1lOGJSNqH0ReJY84nBjcJY52M5+93fYZ7c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1t+M6rieGlgqNzMfkuAo2HC1GTFnX2QBRcgP09FPssHpVGSJFebjDxw1+5jTDbXP0 7FQ9kTYS/WLaCwHhbTD8hK3V/4ofe7ws/55BVganxyrUMTE9U2Ltkx7Mz/8X/8rnij OtEt5MmZlx3EQ4qy0b6AhHhuyQlQEUNMRi41l4wo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+c80e9ef5d8bb45894db0@syzkaller.appspotmail.com, Gerd Hoffmann , Vivek Kasireddy , Sasha Levin Subject: [PATCH 6.0 736/862] udmabuf: Set ubuf->sg = NULL if the creation of sg table fails Date: Wed, 19 Oct 2022 10:33:43 +0200 Message-Id: <20221019083322.474096571@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108578689311891?= X-GMAIL-MSGID: =?utf-8?q?1747108578689311891?= From: Vivek Kasireddy [ Upstream commit d9c04a1b7a15b5e74b2977461d9511e497f05d8f ] When userspace tries to map the dmabuf and if for some reason (e.g. OOM) the creation of the sg table fails, ubuf->sg needs to be set to NULL. Otherwise, when the userspace subsequently closes the dmabuf fd, we'd try to erroneously free the invalid sg table from release_udmabuf resulting in the following crash reported by syzbot: general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] PREEMPT SMP KASAN KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007] CPU: 0 PID: 3609 Comm: syz-executor487 Not tainted 5.19.0-syzkaller-13930-g7ebfc85e2cd7 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/22/2022 RIP: 0010:dma_unmap_sgtable include/linux/dma-mapping.h:378 [inline] RIP: 0010:put_sg_table drivers/dma-buf/udmabuf.c:89 [inline] RIP: 0010:release_udmabuf+0xcb/0x4f0 drivers/dma-buf/udmabuf.c:114 Code: 48 89 fa 48 c1 ea 03 80 3c 02 00 0f 85 2b 04 00 00 48 8d 7d 0c 4c 8b 63 30 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <0f> b6 14 02 48 89 f8 83 e0 07 83 c0 03 38 d0 7c 08 84 d2 0f 85 e2 RSP: 0018:ffffc900037efd30 EFLAGS: 00010246 RAX: dffffc0000000000 RBX: ffffffff8cb67800 RCX: 0000000000000000 RDX: 0000000000000000 RSI: ffffffff84ad27e0 RDI: 0000000000000000 RBP: fffffffffffffff4 R08: 0000000000000005 R09: 0000000000000000 R10: 0000000000000000 R11: 000000000008c07c R12: ffff88801fa05000 R13: ffff888073db07e8 R14: ffff888025c25440 R15: 0000000000000000 FS: 0000555555fc4300(0000) GS:ffff8880b9a00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fc1c0ce06e4 CR3: 00000000715e6000 CR4: 00000000003506f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: dma_buf_release+0x157/0x2d0 drivers/dma-buf/dma-buf.c:78 __dentry_kill+0x42b/0x640 fs/dcache.c:612 dentry_kill fs/dcache.c:733 [inline] dput+0x806/0xdb0 fs/dcache.c:913 __fput+0x39c/0x9d0 fs/file_table.c:333 task_work_run+0xdd/0x1a0 kernel/task_work.c:177 ptrace_notify+0x114/0x140 kernel/signal.c:2353 ptrace_report_syscall include/linux/ptrace.h:420 [inline] ptrace_report_syscall_exit include/linux/ptrace.h:482 [inline] syscall_exit_work kernel/entry/common.c:249 [inline] syscall_exit_to_user_mode_prepare+0x129/0x280 kernel/entry/common.c:276 __syscall_exit_to_user_mode_work kernel/entry/common.c:281 [inline] syscall_exit_to_user_mode+0x9/0x50 kernel/entry/common.c:294 do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7fc1c0c35b6b Code: 0f 05 48 3d 00 f0 ff ff 77 45 c3 0f 1f 40 00 48 83 ec 18 89 7c 24 0c e8 63 fc ff ff 8b 7c 24 0c 41 89 c0 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 35 44 89 c7 89 44 24 0c e8 a1 fc ff ff 8b 44 RSP: 002b:00007ffd78a06090 EFLAGS: 00000293 ORIG_RAX: 0000000000000003 RAX: 0000000000000000 RBX: 0000000000000007 RCX: 00007fc1c0c35b6b RDX: 0000000020000280 RSI: 0000000040086200 RDI: 0000000000000006 RBP: 0000000000000007 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000293 R12: 000000000000000c R13: 0000000000000003 R14: 00007fc1c0cfe4a0 R15: 00007ffd78a06140 Modules linked in: ---[ end trace 0000000000000000 ]--- RIP: 0010:dma_unmap_sgtable include/linux/dma-mapping.h:378 [inline] RIP: 0010:put_sg_table drivers/dma-buf/udmabuf.c:89 [inline] RIP: 0010:release_udmabuf+0xcb/0x4f0 drivers/dma-buf/udmabuf.c:114 Reported-by: syzbot+c80e9ef5d8bb45894db0@syzkaller.appspotmail.com Cc: Gerd Hoffmann Signed-off-by: Vivek Kasireddy Link: http://patchwork.freedesktop.org/patch/msgid/20220825063522.801264-1-vivek.kasireddy@intel.com Signed-off-by: Gerd Hoffmann Signed-off-by: Sasha Levin --- drivers/dma-buf/udmabuf.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c index 38e8767ec371..bf11d32205f3 100644 --- a/drivers/dma-buf/udmabuf.c +++ b/drivers/dma-buf/udmabuf.c @@ -124,17 +124,20 @@ static int begin_cpu_udmabuf(struct dma_buf *buf, { struct udmabuf *ubuf = buf->priv; struct device *dev = ubuf->device->this_device; + int ret = 0; if (!ubuf->sg) { ubuf->sg = get_sg_table(dev, buf, direction); - if (IS_ERR(ubuf->sg)) - return PTR_ERR(ubuf->sg); + if (IS_ERR(ubuf->sg)) { + ret = PTR_ERR(ubuf->sg); + ubuf->sg = NULL; + } } else { dma_sync_sg_for_cpu(dev, ubuf->sg->sgl, ubuf->sg->nents, direction); } - return 0; + return ret; } static int end_cpu_udmabuf(struct dma_buf *buf, From patchwork Wed Oct 19 08:33: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: 4885 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225369wrs; Wed, 19 Oct 2022 02:42:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6K/s+7kHnQu1Uke2V5atfhxwTxE6raAKHm3PV4FDmRJCM3yGEac2aSplNpN7jbwLw3uPAt X-Received: by 2002:a05:6402:1394:b0:456:97cd:e9d4 with SMTP id b20-20020a056402139400b0045697cde9d4mr6866715edv.174.1666172579437; Wed, 19 Oct 2022 02:42:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172579; cv=none; d=google.com; s=arc-20160816; b=BXWN/6ai1zJxj+71gkhOKv6gCA275OmiKmBw6T2WextPOfL9M+NNhC8zM3xGds7oLc psH+AZfVE1/naqKSHAjVzNvzreeydt+qUTT+xBzIY8qGajySFPZVvOOdRYy9X3pdjD+u O4ppu/m49BxVoS7VyiS1jJ6EdhId91j4duGNY6ryH4VNHJcmnweSShwuuMc8WwAnIDOC CNRtoO+7XSAevLJ0EcATvbSgNfzwagI0U1pp8gvXYu/boWdUQbiRL1GoAjR88FriOAq7 7O7F7E4HWlZ7w3qMsCp1zBMj2BX1PsTWxHTqPl36ggwzg6nE2UHrd7armUlOnTHHlfDG W8aQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qE0t9rO7V7EbPVXuzxbtutiptuaRCfpHq1mDUJsDtPI=; b=PembwKaWhHH3Mbq8HjFZaIM1m/XP8dgj4tjvtHx5af4TjPEiGiFrRgD2anz/OT1hyy fQvkp5AoPuSens6CjabyiTgwEI2s7Kljgq9XX9bpJgn67uWqXmacpFPyv5lwtizh0C6x KPfMz/pTV/CSsoF078ECpTFi0xVjg+kp72+0Cf/w+FmSm7LGwLf0Uz6lZOovXjSe0/x3 /kNjjrZGNnxVbzHlcv65I+X9GdNB9Wol26jr9nN8eLj8Xvv9TdqxpTZwDN6bKdcEUHfG W7xDnLAr1Y/BzIjDkC8wBJbY8l/9+5H1dfMiFrKL8xymLHChugpt2xuNUoPsIHuRWeaq 0BtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fBePdchY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qb4-20020a1709077e8400b0078b85fdf4e4si14571121ejc.532.2022.10.19.02.42.33; Wed, 19 Oct 2022 02:42: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=fBePdchY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233746AbiJSJb4 (ORCPT + 99 others); Wed, 19 Oct 2022 05:31:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229596AbiJSJ2X (ORCPT ); Wed, 19 Oct 2022 05:28:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E75A0E8A8F; Wed, 19 Oct 2022 02:12: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 D384561824; Wed, 19 Oct 2022 09:10:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6084C433D6; Wed, 19 Oct 2022 09:10:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170658; bh=T//Mq0MV/vPrzN/kQ3SK6QnEFdooxLJ2GbtjTJnDnIg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fBePdchYV/b/PeI4K4XnG7oxGKRFvIKZSutqii3q8Zoed/2DmzbuhezRbHU77yu+M 587HUr9O85ebxiw34JFHsUmh8uvVj3P/wV/OQ24yFOortiU4NoiWNr4+hyBpe0Ir07 xLr4fcvrGluZYnLiIr/7RMOOPnF7q0CsCXGsJkCI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Shevchenko , Hans de Goede , Sasha Levin Subject: [PATCH 6.0 737/862] platform/x86: pmc_atom: Improve quirk message to be less cryptic Date: Wed, 19 Oct 2022 10:33:44 +0200 Message-Id: <20221019083322.521820393@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108579011779858?= X-GMAIL-MSGID: =?utf-8?q?1747108579011779858?= From: Andy Shevchenko [ Upstream commit 32c9b75640aeb1b144f9e2963c1640f4cef7c6f2 ] Not everyone can get what "critclks" means in the message, improve it to make less cryptic. Signed-off-by: Andy Shevchenko Link: https://lore.kernel.org/r/20220801113734.36131-2-andriy.shevchenko@linux.intel.com Reviewed-by: Hans de Goede Signed-off-by: Hans de Goede Signed-off-by: Sasha Levin --- drivers/platform/x86/pmc_atom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/platform/x86/pmc_atom.c b/drivers/platform/x86/pmc_atom.c index 5c757c7f64de..f4046572a9fe 100644 --- a/drivers/platform/x86/pmc_atom.c +++ b/drivers/platform/x86/pmc_atom.c @@ -354,7 +354,7 @@ static bool pmc_clk_is_critical = true; static int dmi_callback(const struct dmi_system_id *d) { - pr_info("%s critclks quirk enabled\n", d->ident); + pr_info("%s: PMC critical clocks quirk enabled\n", d->ident); return 1; } From patchwork Wed Oct 19 08:33: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: 5154 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp253533wrs; Wed, 19 Oct 2022 03:57:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM78oSmaFpu954y/w96pd/KcrfCzupd4NYg6KIbVGlzkeDF4qkwwNIrVGGahp1dTR4UUkP// X-Received: by 2002:a17:902:900a:b0:178:77c7:aa28 with SMTP id a10-20020a170902900a00b0017877c7aa28mr7834015plp.3.1666177047233; Wed, 19 Oct 2022 03:57:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666177047; cv=none; d=google.com; s=arc-20160816; b=Um/E6lbw957MfoPniizzDmCSId822ivYf8MaLxW/Y7njcmK9yqL82pz7TEbgqbI369 U2AHgmUS7C+o5/NgssB+dtjqGrhIdqUX68XEi+YvYLxcYK6XxUVjMk1pAZegjY9+P1OD 33yojDn2WnsTDBGKejHeX6QiiuWZmrY/9l6za8oEoGnNAmpYq9ukyrZ3KrfqJ7B7sIxZ AhE0wQItubWQYfIIU2HapV9OfVIiW53Gs6pi3YfqwR4niyyE71cBeBFy3cnQJ0nI8AI8 9FYehQ2PMzjLZD/8553y22+jq3mBDFEx1CQjCxpvLYn470aArgWKfsya1SZdEug9YiiZ qYWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=T/YTsnZib1kMY0VYlHECbumaiPEs+Cj1UvlsH5zTMz8=; b=Ll8zge/d09FG3mnXqMtgKw+J0F7Q8l9UiWbHxXyAQXXuBuF/afh8t9nmqW7JEZ29PT lRWQpfDVjHNyU2qMCcFCG8S4MROGREuMDz8siTrEQ1K19aTPqpkBlnDt48d3b7gfG/x3 eg7bqULyslplYEanqnyDbkc9hIXxSJXOUo7/8uwzfwkqCjvOTARacHqr/GVE6D2eOUdJ +0bXCOKAW9R+Ep2L8/2ZDNOk9lOZQ/MgZv8dR9wLajEHPBMZK9giodY5Js0xWrVJ1xZr bTuxQKq5jitbh3zNzH7SSrK+e7AplZaJ8j5nLAYJCbNuXkWILwtAH/sxbn6B29vMQu7R f2lQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WIfNX64x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q4-20020a056a00088400b0053e757130c3si20212521pfj.378.2022.10.19.03.57.14; Wed, 19 Oct 2022 03:57:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WIfNX64x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234750AbiJSK4p (ORCPT + 99 others); Wed, 19 Oct 2022 06:56:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234643AbiJSK4H (ORCPT ); Wed, 19 Oct 2022 06:56:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E67E1DF39; Wed, 19 Oct 2022 03:27: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 1F72FB824C0; Wed, 19 Oct 2022 09:11:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83E79C433C1; Wed, 19 Oct 2022 09:11:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170660; bh=aNGCEolK+NBSlxH63pf5dpYKtguBt0WmtFibHave+zk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WIfNX64xA4LpwsAYX47F5cctsfN0knfsh2fvR2hiwBGhk9OoptSeLbWtNdaSTxBZr 0SpLPMzegt0itQNaWotKYWpTJ9b7MBrgCj/EczDGqaEhRL5mhCYP51AXrhPO46KbWr qXVrtBxjigVTaYPxRRhw6Yu2aKPJ8VGWku4PtmGU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bernard Zhao , Alex Deucher , Sasha Levin Subject: [PATCH 6.0 738/862] drm/amd: fix potential memory leak Date: Wed, 19 Oct 2022 10:33:45 +0200 Message-Id: <20221019083322.561013906@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747113263780813289?= X-GMAIL-MSGID: =?utf-8?q?1747113263780813289?= From: Bernard Zhao [ Upstream commit 6160216fd2c97107e8a9ab39863b056d677fcd85 ] This patch fix potential memory leak (clk_src) when function run into last return NULL. s/free/kfree/ - Alex Signed-off-by: Bernard Zhao Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c b/drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c index 3cd7c91655c5..6d721fadcbee 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c +++ b/drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c @@ -1720,6 +1720,7 @@ static struct clock_source *dcn30_clock_source_create( } BREAK_TO_DEBUGGER(); + kfree(clk_src); return NULL; } From patchwork Wed Oct 19 08:33: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: 5156 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp253557wrs; Wed, 19 Oct 2022 03:57:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM77u+x4Nb+X1ZBMtvBYIP2Auq2lHJE1gxDoisLnjB8MZP2TvGOj/dmT5FZCkF3EtcenpgpO X-Received: by 2002:a05:6a00:a21:b0:562:99d6:c30a with SMTP id p33-20020a056a000a2100b0056299d6c30amr7599368pfh.35.1666177041964; Wed, 19 Oct 2022 03:57:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666177041; cv=none; d=google.com; s=arc-20160816; b=pos7eFgyWFqzuO7BdrD8j0Ds9OdeNy8O0W+G72CA5k5o+iVdxrNZ/9R9DPPsw2vtPK o3x9CuxImHg4JUQRDxgW1kZtE9c1sKuq7o+3/6qQ418v3v9+WputDOq/0Czi2aKZdUpe EukksPC+9l7PvD+yFJTcf/V5oLIYcn+ggEh10OZfyJM8wT9VT2cUmz/9/qp5OcTXWz8Q DF9KxqWCERtIIQ3omcnbJd/N3UxraG4IgTEYDt7hiOzXwMnioOEuo5xWM4RmtXW55ABR RD9lDIUJVBNWKZnWAcS3LiCYdp3rgd1IPWqNgcdheA9lJAU6+ED0Vsn6AhgwJC4onWPm vC5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MY4f4wEYxhevpanzcS8gfaQD9wrITRBZZGPSEc7YP6k=; b=URVFUfHEH66F/S6+RyYQzvpT3MbPJ2WrtX11YBAlPZCG5L/cBUp58m9yEGG32EpBjZ vImZjANYvEFBxzYTBp8jOzEGOyp4iPUm1VqPTTbmZyE8uTO6saGvwc7ZNBmQYNdwRte0 4pv6MPQYYvENQJHq99WyGwy7NTs2o/hGCCoyYqhRxLiqnzQRTdicC766FJULDIKpHtg8 riQHcQYr1nvl+vMtaJA4jvm2PbwupOiNOTrnEYxurNrJvwp8HXX2bXj2jnhp5n8SgRvF 1d1FCGKY7E0iy/ps4isJpkRQ4LnD3agYM66g50xchhQMoUzBL+AE5O00r2E6f4XZ94Sx 1stQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1ucGnIti; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a28-20020a62d41c000000b0052edbdb0910si15945101pfh.128.2022.10.19.03.57.08; Wed, 19 Oct 2022 03:57:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1ucGnIti; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234727AbiJSK4h (ORCPT + 99 others); Wed, 19 Oct 2022 06:56:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234602AbiJSK4E (ORCPT ); Wed, 19 Oct 2022 06:56:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B8CA165514; Wed, 19 Oct 2022 03:27: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 AE27EB824BC; Wed, 19 Oct 2022 09:11:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28622C4314A; Wed, 19 Oct 2022 09:11:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170663; bh=wn1Qa7aWt3WxTNBuzagICTdOlbP3jJqAjckgAsaRIkE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1ucGnItiV9XBNeWRw23GvDVcw94mrF1o/70LYqGmr1kyXkBartZ6ZEbyy5USoT6aB gIJ9+Ldgu5YE5jm9cSZqPcujaye57pWYdavQ6r+93erT1JQvxDl9sWtOol++BX4Rx4 8rB8rBnVIDee7Yl5WkWsgf3rw4Cyv+lBTui4Gfag= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lucas Stach , Robert Foss , Sasha Levin , Neil Armstrong Subject: [PATCH 6.0 739/862] drm: bridge: dw_hdmi: only trigger hotplug event on link change Date: Wed, 19 Oct 2022 10:33:46 +0200 Message-Id: <20221019083322.612345116@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747113258118857656?= X-GMAIL-MSGID: =?utf-8?q?1747113258118857656?= From: Lucas Stach [ Upstream commit da09daf881082266e4075657fac53c7966de8e4d ] There are two events that signal a real change of the link state: HPD going high means the sink is newly connected or wants the source to re-read the EDID, RX sense going low is a indication that the link has been disconnected. Ignore the other two events that also trigger interrupts, but don't need immediate attention: HPD going low does not necessarily mean the link has been lost and should not trigger a immediate read of the status. RX sense going high also does not require a detect cycle, as HPD going high is the right point in time to read the EDID. Signed-off-by: Lucas Stach Reviewed-by: Neil Armstrong (v1) Reviewed-by: Robert Foss Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20220826185733.3213248-1-l.stach@pengutronix.de Signed-off-by: Sasha Levin --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index 25a60eb4d67c..40d8ca37f5bc 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -3096,6 +3096,7 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id) { struct dw_hdmi *hdmi = dev_id; u8 intr_stat, phy_int_pol, phy_pol_mask, phy_stat; + enum drm_connector_status status = connector_status_unknown; intr_stat = hdmi_readb(hdmi, HDMI_IH_PHY_STAT0); phy_int_pol = hdmi_readb(hdmi, HDMI_PHY_POL0); @@ -3134,13 +3135,15 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id) cec_notifier_phys_addr_invalidate(hdmi->cec_notifier); mutex_unlock(&hdmi->cec_notifier_mutex); } - } - if (intr_stat & HDMI_IH_PHY_STAT0_HPD) { - enum drm_connector_status status = phy_int_pol & HDMI_PHY_HPD - ? connector_status_connected - : connector_status_disconnected; + if (phy_stat & HDMI_PHY_HPD) + status = connector_status_connected; + + if (!(phy_stat & (HDMI_PHY_HPD | HDMI_PHY_RX_SENSE))) + status = connector_status_disconnected; + } + if (status != connector_status_unknown) { dev_dbg(hdmi->dev, "EVENT=%s\n", status == connector_status_connected ? "plugin" : "plugout"); From patchwork Wed Oct 19 08:33: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: 5157 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp253639wrs; Wed, 19 Oct 2022 03:57:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5r8h7D+jxJPmBK9l5VM2/I0UOSACgTexSugmHR0fJuNn87Cob8PdvBJd27isk5XwnbkyJR X-Received: by 2002:a05:6402:320e:b0:45c:ae50:dbca with SMTP id g14-20020a056402320e00b0045cae50dbcamr6905239eda.104.1666177067309; Wed, 19 Oct 2022 03:57:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666177067; cv=none; d=google.com; s=arc-20160816; b=mF1ZR30j9vzYCBoRZtAOZdYk/gXbowRJj+wj9v2hBXVPN0Iloa5+sIoXpftze8pPzy qfzC3tqLzbaOrAfiQulQseT/pvCyEZSOUSw/VEcB+bOqCv4zEykeqmIoO5GTckGYe3L1 BgZun85dIY4tWpeDa8Ehq0hDo1LNqfq3bJp67eKrkzEeCG1ZlyDvkDUwOgjO/RsXVR/1 XxubZmk+avSpOHMcdNmZ4SkO06MeDiWXW0IhSiPoCwwJIVMLsNAkldMH2s52x/aP+ZS/ 9VYR4PPGc5UxdzetKkjTGooGiN7G/BuZiSKNhxwDBAJXKcd4vNCGllwznxTlZoWA89JI DMNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=eZ5tWk8r58wmiNTJursBVehRVzi9Ftw3XX052CENwKw=; b=SuTwTP+4DlhDMHNEkBNCdiUo/4HmwMUkzvI/85RBTaM2g/h0sZnP9qYhO0mpO6f08I DmlBgDEZNHMVgZPM+gaP39RS0YppgxNa7lhDvC4AjQCZtgmnNJyXk7L3ENyaxAl+ksTY uOgYk75H/i5+VhgrUNKwNCBxXseZ5Yhp+ohGTR0oij1WtXdrdh5ryuSIf1ofBxiKpfMo m9m8sSYu16z7hCDWjhsrln2pLW0VZmDf3bhQV0eEcKXAIfWEWwFVn27OrKzXP6JquZRo xodYm7s7VZ07mS/gT4WEb9lUgc9f91OJyktaN1Dxm2fWPGL/rURUqRrkyqquUmlYVswt Jhrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qCprGu7B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j22-20020aa7c0d6000000b00457463dfc74si12078247edp.83.2022.10.19.03.57.23; Wed, 19 Oct 2022 03: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=qCprGu7B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234717AbiJSK5C (ORCPT + 99 others); Wed, 19 Oct 2022 06:57:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234677AbiJSK4J (ORCPT ); Wed, 19 Oct 2022 06:56: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 C942B76756; Wed, 19 Oct 2022 03:27: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 41D96B824C1; Wed, 19 Oct 2022 09:11:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2C18C433D7; Wed, 19 Oct 2022 09:11:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170666; bh=pP8jj1BLaAqsUYAH8uUEPMkH+VEo8jVb7LcvIKD0S1A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qCprGu7Ba2xwEjihypSobcR9TNEKpi8lspjLhQqW5xNj7ShbK5+2o1IxaKXQrb9ZZ MvJJ/soMtByPPiZa/YGucilwDQnUwoqEI/f3uJ2i7AA6B0ypJTR7MLXhqPw6QdSVRz 00CLQJQRCdo1F96LcUJXxYJYyXCOn3NGIrdYYDBs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Dan Carpenter , sunliming , Alex Deucher , Sasha Levin Subject: [PATCH 6.0 740/862] drm/amd/display: Fix variable dereferenced before check Date: Wed, 19 Oct 2022 10:33:47 +0200 Message-Id: <20221019083322.652970141@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747113284595138190?= X-GMAIL-MSGID: =?utf-8?q?1747113284595138190?= From: sunliming [ Upstream commit 45a92f45f4578ff89da7dc5ef50bab4ef870f3b7 ] Fixes the following smatch warning: drivers/gpu/drm/amd/amdgpu/../display/dc/dc_dmub_srv.c:311 dc_dmub_srv_p_state_delegate() warn: variable dereferenced before check 'dc' (see line 309) Reported-by: kernel test robot Reported-by: Dan Carpenter Signed-off-by: sunliming Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c b/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c index 76c05ff12e95..755c4f9de6da 100644 --- a/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c +++ b/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c @@ -323,11 +323,13 @@ bool dc_dmub_srv_p_state_delegate(struct dc *dc, bool should_manage_pstate, stru struct dmub_cmd_fw_assisted_mclk_switch_config *config_data = &cmd.fw_assisted_mclk_switch.config_data; int i = 0; int ramp_up_num_steps = 1; // TODO: Ramp is currently disabled. Reenable it. - uint8_t visual_confirm_enabled = dc->debug.visual_confirm == VISUAL_CONFIRM_FAMS; + uint8_t visual_confirm_enabled; if (dc == NULL) return false; + visual_confirm_enabled = dc->debug.visual_confirm == VISUAL_CONFIRM_FAMS; + // Format command. cmd.fw_assisted_mclk_switch.header.type = DMUB_CMD__FW_ASSISTED_MCLK_SWITCH; cmd.fw_assisted_mclk_switch.header.sub_type = DMUB_CMD__FAMS_SETUP_FW_CTRL; From patchwork Wed Oct 19 08:33:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5172 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp254643wrs; Wed, 19 Oct 2022 04:00:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM44XVF1qJpU8P7ZGGJFAYAMkM/E75B9iNTeBQCzK2GxzenOyk+kp2dajUGhsDkPorUWPtQo X-Received: by 2002:a17:90b:1e0d:b0:20d:7a3b:df5b with SMTP id pg13-20020a17090b1e0d00b0020d7a3bdf5bmr8850796pjb.189.1666177218758; Wed, 19 Oct 2022 04:00:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666177218; cv=none; d=google.com; s=arc-20160816; b=wvrXt8FSIO0UnputinUONkSCbcG8/yA6WasuVp4F8Q30IeqWn5EdhHO0FQSV9tc+7E KYPWiKqcskwRyNMJA3mX8HpyLSWYG9wGNiUYTw3owOFgKsBFgtq6XvCjzMUmOtFv0GY/ A8+F6AW1zfhvsTVFNoypoBqCGs87wOgJeSsJqBIz6cYVT1vGjTuYdLAlKsWkybXs0qzo EbrptBpRVrmmQyNVdhyZ+F7IJczjI5TufFqZXTHiwcxPJV/q9XRK+J0XJBeX09bRudZR XDjADOV/zIb9dwY11wEXkB76y2EgM2XRL5mGI2Ql38hPr51feWW55q61cv9Hd7j8qr1j uHlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fdEvwau9N/YbcB7d/XgephwtoRhttEd0AgCQlxrX2Q0=; b=F6K+lLvl+BQhojA12QyvH4cEv7d3bdtZ7RXmGO3akyQy7BJyqbDMC6R96zBGK2t6AC 1XiTXSGm5uq8YYxtVd9CJln6eTGKWVT2LdSFbTMN0Fgd1UxRNdQuyGaRcK4MRm9XYWty SSeQNoBHZRQ5LDF4MR36wbNr48G+rIBOfowMRMeqOJ676SbB7IsYu3w5DmtTYFzYPIjE BHPMmICs1QD9ohOWwE3sE5kHzYb/TqG2ChWuJC+nmEXxXNXk6ivHeoo47GDH0RROAfdr A5VJUFxRRFXL80C7XVBq3+hKwwo8fPEQawVatWEgMqPflT3GKsGvSxNfdabm2g9lIkB7 fD9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="wCDG/DCz"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y12-20020a170902700c00b0018273316ce0si17499428plk.511.2022.10.19.04.00.04; Wed, 19 Oct 2022 04:00: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="wCDG/DCz"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234753AbiJSK6k (ORCPT + 99 others); Wed, 19 Oct 2022 06:58:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234126AbiJSK4q (ORCPT ); Wed, 19 Oct 2022 06:56:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF791165510; Wed, 19 Oct 2022 03:27: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 06E74B824C3; Wed, 19 Oct 2022 09:11:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6416CC433D7; Wed, 19 Oct 2022 09:11:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170668; bh=D57F51nhXs+6rwTKvULIB5lh9K58TqPulJrZALO2lFY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wCDG/DCzII0YUg9RFOd5frXpgCFE0ioVMHXLm6eMS3uqSYaAojbZ8rcsxJkodMjWr 5WdRlVoCFC942JAOQDA8sABjeoFLyHvejrjLyWY2BW0gmDvo7txNn/moZvzvONnxmy ZeTuKJn3GG6e+/mXyeEfnXTrtjNvYgWJOYUfX1DI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Christian_K=C3=B6nig?= , Yifan Zha , Horace Chen , Hawking Zhang , Alex Deucher , Sasha Levin Subject: [PATCH 6.0 741/862] drm/amdgpu: Skip the program of MMMC_VM_AGP_* in SRIOV on MMHUB v3_0_0 Date: Wed, 19 Oct 2022 10:33:48 +0200 Message-Id: <20221019083322.695644152@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747113443630215501?= X-GMAIL-MSGID: =?utf-8?q?1747113443630215501?= From: Yifan Zha [ Upstream commit c1026c6f319724dc88fc08d9d9d35bcbdf492b42 ] [Why] VF should not program these registers, the value were defined in the host. [How] Skip writing them in SRIOV environment and program them on host side. Acked-by: Christian König Signed-off-by: Yifan Zha Signed-off-by: Horace Chen Reviewed-by: Hawking Zhang Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/mmhub_v3_0.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/mmhub_v3_0.c b/drivers/gpu/drm/amd/amdgpu/mmhub_v3_0.c index bc11b2de37ae..a1d26c4d80b8 100644 --- a/drivers/gpu/drm/amd/amdgpu/mmhub_v3_0.c +++ b/drivers/gpu/drm/amd/amdgpu/mmhub_v3_0.c @@ -169,17 +169,17 @@ static void mmhub_v3_0_init_system_aperture_regs(struct amdgpu_device *adev) uint64_t value; uint32_t tmp; - /* Disable AGP. */ - WREG32_SOC15(MMHUB, 0, regMMMC_VM_AGP_BASE, 0); - WREG32_SOC15(MMHUB, 0, regMMMC_VM_AGP_TOP, 0); - WREG32_SOC15(MMHUB, 0, regMMMC_VM_AGP_BOT, 0x00FFFFFF); - if (!amdgpu_sriov_vf(adev)) { /* * the new L1 policy will block SRIOV guest from writing * these regs, and they will be programed at host. * so skip programing these regs. */ + /* Disable AGP. */ + WREG32_SOC15(MMHUB, 0, regMMMC_VM_AGP_BASE, 0); + WREG32_SOC15(MMHUB, 0, regMMMC_VM_AGP_TOP, 0); + WREG32_SOC15(MMHUB, 0, regMMMC_VM_AGP_BOT, 0x00FFFFFF); + /* Program the system aperture low logical page number. */ WREG32_SOC15(MMHUB, 0, regMMMC_VM_SYSTEM_APERTURE_LOW_ADDR, adev->gmc.vram_start >> 18); From patchwork Wed Oct 19 08:33:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4878 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225378wrs; Wed, 19 Oct 2022 02:42:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4X2jiQCtokXD0i9te+R5QQL8ZOR2wXL4M0w4mnJ0LHsm/Zalf0yaATuct+iMdk5wbNbCr8 X-Received: by 2002:a05:6402:254d:b0:45d:3ed3:8aa9 with SMTP id l13-20020a056402254d00b0045d3ed38aa9mr6433042edb.157.1666172579753; Wed, 19 Oct 2022 02:42:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172579; cv=none; d=google.com; s=arc-20160816; b=rk3itp2Nofe0haGNhr/AC0bYiRCNqmPiSbASFtntzK6teDNyV+xmb71FoGDu50s5JK bt5wvZMJno2mf44YYJfgQeh5pAdPahQKSyQC7fGXRB/AfdEZCY+HTcHnKWG2EPLh6KRe qUw2DgJfJASiY+QqsEpGjMfCzDrsMLK6ooEWouXVt8xMPAPiZJl7s44lTj3NuUMS6wpq zdxrSEjX/lk79AdVF14ZXXiNa6qM3D4Sv3uldDzBwJQuxWgRpjjsVC6iPhLB03AA0Thb UsduoKSwrIDJ5JGHQNMIXZKMc2BLPH51iShvsumPOkma6dmqJeZ73fmMqpi1SfKZz8LP ZLRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=b/gssEaT72zinhV99eXUnvdx6oHKgFWsLcCEgSiK+o4=; b=kUq+/sgBEYO/TJeKcU0/1stM5kATufJLnSe1OEt+nB9NUhb16CVIUDhmSL0I9t0bgJ hu00izr+FvRcvtCdabX8CXtj04q0j3HZYMK8B7R1L7wKhGP4fPPcAMOLpOeUx1IxREJY PG0KI6NXCogxzTKnjTS350t8s6D/gQXsuLlTSBZ2dbB1U3nUBoVAtfu7YqsQea+seF2Z dLsDgWPok5CnsEI8w+ctWx7D0jYl9RieW3nPwwgb/qmsm4zckQl7rWjkZOJbY8BpazOk c2fti6+0OBtGf4neD+7ffXWcj7nJRDsg8DU7hbxDdRt3Lv/TCmgCKHnQ1fXFh/gmvv+f ahEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=j7EK8f8Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s3-20020a17090699c300b0078b6559a610si16311195ejn.12.2022.10.19.02.42.33; Wed, 19 Oct 2022 02:42: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=j7EK8f8Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233735AbiJSJcJ (ORCPT + 99 others); Wed, 19 Oct 2022 05:32:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233638AbiJSJ20 (ORCPT ); Wed, 19 Oct 2022 05:28:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3996FC4D98; Wed, 19 Oct 2022 02:12: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 D5B6F6188D; Wed, 19 Oct 2022 09:11:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6947C433D6; Wed, 19 Oct 2022 09:11:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170671; bh=ueAwCMAZ21Z3WumpFmAnkEqCVUSiHtJuAqmbEshjAq0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j7EK8f8YD90Ea4KR5GM1yU76c586mleuF9cUkcE55Rcpn6Ce8KJilowwauRx8C9ZC QAdQ7rUXL/qdn7Cqmn96fTnqYHyUg4nFXjHUCRcKQJmXtx3fW1mVjte2pUSGhjLpQj 4O6ceEWPbeHuZ50B5slBeKQ9DHdTnrjzYpQObWoI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Christian_K=C3=B6nig?= , Yifan Zha , Hawking Zhang , Alex Deucher , Sasha Levin Subject: [PATCH 6.0 742/862] drm/admgpu: Skip CG/PG on SOC21 under SRIOV VF Date: Wed, 19 Oct 2022 10:33:49 +0200 Message-Id: <20221019083322.734583373@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108578544535174?= X-GMAIL-MSGID: =?utf-8?q?1747108578544535174?= From: Yifan Zha [ Upstream commit 828418259254863e0af5805bd712284e2bd88e3b ] [Why] There is no CG(Clock Gating)/PG(Power Gating) requirement on SRIOV VF. For multi VF, VF should not enable any CG/PG features. For one VF, PF will program CG/PG related registers. [How] Do not set any cg/pg flag bit at early init under sriov. Acked-by: Christian König Signed-off-by: Yifan Zha Reviewed-by: Hawking Zhang Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/soc21.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/soc21.c b/drivers/gpu/drm/amd/amdgpu/soc21.c index 276ff6709881..9c3463b48139 100644 --- a/drivers/gpu/drm/amd/amdgpu/soc21.c +++ b/drivers/gpu/drm/amd/amdgpu/soc21.c @@ -583,6 +583,10 @@ static int soc21_common_early_init(void *handle) AMD_PG_SUPPORT_JPEG | AMD_PG_SUPPORT_ATHUB | AMD_PG_SUPPORT_MMHUB; + if (amdgpu_sriov_vf(adev)) { + adev->cg_flags = 0; + adev->pg_flags = 0; + } adev->external_rev_id = adev->rev_id + 0x1; // TODO: need update break; case IP_VERSION(11, 0, 2): From patchwork Wed Oct 19 08:33: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: 4902 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225574wrs; Wed, 19 Oct 2022 02:43:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Iz0Thfo3KKNg+5AjclactYOmqlFl3rVdZh4qUcC8U2PybN4KykB03r6CsAGUx1JT2O+Ai X-Received: by 2002:a17:907:2c44:b0:78d:4e67:ca5d with SMTP id hf4-20020a1709072c4400b0078d4e67ca5dmr5921346ejc.397.1666172606975; Wed, 19 Oct 2022 02:43:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172606; cv=none; d=google.com; s=arc-20160816; b=xJuNgmgEqPgVyYWmpjR/+eH9mUgCnSPFEzJS3v7gp6GxRkN07cPyFADiUeU1xUa5Js 8YEDJ3rBbSabezyelK4P16O1bTZL4neZxQLoiXdGPlBEANc1I8RT17ODkn+wYIqTPuht lhMRzmYEVo+k5lYBMzrDGLZQ8i5Njyj8L/dhbWTw+5QNmL6LBEC+qoG4ebbhhc5rWNgO FMJE/ZKco7d8h5BUHxfemrZ+4Dpe2Zt6SJG5NoFuNS/jaHOw1nNcEI3SplO66wfD50eB F/a2Ll5Je7OfV3HzC76F7zRao3kzBdSs5ODiF/d082nQ6eA1sRut1Uyw0w6ZZ9r2Zkea U30A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FdTEVCMsGDi3mhw+aiDP9E7Dp4+CQnghzQP2ePAd/sQ=; b=ytaO5427EUEYEwKUl+l5abrCVpF7V4/qbgMpEYa+m+MMQYuM4TopiHBibwNoNNqleO 0Vr18NP+0KEXzTzU4MTCIDgAIQfAy8gKKs2OtQLkGbtvKVD2T1Q0EcSr7AkRW+I7zFQ1 Qy0LVDFadH6nuyYYbvqb4oJFswU8APcGtOo6wLKZ89GJvWkvwZEwjQJE18Akt+ZtMyEZ ycgTg77UYRwz8xP1wcfoEm2EMviFOTc/nn42Bnu5pXE0x4mG48SusepIAOKPt6bIYllm ekRy+GtdtmLxNwJG+CKV+7H8P+/0ToN3uc0GrLKmXM8Y4O87cEn4JC0ie5DNeU+Od/h8 PT/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=h9Tr9epy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cw10-20020a170906478a00b007314b427e96si16698611ejc.633.2022.10.19.02.43.01; Wed, 19 Oct 2022 02:43: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=h9Tr9epy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231547AbiJSJfo (ORCPT + 99 others); Wed, 19 Oct 2022 05:35:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233867AbiJSJ3m (ORCPT ); Wed, 19 Oct 2022 05:29:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF13CC6969; Wed, 19 Oct 2022 02:13:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DB0856170D; Wed, 19 Oct 2022 09:13:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF8E7C433C1; Wed, 19 Oct 2022 09:13:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170790; bh=y/af1kOedKL50XzNHwF0O2BQbzKhSZO65VVLNKv40Ss=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h9Tr9epysyYdzW9FKQAIXiNFdPbfzlZ6p8SIojiGY42NSxIvrqwKRfkrouoWAKSca QMAe25kAsSTNSRUD8ekPzT5svDNogk8zFEpex/mHZ1f+qcRUVRc1oE28DKmpN/b4nl XJbSy+tEAffh6XEZ0pSvLSpsjgGzHwMWYyGdpPY0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai , Sasha Levin Subject: [PATCH 6.0 743/862] ALSA: usb-audio: Register card at the last interface Date: Wed, 19 Oct 2022 10:33:50 +0200 Message-Id: <20221019083322.779453049@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108607334135761?= X-GMAIL-MSGID: =?utf-8?q?1747108607334135761?= From: Takashi Iwai [ Upstream commit 6392dcd1d0c7034ccf630ec55fc9e5810ecadf3b ] The USB-audio driver matches per interface, and as default, it registers the card instance at the very first instance. This can be a problem for the devices that have multiple interfaces to be probed, as the udev rule isn't applied properly for the later appearing interfaces. Although we introduced the delayed_register option and the quirks for covering those shortcomings, it's nothing but a workaround for specific devices. This patch is an another attempt to fix the problem in a more generic way. Now the driver checks the whole USB device descriptor at the very first time when an interface is attached to a sound card. It looks at each matching interface in the descriptor and remembers the last matching one. The snd_card_register() is invoked only when this last interface is probed. After this change, the quirks for the delayed registration become superfluous, hence they are removed along with the patch. OTOH, the delayed_register option is still kept, as it might be useful for some corner cases (e.g. a special driver overtakes the interface probe from the standard driver, and the last interface probe may miss). Link: https://lore.kernel.org/r/20220904161247.16461-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/usb/card.c | 32 +++++++++++++++++++++++++------- sound/usb/quirks.c | 42 ------------------------------------------ sound/usb/quirks.h | 2 -- sound/usb/usbaudio.h | 1 + 4 files changed, 26 insertions(+), 51 deletions(-) diff --git a/sound/usb/card.c b/sound/usb/card.c index 706d249a9ad6..3aea241435fb 100644 --- a/sound/usb/card.c +++ b/sound/usb/card.c @@ -690,7 +690,7 @@ static bool get_alias_id(struct usb_device *dev, unsigned int *id) return false; } -static bool check_delayed_register_option(struct snd_usb_audio *chip, int iface) +static int check_delayed_register_option(struct snd_usb_audio *chip) { int i; unsigned int id, inum; @@ -699,14 +699,31 @@ static bool check_delayed_register_option(struct snd_usb_audio *chip, int iface) if (delayed_register[i] && sscanf(delayed_register[i], "%x:%x", &id, &inum) == 2 && id == chip->usb_id) - return iface < inum; + return inum; } - return false; + return -1; } static const struct usb_device_id usb_audio_ids[]; /* defined below */ +/* look for the last interface that matches with our ids and remember it */ +static void find_last_interface(struct snd_usb_audio *chip) +{ + struct usb_host_config *config = chip->dev->actconfig; + struct usb_interface *intf; + int i; + + if (!config) + return; + for (i = 0; i < config->desc.bNumInterfaces; i++) { + intf = config->interface[i]; + if (usb_match_id(intf, usb_audio_ids)) + chip->last_iface = intf->altsetting[0].desc.bInterfaceNumber; + } + usb_audio_dbg(chip, "Found last interface = %d\n", chip->last_iface); +} + /* look for the corresponding quirk */ static const struct snd_usb_audio_quirk * get_alias_quirk(struct usb_device *dev, unsigned int id) @@ -813,6 +830,7 @@ static int usb_audio_probe(struct usb_interface *intf, err = -ENODEV; goto __error; } + find_last_interface(chip); } if (chip->num_interfaces >= MAX_CARD_INTERFACES) { @@ -862,11 +880,11 @@ static int usb_audio_probe(struct usb_interface *intf, chip->need_delayed_register = false; /* clear again */ } - /* we are allowed to call snd_card_register() many times, but first - * check to see if a device needs to skip it or do anything special + /* register card if we reach to the last interface or to the specified + * one given via option */ - if (!snd_usb_registration_quirk(chip, ifnum) && - !check_delayed_register_option(chip, ifnum)) { + if (check_delayed_register_option(chip) == ifnum || + chip->last_iface == ifnum) { err = snd_card_register(chip->card); if (err < 0) goto __error; diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index 194c75c45628..eadac586bcc8 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c @@ -2030,48 +2030,6 @@ void snd_usb_audioformat_attributes_quirk(struct snd_usb_audio *chip, } } -/* - * registration quirk: - * the registration is skipped if a device matches with the given ID, - * unless the interface reaches to the defined one. This is for delaying - * the registration until the last known interface, so that the card and - * devices appear at the same time. - */ - -struct registration_quirk { - unsigned int usb_id; /* composed via USB_ID() */ - unsigned int interface; /* the interface to trigger register */ -}; - -#define REG_QUIRK_ENTRY(vendor, product, iface) \ - { .usb_id = USB_ID(vendor, product), .interface = (iface) } - -static const struct registration_quirk registration_quirks[] = { - REG_QUIRK_ENTRY(0x0951, 0x16d8, 2), /* Kingston HyperX AMP */ - REG_QUIRK_ENTRY(0x0951, 0x16ed, 2), /* Kingston HyperX Cloud Alpha S */ - REG_QUIRK_ENTRY(0x0951, 0x16ea, 2), /* Kingston HyperX Cloud Flight S */ - REG_QUIRK_ENTRY(0x0ecb, 0x1f46, 2), /* JBL Quantum 600 */ - REG_QUIRK_ENTRY(0x0ecb, 0x1f47, 2), /* JBL Quantum 800 */ - REG_QUIRK_ENTRY(0x0ecb, 0x1f4c, 2), /* JBL Quantum 400 */ - REG_QUIRK_ENTRY(0x0ecb, 0x2039, 2), /* JBL Quantum 400 */ - REG_QUIRK_ENTRY(0x0ecb, 0x203c, 2), /* JBL Quantum 600 */ - REG_QUIRK_ENTRY(0x0ecb, 0x203e, 2), /* JBL Quantum 800 */ - { 0 } /* terminator */ -}; - -/* return true if skipping registration */ -bool snd_usb_registration_quirk(struct snd_usb_audio *chip, int iface) -{ - const struct registration_quirk *q; - - for (q = registration_quirks; q->usb_id; q++) - if (chip->usb_id == q->usb_id) - return iface < q->interface; - - /* Register as normal */ - return false; -} - /* * driver behavior quirk flags */ diff --git a/sound/usb/quirks.h b/sound/usb/quirks.h index 31abb7cb01a5..f9bfd5ac7bab 100644 --- a/sound/usb/quirks.h +++ b/sound/usb/quirks.h @@ -48,8 +48,6 @@ void snd_usb_audioformat_attributes_quirk(struct snd_usb_audio *chip, struct audioformat *fp, int stream); -bool snd_usb_registration_quirk(struct snd_usb_audio *chip, int iface); - void snd_usb_init_quirk_flags(struct snd_usb_audio *chip); #endif /* __USBAUDIO_QUIRKS_H */ diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h index ffbb4b0d09a0..2c6575029b1c 100644 --- a/sound/usb/usbaudio.h +++ b/sound/usb/usbaudio.h @@ -37,6 +37,7 @@ struct snd_usb_audio { unsigned int quirk_flags; unsigned int need_delayed_register:1; /* warn for delayed registration */ int num_interfaces; + int last_iface; int num_suspended_intf; int sample_rate_read_error; From patchwork Wed Oct 19 08:33:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5143 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp252937wrs; Wed, 19 Oct 2022 03:56:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM58x/LmZfYUzA/3AVjVL4f4AWgX1Xbt2AVzM9Cev76JcAvPAGCwhw9CM1zwcxuYOb4/Ukbh X-Received: by 2002:a17:907:3f26:b0:78d:9c30:4529 with SMTP id hq38-20020a1709073f2600b0078d9c304529mr6163446ejc.195.1666176965865; Wed, 19 Oct 2022 03:56:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176965; cv=none; d=google.com; s=arc-20160816; b=VL6qnTptIR7dtjU+iv8b6oTTsHki4DJMenIQZ3L8Sa+/4V054uhiIUPtPGSXXZh3t8 Hc8ze5s5bReqesKFr8SxQxZlE9COqLdskO7QrjSeGCFEDYWDzcBRU80oxC0XNrFGJvsz m2WQTP2uhpnWCIT4s8sOPy7KFmdFVHYsN1iZzo/+GHdYc4ZpCA6+4+d/WBnmwmgu7Ai/ +iZSsCqCpJlJ+WxGwN8RAPaL4iW+TYnf2R9KqEcvqFC4jbCskqssGjrbenzah1R/hluG +VysMEfB9P7KvOdp7Y9rzTZzug93+C4ADKengcvrWJ0z1eWZ2JbVatDVf6KSGzuCeBs1 vRKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=eK8pLtymwl12CRJdMtE2GMNvtXxO+HwsPAQcgMQaXfY=; b=jlVU4Yh0/C0/FhhTchjiEM6lW+SYJQj915ow86RmzcyzPTDivrkPIxhxmSoHFYPz2c hBqpX6bDqaaFYjTvJZKW4i6nAdvcUozPqywKHvvXla96CbovXpO487078w19x61xwbWc d4UAbOoViJrrLUP6VIwvyN29mM7R93GJgH6bOsGM0Usw/UQvNdh6jqb+QktixXpv4Hm/ 2qa8lYlWjsptNFmdsEaSxtMEa38JXJKgYSgFFbhKJwB9onyIeNJC0jKKv6WxSe8C6S5V 9bWlsb71w3203EKZKmZWgH/JoE4yzVwwupxWfifVB2fSB0P0W7CH4WrJFHzCfSQNJnK2 mLFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=j2MBILij; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u26-20020a056402065a00b004514cd5ec24si12890622edx.630.2022.10.19.03.55.38; Wed, 19 Oct 2022 03:56: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=j2MBILij; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234629AbiJSKw7 (ORCPT + 99 others); Wed, 19 Oct 2022 06:52:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234546AbiJSKw2 (ORCPT ); Wed, 19 Oct 2022 06:52: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 0D3A3D01BF; Wed, 19 Oct 2022 03:23: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 BA211B824C9; Wed, 19 Oct 2022 09:11:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20BE6C433D6; Wed, 19 Oct 2022 09:11:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170693; bh=scH4qEzCtXeEEbH+HVY3DscdNarNOhCopKbgKjvj6Pc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j2MBILijfGM6ubu0ORyAm0A33Ygj/lv1Yn2iWySFmPyuAUG6+XaXFv8OHLVi482hV xdVuwTgtfH5xlNsQxmTs9q1JWkZXnWKI+MGNh1KTFc8cwaZfL8jCGwnoSI1JJMLcph mG9fbSlPRaE7fyxu2EZO0Rq22UAkBgZFI4GRJ9Wk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mateusz Kwiatkowski , =?utf-8?q?Noralf_Tr?= =?utf-8?q?=C3=B8nnes?= , Maxime Ripard , Sasha Levin Subject: [PATCH 6.0 744/862] drm/vc4: vec: Fix timings for VEC modes Date: Wed, 19 Oct 2022 10:33:51 +0200 Message-Id: <20221019083322.817861500@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747113178173764431?= X-GMAIL-MSGID: =?utf-8?q?1747113178173764431?= From: Mateusz Kwiatkowski [ Upstream commit 30d7565be96b3946c18a1ce3fd538f7946839092 ] This commit fixes vertical timings of the VEC (composite output) modes to accurately represent the 525-line ("NTSC") and 625-line ("PAL") ITU-R standards. Previous timings were actually defined as 502 and 601 lines, resulting in non-standard 62.69 Hz and 52 Hz signals being generated, respectively. Signed-off-by: Mateusz Kwiatkowski Acked-by: Noralf Trønnes Signed-off-by: Maxime Ripard Link: https://patchwork.freedesktop.org/patch/msgid/20220728-rpi-analog-tv-properties-v2-28-459522d653a7@cerno.tech Signed-off-by: Sasha Levin --- drivers/gpu/drm/vc4/vc4_vec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_vec.c b/drivers/gpu/drm/vc4/vc4_vec.c index 11fc3d6f66b1..4e2250b8fa23 100644 --- a/drivers/gpu/drm/vc4/vc4_vec.c +++ b/drivers/gpu/drm/vc4/vc4_vec.c @@ -256,7 +256,7 @@ static void vc4_vec_ntsc_j_mode_set(struct vc4_vec *vec) static const struct drm_display_mode ntsc_mode = { DRM_MODE("720x480", DRM_MODE_TYPE_DRIVER, 13500, 720, 720 + 14, 720 + 14 + 64, 720 + 14 + 64 + 60, 0, - 480, 480 + 3, 480 + 3 + 3, 480 + 3 + 3 + 16, 0, + 480, 480 + 7, 480 + 7 + 6, 525, 0, DRM_MODE_FLAG_INTERLACE) }; @@ -278,7 +278,7 @@ static void vc4_vec_pal_m_mode_set(struct vc4_vec *vec) static const struct drm_display_mode pal_mode = { DRM_MODE("720x576", DRM_MODE_TYPE_DRIVER, 13500, 720, 720 + 20, 720 + 20 + 64, 720 + 20 + 64 + 60, 0, - 576, 576 + 2, 576 + 2 + 3, 576 + 2 + 3 + 20, 0, + 576, 576 + 4, 576 + 4 + 6, 625, 0, DRM_MODE_FLAG_INTERLACE) }; From patchwork Wed Oct 19 08:33: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: 5208 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp264650wrs; Wed, 19 Oct 2022 04:20:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4fhvI5L9nBlVF1Nvt10pFSCBfZaZIbEOsDtv5WvXGUQPuSqjPX7z0qiFJgsYVtzEsk2jmu X-Received: by 2002:a17:902:7281:b0:178:388d:6f50 with SMTP id d1-20020a170902728100b00178388d6f50mr8138129pll.127.1666178436649; Wed, 19 Oct 2022 04:20:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178436; cv=none; d=google.com; s=arc-20160816; b=eO8t015AshlMofZJgxdzJUptV75YNrZ8fqym8uj2csHWWCEVsv+IoKBFgDSsT8g8Xz DOIDH6fnKD6eMZk/Rer3b2rfC6fRiKyQLdqR35EOwMih2yzT7oE08shzo4uRnaQ9WeMo wbiOPR84QLugRHcZraRQR1k7v0xr6zYUwkbOnc7BtkuTKA44mmghq3irY8GGyoc3QOxT gxRIqM9l+baM8pcuckLXaZ44fA5a/ZfpCyBc8m4mWqtboNFZLWQ3wU2JXTbIJh+W7ycQ 4BnGzZSxxk6FgOYvic+PuDcsuZ+mHDRUQDbjntjWgi2hX3uPLvRYkMbFDKCD3Vm/jq+q pjjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Wxud0WBR8xdYjZOVPDe9zRdzHMRU1+WNqZl/wUSEJJU=; b=udasaHJFXN3orm1U1Bc3opzlPd9y8JUtXK4U4X4PoNNlulcrCO0k36E92D8BmrQbn9 ZplTpCiRi8VB35feoClvT2qzMj510eSKcTq6rzoxe1uKR61RcrdF4Wi+Y6bvfQGtQGLH h3/QQSxJY92ZZfTTFNS2x6/VHgXj14xOkz0DvMPyzCJcBMhVlE3O4wqyN9fepI8K+G1G 7ZT7naky8uAoe8PCFuHDDGooG7OXTCfgJMH4APIeyevvBvvPHeIOT2URys/20UxJ9Bnm 9U8FwPWCb1wqt92hgoJJFQbWzNrPc8d1AIyJ+X8+9BjNtfJWmVEJj2yL9A6tWltstsnA xbdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Y5NfI/HT"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lr1-20020a17090b4b8100b002034e5450f0si26925324pjb.131.2022.10.19.04.20.20; Wed, 19 Oct 2022 04:20: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="Y5NfI/HT"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233224AbiJSLKX (ORCPT + 99 others); Wed, 19 Oct 2022 07:10:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234665AbiJSLJH (ORCPT ); Wed, 19 Oct 2022 07:09:07 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD17517FD73; Wed, 19 Oct 2022 03:37: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 sin.source.kernel.org (Postfix) with ESMTPS id 735E5CE21C3; Wed, 19 Oct 2022 09:12:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 972CAC433D6; Wed, 19 Oct 2022 09:12:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170721; bh=q1chyhTIU7/d/UsHn4fDC9XzScQs2LA1hTV5YSEKLN4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y5NfI/HTFX/7hAosbnrcQ5uAmcLQhPDoQEFT6OfzyLdnsvS0eZASQB+hq+k5+P0fa bSzUzq5SpxG+ANVW+1LbDMpxDowrlfurUWb8kLCUDQPKmKymz4iZnf14aMpIPhBS0z Cr4jTBcSZ6e6rRTPij1/YS66Ve4Mau/3zSpZnjH4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maya Matuszczyk , Hans de Goede , Sasha Levin Subject: [PATCH 6.0 745/862] drm: panel-orientation-quirks: Add quirk for Anbernic Win600 Date: Wed, 19 Oct 2022 10:33:52 +0200 Message-Id: <20221019083322.860092589@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114720632730409?= X-GMAIL-MSGID: =?utf-8?q?1747114720632730409?= From: Maya Matuszczyk [ Upstream commit 770e19076065e079a32f33eb11be2057c87f1cde ] This device is another x86 gaming handheld, and as (hopefully) there is only one set of DMI IDs it's using DMI_EXACT_MATCH Signed-off-by: Maya Matuszczyk Reviewed-by: Hans de Goede Signed-off-by: Hans de Goede Link: https://patchwork.freedesktop.org/patch/msgid/20220803182402.1217293-1-maccraft123mc@gmail.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/drm_panel_orientation_quirks.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/drm/drm_panel_orientation_quirks.c b/drivers/gpu/drm/drm_panel_orientation_quirks.c index fc1728d46ac2..64b194af003c 100644 --- a/drivers/gpu/drm/drm_panel_orientation_quirks.c +++ b/drivers/gpu/drm/drm_panel_orientation_quirks.c @@ -128,6 +128,12 @@ static const struct dmi_system_id orientation_data[] = { DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "One S1003"), }, .driver_data = (void *)&lcd800x1280_rightside_up, + }, { /* Anbernic Win600 */ + .matches = { + DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Anbernic"), + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Win600"), + }, + .driver_data = (void *)&lcd720x1280_rightside_up, }, { /* Asus T100HA */ .matches = { DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), From patchwork Wed Oct 19 08:33: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: 4881 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225399wrs; Wed, 19 Oct 2022 02:43:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM62NhOoKUmag1XmwV/yhGyDYzwWYlICfrNn/ayOChSvSzrI/82GoF2git85R5hMyD6zMAXe X-Received: by 2002:a17:907:31c9:b0:740:ef93:2ffd with SMTP id xf9-20020a17090731c900b00740ef932ffdmr5977196ejb.584.1666172583214; Wed, 19 Oct 2022 02:43:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172583; cv=none; d=google.com; s=arc-20160816; b=oPPHIMNhP3AwrWNY25qJl2ULDXeFslXEDuRe+WJaHyx+7KJ2XvCk2Y9lD2DK/gpkFx iwkUOaXP5rDq+cgjoce/73W+WOPBj/VFl58BXm+Qbd46ZBgzi8UI5JC/FSnk3IFalIka CFwPCj8pTVAo10wkcXbEYzfQfwXOn7WVrRHnB/Ya5bsF7PGLmGJ1zGRp6z1Fn6wlWBmB u63pvr3o6SZwryP1yFsc/DhviuLxwfNQ5ZEIfzEP+BeCnrFIYXkyt3TopDRTUJItd/J5 FVAhQbmj2Fm/me7/8SSX4v8ImljKreETDWQXCdatV6Jo6yO8l1Y+sR/X0C4GT5wWDBbo axXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=APtJls/JpVBlxt3OaB9SPFJlvz4r9PaZm3Cih8CgPUc=; b=r4JGJWFteYrQTpo+5d/MwgEeQ2SAVLL0gNNvMlTwVEHTFBsVzkL4Ct2KithV7VNT3w 9W74IYEzNzPVEZAJHNwiP5ujI8vCviVF6jDk6J7RSW8+M+H+RE8qG6XIqhYmOH/+6mnq B72u4/uEjISeEcU0rlEtO+t6VV9frUpstopgbQQuvTnWqDUXfbVjXevkIlIbe5+OCx5C 6fFgBy6CjD0N12+Bj29Mdfo/TkycN/BRJybmHepJ7HGH3E9aY0ULF2v+X09a/7H2nm2R w4OvQgQAZ1jITTGTi9RiOw0l/rS7DVlnongKvoVIdnZRnMQB5qOr7JA+jCcJmEvcA5yY Uo1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hB3tRo0e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lt4-20020a170906fa8400b0078d8b6976eesi11809129ejb.140.2022.10.19.02.42.38; Wed, 19 Oct 2022 02:43: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=hB3tRo0e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233574AbiJSJc5 (ORCPT + 99 others); Wed, 19 Oct 2022 05:32:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233681AbiJSJ3C (ORCPT ); Wed, 19 Oct 2022 05:29:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A619EA349; Wed, 19 Oct 2022 02:12: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 3512B61807; Wed, 19 Oct 2022 09:12:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 188F9C433D7; Wed, 19 Oct 2022 09:12:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170751; bh=jeM9Fj147OpUgh5L3U33TX8WpT72OBGDIxBglNY+h/M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hB3tRo0eh88UM3wgJufxtjTfBuz6e2wdnVwcFGB4jTVmi+n8l0mcN/pCEE+vS9LPJ Txbh3rTwc6u04LYGWcFzQjV8kh5JraNiArriQ9hiTa1O0pqDbCACVA6lzNRm3Ewh/X ijKOH0LJCT3r5zS72URltCJaqkEmNhuvcuWT0VzQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maya Matuszczyk , Hans de Goede , Sasha Levin Subject: [PATCH 6.0 746/862] drm: panel-orientation-quirks: Add quirk for Aya Neo Air Date: Wed, 19 Oct 2022 10:33:53 +0200 Message-Id: <20221019083322.900923435@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108582366228813?= X-GMAIL-MSGID: =?utf-8?q?1747108582366228813?= From: Maya Matuszczyk [ Upstream commit e10ea7b9b90219da305a16b3c1252169715a807b ] Yet another x86 gaming handheld. This one has many SKUs with quite a few of DMI strings, so let's just use a catchall, just as with Aya Neo Next. Signed-off-by: Maya Matuszczyk Signed-off-by: Hans de Goede Link: https://patchwork.freedesktop.org/patch/msgid/20220825191946.1678798-1-maccraft123mc@gmail.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/drm_panel_orientation_quirks.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/gpu/drm/drm_panel_orientation_quirks.c b/drivers/gpu/drm/drm_panel_orientation_quirks.c index 64b194af003c..8a0c0e0bb5bd 100644 --- a/drivers/gpu/drm/drm_panel_orientation_quirks.c +++ b/drivers/gpu/drm/drm_panel_orientation_quirks.c @@ -103,6 +103,12 @@ static const struct drm_dmi_panel_orientation_data lcd800x1280_rightside_up = { .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP, }; +static const struct drm_dmi_panel_orientation_data lcd1080x1920_leftside_up = { + .width = 1080, + .height = 1920, + .orientation = DRM_MODE_PANEL_ORIENTATION_LEFT_UP, +}; + static const struct drm_dmi_panel_orientation_data lcd1200x1920_rightside_up = { .width = 1200, .height = 1920, @@ -158,6 +164,12 @@ static const struct dmi_system_id orientation_data[] = { DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "AYA NEO 2021"), }, .driver_data = (void *)&lcd800x1280_rightside_up, + }, { /* AYA NEO AIR */ + .matches = { + DMI_EXACT_MATCH(DMI_SYS_VENDOR, "AYANEO"), + DMI_MATCH(DMI_BOARD_NAME, "AIR"), + }, + .driver_data = (void *)&lcd1080x1920_leftside_up, }, { /* AYA NEO NEXT */ .matches = { DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "AYANEO"), From patchwork Wed Oct 19 08:33: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: 5283 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp280904wrs; Wed, 19 Oct 2022 05:01:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4BRkmoZKQqe8wOkCPp584hDvhoWD2zKYPVs42Pdb8TTQUO6shiH8+D4I/8CCE3qSX1TGE+ X-Received: by 2002:a05:6402:2712:b0:45d:de37:f828 with SMTP id y18-20020a056402271200b0045dde37f828mr6596073edd.317.1666180885378; Wed, 19 Oct 2022 05:01:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666180885; cv=none; d=google.com; s=arc-20160816; b=ZbH/cdzfG+dtiMVYe8yzuCWaKpYqIa0SJqcVB64BGoS8Rix6/WSVXVi4fTj2IGqgd5 MFq66KLw0R/gA5df5GLuqqkcsUkLTXKKkY3QVoe4rbHfvjGD46gWrZYV67jKaQHp4SM2 YFjwJfoM9TQt0jzGvbGWNFU6JX6gL3wrohKy/eV9ETCRdJOAcQMlBEkDFFmlnBN4Mi05 hIv3KSaDqVaYyon02YFQJsnsAhpAlrp6MRvVbG7YgGqi7U5fvR26auxVi5SWNiS/h2RS ncsYiKW9MVPkGGwNjotWMGOHGSLiAlIK4AJRywWvX+celMI1meCSgIGhKR4eMPMMcfwd q4SA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Ks9c5fal2HIeLdJjd/0p+pyxwCfKlQSG+Ai82b6dNXM=; b=APQqpvRC0RGCkGOCnGu+gRPgt3z8hQpht6uWNCbfka4jVQYgCITlqK5w7PnkmQQWH8 PU/4k0ZRiDGD3uDinsbNLUFahz+8GFBYfx+RwLANB/TzumlYupCdnDrjpxZh/is8askD owYpOaxHogZSZJ3NRTd4vhWp06W/NSuNI7Wadc8p/A/5m9QqV7Wxp++NYe74eWWQvafJ Xlu/5oCEdsxenqHyLCLkKNSuoEWKWFUiZPPEObNn3saKoiks9Vb7wPU1XL6cj66Ksjn2 U3rnLDz246z/4Oi5SHy5OoXfJRoksXIcklL94w758VzAObG+YP7BjUWXfD5980TRoKBY PsEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0AhZtaOZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dm10-20020a170907948a00b00783204942e5si187962ejc.885.2022.10.19.05.00.55; Wed, 19 Oct 2022 05:01: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=0AhZtaOZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230372AbiJSL4A (ORCPT + 99 others); Wed, 19 Oct 2022 07:56:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232594AbiJSLyy (ORCPT ); Wed, 19 Oct 2022 07:54: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 6FE4817FD41; Wed, 19 Oct 2022 04:34:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 0A7E7CE21C7; Wed, 19 Oct 2022 09:12:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0EAF7C433C1; Wed, 19 Oct 2022 09:12:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170774; bh=+bDLyobCzXL7wDQw/U6oi4YdNCx8flKdh8jVS9hCnO8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0AhZtaOZgiXDbyxotjBIjOSk/NhYE8NPVZeClqTz1SgeBHFjf9xx1agNhD4YaktcC y9649sOuHHpVsvgsA/r7Jz4idWSRcQafBJIZm+sZXytlkPtjQAO+GW7WfO/xYko8nU QbzFbr27saY6Ec+A+qTO2Qi3qlRCr2EmUutjZw84= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jameson Thies , Prashant Malani , Benson Leung , Tzung-Bi Shih , Sasha Levin Subject: [PATCH 6.0 747/862] platform/chrome: cros_ec: Notify the PM of wake events during resume Date: Wed, 19 Oct 2022 10:33:54 +0200 Message-Id: <20221019083322.941916152@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747117287675124683?= X-GMAIL-MSGID: =?utf-8?q?1747117287675124683?= From: Jameson Thies [ Upstream commit 8edd2752b0aa498b3a61f3caee8f79f7e0567fad ] cros_ec_handle_event in the cros_ec driver can notify the PM of wake events. When a device is suspended, cros_ec_handle_event will not check MKBP events. Instead, received MKBP events are checked during resume by cros_ec_report_events_during_suspend. But cros_ec_report_events_during_suspend cannot notify the PM if received events are wake events, causing wake events to not be reported if received while the device is suspended. Update cros_ec_report_events_during_suspend to notify the PM of wake events during resume by calling pm_wakeup_event. Signed-off-by: Jameson Thies Reviewed-by: Prashant Malani Reviewed-by: Benson Leung Signed-off-by: Tzung-Bi Shih Link: https://lore.kernel.org/r/20220913204954.2931042-1-jthies@google.com Signed-off-by: Sasha Levin --- drivers/platform/chrome/cros_ec.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/platform/chrome/cros_ec.c b/drivers/platform/chrome/cros_ec.c index 8aace50d446d..110df0fd4b00 100644 --- a/drivers/platform/chrome/cros_ec.c +++ b/drivers/platform/chrome/cros_ec.c @@ -349,10 +349,16 @@ EXPORT_SYMBOL(cros_ec_suspend); static void cros_ec_report_events_during_suspend(struct cros_ec_device *ec_dev) { + bool wake_event; + while (ec_dev->mkbp_event_supported && - cros_ec_get_next_event(ec_dev, NULL, NULL) > 0) + cros_ec_get_next_event(ec_dev, &wake_event, NULL) > 0) { blocking_notifier_call_chain(&ec_dev->event_notifier, 1, ec_dev); + + if (wake_event && device_may_wakeup(ec_dev->dev)) + pm_wakeup_event(ec_dev->dev, 0); + } } /** From patchwork Wed Oct 19 08:33:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4907 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225625wrs; Wed, 19 Oct 2022 02:43:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4VQm/Be8+2gwHn++iDx9QS3YFPL5kf/L3zrzeityn6JbadDqw4LEgYYJKJCRsoDn9yqWAw X-Received: by 2002:a05:6402:1bd0:b0:458:f170:fa74 with SMTP id ch16-20020a0564021bd000b00458f170fa74mr6646944edb.382.1666172616825; Wed, 19 Oct 2022 02:43:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172616; cv=none; d=google.com; s=arc-20160816; b=SZLzCQGAI3fye5N7v/USe5Y/2ZR4hbcReCwc3Dyj4g4x26n1yKEXM47Cv4RV/lvEPc nOSKnokbv2Vkm7Q4xAmoSmUQqlV+KQUBKjNboST1ZI1Yy5XrUsb8dQyWbkcxmI/yZl3d G3PABoroXW/1Q7+2Y4S9Lbu7VopB08FNdlLB64XSnduFctiZY/OHkOuDwcRSmvinhZ6z SF62pVMh8GSHnr7eTsYqw9ROHxnqVtqHHDVqmYiS42xSbIp03QxLO+f63lQtOF+K7oe4 +lLvSbhWr/A5NkrcxdHY2F4Met1NJaP6JR/bE/RT+Ir04m3pF39tKli6ZtIRY42O9p+O Y6zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=U3i6e5mz9lTrz0/598WA8qjJGMH8CDQktUCuLIpeUqw=; b=j0lk44pRkSw2hxEC5wSvRxllN5bxdBjL/EdIUeDHALcW6vG8iupIpMop4iYYKi0Qwl FeFQwrDg6toJHpSiy72NZPy5gKWvUkw0WSCWWqsneQsmvy3hgIA+adhd9OnbZOfJUZF4 SGKtMGsmne+LHTXqIx6ne4yZfP99q3mPKtkrS3VKrfCCH6Aik3b7lPmvb3AboTMu1yA2 4PCsD1UKIFMSbt2cQO3RFh6smoF9ZK2WTqNIA3Fi6Fjvx9atQg5oWP6n8O9MRgPKFLOH +I9g8kiwT3c1ic1WlZBKUaDcaEEOYMxnGXTU6zRHlSqhyAU4YLLrnDxXKkkI+JVDnzUI eQxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ozFszcnr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a056402015300b004597b778b3bsi12197380edu.75.2022.10.19.02.43.09; Wed, 19 Oct 2022 02:43: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=ozFszcnr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232486AbiJSJf5 (ORCPT + 99 others); Wed, 19 Oct 2022 05:35:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233876AbiJSJ3n (ORCPT ); Wed, 19 Oct 2022 05:29:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80CD2EC52A; Wed, 19 Oct 2022 02:13: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 8B485617E6; Wed, 19 Oct 2022 09:12:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F7F9C433C1; Wed, 19 Oct 2022 09:12:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170777; bh=wLs1MRVkbxT3b8aKqZEYPEL1jHZDMLOF9qfa9pKqlWM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ozFszcnrS6gLMqjii4plqaqLhhJVR79xdKRMs0SIO9zzObwONOJyjd+W82eQGOHcF GxYdO62yjFNVbS4O+HS6LHr+G38g5mTaKx9Z72Ouj3VD6OH0iSMa1mUX1aFJpACadM VFx1m8kG7pc63kJGpVY6SzeLmDaPlGfxQSE6q978= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jorge Lopez , Hans de Goede , Sasha Levin Subject: [PATCH 6.0 748/862] platform/x86: hp-wmi: Setting thermal profile fails with 0x06 Date: Wed, 19 Oct 2022 10:33:55 +0200 Message-Id: <20221019083322.982623777@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108617745392270?= X-GMAIL-MSGID: =?utf-8?q?1747108617745392270?= From: Jorge Lopez [ Upstream commit 00b1829294b7c88ecba92c661fbe6fe347b364d2 ] Error 0x06 (invalid command parameter) is reported by hp-wmi module when reading the current thermal profile and then proceed to set it back. The failing condition occurs in Linux NixOS after user configures the thermal profile to ‘quiet mode’ in Windows. Quiet Fan Mode is supported in Windows but was not supported in hp-wmi module. This fix adds support for PLATFORM_PROFILE_QUIET in hp-wmi module for HP notebooks other than HP Omen series. Quiet thermal profile is not supported in HP Omen series notebooks. Signed-off-by: Jorge Lopez Link: https://lore.kernel.org/r/20220912192603.4001-1-jorge.lopez2@hp.com Reviewed-by: Hans de Goede Signed-off-by: Hans de Goede Signed-off-by: Sasha Levin --- drivers/platform/x86/hp-wmi.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c index bc7020e9df9e..fc8dbbd6fc7c 100644 --- a/drivers/platform/x86/hp-wmi.c +++ b/drivers/platform/x86/hp-wmi.c @@ -177,7 +177,8 @@ enum hp_thermal_profile_omen_v1 { enum hp_thermal_profile { HP_THERMAL_PROFILE_PERFORMANCE = 0x00, HP_THERMAL_PROFILE_DEFAULT = 0x01, - HP_THERMAL_PROFILE_COOL = 0x02 + HP_THERMAL_PROFILE_COOL = 0x02, + HP_THERMAL_PROFILE_QUIET = 0x03, }; #define IS_HWBLOCKED(x) ((x & HPWMI_POWER_FW_OR_HW) != HPWMI_POWER_FW_OR_HW) @@ -1194,6 +1195,9 @@ static int hp_wmi_platform_profile_get(struct platform_profile_handler *pprof, case HP_THERMAL_PROFILE_COOL: *profile = PLATFORM_PROFILE_COOL; break; + case HP_THERMAL_PROFILE_QUIET: + *profile = PLATFORM_PROFILE_QUIET; + break; default: return -EINVAL; } @@ -1216,6 +1220,9 @@ static int hp_wmi_platform_profile_set(struct platform_profile_handler *pprof, case PLATFORM_PROFILE_COOL: tp = HP_THERMAL_PROFILE_COOL; break; + case PLATFORM_PROFILE_QUIET: + tp = HP_THERMAL_PROFILE_QUIET; + break; default: return -EOPNOTSUPP; } @@ -1263,6 +1270,8 @@ static int thermal_profile_setup(void) platform_profile_handler.profile_get = hp_wmi_platform_profile_get; platform_profile_handler.profile_set = hp_wmi_platform_profile_set; + + set_bit(PLATFORM_PROFILE_QUIET, platform_profile_handler.choices); } set_bit(PLATFORM_PROFILE_COOL, platform_profile_handler.choices); From patchwork Wed Oct 19 08:33: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: 4903 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225602wrs; Wed, 19 Oct 2022 02:43:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM74rRUOUWMrGfQ5lDdABK9DBUT+w9byxRx0XIEAX887GI4KrsYy4aCUmzwazXyMB0B2LisD X-Received: by 2002:a17:907:1c28:b0:78d:4616:e6b6 with SMTP id nc40-20020a1709071c2800b0078d4616e6b6mr5673168ejc.257.1666172613240; Wed, 19 Oct 2022 02:43:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172613; cv=none; d=google.com; s=arc-20160816; b=RGLso5EBidiM59YPGLkc+t9+vHYQ1p0vxFtHgv2BzaQtvICGX51+iTefHWHmn5bHnb 5YLK6ADVw5LZwjdGXGszApn3gAONkaPGuMBZBc6Pqqz+7LYb/NWi2xshj0rUO+0TumFq rPNmRRjOYmrBl3VHRlgq7qZEdBIOlDn8yPaSWxYJzO57A3jS/1ykYwNrqHW7C6qLVHeY qSE0E5Jee7QbOvx1ouZDf/A0xL3apJRtGpvag1W2u5LmT1ywpT0YqFzsBJu3hW3R7ZNy 4IMxbfMGhtKlHsE7vWlhuMryoVYbjl9cQytUVyNHW+3zn7YsAlphKxM4K1ifIAJkgA/a ASmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HKWcpNGSz/qO9umKP5O4jo5RzD6s32hka6dtmUVAbiY=; b=jKnm0l89Wut1KTlSmeLVfrO5sL67St5CJpg3qpiKWntsn6KdcYmUHOK2858vTzUHli I/NPaC3T8NOf9giDvg0RNAaNR0o5avx5P9jionp9VfYjvzE4KchiQykOp3wU7IwRrO7L IbcLLty2vb9xdGXsx6DnxzxwWRUzpfyjCUlNjgBoc8PIN6Qz5G7ryIQDTjBG25G5K21v w7H6vJKs3hWQgcjymjcFo038TMcb1jU38ty6sUMrGJcgAmBt4IPH/JOR2Ct9x3Gh/kdQ MLBXp/0FkwpCZ8Q7LXwPeWmmMNvNidJA3a/IjJ0azVpZUAR7ZJ9jzSjebr/ANFFtL3u3 0beg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wx4k6Ob0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j11-20020aa7de8b000000b004593fb0c125si11842638edv.103.2022.10.19.02.43.07; Wed, 19 Oct 2022 02:43: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=wx4k6Ob0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233855AbiJSJfx (ORCPT + 99 others); Wed, 19 Oct 2022 05:35:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233872AbiJSJ3n (ORCPT ); Wed, 19 Oct 2022 05:29: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 B7875EC535; Wed, 19 Oct 2022 02:13: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 477C6617D7; Wed, 19 Oct 2022 09:13:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59EA8C433C1; Wed, 19 Oct 2022 09:12:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170779; bh=VyRbyK2ww2404bbaV+nZGsh7aEeNQVyazO8tGuaL5hY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wx4k6Ob0tmgBUKydS5Jg7KGm75kPCHaVlDhIkl/MqlaxavgzwHmRj8rVEpqwie9zn GHYHdhQpclGspaWSl2FClkmA3VJXH/MCHVyCO9EuZ1raOq249JSWgx3pfER+FM+qTE kQtEdm4DD7qQZWPcHMCvj+K5T7T3zTXQ1M/z67BQ= 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 6.0 749/862] platform/x86: msi-laptop: Change DMI match / alias strings to fix module autoloading Date: Wed, 19 Oct 2022 10:33:56 +0200 Message-Id: <20221019083323.019544985@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108614191322448?= X-GMAIL-MSGID: =?utf-8?q?1747108614191322448?= 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 3e935303b143..0e804b6c2d24 100644 --- a/drivers/platform/x86/msi-laptop.c +++ b/drivers/platform/x86/msi-laptop.c @@ -596,11 +596,10 @@ static const struct dmi_system_id msi_dmi_table[] __initconst = { { .ident = "MSI S270", .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "MICRO-STAR INT'L CO.,LTD"), + DMI_MATCH(DMI_SYS_VENDOR, "MICRO-STAR INT"), DMI_MATCH(DMI_PRODUCT_NAME, "MS-1013"), DMI_MATCH(DMI_PRODUCT_VERSION, "0131"), - DMI_MATCH(DMI_CHASSIS_VENDOR, - "MICRO-STAR INT'L CO.,LTD") + DMI_MATCH(DMI_CHASSIS_VENDOR, "MICRO-STAR INT") }, .driver_data = &quirk_old_ec_model, .callback = dmi_check_cb @@ -633,8 +632,7 @@ static const struct dmi_system_id msi_dmi_table[] __initconst = { DMI_MATCH(DMI_SYS_VENDOR, "NOTEBOOK"), DMI_MATCH(DMI_PRODUCT_NAME, "SAM2000"), DMI_MATCH(DMI_PRODUCT_VERSION, "0131"), - DMI_MATCH(DMI_CHASSIS_VENDOR, - "MICRO-STAR INT'L CO.,LTD") + DMI_MATCH(DMI_CHASSIS_VENDOR, "MICRO-STAR INT") }, .driver_data = &quirk_old_ec_model, .callback = dmi_check_cb From patchwork Wed Oct 19 08:33: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: 4920 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225822wrs; Wed, 19 Oct 2022 02:44:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4HeoFvdVMkXBxOzbIIWwrCMOA0b4g/vXSJ/WeWVfAfpAbCu/mlkkjrvXPgJ3JXSeKFRFZL X-Received: by 2002:a17:902:aa46:b0:17a:487:ef6b with SMTP id c6-20020a170902aa4600b0017a0487ef6bmr7599976plr.8.1666172647553; Wed, 19 Oct 2022 02:44:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172647; cv=none; d=google.com; s=arc-20160816; b=kg7MnYWOkXiNsJLMLla1NKhXJn3C/0YtDheMfPYBdA9fO+s+Xjgtv3rarp6z4+spC2 p2go4tHp2zPBqrwCW+f9CQg8MqqJMlWKJp6ZmwHn6K6/cyg19J+9jn+BIOnZpRqcGwkx 0uodn0ctcRaaZjJRpOOt0aDHyJ7Y2y6A40Kh9FeTJb78VNuZXAeWnS/lq0QjBHvZ78JS VG3xTxrg32l1Ucis0QtKpX3gDUOIacUkqR9LW4VYjEGw24oUQIofuc9z2CAimS5z1Mp+ BKuz0PDkChOAvdLjFzo62qiqoWbo4wjyaRi10oIO+8QTZ2zME5ysfBeIZXv20axXeHXH cPqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=LzhO+5d0xY1Ik1fvHEhKeIOhNYur437pc02nkhovvx0=; b=KgMPpmeoOm7g+CBh2ajDwZHXVex7MMUuEObGkuKx3SM8uAtacsBgodky3ze5inty4/ KI+R8wCxA7xSlclQmoMWZkGvuehdS6qiRdgih35MpQKxMOmGhrnc1lJwMCk/eq7Epc3r zjR/N8NSGzxwv2AGlS4YGchp4h9PUZhhH1HF88R28hOn554Wn9u3zsJ6zoXvOmI+QCcP OkDbcVCsH/toL/G+9X78hRCPQJWFcdRt1euVWE8YMjWDfxBiNgV6yv9jwG2sQjwBLjis nD2lWiba/7xKa7cRFPP+SuDuDul1E1b8M6/nKE6R+mjMnVTyiOJpsv3N6FS2zNoX35L3 gtVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="x//n5qfI"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u8-20020a654c08000000b0043c9d3b9c83si18118912pgq.140.2022.10.19.02.43.50; Wed, 19 Oct 2022 02:44: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="x//n5qfI"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233893AbiJSJgS (ORCPT + 99 others); Wed, 19 Oct 2022 05:36:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233910AbiJSJ3u (ORCPT ); Wed, 19 Oct 2022 05:29:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19CFCC4C33; Wed, 19 Oct 2022 02:13: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 E6AC861777; Wed, 19 Oct 2022 09:13:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A7F3C433D7; Wed, 19 Oct 2022 09:13:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170782; bh=rpwhqAxu7g2q3YqyG2REyODVriYQxeZ1tyF0riBzRNY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x//n5qfILYRUokPXkE+XF3EpQtCLzTnjAaVW00UFqQh4oOD/1X0kglJJ+yJKbCoS0 4S9ETAxsgQPmllSUF3Ag6qUFkomAaepxyiYMOpDwnmd1eQx4Byp6av7TofPEFRNqjX N94VVlEgaGOKRhe2P6yOioOeQqNV7sYOPBQYhOns= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ranjani Sridharan , Muralidhar Reddy , Pierre-Louis Bossart , Mark Brown , Sasha Levin Subject: [PATCH 6.0 750/862] ALSA: intel-dspconfig: add ES8336 support for AlderLake-PS Date: Wed, 19 Oct 2022 10:33:57 +0200 Message-Id: <20221019083323.060211380@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108650468958506?= X-GMAIL-MSGID: =?utf-8?q?1747108650468958506?= From: Muralidhar Reddy [ Upstream commit 9db1c9fa214ef41d098633ff40a87284ca6e1870 ] added quirks for ESS8336 for AlderLake-PS Reviewed-by: Ranjani Sridharan Signed-off-by: Muralidhar Reddy Signed-off-by: Pierre-Louis Bossart Link: https://lore.kernel.org/r/20220919114548.42769-1-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/hda/intel-dsp-config.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sound/hda/intel-dsp-config.c b/sound/hda/intel-dsp-config.c index 5a478649f338..b9eb3208f288 100644 --- a/sound/hda/intel-dsp-config.c +++ b/sound/hda/intel-dsp-config.c @@ -427,6 +427,11 @@ static const struct config_entry config_table[] = { .device = 0x51cd, }, /* Alderlake-PS */ + { + .flags = FLAG_SOF, + .device = 0x51c9, + .codec_hid = &essx_83x6, + }, { .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, .device = 0x51c9, From patchwork Wed Oct 19 08:33: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: 4909 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225719wrs; Wed, 19 Oct 2022 02:43:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7dO5vCrYqTUXeZIsFD4qVODqIm4nym/4jab5F6IH2oaMVnOQ2MBbKN5t3UIA3pj9SDKePF X-Received: by 2002:a17:907:971c:b0:78e:63f:c766 with SMTP id jg28-20020a170907971c00b0078e063fc766mr5966793ejc.330.1666172631905; Wed, 19 Oct 2022 02:43:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172631; cv=none; d=google.com; s=arc-20160816; b=oojlUV1AEsmrhojWolJr3a3RlWCjRmeBPJ0AC/SnqRLAvPHZvNpE/3OuKt+dH9XuD9 gLYajYptujWPDYCkX8Xul687eyfpfWQl0iJO7pDg+ZHVaOEKNzzWzAjq6x+JdeEN8wyU tFEhPAxWGjIxzNBPYdFGMQJFoZUm38QHGrU2XeKPSHjf3lmAx5pCCOYNbMFZj0wC0Krw s8Kp6aMA7G+vrbEM+twe7g5TrCoeBgGJc2J3duNFmTpzpq3+Wq9nVZSOotAjt71MsNkB XzO4I+/wm98PTlV6ubmvecMR089eouXzRf5IEs7wp0CpqoKdrTB1YU+bV55CG2ovK1aJ p8/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=pVU5ACPm09g4WEu+LdsddffbfjXZe98V0tuL1COp4vY=; b=EEt8qf1qZTfwXe5kIz6/1FdWVrLeWBaH+auZ11Gs/hXcZm99u3sHLIi0/5Ma4DF8wq VMr2pgGkLH29QZbXady3ceK2e4v+D9QggW17S9muVhcklUKaZc7WSe+tmJCbjknIvqHI qrqeYZJLt+Wv5CVAOkAsJzoh/NTYnBpnYavCuvfK3vHHvp2ixnDgCUOzodRvLExboi6e pqerSxMy3wu9MSnosbQFoKPvhAVxNeB9aJhtdxn7WHiQHkHU/yKfViGvjUyYYkEuX4Bw C/KbqLpfdb8YMKjWSh2p0WCb31I+MboN35bZsMoTR1ITLtoOTDISOsrXXHUQ6bjyVUsO 023A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hkyc3FZC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h6-20020a056402280600b0044f3b9ef98bsi17112864ede.27.2022.10.19.02.43.22; Wed, 19 Oct 2022 02:43: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=hkyc3FZC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233976AbiJSJgZ (ORCPT + 99 others); Wed, 19 Oct 2022 05:36:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233916AbiJSJ3v (ORCPT ); Wed, 19 Oct 2022 05:29:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5850EEC533; Wed, 19 Oct 2022 02:13: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 88019617E4; Wed, 19 Oct 2022 09:13:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75962C433C1; Wed, 19 Oct 2022 09:13:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170785; bh=pMbxhj9oyvXcVZkWKcZXy1MVAYMbhd3RSfm4nlEApfQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hkyc3FZC6/zZLL7K+dGyIOy0/qzt5n5LqTmuAgSKKpMHsp43Omx3gvEn3ThJj0oO6 tIVLGg3y3NrhKQI5fwqWzXF3RHZzxU5mk2cgbgFTKNKZbqqSf/alqjem4Ob4Lr0Dya TTVQ08wEoxCykn7GLFlwiNK4ihpAHXczFa2CxaDk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ranjani Sridharan , Chao Song , Curtis Malainey , Jairaj Arava , Curtis Malainey , Sathyanarayana Nujella , Pierre-Louis Bossart , Mark Brown , Sasha Levin Subject: [PATCH 6.0 751/862] ASoC: SOF: pci: Change DMI match info to support all Chrome platforms Date: Wed, 19 Oct 2022 10:33:58 +0200 Message-Id: <20221019083323.098712202@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108633646238606?= X-GMAIL-MSGID: =?utf-8?q?1747108633646238606?= From: Jairaj Arava [ Upstream commit c1c1fc8103f794a10c5c15e3c17879caf4f42c8f ] In some Chrome platforms if OEM's use their own string as SYS_VENDOR than "Google", it leads to firmware load failure from intel/sof/community path. Hence, changing SYS_VENDOR to PRODUCT_FAMILY in which "Google" is used as common prefix and is supported in all Chrome platforms. Reviewed-by: Ranjani Sridharan Reviewed-by: Chao Song Reviewed-by: Curtis Malainey Signed-off-by: Jairaj Arava Signed-off-by: Curtis Malainey Signed-off-by: Sathyanarayana Nujella Signed-off-by: Pierre-Louis Bossart Link: https://lore.kernel.org/r/20220919114429.42700-1-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/sof/sof-pci-dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/sof/sof-pci-dev.c b/sound/soc/sof/sof-pci-dev.c index d627092b399d..643fd1036d60 100644 --- a/sound/soc/sof/sof-pci-dev.c +++ b/sound/soc/sof/sof-pci-dev.c @@ -138,7 +138,7 @@ static const struct dmi_system_id community_key_platforms[] = { .ident = "Google Chromebooks", .callback = chromebook_use_community_key, .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Google"), + DMI_MATCH(DMI_PRODUCT_FAMILY, "Google"), } }, {}, From patchwork Wed Oct 19 08:33: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: 5093 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp249823wrs; Wed, 19 Oct 2022 03:47:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM68AjdMIxJPFxE6EuDj/XT5DVu2Bg4aFqYXEGAXMm6McAAolheMFTvOIk1Db7IQpzMXyJYw X-Received: by 2002:a17:90b:4c89:b0:20d:457c:5068 with SMTP id my9-20020a17090b4c8900b0020d457c5068mr43357058pjb.208.1666176432087; Wed, 19 Oct 2022 03:47:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176432; cv=none; d=google.com; s=arc-20160816; b=INb9u0/mDqoTEVxgKJ4HB0RoHMIAAkMnLpca0RtH8pOk/yzSBNiKlge8Ro0AnmBdUR FjFaW72eJFeAjKyjOlyM+Z0aVxrEZ4r+HgYeBheYTU5IcU3iTs3wY2/4dv9+oOPtfZTZ lPqsFS+wxQ6qO30m48zrjmo8SRRDsuGE00+TywOzKXV1odkxiTI+0nfVRM+Gyu+/64U7 lm4ASTwAcaftOVEceK+k8EWzGfgd2wiUHEzYASamIJj4kc6WVtOSCmN3DmUaTRkLHtRL KmpJaocKmFTRseo1FAWcucZOXpsun+b0zK1YrmAtsMrFZq4pZiHRX850ENmnMnbWFqHt hYTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qg8KPg1aGV7vsxEijlRYq/bUFOlC3jDh+C01gu5BdMQ=; b=b8iSL7CHtiXuuwEDL0Gx/FVR3QIF5qiNmrehlkGcUCDFm4oyANEpC/6JzlfvOGovha 4eI4CNe6kJ1HzOS+sMPVJcgH/PPFs5ZlgR1gkh4Ke6axaGE2CHFKD3MbWJXhHqR6p8U4 zH/Z0Hvi0r+sYesZu/H6k0Vc9knxdx25ipYnywHm6ACHtWd9jh8RqOxc3G90JCth4mFp +GxoQFAo2qU4CfP0s05AA0I7SVlJrANrn9731GCNuxEWk3xlhooBPqFWZezwL6unLyyY 6Qs1MeFF920/rMOpvC0vKleKksICFzX0bLeNJ/qig3jUk5EJTKGhhQZf+byoD4PxgVCf crUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AOI4Viqz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lx12-20020a17090b4b0c00b0020a7d457b5asi26990511pjb.169.2022.10.19.03.46.59; Wed, 19 Oct 2022 03:47: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=AOI4Viqz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233337AbiJSKqk (ORCPT + 99 others); Wed, 19 Oct 2022 06:46:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233297AbiJSKoe (ORCPT ); Wed, 19 Oct 2022 06:44:34 -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 B35668E7B5; Wed, 19 Oct 2022 03:20: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 104CAB824D7; Wed, 19 Oct 2022 09:13:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5ECE1C433C1; Wed, 19 Oct 2022 09:13:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170787; bh=FoAKBoM3BVE06nEwOQj9AKyKByzBVLYrsUm0mfXl8EQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AOI4Viqzgb1uOEYMe4Zhg8V7lYI7431EbtRIXIAALVKMAcNUZqBu3oxlzLvK09jNt KYSe/eymQZP+n+XOFGBcHRALnwleVfzk5QLdRovZ2TH6uPXTMC39rFVwohMiGGlnnU VHx/MFcGrzWYcCP6blMw7GVlLanePa+mxeKyRNF4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mikhail Rudenko , Mark Brown , Sasha Levin Subject: [PATCH 6.0 752/862] ASoC: sunxi: sun4i-codec: set debugfs_prefix for CPU DAI component Date: Wed, 19 Oct 2022 10:33:59 +0200 Message-Id: <20221019083323.137280072@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112618123312463?= X-GMAIL-MSGID: =?utf-8?q?1747112618123312463?= From: Mikhail Rudenko [ Upstream commit 717a8ff20f32792d6a94f2883e771482c37d844b ] At present, succesfull probing of H3 Codec results in an error debugfs: Directory '1c22c00.codec' with parent 'H3 Audio Codec' already present! This is caused by a directory name conflict between codec components. Fix it by setting debugfs_prefix for the CPU DAI component. Signed-off-by: Mikhail Rudenko Link: https://lore.kernel.org/r/20220913212256.151799-2-mike.rudenko@gmail.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/sunxi/sun4i-codec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c index 830beb38bf15..fdf3165acd70 100644 --- a/sound/soc/sunxi/sun4i-codec.c +++ b/sound/soc/sunxi/sun4i-codec.c @@ -1232,6 +1232,9 @@ static const struct snd_soc_component_driver sun8i_a23_codec_codec = { static const struct snd_soc_component_driver sun4i_codec_component = { .name = "sun4i-codec", .legacy_dai_naming = 1, +#ifdef CONFIG_DEBUG_FS + .debugfs_prefix = "cpu", +#endif }; #define SUN4I_CODEC_RATES SNDRV_PCM_RATE_CONTINUOUS From patchwork Wed Oct 19 08:34: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: 5139 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp252058wrs; Wed, 19 Oct 2022 03:53:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM60QKV6HtZ2JZ2RFnI8P242w4s8DZ4oQzVndmUVg0yMaK9BrC+JZvpUOQSC63O1G9ZX5oJl X-Received: by 2002:a05:6402:4302:b0:45d:c9b4:c007 with SMTP id m2-20020a056402430200b0045dc9b4c007mr6825539edc.328.1666176806209; Wed, 19 Oct 2022 03:53:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176806; cv=none; d=google.com; s=arc-20160816; b=r+cL7Nu4IN8CG9eyl8XLe6QjUrt/dv5dAbhcmkosl4dQyxSr3PtcJA/L/l9roQ4Q7P 1G51q2+DviBPfkTy3nDpSH5S9uJ21E4J5KKeYmNY53QO4DbmrPpgQmFzLytVna3MiHCB SXgaBuIODnbdkQc01NRv/nfVMxLyWhtz4D3rGLvhwkx2GQCezYjXHSgsoFKMKnoVPobU umB5MatagVsY82S1h3thH8oTetGTB2SNEZs6tLVGnJYkLQX13hK0riOjcuVJZCWY4wmL RYpekO6MwUeXEUNTo6scVdRnuqr2LDw64HmR66CcB+mebzkThsnoox2ABwirTqcVEWel 58bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Qm5wmh6PxQ3/Tn1y5d7HHNsRB2z0MlMUorXHGntJ3nU=; b=pCLmAJfwTVIDMlXFOeYTQGlrz5nRYR6aUIOFT6Hyf10p1wfjrpGJ6tutB8BxFmpR4W Y7wkNscWGmWPJF63LBDV2jMhToyMS9c+f2870ep7k8UmLHyFjgSOrTFfRG45doyKS1H+ mHTtK6O+uKW03Rbe+ATNqJE++Mu6CV76gyY6JbVISrve+95fA8k4Ut/GBq205fU/s5zu bRoxYvI4wFOjjIq6xzsEo6Pwndbl+QAtDaaf2PdXWDCyjPaz/UvKZxc0CLyX4ONX+g6R PnO2vMz+3WbMb+StdjH2BOwMrqrhdc8mWeSQoQ/pepm309ayHJ05quhI7Q0Ecv4WYQ2F ND4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bzXAUqCc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nd10-20020a170907628a00b0078dacbcaa7asi13841648ejc.992.2022.10.19.03.53.01; Wed, 19 Oct 2022 03:53: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=bzXAUqCc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234585AbiJSKvg (ORCPT + 99 others); Wed, 19 Oct 2022 06:51:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234564AbiJSKt3 (ORCPT ); Wed, 19 Oct 2022 06:49:29 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08DBE14BB71; Wed, 19 Oct 2022 03:22: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 3B04CB824C2; Wed, 19 Oct 2022 09:11:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF157C433C1; Wed, 19 Oct 2022 09:11:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170696; bh=8vlZOH+1gnjwy2xjkBABceLfZcQrgsu6aRHtvXp0IEs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bzXAUqCc8BDenCN6P9al8XIwEpprm9kxdSK/CJQhV3RJBl0kHCZXq6YRE/2Pk5CDo mwBON4DcKGXc26lp7fbQoQEQc50Wm+VaQu2PryETFPin5P1Jfb9r+3m8pjgelN8P/t j2sav56cpCWxXFABNOFC0663Y+gLbjDVrCHuOUn0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pierre-Louis Bossart , Kai Vehmanen , Bard Liao , Mark Brown , Sasha Levin Subject: [PATCH 6.0 753/862] ASoC: SOF: add quirk to override topology mclk_id Date: Wed, 19 Oct 2022 10:34:00 +0200 Message-Id: <20221019083323.177619438@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747113010786944659?= X-GMAIL-MSGID: =?utf-8?q?1747113010786944659?= From: Pierre-Louis Bossart [ Upstream commit d136949dd8e2e309dc2f186507486b71cbe9acdb ] Some Intel-based platforms rely on a topology file that hard-codes the use of MCLK0. This is incorrect in 10% of the cases. Rather than generating yet another set of topology files, this patch adds a kernel module parameter to override the topology value. In hindsight, we should never have allowed mclks to be specified in topology, this is a hardware-level information that should not have been visible in the topology. Future patches will try to set this value automagically, e.g. by parsing the NHLT content. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Kai Vehmanen Reviewed-by: Bard Liao Link: https://lore.kernel.org/r/20220919115350.43104-3-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/sof/intel/hda.c | 11 +++++++++++ sound/soc/sof/ipc3-topology.c | 7 +++++++ sound/soc/sof/sof-priv.h | 4 ++++ 3 files changed, 22 insertions(+) diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c index 6d4ecbe14adf..ada2e6775749 100644 --- a/sound/soc/sof/intel/hda.c +++ b/sound/soc/sof/intel/hda.c @@ -376,6 +376,10 @@ static int dmic_num_override = -1; module_param_named(dmic_num, dmic_num_override, int, 0444); MODULE_PARM_DESC(dmic_num, "SOF HDA DMIC number"); +static int mclk_id_override = -1; +module_param_named(mclk_id, mclk_id_override, int, 0444); +MODULE_PARM_DESC(mclk_id, "SOF SSP mclk_id"); + #if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) static bool hda_codec_use_common_hdmi = IS_ENABLED(CONFIG_SND_HDA_CODEC_HDMI); module_param_named(use_common_hdmi, hda_codec_use_common_hdmi, bool, 0444); @@ -1565,6 +1569,13 @@ struct snd_soc_acpi_mach *hda_machine_select(struct snd_sof_dev *sdev) sof_pdata->tplg_filename = tplg_filename; } + + /* check if mclk_id should be modified from topology defaults */ + if (mclk_id_override >= 0) { + dev_info(sdev->dev, "Overriding topology with MCLK %d from kernel_parameter\n", mclk_id_override); + sdev->mclk_id_override = true; + sdev->mclk_id_quirk = mclk_id_override; + } } /* diff --git a/sound/soc/sof/ipc3-topology.c b/sound/soc/sof/ipc3-topology.c index 65923e7a5976..a39b43850f0e 100644 --- a/sound/soc/sof/ipc3-topology.c +++ b/sound/soc/sof/ipc3-topology.c @@ -1249,6 +1249,7 @@ static int sof_link_afe_load(struct snd_soc_component *scomp, struct snd_sof_dai static int sof_link_ssp_load(struct snd_soc_component *scomp, struct snd_sof_dai_link *slink, struct sof_ipc_dai_config *config, struct snd_sof_dai *dai) { + struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp); struct snd_soc_tplg_hw_config *hw_config = slink->hw_configs; struct sof_dai_private_data *private = dai->private; u32 size = sizeof(*config); @@ -1273,6 +1274,12 @@ static int sof_link_ssp_load(struct snd_soc_component *scomp, struct snd_sof_dai config[i].hdr.size = size; + if (sdev->mclk_id_override) { + dev_dbg(scomp->dev, "tplg: overriding topology mclk_id %d by quirk %d\n", + config[i].ssp.mclk_id, sdev->mclk_id_quirk); + config[i].ssp.mclk_id = sdev->mclk_id_quirk; + } + /* copy differentiating hw configs to ipc structs */ config[i].ssp.mclk_rate = le32_to_cpu(hw_config[i].mclk_rate); config[i].ssp.bclk_rate = le32_to_cpu(hw_config[i].bclk_rate); diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h index 823583086279..828c74bb75f8 100644 --- a/sound/soc/sof/sof-priv.h +++ b/sound/soc/sof/sof-priv.h @@ -594,6 +594,10 @@ struct snd_sof_dev { /* to protect the ipc_rx_handler_list and dsp_state_handler_list list */ struct mutex client_event_handler_mutex; + /* quirks to override topology values */ + bool mclk_id_override; + u16 mclk_id_quirk; /* same size as in IPC3 definitions */ + void *private; /* core does not touch this */ }; From patchwork Wed Oct 19 08:34:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5206 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp264575wrs; Wed, 19 Oct 2022 04:20:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM54zMTwNlZjVEf2onQr29w7u93BPXZ3wCbdcb6yUL0D1cWT9yyyt7DXWPfyEg8wQqANUxBv X-Received: by 2002:a05:6402:254b:b0:45d:b117:90f0 with SMTP id l11-20020a056402254b00b0045db11790f0mr6810611edb.57.1666178426204; Wed, 19 Oct 2022 04:20:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178426; cv=none; d=google.com; s=arc-20160816; b=s+C4YdnreSMxyFqh2Qdyd/poj1RiOuFpdX4TYpAXP8s5uT5Rx1Z5jA0ZjCWFYFm6Se GOgJJ5SNb3pweOZC6364/kz61tsZcvoBfnbZttTLGkxcMTncZL0dN3IoR7s+vsTNmg8r ZV8QOwuYgDjoC7WsijsMVw0k5dChsuZtxwMYrf4j2EPXbZ9+joJ1TgP1/+zfcgYD9Eln /QWF80BV6MhhQ7faFQY0qlAgMWtWdK2ZWquDTukgEG7YW4sZ8Of9OvUQtiJXmXmpw0Wr i8g9xQjecSa8W/y78VM5K1EIBQL1dFMnpEu75pgWS32tVtzQsnwf04mVFdDUsvdjvxZO KFXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=IRvL89iu3AsYoBNtyhQYCs/DDPqSHzhlIPhLiEwM0o0=; b=aY9AiG14uEZBBGnjLgxO9A2baTUYQh6OuM6t3JNlsxSl1npTAYr8wz8rELSN/9+qDH SuwVA6YoHeOibXQn1iZLR6dm+UFIuhUFggj83ZOTWbjleld4/2uyD9Z/mnOr3CitWKbl uXmLsEBwHpLAMrx89rPxho7CQVzEODj9dv4i5PVQTxLYl0nk049XBCk7HaBBQAGdHMvB chOkBlFtLef+I0x2muYqFxNGm+qZGaS0TWJY65Ak1iD1/SrbI+uuUf6vndgSciz/nmLH w0Lq1deMJkY/6esQxvvlNJxPGZTC+BmCSfNRtuAzGL7LL05+TNMiMF7G23H0yfcv49NV mf+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gDGk9bT+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nb16-20020a1709071c9000b0078d770f363fsi10849060ejc.471.2022.10.19.04.20.00; Wed, 19 Oct 2022 04:20:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gDGk9bT+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232538AbiJSLKC (ORCPT + 99 others); Wed, 19 Oct 2022 07:10:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233181AbiJSLIy (ORCPT ); Wed, 19 Oct 2022 07:08: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 3C97D14EC77; Wed, 19 Oct 2022 03:37: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 59455CE21B0; Wed, 19 Oct 2022 09:11:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5EE53C433D7; Wed, 19 Oct 2022 09:11:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170698; bh=Syyww4aE/A9q2YbgecUDjN7WhpYEeXohYESQpJiSY+w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gDGk9bT+1mK4aCae/7WPEbGv2qy33SKbiMCdGlJGuNSxv9MEURoYEjRskOKs8OWn6 0e7ZCidLaqKTK92/Wf/NxjsVUJwdrdsQ0zJs8k1RtVuvfatAnqoizBjkSmiCGyi8or 6qsGSrJzVuX/RQ+h6nQKb8HzpurXNqkcAo+Q1Ljk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Philip Yang , Felix Kuehling , =?utf-8?q?Christian_K=C3=B6nig?= , Alex Deucher , Sasha Levin Subject: [PATCH 6.0 754/862] drm/amdgpu: SDMA update use unlocked iterator Date: Wed, 19 Oct 2022 10:34:01 +0200 Message-Id: <20221019083323.217463591@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114709076247540?= X-GMAIL-MSGID: =?utf-8?q?1747114709076247540?= From: Philip Yang [ Upstream commit 3913f0179ba366f7d7d160c506ce00de1602bbc4 ] SDMA update page table may be called from unlocked context, this generate below warning. Use unlocked iterator to handle this case. WARNING: CPU: 0 PID: 1475 at drivers/dma-buf/dma-resv.c:483 dma_resv_iter_next Call Trace: dma_resv_iter_first+0x43/0xa0 amdgpu_vm_sdma_update+0x69/0x2d0 [amdgpu] amdgpu_vm_ptes_update+0x29c/0x870 [amdgpu] amdgpu_vm_update_range+0x2f6/0x6c0 [amdgpu] svm_range_unmap_from_gpus+0x115/0x300 [amdgpu] svm_range_cpu_invalidate_pagetables+0x510/0x5e0 [amdgpu] __mmu_notifier_invalidate_range_start+0x1d3/0x230 unmap_vmas+0x140/0x150 unmap_region+0xa8/0x110 Signed-off-by: Philip Yang Suggested-by: Felix Kuehling Reviewed-by: Christian König Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c index 1fd3cbca20a2..718db7d98e5a 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c @@ -211,12 +211,15 @@ static int amdgpu_vm_sdma_update(struct amdgpu_vm_update_params *p, int r; /* Wait for PD/PT moves to be completed */ - dma_resv_for_each_fence(&cursor, bo->tbo.base.resv, - DMA_RESV_USAGE_KERNEL, fence) { + dma_resv_iter_begin(&cursor, bo->tbo.base.resv, DMA_RESV_USAGE_KERNEL); + dma_resv_for_each_fence_unlocked(&cursor, fence) { r = amdgpu_sync_fence(&p->job->sync, fence); - if (r) + if (r) { + dma_resv_iter_end(&cursor); return r; + } } + dma_resv_iter_end(&cursor); do { ndw = p->num_dw_left; From patchwork Wed Oct 19 08:34: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: 5131 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp251684wrs; Wed, 19 Oct 2022 03:52:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6arO5JPDNsLNNwNuDeUkwpO0Pbt5e3WiWk94BcNuWO1nVshh4ceYLehNjF6tIueuHUjWsW X-Received: by 2002:a05:6402:847:b0:453:943b:bf4 with SMTP id b7-20020a056402084700b00453943b0bf4mr6711296edz.301.1666176743542; Wed, 19 Oct 2022 03:52:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176743; cv=none; d=google.com; s=arc-20160816; b=qPrVqjnbNKEXskwDTBlzSMN9Dj0B/ZnYet4EH0u6qOmRgFB6QQ0akExiMM6uHcgOoP LTpnOx4cbbd6MKvRJImeyOedTTGNtfDcgY6akXlneTCOOK1S519drk8in4eAIjph1TTy ErO9FHBnXy8DcEdFaLnYqxOKMoEuHCfLMaHSomRxozeDBRZGMEHzNLR/DE+MFm5NXhK9 jqw0BCU3XBX5N1OpoCv2XHAa4C+UL/bikBTL3TMUthIWXGAqz27G8bfIFRc2syzO1aI9 PbdUjTKD3jFPRwWApLbEEWElLl6eT5C1f+zL2er6RuzFylwDYYDWdoZdIOmgcYp0JLwB JxvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BX0SGS4kaiBFvfOdX/uvNY81Dot8Zj5mJVJVhoTsl8k=; b=Ye7qTq0Pm9tczN0bNVlfZ6sIcrkE6d+8dA/5S79A9QJVZzDlum6N4X2+K24f2Qpv9Y eED3TvlCjQAt/ETFLM7X5KBqykB3nvSQxi/nGPzIFB/fwAWduH3jr9jo3Zmd70i2XJPv 1vs/XJLSpJ92io4q00K50nJSAi9KbPMXKapgNENhFKe+Vv+makdE8ni9aUC3ZO82f84j Lp2WzK9A5ULgXGDPchMlNgEjyZOyhI6iU2TkGyiLXGquAUfpIBDKWT5fc3IUzrg+XZ65 x85MpDIaQ/zXMB444rFWkcaBXprbVUbARijurTWs10qbbxbC7z0gJ5vBQTagO9W4fJVp HGaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eL3QFvCA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z12-20020a50eb4c000000b004594b742e0asi13022185edp.323.2022.10.19.03.51.58; Wed, 19 Oct 2022 03:52: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=eL3QFvCA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234531AbiJSKvR (ORCPT + 99 others); Wed, 19 Oct 2022 06:51:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234518AbiJSKtX (ORCPT ); Wed, 19 Oct 2022 06:49:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5083D15B121; Wed, 19 Oct 2022 03:22: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 918CFB824C8; Wed, 19 Oct 2022 09:11:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E92A7C433D6; Wed, 19 Oct 2022 09:11:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170701; bh=0Mkkz5bfFZBlBKXGzFz6TYYw1H49rCJnHuktGD6YMI8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eL3QFvCAZ4pqnJRb6KILamdSAecOxzlXl+QyZ7UlsktJ54dPOX4o0OtHmAufKYgO5 uAPZUfYAo/y066LgCzhuXwPhGxSPjiukEvW0XoLLwFVuyvRGh/ZeiU0LWRy6xfU22a nH9ePbLaZt3jpbOkaEE26Z3TGTyCMs2CA0q0Hbog= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alvin Lee , Nevenko Stupar , Wayne Lin , George Shen , Daniel Wheeler , Alex Deucher , Sasha Levin Subject: [PATCH 6.0 755/862] drm/amd/display: Fix urgent latency override for DCN32/DCN321 Date: Wed, 19 Oct 2022 10:34:02 +0200 Message-Id: <20221019083323.271631999@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112945178243101?= X-GMAIL-MSGID: =?utf-8?q?1747112945178243101?= From: George Shen [ Upstream commit e7f2f4cd67443ce308480ca461806fcc3456e0ba ] [Why] The urgent latency override is useful when debugging issues relating to underflow. Current overridden variable is not correct and has no effect on DCN3.2 and DCN3.21 DML calculations. [How] For DCN3.2 and DCN3.21, override the correct urgent latency variable when bounding box override is present. Reviewed-by: Alvin Lee Reviewed-by: Nevenko Stupar Acked-by: Wayne Lin Signed-off-by: George Shen Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c | 1 + drivers/gpu/drm/amd/display/dc/dml/dcn321/dcn321_fpu.c | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c b/drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c index e573e706430d..b9d3a4000c3d 100644 --- a/drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c +++ b/drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c @@ -2199,6 +2199,7 @@ void dcn32_update_bw_bounding_box_fpu(struct dc *dc, struct clk_bw_params *bw_pa if ((int)(dcn3_2_soc.urgent_latency_us * 1000) != dc->bb_overrides.urgent_latency_ns && dc->bb_overrides.urgent_latency_ns) { dcn3_2_soc.urgent_latency_us = dc->bb_overrides.urgent_latency_ns / 1000.0; + dcn3_2_soc.urgent_latency_pixel_data_only_us = dc->bb_overrides.urgent_latency_ns / 1000.0; } if ((int)(dcn3_2_soc.dram_clock_change_latency_us * 1000) diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn321/dcn321_fpu.c b/drivers/gpu/drm/amd/display/dc/dml/dcn321/dcn321_fpu.c index c87091683b5d..b6369758b491 100644 --- a/drivers/gpu/drm/amd/display/dc/dml/dcn321/dcn321_fpu.c +++ b/drivers/gpu/drm/amd/display/dc/dml/dcn321/dcn321_fpu.c @@ -489,6 +489,7 @@ void dcn321_update_bw_bounding_box_fpu(struct dc *dc, struct clk_bw_params *bw_p if ((int)(dcn3_21_soc.urgent_latency_us * 1000) != dc->bb_overrides.urgent_latency_ns && dc->bb_overrides.urgent_latency_ns) { dcn3_21_soc.urgent_latency_us = dc->bb_overrides.urgent_latency_ns / 1000.0; + dcn3_21_soc.urgent_latency_pixel_data_only_us = dc->bb_overrides.urgent_latency_ns / 1000.0; } if ((int)(dcn3_21_soc.dram_clock_change_latency_us * 1000) From patchwork Wed Oct 19 08:34: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: 4888 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225368wrs; Wed, 19 Oct 2022 02:42:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7nLAstykHUbg2KoctYhqcUDpoYjoj1kpmCEwRlPZTwbFBTgLviE0IpXSvqdiZUXofTUbgd X-Received: by 2002:aa7:c509:0:b0:458:cb1f:b9e1 with SMTP id o9-20020aa7c509000000b00458cb1fb9e1mr6521230edq.369.1666172579438; Wed, 19 Oct 2022 02:42:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172579; cv=none; d=google.com; s=arc-20160816; b=xVst0mHcGmENvi+SN+DF//GDHe5qkEiAyDbun5p+DW4uRTUTqiPweJ35wQ1j1Uu1Xi xpF12dG6IQJEnUS2WpVvG7S3QCeDIAWKUDlu+Rz9WZ9o8mMxzHuYIVKseptQI34KD6Kd rsi1ycxv5uP4e25RmM6kevg7buUWTENXWyj1sbmEgY42f+JaWiPvcUmyQZJdrRz71o7n re8slbD2y6dOiMuojSndKYFiVlSKHGqBW719wouS4r85T+1aRvW/BexU2W7Ba0MzKKu7 QITvt8HiL9LS8ssIGbJwZiROkLuZtN1ooWxGz4NsJ0cow9VZIjc0vL9mS34qYuvUYHtt IOHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Vp+fXyxDtt38GpLqeePToHZfPmDsPSrrTa4w7nYQuec=; b=cYJqJSsbGWiuA2noVpNX9sJa9g4QS1xy4TlEKT8yAjf8YFrkTv3hoddcwrNGsSHUhC wRDnc82PKOF6Aucd94E9ZgGnCPEfynwDun/4pR+pCe7Y/p88d9zQUaI8/GlSMlAt8uMJ SCxHUyb6ZcWZL0ZpYj4L73O8h4R5qPflXhTV+Fo1+i8S0CtLkmthR8AmgAV50MEKSpJo p+/m+wxb9Ep0CFw04M6B7UrUhGA/uiHZzrkLIkGya0uM1H3fROXj+4+8hmpyzBdmkeuW k4P0I+DpA/ruRaDtYxIJI5Gf7BJrfAcg+nthEZtT/Cmp6OPgZ3Z8XpvGVolPsV4CDR5r 1/og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=puHbRf9V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nc1-20020a1709071c0100b007820f6b65c6si14953230ejc.469.2022.10.19.02.42.32; Wed, 19 Oct 2022 02:42: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=puHbRf9V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233639AbiJSJbO (ORCPT + 99 others); Wed, 19 Oct 2022 05:31:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229979AbiJSJ1f (ORCPT ); Wed, 19 Oct 2022 05:27:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0191EE8C41; Wed, 19 Oct 2022 02:12: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 77FB061803; Wed, 19 Oct 2022 09:11:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 88200C433D7; Wed, 19 Oct 2022 09:11:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170703; bh=mX24O1vGgImFyw9AlQ1u4BG7+ZHlcMrj6aWT8XAWarE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=puHbRf9Vrhtb1K1EHUhP+zLBx1GOwtLquqfRVo0FF9yPedRb25V6HZa1vXb9t8483 IgBWM+0MzA0DNqO9cEoKnG1JSxDA22TR+OWhQumjZStmRFehmKVKgbbHRsaNHvgdby lynbFnGimAE3swvVVCT3c0vvpXUwZ+Fa/lHcFIDM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Charlene Liu , Wayne Lin , Sherry Wang , Daniel Wheeler , Alex Deucher , Sasha Levin Subject: [PATCH 6.0 756/862] drm/amd/display: correct hostvm flag Date: Wed, 19 Oct 2022 10:34:03 +0200 Message-Id: <20221019083323.316707365@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108578961564296?= X-GMAIL-MSGID: =?utf-8?q?1747108578961564296?= From: Sherry Wang [ Upstream commit 796d6a37ff5ffaf9f2dc0f3f4bf9f4a1034c00de ] [Why] Hostvm should be enabled/disabled accordding to the status of riommu_active, but hostvm always be disabled on DCN31 which causes underflow [How] Set correct hostvm flag on DCN31 Reviewed-by: Charlene Liu Acked-by: Wayne Lin Signed-off-by: Sherry Wang Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c b/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c index aedff18aff56..2e5a21856eee 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c +++ b/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c @@ -891,7 +891,7 @@ static const struct dc_debug_options debug_defaults_drv = { .optimize_edp_link_rate = true, .enable_sw_cntl_psr = true, .enable_z9_disable_interface = true, /* Allow support for the PMFW interface for disable Z9*/ - .dml_hostvm_override = DML_HOSTVM_OVERRIDE_FALSE, + .dml_hostvm_override = DML_HOSTVM_NO_OVERRIDE, }; static const struct dc_debug_options debug_defaults_diags = { From patchwork Wed Oct 19 08:34: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: 5185 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp263777wrs; Wed, 19 Oct 2022 04:18:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5PIu+oK8nBHFBgmivFOaQhUh4T618me20f5b5P5xO3JSNjd7oVC4gR67yeQuqU3AqMIr4S X-Received: by 2002:a05:6402:1853:b0:459:4e34:2ea5 with SMTP id v19-20020a056402185300b004594e342ea5mr7145427edy.191.1666178324242; Wed, 19 Oct 2022 04:18:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178324; cv=none; d=google.com; s=arc-20160816; b=ieKBZZAsNQ8SZAE6rQ0SnKU91AkU+2P6/Yt/XUF86p0dIH3zp0281qdX13cMwblGf+ H9rZuXduff0BE5nW03iYGpxLzEtfH/61dEFq5na610s0snvg3uHAoS6qN9rXf5641MFX qDLV8f10NSi7mUl1SVwLj9DDPkjWgBaD1hGMPRxaVwibYNAUOMfdtKxnNwftB5UW8eSc ydvAY9jbE0tV7gmEj4KlxnYa5xOHEoM+5TflyTpGCKZoUDOgALTqaeE9Yx4S0ciPa6FL rvIjA6hsYIci0oEwg0vuoqQbyYIiOODDRU65XFQgJfYAY+Thg+4iWJw2Zb0gU9KmPClr ISBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=oWrM3ZblDF16QnG7wJFkpCv003izt5dSUqGwlTU/cxg=; b=zgdWrBvG39A2Dx7xr4DlpF+ibtlgEVI+ylR0Tp88JoW3KgQQkblOLPfsbSjwxsLix/ e3lv0q4JCjSmCWVr4MCtqMeBpynPwYA0n9FPNbFrjXpO1y+LOeyFxRRT09ZPnuam5AO0 860tWlxoQ1ltHmo1EuZCjaT6p0oD0gwYqWwTh7f4RN5MNofukqE2g1tvV+5eA2BZE4Mz J4MIpEZEWgkhg0uRpxpOytIH3Jv6Nm1dBV+zkicYuZuUv3M+zWqsJP5srdqTJkw14wbj 3so/fbSWLuA9JzDCgNtB0LVtjwTaD8fKwVUAGgGOc4zoLuXbtr1Qh4zv6Z2IolF2Z2/U ZWmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oFg0kzcv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a1709065d0900b007317274bb0dsi4645234ejt.979.2022.10.19.04.18.09; Wed, 19 Oct 2022 04:18: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=oFg0kzcv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233995AbiJSLH7 (ORCPT + 99 others); Wed, 19 Oct 2022 07:07:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230389AbiJSLHX (ORCPT ); Wed, 19 Oct 2022 07:07:23 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99A98176537; Wed, 19 Oct 2022 03:36: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 sin.source.kernel.org (Postfix) with ESMTPS id 43C0DCE2189; Wed, 19 Oct 2022 09:11:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 23D7AC433D7; Wed, 19 Oct 2022 09:11:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170706; bh=zvWGShizebvrdEFUd9n0bZ6NDl0vKJL3PrigdSbA9rg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oFg0kzcvZJGzhuBumcey11z1ccn2j+aMp8PBr+vYZ153kFePDHKJ9LSTn7iQ5RP0a pEQwooKHzTBD1EHv+ZuNmxUd5C4ElkGkt5Ie7lfGXZNwHed8VDAhUdtTmXBePm2vMX cAPBAUKY9FWf2asp8ka8KIOFqyyLWL+dGrK8bWao= 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 6.0 757/862] drm/amdgpu: fix initial connector audio value Date: Wed, 19 Oct 2022 10:34:04 +0200 Message-Id: <20221019083323.366193273@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114602410459409?= X-GMAIL-MSGID: =?utf-8?q?1747114602410459409?= 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 b7933c2ce765..491d4846fc02 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c @@ -1674,10 +1674,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; @@ -1799,6 +1801,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, @@ -1852,6 +1855,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, @@ -1902,6 +1906,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 Wed Oct 19 08:34: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: 5137 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp252016wrs; Wed, 19 Oct 2022 03:53:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM70uhiWOJTiVSR3qjkOvnSaEzaqZIt55vrgHvSbNXduYFAfzZw3JVBvMhfsZYxrnE2Wp7r2 X-Received: by 2002:aa7:d5d3:0:b0:458:814c:6d57 with SMTP id d19-20020aa7d5d3000000b00458814c6d57mr6839917eds.186.1666176801448; Wed, 19 Oct 2022 03:53:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176801; cv=none; d=google.com; s=arc-20160816; b=ZDppiLrsSNMTs3zCFn1OXkSsNuQKZPjxLa3d2Js3sbAHDtoUDoAP6aXFusAJ1OEaly ma7IkDPNSEedNxBaOynXPd1hfqSGprkYP/G0/+IPuhZXsQdeazp6ctnNCg2hMbIo5YV4 sv8Q1FFqBEV5jK9lko+U09lsBr7IverlKeXpxqr6106B4RPkcwOdEOWoW+fK3PIhJqQb X7DwzrxtfJoFZ39oXJJ3M5iJA1lI9wVJtQQGwCBtnst9vNC/QT6n8nIwYATY/GmJpwgS rpHOq2QjK91UJriFFSIQUDU9BsbEcivFi1GGhBOK0BV0YnZ08UlyFBQV04wukE6qcdNI 2xWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4iflgzsb02/7aVUuunnKJqoL3vGBnk4LJSqkUqTfCuU=; b=VdTAXnrMRmLN/NaVXVjzPaZxZmYX+yI/fbu+2FzOJUAJEtcVfed12Rn2PvsPpmCqQG 5WZaFCouNFrMV2GMc+zEJeEkbPiTRyf6E6XKgONMDQbTHaB+3ZpJ4TU8OyRv9yrfLswI REZYmXRbOZD8tuwOzVJdOWfqfK2uGg5HjHVgQWJL00ttMYKg75TOgf1thr50qUvMYXBg qwYzVd8CLLzzo8LiMDoWwa1bwRHrTXR/4Mrc0ryHRIvKvN9OsuEei2yQUaDste+fmndl phFAKdOpbP0p3aPbJuCMOrw6zmf7CRWDnZbfMT+dTp3axTatjSl8eDqUfzp8PGKyE9ed ThnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nVcE189A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sb10-20020a1709076d8a00b00780076c3322si14912234ejc.432.2022.10.19.03.52.56; Wed, 19 Oct 2022 03:53:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nVcE189A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234567AbiJSKvZ (ORCPT + 99 others); Wed, 19 Oct 2022 06:51:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234541AbiJSKt1 (ORCPT ); Wed, 19 Oct 2022 06:49:27 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09C41900D4; Wed, 19 Oct 2022 03:22: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 44BCAB824CE; Wed, 19 Oct 2022 09:11:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2238C433D7; Wed, 19 Oct 2022 09:11:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170709; bh=VIlYJ2ErGI6e9UFBzveHWStQsrDkc3EGp6+mnyrVdyw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nVcE189Ao3rZe4yYFoLBpq0R/1+6ZKExaDSn5Wu5ZLhcBARw6kegIr3pU0DGi/GsX 0jEVDZUjcC+tN8zeu7yAR/Mh8G5/r08A9HmQgVdZX45fALEjRkLWl35145wrCsh/th yF0WruOJTjMnoGmPK9Bi1Svs90NIcLvnclWrdGck= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiaoyan Li , Mario Limonciello , Mark Brown , Sasha Levin Subject: [PATCH 6.0 758/862] ASoC: amd: yc: Add ASUS UM5302TA into DMI table Date: Wed, 19 Oct 2022 10:34:05 +0200 Message-Id: <20221019083323.404141151@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747113005746844251?= X-GMAIL-MSGID: =?utf-8?q?1747113005746844251?= From: Xiaoyan Li [ Upstream commit 4df5b13dec9e1b5a12db47ee92eb3f7da5c3deb5 ] ASUS Zenbook S 13 OLED (UM5302TA) needs this quirk to get the built-in microphone working properly. Link: https://bugzilla.kernel.org/show_bug.cgi?id=216270 Signed-off-by: Xiaoyan Li Suggested-by: Mario Limonciello Reviewed-by: Mario Limonciello Signed-off-by: Mario Limonciello Link: https://lore.kernel.org/r/20220920201436.19734-2-mario.limonciello@amd.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/amd/yc/acp6x-mach.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sound/soc/amd/yc/acp6x-mach.c b/sound/soc/amd/yc/acp6x-mach.c index e0b24e1daef3..5eab3baf3573 100644 --- a/sound/soc/amd/yc/acp6x-mach.c +++ b/sound/soc/amd/yc/acp6x-mach.c @@ -171,6 +171,13 @@ static const struct dmi_system_id yc_acp_quirk_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "21J6"), } }, + { + .driver_data = &acp6x_card, + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_PRODUCT_NAME, "UM5302TA"), + } + }, {} }; From patchwork Wed Oct 19 08:34: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: 5193 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp264014wrs; Wed, 19 Oct 2022 04:19:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7LOL4J8ItNuoDE7gl2cp8hl1zNy+lHWCUIlCoMPaNojK4FxKKCmBz9/Z8P1Ey+8Sfp63DK X-Received: by 2002:a05:6402:190e:b0:45c:d10a:4c1a with SMTP id e14-20020a056402190e00b0045cd10a4c1amr6982812edz.345.1666178352633; Wed, 19 Oct 2022 04:19:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178352; cv=none; d=google.com; s=arc-20160816; b=dwHD34ef4Sjm+J3n3UHwCiOXNY5Fz5gQmza1Q3qIySsCPM9X3IbEQ7MDYGdai1gmo2 WS7U9ciWE8gp1CGvq3bgZ/A5OA+zG99Zlp5xlRFDR42VyxUAi+3Y+RFElF4T4tZOFYBP oqh/t0sOWbg6DoAKdFrw2jSYhwvTLMKYAeWsD8S+pnmReSp+PsanUBJNDeD2ErWNGvr7 5bAIBMupogxggrrxUzF/b6n9ZVRDpJpIZUgsZgRiWg/YMFQdSZFaZ7YAFA+NRlkrofnk qx3gSdP2pBoEMIuUqqkLhvQdvAkzVwM/zcLolRUo3+IWv+A/J/Nxa33aIRdLDDQ5KiSJ PssQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Kcs9ji2b6iWjIRyg51Os7bdjwOlUaukGXtsCF07zWuQ=; b=CgQIMfNaWtM0gdxQEv05ZBWGrWVEk1Gv/KueXkdR8tfxtlzT1BO3pKRQfzkH6lTd8v e2B3itEGfq+IyBmc9CqAOsEhm9SS4m/B4ZMQjeEH0+WJ+z4aZf1u8kQ5yOK3mrHplmSE V01Qzn342yjHsrUQWTmJJX5CewZjSsYNTcrDmY9TGwFTJtw5YQcYFq8mN8oLCprHaqAq oHhQSaRXBD3nfpKkvdoxnvEER+KWX25Q5lcHfL4SPGzY/nFaj1rIq2y4gvo7sy7Pmhdi +u0INPN+42GAtyGcdnn+eqlh3UHybXv3hQHPEUgH3olM4RpK3Y832t9PoVZnmMWCXNLO uLYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wjkqqDX8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mp9-20020a1709071b0900b0078e28a52d58si13530302ejc.874.2022.10.19.04.18.18; Wed, 19 Oct 2022 04:19: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=wjkqqDX8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233166AbiJSLID (ORCPT + 99 others); Wed, 19 Oct 2022 07:08:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232316AbiJSLHZ (ORCPT ); Wed, 19 Oct 2022 07:07:25 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9981C176533; Wed, 19 Oct 2022 03:36: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 sin.source.kernel.org (Postfix) with ESMTPS id 2E4CCCE21B5; Wed, 19 Oct 2022 09:11:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4EB3EC433D6; Wed, 19 Oct 2022 09:11:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170711; bh=92eQYMkXiqh2tRjqU7wqolS9xclS+SWR5TXgeWI09vw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wjkqqDX8PXNsjHC3svv8D21Ru4ZL0s62HyXsIAIQ93Q9jWt+qjGqwi1O0aVtQwud2 vUmQBfzOhmQVwcPvX4CZ0iEbSFvCJdL+QpmdgymreADyrvaHApHEjF1oI5aiZAcZUD 9pyJeUf3+aBy2jhBgJfQ8KF8yc9XqiyMqm+wrUWA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sebastian S , Mario Limonciello , Mark Brown , Sasha Levin , Travis Glenn Hansen Subject: [PATCH 6.0 759/862] ASoC: amd: yc: Add Lenovo Yoga Slim 7 Pro X to quirks table Date: Wed, 19 Oct 2022 10:34:06 +0200 Message-Id: <20221019083323.444904947@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114632237860223?= X-GMAIL-MSGID: =?utf-8?q?1747114632237860223?= From: Mario Limonciello [ Upstream commit 2232b2dd8cd4f1e6d554b2c3f6899ce36f791b67 ] Lenovo Yoga Slim 7 Pro X has an ACP DMIC that isn't specified in the ASL or existing quirk list. Add it to the quirk table to let DMIC work on these systems. Link: https://bugzilla.kernel.org/show_bug.cgi?id=216299 Tested-by: Sebastian S Reported-and-tested-by: Travis Glenn Hansen Signed-off-by: Mario Limonciello Link: https://lore.kernel.org/r/20220920201436.19734-3-mario.limonciello@amd.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/amd/yc/acp6x-mach.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sound/soc/amd/yc/acp6x-mach.c b/sound/soc/amd/yc/acp6x-mach.c index 5eab3baf3573..2cb50d5cf1a9 100644 --- a/sound/soc/amd/yc/acp6x-mach.c +++ b/sound/soc/amd/yc/acp6x-mach.c @@ -171,6 +171,13 @@ static const struct dmi_system_id yc_acp_quirk_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "21J6"), } }, + { + .driver_data = &acp6x_card, + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), + DMI_MATCH(DMI_PRODUCT_NAME, "82"), + } + }, { .driver_data = &acp6x_card, .matches = { From patchwork Wed Oct 19 08:34:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5135 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp251842wrs; Wed, 19 Oct 2022 03:52:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4EvpkwPOdvOt1V4oON9AJ2LbK/gsOuhKTkUTkCfmDM8Wz8dhVF9ZU8KsXcjzDCG/gr3Y+1 X-Received: by 2002:a17:906:58d2:b0:78d:9d2f:3005 with SMTP id e18-20020a17090658d200b0078d9d2f3005mr5905419ejs.697.1666176769959; Wed, 19 Oct 2022 03:52:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176769; cv=none; d=google.com; s=arc-20160816; b=PS4xnWABXO6Hwrfofriel5FN04wmVwXY0+QIgMyR5I5Y7tn9NkLdwiyzmy4j01+mZ+ I5r58Fu3AjsJV6avtDTcOZTJPWRlQ1b629yMqnuffBqcZB8vUz7RAz4YryZvE8oPvhQG zCiIJJHKXJQ+B3Mc2kJP96G6qJ55PsiJFI8e8hBR1Cc7CsPuLMGOEGR57KD7Un6jMveE 8lYoG5nBTzBa/15pmkqFiSIMN1FU9GvdAnK+i9V8KWHU2SgOovI56KRm4CdEE7XGD9Xt l2U2KZjrLdhbsPC6XBOjk6e4mYGnlHrhBxyy9ANXfzzUp+cULcjJLgL98A/ISsGYbUOO AlIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=byk8dukZUgOfEz/hwrYh6XtljyfOBPNN38YFi468OBs=; b=a66cIo1J66uVHT8m3Zj7GB5goSTczhkH8wteRzrAwShyaZE6S1qLv4HenVr6f2/5oP ttrhMv7wytQojQbynV+Hi9KT+HLMgFdhFZ4waS6LlK8kvTFaH9PgM4O9ABEBrnsg9MJ6 K/yxi2TQsXfsL1vZp4w+BXfdRnvrZ4cJP29QVpNNipekbTW5GDe3cJ2+sJRyaeWHCahg VrsT9vt3BmL9aJEy6SM08+dH4yNd2HDXV9HqjjNHn5HyOkpiTsQeMtTUvdDlZgLWRfYF 7P7rudsu8eWkClcEyiYhUD4Y8ZnXFU10mVK/mZWoLFkV6r2EkxWvO7yDlKP/lTXESrPF mU5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Is6fg+Nx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hv12-20020a17090760cc00b00780e89ce0b0si14919698ejc.600.2022.10.19.03.52.25; Wed, 19 Oct 2022 03:52: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=Is6fg+Nx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234540AbiJSKvU (ORCPT + 99 others); Wed, 19 Oct 2022 06:51:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234519AbiJSKtX (ORCPT ); Wed, 19 Oct 2022 06:49:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17D07149DCF; Wed, 19 Oct 2022 03:22: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 98C04B824BA; Wed, 19 Oct 2022 09:11:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9C4FC433C1; Wed, 19 Oct 2022 09:11:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170714; bh=5aAshN+FiXLo+cw/dQPsDHOuHlVtKNPBBkoCEdY0WK8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Is6fg+Nx9m01jfCmzGnMKVdXkmzSQHUYYL8cHAnl++DQ8pOP3QC1OTt3BbjeD74AR d4d4T7EX8kH6AK3zHuo9rhxTAVhF9jv0WrtT2tadYV99bVSON+S1HvXFdon6k6/X32 FSCNsMk7ffwIgneZtGPO0Jy9YajbKS26UgVv4np0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Adri=C3=A1n_Larumbe?= , Neil Armstrong , Sasha Levin Subject: [PATCH 6.0 760/862] drm/meson: reorder driver deinit sequence to fix use-after-free bug Date: Wed, 19 Oct 2022 10:34:07 +0200 Message-Id: <20221019083323.493107831@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112972695679249?= X-GMAIL-MSGID: =?utf-8?q?1747112972695679249?= From: Adrián Larumbe [ Upstream commit 31c519981eb141c7ec39bfd5be25d35f02edb868 ] Unloading the driver triggers the following KASAN warning: [ +0.006275] ============================================================= [ +0.000029] BUG: KASAN: use-after-free in __list_del_entry_valid+0xe0/0x1a0 [ +0.000026] Read of size 8 at addr ffff000020c395e0 by task rmmod/2695 [ +0.000019] CPU: 5 PID: 2695 Comm: rmmod Tainted: G C O 5.19.0-rc6-lrmbkasan+ #1 [ +0.000013] Hardware name: Hardkernel ODROID-N2Plus (DT) [ +0.000008] Call trace: [ +0.000007] dump_backtrace+0x1ec/0x280 [ +0.000013] show_stack+0x24/0x80 [ +0.000008] dump_stack_lvl+0x98/0xd4 [ +0.000011] print_address_description.constprop.0+0x80/0x520 [ +0.000011] print_report+0x128/0x260 [ +0.000007] kasan_report+0xb8/0xfc [ +0.000008] __asan_report_load8_noabort+0x3c/0x50 [ +0.000010] __list_del_entry_valid+0xe0/0x1a0 [ +0.000009] drm_atomic_private_obj_fini+0x30/0x200 [drm] [ +0.000172] drm_bridge_detach+0x94/0x260 [drm] [ +0.000145] drm_encoder_cleanup+0xa4/0x290 [drm] [ +0.000144] drm_mode_config_cleanup+0x118/0x740 [drm] [ +0.000143] drm_mode_config_init_release+0x1c/0x2c [drm] [ +0.000144] drm_managed_release+0x170/0x414 [drm] [ +0.000142] drm_dev_put.part.0+0xc0/0x124 [drm] [ +0.000143] drm_dev_put+0x20/0x30 [drm] [ +0.000142] meson_drv_unbind+0x1d8/0x2ac [meson_drm] [ +0.000028] take_down_aggregate_device+0xb0/0x160 [ +0.000016] component_del+0x18c/0x360 [ +0.000009] meson_dw_hdmi_remove+0x28/0x40 [meson_dw_hdmi] [ +0.000015] platform_remove+0x64/0xb0 [ +0.000009] device_remove+0xb8/0x154 [ +0.000009] device_release_driver_internal+0x398/0x5b0 [ +0.000009] driver_detach+0xac/0x1b0 [ +0.000009] bus_remove_driver+0x158/0x29c [ +0.000009] driver_unregister+0x70/0xb0 [ +0.000008] platform_driver_unregister+0x20/0x2c [ +0.000008] meson_dw_hdmi_platform_driver_exit+0x1c/0x30 [meson_dw_hdmi] [ +0.000012] __do_sys_delete_module+0x288/0x400 [ +0.000011] __arm64_sys_delete_module+0x5c/0x80 [ +0.000009] invoke_syscall+0x74/0x260 [ +0.000009] el0_svc_common.constprop.0+0xcc/0x260 [ +0.000009] do_el0_svc+0x50/0x70 [ +0.000007] el0_svc+0x68/0x1a0 [ +0.000012] el0t_64_sync_handler+0x11c/0x150 [ +0.000008] el0t_64_sync+0x18c/0x190 [ +0.000018] Allocated by task 0: [ +0.000007] (stack is not available) [ +0.000011] Freed by task 2695: [ +0.000008] kasan_save_stack+0x2c/0x5c [ +0.000011] kasan_set_track+0x2c/0x40 [ +0.000008] kasan_set_free_info+0x28/0x50 [ +0.000009] ____kasan_slab_free+0x128/0x1d4 [ +0.000008] __kasan_slab_free+0x18/0x24 [ +0.000007] slab_free_freelist_hook+0x108/0x230 [ +0.000011] kfree+0x110/0x35c [ +0.000008] release_nodes+0xf0/0x16c [ +0.000009] devres_release_group+0x180/0x270 [ +0.000008] component_unbind+0x128/0x1e0 [ +0.000010] component_unbind_all+0x1b8/0x264 [ +0.000009] meson_drv_unbind+0x1a0/0x2ac [meson_drm] [ +0.000025] take_down_aggregate_device+0xb0/0x160 [ +0.000009] component_del+0x18c/0x360 [ +0.000009] meson_dw_hdmi_remove+0x28/0x40 [meson_dw_hdmi] [ +0.000012] platform_remove+0x64/0xb0 [ +0.000008] device_remove+0xb8/0x154 [ +0.000009] device_release_driver_internal+0x398/0x5b0 [ +0.000009] driver_detach+0xac/0x1b0 [ +0.000009] bus_remove_driver+0x158/0x29c [ +0.000008] driver_unregister+0x70/0xb0 [ +0.000008] platform_driver_unregister+0x20/0x2c [ +0.000008] meson_dw_hdmi_platform_driver_exit+0x1c/0x30 [meson_dw_hdmi] [ +0.000011] __do_sys_delete_module+0x288/0x400 [ +0.000010] __arm64_sys_delete_module+0x5c/0x80 [ +0.000008] invoke_syscall+0x74/0x260 [ +0.000008] el0_svc_common.constprop.0+0xcc/0x260 [ +0.000008] do_el0_svc+0x50/0x70 [ +0.000007] el0_svc+0x68/0x1a0 [ +0.000009] el0t_64_sync_handler+0x11c/0x150 [ +0.000009] el0t_64_sync+0x18c/0x190 [ +0.000014] The buggy address belongs to the object at ffff000020c39000 which belongs to the cache kmalloc-4k of size 4096 [ +0.000008] The buggy address is located 1504 bytes inside of 4096-byte region [ffff000020c39000, ffff000020c3a000) [ +0.000016] The buggy address belongs to the physical page: [ +0.000009] page:fffffc0000830e00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x20c38 [ +0.000013] head:fffffc0000830e00 order:3 compound_mapcount:0 compound_pincount:0 [ +0.000008] flags: 0xffff00000010200(slab|head|node=0|zone=0|lastcpupid=0xffff) [ +0.000019] raw: 0ffff00000010200 fffffc0000fd4808 fffffc0000126208 ffff000000002e80 [ +0.000009] raw: 0000000000000000 0000000000020002 00000001ffffffff 0000000000000000 [ +0.000008] page dumped because: kasan: bad access detected [ +0.000011] Memory state around the buggy address: [ +0.000008] ffff000020c39480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000007] ffff000020c39500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000007] >ffff000020c39580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000007] ^ [ +0.000007] ffff000020c39600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000007] ffff000020c39680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000006] ================================================================== The reason this is happening is unloading meson-dw-hdmi will cause the component API to take down the aggregate device, which in turn will cause all devres-managed memory to be freed, including the struct dw_hdmi allocated in dw_hdmi_probe. This struct embeds a struct drm_bridge that is added at the end of the function, and which is later on picked up in meson_encoder_hdmi_init. However, when attaching the bridge to the encoder created in meson_encoder_hdmi_init, it's linked to the encoder's bridge chain, from where it never leaves, even after devres_release_group is called when the driver's components are unbound and the embedding structure freed. Then, when calling drm_dev_put in the aggregate driver's unbind function, drm_bridge_detach is called for every single bridge linked to the encoder, including the one whose memory had already been deallocated. Fix by calling component_unbind_all after drm_dev_put. Signed-off-by: Adrián Larumbe Reviewed-by: Neil Armstrong Signed-off-by: Neil Armstrong Link: https://patchwork.freedesktop.org/patch/msgid/20220919010940.419893-2-adrian.larumbe@collabora.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/meson/meson_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c index bd4ca11d3ff5..7df149d42728 100644 --- a/drivers/gpu/drm/meson/meson_drv.c +++ b/drivers/gpu/drm/meson/meson_drv.c @@ -388,9 +388,9 @@ static void meson_drv_unbind(struct device *dev) drm_dev_unregister(drm); drm_kms_helper_poll_fini(drm); drm_atomic_helper_shutdown(drm); - component_unbind_all(dev, drm); free_irq(priv->vsync_irq, drm); drm_dev_put(drm); + component_unbind_all(dev, drm); if (priv->afbcd.ops) priv->afbcd.ops->exit(priv); From patchwork Wed Oct 19 08:34:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5204 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp264498wrs; Wed, 19 Oct 2022 04:20:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM60058DS7ZFqlFWY6Mjp2hZ67xHEc0/PbAJ6h2VJRgRTf4vaOu7omMhPI972O1xdiT0gV8D X-Received: by 2002:a17:90b:2812:b0:20d:7a3b:df3e with SMTP id qb18-20020a17090b281200b0020d7a3bdf3emr45040702pjb.169.1666178410677; Wed, 19 Oct 2022 04:20:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178410; cv=none; d=google.com; s=arc-20160816; b=wi9OIrT/gzuBlFIsVWLJ+NisYOz1IaW45hjLKZlrFsO8TQPenKmVwtsqF7dOdv48Of 3oAAMcvP4Sd7S5izLupSIMm7cKDqcW9sj6IV3npHIciPnmCmn51MHopYsWGo+zfyZLLa acja2T3w3KgIGYh82ABL+/AOEhdtmxuu4/Q66vWcVDgZiXW7KcsotcE3YCCiefp9qR6H MMolZoxXkKvUAFnEmhsIkc40IQ35CMwdoDPB7109M8zsfUGDbLfKvVc0QdBTaWkEmOQ0 GBmWxMfgcEqUBHIY4fh1GBgugIeLb6syle4WqqHddX1kpsgRoMT0uA+Mjq6KQeO3R+r+ j5Yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=G8TwT/qhJK3P8UPb7pRxzGyJzW8U+u/MVCkfmTVfpL4=; b=S/J5BzFDKYbdfJdnV+ZsvEhUnSht2N8bGaEZAp51ag8tYO0z5lKXp6NryoEvwl4oqY lG6ilyX+IsKI0op4vxBG9Q5Esh3geIGYjPBfVnLBSeoUey3zlwNLtaRzHs/CLk+WiwdV AOkvrCp/nnO8ZrpUbeB6vLg/Ctcx1C+n2ZvxGAM4UbV5kx9T2LjHFya/Ah7XQz5Ln4uW +a3NStant12E+9Gn3i+nbZbpDLCirzC5k5wy5YwaDMk/tfJ9ut3X8QZNWArOWJKBXHwV 09wEOyHYOhlSIYNfWS7XqcNf1mVzFAvk7k2xsrJOkvAr6quqgIT2O5ssqZOD7+3u6ye+ jtcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rd4dMwmO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bf6-20020a170902b90600b00176b26d519dsi16690208plb.350.2022.10.19.04.19.56; Wed, 19 Oct 2022 04:20: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=rd4dMwmO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231667AbiJSLJp (ORCPT + 99 others); Wed, 19 Oct 2022 07:09:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229795AbiJSLIu (ORCPT ); Wed, 19 Oct 2022 07:08:50 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C2F017D855; Wed, 19 Oct 2022 03:37:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 9363FCE21B2; Wed, 19 Oct 2022 09:11:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7627EC433C1; Wed, 19 Oct 2022 09:11:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170716; bh=VPX5uY0+vC4kQAyQ2AZ1elDZASWNeRriFOJsrmT6Rtc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rd4dMwmORqAhGWxdCyFi7V5A54yHakOSR61nz3iUB2Z29g1sSBV87zKsnfM8qIKKN 84btkI0ZtpjMedN6NvTxb8TzIH0gpGQ1fSawPw09h90gk18D89YH+VzOFSVwpEq6fx /aGJWDzLqC9v0BvcRBs05RNTWQeBNxdY7WaNI3/k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Adri=C3=A1n_Larumbe?= , Neil Armstrong , Sasha Levin Subject: [PATCH 6.0 761/862] drm/meson: explicitly remove aggregate driver at module unload time Date: Wed, 19 Oct 2022 10:34:08 +0200 Message-Id: <20221019083323.530648740@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114693012329084?= X-GMAIL-MSGID: =?utf-8?q?1747114693012329084?= From: Adrián Larumbe [ Upstream commit 8616f2a0589a80e08434212324250eb22f6a66ce ] Because component_master_del wasn't being called when unloading the meson_drm module, the aggregate device would linger forever in the global aggregate_devices list. That means when unloading and reloading the meson_dw_hdmi module, component_add would call into try_to_bring_up_aggregate_device and find the unbound meson_drm aggregate device. This would in turn dereference some of the aggregate_device's struct entries which point to memory automatically freed by the devres API when unbinding the aggregate device from meson_drv_unbind, and trigger an use-after-free bug: [ +0.000014] ============================================================= [ +0.000007] BUG: KASAN: use-after-free in find_components+0x468/0x500 [ +0.000017] Read of size 8 at addr ffff000006731688 by task modprobe/2536 [ +0.000018] CPU: 4 PID: 2536 Comm: modprobe Tainted: G C O 5.19.0-rc6-lrmbkasan+ #1 [ +0.000010] Hardware name: Hardkernel ODROID-N2Plus (DT) [ +0.000008] Call trace: [ +0.000005] dump_backtrace+0x1ec/0x280 [ +0.000011] show_stack+0x24/0x80 [ +0.000007] dump_stack_lvl+0x98/0xd4 [ +0.000010] print_address_description.constprop.0+0x80/0x520 [ +0.000011] print_report+0x128/0x260 [ +0.000007] kasan_report+0xb8/0xfc [ +0.000007] __asan_report_load8_noabort+0x3c/0x50 [ +0.000009] find_components+0x468/0x500 [ +0.000008] try_to_bring_up_aggregate_device+0x64/0x390 [ +0.000009] __component_add+0x1dc/0x49c [ +0.000009] component_add+0x20/0x30 [ +0.000008] meson_dw_hdmi_probe+0x28/0x34 [meson_dw_hdmi] [ +0.000013] platform_probe+0xd0/0x220 [ +0.000008] really_probe+0x3ac/0xa80 [ +0.000008] __driver_probe_device+0x1f8/0x400 [ +0.000008] driver_probe_device+0x68/0x1b0 [ +0.000008] __driver_attach+0x20c/0x480 [ +0.000009] bus_for_each_dev+0x114/0x1b0 [ +0.000007] driver_attach+0x48/0x64 [ +0.000009] bus_add_driver+0x390/0x564 [ +0.000007] driver_register+0x1a8/0x3e4 [ +0.000009] __platform_driver_register+0x6c/0x94 [ +0.000007] meson_dw_hdmi_platform_driver_init+0x30/0x1000 [meson_dw_hdmi] [ +0.000014] do_one_initcall+0xc4/0x2b0 [ +0.000008] do_init_module+0x154/0x570 [ +0.000010] load_module+0x1a78/0x1ea4 [ +0.000008] __do_sys_init_module+0x184/0x1cc [ +0.000008] __arm64_sys_init_module+0x78/0xb0 [ +0.000008] invoke_syscall+0x74/0x260 [ +0.000008] el0_svc_common.constprop.0+0xcc/0x260 [ +0.000009] do_el0_svc+0x50/0x70 [ +0.000008] el0_svc+0x68/0x1a0 [ +0.000009] el0t_64_sync_handler+0x11c/0x150 [ +0.000009] el0t_64_sync+0x18c/0x190 [ +0.000014] Allocated by task 902: [ +0.000007] kasan_save_stack+0x2c/0x5c [ +0.000009] __kasan_kmalloc+0x90/0xd0 [ +0.000007] __kmalloc_node+0x240/0x580 [ +0.000010] memcg_alloc_slab_cgroups+0xa4/0x1ac [ +0.000010] memcg_slab_post_alloc_hook+0xbc/0x4c0 [ +0.000008] kmem_cache_alloc_node+0x1d0/0x490 [ +0.000009] __alloc_skb+0x1d4/0x310 [ +0.000010] alloc_skb_with_frags+0x8c/0x620 [ +0.000008] sock_alloc_send_pskb+0x5ac/0x6d0 [ +0.000010] unix_dgram_sendmsg+0x2e0/0x12f0 [ +0.000010] sock_sendmsg+0xcc/0x110 [ +0.000007] sock_write_iter+0x1d0/0x304 [ +0.000008] new_sync_write+0x364/0x460 [ +0.000007] vfs_write+0x420/0x5ac [ +0.000008] ksys_write+0x19c/0x1f0 [ +0.000008] __arm64_sys_write+0x78/0xb0 [ +0.000007] invoke_syscall+0x74/0x260 [ +0.000008] el0_svc_common.constprop.0+0x1a8/0x260 [ +0.000009] do_el0_svc+0x50/0x70 [ +0.000007] el0_svc+0x68/0x1a0 [ +0.000008] el0t_64_sync_handler+0x11c/0x150 [ +0.000008] el0t_64_sync+0x18c/0x190 [ +0.000013] Freed by task 2509: [ +0.000008] kasan_save_stack+0x2c/0x5c [ +0.000007] kasan_set_track+0x2c/0x40 [ +0.000008] kasan_set_free_info+0x28/0x50 [ +0.000008] ____kasan_slab_free+0x128/0x1d4 [ +0.000008] __kasan_slab_free+0x18/0x24 [ +0.000007] slab_free_freelist_hook+0x108/0x230 [ +0.000010] kfree+0x110/0x35c [ +0.000008] release_nodes+0xf0/0x16c [ +0.000008] devres_release_all+0xfc/0x180 [ +0.000008] device_unbind_cleanup+0x24/0x164 [ +0.000008] device_release_driver_internal+0x3e8/0x5b0 [ +0.000010] driver_detach+0xac/0x1b0 [ +0.000008] bus_remove_driver+0x158/0x29c [ +0.000008] driver_unregister+0x70/0xb0 [ +0.000009] platform_driver_unregister+0x20/0x2c [ +0.000007] 0xffff800003722d98 [ +0.000012] __do_sys_delete_module+0x288/0x400 [ +0.000009] __arm64_sys_delete_module+0x5c/0x80 [ +0.000008] invoke_syscall+0x74/0x260 [ +0.000008] el0_svc_common.constprop.0+0xcc/0x260 [ +0.000008] do_el0_svc+0x50/0x70 [ +0.000007] el0_svc+0x68/0x1a0 [ +0.000008] el0t_64_sync_handler+0x11c/0x150 [ +0.000009] el0t_64_sync+0x18c/0x190 [ +0.000013] Last potentially related work creation: [ +0.000007] kasan_save_stack+0x2c/0x5c [ +0.000007] __kasan_record_aux_stack+0xb8/0xf0 [ +0.000009] kasan_record_aux_stack_noalloc+0x14/0x20 [ +0.000008] insert_work+0x54/0x290 [ +0.000009] __queue_work+0x48c/0xd24 [ +0.000008] queue_work_on+0x90/0x11c [ +0.000008] call_usermodehelper_exec+0x188/0x404 [ +0.000010] kobject_uevent_env+0x5a8/0x794 [ +0.000010] kobject_uevent+0x14/0x20 [ +0.000008] driver_register+0x230/0x3e4 [ +0.000009] __platform_driver_register+0x6c/0x94 [ +0.000007] gxbb_driver_init+0x28/0x34 [ +0.000010] do_one_initcall+0xc4/0x2b0 [ +0.000008] do_initcalls+0x20c/0x24c [ +0.000010] kernel_init_freeable+0x22c/0x278 [ +0.000009] kernel_init+0x3c/0x170 [ +0.000008] ret_from_fork+0x10/0x20 [ +0.000013] The buggy address belongs to the object at ffff000006731600 which belongs to the cache kmalloc-256 of size 256 [ +0.000009] The buggy address is located 136 bytes inside of 256-byte region [ffff000006731600, ffff000006731700) [ +0.000015] The buggy address belongs to the physical page: [ +0.000008] page:fffffc000019cc00 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff000006730a00 pfn:0x6730 [ +0.000011] head:fffffc000019cc00 order:2 compound_mapcount:0 compound_pincount:0 [ +0.000008] flags: 0xffff00000010200(slab|head|node=0|zone=0|lastcpupid=0xffff) [ +0.000016] raw: 0ffff00000010200 fffffc00000c3d08 fffffc0000ef2b08 ffff000000002680 [ +0.000009] raw: ffff000006730a00 0000000000150014 00000001ffffffff 0000000000000000 [ +0.000006] page dumped because: kasan: bad access detected [ +0.000011] Memory state around the buggy address: [ +0.000007] ffff000006731580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ +0.000007] ffff000006731600: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000007] >ffff000006731680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000007] ^ [ +0.000006] ffff000006731700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ +0.000007] ffff000006731780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ +0.000006] ================================================================== Fix by adding 'remove' driver callback for meson-drm, and explicitly deleting the aggregate device. Signed-off-by: Adrián Larumbe Reviewed-by: Neil Armstrong Signed-off-by: Neil Armstrong Link: https://patchwork.freedesktop.org/patch/msgid/20220919010940.419893-3-adrian.larumbe@collabora.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/meson/meson_drv.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c index 7df149d42728..8444d90165fb 100644 --- a/drivers/gpu/drm/meson/meson_drv.c +++ b/drivers/gpu/drm/meson/meson_drv.c @@ -493,6 +493,13 @@ static int meson_drv_probe(struct platform_device *pdev) return 0; }; +static int meson_drv_remove(struct platform_device *pdev) +{ + component_master_del(&pdev->dev, &meson_drv_master_ops); + + return 0; +} + static struct meson_drm_match_data meson_drm_gxbb_data = { .compat = VPU_COMPATIBLE_GXBB, }; @@ -530,6 +537,7 @@ static const struct dev_pm_ops meson_drv_pm_ops = { static struct platform_driver meson_drm_platform_driver = { .probe = meson_drv_probe, + .remove = meson_drv_remove, .shutdown = meson_drv_shutdown, .driver = { .name = "meson-drm", From patchwork Wed Oct 19 08:34:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5182 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp263675wrs; Wed, 19 Oct 2022 04:18:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM639bk4j+CBdZevf3LkWi7Hcl7gc7F3di19XMXguhAtyKt39gmEB9Ifg614k0MJ8+cvuJ+1 X-Received: by 2002:a17:907:7214:b0:791:a4cf:5bb7 with SMTP id dr20-20020a170907721400b00791a4cf5bb7mr3593306ejc.576.1666178312060; Wed, 19 Oct 2022 04:18:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178312; cv=none; d=google.com; s=arc-20160816; b=BiAFdWXE7Em0/zMRpt8IYY0hdIO9elPW4USSyuv5MUgU9/Uh47V5LM3IwtbyRXru0j zwReAJtFev7hnIovugY447OR83D77X93cuyIRmi1oDnCZkbxE0tsmol65uQM/LM5f7oc 2gorr8eQ2e7AH1aoaAPAr6/zwbIu01a95WtZp9C6eHtRi95Ne0GAnPNdzLAmdazl8tOM M2kNAxO0P8nV7Jr9iiuw9lCMgVSHz9yoTfa9h5lLhC+CdwiezmCHlLDlAYSsuGvA0LsE UO9fCubH48x/B2lDiRILfap9BKs9I2EDnTJ/drPz9DlDiKQwS/nTQVYKfxipmJehqqUM nzFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DawctbPGY4WSiRTTAeSQ712hhauHOGnhsEGGfTQ80MA=; b=k3Y9zZCHPVHEFHBRfO8zdSPxfysyA6v2pzf0f2dIeGGiHel743D/iAj1wO//HwI7qP aMB782Qlw/RRXBAx8xAUgkaXXYknPlRFzVgBZCCX4hmL3li4h67dRZ3diw43E9EDDF52 ZSseTYuU4/PHNzSkVQjP1ajbV4cUy8cm7+ltfwxIEc06EL7E+1MNUy86Y3T2Z4xMfMSN ob1Bjruc6PfPumILAvEqLtCg2TG919ES33S9t0JX2a9o3frTAqGvFTR5xKEsYfk+DB32 Ztc5orJ6FHRwpZJvJtYprkeMOskEEr7h7acC/YQ2iCWnrA/Tp5DEjgKWkr4GkkLbZ7tM EogA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KLGaXsEU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jg16-20020a170907971000b00782686da1d1si13100812ejc.761.2022.10.19.04.18.00; Wed, 19 Oct 2022 04:18: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=KLGaXsEU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232888AbiJSLHp (ORCPT + 99 others); Wed, 19 Oct 2022 07:07:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232163AbiJSLHJ (ORCPT ); Wed, 19 Oct 2022 07:07:09 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D08ADFFE; Wed, 19 Oct 2022 03:36: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 sin.source.kernel.org (Postfix) with ESMTPS id 10D97CE21AE; Wed, 19 Oct 2022 09:12:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0FB28C433D6; Wed, 19 Oct 2022 09:11:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170719; bh=IkVn7xMVCxtUE2aM/RM2gSvcJxLmvWVm8OQeZMUirdA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KLGaXsEU9qJv5AVz/hz0VdF78Wh3JbBWCWoERvexSDxcikq3QQXWWjo5+PWPscpSY 6Fvrt+CY9unSGlMuIE5ZHtZ9gy6ppCi5H07exFGE+YPhzoQOLJvsivGcrRV20UJ8kk 44Q1dafBjSDdp7k65TUiaXuO+f/l/HgaTLzKUfV4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Adri=C3=A1n_Larumbe?= , Neil Armstrong , Sasha Levin Subject: [PATCH 6.0 762/862] drm/meson: remove drm bridges at aggregate driver unbind time Date: Wed, 19 Oct 2022 10:34:09 +0200 Message-Id: <20221019083323.580957378@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114589674643261?= X-GMAIL-MSGID: =?utf-8?q?1747114589674643261?= From: Adrián Larumbe [ Upstream commit 09847723c12fc2753749cec3939a02ee92dac468 ] drm bridges added by meson_encoder_hdmi_init and meson_encoder_cvbs_init were not manually removed at module unload time, which caused dangling references to freed memory to remain linked in the global bridge_list. When loading the driver modules back in, the same functions would again call drm_bridge_add, and when traversing the global bridge_list, would end up peeking into freed memory. Once again KASAN revealed the problem: [ +0.000095] ============================================================= [ +0.000008] BUG: KASAN: use-after-free in __list_add_valid+0x9c/0x120 [ +0.000018] Read of size 8 at addr ffff00003da291f0 by task modprobe/2483 [ +0.000018] CPU: 3 PID: 2483 Comm: modprobe Tainted: G C O 5.19.0-rc6-lrmbkasan+ #1 [ +0.000011] Hardware name: Hardkernel ODROID-N2Plus (DT) [ +0.000008] Call trace: [ +0.000006] dump_backtrace+0x1ec/0x280 [ +0.000012] show_stack+0x24/0x80 [ +0.000008] dump_stack_lvl+0x98/0xd4 [ +0.000011] print_address_description.constprop.0+0x80/0x520 [ +0.000011] print_report+0x128/0x260 [ +0.000008] kasan_report+0xb8/0xfc [ +0.000008] __asan_report_load8_noabort+0x3c/0x50 [ +0.000009] __list_add_valid+0x9c/0x120 [ +0.000009] drm_bridge_add+0x6c/0x104 [drm] [ +0.000165] dw_hdmi_probe+0x1900/0x2360 [dw_hdmi] [ +0.000022] meson_dw_hdmi_bind+0x520/0x814 [meson_dw_hdmi] [ +0.000014] component_bind+0x174/0x520 [ +0.000012] component_bind_all+0x1a8/0x38c [ +0.000010] meson_drv_bind_master+0x5e8/0xb74 [meson_drm] [ +0.000032] meson_drv_bind+0x20/0x2c [meson_drm] [ +0.000027] try_to_bring_up_aggregate_device+0x19c/0x390 [ +0.000010] component_master_add_with_match+0x1c8/0x284 [ +0.000009] meson_drv_probe+0x274/0x280 [meson_drm] [ +0.000026] platform_probe+0xd0/0x220 [ +0.000009] really_probe+0x3ac/0xa80 [ +0.000009] __driver_probe_device+0x1f8/0x400 [ +0.000009] driver_probe_device+0x68/0x1b0 [ +0.000009] __driver_attach+0x20c/0x480 [ +0.000008] bus_for_each_dev+0x114/0x1b0 [ +0.000009] driver_attach+0x48/0x64 [ +0.000008] bus_add_driver+0x390/0x564 [ +0.000009] driver_register+0x1a8/0x3e4 [ +0.000009] __platform_driver_register+0x6c/0x94 [ +0.000008] meson_drm_platform_driver_init+0x3c/0x1000 [meson_drm] [ +0.000027] do_one_initcall+0xc4/0x2b0 [ +0.000011] do_init_module+0x154/0x570 [ +0.000011] load_module+0x1a78/0x1ea4 [ +0.000008] __do_sys_init_module+0x184/0x1cc [ +0.000009] __arm64_sys_init_module+0x78/0xb0 [ +0.000009] invoke_syscall+0x74/0x260 [ +0.000009] el0_svc_common.constprop.0+0xcc/0x260 [ +0.000008] do_el0_svc+0x50/0x70 [ +0.000007] el0_svc+0x68/0x1a0 [ +0.000012] el0t_64_sync_handler+0x11c/0x150 [ +0.000008] el0t_64_sync+0x18c/0x190 [ +0.000016] Allocated by task 879: [ +0.000008] kasan_save_stack+0x2c/0x5c [ +0.000011] __kasan_kmalloc+0x90/0xd0 [ +0.000007] __kmalloc+0x278/0x4a0 [ +0.000011] mpi_resize+0x13c/0x1d0 [ +0.000011] mpi_powm+0xd24/0x1570 [ +0.000009] rsa_enc+0x1a4/0x30c [ +0.000009] pkcs1pad_verify+0x3f0/0x580 [ +0.000009] public_key_verify_signature+0x7a8/0xba4 [ +0.000010] public_key_verify_signature_2+0x40/0x60 [ +0.000008] verify_signature+0xb4/0x114 [ +0.000008] pkcs7_validate_trust_one.constprop.0+0x3b8/0x574 [ +0.000009] pkcs7_validate_trust+0xb8/0x15c [ +0.000008] verify_pkcs7_message_sig+0xec/0x1b0 [ +0.000012] verify_pkcs7_signature+0x78/0xac [ +0.000007] mod_verify_sig+0x110/0x190 [ +0.000009] module_sig_check+0x114/0x1e0 [ +0.000009] load_module+0xa0/0x1ea4 [ +0.000008] __do_sys_init_module+0x184/0x1cc [ +0.000008] __arm64_sys_init_module+0x78/0xb0 [ +0.000008] invoke_syscall+0x74/0x260 [ +0.000009] el0_svc_common.constprop.0+0x1a8/0x260 [ +0.000008] do_el0_svc+0x50/0x70 [ +0.000007] el0_svc+0x68/0x1a0 [ +0.000009] el0t_64_sync_handler+0x11c/0x150 [ +0.000009] el0t_64_sync+0x18c/0x190 [ +0.000013] Freed by task 2422: [ +0.000008] kasan_save_stack+0x2c/0x5c [ +0.000009] kasan_set_track+0x2c/0x40 [ +0.000007] kasan_set_free_info+0x28/0x50 [ +0.000009] ____kasan_slab_free+0x128/0x1d4 [ +0.000008] __kasan_slab_free+0x18/0x24 [ +0.000007] slab_free_freelist_hook+0x108/0x230 [ +0.000010] kfree+0x110/0x35c [ +0.000008] release_nodes+0xf0/0x16c [ +0.000009] devres_release_group+0x180/0x270 [ +0.000008] take_down_aggregate_device+0xcc/0x160 [ +0.000010] component_del+0x18c/0x360 [ +0.000009] meson_dw_hdmi_remove+0x28/0x40 [meson_dw_hdmi] [ +0.000013] platform_remove+0x64/0xb0 [ +0.000008] device_remove+0xb8/0x154 [ +0.000009] device_release_driver_internal+0x398/0x5b0 [ +0.000009] driver_detach+0xac/0x1b0 [ +0.000009] bus_remove_driver+0x158/0x29c [ +0.000008] driver_unregister+0x70/0xb0 [ +0.000009] platform_driver_unregister+0x20/0x2c [ +0.000007] meson_dw_hdmi_platform_driver_exit+0x1c/0x30 [meson_dw_hdmi] [ +0.000012] __do_sys_delete_module+0x288/0x400 [ +0.000009] __arm64_sys_delete_module+0x5c/0x80 [ +0.000009] invoke_syscall+0x74/0x260 [ +0.000008] el0_svc_common.constprop.0+0xcc/0x260 [ +0.000008] do_el0_svc+0x50/0x70 [ +0.000007] el0_svc+0x68/0x1a0 [ +0.000008] el0t_64_sync_handler+0x11c/0x150 [ +0.000009] el0t_64_sync+0x18c/0x190 [ +0.000013] The buggy address belongs to the object at ffff00003da29000 which belongs to the cache kmalloc-1k of size 1024 [ +0.000008] The buggy address is located 496 bytes inside of 1024-byte region [ffff00003da29000, ffff00003da29400) [ +0.000015] The buggy address belongs to the physical page: [ +0.000009] page:fffffc0000f68a00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x3da28 [ +0.000012] head:fffffc0000f68a00 order:3 compound_mapcount:0 compound_pincount:0 [ +0.000009] flags: 0xffff00000010200(slab|head|node=0|zone=0|lastcpupid=0xffff) [ +0.000019] raw: 0ffff00000010200 fffffc0000eb5c08 fffffc0000d96608 ffff000000002a80 [ +0.000008] raw: 0000000000000000 00000000000a000a 00000001ffffffff 0000000000000000 [ +0.000008] page dumped because: kasan: bad access detected [ +0.000011] Memory state around the buggy address: [ +0.000009] ffff00003da29080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000007] ffff00003da29100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000007] >ffff00003da29180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000007] ^ [ +0.000008] ffff00003da29200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000006] ffff00003da29280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000007] ================================================================== Fix by keeping track of which encoders were initialised in the meson_drm structure and manually removing their bridges at aggregate driver's unbind time. Signed-off-by: Adrián Larumbe Reviewed-by: Neil Armstrong Signed-off-by: Neil Armstrong Link: https://patchwork.freedesktop.org/patch/msgid/20220920222842.1053234-1-adrian.larumbe@collabora.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/meson/meson_drv.c | 4 ++++ drivers/gpu/drm/meson/meson_drv.h | 7 +++++++ drivers/gpu/drm/meson/meson_encoder_cvbs.c | 13 +++++++++++++ drivers/gpu/drm/meson/meson_encoder_cvbs.h | 1 + drivers/gpu/drm/meson/meson_encoder_hdmi.c | 13 +++++++++++++ drivers/gpu/drm/meson/meson_encoder_hdmi.h | 1 + 6 files changed, 39 insertions(+) diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c index 8444d90165fb..86b90d0f5780 100644 --- a/drivers/gpu/drm/meson/meson_drv.c +++ b/drivers/gpu/drm/meson/meson_drv.c @@ -390,6 +390,10 @@ static void meson_drv_unbind(struct device *dev) drm_atomic_helper_shutdown(drm); free_irq(priv->vsync_irq, drm); drm_dev_put(drm); + + meson_encoder_hdmi_remove(priv); + meson_encoder_cvbs_remove(priv); + component_unbind_all(dev, drm); if (priv->afbcd.ops) diff --git a/drivers/gpu/drm/meson/meson_drv.h b/drivers/gpu/drm/meson/meson_drv.h index 177dac3ca3be..c62ee358456f 100644 --- a/drivers/gpu/drm/meson/meson_drv.h +++ b/drivers/gpu/drm/meson/meson_drv.h @@ -25,6 +25,12 @@ enum vpu_compatible { VPU_COMPATIBLE_G12A = 3, }; +enum { + MESON_ENC_CVBS = 0, + MESON_ENC_HDMI, + MESON_ENC_LAST, +}; + struct meson_drm_match_data { enum vpu_compatible compat; struct meson_afbcd_ops *afbcd_ops; @@ -51,6 +57,7 @@ struct meson_drm { struct drm_crtc *crtc; struct drm_plane *primary_plane; struct drm_plane *overlay_plane; + void *encoders[MESON_ENC_LAST]; const struct meson_drm_soc_limits *limits; diff --git a/drivers/gpu/drm/meson/meson_encoder_cvbs.c b/drivers/gpu/drm/meson/meson_encoder_cvbs.c index 8110a6e39320..5675bc2a92cf 100644 --- a/drivers/gpu/drm/meson/meson_encoder_cvbs.c +++ b/drivers/gpu/drm/meson/meson_encoder_cvbs.c @@ -281,5 +281,18 @@ int meson_encoder_cvbs_init(struct meson_drm *priv) } drm_connector_attach_encoder(connector, &meson_encoder_cvbs->encoder); + priv->encoders[MESON_ENC_CVBS] = meson_encoder_cvbs; + return 0; } + +void meson_encoder_cvbs_remove(struct meson_drm *priv) +{ + struct meson_encoder_cvbs *meson_encoder_cvbs; + + if (priv->encoders[MESON_ENC_CVBS]) { + meson_encoder_cvbs = priv->encoders[MESON_ENC_CVBS]; + drm_bridge_remove(&meson_encoder_cvbs->bridge); + drm_bridge_remove(meson_encoder_cvbs->next_bridge); + } +} diff --git a/drivers/gpu/drm/meson/meson_encoder_cvbs.h b/drivers/gpu/drm/meson/meson_encoder_cvbs.h index 61d9d183ce7f..09710fec3c66 100644 --- a/drivers/gpu/drm/meson/meson_encoder_cvbs.h +++ b/drivers/gpu/drm/meson/meson_encoder_cvbs.h @@ -25,5 +25,6 @@ struct meson_cvbs_mode { extern struct meson_cvbs_mode meson_cvbs_modes[MESON_CVBS_MODES_COUNT]; int meson_encoder_cvbs_init(struct meson_drm *priv); +void meson_encoder_cvbs_remove(struct meson_drm *priv); #endif /* __MESON_VENC_CVBS_H */ diff --git a/drivers/gpu/drm/meson/meson_encoder_hdmi.c b/drivers/gpu/drm/meson/meson_encoder_hdmi.c index 2f616c55c271..53231bfdf7e2 100644 --- a/drivers/gpu/drm/meson/meson_encoder_hdmi.c +++ b/drivers/gpu/drm/meson/meson_encoder_hdmi.c @@ -452,6 +452,8 @@ int meson_encoder_hdmi_init(struct meson_drm *priv) meson_encoder_hdmi->cec_notifier = notifier; } + priv->encoders[MESON_ENC_HDMI] = meson_encoder_hdmi; + dev_dbg(priv->dev, "HDMI encoder initialized\n"); return 0; @@ -460,3 +462,14 @@ int meson_encoder_hdmi_init(struct meson_drm *priv) of_node_put(remote); return ret; } + +void meson_encoder_hdmi_remove(struct meson_drm *priv) +{ + struct meson_encoder_hdmi *meson_encoder_hdmi; + + if (priv->encoders[MESON_ENC_HDMI]) { + meson_encoder_hdmi = priv->encoders[MESON_ENC_HDMI]; + drm_bridge_remove(&meson_encoder_hdmi->bridge); + drm_bridge_remove(meson_encoder_hdmi->next_bridge); + } +} diff --git a/drivers/gpu/drm/meson/meson_encoder_hdmi.h b/drivers/gpu/drm/meson/meson_encoder_hdmi.h index ed19494f0956..a6cd38eb5f71 100644 --- a/drivers/gpu/drm/meson/meson_encoder_hdmi.h +++ b/drivers/gpu/drm/meson/meson_encoder_hdmi.h @@ -8,5 +8,6 @@ #define __MESON_ENCODER_HDMI_H int meson_encoder_hdmi_init(struct meson_drm *priv); +void meson_encoder_hdmi_remove(struct meson_drm *priv); #endif /* __MESON_ENCODER_HDMI_H */ From patchwork Wed Oct 19 08:34: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: 5300 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp282775wrs; Wed, 19 Oct 2022 05:03:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5T59Y5bbZET0m4yu00tx8QEmV6N1SSfh/QVsNWjtc65coPH7Xloyhs8HCmPHyQpPndNW9x X-Received: by 2002:a17:907:75e8:b0:78d:cf11:cccb with SMTP id jz8-20020a17090775e800b0078dcf11cccbmr6467171ejc.42.1666181021932; Wed, 19 Oct 2022 05:03:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666181021; cv=none; d=google.com; s=arc-20160816; b=tuzmR9ErhFXkWosK/yiuR649p4PXK5T7Tf2Dc2yptkn+ZjQQQcpN2vg7dZi1NSoUhB gks8AFhREJcBlYp2uSiWhk3IvTJeZc+AMQg+ilRZoszvt8hZHUOICDRi9mPKmfzin5fp OTCyryyoO9y18VhonABKAXuTLcoZPABdO5S7KgJpPofroip25caze9lI+4iG75/MnoZO u4TGnJlO3CP9nYgBXh6YGCSCCjPWqHRyHo0w+DqKjbTRuPShGdYLv50ACAY23hftOQBv B3rjSwrd0jX2aeoB+TBAhkh7MdJBBSaT9Xq691JgUpV5+Bb1LVZ+uqZCXnaD4GEt55+x VD6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uRTcxlHaUbhkjEfKnTh3Z4Nk7DXbY2g944ynDuCx7Vw=; b=RZqUdXS00uUNYfx7IetrCtNLnsjHPvMKlEW7LFaS/S9GBOwN0zNO1a4c2c46LMmOT0 u9g+6kSomaZMD97adJM2WVO5rI/kGaB1iOYJEKFlIpfHlVoihB4IH9sZ+6I7wQ3hAaeO qVNHa9bjDHURvSi/ptEbvC17ChkxVB7jQ4Ad/1SOYS145t5DQ8PPM49TlpHH7oclRCuH 6OqynDMTqyknWMZAuahOAYJ3g3xxdArq+ZJIDbTp4V/z1rq5jVuPK87VjkY6GxNGW8H2 hWd7DfXbKf0c8E3oB7OmUF5rbkRiPg7cvEbbRmhKjAgno+2DgQrYJRW1HyeEP8rLlnsl TxDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hjyWneEG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p11-20020a056402500b00b0045d212cc170si13526557eda.363.2022.10.19.05.03.10; Wed, 19 Oct 2022 05:03: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=hjyWneEG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231926AbiJSMAK (ORCPT + 99 others); Wed, 19 Oct 2022 08:00:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230134AbiJSL7P (ORCPT ); Wed, 19 Oct 2022 07:59: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 9D77C1285DA; Wed, 19 Oct 2022 04:37: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 E9A71B824CD; Wed, 19 Oct 2022 09:12:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69044C433D6; Wed, 19 Oct 2022 09:12:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170724; bh=ThY2MOp/n/nLpFQXMwnUVPXfqCJib/tNxueBla8bxI4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hjyWneEGx9f+1B+d+OrjQ0PxG7xOcwlk90+81dm9icaAedRj5Y164AASM9gmQ69pq jyMsH8ZmP8rlj7j210XQByiY/e72wISsQgaXKXPFmd+O3w3qtDOA4JEXDM+6xxp8ox 9p1OwZVp0i7dk59vKRVZ1CBOO7iqporIJ//Eo66k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Richard Acayan , Bhupesh Sharma , Krzysztof Kozlowski , Ulf Hansson , Sasha Levin Subject: [PATCH 6.0 763/862] mmc: sdhci-msm: add compatible string check for sdm670 Date: Wed, 19 Oct 2022 10:34:10 +0200 Message-Id: <20221019083323.632044579@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747117431202044397?= X-GMAIL-MSGID: =?utf-8?q?1747117431202044397?= From: Richard Acayan [ Upstream commit 4de95950d970c71a9e82a24573bb7a44fd95baa1 ] The Snapdragon 670 has the same quirk as Snapdragon 845 (needing to restore the dll config). Add a compatible string check to detect the need for this. Signed-off-by: Richard Acayan Reviewed-by: Bhupesh Sharma Acked-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20220923014322.33620-3-mailingradian@gmail.com Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin --- drivers/mmc/host/sdhci-msm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c index dc2991422a87..3a091a387ecb 100644 --- a/drivers/mmc/host/sdhci-msm.c +++ b/drivers/mmc/host/sdhci-msm.c @@ -2441,6 +2441,7 @@ static const struct of_device_id sdhci_msm_dt_match[] = { */ {.compatible = "qcom,sdhci-msm-v4", .data = &sdhci_msm_mci_var}, {.compatible = "qcom,sdhci-msm-v5", .data = &sdhci_msm_v5_var}, + {.compatible = "qcom,sdm670-sdhci", .data = &sdm845_sdhci_var}, {.compatible = "qcom,sdm845-sdhci", .data = &sdm845_sdhci_var}, {.compatible = "qcom,sc7180-sdhci", .data = &sdm845_sdhci_var}, {}, From patchwork Wed Oct 19 08:34: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: 5138 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp252042wrs; Wed, 19 Oct 2022 03:53:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7lI1uRmOFvLBM2aCV9jCNmccZ/jML10Wv+OVXxD3Z3cl4SZPzubvsAHWi0WIHz+KaK6uQH X-Received: by 2002:a17:907:7f07:b0:779:7f94:d259 with SMTP id qf7-20020a1709077f0700b007797f94d259mr6098037ejc.525.1666176804939; Wed, 19 Oct 2022 03:53:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176804; cv=none; d=google.com; s=arc-20160816; b=nvyjZmkTV0lZg+OmbSmBq0DlSJTCMZA8Knk5s6HLSCBMaFSi90hc4Sr52m6qBmI9Ga yh1bdbYlvBtefTbnv/o9y5lrg3KoI3mZXWZLNtFvTzetIThHs3Jirf80yEUchr6RsRfV U4tGK5tOCl85fvPnkzaFAI5PEIgQFDcgVPAeFzbmkvebvgIWaGsllqIDeF2nK6HLkiM8 eGFEJHxvA4ek1/544b9fZ0f2M1NLRluUjhpSFC6qqmFvR4rG0QY9nJs9Nmf0bs0DHRZG ShpWpbwQzhpXCftcyknAPFGHFQyujixrN3txoJRMfVafcWPrsmFYpjVXLi6P2r++6rFT h/JA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1rZWJ3oWWCM9wx+tSDQ7NXoNL7Rdp9StXIahP1tc1iA=; b=rXOzxRwlwrPsFz+9ITNbcq/HZ4AVSsxBph5oYnwHdEpRL5Q7rQt4aMVnYowhe5D5V5 1TEIPspTiJsnZ3a6WL55pDcMzyt+VOWfFdNCiQPX10fuZ7fJgrSchyDARVQ8ZjyjWL7S 0fq0J++QpZrzuWaA0lyxap7cbgTdLBvbGfA0U9M1jq8CpLT+34XI4dztH6S0FznGlpec F9Tjlft7mVnLJA/b+cy45rXVYE9QUGw3/Yg1ZMBM67IFfC3xOHKGXJyijofOX938ugVQ vat5SKy4gjlo3V89qlQ1GCnmO8OKlxNcqMQ+qXI5SQAzb7oLWp72MLNkYGumXkV238qe eRTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="zY/x7bnr"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z11-20020a05640235cb00b0045d0444e410si16326700edc.0.2022.10.19.03.52.59; Wed, 19 Oct 2022 03:53: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="zY/x7bnr"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234578AbiJSKva (ORCPT + 99 others); Wed, 19 Oct 2022 06:51:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234553AbiJSKt2 (ORCPT ); Wed, 19 Oct 2022 06:49: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 6013C120EFD; Wed, 19 Oct 2022 03:22: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 CB1B6B824BD; Wed, 19 Oct 2022 09:12:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 15E1CC433D7; Wed, 19 Oct 2022 09:12:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170727; bh=0lXjXOMZkxdP2GPXXjyd/ApI3WY6HQ54fKTjurDXXu4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zY/x7bnrbOKcuXEO9NPPNxc9g6D3dPo5g4wZmM6vWxmepkwDE4aBzQWnYigCYoKy9 eOB5vZNUb4+GXY8Ed3JFGOTpOlV98W8bmBIDRscpb06VlaRouYDxVkojxE5HhZHQmE x8STH7EsD5SE5Mcf4WwrcngzB0d3YfJWkBwc6fAs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Imre Deak , Jani Nikula , Or Cochvi , Khaled Almahallawy , Sasha Levin Subject: [PATCH 6.0 764/862] drm/dp: Dont rewrite link config when setting phy test pattern Date: Wed, 19 Oct 2022 10:34:11 +0200 Message-Id: <20221019083323.680907744@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747113009748331051?= X-GMAIL-MSGID: =?utf-8?q?1747113009748331051?= From: Khaled Almahallawy [ Upstream commit 7b4d8db657192066bc6f1f6635d348413dac1e18 ] The sequence for Source DP PHY CTS automation is [2][1]: 1- Emulate successful Link Training(LT) 2- Short HPD and change link rates and number of lanes by LT. (This is same flow for Link Layer CTS) 3- Short HPD and change PHY test pattern and swing/pre-emphasis levels (This step should not trigger LT) The problem is with DP PHY compliance setup as follow: [DPTX + on board LTTPR]------Main Link--->[Scope] ^ | | | | | ----------Aux Ch------>[Aux Emulator] At step 3, before writing TRAINING_LANEx_SET/LINK_QUAL_PATTERN_SET to declare the pattern/swing requested by scope, we write link config in LINK_BW_SET/LANE_COUNT_SET on a port that has LTTPR. As LTTPR snoops aux transaction, LINK_BW_SET/LANE_COUNT_SET writes indicate a LT will start [Check DP 2.0 E11 -Sec 3.6.8.2 & 3.6.8.6.3], and LTTPR will reset the link and stop sending DP signals to DPTX/Scope causing the measurements to fail. Note that step 3 will not trigger LT and DP link will never recovered by the Aux Emulator/Scope. The reset of link can be tested with a monitor connected to LTTPR port simply by writing to LINK_BW_SET or LANE_COUNT_SET as follow igt/tools/dpcd_reg write --offset=0x100 --value 0x14 --device=2 OR printf '\x14' | sudo dd of=/dev/drm_dp_aux2 bs=1 count=1 conv=notrunc seek=$((0x100)) This single aux write causes the screen to blank, sending short HPD to DPTX, setting LINK_STATUS_UPDATE = 1 in DPCD 0x204, and triggering LT. As stated in [1]: "Before any TX electrical testing can be performed, the link between a DPTX and DPRX (in this case, a piece of test equipment), including all LTTPRs within the path, shall be trained as defined in this Standard." In addition, changing Phy pattern/Swing/Pre-emphasis (Step 3) uses the same link rate and lane count applied on step 2, so no need to redo LT. The fix is to not rewrite link config in step 3, and just writes TRAINING_LANEx_SET and LINK_QUAL_PATTERN_SET [1]: DP 2.0 E11 - 3.6.11.1 LTTPR DPTX_PHY Electrical Compliance [2]: Configuring UnigrafDPTC Controller - Automation Test Sequence https://www.keysight.com/us/en/assets/9922-01244/help-files/ D9040DPPC-DisplayPort-Test-Software-Online-Help-latest.chm Cc: Imre Deak Cc: Jani Nikula Cc: Or Cochvi Signed-off-by: Khaled Almahallawy Signed-off-by: Jani Nikula Link: https://patchwork.freedesktop.org/patch/msgid/20220916054900.415804-1-khaled.almahallawy@intel.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/display/drm_dp_helper.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/gpu/drm/display/drm_dp_helper.c b/drivers/gpu/drm/display/drm_dp_helper.c index e5bab236b3ae..4c0c4e3d1e20 100644 --- a/drivers/gpu/drm/display/drm_dp_helper.c +++ b/drivers/gpu/drm/display/drm_dp_helper.c @@ -2638,17 +2638,8 @@ int drm_dp_set_phy_test_pattern(struct drm_dp_aux *aux, struct drm_dp_phy_test_params *data, u8 dp_rev) { int err, i; - u8 link_config[2]; u8 test_pattern; - link_config[0] = drm_dp_link_rate_to_bw_code(data->link_rate); - link_config[1] = data->num_lanes; - if (data->enhanced_frame_cap) - link_config[1] |= DP_LANE_COUNT_ENHANCED_FRAME_EN; - err = drm_dp_dpcd_write(aux, DP_LINK_BW_SET, link_config, 2); - if (err < 0) - return err; - test_pattern = data->phy_pattern; if (dp_rev < 0x12) { test_pattern = (test_pattern << 2) & From patchwork Wed Oct 19 08:34: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: 5187 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp263873wrs; Wed, 19 Oct 2022 04:18:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5iFG7ZYC7z7PhJWxgQm/EMYGyTv2qG3YYaRa8cUyMu6eTaXQpTw9VTcUkLaQVSqXUQUYLu X-Received: by 2002:a05:6a02:10e:b0:43b:e57d:2bfa with SMTP id bg14-20020a056a02010e00b0043be57d2bfamr6613570pgb.263.1666178335217; Wed, 19 Oct 2022 04:18:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178335; cv=none; d=google.com; s=arc-20160816; b=bDK76YHtQObQDKt2ktPvAgkNcPRYHy1Toxsz36dm6Q6BC14LPpQ0M/kJ9M3/hWxrY2 4lrKgmStbraV79jll0N/EnSE0FMF1C3zp6C0bFASLXNUtnondymrCetcGDlyMrICRh/z kEvNILaBZi4atJ5y9GBEyRm8PvY8OBjIlDlGIHn0HTFPI1dJ7g7ELlWv2sptFk8/+Voa viPwZ4R7m+b90IiC/oF5iXCZKlGwu1Vfunl26NLd5ONaPYblgeEOHhgLL3ZLVgtv55so vbR1plmdJtIO5c5TIjW8zADeSLyof7RHYCOvs0b3xCPK4hSiBWRvg2Su8XnSC8iWvJpE hA2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=plRKA6c7fuO0pupPDYjQpHZ8nc3+HoDel7PFExxjbmg=; b=HI3WcFhae/OB6HUovcfBTQGmJXmXBrk9dBO4p3Pph8SrUOEbVChblKn9sz50nFfgk1 mfe9sroprnpGQDxRBPdzEf91Pl8L3Uu0O8NST43oePYwbEXyQ2342RZ6PsNJhzOJDJ/y 5SPA3zy/hqAfhVW4DrEGxYU1+U+GBRBG9IdsRIbrITQRsn2BQaNnKb4fKHBKoQjJ/Qo+ Fq8g9mkAwh1olyDMWhtPqFQj4ZKg5xD5f9AguB25rzrvZF7ek3Cb2MRjo10Qwsq9ZSU0 C3SMYlcGHDiUfarEjn7NQQWCpaDPgtT+aTJYx+uzRk0ImafY/oD1UnfkDpRb5tLcfN1M SxYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lfP7LZ5K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v22-20020a17090a899600b0020a5121be54si21389492pjn.23.2022.10.19.04.18.36; Wed, 19 Oct 2022 04:18: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=lfP7LZ5K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231668AbiJSLIJ (ORCPT + 99 others); Wed, 19 Oct 2022 07:08:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231972AbiJSLHZ (ORCPT ); Wed, 19 Oct 2022 07:07:25 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98E6F176522; Wed, 19 Oct 2022 03:36: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 sin.source.kernel.org (Postfix) with ESMTPS id AA06DCE21B9; Wed, 19 Oct 2022 09:12:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7DF9C433D7; Wed, 19 Oct 2022 09:12:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170730; bh=14NvLwA4fUXcofMhUIAAVbjoN/PdGvt5TBRz5MgG8d4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lfP7LZ5KbVz86EGyrZ5+1bKRyLcY/r/3IFCseWFiHFHN+TOoUnLXUjzfTCSLepjKF U0KXsJioebA6trSU6AeLanlZRD5QxYReLn2NXk8W9Nq/cmHcEZmIQyah1ZrXSXJdG7 1pr11JNbY2Jp9rm0WIMACjIEioTHejgnABDWlcwA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jaehyun Chung , Jasdeep Dhillon , Aric Cyr , Daniel Wheeler , Alex Deucher , Sasha Levin Subject: [PATCH 6.0 765/862] drm/amd/display: Remove interface for periodic interrupt 1 Date: Wed, 19 Oct 2022 10:34:12 +0200 Message-Id: <20221019083323.729777790@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114614013772829?= X-GMAIL-MSGID: =?utf-8?q?1747114614013772829?= From: Aric Cyr [ Upstream commit 97d8d6f075bd8f988589be02b91f6fa644d0b0b8 ] [why] Only a single VLINE interrupt is available so interface should not expose the second one which is used by DMU firmware. [how] Remove references to periodic_interrupt1 and VLINE1 from DC interfaces. Reviewed-by: Jaehyun Chung Acked-by: Jasdeep Dhillon Signed-off-by: Aric Cyr Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/dc/core/dc.c | 16 +++------ drivers/gpu/drm/amd/display/dc/dc_stream.h | 6 ++-- .../amd/display/dc/dcn10/dcn10_hw_sequencer.c | 35 ++++++------------- .../amd/display/dc/dcn10/dcn10_hw_sequencer.h | 3 +- .../gpu/drm/amd/display/dc/inc/hw_sequencer.h | 8 +---- 5 files changed, 18 insertions(+), 50 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c index fb22c3d70528..18d6ee666297 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c @@ -2753,11 +2753,8 @@ static void copy_stream_update_to_stream(struct dc *dc, if (update->abm_level) stream->abm_level = *update->abm_level; - if (update->periodic_interrupt0) - stream->periodic_interrupt0 = *update->periodic_interrupt0; - - if (update->periodic_interrupt1) - stream->periodic_interrupt1 = *update->periodic_interrupt1; + if (update->periodic_interrupt) + stream->periodic_interrupt = *update->periodic_interrupt; if (update->gamut_remap) stream->gamut_remap_matrix = *update->gamut_remap; @@ -2987,13 +2984,8 @@ static void commit_planes_do_stream_update(struct dc *dc, if (!pipe_ctx->top_pipe && !pipe_ctx->prev_odm_pipe && pipe_ctx->stream == stream) { - if (stream_update->periodic_interrupt0 && - dc->hwss.setup_periodic_interrupt) - dc->hwss.setup_periodic_interrupt(dc, pipe_ctx, VLINE0); - - if (stream_update->periodic_interrupt1 && - dc->hwss.setup_periodic_interrupt) - dc->hwss.setup_periodic_interrupt(dc, pipe_ctx, VLINE1); + if (stream_update->periodic_interrupt && dc->hwss.setup_periodic_interrupt) + dc->hwss.setup_periodic_interrupt(dc, pipe_ctx); if ((stream_update->hdr_static_metadata && !stream->use_dynamic_meta) || stream_update->vrr_infopacket || diff --git a/drivers/gpu/drm/amd/display/dc/dc_stream.h b/drivers/gpu/drm/amd/display/dc/dc_stream.h index f87f852d4829..ae0922e98ef7 100644 --- a/drivers/gpu/drm/amd/display/dc/dc_stream.h +++ b/drivers/gpu/drm/amd/display/dc/dc_stream.h @@ -212,8 +212,7 @@ struct dc_stream_state { /* DMCU info */ unsigned int abm_level; - struct periodic_interrupt_config periodic_interrupt0; - struct periodic_interrupt_config periodic_interrupt1; + struct periodic_interrupt_config periodic_interrupt; /* from core_stream struct */ struct dc_context *ctx; @@ -283,8 +282,7 @@ struct dc_stream_update { struct dc_info_packet *hdr_static_metadata; unsigned int *abm_level; - struct periodic_interrupt_config *periodic_interrupt0; - struct periodic_interrupt_config *periodic_interrupt1; + struct periodic_interrupt_config *periodic_interrupt; struct dc_info_packet *vrr_infopacket; struct dc_info_packet *vsc_infopacket; diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c index 5b5d952b2b8c..bc9b92838ea9 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c @@ -3768,7 +3768,7 @@ void dcn10_calc_vupdate_position( { const struct dc_crtc_timing *dc_crtc_timing = &pipe_ctx->stream->timing; int vline_int_offset_from_vupdate = - pipe_ctx->stream->periodic_interrupt0.lines_offset; + pipe_ctx->stream->periodic_interrupt.lines_offset; int vupdate_offset_from_vsync = dc->hwss.get_vupdate_offset_from_vsync(pipe_ctx); int start_position; @@ -3793,18 +3793,10 @@ void dcn10_calc_vupdate_position( static void dcn10_cal_vline_position( struct dc *dc, struct pipe_ctx *pipe_ctx, - enum vline_select vline, uint32_t *start_line, uint32_t *end_line) { - enum vertical_interrupt_ref_point ref_point = INVALID_POINT; - - if (vline == VLINE0) - ref_point = pipe_ctx->stream->periodic_interrupt0.ref_point; - else if (vline == VLINE1) - ref_point = pipe_ctx->stream->periodic_interrupt1.ref_point; - - switch (ref_point) { + switch (pipe_ctx->stream->periodic_interrupt.ref_point) { case START_V_UPDATE: dcn10_calc_vupdate_position( dc, @@ -3813,7 +3805,9 @@ static void dcn10_cal_vline_position( end_line); break; case START_V_SYNC: - // Suppose to do nothing because vsync is 0; + // vsync is line 0 so start_line is just the requested line offset + *start_line = pipe_ctx->stream->periodic_interrupt.lines_offset; + *end_line = *start_line + 2; break; default: ASSERT(0); @@ -3823,24 +3817,15 @@ static void dcn10_cal_vline_position( void dcn10_setup_periodic_interrupt( struct dc *dc, - struct pipe_ctx *pipe_ctx, - enum vline_select vline) + struct pipe_ctx *pipe_ctx) { struct timing_generator *tg = pipe_ctx->stream_res.tg; + uint32_t start_line = 0; + uint32_t end_line = 0; - if (vline == VLINE0) { - uint32_t start_line = 0; - uint32_t end_line = 0; + dcn10_cal_vline_position(dc, pipe_ctx, &start_line, &end_line); - dcn10_cal_vline_position(dc, pipe_ctx, vline, &start_line, &end_line); - - tg->funcs->setup_vertical_interrupt0(tg, start_line, end_line); - - } else if (vline == VLINE1) { - pipe_ctx->stream_res.tg->funcs->setup_vertical_interrupt1( - tg, - pipe_ctx->stream->periodic_interrupt1.lines_offset); - } + tg->funcs->setup_vertical_interrupt0(tg, start_line, end_line); } void dcn10_setup_vupdate_interrupt(struct dc *dc, struct pipe_ctx *pipe_ctx) diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.h b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.h index 9ae07c77fdc0..0ef7bf7ddb75 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.h +++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.h @@ -175,8 +175,7 @@ void dcn10_set_cursor_attribute(struct pipe_ctx *pipe_ctx); void dcn10_set_cursor_sdr_white_level(struct pipe_ctx *pipe_ctx); void dcn10_setup_periodic_interrupt( struct dc *dc, - struct pipe_ctx *pipe_ctx, - enum vline_select vline); + struct pipe_ctx *pipe_ctx); enum dc_status dcn10_set_clock(struct dc *dc, enum dc_clock_type clock_type, uint32_t clk_khz, diff --git a/drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h b/drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h index ccb3c719fc4d..ac94dba72c18 100644 --- a/drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h +++ b/drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h @@ -32,11 +32,6 @@ #include "inc/hw/link_encoder.h" #include "core_status.h" -enum vline_select { - VLINE0, - VLINE1 -}; - struct pipe_ctx; struct dc_state; struct dc_stream_status; @@ -116,8 +111,7 @@ struct hw_sequencer_funcs { int group_index, int group_size, struct pipe_ctx *grouped_pipes[]); void (*setup_periodic_interrupt)(struct dc *dc, - struct pipe_ctx *pipe_ctx, - enum vline_select vline); + struct pipe_ctx *pipe_ctx); void (*set_drr)(struct pipe_ctx **pipe_ctx, int num_pipes, struct dc_crtc_timing_adjust adjust); void (*set_static_screen_control)(struct pipe_ctx **pipe_ctx, From patchwork Wed Oct 19 08:34: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: 4871 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225281wrs; Wed, 19 Oct 2022 02:42:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM58zuDUgOb0lkY8JKbhU12ySYZKtxsmHCcqMYs3jmdTKAqUw6UcmJlTf4fnRZ/7usmtRDU9 X-Received: by 2002:aa7:83cd:0:b0:563:5f54:d78c with SMTP id j13-20020aa783cd000000b005635f54d78cmr8003126pfn.66.1666172566682; Wed, 19 Oct 2022 02:42:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172566; cv=none; d=google.com; s=arc-20160816; b=SAJFvJsV7t1pHgkxldP2PcNZ2oxx1SW7Yli56+UItSlX6ajoRdfV6hdtzvwqpoDPat 3xFTySFwmDCidSUQU7BOfxeIgLngjePR6lGKcdINy+PvgF1e31SR6YKqW+J5O5NE8Yy4 g2vXY4hGJswXBuXs2XsNzH5M2vfwHVthLPTtUHMowYiTNMCf0cgb0BP7dCvHGMbZKQr6 758B89EeGzf12ycTZKtYgyU6e8Ja77oenno8kVfnsZW1rK03QPJuH99JejmTet5VgGmK s0JL4vBla5SAAEHAMyasSlczYlsIQmHZ4zGgDeEdqsuD6+MTf5Dkzk+8doPPsxd9JbS1 vhTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ASw7rQcgGchXNtvOPeuTpiqU2jtJjAeTsM/B4BbCHE4=; b=SlrpNitETj0oKUNZzkCv6DjMlGSFNGEmL82wWKEVjyMUNLCJ4xKr6ckSGtTWPor+EO zwiWKCmbY3qRfjm0kPf913G3jNYFH9OGurqhQkGucdnlIYrPNTGn6pjQHKWcdxF9ItYQ x6/bzGRT+8e0aRU5CUHWMve7kBSy5xJsz1yh10gmy5Xpk1/mJX5/xJPHzR5DIEPl3v7O eUlUhali928SK/sVZ1/OT0UQgwtamC18TqJY7Do5vHY3pc9QK70zbvxWjXDlQOmWT/gz kjwq5Q/mVi4bAQZ16ZDdbIouQlgKFPHndZK8EwAxTL4DUNiapVF76cdMKlyhtLafVYnG AKdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ucDKHnNV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d19-20020a170902e15300b00179e261e4f8si15375391pla.90.2022.10.19.02.42.33; Wed, 19 Oct 2022 02:42: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=ucDKHnNV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233797AbiJSJci (ORCPT + 99 others); Wed, 19 Oct 2022 05:32:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233502AbiJSJ2j (ORCPT ); Wed, 19 Oct 2022 05:28:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65A22E8C46; Wed, 19 Oct 2022 02:12: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 623F961750; Wed, 19 Oct 2022 09:12:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76B37C433D6; Wed, 19 Oct 2022 09:12:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170732; bh=Ol+2Xj2+b+tySJ+C/RyQP4TaRR4MLjLtzXy+zmFgurg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ucDKHnNVHsByYjX5joYxmB+CcHZFvIDiPFLSsO/mpZ84Z7mrlI/YiwMYzJCx+pRbZ Bxck4HgI01mWcrmrjYNjJ/776EgvEnyIH5hlhWXnDZfjEh1ft3gQt5StumNqvMHAXQ l/prdgC/9MJcwFt06GgoN8wATUa2A5hhGTfkLVVg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ariel Bernstein , Jasdeep Dhillon , Wenjing Liu , Daniel Wheeler , Alex Deucher , Sasha Levin Subject: [PATCH 6.0 766/862] drm/amd/display: polling vid stream status in hpo dp blank Date: Wed, 19 Oct 2022 10:34:13 +0200 Message-Id: <20221019083323.765197093@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108565286201318?= X-GMAIL-MSGID: =?utf-8?q?1747108565286201318?= From: Wenjing Liu [ Upstream commit e32df0c7ecead95d70ca89f39b1b2b02a59ff691 ] [why] vid stream control is double bufferred, if we don't wait for video stream enable set to 0, we may get temporary image corruption showing on the stream when setting PIXEL_TO_SYMBOL_FIFO_ENABLE to 0. Reviewed-by: Ariel Bernstein Acked-by: Jasdeep Dhillon Signed-off-by: Wenjing Liu Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- .../drm/amd/display/dc/dcn31/dcn31_hpo_dp_stream_encoder.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hpo_dp_stream_encoder.c b/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hpo_dp_stream_encoder.c index 23621ff08c90..52fb2bf3d578 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hpo_dp_stream_encoder.c +++ b/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hpo_dp_stream_encoder.c @@ -150,9 +150,9 @@ static void dcn31_hpo_dp_stream_enc_dp_blank( * 10us*5000=50ms. This covers 41.7ms of minimum 24 Hz mode + * a little more because we may not trust delay accuracy. */ - //REG_WAIT(DP_SYM32_ENC_VID_STREAM_CONTROL, - // VID_STREAM_STATUS, 0, - // 10, 5000); + REG_WAIT(DP_SYM32_ENC_VID_STREAM_CONTROL, + VID_STREAM_STATUS, 0, + 10, 5000); /* Disable SDP tranmission */ REG_UPDATE(DP_SYM32_ENC_SDP_CONTROL, From patchwork Wed Oct 19 08:34: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: 4931 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp226137wrs; Wed, 19 Oct 2022 02:45:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6KBIpOYZvEhmCtZ1Q1f8fjZee/FjizJC6xuX3Jaw05DFNLvJmjJiOh7vkP4+BbJFbv68QH X-Received: by 2002:aa7:d392:0:b0:458:800a:c47 with SMTP id x18-20020aa7d392000000b00458800a0c47mr6459551edq.5.1666172601448; Wed, 19 Oct 2022 02:43:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172601; cv=none; d=google.com; s=arc-20160816; b=xs/pALe9Uh4l1rD5qoOhrDGxWDbt06fpl7aLFS928YjqXfJgkZUPssEyXXBBRdEhT/ 3IL3H0B6ksLZVN2YoSECFdcSwP3/J57YqHk0GCLaiy8jnCpiDG671mfWn/Orey1/iWeG p+8Z0hLvJYRzTIn1mI+ZaJTXIydDcokmHXu/IbV91u1KxxQ7VmvxohUfWWsjL+1T/itu +Qw41Yd7PSU8Nd7OyBnxf3hXIBGp9fOaF3vlB2m35tCEykGjoMynLia/XMw2F98Gak70 fqyAbMacwmM2WpFUpLfP/x98iZO1SK1cU3pl0qqA8r9l67M14BH/jq6clD6ScG3YQM8m ADQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=AAtOVqaO7hCarRCb4n0UUAtDwRsQklmG/7TwBNEZl8Y=; b=rNyHHBDtmZPb2dyzCctcOlX84pnHT1mA2zlcahZMASjZxQzmkKW9nUpx7FtKJB3gD+ Anfx6XvvDvZVK76eLs5JxUKlVyrqGV36v4/nlwwaCiOOurv5NxL9e1tEzHwBMMmjC24e 4xOATSiz4NMOdc0L6G4WMgsIohOC9gLjjrKVAUfJg2ym2YGbTM74TkkYUCPwPLbJl+Aa c/heUqCW8RltXcD/9GL11xGsJLm91qWuaLtdjJhE0XsjPTVZtW0/Kym7YLQ/8GPYa5uJ 4WPxHLWxE9baKCyyuHYvDpxVVF0PD24cU/8qKMxICOOd0VyaicRxD6HTTiH7XrMABSrB F0nA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=L1foq1xk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sd41-20020a1709076e2900b0078c2c22d6cesi14828191ejc.70.2022.10.19.02.42.56; Wed, 19 Oct 2022 02:43:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=L1foq1xk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233704AbiJSJbc (ORCPT + 99 others); Wed, 19 Oct 2022 05:31:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233558AbiJSJ1k (ORCPT ); Wed, 19 Oct 2022 05:27: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 BFCA2E8C62; Wed, 19 Oct 2022 02:12:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id ED8E261866; Wed, 19 Oct 2022 09:12:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F002C4314D; Wed, 19 Oct 2022 09:12:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170735; bh=N4wF+6kGYuK5CrjAuFfYgXmfcNsLOqTRoXjZk208taQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L1foq1xk44heBTDK/gigTDPXOFAAMrXpDWWWsHfwoG+Lpr+UvFjymjCTGM11x1ji4 ePISaftWb8jz2b+hCs3+mKNNUloGMHM830lRJzUeoO5GqpTGVoyVAOQm7Qn6kgd8d0 r9DJ5wZ6Mnjk9i1GPzoLm3YpUb01an3yYs/woJpE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ellis Michael , Felix Kuehling , Graham Sider , Alex Deucher , Sasha Levin Subject: [PATCH 6.0 767/862] drm/amdkfd: Fix UBSAN shift-out-of-bounds warning Date: Wed, 19 Oct 2022 10:34:14 +0200 Message-Id: <20221019083323.814976471@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108601792777685?= X-GMAIL-MSGID: =?utf-8?q?1747108601792777685?= From: Felix Kuehling [ Upstream commit b292cafe2dd02d96a07147e4b160927e8399d5cc ] This was fixed in initialize_cpsch before, but not in initialize_nocpsch. Factor sdma bitmap initialization into a helper function to apply the correct implementation in both cases without duplicating it. v2: Added a range check Reported-by: Ellis Michael Signed-off-by: Felix Kuehling Reviewed-by: Graham Sider Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- .../drm/amd/amdkfd/kfd_device_queue_manager.c | 45 +++++++++---------- 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c index 007a3db69df1..ecb4c3abc629 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c @@ -1242,6 +1242,24 @@ static void init_interrupts(struct device_queue_manager *dqm) dqm->dev->kfd2kgd->init_interrupts(dqm->dev->adev, i); } +static void init_sdma_bitmaps(struct device_queue_manager *dqm) +{ + unsigned int num_sdma_queues = + min_t(unsigned int, sizeof(dqm->sdma_bitmap)*8, + get_num_sdma_queues(dqm)); + unsigned int num_xgmi_sdma_queues = + min_t(unsigned int, sizeof(dqm->xgmi_sdma_bitmap)*8, + get_num_xgmi_sdma_queues(dqm)); + + if (num_sdma_queues) + dqm->sdma_bitmap = GENMASK_ULL(num_sdma_queues-1, 0); + if (num_xgmi_sdma_queues) + dqm->xgmi_sdma_bitmap = GENMASK_ULL(num_xgmi_sdma_queues-1, 0); + + dqm->sdma_bitmap &= ~get_reserved_sdma_queues_bitmap(dqm); + pr_info("sdma_bitmap: %llx\n", dqm->sdma_bitmap); +} + static int initialize_nocpsch(struct device_queue_manager *dqm) { int pipe, queue; @@ -1270,11 +1288,7 @@ static int initialize_nocpsch(struct device_queue_manager *dqm) memset(dqm->vmid_pasid, 0, sizeof(dqm->vmid_pasid)); - dqm->sdma_bitmap = ~0ULL >> (64 - get_num_sdma_queues(dqm)); - dqm->sdma_bitmap &= ~(get_reserved_sdma_queues_bitmap(dqm)); - pr_info("sdma_bitmap: %llx\n", dqm->sdma_bitmap); - - dqm->xgmi_sdma_bitmap = ~0ULL >> (64 - get_num_xgmi_sdma_queues(dqm)); + init_sdma_bitmaps(dqm); return 0; } @@ -1452,9 +1466,6 @@ static int set_sched_resources(struct device_queue_manager *dqm) static int initialize_cpsch(struct device_queue_manager *dqm) { - uint64_t num_sdma_queues; - uint64_t num_xgmi_sdma_queues; - pr_debug("num of pipes: %d\n", get_pipes_per_mec(dqm)); mutex_init(&dqm->lock_hidden); @@ -1463,24 +1474,10 @@ static int initialize_cpsch(struct device_queue_manager *dqm) dqm->active_cp_queue_count = 0; dqm->gws_queue_count = 0; dqm->active_runlist = false; - - num_sdma_queues = get_num_sdma_queues(dqm); - if (num_sdma_queues >= BITS_PER_TYPE(dqm->sdma_bitmap)) - dqm->sdma_bitmap = ULLONG_MAX; - else - dqm->sdma_bitmap = (BIT_ULL(num_sdma_queues) - 1); - - dqm->sdma_bitmap &= ~(get_reserved_sdma_queues_bitmap(dqm)); - pr_info("sdma_bitmap: %llx\n", dqm->sdma_bitmap); - - num_xgmi_sdma_queues = get_num_xgmi_sdma_queues(dqm); - if (num_xgmi_sdma_queues >= BITS_PER_TYPE(dqm->xgmi_sdma_bitmap)) - dqm->xgmi_sdma_bitmap = ULLONG_MAX; - else - dqm->xgmi_sdma_bitmap = (BIT_ULL(num_xgmi_sdma_queues) - 1); - INIT_WORK(&dqm->hw_exception_work, kfd_process_hw_exception); + init_sdma_bitmaps(dqm); + return 0; } From patchwork Wed Oct 19 08:34: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: 4880 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225387wrs; Wed, 19 Oct 2022 02:43:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7RMlXOP3ejBPByIzGgCS78X3dNVdQK2mUw766urNyn8wv+ewi2qnPao4+8va8sIdadrENb X-Received: by 2002:a17:907:94cf:b0:78d:38cd:afcf with SMTP id dn15-20020a17090794cf00b0078d38cdafcfmr6012741ejc.229.1666172581534; Wed, 19 Oct 2022 02:43:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172581; cv=none; d=google.com; s=arc-20160816; b=C9LaBkAU1Pu+yifSMnG3P8ZDgGz4s4yR9a06/tIsK8IxCkBGdoiPF6tdT5yF8xYCWI IUFPlf2OwYPnk+iiEpFmwgq0pNppgZpgmgYuYdNSmZ6nXSetYWTInYlKY5Ru3376n3B8 udt3RzGf65FQN8dp3j/aeecf93QeE+fYVF/y7V4JyUyS8yppT5J1o4KYgkT2OeMLJGw9 siWErNz8cNjXiYkmzSMWcqBbtSLK99nsXdgR/1mrFimWPolI5lGiLP8diflR+f2JAQ/h SECGmUkOu57r2Cq8UpVYHxbzOVzCMhWgvou2xzfrKlI+sZI24dCdJCzuyiggm21gIfiH +LzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JKN+X0V6f7CHHPhjfxydipXH6VFofT/0PExwpPI+6L0=; b=tvlfoypjPkJS3/iimr6mGJWskT/aAfHRWcIZ3KQPk04lLB5Y0EWF20bob27qouzkDP vtzLwmSTIQNWToiQyLuPWnCXa4YKIIBb3oqCTBObp5mrvH66pqBZbSQUmhMgQXREBl/n T3L0DuIUucDcBHRgg0VO5McnTEz+1dziHsKkgH5OASzYfMe4jhsZSISmErtzq0u+7zUL GHwxpzV8kjOEvd7lGE5ozQ9njLigMbstJbTdq/1tv3uxaZCIphRNKtdXkJVLiWtruBha ytx8qp/tDvtG5Q81Vtq9sT7vu78Q92S93mKS7Bmo4VTgsDD5LUBkm3sr/eli4hAbvg1Q 9yjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EGhcvJ0O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j1-20020a508a81000000b004593faf4fccsi13034457edj.110.2022.10.19.02.42.37; Wed, 19 Oct 2022 02:43: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=EGhcvJ0O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230124AbiJSJcy (ORCPT + 99 others); Wed, 19 Oct 2022 05:32:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233668AbiJSJ3A (ORCPT ); Wed, 19 Oct 2022 05:29:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EC26E5EEE; Wed, 19 Oct 2022 02:12: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 76AA5617DE; Wed, 19 Oct 2022 09:12:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F98DC433C1; Wed, 19 Oct 2022 09:12:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170737; bh=4ee12yKSQ/35Nz7CmDVqwURep8FFoi1o/s/f03kHQTA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EGhcvJ0OwZCgZYNiFQHgx5GT9ALZK7kuASmNX3U2vH1gPseSqCar7NVqV6spSWHyr P7WG7OUC3d0T3badxkv8rnbd7Bp/kmD0pZDtmZyZ+3uo7JMJLUIV/kK0MW5bOlSaZh RK5iG5H/czclMRSyPESlm5g3Yc7+dAWHb7CGpi2U= 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 6.0 768/862] ARM: dts: imx6: delete interrupts property if interrupts-extended is set Date: Wed, 19 Oct 2022 10:34:15 +0200 Message-Id: <20221019083323.859587766@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108581186929845?= X-GMAIL-MSGID: =?utf-8?q?1747108581186929845?= From: Alexander Stein [ Upstream commit c9d38ff7080b2c4fa6786b82210fa13115895aae ] In most cases this is related to fsl,err006687-workaround-present, which requires a GPIO interrupt next a GIC interrupt. This fixes the dtbs_check warning: imx6dl-mba6a.dtb: ethernet@2188000: More than one condition true in oneOf schema: {'$filename': 'Documentation/devicetree/bindings/net/fsl,fec.yaml', [...] Signed-off-by: Alexander Stein Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin --- arch/arm/boot/dts/imx6dl-riotboard.dts | 1 + arch/arm/boot/dts/imx6q-arm2.dts | 1 + arch/arm/boot/dts/imx6q-evi.dts | 1 + arch/arm/boot/dts/imx6q-mccmon6.dts | 1 + arch/arm/boot/dts/imx6qdl-nit6xlite.dtsi | 1 + arch/arm/boot/dts/imx6qdl-nitrogen6_max.dtsi | 1 + arch/arm/boot/dts/imx6qdl-nitrogen6_som2.dtsi | 1 + arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi | 1 + arch/arm/boot/dts/imx6qdl-sabreauto.dtsi | 1 + arch/arm/boot/dts/imx6qdl-tqma6a.dtsi | 1 + arch/arm/boot/dts/imx6qdl-ts7970.dtsi | 1 + 11 files changed, 11 insertions(+) diff --git a/arch/arm/boot/dts/imx6dl-riotboard.dts b/arch/arm/boot/dts/imx6dl-riotboard.dts index e7d9bfbfd0e4..e7be05f205d3 100644 --- a/arch/arm/boot/dts/imx6dl-riotboard.dts +++ b/arch/arm/boot/dts/imx6dl-riotboard.dts @@ -90,6 +90,7 @@ pinctrl-0 = <&pinctrl_enet>; phy-mode = "rgmii-id"; phy-handle = <&rgmii_phy>; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present; diff --git a/arch/arm/boot/dts/imx6q-arm2.dts b/arch/arm/boot/dts/imx6q-arm2.dts index 0b40f52268b3..75586299d9ca 100644 --- a/arch/arm/boot/dts/imx6q-arm2.dts +++ b/arch/arm/boot/dts/imx6q-arm2.dts @@ -178,6 +178,7 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_enet>; phy-mode = "rgmii"; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present; diff --git a/arch/arm/boot/dts/imx6q-evi.dts b/arch/arm/boot/dts/imx6q-evi.dts index c63f371ede8b..78d941fef5df 100644 --- a/arch/arm/boot/dts/imx6q-evi.dts +++ b/arch/arm/boot/dts/imx6q-evi.dts @@ -146,6 +146,7 @@ pinctrl-0 = <&pinctrl_enet>; phy-mode = "rgmii"; phy-reset-gpios = <&gpio1 25 GPIO_ACTIVE_LOW>; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present; diff --git a/arch/arm/boot/dts/imx6q-mccmon6.dts b/arch/arm/boot/dts/imx6q-mccmon6.dts index 55692c73943d..64ab01018b71 100644 --- a/arch/arm/boot/dts/imx6q-mccmon6.dts +++ b/arch/arm/boot/dts/imx6q-mccmon6.dts @@ -100,6 +100,7 @@ pinctrl-0 = <&pinctrl_enet>; phy-mode = "rgmii"; phy-reset-gpios = <&gpio1 27 GPIO_ACTIVE_LOW>; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; status = "okay"; diff --git a/arch/arm/boot/dts/imx6qdl-nit6xlite.dtsi b/arch/arm/boot/dts/imx6qdl-nit6xlite.dtsi index 0ad4cb4f1e82..a53a5d0766a5 100644 --- a/arch/arm/boot/dts/imx6qdl-nit6xlite.dtsi +++ b/arch/arm/boot/dts/imx6qdl-nit6xlite.dtsi @@ -192,6 +192,7 @@ phy-mode = "rgmii"; phy-handle = <ðphy>; phy-reset-gpios = <&gpio1 27 GPIO_ACTIVE_LOW>; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present; diff --git a/arch/arm/boot/dts/imx6qdl-nitrogen6_max.dtsi b/arch/arm/boot/dts/imx6qdl-nitrogen6_max.dtsi index beaa2dcd436c..57c21a01f126 100644 --- a/arch/arm/boot/dts/imx6qdl-nitrogen6_max.dtsi +++ b/arch/arm/boot/dts/imx6qdl-nitrogen6_max.dtsi @@ -334,6 +334,7 @@ phy-mode = "rgmii"; phy-handle = <ðphy>; phy-reset-gpios = <&gpio1 27 GPIO_ACTIVE_LOW>; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present; diff --git a/arch/arm/boot/dts/imx6qdl-nitrogen6_som2.dtsi b/arch/arm/boot/dts/imx6qdl-nitrogen6_som2.dtsi index ee7e2371f94b..000e9dc97b1a 100644 --- a/arch/arm/boot/dts/imx6qdl-nitrogen6_som2.dtsi +++ b/arch/arm/boot/dts/imx6qdl-nitrogen6_som2.dtsi @@ -263,6 +263,7 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_enet>; phy-mode = "rgmii"; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present; diff --git a/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi b/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi index 904d5d051d63..731759bdd7f5 100644 --- a/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi +++ b/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi @@ -267,6 +267,7 @@ phy-mode = "rgmii"; phy-handle = <ðphy>; phy-reset-gpios = <&gpio1 27 GPIO_ACTIVE_LOW>; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present; diff --git a/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi b/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi index 1368a4762037..3dbb460ef102 100644 --- a/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi +++ b/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi @@ -295,6 +295,7 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_enet>; phy-mode = "rgmii-id"; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present; diff --git a/arch/arm/boot/dts/imx6qdl-tqma6a.dtsi b/arch/arm/boot/dts/imx6qdl-tqma6a.dtsi index 7dc3f0005b0f..0a36e1bce375 100644 --- a/arch/arm/boot/dts/imx6qdl-tqma6a.dtsi +++ b/arch/arm/boot/dts/imx6qdl-tqma6a.dtsi @@ -7,6 +7,7 @@ #include &fec { + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present; diff --git a/arch/arm/boot/dts/imx6qdl-ts7970.dtsi b/arch/arm/boot/dts/imx6qdl-ts7970.dtsi index d6ba4b2a60f6..c096d25a6f5b 100644 --- a/arch/arm/boot/dts/imx6qdl-ts7970.dtsi +++ b/arch/arm/boot/dts/imx6qdl-ts7970.dtsi @@ -192,6 +192,7 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_enet>; phy-mode = "rgmii"; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present; From patchwork Wed Oct 19 08:34: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: 5045 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp247421wrs; Wed, 19 Oct 2022 03:40:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7shOQt9+A0nOrhBDsCZZ0KSqZAxApZE8RKleS8lzHVCV1kllF2yo9x4zJOSiy0yribZZ0P X-Received: by 2002:aa7:c78e:0:b0:456:c524:90ec with SMTP id n14-20020aa7c78e000000b00456c52490ecmr6775219eds.192.1666176046341; Wed, 19 Oct 2022 03:40:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176046; cv=none; d=google.com; s=arc-20160816; b=w4LTwtoDikPGTxx7yTBK4y5n3Y1UfbMwyZpqyU1wc9YyRe1Z3UmqL/NRxQKz9p6TBZ qHntMO0Qvb+eP2Ebh1xF9N5psiT5r77HntBd3cmBIhVzQaHqPLDunT2tHBs/c1UIiXlX 173rf0B0ItL4xDpFD2lJhT55KRNSNbHmLpMPYSo2SD3W8hAJ800H54womugARXmuviUv Rd4AeH4zUZ36gOmk4x46hvKxzur6/krjMh7wSfLDOlYjyCGpdspggDOQulZo1UXwiRJy ThbqS9l8UhfGPLkV96L/lwBkabFAgPgwFn7MQK27Tuo0YTHew0XG3BDHTsgKeKF3PwUz qAIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2k4dB7E5FF64xJ66SSBnehljjcrqg2jSljoX4MBk9t0=; b=AkPIk0jVbTe2xwyUi6hvFNDxC1TZy2CJI/rvXByPS0oo3SlKBgCg0gePc9NZcwli9T nFNTOrXjjQEFjSxgyRuN9HV5dgVUUn1z6ISJi9UTa3r9RH0yha5EA6en4Qbpm6QGZx2B iA9W5OsHthTbHVtuHrXH7Uw7uhvDd23NHrUSM3ty8Sg/iAW9YfhIA0A2n5U2HEC7KoL8 5fV3N1EEl6dKO+hSDwjWdTA2ZLqD1ZTW5BHTxsfyiwdk8KnQtl3eHW4Y0rMVGiHgQVTq YZnKCmRyUsPF2xiwH5u7exGdId5BhCNSB65VZrqWIPG4CkNDub4VCy7eI+EHMg36Ejkc PPmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="M/+RHjP4"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y4-20020aa7ce84000000b0045c29d74fd0si12568265edv.291.2022.10.19.03.40.20; Wed, 19 Oct 2022 03:40: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="M/+RHjP4"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230346AbiJSKj1 (ORCPT + 99 others); Wed, 19 Oct 2022 06:39:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231469AbiJSKil (ORCPT ); Wed, 19 Oct 2022 06:38:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1078310B787; Wed, 19 Oct 2022 03:17: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 A8803B824CB; Wed, 19 Oct 2022 09:12:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27D2AC433C1; Wed, 19 Oct 2022 09:12:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170740; bh=YXJ6jlhVaIydLU7g8el4Ja0yIXr/JjeVWdr42HHWms0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M/+RHjP4D7C2uRZuxvtqGrzWki8PXoF++3ZjtwTcFSJdmITDbZbDy3M8G7dJy+eB9 syQqSLIXly6yNLJtvDxGPpvBT2VC9Z5ZBeeEplcgxBWFWdiSZWzSnN0MoZEzvlP2QE 5tAYawDHxrAa2U0JTKo5443ImN3jdxQvjGVUbpmk= 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 6.0 769/862] ARM: dts: imx7d-sdb: config the max pressure for tsc2046 Date: Wed, 19 Oct 2022 10:34:16 +0200 Message-Id: <20221019083323.902266466@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112214051512354?= X-GMAIL-MSGID: =?utf-8?q?1747112214051512354?= 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 78f4224a9bf4..e93b9cd9c27b 100644 --- a/arch/arm/boot/dts/imx7d-sdb.dts +++ b/arch/arm/boot/dts/imx7d-sdb.dts @@ -206,12 +206,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 Wed Oct 19 08:34: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: 4930 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp226093wrs; Wed, 19 Oct 2022 02:44:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5SFMzgFZ2FREbDqiSy22zVtdYEDYMt+zCYksnbdXu6T9F82t0GcMOQ2GTYqE4e5/Y2UB58 X-Received: by 2002:a05:6402:5406:b0:452:1560:f9d4 with SMTP id ev6-20020a056402540600b004521560f9d4mr6647202edb.333.1666172579210; Wed, 19 Oct 2022 02:42:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172579; cv=none; d=google.com; s=arc-20160816; b=Z32tCQ4Z2BDKNE7rCyk1r7HjVzy5JTL3eGwqrXKQDtfG/14VNUbHQu6dEDEvu5Yut9 GcfFA3t+dIJKuucdcHz9s0jvZsDnlO0a4zYKBmYmXzp/b0GSaYefnQ4H8spIobnPHF+c S+yKH2Wf3NImdBTIYkFDnMO8Y5+oQJIOAEK8wcor5VvjGkj6ZP9h8luBxdJ7bSd39uEz BrSmiTbqUWXppPKsHCEnRKuTXr88jlCox8PjYGd6J2Gs5QSISQldoe/Cjj0/z8K40jqR f4Zzk3cArPzg4E9mfoi0P2ZJsrKyIEhpRua1ShPjzv0fRQiFkejO5ATdLrr7vKl8A5TO uCDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OCNJxLOuJv5AtODbNHEZTelerdpEF9oG2N3Msk1g0Pg=; b=bEY0771gtn0q4Iq1AOhljLdMC4fsbCIyaWkif1063ZxPSUBOHGolFTIs+hWl9U8Q+0 zJMckjMYwUyqvKv/tFlMpBS5kTA5MhTwWqTE5nWxQD3UGfRJK8X9wEJVSeTZmq2V1Rif /2NLlioZWcvaalGKZM52mPt156x3jvUXf631lPtRqT1LV0VWBhkO6bJ5t8UJKlK/vRwF yg/1nKcXy3TlwlpNvy7Eue9yBEX4aF8OUDJMIGKUy4vf6hWVkXvxdDx7MFjUQB3NNIMs rNdqQMFK5+pR7EKfidifkGtGiN/cvBFvZollXAGhe1wLzPzq3oOruD+3PxDdsbr1PuD+ HEOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RdWvhbqM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a05640211c700b004593a09f7cdsi11937305edw.394.2022.10.19.02.42.33; Wed, 19 Oct 2022 02:42: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=RdWvhbqM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233732AbiJSJbo (ORCPT + 99 others); Wed, 19 Oct 2022 05:31:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233379AbiJSJ2L (ORCPT ); Wed, 19 Oct 2022 05:28: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 48B222F00B; Wed, 19 Oct 2022 02:12: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 A2F79617FB; Wed, 19 Oct 2022 09:12:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3ABDC433C1; Wed, 19 Oct 2022 09:12:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170743; bh=JmpHzPt5OzRE48qvSoGUsEyjroleAuSqVfzmL+otnSI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RdWvhbqMZz2gWm+bkfnUUcuo0xe8D3Za7mAIOArLU2dMV/FrnBQfAlytdssw6ql7Q H8YFQyO3SpYNz0ag6wKj6BK/r6IuLrDMOYEskspMKB+VAU2rfE6pxULiMkOn7ILiEJ EniXwZd59/AtmSQ0TCKhn8pnAYQO9NAWgUp7XwcY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Stephen Boyd , Vinod Koul , David Heidelberg , Bjorn Andersson , Sasha Levin Subject: [PATCH 6.0 770/862] arm64: dts: qcom: sc7280-idp: correct ADC channel node name and unit address Date: Wed, 19 Oct 2022 10:34:17 +0200 Message-Id: <20221019083323.943895684@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108578234531749?= X-GMAIL-MSGID: =?utf-8?q?1747108578234531749?= From: Krzysztof Kozlowski [ Upstream commit 5589ffb2da2a66988ab3a68334dad3e68b42e3a9 ] Correct SPMI PMIC VADC channel node name: 1. Use hyphens instead of underscores, 2. Add missing unit address. This fixes `make dtbs_check` warnings like: qcom/sc7280-idp.dtb: pmic@0: adc@3100: 'pmk8350_die_temp', 'pmr735a_die_temp' do not match any of the regexes: '^.*@[0-9a-f]+$', 'pinctrl-[0-9]+' Signed-off-by: Krzysztof Kozlowski Reviewed-by: Stephen Boyd Reviewed-by: Vinod Koul Reviewed-by: David Heidelberg Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220828084341.112146-12-krzysztof.kozlowski@linaro.org Signed-off-by: Sasha Levin --- arch/arm64/boot/dts/qcom/sc7280-idp.dts | 2 +- arch/arm64/boot/dts/qcom/sc7280-idp.dtsi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/sc7280-idp.dts b/arch/arm64/boot/dts/qcom/sc7280-idp.dts index 6d3ff80582ae..e2e37a0292ad 100644 --- a/arch/arm64/boot/dts/qcom/sc7280-idp.dts +++ b/arch/arm64/boot/dts/qcom/sc7280-idp.dts @@ -78,7 +78,7 @@ }; &pmk8350_vadc { - pmr735a_die_temp { + pmr735a-die-temp@403 { reg = ; label = "pmr735a_die_temp"; qcom,pre-scaling = <1 1>; diff --git a/arch/arm64/boot/dts/qcom/sc7280-idp.dtsi b/arch/arm64/boot/dts/qcom/sc7280-idp.dtsi index a74e0b730db6..27c47ddbdf02 100644 --- a/arch/arm64/boot/dts/qcom/sc7280-idp.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7280-idp.dtsi @@ -264,7 +264,7 @@ }; &pmk8350_vadc { - pmk8350_die_temp { + pmk8350-die-temp@3 { reg = ; label = "pmk8350_die_temp"; qcom,pre-scaling = <1 1>; From patchwork Wed Oct 19 08:34: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: 4889 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225469wrs; Wed, 19 Oct 2022 02:43:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5JPtzKR4LsafWppRbTNjmzgHSRqKyb6uC636s3ulYI5CGNGMlnoXkMy3ZYUiOcNUbUFP+9 X-Received: by 2002:a05:6402:2686:b0:45d:82c0:c2b6 with SMTP id w6-20020a056402268600b0045d82c0c2b6mr6398053edd.390.1666172593962; Wed, 19 Oct 2022 02:43:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172593; cv=none; d=google.com; s=arc-20160816; b=d32mrU1x4cRHSi3ibIROVfAWj8QOUk+K3BVvIou+v1Mihn3KCr0akQgbki8ryuxRay XmWj9B5HCJdm+CRF2VflVLHQJPPu2uihZNhn0fJ8QapSdiUCE0bBjlqRaXmgARabKUE+ G7iP+gZDWyJ31SBxG1FPdV5NLsbFTy4ztpGZ4dGzzHq9gVk6cN8tGaSHSkMDCQNdIwzA MDaaXeYBpTpQO9Bh9XBrmLCAqHP0/aAVkLkSuBYb9XDoN7upV3gPHt9BeaCJbWflEnou +dSAqtOwRGriwkiyg3Os3hujF/xZCCLM+ZyGnvyO8Z0cJ929PMAGZLQOIZVELQUvJ5l4 Z3VA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rIGIBiHBFbuNhsT+y2ZdWaoNz1OOxAbkDcZcFq4vrB4=; b=Q+NXEIVo0IbhnKQJ5NtDl0zM38CK1W10W6yyqVaGAbW2YXrGsRKIflS2Tzuc3bfUv4 EyGeBpnMTi6BYu97k3fy7Tzqbd7vEMT2EL2uCNHqb85JC3AKUNORkIih0ZSd3bVmJudh EkRcQZ9H3tvK8t0954s/llftvqhsuO4v7SLe4A6EXJnQdTHWrG4eT5ItxRhrwkq7VrLx UZSDEqKF+v2NlCvWTV1I28iZ7mDMuAy9h39PsLquT+rLQ22QsDFt5ijOafBNcfkjXBR5 ancqI3VqTbQb6rHwNtzyKmWHEBQnxuaJTvWQRn5YF46BhOrfkAIt2JW8jL0IQCkS2QVL 6NAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eYKFnrHJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p26-20020a170906a01a00b0078db89b2566si12204328ejy.699.2022.10.19.02.42.48; Wed, 19 Oct 2022 02:43:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eYKFnrHJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233654AbiJSJdb (ORCPT + 99 others); Wed, 19 Oct 2022 05:33:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233742AbiJSJ3R (ORCPT ); Wed, 19 Oct 2022 05:29:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C616EA354; Wed, 19 Oct 2022 02:12: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 7A815617E9; Wed, 19 Oct 2022 09:12:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8CABEC433D6; Wed, 19 Oct 2022 09:12:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170745; bh=/UPmvDRbtsBw3+d+730TijZ/pJ3LtWpVfzkxMeoQgAc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eYKFnrHJkwxOQETbU7WSas87+lf/9VLZh0BC6wQdNZMPIUVdfWT7LUifHvm4fw910 jR+YacsYLeiYCnbVz+fM0IKjg1ev8Fma16aqszpfeyQysG1Lg23BjYeFX0E/nlVoho WTWfKe+mGTmg8gDLq+s0j7Dm59II0ZNiJvL81X5E= 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 6.0 771/862] ARM: dts: imx6q: add missing properties for sram Date: Wed, 19 Oct 2022 10:34:18 +0200 Message-Id: <20221019083323.981985955@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108593668035136?= X-GMAIL-MSGID: =?utf-8?q?1747108593668035136?= 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 3b77eae40e39..df86049a695b 100644 --- a/arch/arm/boot/dts/imx6q.dtsi +++ b/arch/arm/boot/dts/imx6q.dtsi @@ -163,6 +163,9 @@ ocram: sram@900000 { compatible = "mmio-sram"; reg = <0x00900000 0x40000>; + ranges = <0 0x00900000 0x40000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6QDL_CLK_OCRAM>; }; From patchwork Wed Oct 19 08:34: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: 5391 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp304425wrs; Wed, 19 Oct 2022 05:43:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4riiPATl/EIz4ULdpwxE9Z0BCh5uO7ZfFd9z1WriXA9fkdm64x0N5LGK1qK/ULI/0vboow X-Received: by 2002:a62:1dcc:0:b0:567:6e2c:4810 with SMTP id d195-20020a621dcc000000b005676e2c4810mr4681036pfd.44.1666183388721; Wed, 19 Oct 2022 05:43:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666183388; cv=none; d=google.com; s=arc-20160816; b=Sdag5hHT7KP7C9oLo3D6lCytJ+aixiD8uebxOp4K5V8Z6KTcBcOyd1lGF2yiUPWr3r gdo0RV/0k/dYCmlgx6NukereA9ROAo7HBCnwnf9CbP1C165qONETml4UJRdrtkvHlyp1 7f4FcF8d/Cdq7qQbcIJTQ0qEITKW74H2wxkO0B+h5jtQNyhRNeT7AFcANc1NXlH7NlOI a4uHuW4C2i1zshz8/+2N65lXMsr/if3vV44EVSb/IK6fCe16hUMhT+nhKvsiRTYx8vBh pddQ4dWDAmwz5UWElfTycyOUom6Iiccdt0asqyMFm+zBENo5anBIaxRYif9PO8EljvH+ 3qjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hHzRSMJdSl0C5L4UQkWrk5YPxH9wd1WM93fD7Lcz4gU=; b=pbd4GOSPxoHV8xv3dB+iJTNpXT2o865E30enqs8GY0P1nog/nL7LX48Z/ZvhwHfh3n Q4OdMvX5sE39jIg4c9Ayk+jZJbB/MpBUz9iYIPumxa3ZnrcvLnRSTDJqErB+Nzn4k5jx ubpHzAlsLAUEMKhfk4EW0zcN5EidbTg5nsENc6YN3UJE3ULLXDYnCUnlHjNHzzB23uZM kJExod5TZH++26AP6jKzrE7AuY6HZ+VU1eFk58lvjjJRwJWealfWXlD4OGqWRJS27amQ 44LXrBuyGWWjAyjn+mUEgKliSVSQGE/qLZjwEvSuBQZV4DUvFDxGQpmgNxlZPCZ7YQmq GyFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=k2FIbALr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m5-20020a63fd45000000b004561c1f132csi18828840pgj.346.2022.10.19.05.42.55; Wed, 19 Oct 2022 05:43:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=k2FIbALr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232790AbiJSMj2 (ORCPT + 99 others); Wed, 19 Oct 2022 08:39:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233268AbiJSMis (ORCPT ); Wed, 19 Oct 2022 08:38:48 -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 5824ED7D; Wed, 19 Oct 2022 05:19: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 377446178B; Wed, 19 Oct 2022 09:12:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47D2DC433C1; Wed, 19 Oct 2022 09:12:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170748; bh=1FMfPEnSeBy8Q/Qoddf82KOkolHueXSymF+0YgWpJjQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k2FIbALr4RHBPdY2QvJSZkosnXDgwcmNdWb7VCaVdzF7O6FHaF4ZixfyrmkdJng3S 8EdsZdCG7Sw2rPErotZSYI9hQfX4MlWDzZexJyWbecLosIccRvJ0KtnjJH9IS2qriu r/N4PPlPrZZkMWFfZNiFajbhmllMIoodt7il87RM= 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 6.0 772/862] ARM: dts: imx6dl: add missing properties for sram Date: Wed, 19 Oct 2022 10:34:19 +0200 Message-Id: <20221019083324.020499185@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747119913048584953?= X-GMAIL-MSGID: =?utf-8?q?1747119913048584953?= 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 8e0ed209ede0..dc919e09a505 100644 --- a/arch/arm/boot/dts/imx6dl.dtsi +++ b/arch/arm/boot/dts/imx6dl.dtsi @@ -84,6 +84,9 @@ ocram: sram@900000 { compatible = "mmio-sram"; reg = <0x00900000 0x20000>; + ranges = <0 0x00900000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6QDL_CLK_OCRAM>; }; From patchwork Wed Oct 19 08:34: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: 5402 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp311761wrs; Wed, 19 Oct 2022 06:00:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7yMWt2W9/Pqvx6LB9Tm+DOZ2MCmURVYGsWKg9fNBcg857Mpfhd9Vjc+hb7UxR6FnnjGoXt X-Received: by 2002:a17:907:8693:b0:791:a37d:e9ac with SMTP id qa19-20020a170907869300b00791a37de9acmr5102635ejc.7.1666184453522; Wed, 19 Oct 2022 06:00:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666184453; cv=none; d=google.com; s=arc-20160816; b=AkhmICP8wzzhmCHWHnuhH+hZrGh7zzbwx+hGth9RS6Q0Hs1V5b4ASEbhQpmzNov3iF 7J4kBkzEGgcsidTSi63d0f8BLoFulUr1h9M2zxBALG7hW3smW2ELOQqjzuPGW7NHAY5L 7mWkrVhFUERprJG0WQa0vzT3McAkmm+be0SAqPMxTpZLwOFVhGg67AkFlS4xHaHC1Cnk FbpyvbluectvICEuXSyDKLnP1BYaJUuvDo/Giaj8aBLdFPgyjMZsq2YwuNHTqm2+3kha XYoX83TI6ZiId82eGrGy/swzYSRL3GxnzWptmnY5tzuNU8ahLEDsaagTc6wM6D6SHBt1 Xw2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=g/W2IHSbl+5B1G/xoZdlCTg2aCCVNxJ2a1lkQ+7hyjI=; b=X555Np7GBDHXfzMmEu3JbxOTfHcAAyCgkYdZPGGzNChOc3jOgEIHuHMQR2J0LwPIim gA/w8UuMns6s4NxJrtgSof4eCr+X3QRZIkEOzEETbGkOj6aWLE1J5c+mmy3lTK70aVY9 fuxutPM/fPUhaBxCcP7FO4FAwpCQ+j51yS+4LuzQmCoecNLgzJ0HnswPoDWLAq8keqrE 9zBjPLCDzMlSiBW8IQYAV/Qc46r4AmJHMLCBcbbe0LlnmNFXbcef7VH9FFCCyaYC8jXK hrI0M+YnLNmwDpVB91aWLhZqbFxm7elQsr2A4EMvp62neOKQ2ybJZ6mi+A+hxnvqm4R2 mYlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nUnHU1yC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m15-20020a056402430f00b0043d54ba0a4dsi17155964edc.327.2022.10.19.06.00.23; Wed, 19 Oct 2022 06:00:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nUnHU1yC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233400AbiJSMuE (ORCPT + 99 others); Wed, 19 Oct 2022 08:50:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233591AbiJSMtL (ORCPT ); Wed, 19 Oct 2022 08:49: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 0E8AE27932; Wed, 19 Oct 2022 05:32:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D969AB824D5; Wed, 19 Oct 2022 09:12:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C11AC433D6; Wed, 19 Oct 2022 09:12:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170754; bh=LnPRrEoDzH7H8HbDkKzRjnxiAaycDy98ULWnwDlGX2c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nUnHU1yCbYJgCVD2g3zYhqT3Gj1MmKllEEpzagGX7uB+cFa668CtOvdxeJGsKCd13 g93lSPc9LmyrPUTjPBsQDveLybknT0avT+W08qnKeLMpQEuF0Eps3pLId7OTM3xIjr K96rWLqX4e23CCU/FCzYVfnMPhSZZvFwsP5hkLpg= 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 6.0 773/862] ARM: dts: imx6qp: add missing properties for sram Date: Wed, 19 Oct 2022 10:34:20 +0200 Message-Id: <20221019083324.066473333@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747121029184001489?= X-GMAIL-MSGID: =?utf-8?q?1747121029184001489?= 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 050365513836..fc164991d2ae 100644 --- a/arch/arm/boot/dts/imx6qp.dtsi +++ b/arch/arm/boot/dts/imx6qp.dtsi @@ -9,12 +9,18 @@ ocram2: sram@940000 { compatible = "mmio-sram"; reg = <0x00940000 0x20000>; + ranges = <0 0x00940000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6QDL_CLK_OCRAM>; }; ocram3: sram@960000 { compatible = "mmio-sram"; reg = <0x00960000 0x20000>; + ranges = <0 0x00960000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6QDL_CLK_OCRAM>; }; From patchwork Wed Oct 19 08:34: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: 5044 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp247281wrs; Wed, 19 Oct 2022 03:40:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7mcwelSEs9Fg5fl5gHKNCBIZxoLAonypi3/1iHgb4b2psnuwy0A/RNB2U2yMGcjkWc1/qZ X-Received: by 2002:aa7:cc90:0:b0:458:b07c:f35f with SMTP id p16-20020aa7cc90000000b00458b07cf35fmr6574211edt.310.1666176026694; Wed, 19 Oct 2022 03:40:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176026; cv=none; d=google.com; s=arc-20160816; b=gQB/YKR0KcDJQMkjMHimK8t/r3oX0ajDM0Rg1oxEG5rziyREF4+un1kW9FZTHfaBe6 QnSyG3lEzErU5ZvnPus5rd1km1aZJK4jdPekYN2MzdiQbdPe3WoTIQoumJb5Jx2wTR8X bswznWPyG4VFLSf0P1I0p6magfw5HWVYrfAK/NSRTf9s+EzENcFh6i3drkqi/GhTOfbC MsCG3jsxVEDbHMNdxWjN1jO5ZjQQfdI4HwHcf5C3kyJBk0r8Jkro23vIlsJbUz0GrIDP II75DL9l/31G4I0QV/i6lSP802ccdI8wM9JX/0NwCychCy/aHyoQuvG1jfyn1Op+loBj +Tyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=B3Y3Xl8TFPorfZKxUW93YkzptNKqsIxMjjmC1jqlxSY=; b=MuoS93VPhBIXux54IpzMZE1a+SBvtUygefxk/9oPr1fVleHqGM9d1+HcpyWEcIkOZl MYTXeAFJCnkGJ3fy56KUztpLxWHo6UUcP185VPrt30CAW8m3b4274exTvORmvny2kQAs 9jdX44ZyzeVXPUXSj3J3d0jn0F6ZZYT/9hZ/tKR5dC3bIkviGLMw0N+ukktoedOENHg5 XXH/ZMWjifLSlEVZ5dmv/QqOSg/edSdIaSYcFaTdPKOzpJiyd1JC3nSbzWMByEWslObm SxmnuvSIQTtJopJU7boW36yuG1IqhzQZv0CaI7ZYafBKfFK35hM9djf4VPyZezuihdWQ ZC3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="C/TO3U2G"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gb6-20020a170907960600b0078d25914115si16730662ejc.570.2022.10.19.03.40.00; Wed, 19 Oct 2022 03:40: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="C/TO3U2G"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230044AbiJSKjW (ORCPT + 99 others); Wed, 19 Oct 2022 06:39:22 -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 S230322AbiJSKiw (ORCPT ); Wed, 19 Oct 2022 06:38:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DC3B156241; Wed, 19 Oct 2022 03:17: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 A28F2B824C7; Wed, 19 Oct 2022 09:12:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 243FCC433D6; Wed, 19 Oct 2022 09:12:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170757; bh=01jDxhgdXrSDbn6vPLVwOQpBBL5rmQYUKZArmb7rDrI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C/TO3U2GrWsswrsdxCyeEHMHh24J+IvhTZl8ZhyMOXYdeWaHmTX6GHY4ZrsN7mvFT BmwOeKXBHczHpSP8FkRh477F0FIoQiaNrjmB29XKJdOad4ibauMjZae8BbvldeuX5S LjdOHMSPN106RK2Lb7SA8AFf4SgYufHuwonqHfNc= 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 6.0 774/862] ARM: dts: imx6sl: add missing properties for sram Date: Wed, 19 Oct 2022 10:34:21 +0200 Message-Id: <20221019083324.106913519@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112193760633502?= X-GMAIL-MSGID: =?utf-8?q?1747112193760633502?= 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 06a515121dfc..cfd6b4972ae7 100644 --- a/arch/arm/boot/dts/imx6sl.dtsi +++ b/arch/arm/boot/dts/imx6sl.dtsi @@ -115,6 +115,9 @@ ocram: sram@900000 { compatible = "mmio-sram"; reg = <0x00900000 0x20000>; + ranges = <0 0x00900000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6SL_CLK_OCRAM>; }; From patchwork Wed Oct 19 08:34: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: 5128 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp251540wrs; Wed, 19 Oct 2022 03:51:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7inS2MTlG4/yER5sgk1AcKsNU9ngAMA4YCy3k85OW8N+5QaYUmj/uN0gi6ppXDUrqwa7Qe X-Received: by 2002:a17:907:a073:b0:78d:9e06:8ba9 with SMTP id ia19-20020a170907a07300b0078d9e068ba9mr6173786ejc.338.1666176717241; Wed, 19 Oct 2022 03:51:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176717; cv=none; d=google.com; s=arc-20160816; b=A0swm9IWGIF9WrYtMqO2KuURU5T/UZRwOLW/cbmD1IHdr7H5KX5u8oZTlD/IZPHMTN Mqs2A9p9cY+F2hF9j8lYIJ0dFf5D/tfsycIbuT0MoAbeS8EhA+Jt7QHCGk1mOT0YyBot XgeIp6HX8G2DdhxhHv+T9NCMPmRnqZs8Cw9mp86oJhh4oBW22V2VMDahvKhGUBQq1AJh zqFGIMLnyrmVcgZ6Um/v7HU6mGZnuO9frrkFoyhimT3+/I6ZhSB12GS2EwbT4wKoact7 fgqta28SimTsPJxOf9IthYOHw6MKNvkxzHcHULz1DAmLSUHTAmYRhCy2AdtU/TL8OzNa eqrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xvowuL+lCFpjsbAANtcCPq3hpe73Ispu60nW0ikKK8w=; b=tWSTccIzNeMwZ8s7JVOR7us0dLhbXVDSUJwwaqFdwPv7UGdMVJE8HXHBGMmMWH+icA KSkLZMIC2eJCP+xVY2CbNHu93P6ISnicUmxzICGNeXoaRXv2AmtFUsCthSUMaVPc0ty6 TSoPPwGGBlHTShUXyGCaOvfB+f5BjFj3KJGZD0SS6YOVP3A5BrVJhG3Evd0s2/VCkaKd 1RdXSwlxa9Cb3ZMi9ZsNjJExD9V7HuvzCuCtYVOBiZQcXnQNm8YKBRC13WSLt0IpK97m y9Yy/2Qbs9U6H8M3Ln3+FYeaGP78QATvuRLYPfyuaYeA4sFkug88s551o1rlvr8Rdw0n qgOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AEon5jEB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f8-20020a0564021e8800b0044e78dbb615si16587251edf.379.2022.10.19.03.51.33; Wed, 19 Oct 2022 03:51: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=AEon5jEB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234455AbiJSKuw (ORCPT + 99 others); Wed, 19 Oct 2022 06:50:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234243AbiJSKsY (ORCPT ); Wed, 19 Oct 2022 06:48:24 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4E59122754; Wed, 19 Oct 2022 03:22: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 5D625B824D3; Wed, 19 Oct 2022 09:12:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D19D2C433D6; Wed, 19 Oct 2022 09:12:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170761; bh=hC7weKyqCI/bOmZ+4VQhssSCJ6Wn8R/IKSruyt9fD58=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AEon5jEBQSIyGBw1LfW9rOKrClRpzOjUtZOuiI//+KOE8zSrSgDP/ed0K+FXlmvS8 qWU+ciu8HTp/0p/yvNc1BgRu+qjIs55Gi4tGAmRJM3QQtIjE9wEhXJ6oFGIhaNSqKS NzFYzlPUOY5ygtShDMvdnkjnYbBOF7h6eSSza3rA= 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 6.0 775/862] ARM: dts: imx6sll: add missing properties for sram Date: Wed, 19 Oct 2022 10:34:22 +0200 Message-Id: <20221019083324.148244847@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112917029204342?= X-GMAIL-MSGID: =?utf-8?q?1747112917029204342?= From: Alexander Stein [ Upstream commit 7492a83ed9b7a151e2dd11d64b06da7a7f0fa7f9 ] 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/imx6sll.dtsi | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm/boot/dts/imx6sll.dtsi b/arch/arm/boot/dts/imx6sll.dtsi index d4a000c3dde7..2873369a57c0 100644 --- a/arch/arm/boot/dts/imx6sll.dtsi +++ b/arch/arm/boot/dts/imx6sll.dtsi @@ -115,6 +115,9 @@ ocram: sram@900000 { compatible = "mmio-sram"; reg = <0x00900000 0x20000>; + ranges = <0 0x00900000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; }; intc: interrupt-controller@a01000 { From patchwork Wed Oct 19 08:34: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: 5076 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp249287wrs; Wed, 19 Oct 2022 03:45:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Ki8hsKEffGjuFau1SyNrELyRY0Ma07C5H59LXM4bceGD2BtpuXuy/Ip/HO38ZTRgYeddI X-Received: by 2002:a63:4f09:0:b0:440:4706:2299 with SMTP id d9-20020a634f09000000b0044047062299mr6744454pgb.115.1666176349603; Wed, 19 Oct 2022 03:45:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176349; cv=none; d=google.com; s=arc-20160816; b=KPiFE9cNxsk5cYtQb/oUcC9dQHKS9FwdzxHunFqwvgmAxXlw5yUhndS5++aRHQfNzg U7++WcKYFuofqXvh3WrhFv0XFxSVBvyG5dXk8KGdjC+1pwv3grs6GuaBMhThiDyqUDYZ r45f1PtKDJjz260/fNAWozAsgL0GuWEn1ZeGBCdXuGHm2Ogs/vW7fCZz6xX7Q6D981Ef TWeBJ8D/50EKZb7WACkXmU4sx88FDsMiDiu8cXTeqL1g0CjRIQ92kW6g8oV6RG3sNW/F cAea/CwqB5SdSJuDn7yNx7NcyOOTwj32tEr7dEzKX3Ypa+yzc/ufYvkIBY1PzLewo0Bq w+oQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GgOcJ8fGOFpohpnnx9po7frwk8AVHK+TwAwXSSORFDw=; b=cSlL3cSuXJyaoPMfn3VKSHBZMUq+dN+4VvsDWzW0bubThI0IPgKTR4eZPL5j0TR+s8 P8s6kohEzFinZvT1reriuYKmqr+UuzxWEVx3YfEGLuTg0F2ILiAQapGrGUi7kWRiMkjP ef2B5wlKH3YVaGSP1T7P7rzVez/2Fv7qpC2sGJWVGqXjuAkxgYzq6dR8eWOo3BAUbpxb eXsqnFvROP0HokC4+M/sMoVdRmE66PfmuahaovAVLMFOWPAtHo7X8aB5J0TqrFui24rQ Qw04XJnK65LkLUchV5dH1j1JQh6Kym/lZCkgKM8gbZKNNrejamOmrrndv+Gyh8bFizWM bZMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rZBqmh4N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020aa796ad000000b0053712acc6e0si15018844pfk.246.2022.10.19.03.45.35; Wed, 19 Oct 2022 03:45: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=rZBqmh4N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232580AbiJSKpG (ORCPT + 99 others); Wed, 19 Oct 2022 06:45:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232297AbiJSKnV (ORCPT ); Wed, 19 Oct 2022 06:43:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C311F4D806; Wed, 19 Oct 2022 03:20: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 23574B824D6; Wed, 19 Oct 2022 09:12:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7FF92C433D6; Wed, 19 Oct 2022 09:12:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170763; bh=dtWVjWEZNz1q3Y4P/0EdQigzCiC8UA+5Rc0zCDFQZt0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rZBqmh4NSFMcNy8ddqKKt7h2Re8yASxsS3vnqJz3lAeeGdtVhd2/J7EnbjMHfv2+E RT5bNNzbleUamiFod6WpnYGlVm6YeqAaZMf+P0UYL46hR8htKm0Lhfk00a3e0WoL4p EwwU0/BBkJ0leTS5BtkpcaaHx+pD/I7+j3f6pGyw= 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 6.0 776/862] ARM: dts: imx6sx: add missing properties for sram Date: Wed, 19 Oct 2022 10:34:23 +0200 Message-Id: <20221019083324.195231808@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112531808323820?= X-GMAIL-MSGID: =?utf-8?q?1747112531808323820?= From: Alexander Stein [ Upstream commit 415432c008b2bce8138841356ba444631cabaa50 ] 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/imx6sx.dtsi | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm/boot/dts/imx6sx.dtsi b/arch/arm/boot/dts/imx6sx.dtsi index 4d075e2bf749..2611eef3b2a2 100644 --- a/arch/arm/boot/dts/imx6sx.dtsi +++ b/arch/arm/boot/dts/imx6sx.dtsi @@ -164,12 +164,18 @@ ocram_s: sram@8f8000 { compatible = "mmio-sram"; reg = <0x008f8000 0x4000>; + ranges = <0 0x008f8000 0x4000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6SX_CLK_OCRAM_S>; }; ocram: sram@900000 { compatible = "mmio-sram"; reg = <0x00900000 0x20000>; + ranges = <0 0x00900000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6SX_CLK_OCRAM>; }; From patchwork Wed Oct 19 08:34: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: 4906 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225459wrs; Wed, 19 Oct 2022 02:43:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7GQNMBa39StgZ/IWEJ+YUIFhlyUjKydqABF5fb15iAiW8EO29r+az9cyxdPWmrKg8oxcN/ X-Received: by 2002:a05:6a00:178a:b0:563:7ada:f70 with SMTP id s10-20020a056a00178a00b005637ada0f70mr7535842pfg.69.1666172592686; Wed, 19 Oct 2022 02:43:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172592; cv=none; d=google.com; s=arc-20160816; b=Rkibbt/iJPNTl4sP7aesJRWhsYkjWCnQcbeyYKyNaWfVpiiLZ6Xhuwicy8Nr7A/1zz vxuCgeE9H8pVgutgGEirXJO29dNrDDsmtVmoaFRhbVhYfCmZe54XGBTGlehvRoiRxaOc SaC9fdvMxp/uwHY8kMbCwt0uOgs5PBzXBlP3mHPvwRhHm02tpicHoTA/OY+ylwwZ/js3 6HavP+oCTKpTBitMePm3ZjOlEdGZGBe44u0D2Z1IZ8E8VtEPMPh+5+4ro1FEv9mqfEkf D8OJ4dRI4TxJNkc/Gu5GAP8RsXKavkqCE5f2T60y67m2kG/rxXxT753klpyAsNoLub29 0fUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MjIEC0xZMITsarOtOrMSLjV0JjcBwUbOpJ9XoLej8g4=; b=rmBEw+ncDzdbSTOh0pSLw9PKig/OjGWpkrK2n0UwatKN08bp5kMPWetsYHSgo5KTrF UZ1iIJfwuQD2Npf8WWW0+Q6yk5d6qQo7L67/z32F1LqQ/SbuKZ54zlcm9HR4IMFwFJov DhgXJeCMqQvoVskWTKk/iDschcbWpWSvBD9J7/Zhv4idBGadDY2vT9ZaMB4fDEV794lh /VBccMNqBdYEg8w6HkEhWh53h6+S7EQRV2XZwfD6j/iErp4LzWHP8/IvhBYdY9ieL4hO bBbuEtPR0fteyCPpbOSsvNSkDKyOjx+/eYDJLz6VzZt3ykUEe6FPF+20z7351oCK9J6L XHNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BlcWLwtA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f10-20020a056a00238a00b0051bbbc5f0aasi18309661pfc.261.2022.10.19.02.43.00; Wed, 19 Oct 2022 02:43: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=BlcWLwtA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233817AbiJSJfi (ORCPT + 99 others); Wed, 19 Oct 2022 05:35:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233866AbiJSJ3m (ORCPT ); Wed, 19 Oct 2022 05:29: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 B83CCEC519; Wed, 19 Oct 2022 02:13:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 27D2961840; Wed, 19 Oct 2022 09:12:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3AE77C433B5; Wed, 19 Oct 2022 09:12:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170766; bh=teLkVvsGmTvEmoonmZOWurIfqTWLncO4ba3j6bGrtxA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BlcWLwtApucbErr4jCxPx+L9vc5p9DbICVw92X9G+DclNdrB1B4zpsN+KHqGbYNid cCbgmTXdxAFWgZ7R6Zt6VYtfIONvDEX+3T4Yt1q4x3vQ4GURKNCHNtMtQ4fi83Af8D 04F3TA1Xmir92pDfz4BFLQd+PSuFZGevHOkGJ3Ko= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marcel Ziswiler , Shawn Guo , Sasha Levin Subject: [PATCH 6.0 777/862] ARM: dts: imx6sl: use tabs for code indent Date: Wed, 19 Oct 2022 10:34:24 +0200 Message-Id: <20221019083324.235986504@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108592546224126?= X-GMAIL-MSGID: =?utf-8?q?1747108592546224126?= From: Marcel Ziswiler [ Upstream commit 218db824a7519856d0eaaeb5c41ca504ed550210 ] This fixes the following error: arch/arm/boot/dts/imx6sl.dtsi:714: error: code indent should use tabs where possible Signed-off-by: Marcel Ziswiler Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin --- arch/arm/boot/dts/imx6sl.dtsi | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/arch/arm/boot/dts/imx6sl.dtsi b/arch/arm/boot/dts/imx6sl.dtsi index cfd6b4972ae7..01122ddfdc0d 100644 --- a/arch/arm/boot/dts/imx6sl.dtsi +++ b/arch/arm/boot/dts/imx6sl.dtsi @@ -61,10 +61,10 @@ <792000 1175000>, <396000 975000>; fsl,soc-operating-points = - /* ARM kHz SOC-PU uV */ - <996000 1225000>, - <792000 1175000>, - <396000 1175000>; + /* ARM kHz SOC-PU uV */ + <996000 1225000>, + <792000 1175000>, + <396000 1175000>; clock-latency = <61036>; /* two CLK32 periods */ #cooling-cells = <2>; clocks = <&clks IMX6SL_CLK_ARM>, <&clks IMX6SL_CLK_PLL2_PFD2>, @@ -225,7 +225,7 @@ uart5: serial@2018000 { compatible = "fsl,imx6sl-uart", - "fsl,imx6q-uart", "fsl,imx21-uart"; + "fsl,imx6q-uart", "fsl,imx21-uart"; reg = <0x02018000 0x4000>; interrupts = <0 30 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clks IMX6SL_CLK_UART>, @@ -238,7 +238,7 @@ uart1: serial@2020000 { compatible = "fsl,imx6sl-uart", - "fsl,imx6q-uart", "fsl,imx21-uart"; + "fsl,imx6q-uart", "fsl,imx21-uart"; reg = <0x02020000 0x4000>; interrupts = <0 26 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clks IMX6SL_CLK_UART>, @@ -251,7 +251,7 @@ uart2: serial@2024000 { compatible = "fsl,imx6sl-uart", - "fsl,imx6q-uart", "fsl,imx21-uart"; + "fsl,imx6q-uart", "fsl,imx21-uart"; reg = <0x02024000 0x4000>; interrupts = <0 27 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clks IMX6SL_CLK_UART>, @@ -312,7 +312,7 @@ uart3: serial@2034000 { compatible = "fsl,imx6sl-uart", - "fsl,imx6q-uart", "fsl,imx21-uart"; + "fsl,imx6q-uart", "fsl,imx21-uart"; reg = <0x02034000 0x4000>; interrupts = <0 28 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clks IMX6SL_CLK_UART>, @@ -325,7 +325,7 @@ uart4: serial@2038000 { compatible = "fsl,imx6sl-uart", - "fsl,imx6q-uart", "fsl,imx21-uart"; + "fsl,imx6q-uart", "fsl,imx21-uart"; reg = <0x02038000 0x4000>; interrupts = <0 29 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clks IMX6SL_CLK_UART>, @@ -714,7 +714,7 @@ #power-domain-cells = <0>; power-supply = <®_pu>; clocks = <&clks IMX6SL_CLK_GPU2D_OVG>, - <&clks IMX6SL_CLK_GPU2D_PODF>; + <&clks IMX6SL_CLK_GPU2D_PODF>; }; pd_disp: power-domain@2 { From patchwork Wed Oct 19 08:34: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: 5398 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp311487wrs; Wed, 19 Oct 2022 06:00:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM71JfVpwc0BV8UhgnhtuN4tdVBqTWbj5BRXkJr1ucnSbbjPuco2pfqre6Ftan9+olGAChNV X-Received: by 2002:a17:902:d2c6:b0:17f:592b:35dd with SMTP id n6-20020a170902d2c600b0017f592b35ddmr8358755plc.172.1666184431873; Wed, 19 Oct 2022 06:00:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666184431; cv=none; d=google.com; s=arc-20160816; b=F8A73UuEKH7D6pfCJw4T8NV05ZbOc+mwwtMT36SxTnXcINCIU2hriyGgZ+RGi/PAr3 +li6B/7orbaRAA/VMg3EoEw1GmVTva53/W86V7SafKOdQtf5JZWWIThWuUp42NTr/ox1 G/PROt+TVwH0kyFQwiwVJA0vwEGYu6/G1hynYOvxf7137Z0Yjmg0ySN13OyhABWNQnyJ 9aGi4v5AAOjXZwkAWmjbzJcp5oxKhIIw+5SPxkRLK+4018f9wzD0pcfszdph+IfuR5Tv HJ9NoXxaXSJO1yNwTi7oNa5tleZExSY0h7Gt4VbEseVTAnAZXqFFSA1fkTJhyz01zSJS c83Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NcoPaPHVfJFDveYjF6/vwYvXghdIv70K7/fWbnw5E/A=; b=R+BC2vzz5d0aLMmuteb7Prow9qSZaJoJ6zcAXLsThw3tbiaX11SaNk/j8OiosV0gqN Eww7Eo5v+GTZtE8BhAHmhBgD5N7ZEM5XXd5B4tQRpnSAuTFYMhkR15eqafm+RX7nl/ti wQH4KIvrPvzSQBAv4ZR7v1q7nd+Y7hS2iO+ag5IHPYNs4+GxisaVUzor/99ayYdmHh1K MMYoVJ59aNibBht7rMr/WwK3O8Uyw/4yVdwgRisyEaCuKv3aobDsselOm+NsHeq6E18a 3221HtDnoltQmKjS/V+7Slx1SAb1ZFiVrOlAHQgfKkybLk+G5lneOaJ4FPeTMjXDIzys xnog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RPyG0gzw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a35-20020a631a23000000b004610dceef13si17280434pga.336.2022.10.19.06.00.15; Wed, 19 Oct 2022 06:00: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=RPyG0gzw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233386AbiJSMts (ORCPT + 99 others); Wed, 19 Oct 2022 08:49:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233378AbiJSMs7 (ORCPT ); Wed, 19 Oct 2022 08:48:59 -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 A5A1FC1DA0; Wed, 19 Oct 2022 05:31: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 B1993CE21C1; Wed, 19 Oct 2022 09:12:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D301FC433D7; Wed, 19 Oct 2022 09:12:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170769; bh=V3gHEUw1Kk05qfDus0qF9T3OcYJdKc5uRN6/d7kBomw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RPyG0gzwVVOfEaLsNk3fF7uyGQ8whYSHKMvuJAlRX2lVTtLbDl8ebnOdeSep/zEKJ iyOJV5G/aT/VAltZgfuhTl3GnqUxSujvtEuQf4+Top/5eo30zeG55AYIjsWMDx6X4/ BjNTxPuh7kUvovk+pOFC9ldOqqE5zxqQbh1hDhzM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marcel Ziswiler , Shawn Guo , Sasha Levin Subject: [PATCH 6.0 778/862] ARM: dts: imx6sx-udoo-neo: dont use multiple blank lines Date: Wed, 19 Oct 2022 10:34:25 +0200 Message-Id: <20221019083324.281273911@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747121006894531724?= X-GMAIL-MSGID: =?utf-8?q?1747121006894531724?= From: Marcel Ziswiler [ Upstream commit fd2dd7077c7498765e7326c1b7f34bde85f1a975 ] This fixes the following warning: arch/arm/boot/dts/imx6sx-udoo-neo.dtsi:309: check: Please don't use multiple blank lines While at it, use tabs indent for some pinctrl entries. Signed-off-by: Marcel Ziswiler Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin --- arch/arm/boot/dts/imx6sx-udoo-neo.dtsi | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/arch/arm/boot/dts/imx6sx-udoo-neo.dtsi b/arch/arm/boot/dts/imx6sx-udoo-neo.dtsi index 35861bbea94e..c84ea1fac5e9 100644 --- a/arch/arm/boot/dts/imx6sx-udoo-neo.dtsi +++ b/arch/arm/boot/dts/imx6sx-udoo-neo.dtsi @@ -226,7 +226,7 @@ &iomuxc { pinctrl_bt_reg: btreggrp { fsl,pins = - ; + ; }; pinctrl_enet1: enet1grp { @@ -306,7 +306,6 @@ >; }; - pinctrl_uart1: uart1grp { fsl,pins = , @@ -347,24 +346,23 @@ pinctrl_otg1_reg: otg1grp { fsl,pins = - ; + ; }; - pinctrl_otg2_reg: otg2grp { fsl,pins = - ; + ; }; pinctrl_usb_otg1: usbotg1grp { fsl,pins = - , - ; + , + ; }; pinctrl_usb_otg2: usbot2ggrp { fsl,pins = - ; + ; }; pinctrl_usdhc2: usdhc2grp { From patchwork Wed Oct 19 08:34: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: 5106 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp250517wrs; Wed, 19 Oct 2022 03:49:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6WPKUtGa6lWF8EY0RHnRzcL5BIvjgeEyJDOUI4MnoD/GXHEZQBrpqwIyTAyWEHJzoVPQX5 X-Received: by 2002:a17:906:9745:b0:78d:480f:cee7 with SMTP id o5-20020a170906974500b0078d480fcee7mr6170737ejy.192.1666176557267; Wed, 19 Oct 2022 03:49:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176557; cv=none; d=google.com; s=arc-20160816; b=NmCY7Ha2OYAdMD4APY3cu2q0V79WD5cG0Z5Ul8CXTy/7UJ2+azlIU2OBtvNZocq6aa OSOQ/hUOOQBrIyBV1f+O6G21tuoyPBrIZnAz7kX+Z5J6Lsy3SpYDcO1xTmpE32JPoaz2 z5+OVTo+VivlnYTdlslWwH65SKq+A0p/fVI42RkMt/KQr5jX6Ob4iuEvUIJLQ0dMUbWk HuOeHqehWMxz0bwj68WHTOSi2zFaCXSgHifKz9Zz5JPL60lp3OsJSilfvekB4kA48MO/ gO4tGPPW9MPOfLrXcMvS0LiodgrtdAoXhJeXAnOAtVAX0ZkrbIPdisWQY8dITfUyG0dz 7ung== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gmNVKqHj52xvuWQOZbrsjyGqZ8EVspUwCPvyaLVnFyg=; b=fwc/1sAr24uHFRZ3cxb3alhfUVJk1hmBJ8sME0sdAHGi5tSjXGeJ3Mkp3tV7dBYHT2 wd14/b+09rRFIuVvCqHsFskS84W46/412E771PZjmhRB1pzkgoZoaMts/pJ4dU/HNdI4 eOTnUhcJczLSbmOIxThYCjw4Xv7KMewpqvObKrKtvWCwYQGUw1dPFwLnzYTQ6ug4qQU2 UX5mqqJ79UnpKchz1TF6jwbvwuUWBme/TDK7m2+KhnpiHitTjOFPJQHPcQIP6vT+uOiY NC+K7xvU8eLCkmbr7iOx6MAWApz3cgtYWHAnOXgA1zzNOafjWoDZr70oU0JsO18x1c1u XsXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ui9SckBF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l17-20020a056402255100b0045d7d14baefsi6516953edb.386.2022.10.19.03.48.52; Wed, 19 Oct 2022 03:49: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=ui9SckBF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232058AbiJSKsQ (ORCPT + 99 others); Wed, 19 Oct 2022 06:48:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233167AbiJSKqU (ORCPT ); Wed, 19 Oct 2022 06:46: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 7691C15A304; Wed, 19 Oct 2022 03:21: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 1D397B824D8; Wed, 19 Oct 2022 09:12:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73C1FC433B5; Wed, 19 Oct 2022 09:12:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170771; bh=xlDA8pfPkFAaw/9xQEsxhHEEkQh9btgLLPQGvlm7iec=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ui9SckBFtthvRN75uh4fZUPkSFwxxilsF6swk5Vr6PM+qKp1eO3NH0Um5LM3zPyNn kU0T75RUc+ILCe4RtwPfO/5/3QwLeJKeTqU9NKX8wymFqEdLfrFFRsrKBxK6XJtE/2 f2uwKXdweAPaeR82bPdyB/BIsL6FFlMjL2ApAyoU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Brown , Catalin Marinas , Sasha Levin Subject: [PATCH 6.0 779/862] kselftest/arm64: Fix validatation termination record after EXTRA_CONTEXT Date: Wed, 19 Oct 2022 10:34:26 +0200 Message-Id: <20221019083324.327191199@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112749710218698?= X-GMAIL-MSGID: =?utf-8?q?1747112749710218698?= From: Mark Brown [ Upstream commit 5c152c2f66f9368394b89ac90dc7483476ef7b88 ] When arm64 signal context data overflows the base struct sigcontext it gets placed in an extra buffer pointed to by a record of type EXTRA_CONTEXT in the base struct sigcontext which is required to be the last record in the base struct sigframe. The current validation code attempts to check this by using GET_RESV_NEXT_HEAD() to step forward from the current record to the next but that is a macro which assumes it is being provided with a struct _aarch64_ctx and uses the size there to skip forward to the next record. Instead validate_extra_context() passes it a struct extra_context which has a separate size field. This compiles but results in us trying to validate a termination record in completely the wrong place, at best failing validation and at worst just segfaulting. Fix this by passing the struct _aarch64_ctx we meant to into the macro. Signed-off-by: Mark Brown Link: https://lore.kernel.org/r/20220829160703.874492-4-broonie@kernel.org Signed-off-by: Catalin Marinas Signed-off-by: Sasha Levin --- tools/testing/selftests/arm64/signal/testcases/testcases.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/arm64/signal/testcases/testcases.c b/tools/testing/selftests/arm64/signal/testcases/testcases.c index 84c36bee4d82..d98828cb542b 100644 --- a/tools/testing/selftests/arm64/signal/testcases/testcases.c +++ b/tools/testing/selftests/arm64/signal/testcases/testcases.c @@ -33,7 +33,7 @@ bool validate_extra_context(struct extra_context *extra, char **err) return false; fprintf(stderr, "Validating EXTRA...\n"); - term = GET_RESV_NEXT_HEAD(extra); + term = GET_RESV_NEXT_HEAD(&extra->head); if (!term || term->magic || term->size) { *err = "Missing terminator after EXTRA context"; return false; From patchwork Wed Oct 19 08:34: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: 4988 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp227376wrs; Wed, 19 Oct 2022 02:48:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6KmMc/73QYQA+PRMOwY/Ylak5Mt+gJfZrUJ0iwQ99TPKzzDAs0fcOua3QCbaICrPYFw4xy X-Received: by 2002:a17:90a:d48b:b0:20a:97fb:3eb with SMTP id s11-20020a17090ad48b00b0020a97fb03ebmr42893391pju.189.1666172910359; Wed, 19 Oct 2022 02:48:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172910; cv=none; d=google.com; s=arc-20160816; b=KLhaayuol7rh5qCN88QNsiN3vpaUbx0JWBAv3O6fpa376+qFmcPyPU8p2s/gvy1oqd EWaxKzGlODaaqXCqga/wX1ExwHTPUuIQLxtSihPXcZNJ6gu1Dl1j7BAAx+3laqzmUWg0 UtiXIBogjIDtbmHdiLBqXt0Hpise8/MSSETc/n/kOJRgPX0w7W6mJxfoCBvU8zQCh0Ki dOj6ojcO6MxaVRhoSH2NGpvXjxtAgTaEaFGG9w5as4SOICF2rGwLn5b40Ce1hhZzaK/Q WBEBAOv2x/LrItiF+KOyFDNfBy8rY8Y4AgKiVFPqbt5GDJhN5oYW5FyHu4iO61jA91l3 oLXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=znJ33oZa3MkKH/OF1WUCb7Nf+L5apWN0T5CuBPR8zgg=; b=owEi7DOoGoVVdjUEk1evAVUP75XUTrlQDxOub19rr39OIeukSA4tQDV/MIBBydQIhn zhNwu73SN+TRHs/XyxHSslPdcIy0il+tgCKZSuH4A6O5/m3IoQmWPlNGwsFk7c8kJ3L+ lK4RD97+32n1FFvIsd7FmHjLunYmkIc+6IOwObMnuidxppnUsYFlJFdkUxjwnjvOvdCM SmKeOFxmiGEAkrxaehEF+HLYk8T+xxOaq02gra6vrepB/J2GoUFCuV3sYtPvLpmDjUpX 0aQ9njStQjH54JRv3E/ZIx/W319PCAa1Aa09LwuI4Y4bjJnoNFd8kKgAGGIBAEHOA3oP /4tQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZTJ4CDZM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id on10-20020a17090b1d0a00b0020db486e32esi20182213pjb.158.2022.10.19.02.48.15; Wed, 19 Oct 2022 02:48:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZTJ4CDZM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234641AbiJSJo5 (ORCPT + 99 others); Wed, 19 Oct 2022 05:44:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234862AbiJSJlp (ORCPT ); Wed, 19 Oct 2022 05:41:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20E01F5CD1; Wed, 19 Oct 2022 02:18:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DF852617D7; Wed, 19 Oct 2022 09:14:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 03EE2C433D6; Wed, 19 Oct 2022 09:14:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170882; bh=9k1/VbHeguU3yVKC6fiS5SarwOPVXS7nqwlfeyR3xoI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZTJ4CDZMEXjw6/V4ZoGKhDDLc79UCYvihM9g5YG7SfbADT67TVo6F/CtvHooXxvTH dlGP3REa/3SfaVKRlFIC4AdGYYHYqcU2xuCY/8rYA19+h2PFdLEPHfB6yyfa5Cdq2Y ACwVo9hsMLoEf25c+fhtoPeyA+YU2xfYSOZL6ouk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Heiko Thiery , Frieder Schrempf , Shawn Guo , Sasha Levin Subject: [PATCH 6.0 780/862] arm64: dts: imx8mm-kontron: Use the VSELECT signal to switch SD card IO voltage Date: Wed, 19 Oct 2022 10:34:27 +0200 Message-Id: <20221019083324.374869972@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108925861688797?= X-GMAIL-MSGID: =?utf-8?q?1747108925861688797?= From: Frieder Schrempf [ Upstream commit eef2c0217e02b6c7ed5b10b82ea944127145e113 ] It turns out that it is not necessary to declare the VSELECT signal as GPIO and let the PMIC driver set it to a fixed high level. This switches the voltage between 3.3V and 1.8V by setting the PMIC register for LDO5 accordingly. Instead we can do it like other boards already do and simply mux the VSELECT signal of the USDHC interface to the pin. This makes sure that the correct voltage is selected by setting the PMIC's SD_VSEL input to high or low accordingly. Reported-by: Heiko Thiery Signed-off-by: Frieder Schrempf Reviewed-by: Heiko Thiery Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin --- arch/arm64/boot/dts/freescale/imx8mm-kontron-n801x-s.dts | 3 +++ arch/arm64/boot/dts/freescale/imx8mm-kontron-n801x-som.dtsi | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/freescale/imx8mm-kontron-n801x-s.dts b/arch/arm64/boot/dts/freescale/imx8mm-kontron-n801x-s.dts index 23be1ec538ba..c54536c0a2ba 100644 --- a/arch/arm64/boot/dts/freescale/imx8mm-kontron-n801x-s.dts +++ b/arch/arm64/boot/dts/freescale/imx8mm-kontron-n801x-s.dts @@ -321,6 +321,7 @@ MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2 0x1d0 MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3 0x1d0 MX8MM_IOMUXC_SD2_CD_B_GPIO2_IO12 0x019 + MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0x1d0 >; }; @@ -333,6 +334,7 @@ MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2 0x1d4 MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3 0x1d4 MX8MM_IOMUXC_SD2_CD_B_GPIO2_IO12 0x019 + MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0x1d0 >; }; @@ -345,6 +347,7 @@ MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2 0x1d6 MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3 0x1d6 MX8MM_IOMUXC_SD2_CD_B_GPIO2_IO12 0x019 + MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0x1d0 >; }; }; diff --git a/arch/arm64/boot/dts/freescale/imx8mm-kontron-n801x-som.dtsi b/arch/arm64/boot/dts/freescale/imx8mm-kontron-n801x-som.dtsi index 8f90eb02550d..6307af803429 100644 --- a/arch/arm64/boot/dts/freescale/imx8mm-kontron-n801x-som.dtsi +++ b/arch/arm64/boot/dts/freescale/imx8mm-kontron-n801x-som.dtsi @@ -86,7 +86,6 @@ pinctrl-0 = <&pinctrl_pmic>; interrupt-parent = <&gpio1>; interrupts = <0 IRQ_TYPE_LEVEL_LOW>; - sd-vsel-gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>; regulators { reg_vdd_soc: BUCK1 { @@ -229,7 +228,6 @@ pinctrl_pmic: pmicgrp { fsl,pins = < MX8MM_IOMUXC_GPIO1_IO00_GPIO1_IO0 0x141 - MX8MM_IOMUXC_GPIO1_IO04_GPIO1_IO4 0x141 >; }; From patchwork Wed Oct 19 08:34: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: 5279 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp280472wrs; Wed, 19 Oct 2022 05:00:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5eGan4EqbEn3uTvtoVzPcbns0N+I4RLHzbhEKG6lXiMWhFeXEcPGztgwmCI2XT/EReCdIg X-Received: by 2002:a17:906:fe44:b0:77c:e313:a8e8 with SMTP id wz4-20020a170906fe4400b0077ce313a8e8mr6540491ejb.700.1666180849991; Wed, 19 Oct 2022 05:00:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666180849; cv=none; d=google.com; s=arc-20160816; b=IXWK7BoninHl+ahmxBLlRAtazfNmjrknAKjUYc7NsjwYWPi49uK3s2QwrlZoSSVLkQ CEBwb/9UmPwq4sNDqKoyZqsnpXOj/Dfk4BMqsps9pqRejvsZmAXr039IHk4/j44TT8Z9 UdgUmYE6XmdWrixYS0O8f18Sftzo0M1HPM7g8vhWf42ulMBNSoiOcYsLBR1mHNYi/Dza 3ZVoTNW7CmBcnK4zsR/H0nBjVm8kyzRABqamYH1rQ6awzMFigUIEQ5f4kB8VCLB9e/fo rxpVgDssOcD/OvRRfKCjclotXezvC0IUYyAsUFN7Zx7LU128qgrwah8LWUPhMfTPkyJm K11g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sossEWVWk208JAIFFkIwmqnub/OJGDDFs/Mj3nDrfpY=; b=bIrDDjkFtBxctU/vvTSIigRHuI5Q0M+IRVNCXaGoNzbcT91ZdeoPumuQdfMMp9URbH P3mqZug3WzVJeoPY0yqAqVe0FNQ5102qlRP1JhgschOHnkxRx8LitvSNtvk3YH3VHIqG H6N1JIClFS6d6J3XsVmmVitFB9yY4/hcr/Z34qpDuhrtV5kytJCVJCZ+ko4uaNHwaFxp rAxYIaV0CAGp/VJoC1wQfUbgXUDifiXLtQyvrfLNsFy5Yu3e8s73S86+ot8K57YC0apr LkGH03SUOffWEbyBW1LuniByfgpT0nvNSZZXWFn7J5BOoLAsOJqmljYR4yhEv/ZzvtZC prOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QYkQ8OjR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a1709076d1a00b0078c8dadd4bbsi14089507ejc.742.2022.10.19.05.00.23; Wed, 19 Oct 2022 05:00: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=QYkQ8OjR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230227AbiJSLxb (ORCPT + 99 others); Wed, 19 Oct 2022 07:53:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231992AbiJSLwy (ORCPT ); Wed, 19 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 03179DED07; Wed, 19 Oct 2022 04:31: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 AB22BCE21C8; Wed, 19 Oct 2022 09:13:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D635C433C1; Wed, 19 Oct 2022 09:13:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170792; bh=5WJeNR1Zg58qVpwQnV00zHOWvLfpqG1V3CkVMo5G3kU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QYkQ8OjRInwPfRmkmmUEbKi5ldwDBCYeTBFr11Mowjtg2+rspEENXK12mBy+rKJiP /NkhOZC9k8yt107zmSHeCd9WkhiL7OhIAbMykZote6p6jHNxkt8XENv6j/QPcvCjQA hM9Hsl0GNM2PKUtADbNOFAJMkkYCrj8I8aBLiuyg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sebastian Krzyszkowiak , Martin Kepplinger , Shawn Guo , Sasha Levin Subject: [PATCH 6.0 781/862] arm64: dts: imx8mq-librem5: Add bq25895 as max17055s power supply Date: Wed, 19 Oct 2022 10:34:28 +0200 Message-Id: <20221019083324.416436240@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747117250993293412?= X-GMAIL-MSGID: =?utf-8?q?1747117250993293412?= From: Sebastian Krzyszkowiak [ Upstream commit 6effe295e1a87408033c29dbcea9d5a5c8b937d5 ] This allows the userspace to notice that there's not enough current provided to charge the battery, and also fixes issues with 0% SOC values being considered invalid. Signed-off-by: Sebastian Krzyszkowiak Signed-off-by: Martin Kepplinger Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin --- arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi b/arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi index 9eec8a7eecfc..127fc7f904c8 100644 --- a/arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi +++ b/arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi @@ -1077,6 +1077,7 @@ interrupts = <20 IRQ_TYPE_LEVEL_LOW>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_gauge>; + power-supplies = <&bq25895>; maxim,over-heat-temp = <700>; maxim,over-volt = <4500>; maxim,rsns-microohm = <5000>; From patchwork Wed Oct 19 08:34: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: 4917 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225780wrs; Wed, 19 Oct 2022 02:44:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6aiY1UOMaMBMy34tIpnH0vqtAyA+DMvqUDN/VRQ1UbFDGpvKHtlvtTa4C0eagr+pTz7u8Z X-Received: by 2002:a63:e113:0:b0:439:e032:c879 with SMTP id z19-20020a63e113000000b00439e032c879mr6457229pgh.287.1666172641113; Wed, 19 Oct 2022 02:44:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172641; cv=none; d=google.com; s=arc-20160816; b=yUPZE0rnbb0glUw9/iBiy94h2iJ2AGEz9g/wF8toSTIhExyqy1fQR3TedGO3US7MWP y9LOLHayCcDtzvaEO9KW4BRVavAKxY1LBHyxd0LdPmqFSbnvsVyiJGY4aAifCJD3VykE 5JQT15vCiEadNarnJoUGQh6L7vmzZsO/nkiYQXAVXIkDxahgMLrTsZiKL1IThpqAFunm EpLfW+eSsYhNiZFDBqdE9/IUmdQRNBfNPHk8MAVljD9KV/b4ax9Hp0OM13w8WnT/zGWK +HYxkEjvYgyUuLDqzgLnpUSZd1Vm+wYoGm66ae/OFFF2GiDmZr9okQqfoHPTGZCXAY+/ jh/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=26LtxhfmmmJxLMlHjva7rFzhVRq8fHYJMmo/2hablJY=; b=zKIKvwhCvtqB6egMeIdRySLnE8He1hZBN0J/h4Vg7Dnsu8Knd0cLu3XlWQHMdDBZCx BVB5coMsSMwE0LzX/RNkbY/ZxR/s/cKMDXuiiK7BKiMIKCVJe6LqyTRWAbRZETVEIAXR QmYpF8VwE6ferI8k7j8S2rZVT4jJND3Bd23LYH6fywXKyeImb8ydAe7GwgAPA+0vgugY jLZyKa07uu+HKtgLxbF/8STzyYNfw0waqT4S28FNwwggyi8oBBdpqSwxzi+awx6QKrDT APzv4lm2pSs8YN0lCBpVDQdTt+J0B/FrvEXfs0O4gDhDV0pqRuDB8VthpPnlJ3jkoxCM AVSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ba1dWm5p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id my14-20020a17090b4c8e00b0020c060f42c9si20541741pjb.164.2022.10.19.02.43.45; Wed, 19 Oct 2022 02:44: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=Ba1dWm5p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229982AbiJSJhF (ORCPT + 99 others); Wed, 19 Oct 2022 05:37:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233982AbiJSJaK (ORCPT ); Wed, 19 Oct 2022 05:30:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A258EB75A; Wed, 19 Oct 2022 02:13: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 dfw.source.kernel.org (Postfix) with ESMTPS id B0191617D4; Wed, 19 Oct 2022 09:13:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1110C433D7; Wed, 19 Oct 2022 09:13:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170822; bh=Kl9RoFAq3sCIwA5R+gllPUC3sCxEPBv5CtTb6Rfc7FE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ba1dWm5pWrfwEFHV1+Vii2JDATk3xFjYXfXchptxKNseXMgZZSd2pXebWcPkMI5kN EKXAfsLPAAKZYMaWeH4cLjWGiMMhp6QTgMtYP+KOP7tLNehvBXgzFMvtR2URZobIa/ d8Vo1qthOfkyYxHmSrK2KKGQVQxZ3IndoQ1PKcKo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Arnd Bergmann , Sasha Levin Subject: [PATCH 6.0 782/862] ARM: orion: fix include path Date: Wed, 19 Oct 2022 10:34:29 +0200 Message-Id: <20221019083324.465380916@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108643191056748?= X-GMAIL-MSGID: =?utf-8?q?1747108643191056748?= From: Arnd Bergmann [ Upstream commit 63872304bdb3decd5454f4dd210c25395278ed13 ] Now that CONFIG_ARCH_MULTIPLATFORM can be disabled anywhere, there is a build failure for plat-orion: arch/arm/plat-orion/irq.c:19:10: fatal error: plat/irq.h: No such file or directory Make the include path unconditional. Reported-by: kernel test robot Signed-off-by: Arnd Bergmann Signed-off-by: Sasha Levin --- arch/arm/plat-orion/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/plat-orion/Makefile b/arch/arm/plat-orion/Makefile index 4e3f25de13c1..830b0be038c6 100644 --- a/arch/arm/plat-orion/Makefile +++ b/arch/arm/plat-orion/Makefile @@ -2,7 +2,7 @@ # # Makefile for the linux kernel. # -ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include +ccflags-y := -I$(srctree)/$(src)/include orion-gpio-$(CONFIG_GPIOLIB) += gpio.o obj-$(CONFIG_PLAT_ORION_LEGACY) += irq.o pcie.o time.o common.o mpp.o From patchwork Wed Oct 19 08:34: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: 5085 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp249528wrs; Wed, 19 Oct 2022 03:46:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7e0i37qmWQWBBlhsr/E6ETrBTCH0lOE99ztprRhiIUI5R6flWTgA+aUfTvT0AuXAwT4lab X-Received: by 2002:a05:6a00:80e:b0:563:4ad2:9d39 with SMTP id m14-20020a056a00080e00b005634ad29d39mr8020422pfk.66.1666176389604; Wed, 19 Oct 2022 03:46:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176389; cv=none; d=google.com; s=arc-20160816; b=Qwg+xglHB789+2g46Gtp+QzMWHSbJamfthqfKF6QlKqeErryotT23+7cYNtIFOk4as L6NrbfCURU5q5oxmr19GYRBJiGuRWN7CprYOHVJ2mXtqpaonbhBGSIzndTTXB+1NURYe gbHaSx+AcH07BVXsuOrfzRlNOr86s4fMS3RBu2CMgiVE3Hg4HQekSkCYPSIYFB4WAxOn cXTY4h9XM5jiYBkQjhkv5D7+Yt58U06IjmczpbJTIxW6iP9PTBsEgHpfwtLnK5K8bcfk U63cPmB0UFv2GZvz3M6PMyvMhluO/yzb6zzw+8bF8nxcwKfhhooOq54Mtim4oxaiXACD 8SwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=cjsIhCmhOqof/LCTmF6sgST4cjPfN+wPU4eFJGNs5Ng=; b=DvUUNEK8G41164Auwx+9pKqewRq27ux062tJLgH21UcjHEHbGt8TJGdBkkTdqca9SO 98DF/MmNPOzZHT4qHYyA/LCz2k6aN66gY7j2xBQMWnELsQ4tCITZks5wMh9wSNPh682G iPO+4JvgWHVmM3ITYQLlsuE39b05mGzF4+dM2TGwfRJ7E8qcWybl14hISz4fScnSWskR O5bm5ctnBHpKGiLc/CO7XWX0m4wXOT2xy0WkXKCDbhqT4+L/r7kqczVArqmLXLz7PJTO vDqOAzXualjJuLWaVTDguS6KCqLTU5hkyTjNPyMDxNqtGxoxYUPdBM0AFJwUryXGzb8K DbIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0r8txky4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a635d26000000b004607f8ab960si18462248pgb.356.2022.10.19.03.46.15; Wed, 19 Oct 2022 03:46: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=0r8txky4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232720AbiJSKpy (ORCPT + 99 others); Wed, 19 Oct 2022 06:45:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232884AbiJSKoT (ORCPT ); Wed, 19 Oct 2022 06:44:19 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33472F01A4; Wed, 19 Oct 2022 03:20: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 24C45B824DE; Wed, 19 Oct 2022 09:14:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 808BEC433B5; Wed, 19 Oct 2022 09:14:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170850; bh=USN0DegjD2jdAYzzw+a6E24iyODsPCAphQhOpxQnV+0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0r8txky4wCpkMH1LFt2Cw1/QUn2kSf3lmYC5e1Sej7XxBd3KI4Mh3+Maei3/uuyzM cboIPkd6aXAc5aXVTTQTrTG3/h9e+Ze+HY+KIvTlQA+XPa2EKt4NaARIy41jb9tU8L lqoIqaE8fhYQoh2VyDSk0OkYoDKlhME5TVPB+0Uo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anand Jain , Qu Wenruo , David Sterba , Sasha Levin Subject: [PATCH 6.0 783/862] btrfs: dump extra info if one free space cache has more bitmaps than it should Date: Wed, 19 Oct 2022 10:34:30 +0200 Message-Id: <20221019083324.507076974@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112573784681209?= X-GMAIL-MSGID: =?utf-8?q?1747112573784681209?= From: Qu Wenruo [ Upstream commit 62cd9d4474282a1eb84f945955c56cbfc42e1ffe ] There is an internal report on hitting the following ASSERT() in recalculate_thresholds(): ASSERT(ctl->total_bitmaps <= max_bitmaps); Above @max_bitmaps is calculated using the following variables: - bytes_per_bg 8 * 4096 * 4096 (128M) for x86_64/x86. - block_group->length The length of the block group. @max_bitmaps is the rounded up value of block_group->length / 128M. Normally one free space cache should not have more bitmaps than above value, but when it happens the ASSERT() can be triggered if CONFIG_BTRFS_ASSERT is also enabled. But the ASSERT() itself won't provide enough info to know which is going wrong. Is the bg too small thus it only allows one bitmap? Or is there something else wrong? So although I haven't found extra reports or crash dump to do further investigation, add the extra info to make it more helpful to debug. Reviewed-by: Anand Jain Signed-off-by: Qu Wenruo Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Sasha Levin --- fs/btrfs/free-space-cache.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index 996da650ecdc..85404c62a1c2 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c @@ -693,6 +693,12 @@ static void recalculate_thresholds(struct btrfs_free_space_ctl *ctl) max_bitmaps = max_t(u64, max_bitmaps, 1); + if (ctl->total_bitmaps > max_bitmaps) + btrfs_err(block_group->fs_info, +"invalid free space control: bg start=%llu len=%llu total_bitmaps=%u unit=%u max_bitmaps=%llu bytes_per_bg=%llu", + block_group->start, block_group->length, + ctl->total_bitmaps, ctl->unit, max_bitmaps, + bytes_per_bg); ASSERT(ctl->total_bitmaps <= max_bitmaps); /* From patchwork Wed Oct 19 08:34: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: 4955 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp226525wrs; Wed, 19 Oct 2022 02:46:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7DvK2jEZXb1gSZ1AHsOhn+vRbGP/hvZ3HRbCfGWOxCjoz8qygVkKjhbwf2HsOkR+yTWgPI X-Received: by 2002:a65:6e9a:0:b0:435:6009:4b62 with SMTP id bm26-20020a656e9a000000b0043560094b62mr6585936pgb.596.1666172769025; Wed, 19 Oct 2022 02:46:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172769; cv=none; d=google.com; s=arc-20160816; b=ENLRjRCMq6a0M+GG0K/4pxt9PEuWgPJVy4NFgXl4Vo2q8cpGqB6GCff0ky0RL5peEo 6iLqP1KbVpQmRoR+HMPmpNpcH2DuCa7OFOk4nuk8C+cN0My+5SKay7Qbc5Z43j3AhR6L 51W0DVwTEsSDtTBy+rxrVu5wMtUEAJs4H/ZFonIPAEYLr7JuD616YHYTJrPtab87qcPw 7RvrMGf3PYK1FSq5BZ/caTYK2SjpA46uY4QMJXxpgHpWmJcFqGgP6lTzzyXG0M+Vc0/h bcmuQwb8CnExaP7/JiKRb1bcZFKrYyRMWXFYebqBjfNaYhjrsZ5Pgzwb18hFWe+mNkna J9EQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=IRsBBydr5z19uPoPhsDGSmqnLZCcZ7+MDCiY8PloA/8=; b=eWeIWy/efV5uFNzX0feLTAdY1dLB4QIrI8oOwnzEc5LMkBHHMBRaG8G86z9Rrm8P6i B+NPIgGAywL0g4krktcuhJgntw9YA2b35kI9S8iYtr712OL0fSf73XT6vNK8FDLp4yTy jDAxAKAMIa/wg/IAT8WyGDThfQsivzeoaEkR2u9Cw5puZhVmhnvCiDkp+tAW4b/MM4H0 XQRK+0zzlslG6bQP90uKHtcpMzX5aNx3jgDgm5wWGZToVYA18O7i1sChWy6m1nlE4NA3 MFFd+jLLwcKZObuzx52IeFXZZDT1IKycz4rAimpC++ttOt2KYc8GsSAjVSdy/R1+pEar o8fA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=twnDxtga; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a635c18000000b004589dfd10e2si16912802pgb.38.2022.10.19.02.45.50; Wed, 19 Oct 2022 02:46: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=twnDxtga; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234068AbiJSJmq (ORCPT + 99 others); Wed, 19 Oct 2022 05:42:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234266AbiJSJji (ORCPT ); Wed, 19 Oct 2022 05:39: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 A8027C706C; Wed, 19 Oct 2022 02:16: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 1B283617B0; Wed, 19 Oct 2022 09:14:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E560C433D6; Wed, 19 Oct 2022 09:14:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170866; bh=CVnALvBuDhhOTk8a0gz9QtP4swLjci7y0g7qcMBKSic=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=twnDxtgaPVlSqDrODUfKwXzj0Latt0Ay4zJO9oIIyECU955uEWnIIMgJcxH+Pfo/3 zGPjTE+jHCEGnycSRnOxMlc7m0oRCFuWl3HUP0tzuPUAupyvBMSYCYLab8DMnd92i/ CDC4oGKixoFI6IkHLhBSs7t5JCxlvXLhA8nD/pjY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Qu Wenruo , David Sterba , Sasha Levin Subject: [PATCH 6.0 784/862] btrfs: scrub: properly report super block errors in system log Date: Wed, 19 Oct 2022 10:34:31 +0200 Message-Id: <20221019083324.546304187@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108777308687768?= X-GMAIL-MSGID: =?utf-8?q?1747108777308687768?= From: Qu Wenruo [ Upstream commit e69bf81c9a339f1b2c041b112a6fbb9f60fc9340 ] [PROBLEM] Unlike data/metadata corruption, if scrub detected some error in the super block, the only error message is from the updated device status: BTRFS info (device dm-1): scrub: started on devid 2 BTRFS error (device dm-1): bdev /dev/mapper/test-scratch2 errs: wr 0, rd 0, flush 0, corrupt 1, gen 0 BTRFS info (device dm-1): scrub: finished on devid 2 with status: 0 This is not helpful at all. [CAUSE] Unlike data/metadata error reporting, there is no visible report in kernel dmesg to report supper block errors. In fact, return value of scrub_checksum_super() is intentionally skipped, thus scrub_handle_errored_block() will never be called for super blocks. [FIX] Make super block errors to output an error message, now the full dmesg would looks like this: BTRFS info (device dm-1): scrub: started on devid 2 BTRFS warning (device dm-1): super block error on device /dev/mapper/test-scratch2, physical 67108864 BTRFS error (device dm-1): bdev /dev/mapper/test-scratch2 errs: wr 0, rd 0, flush 0, corrupt 1, gen 0 BTRFS info (device dm-1): scrub: finished on devid 2 with status: 0 BTRFS info (device dm-1): scrub: started on devid 2 This fix involves: - Move the super_errors reporting to scrub_handle_errored_block() This allows the device status message to show after the super block error message. But now we no longer distinguish super block corruption and generation mismatch, now all counted as corruption. - Properly check the return value from scrub_checksum_super() - Add extra super block error reporting for scrub_print_warning(). Signed-off-by: Qu Wenruo Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Sasha Levin --- fs/btrfs/scrub.c | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index 3afe5fa50a63..0fe7c4882e1f 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -729,6 +729,13 @@ static void scrub_print_warning(const char *errstr, struct scrub_block *sblock) dev = sblock->sectors[0]->dev; fs_info = sblock->sctx->fs_info; + /* Super block error, no need to search extent tree. */ + if (sblock->sectors[0]->flags & BTRFS_EXTENT_FLAG_SUPER) { + btrfs_warn_in_rcu(fs_info, "%s on device %s, physical %llu", + errstr, rcu_str_deref(dev->name), + sblock->sectors[0]->physical); + return; + } path = btrfs_alloc_path(); if (!path) return; @@ -804,7 +811,7 @@ static inline void scrub_put_recover(struct btrfs_fs_info *fs_info, static int scrub_handle_errored_block(struct scrub_block *sblock_to_check) { struct scrub_ctx *sctx = sblock_to_check->sctx; - struct btrfs_device *dev; + struct btrfs_device *dev = sblock_to_check->sectors[0]->dev; struct btrfs_fs_info *fs_info; u64 logical; unsigned int failed_mirror_index; @@ -825,13 +832,15 @@ static int scrub_handle_errored_block(struct scrub_block *sblock_to_check) fs_info = sctx->fs_info; if (sblock_to_check->sectors[0]->flags & BTRFS_EXTENT_FLAG_SUPER) { /* - * if we find an error in a super block, we just report it. + * If we find an error in a super block, we just report it. * They will get written with the next transaction commit * anyway */ + scrub_print_warning("super block error", sblock_to_check); spin_lock(&sctx->stat_lock); ++sctx->stat.super_errors; spin_unlock(&sctx->stat_lock); + btrfs_dev_stat_inc_and_print(dev, BTRFS_DEV_STAT_CORRUPTION_ERRS); return 0; } logical = sblock_to_check->sectors[0]->logical; @@ -840,7 +849,6 @@ static int scrub_handle_errored_block(struct scrub_block *sblock_to_check) is_metadata = !(sblock_to_check->sectors[0]->flags & BTRFS_EXTENT_FLAG_DATA); have_csum = sblock_to_check->sectors[0]->have_csum; - dev = sblock_to_check->sectors[0]->dev; if (!sctx->is_dev_replace && btrfs_repair_one_zone(fs_info, logical)) return 0; @@ -1762,7 +1770,7 @@ static int scrub_checksum(struct scrub_block *sblock) else if (flags & BTRFS_EXTENT_FLAG_TREE_BLOCK) ret = scrub_checksum_tree_block(sblock); else if (flags & BTRFS_EXTENT_FLAG_SUPER) - (void)scrub_checksum_super(sblock); + ret = scrub_checksum_super(sblock); else WARN_ON(1); if (ret) @@ -1901,23 +1909,6 @@ static int scrub_checksum_super(struct scrub_block *sblock) if (memcmp(calculated_csum, s->csum, sctx->fs_info->csum_size)) ++fail_cor; - if (fail_cor + fail_gen) { - /* - * if we find an error in a super block, we just report it. - * They will get written with the next transaction commit - * anyway - */ - spin_lock(&sctx->stat_lock); - ++sctx->stat.super_errors; - spin_unlock(&sctx->stat_lock); - if (fail_cor) - btrfs_dev_stat_inc_and_print(sector->dev, - BTRFS_DEV_STAT_CORRUPTION_ERRS); - else - btrfs_dev_stat_inc_and_print(sector->dev, - BTRFS_DEV_STAT_GENERATION_ERRS); - } - return fail_cor + fail_gen; } From patchwork Wed Oct 19 08:34: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: 5074 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp249188wrs; Wed, 19 Oct 2022 03:45:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7QydDdUlH22+5RvHllIKQNHBR3FXunyf0JG6nqWaoWWrA546seuMtjyQPk/IVgGmPcgae5 X-Received: by 2002:a17:902:e5d1:b0:183:6e51:4ff with SMTP id u17-20020a170902e5d100b001836e5104ffmr7629305plf.151.1666176323864; Wed, 19 Oct 2022 03:45:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176323; cv=none; d=google.com; s=arc-20160816; b=LxsVPTbouOUnRt4l0/ygzMXi27lzWK/VTcQ0Gep2/Mg+wivEtpekuO5MSCskpYccpb mYEhl6CDDobGrx+OBlGScvQeJVuUZr6X+fnv+zwhFsFA/nJ4PA1Go+Wiq6VA9MqOu5sy jq7U2XhZTn1Rq9fYqXFer/6K64uL/L9GhSl4R9Pv82qWvMoXQayYpga99gcezxaw5FKU YtXXxUVcJxvcmfZ5FVbu7u7cmxIcv5CG/iiPRnVULLsArkl0ZYPOexqgrEJ5kzCBuAPG 1iR0ySobtYvpOZ8m1tSSlEQ+Xmndz6PoqK6KZGYQ45RrO3a5q7qx2a3UJfpLzCMQhrl3 5gIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=SL3I5WekqbkgBSZdN8GbXtK2fwiYQbEoPatA3eBYnTQ=; b=ZYfbuhqjEQDlnJ4SuK4y8jrCnvU5QJv9buaIMFEpatI83Sn41LS+iZQCookJLrmi/K AoHtnEelZBUYmRYwL55t1U318C1tavuFqrvH3wNVnrzsLeWdYJtOJTXX/jZMmLia9f4h eA91BTvmGgFl9GTe8lexbEsqHedjq/3uZEUppWcihWrYeAiTv3EnfKswfliXaB1I4lBV uquFTNTfAz8udhROxF3750tJSKEyJVGUaiDaGE9MRrctN3MxeFCEkoBEsunbjLYb74Zn V+53KE0pESt4EdZbgIx0vuy6z4aiapzIRRAXuiAxL1ZjLM+D8keePTTBrGvddaU8lMFj H03w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wGyArL8P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ji21-20020a170903325500b001789bd50b64si16480489plb.319.2022.10.19.03.45.08; Wed, 19 Oct 2022 03:45: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=wGyArL8P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229452AbiJSKon (ORCPT + 99 others); Wed, 19 Oct 2022 06:44:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232602AbiJSKnR (ORCPT ); Wed, 19 Oct 2022 06:43: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 4E723ABF2F; Wed, 19 Oct 2022 03:20:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 66F86B824D0; Wed, 19 Oct 2022 09:14:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DBE08C433C1; Wed, 19 Oct 2022 09:14:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170869; bh=qUjyoVvOS3Ad4+C90cegODPyGWIqsREsIRdqhCf699w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wGyArL8P2WMmsYdM2x/lJNzC/Sg4GLRFcFKghGheZt0bq724nwg4uCp8+HHzrf/kh OKUBJymyHPkxnRupjgXPbAF2VD6Wzdb2ApV0lWqwsoWWNm45ZLsEDkDvfvrVUqsQ49 vAzJPc42xYGzX8t0EgOcLAXSZCDSZTnELSbGbiOM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Qu Wenruo , David Sterba , Sasha Levin Subject: [PATCH 6.0 785/862] btrfs: scrub: try to fix super block errors Date: Wed, 19 Oct 2022 10:34:32 +0200 Message-Id: <20221019083324.594125010@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112504806778897?= X-GMAIL-MSGID: =?utf-8?q?1747112504806778897?= From: Qu Wenruo [ Upstream commit f9eab5f0bba76742af654f33d517bf62a0db8f12 ] [BUG] The following script shows that, although scrub can detect super block errors, it never tries to fix it: mkfs.btrfs -f -d raid1 -m raid1 $dev1 $dev2 xfs_io -c "pwrite 67108864 4k" $dev2 mount $dev1 $mnt btrfs scrub start -B $dev2 btrfs scrub start -Br $dev2 umount $mnt The first scrub reports the super error correctly: scrub done for f3289218-abd3-41ac-a630-202f766c0859 Scrub started: Tue Aug 2 14:44:11 2022 Status: finished Duration: 0:00:00 Total to scrub: 1.26GiB Rate: 0.00B/s Error summary: super=1 Corrected: 0 Uncorrectable: 0 Unverified: 0 But the second read-only scrub still reports the same super error: Scrub started: Tue Aug 2 14:44:11 2022 Status: finished Duration: 0:00:00 Total to scrub: 1.26GiB Rate: 0.00B/s Error summary: super=1 Corrected: 0 Uncorrectable: 0 Unverified: 0 [CAUSE] The comments already shows that super block can be easily fixed by committing a transaction: /* * If we find an error in a super block, we just report it. * They will get written with the next transaction commit * anyway */ But the truth is, such assumption is not always true, and since scrub should try to repair every error it found (except for read-only scrub), we should really actively commit a transaction to fix this. [FIX] Just commit a transaction if we found any super block errors, after everything else is done. We cannot do this just after scrub_supers(), as btrfs_commit_transaction() will try to pause and wait for the running scrub, thus we can not call it with scrub_lock hold. Signed-off-by: Qu Wenruo Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Sasha Levin --- fs/btrfs/scrub.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index 0fe7c4882e1f..7d9b09e3ca70 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -4093,6 +4093,7 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start, int ret; struct btrfs_device *dev; unsigned int nofs_flag; + bool need_commit = false; if (btrfs_fs_closing(fs_info)) return -EAGAIN; @@ -4196,6 +4197,12 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start, */ nofs_flag = memalloc_nofs_save(); if (!is_dev_replace) { + u64 old_super_errors; + + spin_lock(&sctx->stat_lock); + old_super_errors = sctx->stat.super_errors; + spin_unlock(&sctx->stat_lock); + btrfs_info(fs_info, "scrub: started on devid %llu", devid); /* * by holding device list mutex, we can @@ -4204,6 +4211,16 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start, mutex_lock(&fs_info->fs_devices->device_list_mutex); ret = scrub_supers(sctx, dev); mutex_unlock(&fs_info->fs_devices->device_list_mutex); + + spin_lock(&sctx->stat_lock); + /* + * Super block errors found, but we can not commit transaction + * at current context, since btrfs_commit_transaction() needs + * to pause the current running scrub (hold by ourselves). + */ + if (sctx->stat.super_errors > old_super_errors && !sctx->readonly) + need_commit = true; + spin_unlock(&sctx->stat_lock); } if (!ret) @@ -4230,6 +4247,25 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start, scrub_workers_put(fs_info); scrub_put_ctx(sctx); + /* + * We found some super block errors before, now try to force a + * transaction commit, as scrub has finished. + */ + if (need_commit) { + struct btrfs_trans_handle *trans; + + trans = btrfs_start_transaction(fs_info->tree_root, 0); + if (IS_ERR(trans)) { + ret = PTR_ERR(trans); + btrfs_err(fs_info, + "scrub: failed to start transaction to fix super block errors: %d", ret); + return ret; + } + ret = btrfs_commit_transaction(trans); + if (ret < 0) + btrfs_err(fs_info, + "scrub: failed to commit transaction to fix super block errors: %d", ret); + } return ret; out: scrub_workers_put(fs_info); From patchwork Wed Oct 19 08:34: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: 5059 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp248120wrs; Wed, 19 Oct 2022 03:42:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7NErlmGA4N4SgAFbyPuF9HxmuGx0PCiv+2bu1FmIXVmaFVnilF/TbH0U08w0LC56EAVRVl X-Received: by 2002:a17:902:e552:b0:179:e795:71c5 with SMTP id n18-20020a170902e55200b00179e79571c5mr7692425plf.57.1666176165142; Wed, 19 Oct 2022 03:42:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176165; cv=none; d=google.com; s=arc-20160816; b=VhCw63zXyEM2Kn9fM6T4lXsPkV4Ix/SHdhENzeu9kOWz8aUBEedbtRrPShxbLCXcj2 fIBiG0uKz8DEIs6KdhDuY1Jioa38iazQE3dRIW0ZdWKULJ2JRVB+G3C0TNIdd7LTBlG8 poCrvmFov7p3uKqtvDPIokL95pwFkt7NSStcrtIqjDnPK/SX9JNrOT0ZLG3fflcMt1rR oUgXaKq/Enq6wb3fbnkjqhLfRyQexJXlfZ4SvEDKGJ2DfoMSk5lEOdOUa8yb+1YwTnSo LjHJoLZ0e6MTzpjupNVTKgckyKEb19Jw/fAcatfW/uJ/GeBPWHZMiILP03zdobUV9IMp qLjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0EvDEygCLuUZCrTrNgMNgx9cFo26WxKwScboay1NNeo=; b=Y4g4DsVCwu6Z4QLcAf/QR/FiYYtle7/GKxEme2CeX78itfa6Om6yPfhKI/ibqAamdp Rb9RRJw7a6iwWG/rhEft/10XGi3F5ksfgzBj6tpm/BvG5KuIvvra7VNuEqZ9hG/GgsOI sIkHaHIT3XMWKC4mMCRxRFVoEhEDUAzoUUQu/wCj3ZiC/nPuqtZ/+jCVo8Vq7V41RueQ lr1TYwx+x6S0ZDCxC9dwj6QqvQznHIMlASqDZi6iOSE6269F3jImcYrjSLNRlTgFmffe POqPGAkOJ2sk7fkR3GvQlXU0v+cmrQ1iCiI20kugMIWn1ZK7z1sHMK+FSspNKdRYhfQ4 p81Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TUy8aRCy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170902f70700b001841134e3b1si18233485plo.160.2022.10.19.03.42.31; Wed, 19 Oct 2022 03:42: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=TUy8aRCy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232453AbiJSKmC (ORCPT + 99 others); Wed, 19 Oct 2022 06:42:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232075AbiJSKlI (ORCPT ); Wed, 19 Oct 2022 06:41: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 EE509B857; Wed, 19 Oct 2022 03:19: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 165C9B824CF; Wed, 19 Oct 2022 09:14:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8DAE6C433D6; Wed, 19 Oct 2022 09:14:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170871; bh=9rEkCfPGF7aTg6XEIPGPG0g/5ewXXcWrs+BmJMl5KNE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TUy8aRCyWwgGZsaFO+dIqZK3VxXyDzDdZu9E8uTSRg2teFs87X45fnFcwc5B9CwN3 Mi9lGAerIl4zyWoiZ4QAP5cml+H+Icw0KNG+/uqsGH9DLIUrHQU7HiHzH61PT0bsYj C/J4RqFdhL0Ya1XvIke89k7OrifWuYnJCjAHqUDE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Maciej S. Szmigiero" , David Sterba , Sasha Levin Subject: [PATCH 6.0 786/862] btrfs: dont print information about space cache or tree every remount Date: Wed, 19 Oct 2022 10:34:33 +0200 Message-Id: <20221019083324.642593394@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112338299446417?= X-GMAIL-MSGID: =?utf-8?q?1747112338299446417?= From: Maciej S. Szmigiero [ Upstream commit dbecac26630014d336a8e5ea67096ff18210fb9c ] btrfs currently prints information about space cache or free space tree being in use on every remount, regardless whether such remount actually enabled or disabled one of these features. This is actually unnecessary since providing remount options changing the state of these features will explicitly print the appropriate notice. Let's instead print such unconditional information just on an initial mount to avoid filling the kernel log when, for example, laptop-mode-tools remount the fs on some events. Signed-off-by: Maciej S. Szmigiero Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Sasha Levin --- fs/btrfs/super.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 6eeb3402b4a2..ad3ce9700eaf 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -626,6 +626,7 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options, int saved_compress_level; bool saved_compress_force; int no_compress = 0; + const bool remounting = test_bit(BTRFS_FS_STATE_REMOUNTING, &info->fs_state); if (btrfs_fs_compat_ro(info, FREE_SPACE_TREE)) btrfs_set_opt(info->mount_opt, FREE_SPACE_TREE); @@ -1137,10 +1138,12 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options, } if (!ret) ret = btrfs_check_mountopts_zoned(info); - if (!ret && btrfs_test_opt(info, SPACE_CACHE)) - btrfs_info(info, "disk space caching is enabled"); - if (!ret && btrfs_test_opt(info, FREE_SPACE_TREE)) - btrfs_info(info, "using free space tree"); + if (!ret && !remounting) { + if (btrfs_test_opt(info, SPACE_CACHE)) + btrfs_info(info, "disk space caching is enabled"); + if (btrfs_test_opt(info, FREE_SPACE_TREE)) + btrfs_info(info, "using free space tree"); + } return ret; } From patchwork Wed Oct 19 08:34: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: 5007 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp244332wrs; Wed, 19 Oct 2022 03:32:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM51V/9my/a664U2wqZOfJOSHrDBLi00uaEHVQWbIMkVxlwOFeWn61b9My/a7DUdgj3G4iy7 X-Received: by 2002:a17:906:8473:b0:77b:efa8:50e4 with SMTP id hx19-20020a170906847300b0077befa850e4mr6101953ejc.250.1666175568483; Wed, 19 Oct 2022 03:32:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666175568; cv=none; d=google.com; s=arc-20160816; b=u49d4k2Kk127lzY8vUlETNxVOA5vbCFcj4S2aP/0ps099N6XPCc+aHMMTTWxOnksBu KqewG8g2gDPEOZtHNEusWk7tKg5wfkt+H90+X31nB1psyRmiQ3mssOJgQIOpRx1PTcH0 Tx9dGFRy2XTP3dp3zk7FVGMqtXN3A1vr+WQN2tlxUirhVXDBn1WCGsoYztKxWWYahalo uqe1pYbBhjfWGu/tHTy3+IXROAAjxZ0R6GC+s7NG7qii3FhwNEyqJEb2QJMlP2U0Wlnf uPSjVjMpbdhcunY1oyzhfGqV1Gf07f6ZOjvZZNtJ6vXXqVcLP7dsrJk2vDKAosroOHdZ BhCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wytThTImOBRPJ0d12pVMCynEebnkKc7zTfPv9FhUm84=; b=r8HWV2rbnXy+kjJhhXVxKu1TZhlsBWoLa0bt4BDw4kdFkfDBbUlMCCja/AYhMsbsUN GxzYZaC9h71oamRXnI3Wnmbr+CF9kMQ2RMfCTQbkmusAYKgumXsuExLOKBEyIhOXU1aQ JsWCmUua/Hwo1UOwoUPnEL8OM5canOdatkJZQvxWfLcbblYV5vyvONqrP00fYA13Jpqd Dkncr8ZiHdgp3XRIl6RD5u26LuEpcOd2wBGNZ49SlTjLMEVnSMUx8IhkkNDBEcoHX08F LbfgcI/BWHKCxPRETKlQfXzzRdxFevEa4SByVCgvwMPzFjBgYIyyyQLzjc9b1PSlWqJp bJyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rhETA3CZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id wu13-20020a170906eecd00b0072f38ecf74asi15384265ejb.794.2022.10.19.03.32.22; Wed, 19 Oct 2022 03:32: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=rhETA3CZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230500AbiJSKIa (ORCPT + 99 others); Wed, 19 Oct 2022 06:08:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233052AbiJSKIG (ORCPT ); Wed, 19 Oct 2022 06:08: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 D723713ECE6; Wed, 19 Oct 2022 02:46:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 16F6661753; Wed, 19 Oct 2022 09:14:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2FBC2C433D7; Wed, 19 Oct 2022 09:14:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170874; bh=68QUrxDYF+PVlFxrrny2cf5HOMi/5kXxGhpmdQA+QS0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rhETA3CZShTmJh0J1QlKcckOvLeACO/RXW10UT5a8rzj1dO6leP+HN9jSmAdd2TFr 2PxeH0Yir4zFOAUCQ8FTSUFyc86zIsmpPveS7JyGo5CLJFbJ2RVlll//bPO8nyY72Q nR5cJDw/LD6/i0XoHqn9p5m5/QJOnedZCnYSqFsQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Josef Bacik , David Sterba , Sasha Levin Subject: [PATCH 6.0 787/862] btrfs: call __btrfs_remove_free_space_cache_locked on cache load failure Date: Wed, 19 Oct 2022 10:34:34 +0200 Message-Id: <20221019083324.683456651@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747111713144241074?= X-GMAIL-MSGID: =?utf-8?q?1747111713144241074?= From: Josef Bacik [ Upstream commit 8a1ae2781dee9fc21ca82db682d37bea4bd074ad ] Now that lockdep is staying enabled through our entire CI runs I started seeing the following stack in generic/475 ------------[ cut here ]------------ WARNING: CPU: 1 PID: 2171864 at fs/btrfs/discard.c:604 btrfs_discard_update_discardable+0x98/0xb0 CPU: 1 PID: 2171864 Comm: kworker/u4:0 Not tainted 5.19.0-rc8+ #789 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.13.0-2.fc32 04/01/2014 Workqueue: btrfs-cache btrfs_work_helper RIP: 0010:btrfs_discard_update_discardable+0x98/0xb0 RSP: 0018:ffffb857c2f7bad0 EFLAGS: 00010246 RAX: 0000000000000000 RBX: ffff8c85c605c200 RCX: 0000000000000001 RDX: 0000000000000000 RSI: ffffffff86807c5b RDI: ffffffff868a831e RBP: ffff8c85c4c54000 R08: 0000000000000000 R09: 0000000000000000 R10: ffff8c85c66932f0 R11: 0000000000000001 R12: ffff8c85c3899010 R13: ffff8c85d5be4f40 R14: ffff8c85c4c54000 R15: ffff8c86114bfa80 FS: 0000000000000000(0000) GS:ffff8c863bd00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f2e7f168160 CR3: 000000010289a004 CR4: 0000000000370ee0 Call Trace: __btrfs_remove_free_space_cache+0x27/0x30 load_free_space_cache+0xad2/0xaf0 caching_thread+0x40b/0x650 ? lock_release+0x137/0x2d0 btrfs_work_helper+0xf2/0x3e0 ? lock_is_held_type+0xe2/0x140 process_one_work+0x271/0x590 ? process_one_work+0x590/0x590 worker_thread+0x52/0x3b0 ? process_one_work+0x590/0x590 kthread+0xf0/0x120 ? kthread_complete_and_exit+0x20/0x20 ret_from_fork+0x1f/0x30 This is the code ctl = block_group->free_space_ctl; discard_ctl = &block_group->fs_info->discard_ctl; lockdep_assert_held(&ctl->tree_lock); We have a temporary free space ctl for loading the free space cache in order to avoid having allocations happening while we're loading the cache. When we hit an error we free it all up, however this also calls btrfs_discard_update_discardable, which requires block_group->free_space_ctl->tree_lock to be held. However this is our temporary ctl so this lock isn't held. Fix this by calling __btrfs_remove_free_space_cache_locked instead so that we only clean up the entries and do not mess with the discardable stats. Signed-off-by: Josef Bacik Signed-off-by: David Sterba Signed-off-by: Sasha Levin --- fs/btrfs/free-space-cache.c | 53 +++++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 20 deletions(-) --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c @@ -48,6 +48,25 @@ static void bitmap_clear_bits(struct btr struct btrfs_free_space *info, u64 offset, u64 bytes, bool update_stats); +static void __btrfs_remove_free_space_cache_locked( + struct btrfs_free_space_ctl *ctl) +{ + struct btrfs_free_space *info; + struct rb_node *node; + + while ((node = rb_last(&ctl->free_space_offset)) != NULL) { + info = rb_entry(node, struct btrfs_free_space, offset_index); + if (!info->bitmap) { + unlink_free_space(ctl, info, true); + kmem_cache_free(btrfs_free_space_cachep, info); + } else { + free_bitmap(ctl, info); + } + + cond_resched_lock(&ctl->tree_lock); + } +} + static struct inode *__lookup_free_space_inode(struct btrfs_root *root, struct btrfs_path *path, u64 offset) @@ -881,7 +900,14 @@ out: return ret; free_cache: io_ctl_drop_pages(&io_ctl); - __btrfs_remove_free_space_cache(ctl); + + /* + * We need to call the _locked variant so we don't try to update the + * discard counters. + */ + spin_lock(&ctl->tree_lock); + __btrfs_remove_free_space_cache_locked(ctl); + spin_unlock(&ctl->tree_lock); goto out; } @@ -1007,7 +1033,13 @@ int load_free_space_cache(struct btrfs_b if (ret == 0) ret = 1; } else { + /* + * We need to call the _locked variant so we don't try to update + * the discard counters. + */ + spin_lock(&tmp_ctl.tree_lock); __btrfs_remove_free_space_cache(&tmp_ctl); + spin_unlock(&tmp_ctl.tree_lock); btrfs_warn(fs_info, "block group %llu has wrong amount of free space", block_group->start); @@ -2970,25 +3002,6 @@ static void __btrfs_return_cluster_to_fr btrfs_put_block_group(block_group); } -static void __btrfs_remove_free_space_cache_locked( - struct btrfs_free_space_ctl *ctl) -{ - struct btrfs_free_space *info; - struct rb_node *node; - - while ((node = rb_last(&ctl->free_space_offset)) != NULL) { - info = rb_entry(node, struct btrfs_free_space, offset_index); - if (!info->bitmap) { - unlink_free_space(ctl, info, true); - kmem_cache_free(btrfs_free_space_cachep, info); - } else { - free_bitmap(ctl, info); - } - - cond_resched_lock(&ctl->tree_lock); - } -} - void __btrfs_remove_free_space_cache(struct btrfs_free_space_ctl *ctl) { spin_lock(&ctl->tree_lock); From patchwork Wed Oct 19 08:34: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: 5177 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp263342wrs; Wed, 19 Oct 2022 04:17:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5msYFTfqYwHf4fZn+H1h2Vp7QyRdNl7zmNCHGemiT27++wj7NienqObIBs5xLnrS+mN6uc X-Received: by 2002:a05:6a00:2350:b0:541:b5bf:2774 with SMTP id j16-20020a056a00235000b00541b5bf2774mr7737838pfj.28.1666178272023; Wed, 19 Oct 2022 04:17:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178272; cv=none; d=google.com; s=arc-20160816; b=DJj+HtgqupBdJ2Xq38hGdBy8q6jShuP2EN0iv45FNtq0LeCQSPeyLDOwqeDfnrPpx7 r6xWGl9cpmOey/AHl/NmeQr80T0jBtcPLNGSRgcQ83Tr1wbxupATE7iCD+kjrmXWM3b0 jFhSXJwQ2Qujx2TTJMOHE5ZAnvLE3FcHnmLZetTSdmWEyyyj8iRE3fv/LboSq/xcOmvP npKWyTfKb5xoaa7SoC/1S85BoBOc2doqAbWML0uZyF90hjvPM0mYeCGmtOg5KCUhC4O9 apSPrwhrEFkdZk/prclwugWtP7JT4liCytWeXY6nwUaBcQg++gjelv9MVAnkByk05gd6 ujDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+q4zsi7UhlUH70cMFAo7Ees77SBcnF5f15TVZiqaPDk=; b=xVnurbNL8zmWReRukH3a5mmh5pULpu9Qh0uy+iZDyGI5Uh4ZwgNsFCaiuVJ8Nhmcah T/SVpLnw1euNAlcteef3gwPH1u8tCgXq0ouRmjUyiYf198FbRI4KFN5sYJ6zaOU3Yz+m EdL7edk88Ta4gmi3tPQ4gXyGETi04HLXQ9ZyoLqL2j3n4ZoTI2qVxsHI7aR49T8UY26M MMIcIkRdRyWvwSOQmqshswSxYxseksEHW2v+uCGmcSs+wUUovXDYTwxLDilJ3uB2//Dh ariNdcw8a+BNcvXmaBV/6+QC327PgGMsJiFhvFVGN+CmTCXjCJHiRDWN1mu6/6/450F2 IHuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pAto0vey; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z21-20020aa78895000000b0056353f0bd40si18527613pfe.29.2022.10.19.04.17.35; Wed, 19 Oct 2022 04:17: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=pAto0vey; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233517AbiJSLGW (ORCPT + 99 others); Wed, 19 Oct 2022 07:06:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233526AbiJSLFY (ORCPT ); Wed, 19 Oct 2022 07:05: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 8AEF21DF0B; Wed, 19 Oct 2022 03:34:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C3105617EA; Wed, 19 Oct 2022 09:14:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BEA1FC433C1; Wed, 19 Oct 2022 09:14:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170877; bh=DyF7cFPBhyiKKwMWomnIA0DO1L1nyUDi+UAHcYqsMI0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pAto0vey2tthbgMIVtbLsXgSb8FOLO7y+Tb0LEAbijJAP5wSRv+oTaxuRlubqpQQ4 G2s8rOTRDXeDaijFfYn04O9cJYia8Tk9Cet5hXGo8m2WUCR4NKDRSKujaZAva46NTV qgzsUzO52IzFCs9d8N6YBbbP8qvjBGICtvGolk8c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kunihiko Hayashi , Arnd Bergmann , Sasha Levin Subject: [PATCH 6.0 788/862] arm64: dts: uniphier: Add USB-device support for PXs3 reference board Date: Wed, 19 Oct 2022 10:34:35 +0200 Message-Id: <20221019083324.721603131@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114547833870568?= X-GMAIL-MSGID: =?utf-8?q?1747114547833870568?= From: Kunihiko Hayashi [ Upstream commit 19fee1a1096d21ab1f1e712148b5417bda2939a2 ] PXs3 reference board can change each USB port 0 and 1 to device mode with jumpers. Prepare devicetree sources for USB port 0 and 1. This specifies dr_mode, pinctrl, and some quirks and removes nodes for unused phys and vbus-supply properties. Signed-off-by: Kunihiko Hayashi Link: https://lore.kernel.org/r/20220913042321.4817-8-hayashi.kunihiko@socionext.com' Signed-off-by: Arnd Bergmann Signed-off-by: Sasha Levin --- arch/arm/boot/dts/uniphier-pinctrl.dtsi | 10 +++++ arch/arm64/boot/dts/socionext/Makefile | 4 +- .../socionext/uniphier-pxs3-ref-gadget0.dts | 41 +++++++++++++++++++ .../socionext/uniphier-pxs3-ref-gadget1.dts | 40 ++++++++++++++++++ 4 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 arch/arm64/boot/dts/socionext/uniphier-pxs3-ref-gadget0.dts create mode 100644 arch/arm64/boot/dts/socionext/uniphier-pxs3-ref-gadget1.dts diff --git a/arch/arm/boot/dts/uniphier-pinctrl.dtsi b/arch/arm/boot/dts/uniphier-pinctrl.dtsi index c0fd029b37e5..f909ec2e5333 100644 --- a/arch/arm/boot/dts/uniphier-pinctrl.dtsi +++ b/arch/arm/boot/dts/uniphier-pinctrl.dtsi @@ -196,11 +196,21 @@ function = "usb0"; }; + pinctrl_usb0_device: usb0-device { + groups = "usb0_device"; + function = "usb0"; + }; + pinctrl_usb1: usb1 { groups = "usb1"; function = "usb1"; }; + pinctrl_usb1_device: usb1-device { + groups = "usb1_device"; + function = "usb1"; + }; + pinctrl_usb2: usb2 { groups = "usb2"; function = "usb2"; diff --git a/arch/arm64/boot/dts/socionext/Makefile b/arch/arm64/boot/dts/socionext/Makefile index dda3da33614b..33989a9643ac 100644 --- a/arch/arm64/boot/dts/socionext/Makefile +++ b/arch/arm64/boot/dts/socionext/Makefile @@ -5,4 +5,6 @@ dtb-$(CONFIG_ARCH_UNIPHIER) += \ uniphier-ld20-akebi96.dtb \ uniphier-ld20-global.dtb \ uniphier-ld20-ref.dtb \ - uniphier-pxs3-ref.dtb + uniphier-pxs3-ref.dtb \ + uniphier-pxs3-ref-gadget0.dtb \ + uniphier-pxs3-ref-gadget1.dtb diff --git a/arch/arm64/boot/dts/socionext/uniphier-pxs3-ref-gadget0.dts b/arch/arm64/boot/dts/socionext/uniphier-pxs3-ref-gadget0.dts new file mode 100644 index 000000000000..7069f51bc120 --- /dev/null +++ b/arch/arm64/boot/dts/socionext/uniphier-pxs3-ref-gadget0.dts @@ -0,0 +1,41 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +// +// Device Tree Source for UniPhier PXs3 Reference Board (for USB-Device #0) +// +// Copyright (C) 2021 Socionext Inc. +// Author: Kunihiko Hayashi + +/dts-v1/; +#include "uniphier-pxs3-ref.dts" + +/ { + model = "UniPhier PXs3 Reference Board (USB-Device #0)"; +}; + +/* I2C3 pinctrl is shared with USB*VBUSIN */ +&i2c3 { + status = "disabled"; +}; + +&usb0 { + status = "okay"; + dr_mode = "peripheral"; + pinctrl-0 = <&pinctrl_usb0_device>; + snps,dis_enblslpm_quirk; + snps,dis_u2_susphy_quirk; + snps,dis_u3_susphy_quirk; + snps,usb2_gadget_lpm_disable; + phy-names = "usb2-phy", "usb3-phy"; + phys = <&usb0_hsphy0>, <&usb0_ssphy0>; +}; + +&usb0_hsphy0 { + /delete-property/ vbus-supply; +}; + +&usb0_ssphy0 { + /delete-property/ vbus-supply; +}; + +/delete-node/ &usb0_hsphy1; +/delete-node/ &usb0_ssphy1; diff --git a/arch/arm64/boot/dts/socionext/uniphier-pxs3-ref-gadget1.dts b/arch/arm64/boot/dts/socionext/uniphier-pxs3-ref-gadget1.dts new file mode 100644 index 000000000000..a3cfa8113ffb --- /dev/null +++ b/arch/arm64/boot/dts/socionext/uniphier-pxs3-ref-gadget1.dts @@ -0,0 +1,40 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +// +// Device Tree Source for UniPhier PXs3 Reference Board (for USB-Device #1) +// +// Copyright (C) 2021 Socionext Inc. +// Author: Kunihiko Hayashi + +/dts-v1/; +#include "uniphier-pxs3-ref.dts" + +/ { + model = "UniPhier PXs3 Reference Board (USB-Device #1)"; +}; + +/* I2C3 pinctrl is shared with USB*VBUSIN */ +&i2c3 { + status = "disabled"; +}; + +&usb1 { + status = "okay"; + dr_mode = "peripheral"; + pinctrl-0 = <&pinctrl_usb1_device>; + snps,dis_enblslpm_quirk; + snps,dis_u2_susphy_quirk; + snps,dis_u3_susphy_quirk; + snps,usb2_gadget_lpm_disable; + phy-names = "usb2-phy", "usb3-phy"; + phys = <&usb1_hsphy0>, <&usb1_ssphy0>; +}; + +&usb1_hsphy0 { + /delete-property/ vbus-supply; +}; + +&usb1_ssphy0 { + /delete-property/ vbus-supply; +}; + +/delete-node/ &usb1_hsphy1; From patchwork Wed Oct 19 08:34: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: 4961 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp226622wrs; Wed, 19 Oct 2022 02:46:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6kw6UvCmfu2tQFx8kllI5DHHYgxhaVDHEDV6OAP3E3oKoXthpSm/WiaFm/iH6lTxuclAYU X-Received: by 2002:a05:6a00:1d26:b0:54e:8c81:9f64 with SMTP id a38-20020a056a001d2600b0054e8c819f64mr7802688pfx.58.1666172784843; Wed, 19 Oct 2022 02:46:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172784; cv=none; d=google.com; s=arc-20160816; b=eIcWPQRuses+u3BOl5V/J5iD9jFISg8iuN9FhxtkLxTVXjmYvrc+UKDW5Rjq7nV+FK QJiw+0mFW4MUAVjrTV4MkUI0T4OgPX2pK1xJoDqLwd7bsXE31O6p9KJxuBVtBx1wRoPV nlMu/MD9bybG5DqiPmYKGXF/jo10IOMuBf/0W0F13Kq3/X5r88LOQYzpanqz5PGIzq3E LQEKZ0YqM8iNrgI/LQYKl2TRBDK6sP4H/wfp4jz1xQMUpXugpGZ5m3dnGoq+SBmM6x+K Qe39qdysJzPFUo8KCBVw6zMM7pi2GIG5DH3PUl1hK/09iB94rhmslu9ERisrUAbvM3cK KAWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bH4dHZzbIwvguSxePi0OwlXmu34A5nrw9qglcwJmnB4=; b=A9Sckg3sRoKfmpxbKXxy/rD9q20QeoP5rHeDUmPHSQNzr5vGqfLmRV37h9g35A5b+a MxKSP6H0aAC/X6POx+9QNTj3GPLXXDXqlIQE8lK3kzOaCu3olnkei7eogq4EUDM9VBoC VSNd/yYKLOlAnl5TXZX4Bf8Wa0no4WAgx/qTHa/Ol9n7MPm54ywYq7BfLgIEwqkgru2c 9THLAnFAOCxJGl3AllBkg3nsrX5/LCIsalYmhK/4DeFHzxWduYzH38Jmr/UiHe9Q9tzD Aj9WAWTomV50HfRoPzbaLroom9TzuhGmKntxPI7Y+IYar/02UEN5d4hKI+qMMsFRM5T9 C1fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RM78CWkp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a7-20020a170902710700b00182ecf96250si15482570pll.550.2022.10.19.02.46.07; Wed, 19 Oct 2022 02:46: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=RM78CWkp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233971AbiJSJne (ORCPT + 99 others); Wed, 19 Oct 2022 05:43:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234458AbiJSJk2 (ORCPT ); Wed, 19 Oct 2022 05:40:28 -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 4BF09F0191; Wed, 19 Oct 2022 02:16: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 dfw.source.kernel.org (Postfix) with ESMTPS id 6037C61777; Wed, 19 Oct 2022 09:14:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 714F4C433B5; Wed, 19 Oct 2022 09:14:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170879; bh=eHV1aJFxZYib1ONBCUtCKxxKWY0nN7MLKb5IBx+tpRE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RM78CWkpXU/CmRjYjFdhaX6nS/nMiAbVyY6CcrZo+ZD5fyVSqfiB4+CuXzPR8ZNIi jQPUuDcgomP47rr1C3suvZjq+Bj+qYDHtaUBqGP5BiD0rQ1MneXV2Lz+nsmBf3cjPv IjPo2hO/1ztW6WPjJaF317lzphIKqUHVxjWyQ4hA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Li Huafei , Linus Waleij , "Russell King (Oracle)" , Sasha Levin Subject: [PATCH 6.0 789/862] ARM: 9233/1: stacktrace: Skip frame pointer boundary check for call_with_stack() Date: Wed, 19 Oct 2022 10:34:36 +0200 Message-Id: <20221019083324.769545934@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108794018982329?= X-GMAIL-MSGID: =?utf-8?q?1747108794018982329?= From: Li Huafei [ Upstream commit 5854e4d8530e6ed4c2532a71a6b0474e199d44dd ] When using the frame pointer unwinder, it was found that the stack trace output of stack_trace_save() is incomplete if the stack contains call_with_stack(): [0x7f00002c] dump_stack_task+0x2c/0x90 [hrtimer] [0x7f0000a0] hrtimer_hander+0x10/0x18 [hrtimer] [0x801a67f0] __hrtimer_run_queues+0x1b0/0x3b4 [0x801a7350] hrtimer_run_queues+0xc4/0xd8 [0x801a597c] update_process_times+0x3c/0x88 [0x801b5a98] tick_periodic+0x50/0xd8 [0x801b5bf4] tick_handle_periodic+0x24/0x84 [0x8010ffc4] twd_handler+0x38/0x48 [0x8017d220] handle_percpu_devid_irq+0xa8/0x244 [0x80176e9c] generic_handle_domain_irq+0x2c/0x3c [0x8052e3a8] gic_handle_irq+0x7c/0x90 [0x808ab15c] generic_handle_arch_irq+0x60/0x80 [0x8051191c] call_with_stack+0x1c/0x20 For the frame pointer unwinder, unwind_frame() checks stackframe::fp by stackframe::sp. Since call_with_stack() switches the SP from one stack to another, stackframe::fp and stackframe: :sp will point to different stacks, so we can no longer check stackframe::fp by stackframe::sp. Skip checking stackframe::fp at this point to avoid this problem. Signed-off-by: Li Huafei Reviewed-by: Linus Waleij Signed-off-by: Russell King (Oracle) Signed-off-by: Sasha Levin --- arch/arm/kernel/stacktrace.c | 40 ++++++++++++++++++++++++++++------ arch/arm/lib/call_with_stack.S | 2 ++ 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/arch/arm/kernel/stacktrace.c b/arch/arm/kernel/stacktrace.c index d0fa2037460a..af87040b0353 100644 --- a/arch/arm/kernel/stacktrace.c +++ b/arch/arm/kernel/stacktrace.c @@ -9,6 +9,8 @@ #include #include +#include "reboot.h" + #if defined(CONFIG_FRAME_POINTER) && !defined(CONFIG_ARM_UNWIND) /* * Unwind the current stack frame and store the new register values in the @@ -39,29 +41,53 @@ * Note that with framepointer enabled, even the leaf functions have the same * prologue and epilogue, therefore we can ignore the LR value in this case. */ -int notrace unwind_frame(struct stackframe *frame) + +extern unsigned long call_with_stack_end; + +static int frame_pointer_check(struct stackframe *frame) { unsigned long high, low; unsigned long fp = frame->fp; + unsigned long pc = frame->pc; + + /* + * call_with_stack() is the only place we allow SP to jump from one + * stack to another, with FP and SP pointing to different stacks, + * skipping the FP boundary check at this point. + */ + if (pc >= (unsigned long)&call_with_stack && + pc < (unsigned long)&call_with_stack_end) + return 0; /* only go to a higher address on the stack */ low = frame->sp; high = ALIGN(low, THREAD_SIZE); -#ifdef CONFIG_CC_IS_CLANG /* check current frame pointer is within bounds */ +#ifdef CONFIG_CC_IS_CLANG if (fp < low + 4 || fp > high - 4) return -EINVAL; - - frame->sp = frame->fp; - frame->fp = READ_ONCE_NOCHECK(*(unsigned long *)(fp)); - frame->pc = READ_ONCE_NOCHECK(*(unsigned long *)(fp + 4)); #else - /* check current frame pointer is within bounds */ if (fp < low + 12 || fp > high - 4) return -EINVAL; +#endif + + return 0; +} + +int notrace unwind_frame(struct stackframe *frame) +{ + unsigned long fp = frame->fp; + + if (frame_pointer_check(frame)) + return -EINVAL; /* restore the registers from the stack frame */ +#ifdef CONFIG_CC_IS_CLANG + frame->sp = frame->fp; + frame->fp = READ_ONCE_NOCHECK(*(unsigned long *)(fp)); + frame->pc = READ_ONCE_NOCHECK(*(unsigned long *)(fp + 4)); +#else frame->fp = READ_ONCE_NOCHECK(*(unsigned long *)(fp - 12)); frame->sp = READ_ONCE_NOCHECK(*(unsigned long *)(fp - 8)); frame->pc = READ_ONCE_NOCHECK(*(unsigned long *)(fp - 4)); diff --git a/arch/arm/lib/call_with_stack.S b/arch/arm/lib/call_with_stack.S index 0a268a6c513c..5030d4e8d126 100644 --- a/arch/arm/lib/call_with_stack.S +++ b/arch/arm/lib/call_with_stack.S @@ -46,4 +46,6 @@ UNWIND( .setfp fpreg, sp ) pop {fpreg, pc} UNWIND( .fnend ) #endif + .globl call_with_stack_end +call_with_stack_end: ENDPROC(call_with_stack) From patchwork Wed Oct 19 08:34: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: 5037 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp247042wrs; Wed, 19 Oct 2022 03:39:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5NeE7XxYdY+u9l2ZkIr254WockS+b+K5AtqhWrh6S2muAj+fif/MC2OOlczlq+u22/V4SN X-Received: by 2002:a17:907:2711:b0:78e:c2a:a3fb with SMTP id w17-20020a170907271100b0078e0c2aa3fbmr6077876ejk.556.1666175986136; Wed, 19 Oct 2022 03:39:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666175986; cv=none; d=google.com; s=arc-20160816; b=HHNbhyS27mcMWQcl+uMnXbOAILpLRmJhqG3j0WPzzOvFUwrhN79ni0wqA8cRKGExyJ 5VhCV+K+pdp3nix4VDMQ29PHJfIvl30Qva+CbWw6ySh6XhVanOHASGU0tIbNl6sjpYDw shna6hwBIdUbfjSMq122QrC2OfXehjyNAgn6LczoRKKqdWXxR+glPgiEVy1kdx0qS1n8 uwLCqoWrzjzvPENFjXbN1M9CoaQmH3xN1ijS3/mHeUEqt+C8cRjNMS6SCg8rdFAvhYZD XM1zv6+7UdGEkL8CONGbnkiIxgCOowOAgu/Fm3NtSlec53+XpU4wIRYeFncFvQqBUvPU 3Ijw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HgAW6ipeS5MKvobZvTgmL7Gernce+Vu46Dw3iRa2qXI=; b=fDg18z21zeminaGePJ797/iCsAEdBa5tKkDDR3pV+hYb/u8k0VCYGQmh0a2uXwh1mo f2hHJmNnvsNKMCb/tgWurdi4vgRg8rBI8I3gbMFK3q7eyVf10lcCLvqaq6q1Jz+U9Lox o+iuVRGao1s/a+mHhEP1h6fyuhKXhSQ+UWo1NkzQzH4QfS2CghC01UAzLPEGP4e0do4o QBs/Kh9/zO3Oujocj7zo/E1RvCenc7mbCCFivnu5FB5Gim22OyRsCkP2BfbnMR4TuPr8 fOqEkdIHtvf8UhkTrncFXH/XWx84BCFoiJUVEnX8pkdUPMazGvGW36v89UiMr8b0ombi /ePw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EMnu1Tcf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170906829000b0076f0940cb28si10563820ejx.175.2022.10.19.03.39.21; Wed, 19 Oct 2022 03:39: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=EMnu1Tcf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230398AbiJSKfk (ORCPT + 99 others); Wed, 19 Oct 2022 06:35:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231909AbiJSKeG (ORCPT ); Wed, 19 Oct 2022 06:34:06 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99D3125E93; Wed, 19 Oct 2022 03:13: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 sin.source.kernel.org (Postfix) with ESMTPS id 47EABCE21C4; Wed, 19 Oct 2022 09:13:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C37FC433D6; Wed, 19 Oct 2022 09:13:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170795; bh=G8CuIdsxyRmJZ0HZZZ+6AWbhH4w906IufRABNPKTnM0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EMnu1Tcf69bedyBPrM3c4kpDxxZwkbw/aegKz5o8Y1pskqr9Lmu1+cS5Y+QwrW7rS 2nQhUFT9PB0WM3tah/ok2tr0LgS7owWhiSsot7Tsoqc9vEHaNCpLwAGzPopLFHPt5E gNNIUo3zr8Elg/6Zd2r5c2QsQf0SGc1dMgOjB5f4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Li Huafei , Linus Waleij , "Russell King (Oracle)" , Sasha Levin Subject: [PATCH 6.0 790/862] ARM: 9234/1: stacktrace: Avoid duplicate saving of exception PC value Date: Wed, 19 Oct 2022 10:34:37 +0200 Message-Id: <20221019083324.817190727@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112150495703912?= X-GMAIL-MSGID: =?utf-8?q?1747112150495703912?= From: Li Huafei [ Upstream commit 752ec621ef5c30777958cc5eb5f1cf394f7733f4 ] Because an exception stack frame is not created in the exception entry, save_trace() does special handling for the exception PC, but this is only needed when CONFIG_FRAME_POINTER_UNWIND=y. When CONFIG_ARM_UNWIND=y, unwind annotations have been added to the exception entry and save_trace() will repeatedly save the exception PC: [0x7f000090] hrtimer_hander+0x8/0x10 [hrtimer] [0x8019ec50] __hrtimer_run_queues+0x18c/0x394 [0x8019f760] hrtimer_run_queues+0xbc/0xd0 [0x8019def0] update_process_times+0x34/0x80 [0x801ad2a4] tick_periodic+0x48/0xd0 [0x801ad3dc] tick_handle_periodic+0x1c/0x7c [0x8010f2e0] twd_handler+0x30/0x40 [0x80177620] handle_percpu_devid_irq+0xa0/0x23c [0x801718d0] generic_handle_domain_irq+0x24/0x34 [0x80502d28] gic_handle_irq+0x74/0x88 [0x8085817c] generic_handle_arch_irq+0x58/0x78 [0x80100ba8] __irq_svc+0x88/0xc8 [0x80108114] arch_cpu_idle+0x38/0x3c [0x80108114] arch_cpu_idle+0x38/0x3c <==== duplicate saved exception PC [0x80861bf8] default_idle_call+0x38/0x130 [0x8015d5cc] do_idle+0x150/0x214 [0x8015d978] cpu_startup_entry+0x18/0x1c [0x808589c0] rest_init+0xd8/0xdc [0x80c00a44] arch_post_acpi_subsys_init+0x0/0x8 We can move the special handling of the exception PC in save_trace() to the unwind_frame() of the frame pointer unwinder. Signed-off-by: Li Huafei Reviewed-by: Linus Waleij Signed-off-by: Russell King (Oracle) Signed-off-by: Sasha Levin --- arch/arm/include/asm/stacktrace.h | 6 +++++ arch/arm/kernel/return_address.c | 1 + arch/arm/kernel/stacktrace.c | 44 +++++++++++++++++++++---------- 3 files changed, 37 insertions(+), 14 deletions(-) diff --git a/arch/arm/include/asm/stacktrace.h b/arch/arm/include/asm/stacktrace.h index 3e78f921b8b2..39be2d1aa27b 100644 --- a/arch/arm/include/asm/stacktrace.h +++ b/arch/arm/include/asm/stacktrace.h @@ -21,6 +21,9 @@ struct stackframe { struct llist_node *kr_cur; struct task_struct *tsk; #endif +#ifdef CONFIG_UNWINDER_FRAME_POINTER + bool ex_frame; +#endif }; static __always_inline @@ -34,6 +37,9 @@ void arm_get_current_stackframe(struct pt_regs *regs, struct stackframe *frame) frame->kr_cur = NULL; frame->tsk = current; #endif +#ifdef CONFIG_UNWINDER_FRAME_POINTER + frame->ex_frame = in_entry_text(frame->pc); +#endif } extern int unwind_frame(struct stackframe *frame); diff --git a/arch/arm/kernel/return_address.c b/arch/arm/kernel/return_address.c index 8aac1e10b117..38f1ea9c724d 100644 --- a/arch/arm/kernel/return_address.c +++ b/arch/arm/kernel/return_address.c @@ -47,6 +47,7 @@ void *return_address(unsigned int level) frame.kr_cur = NULL; frame.tsk = current; #endif + frame.ex_frame = false; walk_stackframe(&frame, save_return_addr, &data); diff --git a/arch/arm/kernel/stacktrace.c b/arch/arm/kernel/stacktrace.c index af87040b0353..85443b5d1922 100644 --- a/arch/arm/kernel/stacktrace.c +++ b/arch/arm/kernel/stacktrace.c @@ -82,6 +82,27 @@ int notrace unwind_frame(struct stackframe *frame) if (frame_pointer_check(frame)) return -EINVAL; + /* + * When we unwind through an exception stack, include the saved PC + * value into the stack trace. + */ + if (frame->ex_frame) { + struct pt_regs *regs = (struct pt_regs *)frame->sp; + + /* + * We check that 'regs + sizeof(struct pt_regs)' (that is, + * ®s[1]) does not exceed the bottom of the stack to avoid + * accessing data outside the task's stack. This may happen + * when frame->ex_frame is a false positive. + */ + if ((unsigned long)®s[1] > ALIGN(frame->sp, THREAD_SIZE)) + return -EINVAL; + + frame->pc = regs->ARM_pc; + frame->ex_frame = false; + return 0; + } + /* restore the registers from the stack frame */ #ifdef CONFIG_CC_IS_CLANG frame->sp = frame->fp; @@ -98,6 +119,9 @@ int notrace unwind_frame(struct stackframe *frame) (void *)frame->fp, &frame->kr_cur); #endif + if (in_entry_text(frame->pc)) + frame->ex_frame = true; + return 0; } #endif @@ -128,7 +152,6 @@ static int save_trace(struct stackframe *frame, void *d) { struct stack_trace_data *data = d; struct stack_trace *trace = data->trace; - struct pt_regs *regs; unsigned long addr = frame->pc; if (data->no_sched_functions && in_sched_functions(addr)) @@ -139,19 +162,6 @@ static int save_trace(struct stackframe *frame, void *d) } trace->entries[trace->nr_entries++] = addr; - - if (trace->nr_entries >= trace->max_entries) - return 1; - - if (!in_entry_text(frame->pc)) - return 0; - - regs = (struct pt_regs *)frame->sp; - if ((unsigned long)®s[1] > ALIGN(frame->sp, THREAD_SIZE)) - return 0; - - trace->entries[trace->nr_entries++] = regs->ARM_pc; - return trace->nr_entries >= trace->max_entries; } @@ -193,6 +203,9 @@ static noinline void __save_stack_trace(struct task_struct *tsk, frame.kr_cur = NULL; frame.tsk = tsk; #endif +#ifdef CONFIG_UNWINDER_FRAME_POINTER + frame.ex_frame = false; +#endif walk_stackframe(&frame, save_trace, &data); } @@ -214,6 +227,9 @@ void save_stack_trace_regs(struct pt_regs *regs, struct stack_trace *trace) frame.kr_cur = NULL; frame.tsk = current; #endif +#ifdef CONFIG_UNWINDER_FRAME_POINTER + frame.ex_frame = in_entry_text(frame.pc); +#endif walk_stackframe(&frame, save_trace, &data); } From patchwork Wed Oct 19 08:34: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: 4914 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225744wrs; Wed, 19 Oct 2022 02:43:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4SW+rdCpzlU9FdqV0PaMIzcK5/XIDa8LgHMO22c1YmKd0ogq8ZM8/DnnoTtuamRemKv84x X-Received: by 2002:a17:906:8a61:b0:78d:9d00:c906 with SMTP id hy1-20020a1709068a6100b0078d9d00c906mr5978566ejc.321.1666172635141; Wed, 19 Oct 2022 02:43:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172635; cv=none; d=google.com; s=arc-20160816; b=RJR7rsj0IhYrwaDIziigrKzGNfqW581SWUtrgHmU8d4M29QZfkWgybn4+KeDOYGmdE d2pyrj5jeEAGN7rLhONCsVEmT3wrJsHUgRgx8JHyla5Q2r0z2teePC/O8fCmZX0S9wl+ jXZOLDrXU/pHTl04WoyjhvDKLxs2slhfmEvcN39vn5z5q63mSwdfm06X8/PmU2mja6T/ HCEvLcsccIteDJQj64jbRXCXmY7thjtxNQ5bAlYxrCJZ/vWki82lW5PvMPNR70L5aMk3 7iq53ioOvaT+wuqG5JX8M6xAEL8Zzkrp7tNagTUN+suApqaRHooiah7E/cmexNTiH6pG 9Kkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=B4G7M8JKZn6dY9zXOIh+E6Zcjzi8GQVa+pilD8KJgvQ=; b=aZYlgswI3c7zzv1HdMO5uEXS9sQ8AxTB/tLJS0ETaedQKbR0/wB7QChyhmtE7GrWwd ngKDqcPNtBKIwYuB/ciNiAazqHh0vFZehlEtXffoj9gwICOLnomAkTW5k8S84f6a805z AfeiRF3XP5wnEHUmoQFmwjJLqvxU5xhrGmIfT4dy9KDvffRn149IKSKmKyotv75MKWK8 WXv94Fix26iwsVjDcsCmajKhewWgrCWcMrMhfMxR0KJySaECxYYvzcmx5/wwHeRNc+sV olebw0XaLmqOwFmnkkEuFAfJzRamk9QeVPwcCmJ6e/c+HJQgW1bE/PlFShvrcTo17X6K QA2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=N72xUiT8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l17-20020aa7c311000000b00458b6dd954dsi12423086edq.200.2022.10.19.02.43.22; Wed, 19 Oct 2022 02:43: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=N72xUiT8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233912AbiJSJgV (ORCPT + 99 others); Wed, 19 Oct 2022 05:36:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233921AbiJSJ3w (ORCPT ); Wed, 19 Oct 2022 05:29: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 22A82C354F; Wed, 19 Oct 2022 02:13:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 581D3617EA; Wed, 19 Oct 2022 09:13:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A3B5C433D7; Wed, 19 Oct 2022 09:13:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170798; bh=zx+NsFJM2HlrPk63IXXZIbC844ngJf0rvo8h74tKeLo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N72xUiT8OZk4c8NSRuN+/Pxn92eQcDactv98sAG4yuqFffxi14+UWq59cZa0u2Bij y1kL+AEMaYT+t+mdF/eJsPh996idi72wxuPWnKDFn+TnddBdSXZqsgc5MJoCidJRuO PqFKIgPrZUXIqEIg6NooO+gwB1YJulwgjfDIpfsA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Linus Walleij , Alexander Sverdlin , "Russell King (Oracle)" , Sasha Levin Subject: [PATCH 6.0 791/862] ARM: 9242/1: kasan: Only map modules if CONFIG_KASAN_VMALLOC=n Date: Wed, 19 Oct 2022 10:34:38 +0200 Message-Id: <20221019083324.863655777@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108636906494958?= X-GMAIL-MSGID: =?utf-8?q?1747108636906494958?= From: Alex Sverdlin [ Upstream commit 823f606ab6b4759a1faf0388abcf4fb0776710d2 ] In case CONFIG_KASAN_VMALLOC=y kasan_populate_vmalloc() allocates the shadow pages dynamically. But even worse is that kasan_release_vmalloc() releases them, which is not compatible with create_mapping() of MODULES_VADDR..MODULES_END range: BUG: Bad page state in process kworker/9:1 pfn:2068b page:e5e06160 refcount:0 mapcount:0 mapping:00000000 index:0x0 flags: 0x1000(reserved) raw: 00001000 e5e06164 e5e06164 00000000 00000000 00000000 ffffffff 00000000 page dumped because: PAGE_FLAGS_CHECK_AT_FREE flag(s) set bad because of flags: 0x1000(reserved) Modules linked in: ip_tables CPU: 9 PID: 154 Comm: kworker/9:1 Not tainted 5.4.188-... #1 Hardware name: LSI Axxia AXM55XX Workqueue: events do_free_init unwind_backtrace show_stack dump_stack bad_page free_pcp_prepare free_unref_page kasan_depopulate_vmalloc_pte __apply_to_page_range apply_to_existing_page_range kasan_release_vmalloc __purge_vmap_area_lazy _vm_unmap_aliases.part.0 __vunmap do_free_init process_one_work worker_thread kthread Reviewed-by: Linus Walleij Signed-off-by: Alexander Sverdlin Signed-off-by: Russell King (Oracle) Signed-off-by: Sasha Levin --- arch/arm/mm/kasan_init.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/arm/mm/kasan_init.c b/arch/arm/mm/kasan_init.c index 29caee9c79ce..46d9f4a622cb 100644 --- a/arch/arm/mm/kasan_init.c +++ b/arch/arm/mm/kasan_init.c @@ -268,12 +268,17 @@ void __init kasan_init(void) /* * 1. The module global variables are in MODULES_VADDR ~ MODULES_END, - * so we need to map this area. + * so we need to map this area if CONFIG_KASAN_VMALLOC=n. With + * VMALLOC support KASAN will manage this region dynamically, + * refer to kasan_populate_vmalloc() and ARM's implementation of + * module_alloc(). * 2. PKMAP_BASE ~ PKMAP_BASE+PMD_SIZE's shadow and MODULES_VADDR * ~ MODULES_END's shadow is in the same PMD_SIZE, so we can't * use kasan_populate_zero_shadow. */ - create_mapping((void *)MODULES_VADDR, (void *)(PKMAP_BASE + PMD_SIZE)); + if (!IS_ENABLED(CONFIG_KASAN_VMALLOC) && IS_ENABLED(CONFIG_MODULES)) + create_mapping((void *)MODULES_VADDR, (void *)(MODULES_END)); + create_mapping((void *)PKMAP_BASE, (void *)(PKMAP_BASE + PMD_SIZE)); /* * KAsan may reuse the contents of kasan_early_shadow_pte directly, so From patchwork Wed Oct 19 08:34: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: 5403 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp311782wrs; Wed, 19 Oct 2022 06:00:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4ufAIo/WjxEmUajkKF7FacjGQtNCP9eCk55912J3IaasuVMYCTPGlJrUPCKGNM1LMiia+P X-Received: by 2002:aa7:cdcb:0:b0:459:e3a6:2df9 with SMTP id h11-20020aa7cdcb000000b00459e3a62df9mr7353966edw.105.1666184455094; Wed, 19 Oct 2022 06:00:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666184455; cv=none; d=google.com; s=arc-20160816; b=cPN7X4dRqVWPdWpvYiYu9d5F7W4d/vT8a+fb2ypdO0xrpNWV11LL/tVwGIpg6Mo6Ua LUVDBwcnCGcftnG76qnDTQj0vwCy5oN6r2SBL5cy22+52tX2CTLBkd6/9swD3rRZ02Uw jn4FwtEO0iqDuvrfsV1Z+8+nEP4GSWzZuI//kEPFW71DDYIAOiVUdwSL44iaEav8aKWc 2aD0/c58eYH73bn83ksd7EicNETBco+CmabtZZh5WSl33phWW/IPAFDXN+jJbgaDjyb9 DhIUq9LX05cyIVHlDVWXLy92cC4hQaHojG43oADXtF7Csv754JbKL1vyr3atV4tGGa4u devw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Zm1RQ7ZeO+3TNCjzULgAkLZXWeTo1wN2lWPNPRAjYec=; b=oYGuraLJgKbeUVO7t/Ur7YbYQ/NEKMQZWN6mFkga0Bx9uv2r5XgQhkD2oyGDtFj0HL u1FTd6wrgPNBTE1lZXYx/MoTfhLbXJ1tnn3S7OR9HGlubqjSs4Xqi1peVBrFdQRiZSd1 0aasJpjHiR+1Qjhke1O8u8OK4xTgD0Te7JIXg5Tlr/VW0ICI+E7pO2l4CRiHVGy3HlOk X3KgIWQbVxfypJHQZRe0KUU7SoB4M9ezt52V7jZz25cKWmF848wUkkr71sc76/kc4yuL ZISqGPGY/d5V9ccnHS53TBGw7wmd3jGxIXVBZ7gZPO9GAqEWUxHYakdGenQWbmOGy90W MzEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QnhME8eu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bh11-20020a170906a0cb00b0078d1dc1b64csi11532364ejb.170.2022.10.19.06.00.25; Wed, 19 Oct 2022 06:00: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=QnhME8eu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233428AbiJSMuK (ORCPT + 99 others); Wed, 19 Oct 2022 08:50:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233604AbiJSMtM (ORCPT ); Wed, 19 Oct 2022 08:49: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 438D55208A; Wed, 19 Oct 2022 05:32:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8F175B824CC; Wed, 19 Oct 2022 09:13:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 06783C433D6; Wed, 19 Oct 2022 09:13:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170801; bh=JANyCe8JQE5s7goiFOxXvXCylmib8YtSbUs1+M+zqNI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QnhME8euICAOt7jauUz2PFKXNquKYWm2pliA5XDvald8fDnVgTRJA1VIohXQlnHb+ Uwr0ZYnDb5HAfYwTJAUXwa7lIGOBc/fNBiyyFqG+WwL55U6r06gJD5/1UA9rUxLhgX T2kCiHiHL8RowDCfyBrBpmCo//aoUiUBvcKeJIWQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ian Nam , Shubhrajyoti Datta , Michal Simek , Stephen Boyd , Sasha Levin Subject: [PATCH 6.0 792/862] clk: zynqmp: Fix stack-out-of-bounds in strncpy` Date: Wed, 19 Oct 2022 10:34:39 +0200 Message-Id: <20221019083324.910258537@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_FILL_THIS_FORM_SHORT autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747121030850443023?= X-GMAIL-MSGID: =?utf-8?q?1747121030850443023?= From: Ian Nam [ Upstream commit dd80fb2dbf1cd8751efbe4e53e54056f56a9b115 ] "BUG: KASAN: stack-out-of-bounds in strncpy+0x30/0x68" Linux-ATF interface is using 16 bytes of SMC payload. In case clock name is longer than 15 bytes, string terminated NULL character will not be received by Linux. Add explicit NULL character at last byte to fix issues when clock name is longer. This fixes below bug reported by KASAN: ================================================================== BUG: KASAN: stack-out-of-bounds in strncpy+0x30/0x68 Read of size 1 at addr ffff0008c89a7410 by task swapper/0/1 CPU: 1 PID: 1 Comm: swapper/0 Not tainted 5.4.0-00396-g81ef9e7-dirty #3 Hardware name: Xilinx Versal vck190 Eval board revA (QSPI) (DT) Call trace: dump_backtrace+0x0/0x1e8 show_stack+0x14/0x20 dump_stack+0xd4/0x108 print_address_description.isra.0+0xbc/0x37c __kasan_report+0x144/0x198 kasan_report+0xc/0x18 __asan_load1+0x5c/0x68 strncpy+0x30/0x68 zynqmp_clock_probe+0x238/0x7b8 platform_drv_probe+0x6c/0xc8 really_probe+0x14c/0x418 driver_probe_device+0x74/0x130 __device_attach_driver+0xc4/0xe8 bus_for_each_drv+0xec/0x150 __device_attach+0x160/0x1d8 device_initial_probe+0x10/0x18 bus_probe_device+0xe0/0xf0 device_add+0x528/0x950 of_device_add+0x5c/0x80 of_platform_device_create_pdata+0x120/0x168 of_platform_bus_create+0x244/0x4e0 of_platform_populate+0x50/0xe8 zynqmp_firmware_probe+0x370/0x3a8 platform_drv_probe+0x6c/0xc8 really_probe+0x14c/0x418 driver_probe_device+0x74/0x130 device_driver_attach+0x94/0xa0 __driver_attach+0x70/0x108 bus_for_each_dev+0xe4/0x158 driver_attach+0x30/0x40 bus_add_driver+0x21c/0x2b8 driver_register+0xbc/0x1d0 __platform_driver_register+0x7c/0x88 zynqmp_firmware_driver_init+0x1c/0x24 do_one_initcall+0xa4/0x234 kernel_init_freeable+0x1b0/0x24c kernel_init+0x10/0x110 ret_from_fork+0x10/0x18 The buggy address belongs to the page: page:ffff0008f9be1c88 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 raw: 0008d00000000000 ffff0008f9be1c90 ffff0008f9be1c90 0000000000000000 raw: 0000000000000000 0000000000000000 00000000ffffffff page dumped because: kasan: bad access detected addr ffff0008c89a7410 is located in stack of task swapper/0/1 at offset 112 in frame: zynqmp_clock_probe+0x0/0x7b8 this frame has 3 objects: [32, 44) 'response' [64, 80) 'ret_payload' [96, 112) 'name' Memory state around the buggy address: ffff0008c89a7300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff0008c89a7380: 00 00 00 00 f1 f1 f1 f1 00 04 f2 f2 00 00 f2 f2 >ffff0008c89a7400: 00 00 f3 f3 00 00 00 00 00 00 00 00 00 00 00 00 ^ ffff0008c89a7480: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff0008c89a7500: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ================================================================== Signed-off-by: Ian Nam Signed-off-by: Shubhrajyoti Datta Link: https://lore.kernel.org/r/20220510070154.29528-3-shubhrajyoti.datta@xilinx.com Acked-by: Michal Simek Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/zynqmp/clkc.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/clk/zynqmp/clkc.c b/drivers/clk/zynqmp/clkc.c index eb25303eefed..2c9da6623b84 100644 --- a/drivers/clk/zynqmp/clkc.c +++ b/drivers/clk/zynqmp/clkc.c @@ -710,6 +710,13 @@ static void zynqmp_get_clock_info(void) FIELD_PREP(CLK_ATTR_NODE_INDEX, i); zynqmp_pm_clock_get_name(clock[i].clk_id, &name); + + /* + * Terminate with NULL character in case name provided by firmware + * is longer and truncated due to size limit. + */ + name.name[sizeof(name.name) - 1] = '\0'; + if (!strcmp(name.name, RESERVED_CLK_NAME)) continue; strncpy(clock[i].clk_name, name.name, MAX_NAME_LEN); From patchwork Wed Oct 19 08:34: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: 5029 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp246468wrs; Wed, 19 Oct 2022 03:38:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5poSdDc15+/99BeW1UjLUceV/g3EdoEe233VIgFrE9IH5bcaiwpsm3cROgVXGa6wqaq9wx X-Received: by 2002:a17:906:cc0d:b0:78e:2c06:8e70 with SMTP id ml13-20020a170906cc0d00b0078e2c068e70mr5984350ejb.732.1666175897803; Wed, 19 Oct 2022 03:38:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666175897; cv=none; d=google.com; s=arc-20160816; b=tP2fp2FMVTkeRqoI6Ne2F7/WD+lqmgwY4IY/ggqbAghfAoEK4Gl+zUtkcC/uNlaG/6 T/uBPmanB+UiCEmN+ZlK6F/CdFTv9uPmGvhPy3fNRtdI+lUn0cNEwdA/QLUquGrbw2hS TfBuE3INoEilYdJoD7hfuLNge0c71pmNkfxJPTz4cItfXb9wLfjMBRp3R1Z/4lNXCaqs sG3plqG1MC7z6f48cBgZdq5lPgLAPBArBm7itSm9jFUIv9xKzNmzi7je4vaj1ORG7n6/ WK26JNgdPNbvDXh69v9yvQs+bsFnx/JawfLR+A7u8XCg8lkHbbZxRVo3HiVOQpUthqLy P/YA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=V79x5QVuo8Dh1jOJMhjkI2tEpNr7+uJ1KMJgO1fLzFo=; b=jgej9m5cKefX/q0d8lNtIgJD32UT7/OMBPjdjo0ySNCfZXaRTOqYpfr/ftSX6bwKDG ZunbtqK5geKH+X+9Yvk7NBiub5x05JYJmGh1HndoRDIZ9Z8/Zg6+eUqgDtK67VWhwHo1 DQuZi14NpM3CLlmmY3FklYSwKiB54DKyol1d1wYnXCOfgyQE/P4rOF//zrNhJQ5T0FuS G+rgVcIpXvn47Nb2+OP7sNCHYxeQUm2MrZqmNGP/QEiqXV+ABSVzpsA3fhrwdopGX8ky MCvYgbyOgahHVzn7Df6Lmon/KRAAEKCuDRtLw9u68/zJRpz2mDsA5ZI16TqdnC1noqRK z9Vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=g8+DaP1h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sc12-20020a1709078a0c00b0077fadd74307si15139967ejc.128.2022.10.19.03.37.52; Wed, 19 Oct 2022 03:38: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=g8+DaP1h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230162AbiJSKgy (ORCPT + 99 others); Wed, 19 Oct 2022 06:36:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230120AbiJSKgc (ORCPT ); Wed, 19 Oct 2022 06:36:32 -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 BD97DFF8C9; Wed, 19 Oct 2022 03:15:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 9C9ECCE21CB; Wed, 19 Oct 2022 09:13:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A61DC433C1; Wed, 19 Oct 2022 09:13:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170803; bh=u/bw0MPMS/QV/9IoNFCmnYBw0YZ8rHNhw+FhHjhGJJE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g8+DaP1h1twAwayRjjQbUPT7pZxig55sFkcmNDrmHgY53rOy1kKISkc6KcDlwYgHE mh14elmOHr99xYWfUyf4hS5gumchndc2oeXqX7dq2+acHvfQ0zczi5YkuhkP/dzabC QpPTeHZ/KaP+e10gU9cTs4/b4Jh/rDV4EQ3Ebj5A= 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 6.0 793/862] media: cx88: Fix a null-ptr-deref bug in buffer_prepare() Date: Wed, 19 Oct 2022 10:34:40 +0200 Message-Id: <20221019083324.959657054@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112058310885780?= X-GMAIL-MSGID: =?utf-8?q?1747112058310885780?= 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 a075788c64d4..469aeaa725ad 100644 --- a/drivers/media/pci/cx88/cx88-vbi.c +++ b/drivers/media/pci/cx88/cx88-vbi.c @@ -144,11 +144,10 @@ static int buffer_prepare(struct vb2_buffer *vb) return -EINVAL; vb2_set_plane_payload(vb, 0, size); - cx88_risc_buffer(dev->pci, &buf->risc, sgt->sgl, - 0, VBI_LINE_LENGTH * lines, - VBI_LINE_LENGTH, 0, - lines); - return 0; + return cx88_risc_buffer(dev->pci, &buf->risc, sgt->sgl, + 0, VBI_LINE_LENGTH * lines, + VBI_LINE_LENGTH, 0, + lines); } static void buffer_finish(struct vb2_buffer *vb) diff --git a/drivers/media/pci/cx88/cx88-video.c b/drivers/media/pci/cx88/cx88-video.c index d3729be89252..b509c2a03852 100644 --- a/drivers/media/pci/cx88/cx88-video.c +++ b/drivers/media/pci/cx88/cx88-video.c @@ -431,6 +431,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; @@ -445,35 +446,35 @@ static int buffer_prepare(struct vb2_buffer *vb) switch (core->field) { case V4L2_FIELD_TOP: - cx88_risc_buffer(dev->pci, &buf->risc, - sgt->sgl, 0, UNSET, - buf->bpl, 0, core->height); + ret = cx88_risc_buffer(dev->pci, &buf->risc, + sgt->sgl, 0, UNSET, + buf->bpl, 0, core->height); break; case V4L2_FIELD_BOTTOM: - cx88_risc_buffer(dev->pci, &buf->risc, - sgt->sgl, UNSET, 0, - buf->bpl, 0, core->height); + ret = cx88_risc_buffer(dev->pci, &buf->risc, + sgt->sgl, UNSET, 0, + buf->bpl, 0, core->height); break; case V4L2_FIELD_SEQ_TB: - cx88_risc_buffer(dev->pci, &buf->risc, - sgt->sgl, - 0, buf->bpl * (core->height >> 1), - buf->bpl, 0, - core->height >> 1); + ret = cx88_risc_buffer(dev->pci, &buf->risc, + sgt->sgl, + 0, buf->bpl * (core->height >> 1), + buf->bpl, 0, + core->height >> 1); break; case V4L2_FIELD_SEQ_BT: - cx88_risc_buffer(dev->pci, &buf->risc, - sgt->sgl, - buf->bpl * (core->height >> 1), 0, - buf->bpl, 0, - core->height >> 1); + ret = cx88_risc_buffer(dev->pci, &buf->risc, + sgt->sgl, + buf->bpl * (core->height >> 1), 0, + buf->bpl, 0, + core->height >> 1); break; case V4L2_FIELD_INTERLACED: default: - cx88_risc_buffer(dev->pci, &buf->risc, - sgt->sgl, 0, buf->bpl, - buf->bpl, buf->bpl, - core->height >> 1); + ret = cx88_risc_buffer(dev->pci, &buf->risc, + sgt->sgl, 0, buf->bpl, + buf->bpl, buf->bpl, + core->height >> 1); break; } dprintk(2, @@ -481,7 +482,7 @@ static int buffer_prepare(struct vb2_buffer *vb) buf, buf->vb.vb2_buf.index, __func__, core->width, core->height, dev->fmt->depth, dev->fmt->fourcc, (unsigned long)buf->risc.dma); - return 0; + return ret; } static void buffer_finish(struct vb2_buffer *vb) From patchwork Wed Oct 19 08:34: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: 4911 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225738wrs; Wed, 19 Oct 2022 02:43:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4jVux0PPu7NKudlOX1DAw88/TM9ZXuswqjNatgBM2ZPP01wk5gInAqmIbLq/IMAMPuaNyd X-Received: by 2002:a17:907:2c67:b0:78d:49d2:6297 with SMTP id ib7-20020a1709072c6700b0078d49d26297mr6105438ejc.21.1666172634591; Wed, 19 Oct 2022 02:43:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172634; cv=none; d=google.com; s=arc-20160816; b=GtjhnU1BSzx9PCmuBOT0ZfcvJLuloxUc4OIYyKsIDGAlsr0m6uBuWRrhlog0pjwpQw ytgEhxufoktCKUKXvVCiYkBEZbMVr0jpQfKzSfsDP4xX0LIsKOsFIeGEloMrD32FW2Ce WxN1NqxyhaC69DueA0Ficb/YKO/HR3+V+kRwzcsqfLWKwyOD29NwVFxl2xLmPZWReR+D RmVuXWtk1GVSUq/YylmaQy1CoFZVyq56zFJkYE2KhPoIP6WS6kkjG6mqFeZXgCZGIZOl vK9OmjLRpE7XuehsUDrTQeU1DT87wmXjtIz3BPqEl9caaecoozGL/psOf1UbQgWHKhaD DnjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ONzs0fVmve/S5ghcbzdDMuQ75IIJkGqSlNozVFCWB0E=; b=eI7Nne8o1AgvUX2VWwQCILEchymZahu9eJd9lJ3rYAx5VOai4rTmkoS8RVRcujFm1o CvPjhHC/867IX7zl53qPFr8sNwTPbwiMk0GbL/ZD/oXRwx6LDuhG3yVJf2sMf1yayOYA RKlgLHh1cPvU7dgLeMzRIRnSvd+IVKyCndyFjTsNLssHYzsX+9LBj23JpJ48QOhZ2tm7 ZyPf883DQzPPr36kBl/rIY7oadJCyzY60iYVkBf3zTWcrISkr+kVRVKBsh+yIPgK1wNF xp+4QuHsuN8FLXF+bRT42Lolu855hM5LkiJD9WmRUpKZlrod/O+DBVQ3VGqqW19bsOiN qPyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="ptPSu9/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 m12-20020a056402430c00b0045d050f0fa3si15210304edc.565.2022.10.19.02.43.23; Wed, 19 Oct 2022 02:43:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="ptPSu9/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 S233986AbiJSJga (ORCPT + 99 others); Wed, 19 Oct 2022 05:36:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233932AbiJSJ35 (ORCPT ); Wed, 19 Oct 2022 05:29:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25317ED9A1; Wed, 19 Oct 2022 02:13: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 22970617ED; Wed, 19 Oct 2022 09:13:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3309AC433C1; Wed, 19 Oct 2022 09:13:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170806; bh=YJbnZ0RTeY+t7PcY4eYKEecQAqN2QYIiIc5b5AmosT8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ptPSu9/rqSLrVFkZK/gest72IAu/J4FJMkiWleL3Kblw6U6DLUl5Pe2eJNCo/7Ahm paJow7SuQtX1CeBPBqboSe50qRCN6SQOIKeo45gbfsNSpQR6ABxQs7hx5QEZq9beje 8/lpXGsJqqTtbz5mEvcn9hIURMBf0C72fFaU83Pg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hangyu Hua , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 6.0 794/862] media: platform: fix some double free in meson-ge2d and mtk-jpeg and s5p-mfc Date: Wed, 19 Oct 2022 10:34:41 +0200 Message-Id: <20221019083324.999230687@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108636492328654?= X-GMAIL-MSGID: =?utf-8?q?1747108636492328654?= From: Hangyu Hua [ Upstream commit c65c3f3a2cbf21ed429d9b9c725bdb5dc6abf4cf ] video_unregister_device will release device internally. There is no need to call video_device_release after video_unregister_device. Signed-off-by: Hangyu Hua Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/amlogic/meson-ge2d/ge2d.c | 1 - drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c | 1 - drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c | 3 +-- 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/media/platform/amlogic/meson-ge2d/ge2d.c b/drivers/media/platform/amlogic/meson-ge2d/ge2d.c index 5e7b319f300d..142d421a8d76 100644 --- a/drivers/media/platform/amlogic/meson-ge2d/ge2d.c +++ b/drivers/media/platform/amlogic/meson-ge2d/ge2d.c @@ -1030,7 +1030,6 @@ static int ge2d_remove(struct platform_device *pdev) video_unregister_device(ge2d->vfd); v4l2_m2m_release(ge2d->m2m_dev); - video_device_release(ge2d->vfd); v4l2_device_unregister(&ge2d->v4l2_dev); clk_disable_unprepare(ge2d->clk); diff --git a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c index 87685a62a5c2..3071b61946c3 100644 --- a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c +++ b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c @@ -1414,7 +1414,6 @@ static int mtk_jpeg_remove(struct platform_device *pdev) pm_runtime_disable(&pdev->dev); video_unregister_device(jpeg->vdev); - video_device_release(jpeg->vdev); v4l2_m2m_release(jpeg->m2m_dev); v4l2_device_unregister(&jpeg->v4l2_dev); diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c index 761341934925..f85d1eebafac 100644 --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c @@ -1399,6 +1399,7 @@ static int s5p_mfc_probe(struct platform_device *pdev) /* Deinit MFC if probe had failed */ err_enc_reg: video_unregister_device(dev->vfd_dec); + dev->vfd_dec = NULL; err_dec_reg: video_device_release(dev->vfd_enc); err_enc_alloc: @@ -1444,8 +1445,6 @@ static int s5p_mfc_remove(struct platform_device *pdev) video_unregister_device(dev->vfd_enc); video_unregister_device(dev->vfd_dec); - video_device_release(dev->vfd_enc); - video_device_release(dev->vfd_dec); v4l2_device_unregister(&dev->v4l2_dev); s5p_mfc_unconfigure_dma_memory(dev); From patchwork Wed Oct 19 08:34: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: 4912 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225741wrs; Wed, 19 Oct 2022 02:43:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4nlXHKURu/nyXu1PwThZ1pdWjPCORgIfYvwPtr9cKD69yIed0z88BhEL7+C7xjaGuwg04p X-Received: by 2002:a05:6402:2402:b0:45c:a1ce:94d8 with SMTP id t2-20020a056402240200b0045ca1ce94d8mr6456226eda.50.1666172634926; Wed, 19 Oct 2022 02:43:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172634; cv=none; d=google.com; s=arc-20160816; b=BivinsA8CB2/G/XVTX2B41b+LyMjXsH/KAT5hds1tA18HxuOScYG85sVCWV10gGxLq GFqAXUK1rh8iNRtJUrheoLrbE4D8hXnTgdZZIns4pxroYQjk6BNAgk/3mtFbeonETMLK fvdTCm84VdtY9dPbEKF/52ffGEjYKfS5SyzAri7tL7mi3qIp1rnfw3Q7h0l7RFfJ1r81 oC8OYBsL6lVAaWkTihltG2lIXOiGc36QM6r00pqMWlsHBiiPrsowOC6HG5Pd3Niw0h2/ /cvCM3AEGJjeOYIRg3VwWE8d7RLX6SAksF0Xv5Eeh8eysbOmxF7Q0zcj+u1Dy7uX4KTR 67LA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8+G/2Du0XuxubuCfDN8v+J3rkn9TxxkYAp2SWkRg5gg=; b=ZFzixthM4Sz5QnCf/t9fgfB6X9m0qL1FdB+Kdkb4PynaCKwcuFx2EpWNCGkj0ZuoP4 2r7F9aWYi/0qfN+ooy3NY11KrmBIAsDdSmPyrF42gZxYTNbFYOUrQ1RrIJwrdIUC5w1P YuK8afb5kSYCyQbtiZLtHBAuZSM1+t9KOetecOmPh/bIlOtdWZs8hCDiO2nfl+7x2l8m KNSPH2mBU333ysAjhF50zKxowWqHBM29TaWOPQAd6XWXm6q8WTMpSzhNiaP9yRSTZgRe vFLZV5JEH+dApDU+jNQ29MnixCcjkp2D9BVTvepReDRKThEQ51aiTR7yCUN3p9uwoOrw k+bA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=c3e8DpSw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cs9-20020a170906dc8900b0078d4b88f122si15836474ejc.950.2022.10.19.02.43.23; Wed, 19 Oct 2022 02:43:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=c3e8DpSw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233989AbiJSJgf (ORCPT + 99 others); Wed, 19 Oct 2022 05:36:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233937AbiJSJ36 (ORCPT ); Wed, 19 Oct 2022 05:29:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6983D5F214; Wed, 19 Oct 2022 02:13: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 AC67C61802; Wed, 19 Oct 2022 09:13:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C0014C433C1; Wed, 19 Oct 2022 09:13:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170809; bh=GvZod3RFAjidyXSUoKZ273KLjuujQzygOSc6mBdthnY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c3e8DpSwxnNY2aAnxNQhhx+WsozOphGpPRu5SnptiLOElLXgXsQ2G58jpp0K9Onwo a6FcfZVrzYh6LzE1QnvO9t+G/ZR7tv8b3nT1r47xoyPHgvwhm6giiMTT1/vIevzoP9 lHggDTQ2hpPitg+1G7SrDYlKCmaw+WeflInCj/VE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Quanyang Wang , Shubhrajyoti Datta , Stephen Boyd , Sasha Levin Subject: [PATCH 6.0 795/862] clk: zynqmp: pll: rectify rate rounding in zynqmp_pll_round_rate Date: Wed, 19 Oct 2022 10:34:42 +0200 Message-Id: <20221019083325.037855009@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108637039255804?= X-GMAIL-MSGID: =?utf-8?q?1747108637039255804?= From: Quanyang Wang [ Upstream commit 30eaf02149ecc3c5815e45d27187bf09e925071d ] The function zynqmp_pll_round_rate is used to find a most appropriate PLL frequency which the hardware can generate according to the desired frequency. For example, if the desired frequency is 297MHz, considering the limited range from PS_PLL_VCO_MIN (1.5GHz) to PS_PLL_VCO_MAX (3.0GHz) of PLL, zynqmp_pll_round_rate should return 1.872GHz (297MHz * 5). There are two problems with the current code of zynqmp_pll_round_rate: 1) When the rate is below PS_PLL_VCO_MIN, it can't find a correct rate when the parameter "rate" is an integer multiple of *prate, in other words, if "f" is zero, zynqmp_pll_round_rate won't return a valid frequency which is from PS_PLL_VCO_MIN to PS_PLL_VCO_MAX. For example, *prate is 33MHz and the rate is 660MHz, zynqmp_pll_round_rate will not boost up rate and just return 660MHz, and this will cause clk_calc_new_rates failure since zynqmp_pll_round_rate returns an invalid rate out of its boundaries. 2) Even if the rate is higher than PS_PLL_VCO_MIN, there is still a risk that zynqmp_pll_round_rate returns an invalid rate because the function DIV_ROUND_CLOSEST makes some loss in the fractional part. If the parent clock *prate is 33333333Hz and we want to set the PLL rate to 1.5GHz, this function will return 1499999985Hz by using the formula below: value = *prate * DIV_ROUND_CLOSEST(rate, *prate)). This value is also invalid since it's slightly smaller than PS_PLL_VCO_MIN. because DIV_ROUND_CLOSEST makes some loss in the fractional part. Signed-off-by: Quanyang Wang Link: https://lore.kernel.org/r/20220826142030.213805-1-quanyang.wang@windriver.com Reviewed-by: Shubhrajyoti Datta Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/zynqmp/pll.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/drivers/clk/zynqmp/pll.c b/drivers/clk/zynqmp/pll.c index 91a6b4cc910e..0d3e1377b092 100644 --- a/drivers/clk/zynqmp/pll.c +++ b/drivers/clk/zynqmp/pll.c @@ -102,26 +102,25 @@ static long zynqmp_pll_round_rate(struct clk_hw *hw, unsigned long rate, unsigned long *prate) { u32 fbdiv; - long rate_div, f; + u32 mult, div; - /* Enable the fractional mode if needed */ - rate_div = (rate * FRAC_DIV) / *prate; - f = rate_div % FRAC_DIV; - if (f) { - if (rate > PS_PLL_VCO_MAX) { - fbdiv = rate / PS_PLL_VCO_MAX; - rate = rate / (fbdiv + 1); - } - if (rate < PS_PLL_VCO_MIN) { - fbdiv = DIV_ROUND_UP(PS_PLL_VCO_MIN, rate); - rate = rate * fbdiv; - } - return rate; + /* Let rate fall inside the range PS_PLL_VCO_MIN ~ PS_PLL_VCO_MAX */ + if (rate > PS_PLL_VCO_MAX) { + div = DIV_ROUND_UP(rate, PS_PLL_VCO_MAX); + rate = rate / div; + } + if (rate < PS_PLL_VCO_MIN) { + mult = DIV_ROUND_UP(PS_PLL_VCO_MIN, rate); + rate = rate * mult; } fbdiv = DIV_ROUND_CLOSEST(rate, *prate); - fbdiv = clamp_t(u32, fbdiv, PLL_FBDIV_MIN, PLL_FBDIV_MAX); - return *prate * fbdiv; + if (fbdiv < PLL_FBDIV_MIN || fbdiv > PLL_FBDIV_MAX) { + fbdiv = clamp_t(u32, fbdiv, PLL_FBDIV_MIN, PLL_FBDIV_MAX); + rate = *prate * fbdiv; + } + + return rate; } /** From patchwork Wed Oct 19 08:34: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: 5034 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp246701wrs; Wed, 19 Oct 2022 03:38:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7vhKcB3NkBSMR0YpJbVKvjukVVP9fLSPJgdYJ0o1GK37Q/qpkpTgEcn5tacuIDZ09H2sqy X-Received: by 2002:a05:6402:28a1:b0:458:81c0:a379 with SMTP id eg33-20020a05640228a100b0045881c0a379mr6755371edb.388.1666175938901; Wed, 19 Oct 2022 03:38:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666175938; cv=none; d=google.com; s=arc-20160816; b=T8NTaMioiLCiMClO77F3JIyTfg+QscSs1zkpjw9Kqod8sZ9AEB+KdwQtq+LSGYKOdI eO639j/BsiJl/QxAgDRRdkmCrd23jJmlEIHM3ae39uINgQy/TRjEjR2Gd7/O5S7WB0bi NXme/Fr3EjPWA+q09i/eh6UlPgS6m6GM+nFFmRXDqn8TVdQ8KtFJpP19zL2TqzevVtUr MFh4YOS68Kak2yxZZRunmEBWjW39ZpOWUg4i8+lwZog227mfDILywVU5tyAI2oMKgXNp 3FsHErhBc5uKJ9R0tKL2kSOmTUvNZoE3fkI6yKXVn+qt92D7ZscMr+mfIQbszF5BDdL0 LK9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VVJEl7cXTe6dk3PEnNNF8Y5iPjGXdngiZi7OT8KdzGo=; b=MoF3XMmNe8i7EF7MhlsQi1hurAANUR3LZnSnbHt4c2/9PtX15CE4cOo9Pw7dMKHyWT I6ll9JyrUky5ye6P8sxqUuXrjoVl7Rr8gGgiFLuoazZW9sFkr4Z1UmlUt3GKrspUKr9r Qv9jQigRY+CHQnhmKBoyRQyvgiGCH62ozAVYi9KFAbanxZ/FTQ3s+1yyZyzCi8i0DNLl HXvLGhKWbq4TydpoMWdTGKGcQVnNQyP7MtOWtRKVDGnbYsN6QhAxtfLcB/cctOY9/YXO gqQv4kQg8rCflh8IB/WXFBJlKfm6ZYHWbQSbnqagjEHwcz7xxsRqSbcrfvdsPI1EBDEZ +r2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1KkITEmO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g14-20020a1709065d0e00b0078219af8361si13228507ejt.883.2022.10.19.03.38.33; Wed, 19 Oct 2022 03:38: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=1KkITEmO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231163AbiJSKhl (ORCPT + 99 others); Wed, 19 Oct 2022 06:37:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231818AbiJSKg6 (ORCPT ); Wed, 19 Oct 2022 06:36:58 -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 DEE58F01B; Wed, 19 Oct 2022 03:15: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 sin.source.kernel.org (Postfix) with ESMTPS id 60429CE21B3; Wed, 19 Oct 2022 09:13:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E266C433C1; Wed, 19 Oct 2022 09:13:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170811; bh=2vttJVL/wGU2aeD9rhWr5CzNN4oH2sKTlJIu2eSZwmQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1KkITEmOv1iZFOs1p5SurGBmrFbRt6U4LM15r+l/FKUlS73G8qVTgpF9AM0Dz6B+P uE2lV5DggZiWt9+UR2kheqYIjryejgHDNVwJOMP23BW0HcVxZ5W+LorQWxVabjSrBZ JR2y5V6sLcVK1mZ2NCBc3gS4JHnR8dMCJHkQU6zE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daisuke Matsuda , Leon Romanovsky , Sasha Levin Subject: [PATCH 6.0 796/862] RDMA/rxe: Delete error messages triggered by incoming Read requests Date: Wed, 19 Oct 2022 10:34:43 +0200 Message-Id: <20221019083325.076112879@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112101207646312?= X-GMAIL-MSGID: =?utf-8?q?1747112101207646312?= From: Daisuke Matsuda [ Upstream commit 2c02249fcbfc066bd33e2a7375c7006d4cb367f6 ] An incoming Read request causes multiple Read responses. If a user MR to copy data from is unavailable or responder cannot send a reply, then the error messages can be printed for each response attempt, resulting in message overflow. Link: https://lore.kernel.org/r/20220829071218.1639065-1-matsuda-daisuke@fujitsu.com Signed-off-by: Daisuke Matsuda Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin --- drivers/infiniband/sw/rxe/rxe_resp.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c index b36ec5c4d5e0..7c336db5cb54 100644 --- a/drivers/infiniband/sw/rxe/rxe_resp.c +++ b/drivers/infiniband/sw/rxe/rxe_resp.c @@ -809,10 +809,8 @@ static enum resp_states read_reply(struct rxe_qp *qp, if (!skb) return RESPST_ERR_RNR; - err = rxe_mr_copy(mr, res->read.va, payload_addr(&ack_pkt), - payload, RXE_FROM_MR_OBJ); - if (err) - pr_err("Failed copying memory\n"); + rxe_mr_copy(mr, res->read.va, payload_addr(&ack_pkt), + payload, RXE_FROM_MR_OBJ); if (mr) rxe_put(mr); @@ -823,10 +821,8 @@ static enum resp_states read_reply(struct rxe_qp *qp, } err = rxe_xmit_packet(qp, &ack_pkt, skb); - if (err) { - pr_err("Failed sending RDMA reply.\n"); + if (err) return RESPST_ERR_RNR; - } res->read.va += payload; res->read.resid -= payload; From patchwork Wed Oct 19 08:34: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: 4950 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp226361wrs; Wed, 19 Oct 2022 02:45:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5lVdIK5QJssuQEV4sgsaTZUE+uH+0MhAMN25LMfQdw7TT/yfczW4lKKwe8eu5gOyRw4Nng X-Received: by 2002:a17:90a:354:b0:20a:6867:4a2b with SMTP id 20-20020a17090a035400b0020a68674a2bmr44367259pjf.157.1666172740069; Wed, 19 Oct 2022 02:45:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172740; cv=none; d=google.com; s=arc-20160816; b=WyVbepqcPW1JhHNYqbWN2+uJgS7jCvR/VAe55RFwWjEnJIkDQkpAZNIzuJlsno+8As zfKoeMouAeouTu1AJH/SWohtXNoDdNHrGz4twl9rwb6WnfiyGABmZimk23taPi3NXMGs 0J958OUbdPG/qqey0csF4wA632XvDNmV/Ct1HoJCFtGby0cRwcbA0BV53j4IPaLrm+OE Dgop66T5eno7DVdFzQXuc4EBUlgNArcvYvIR0nbeCpw96++VhgwRdaAAVKn7WyyAGIBG hNm2SDu3XWSzXfKdjdAkPhEU+TtBCIkcvGPpzyZU0pPBTeJGATxVL+fgPiIxZpooBQNw Wehw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=x0N2yxRtUT6+XAXdn0Z2VnXss3cMJQrlmvLLA4Fqsbw=; b=M9zm9AOx7cXFzCR6rhY0/GrvHcQYkNzYW9FzB8vieRZJE50wko72xYF6AB6lqWSdM9 t6G87Xuk21Wc0VdAAbierPT8SfnS2j9hcLM+ZaU+Tu0XkDWeMXpkrg+fTiqBjv64LwBr hoQv9ZUmlIAa7FZnmT7RsO2M4xSNKLNbpsQmLIt3xHvACZvVFKfGS511B+1hlcAjGBuY a67iJcdsHgOjIXZpm57ze6TjIr+Z/5rsG0fr5Woc80EXBON2SHc2FBd2eTlhklJBccOM oqpfX7TL89ZgVNVcNwVTkgz1gRazOr5lAk82viDSKjh9peWlOXgHW6ZsvBEAqizyok/2 NqLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OM4hNUIX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j65-20020a638b44000000b0046b2ebb0a4esi15341035pge.212.2022.10.19.02.45.21; Wed, 19 Oct 2022 02: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=OM4hNUIX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230098AbiJSJgr (ORCPT + 99 others); Wed, 19 Oct 2022 05:36:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233945AbiJSJ37 (ORCPT ); Wed, 19 Oct 2022 05:29: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 62EE5ED9A3; Wed, 19 Oct 2022 02:13:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C84CE6170D; Wed, 19 Oct 2022 09:13:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB13DC433C1; Wed, 19 Oct 2022 09:13:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170814; bh=COvMImI5EhtK7DDUN4rrlXlj6Olbp9bHPrM5fbNPEo8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OM4hNUIXnfQ6Pilf9Pkuc91P85yR96sSFtb1emQoIKcLPA1CNjmsflUjF1EYJx1J2 z6lXwmtrVb8ZQ6Lp6BSlnZXdH/KHFW5dztY9EByrz6yCrICaCbs1JnBwc/0EdurDEi fSm6HnEZulO+Gyi4d+zSS98O0bQLFFg0u9oas/aA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Fainelli , Justin Chen , Sasha Levin Subject: [PATCH 6.0 797/862] usb: host: xhci-plat: suspend and resume clocks Date: Wed, 19 Oct 2022 10:34:44 +0200 Message-Id: <20221019083325.121509847@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108746980837905?= X-GMAIL-MSGID: =?utf-8?q?1747108746980837905?= From: Justin Chen [ Upstream commit 8bd954c56197caf5e3a804d989094bc3fe6329aa ] Introduce XHCI_SUSPEND_RESUME_CLKS quirk as a means to suspend and resume clocks if the hardware is capable of doing so. We assume that clocks will be needed if the device may wake. Reviewed-by: Florian Fainelli Signed-off-by: Justin Chen Link: https://lore.kernel.org/r/1660170455-15781-2-git-send-email-justinpopo6@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/host/xhci-plat.c | 16 +++++++++++++++- drivers/usb/host/xhci.h | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index a8641b6536ee..ef10982ad482 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -437,7 +437,16 @@ static int __maybe_unused xhci_plat_suspend(struct device *dev) * xhci_suspend() needs `do_wakeup` to know whether host is allowed * to do wakeup during suspend. */ - return xhci_suspend(xhci, device_may_wakeup(dev)); + ret = xhci_suspend(xhci, device_may_wakeup(dev)); + if (ret) + return ret; + + if (!device_may_wakeup(dev) && (xhci->quirks & XHCI_SUSPEND_RESUME_CLKS)) { + clk_disable_unprepare(xhci->clk); + clk_disable_unprepare(xhci->reg_clk); + } + + return 0; } static int __maybe_unused xhci_plat_resume(struct device *dev) @@ -446,6 +455,11 @@ static int __maybe_unused xhci_plat_resume(struct device *dev) struct xhci_hcd *xhci = hcd_to_xhci(hcd); int ret; + if (!device_may_wakeup(dev) && (xhci->quirks & XHCI_SUSPEND_RESUME_CLKS)) { + clk_prepare_enable(xhci->clk); + clk_prepare_enable(xhci->reg_clk); + } + ret = xhci_priv_resume_quirk(hcd); if (ret) return ret; diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 7caa0db5e826..6dfbf73ee840 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -1899,6 +1899,7 @@ struct xhci_hcd { #define XHCI_NO_SOFT_RETRY BIT_ULL(40) #define XHCI_BROKEN_D3COLD BIT_ULL(41) #define XHCI_EP_CTX_BROKEN_DCS BIT_ULL(42) +#define XHCI_SUSPEND_RESUME_CLKS BIT_ULL(43) unsigned int num_active_eps; unsigned int limit_active_eps; From patchwork Wed Oct 19 08:34: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: 5020 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp245903wrs; Wed, 19 Oct 2022 03:36:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7n528+FaCqfeyIxF2eZAQIMpD5SJKrQNkfm2hMTlDxK1yx0n5lLMCtRTptiknTMJs8UMKi X-Received: by 2002:a17:907:6d18:b0:78e:259d:c391 with SMTP id sa24-20020a1709076d1800b0078e259dc391mr6167743ejc.615.1666175800305; Wed, 19 Oct 2022 03:36:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666175800; cv=none; d=google.com; s=arc-20160816; b=UQPpMPEB4WwQHdeGA3WjsJI0HJtGswkU8Yb0kb8EwPunMR5zPAtdThY8C5O13k3L9M JGuF+Yjb3jLycn6CDI/VlLNWOTKM9tRfBYmLAlJe+5PCyhOuLOmFJud9fffPm4SvOycl yVSy1foqtGyGQh/M/mX9pOXgSo7C1fRFxl8IAwVQx47B6dhq+P0iXsyAmVsapSCpNS2O zwkHzYlCZjcrmMtEJuc1oPWAlQ/HcczJWYahx6jdkuWSqgaDM9JmYdbdby8+KFhzB4RX gaGd3sz/HKCsqz4aiY/nJelQj1ZPge/nb2y9Zmwy0HmD6vaIyTHDOLMx7LEPRxG4xhGI CMTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=izjwTOmlbg5Yn4vW3i1r2UFyZ3cnTPLxTlGNLQ+qTRA=; b=kRDUVaWXWp2I3/iG3qWasH5mZ2ou+sAw5YMHWqoncomqS7KAYUXvXKXaCGKZu9sPlY dVI4wCfUsTIScFVXRh3O1LS4F6lnDkb/UefZfaByI39MmoLFDvUlKbK2sWwkDxkm8w9p Za4lnF21AsngbXsQq2uvyfu3Rwn3diZG8n4yOsKmY2EsHhoN7OuPcavuVV5QUNhk3ZAo N30a7Jv8lxGOTBiweFge8LhWoIJHUaUZpcm/3ct1Z66pdpJoVO13fe1SOtU4FD2bCX3A 2uhnzBkPfap7Fu7RiuQ4P3g7zQch5wW/4EJhelFmbjhxJuAnYahDQ7sXP3FJ1ZmHY2rV b4tA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=H5xrFcZn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x20-20020a170906441400b0078a00ad1e31si13151502ejo.687.2022.10.19.03.36.14; Wed, 19 Oct 2022 03:36: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=H5xrFcZn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230383AbiJSKZY (ORCPT + 99 others); Wed, 19 Oct 2022 06:25:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230370AbiJSKYm (ORCPT ); Wed, 19 Oct 2022 06:24: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 06446D57FF; Wed, 19 Oct 2022 03:04:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 77529617D6; Wed, 19 Oct 2022 09:13:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82329C433C1; Wed, 19 Oct 2022 09:13:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170816; bh=1TJHyyfg+QsA6U78R8mxqIahZXicXXqn1XHvFq8xnAo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H5xrFcZnm2Qy4qQ2wR8+Du7Atjx8ecqV0u1OAkLh4pdkSTnDWKFff/oN6a9v3lV/K SF6DlOZYko/RE1INgRcGz+F/orSwAIscH2pKN9vyoAAl3Z1ApryBemRb0CDxO/4cfh 9J7AyKqqewnincnZsj95nHYkEx3vJaa0aL5xEdTU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Fainelli , Justin Chen , Sasha Levin Subject: [PATCH 6.0 798/862] usb: host: xhci-plat: suspend/resume clks for brcm Date: Wed, 19 Oct 2022 10:34:45 +0200 Message-Id: <20221019083325.155292107@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747111955766987314?= X-GMAIL-MSGID: =?utf-8?q?1747111955766987314?= From: Justin Chen [ Upstream commit c69400b09e471a3f1167adead55a808f0da6534a ] The xhci_plat_brcm xhci block can enter suspend with clock disabled to save power and re-enable them on resume. Make use of the XHCI_SUSPEND_RESUME_CLKS quirk to do so. Reviewed-by: Florian Fainelli Signed-off-by: Justin Chen Link: https://lore.kernel.org/r/1660170455-15781-3-git-send-email-justinpopo6@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/host/xhci-plat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index ef10982ad482..5fb55bf19493 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -123,7 +123,7 @@ static const struct xhci_plat_priv xhci_plat_renesas_rcar_gen3 = { }; static const struct xhci_plat_priv xhci_plat_brcm = { - .quirks = XHCI_RESET_ON_RESUME, + .quirks = XHCI_RESET_ON_RESUME | XHCI_SUSPEND_RESUME_CLKS, }; static const struct of_device_id usb_xhci_of_match[] = { From patchwork Wed Oct 19 08:34: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: 5381 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp302651wrs; Wed, 19 Oct 2022 05:39:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5SN9OuVLHPGL4U2aU6cNVaZDsMW4HyjyCS+7sNnswqFGDfHgbLSD/hO42EOwr5/iI8qr5Z X-Received: by 2002:a17:902:e0d1:b0:182:6ab:98e3 with SMTP id e17-20020a170902e0d100b0018206ab98e3mr8301029pla.5.1666183158000; Wed, 19 Oct 2022 05:39:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666183157; cv=none; d=google.com; s=arc-20160816; b=A5Xt5j0yx7QSZgOuYZpyb2mL797Rm+WvbdXY0cHAeDIrf7svPhxix+Sfq33G4bN9+o lW8cnF6pCXZXTrd21TWfAAgWg5TO9tu3k1aVvgcoOAliK7Y/HKD2nXzBBcD85W1RoHkY oKBHJij36fQrmFbcQhFdvLxWjSA0Trg84iU0R9+XdSMJKGVpa8gaA4vTeTR+Ouuid9dG K/LLyhBNcQE7Sg6dbQveNB6fxjUqUI5oRuEnSKSSfwojxAn07M8T9F+x5z2UCPOfy4JT Mbay3v+d3SBv62MTBRp4nWcuW2SG7bTz/oxDGLfWo0uJo6LcCyMNwBgXWTBBxjy8R0cC J3FQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nP+zCCEqeSPA4JQWBDFyMAt0mF7WHKpjyGjdsDTE5gc=; b=cb+xkD29rZOzgAxOdMDutuWTTO2KsyIGIxTDiXSH8mfsZa976tQlVdkqRw4xVhkRbx QcKzuRXMEdfs3WQgCM5V21zAgUnCXn8ap5nknId0lMsiQks+08zH5YEKsu55mv93UcHp uwNKrGNE3PeV9av5TnoiM3Qg8AC7Lyy6SlAvfgHRF6B7oJbaEuPq/jgPC7VGIEnnsVa1 O3dA/rDqTD11LKkWJcoQTdcI+tEoLRB6QtMnA94Ile+ndTkinfEWjfhKWFcNZrjqbDRl 9bcThqfItpmM1jk9KkSID8gZKO2xzFLjlxAXrHG6pIVYAtc2yfqDk3LOJiz1xpvL+oc3 bNXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dxAI15kN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m21-20020a637d55000000b0045c39503df3si17588994pgn.451.2022.10.19.05.38.59; Wed, 19 Oct 2022 05:39: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=dxAI15kN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230037AbiJSMcB (ORCPT + 99 others); Wed, 19 Oct 2022 08:32:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231265AbiJSMbk (ORCPT ); Wed, 19 Oct 2022 08:31:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AFF44A803; Wed, 19 Oct 2022 05:09: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 1E41F617DE; Wed, 19 Oct 2022 09:13:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 23FA6C433C1; Wed, 19 Oct 2022 09:13:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170819; bh=ZFoYiT9y2/iVY1FbCrXKpOhrfl3lZzZKHp9H5oPiBIU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dxAI15kNBHcTff1TM8GBU3CoAtLYmSgp5D7UBVyKwb90kgHPNSMTAm0u4dO5toGMD 4YqbKkPXXPbgPRPUAwoJF7GApKCXY6zDNtV+g9/ErMjKbJowMiHFmQszSyzFIiRyhU 546EiygB7NEbi1CO+VB1eQkQfA9GRkNe0l8oN8tE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Justin Tee , James Smart , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 6.0 799/862] scsi: lpfc: Fix null ndlp ptr dereference in abnormal exit path for GFT_ID Date: Wed, 19 Oct 2022 10:34:46 +0200 Message-Id: <20221019083325.204708073@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747119671116518182?= X-GMAIL-MSGID: =?utf-8?q?1747119671116518182?= From: James Smart [ Upstream commit 59b7e210a522b836a01516c71ee85d1d92c1f075 ] An error case exit from lpfc_cmpl_ct_cmd_gft_id() results in a call to lpfc_nlp_put() with a null pointer to a nodelist structure. Changed lpfc_cmpl_ct_cmd_gft_id() to initialize nodelist pointer upon entry. Link: https://lore.kernel.org/r/20220819011736.14141-3-jsmart2021@gmail.com Co-developed-by: Justin Tee Signed-off-by: Justin Tee Signed-off-by: James Smart Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/lpfc/lpfc_ct.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c index 13dfe285493d..b555ccb5ae34 100644 --- a/drivers/scsi/lpfc/lpfc_ct.c +++ b/drivers/scsi/lpfc/lpfc_ct.c @@ -1509,7 +1509,7 @@ lpfc_cmpl_ct_cmd_gft_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, struct lpfc_sli_ct_request *CTrsp; int did; struct lpfc_nodelist *ndlp = NULL; - struct lpfc_nodelist *ns_ndlp = NULL; + struct lpfc_nodelist *ns_ndlp = cmdiocb->ndlp; uint32_t fc4_data_0, fc4_data_1; u32 ulp_status = get_job_ulpstatus(phba, rspiocb); u32 ulp_word4 = get_job_word4(phba, rspiocb); @@ -1522,15 +1522,12 @@ lpfc_cmpl_ct_cmd_gft_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, ulp_status, ulp_word4, did); /* Ignore response if link flipped after this request was made */ - if ((uint32_t) cmdiocb->event_tag != phba->fc_eventTag) { + if ((uint32_t)cmdiocb->event_tag != phba->fc_eventTag) { lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, "9046 Event tag mismatch. Ignoring NS rsp\n"); goto out; } - /* Preserve the nameserver node to release the reference. */ - ns_ndlp = cmdiocb->ndlp; - if (ulp_status == IOSTAT_SUCCESS) { /* Good status, continue checking */ CTrsp = (struct lpfc_sli_ct_request *)outp->virt; From patchwork Wed Oct 19 08:34: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: 4916 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225765wrs; Wed, 19 Oct 2022 02:43:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM57RKqhkxhiZnTICFL3HKHcOq/IGKiqJT6ixIHUv1VmRQVI7oi06AByV7I2sVimJnABPKy1 X-Received: by 2002:a05:6402:540d:b0:450:bda7:f76e with SMTP id ev13-20020a056402540d00b00450bda7f76emr6651549edb.249.1666172638927; Wed, 19 Oct 2022 02:43:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172638; cv=none; d=google.com; s=arc-20160816; b=fXsQ/9UFGA7YlZtAiz3y1xkkY0qZTzLNMEax67dgVNcDiUTFDoj+HL+oXQGFH6FIjd hX5aE8TH18LnzeQT3VS3Exh0rc4wWqqoUiEqgbHJ1MPYXTKR2oyDsJIXsAVl4/IakFez eo5LHcnsZQmYoFLE8L/lqlE5M1aqgyQrcbILRxkWxKsiWXixOxhnYZU+dF+5+6ChX9zO 4ZHgDfOrdhbkbA8nPmdSsrHuxhymVHCS37+h64q3ptVko1l/BOrpWaBiQ2e3fswwKCu1 5w7T3SSwlUWBOSJSbDXsXwJwS6wKdC5gOAE1Vmo7eA8BGmZGdqLhyEZ3oXgyUzm1L34v mHNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=iGWVMjzuvGo5lj1+uXc7eAKNp3H0ETUNtDk9fSJTgWk=; b=bzrGV3CjjLTfk46FOr1aiuy+RiV7DYljf4dnIPptBejqo9cUsEmJM+m2aQM3aFrc3k HSTru3iqH6ZE+pS5QWBtGYCgGC4njIyhLPxsSRzO7bJ1aSR01qVEPa8LNf9ltp3uu7zH QitJW1RoBZR7h02eipsE0I7OehXEJluSCTlss4BdfRygpE74aB1N3jDXHJvqsdM2DcSL TQ7T87HMUpT/5n5ri882azyqrFvdTBpbieZXvAKLwO9cvr2wgtz2OxC1njamqoZLCYMd l737kFhhCdnUYg+bJuDy0ExM+3rpWXHqy1A36eE/BcycdUKc8vo4dd+2Vx5oAfBVLbO0 wSWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="ukS8nKH/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oz42-20020a1709077daa00b0077ed84da316si15085978ejc.217.2022.10.19.02.43.27; Wed, 19 Oct 2022 02:43: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="ukS8nKH/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233925AbiJSJgm (ORCPT + 99 others); Wed, 19 Oct 2022 05:36:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233936AbiJSJ36 (ORCPT ); Wed, 19 Oct 2022 05:29:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98A85EE09F; Wed, 19 Oct 2022 02:13: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 dfw.source.kernel.org (Postfix) with ESMTPS id 4C20E61777; Wed, 19 Oct 2022 09:13:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E63CC433D6; Wed, 19 Oct 2022 09:13:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170824; bh=M+GQYKj7W9Q9eqQVTrqZvdk+oerpuJZZbVXvQ6MtdVg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ukS8nKH/eCJw5UnNzHLR9SGPCCzX2M+mWfu3hrQ8BcRhHk/XMjRSwDutPAlZl+UCD XQWQuWmWfELIGLOIsDMSjkoqQFh5eOKpwR/t1HQOytbK/ebs8gfZy3ADxA5cJgtqWZ +0wDTFru+P8CZT5BAwtvcPyeUlsoHOYcp7Jl08PU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vaishnav Achath , Peter Ujfalusi , Vinod Koul , Sasha Levin Subject: [PATCH 6.0 800/862] dmaengine: ti: k3-udma: Reset UDMA_CHAN_RT byte counters to prevent overflow Date: Wed, 19 Oct 2022 10:34:47 +0200 Message-Id: <20221019083325.251182323@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108641167604681?= X-GMAIL-MSGID: =?utf-8?q?1747108641167604681?= From: Vaishnav Achath [ Upstream commit 7c94dcfa8fcff2dba53915f1dabfee49a3df8b88 ] UDMA_CHAN_RT_*BCNT_REG stores the real-time channel bytecount statistics. These registers are 32-bit hardware counters and the driver uses these counters to monitor the operational progress status for a channel, when transferring more than 4GB of data it was observed that these counters overflow and completion calculation of a operation gets affected and the transfer hangs indefinitely. This commit adds changes to decrease the byte count for every complete transaction so that these registers never overflow and the proper byte count statistics is maintained for ongoing transaction by the RT counters. Earlier uc->bcnt used to maintain a count of the completed bytes at driver side, since the RT counters maintain the statistics of current transaction now, the maintenance of uc->bcnt is not necessary. Signed-off-by: Vaishnav Achath Acked-by: Peter Ujfalusi Link: https://lore.kernel.org/r/20220802054835.19482-1-vaishnav.a@ti.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/ti/k3-udma.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c index 2f0d2c68c93c..fcfcde947b30 100644 --- a/drivers/dma/ti/k3-udma.c +++ b/drivers/dma/ti/k3-udma.c @@ -300,8 +300,6 @@ struct udma_chan { struct udma_tx_drain tx_drain; - u32 bcnt; /* number of bytes completed since the start of the channel */ - /* Channel configuration parameters */ struct udma_chan_config config; @@ -757,6 +755,20 @@ static void udma_reset_rings(struct udma_chan *uc) } } +static void udma_decrement_byte_counters(struct udma_chan *uc, u32 val) +{ + if (uc->desc->dir == DMA_DEV_TO_MEM) { + udma_rchanrt_write(uc, UDMA_CHAN_RT_BCNT_REG, val); + udma_rchanrt_write(uc, UDMA_CHAN_RT_SBCNT_REG, val); + udma_rchanrt_write(uc, UDMA_CHAN_RT_PEER_BCNT_REG, val); + } else { + udma_tchanrt_write(uc, UDMA_CHAN_RT_BCNT_REG, val); + udma_tchanrt_write(uc, UDMA_CHAN_RT_SBCNT_REG, val); + if (!uc->bchan) + udma_tchanrt_write(uc, UDMA_CHAN_RT_PEER_BCNT_REG, val); + } +} + static void udma_reset_counters(struct udma_chan *uc) { u32 val; @@ -790,8 +802,6 @@ static void udma_reset_counters(struct udma_chan *uc) val = udma_rchanrt_read(uc, UDMA_CHAN_RT_PEER_BCNT_REG); udma_rchanrt_write(uc, UDMA_CHAN_RT_PEER_BCNT_REG, val); } - - uc->bcnt = 0; } static int udma_reset_chan(struct udma_chan *uc, bool hard) @@ -1115,7 +1125,7 @@ static void udma_check_tx_completion(struct work_struct *work) if (uc->desc) { struct udma_desc *d = uc->desc; - uc->bcnt += d->residue; + udma_decrement_byte_counters(uc, d->residue); udma_start(uc); vchan_cookie_complete(&d->vd); break; @@ -1168,7 +1178,7 @@ static irqreturn_t udma_ring_irq_handler(int irq, void *data) vchan_cyclic_callback(&d->vd); } else { if (udma_is_desc_really_done(uc, d)) { - uc->bcnt += d->residue; + udma_decrement_byte_counters(uc, d->residue); udma_start(uc); vchan_cookie_complete(&d->vd); } else { @@ -1204,7 +1214,7 @@ static irqreturn_t udma_udma_irq_handler(int irq, void *data) vchan_cyclic_callback(&d->vd); } else { /* TODO: figure out the real amount of data */ - uc->bcnt += d->residue; + udma_decrement_byte_counters(uc, d->residue); udma_start(uc); vchan_cookie_complete(&d->vd); } @@ -3809,7 +3819,6 @@ static enum dma_status udma_tx_status(struct dma_chan *chan, bcnt = udma_tchanrt_read(uc, UDMA_CHAN_RT_BCNT_REG); } - bcnt -= uc->bcnt; if (bcnt && !(bcnt % uc->desc->residue)) residue = 0; else From patchwork Wed Oct 19 08:34: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: 5025 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp246337wrs; Wed, 19 Oct 2022 03:37:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5w62+FZdLQ9M1PwlZ2hMsC7pvFL3p+P26vUojA//iq/MZS76BdRKKHr9ktmtJQ3RCxTAvs X-Received: by 2002:a05:6402:3547:b0:45d:1578:9424 with SMTP id f7-20020a056402354700b0045d15789424mr6622532edd.281.1666175879140; Wed, 19 Oct 2022 03:37:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666175879; cv=none; d=google.com; s=arc-20160816; b=cb7fKjzRClFrjGAhN4IchVxLbVUGxHgVK3SPO0cp1djeK9sIgyJSAeXsLFvCTG1/in dDddnis/iCXWZVrVvopUbNMEI6Uh1VDsKEFUZsLeP1LKMD7tpzkxhXnOzQ9CM1RbQNB8 gXz8G2rMkQz2Sr8qQfdTKsDTOoRIBsU4niu8+2eLVompBCwSe2sSI7O5QnupUWq4wTry azcEbcCHDzq+es8LRsPWkEGVoE9QvHeecqnlCu2Ptkn6sYe23ktl5uAA9qDnFA/9YG1/ 7rTvPDSnBMrdLgnsN6MZFm10mIGEK+vHe7/6KXjaaB8PZzYA4IESxZuZbQ2xgOoj0CWV V2gQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NyFvXrgHPwpCuFHn+Gg/htzby8c/N8ygfLM+53TiBfo=; b=zEsmf/kPdrbqAyFk/bp0hesyDMGDERsfZ7DOQ7mFVqNFXy3c+yVFy6LX8eQEqDQdzE 0mpIqLw2+PsGk2FXLSG9xpHYA3fE27nSTveSwT84n4ZobQkup7KuQ97Bf7L/+3Y+2quv FUHK5+KGAMt7QKtv+m3gpaufv0OEcq4mN0LDXBNq/Q3FVoWSiHHyx8iGu+SmmtIAWfoI GpMCPFSXkPdSHUP8bpWKkB/p4rNP1lgzAogKGJLoUYj/3FaZGyOFah8TIFYmbD1NTUsN xzFVMOercv/rtFWPsKsincJD391jnvb8anAT3hPJ1uF+FQiKKqihJdILbvmxJvBLiWcd kLMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Z7N2ATsQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nb36-20020a1709071ca400b0078cba073ec3si15140605ejc.734.2022.10.19.03.37.34; Wed, 19 Oct 2022 03:37: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=Z7N2ATsQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230220AbiJSKfb (ORCPT + 99 others); Wed, 19 Oct 2022 06:35:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229994AbiJSKdv (ORCPT ); Wed, 19 Oct 2022 06:33:51 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAD85FC1F7; Wed, 19 Oct 2022 03:12: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 sin.source.kernel.org (Postfix) with ESMTPS id E9CE8CE21B8; Wed, 19 Oct 2022 09:13:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E64D7C433D7; Wed, 19 Oct 2022 09:13:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170827; bh=Es5nmzJdT+oW3VwkRSQOa1PJ6ac1UPOFRjBXyXVSk/o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z7N2ATsQ+4ddQXpbFSIsouTFiPPbE3AX/HAllpgov+NbVgoDL2C78GqzByjtXfUJL tVlxABd8x/jdaFAccYYZME7ET6waLx+k0KeQ//p0XzpTp7/1Gxi9ftEyIhzZ9STmMP QzNfdCn1CWhFnk8Qi/xqe1RcVsn97IBgFvNaVqlM= 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 6.0 801/862] scsi: 3w-9xxx: Avoid disabling device if failing to enable it Date: Wed, 19 Oct 2022 10:34:48 +0200 Message-Id: <20221019083325.291693919@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112038549992467?= X-GMAIL-MSGID: =?utf-8?q?1747112038549992467?= 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 cd823ff5deab..6cb9cca9565b 100644 --- a/drivers/scsi/3w-9xxx.c +++ b/drivers/scsi/3w-9xxx.c @@ -2006,7 +2006,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 Wed Oct 19 08:34: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: 5400 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp311529wrs; Wed, 19 Oct 2022 06:00:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6PvPFTDb+kxcYVRlbhZQ46wse/XfoPQ6sOJnKHklkArNp67ORo9tYjDJMSMIXjcQdiLAhD X-Received: by 2002:a17:907:86a2:b0:791:910e:cce4 with SMTP id qa34-20020a17090786a200b00791910ecce4mr6738536ejc.36.1666184437120; Wed, 19 Oct 2022 06:00:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666184437; cv=none; d=google.com; s=arc-20160816; b=FtC4vS6cH0wdLq/Wa6ixn2ZCwpRbB3YMC6Lh5ICYFMAw5nXvDKLm63amajNoyzC4Z0 nIXmZ5EPevnQmfwfEMY/v1DJymn6VryvwhlK/YCaC4CuBdZK7P09ycTl5gn3GKWpBdLp subYM9qsMeiemlKE7zNz59MGjTbXRmml2UNfJe7yLipsostQzCiIQy0d1sbU75JOhWdo Fk1YStvgj9oLoXRK+APIrQ/j+29W7hNXSaXi2I6/hRpnBuGo0U3PcKOI1o/0/JTppoUL iKab/GDwu9qAXrNNe4GF6zR+g3OU7xNcC61I4RA9hoCu5Zr5scNJFM9aOB5FOoEhbLaF FuAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=p54ADDVh5NcNNDQGbTmRAKIyX06WfmXCCnbKmt+8dpE=; b=iM60P+GNOY7w8pHYh4DzAuiTSusJPGZ4WHR8pdpeReQN9P6RHsZs8Si8Gippguhovq EytKl8gG+O7g4I6lzqu7S7aVBpLPBS1GQN+bYMA8p78/HApR6WeArrrd6LJpwIG59kc6 Y3RzxucA/n5lwuhza+9r28xOWgfjQWFZTYDynCUxX5awCrcjh0fWPpOLpkwdh5Oi2VuR qN5d7JvUmeRX+zSkvVfbcZuakbSKFnlEHlZGh0Y0qAg+71/LQ4Wvku4EDJ7O8WPgg2z1 OE6e87aOAibpVzuQPfU3Ktc1MolU0/XH8vI6zRBR+0BqeHceuwk8ct9N36+xn1BZrTKf P/vQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YNBSrzie; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020aa7c690000000b00459ad2b4a4esi12029740edq.188.2022.10.19.06.00.09; Wed, 19 Oct 2022 06:00: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=YNBSrzie; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233282AbiJSMtc (ORCPT + 99 others); Wed, 19 Oct 2022 08:49:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233244AbiJSMsz (ORCPT ); Wed, 19 Oct 2022 08:48:55 -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 826B21958E2; Wed, 19 Oct 2022 05:31: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 sin.source.kernel.org (Postfix) with ESMTPS id 7D9ECCE21C6; Wed, 19 Oct 2022 09:13:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 959ADC433D6; Wed, 19 Oct 2022 09:13:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170829; bh=fvegeJIp2wdais0tigzcD56CJARkRkzBSW+xsY1dQP0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YNBSrzieqaFbScQPGVbk3bN4AXSkDNMAkcJhgQ5jEXLN9X50BH8JihQ+aZtJlZfis G5Pv2M5gBmtXMa32KxqFnsb4+aIFzG9uUZftMh21KaWAvaCwrXK+OMshgSV/lS7+gl yoo2ALJek4n1ImuC2j22XT3kKi4P7OD6i8Yg+fXY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+38e6c55d4969a14c1534@syzkaller.appspotmail.com, Shigeru Yoshida , Josef Bacik , Jens Axboe , Sasha Levin Subject: [PATCH 6.0 802/862] nbd: Fix hung when signal interrupts nbd_start_device_ioctl() Date: Wed, 19 Oct 2022 10:34:49 +0200 Message-Id: <20221019083325.341406137@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747121012085945344?= X-GMAIL-MSGID: =?utf-8?q?1747121012085945344?= From: Shigeru Yoshida [ Upstream commit 1de7c3cf48fc41cd95adb12bd1ea9033a917798a ] syzbot reported hung task [1]. The following program is a simplified version of the reproducer: int main(void) { int sv[2], fd; if (socketpair(AF_UNIX, SOCK_STREAM, 0, sv) < 0) return 1; if ((fd = open("/dev/nbd0", 0)) < 0) return 1; if (ioctl(fd, NBD_SET_SIZE_BLOCKS, 0x81) < 0) return 1; if (ioctl(fd, NBD_SET_SOCK, sv[0]) < 0) return 1; if (ioctl(fd, NBD_DO_IT) < 0) return 1; return 0; } When signal interrupt nbd_start_device_ioctl() waiting the condition atomic_read(&config->recv_threads) == 0, the task can hung because it waits the completion of the inflight IOs. This patch fixes the issue by clearing queue, not just shutdown, when signal interrupt nbd_start_device_ioctl(). Link: https://syzkaller.appspot.com/bug?id=7d89a3ffacd2b83fdd39549bc4d8e0a89ef21239 [1] Reported-by: syzbot+38e6c55d4969a14c1534@syzkaller.appspotmail.com Signed-off-by: Shigeru Yoshida Reviewed-by: Josef Bacik Link: https://lore.kernel.org/r/20220907163502.577561-1-syoshida@redhat.com Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- drivers/block/nbd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 2a709daefbc4..2a2a1d996a57 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -1413,10 +1413,12 @@ static int nbd_start_device_ioctl(struct nbd_device *nbd) mutex_unlock(&nbd->config_lock); ret = wait_event_interruptible(config->recv_wq, atomic_read(&config->recv_threads) == 0); - if (ret) + if (ret) { sock_shutdown(nbd); - flush_workqueue(nbd->recv_workq); + nbd_clear_que(nbd); + } + flush_workqueue(nbd->recv_workq); mutex_lock(&nbd->config_lock); nbd_bdev_reset(nbd); /* user requested, ignore socket errors */ From patchwork Wed Oct 19 08:34: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: 5382 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp302831wrs; Wed, 19 Oct 2022 05:39:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6ltuP7coXxX7STMtUETn4zt8mi6g5bUb0eowI2BuHBiRIMh6FPT9yUFXs3WMUFPcUgkW3x X-Received: by 2002:a17:903:2cb:b0:171:4f0d:beb6 with SMTP id s11-20020a17090302cb00b001714f0dbeb6mr7977176plk.53.1666183183834; Wed, 19 Oct 2022 05:39:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666183183; cv=none; d=google.com; s=arc-20160816; b=IZOMM/v3vKi1JnKMOkjpnxfIfrnzH6IOnF2TOX+HgyI5ffggZdDjuDmWUIV+M9Ds38 TF4hjTonJ8ZGnxZgUGOXwBaYqhNTKv25QrCJ/Oh+jQGKg+s2PzcFZS6xIMKUFVH+bZpp 9BXn6AIqLKMurx97wlgPu6SrWINQMMMfqjVQpZFH189lzESQN4bzs984cdxT3I92btGR 9llWL0bFCZC9YbPTu8gyFw4sfk3tIpCTlkj8ULK6CSdY0wYRwXZsWeaDTQXtbwxX98vl outl+xHhwKdZ4pcCs3maECdU0sh1Jd8ocndDlDA636TQs/tYhlVv0eti0Y849IKxzQ3y 2f8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9SN1NInlw5cURKLB1Xm4/2Qd/V2JxM7kpSqXIry9Rnw=; b=dfSwrxKzVIId76HwZ42hY1kC/DnpUw0+jVP98ZWUhhAk7dbUNHjEwv29xysDBCt86l gS8C1toaroFLf8lUbO1enj3cEMrK2n6i1Lvy3msREN6zpjUgLVOyo8bHXrrKHdIOipq2 ZE+WKnsxDgLnC57zfyxee6dE/fo+VcCH9mEN8FvWtqlrRGk5D6zAGY1N1+gbK8YK6WGr Sj3/eBtbiWUwm8p5zQH1agh1xGXEqUxTm97wIT3VgPnXRX/Uhy+mcFkwFTXBUvzWDTBQ PzCRsvriovnyN5fww+ntLJC5ZBldOnFoFrE7Ilj6uzNwjQMJ3cdEjqEtjgfUhbnnTu6K Uljw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mbzTYI5e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t14-20020aa7938e000000b005668f9d64e7si15841813pfe.172.2022.10.19.05.39.26; Wed, 19 Oct 2022 05:39: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=mbzTYI5e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231451AbiJSMc7 (ORCPT + 99 others); Wed, 19 Oct 2022 08:32:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232996AbiJSMcn (ORCPT ); Wed, 19 Oct 2022 08:32: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 A9A31349A8; Wed, 19 Oct 2022 05:11:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 183BE6170D; Wed, 19 Oct 2022 09:13:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30C73C433D6; Wed, 19 Oct 2022 09:13:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170832; bh=XBFpSNBpsvsC+odxjmIBVDNq5cxpXJDA1q+v7F0LK8s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mbzTYI5eaxQK9bgbAO49XJBt/DOeyYb0lsGyPRBoBFRBhbj1zqkB2k1EKR9FI3bPf 87a3ZVnE/skahXrUJbpax3H/A3ua2vYhHt6IRdJGBweH+nDztg7wcwMXHFGVZEDm+l yJ6zR1ZFgfdWqrhi/UXJsQBlOorVtBcZuZjF0ii0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Will Deacon , Yicong Yang , John Garry , Mathieu Poirier , Sasha Levin Subject: [PATCH 6.0 803/862] iommu/arm-smmu-v3: Make default domain type of HiSilicon PTT device to identity Date: Wed, 19 Oct 2022 10:34:50 +0200 Message-Id: <20221019083325.382550833@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747119697713617549?= X-GMAIL-MSGID: =?utf-8?q?1747119697713617549?= From: Yicong Yang [ Upstream commit 24b6c7798a0122012ca848ea0d25e973334266b0 ] The DMA operations of HiSilicon PTT device can only work properly with identical mappings. So add a quirk for the device to force the domain as passthrough. Acked-by: Will Deacon Signed-off-by: Yicong Yang Reviewed-by: John Garry Link: https://lore.kernel.org/r/20220816114414.4092-2-yangyicong@huawei.com Signed-off-by: Mathieu Poirier Signed-off-by: Sasha Levin --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c index d32b02336411..71f7edded9cf 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c @@ -2817,6 +2817,26 @@ static int arm_smmu_dev_disable_feature(struct device *dev, } } +/* + * HiSilicon PCIe tune and trace device can be used to trace TLP headers on the + * PCIe link and save the data to memory by DMA. The hardware is restricted to + * use identity mapping only. + */ +#define IS_HISI_PTT_DEVICE(pdev) ((pdev)->vendor == PCI_VENDOR_ID_HUAWEI && \ + (pdev)->device == 0xa12e) + +static int arm_smmu_def_domain_type(struct device *dev) +{ + if (dev_is_pci(dev)) { + struct pci_dev *pdev = to_pci_dev(dev); + + if (IS_HISI_PTT_DEVICE(pdev)) + return IOMMU_DOMAIN_IDENTITY; + } + + return 0; +} + static struct iommu_ops arm_smmu_ops = { .capable = arm_smmu_capable, .domain_alloc = arm_smmu_domain_alloc, @@ -2831,6 +2851,7 @@ static struct iommu_ops arm_smmu_ops = { .sva_unbind = arm_smmu_sva_unbind, .sva_get_pasid = arm_smmu_sva_get_pasid, .page_response = arm_smmu_page_response, + .def_domain_type = arm_smmu_def_domain_type, .pgsize_bitmap = -1UL, /* Restricted during device attach */ .owner = THIS_MODULE, .default_domain_ops = &(const struct iommu_domain_ops) { From patchwork Wed Oct 19 08:34: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: 4921 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225823wrs; Wed, 19 Oct 2022 02:44:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4POF1+s5cSIOprkTweLPJEMXVqC474LBcpo30PL7UfwNrzO4rP223GvusfybgeVuA4vQNt X-Received: by 2002:a17:902:8505:b0:181:e55d:2b3 with SMTP id bj5-20020a170902850500b00181e55d02b3mr7434343plb.75.1666172647569; Wed, 19 Oct 2022 02:44:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172647; cv=none; d=google.com; s=arc-20160816; b=ILk1Do1XWZ5neHCHMUgEZtVxEehuXlKRV/VMz30rWpTf7Ri3KPOsYZGCoB0bWVBM4F 41WudqA96+GI74Cc9AzMcDoqWU5ElQ2ZOJsoYC/JJl2SBQfMdJfoZieE7B4Kj+LgMxWg jkwiKIArVU8m70efI+9V8e3yNftJyYezaTc4Te/NG1b+ht+lW1GtdhtDgEbuyS9mw0jc xpHhcD1vo2gvEcxAIXQ3gpPaecohs+6xawwqejSK/AI1ksy6gQ6Qk3da/t41HNPfHyKN GfMnUKCpXbJXG81PM/F6QgA7hTCt02mF8oqug2DYoDA3bPeqbDMBvLKHDXLMqUhhX7P4 AbsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=n0E7RCyo5gwJf8JdydLgA0GE6aibESPVwZUZVA7t2tE=; b=vTb5U7ie8IuN5H2WC/pMEtK14b7+a+V2Uo7+kBvE9XyxYHQjisZ5MNYgZi03DwT1jd tKLUlcI1dUSxKNxDzorZ7coNzMgzFQm/27/KsmGUSAmO/pRz4jSggCa5sg9lJ5rUmROd RAy4dTfaibZANlk0gu4CnCl8taG+CcjkJd4f3aG1KOqzAaYeCoHvm9sanbP1Ep0GxSf8 TCxu9EHGniti7ph1r0BZlSSqv+qg5eFRHbfHPU9YRd0QDk6611zuLdWh29nVwhn1pz8W fzlVW7kRsDI1ruktuD8oad5Zbyxao14/ZKmeLgLlz2zXxhuI6FYiJj2202OJn2OTorOK Yj/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AYcKYqYE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m10-20020a638c0a000000b0045650af278bsi22342019pgd.817.2022.10.19.02.43.50; Wed, 19 Oct 2022 02:44: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=AYcKYqYE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233775AbiJSJhS (ORCPT + 99 others); Wed, 19 Oct 2022 05:37:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234042AbiJSJa0 (ORCPT ); Wed, 19 Oct 2022 05:30:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CD8AC696B; Wed, 19 Oct 2022 02:13:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B0ED6617D7; Wed, 19 Oct 2022 09:13:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C4998C433C1; Wed, 19 Oct 2022 09:13:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170835; bh=ZLE1CSNMbyO4wlg97VRaWaPwROidpEs6zu78zaQFPic=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AYcKYqYEsXSz2vxSjli04zr5YSf5t/Nf0SaKEpwNwifV5GII+snLu3uNLAoGYoTIS cITRNHuYbP4IYgWoPIMoxF5AMZeVsjmr2F9ysDbmaomtqgYPwzmlcOwdrXC5pQGNep dCBEzTPscb3fFNbiJ9u9zKPDSIrmeFQKzfjtoEFU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Grzeschik , Sasha Levin Subject: [PATCH 6.0 804/862] usb: gadget: uvc: increase worker prio to WQ_HIGHPRI Date: Wed, 19 Oct 2022 10:34:51 +0200 Message-Id: <20221019083325.432273431@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108650456088685?= X-GMAIL-MSGID: =?utf-8?q?1747108650456088685?= From: Michael Grzeschik [ Upstream commit 9b91a65230784a9ef644b8bdbb82a79ba4ae9456 ] This patch is changing the simple workqueue in the gadget driver to be allocated as async_wq with a higher priority. The pump worker, that is filling the usb requests, will have a higher priority and will not be scheduled away so often while the video stream is handled. This will lead to fewer streaming underruns. Signed-off-by: Michael Grzeschik Link: https://lore.kernel.org/r/20220907215818.2670097-1-m.grzeschik@pengutronix.de Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/gadget/function/f_uvc.c | 4 ++++ drivers/usb/gadget/function/uvc.h | 1 + drivers/usb/gadget/function/uvc_v4l2.c | 2 +- drivers/usb/gadget/function/uvc_video.c | 9 +++++++-- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c index 86bb0098fb66..7ec223849d94 100644 --- a/drivers/usb/gadget/function/f_uvc.c +++ b/drivers/usb/gadget/function/f_uvc.c @@ -897,10 +897,14 @@ static void uvc_function_unbind(struct usb_configuration *c, { struct usb_composite_dev *cdev = c->cdev; struct uvc_device *uvc = to_uvc(f); + struct uvc_video *video = &uvc->video; long wait_ret = 1; uvcg_info(f, "%s()\n", __func__); + if (video->async_wq) + destroy_workqueue(video->async_wq); + /* * If we know we're connected via v4l2, then there should be a cleanup * of the device from userspace either via UVC_EVENT_DISCONNECT or diff --git a/drivers/usb/gadget/function/uvc.h b/drivers/usb/gadget/function/uvc.h index 58e383afdd44..1a31e6c6a5ff 100644 --- a/drivers/usb/gadget/function/uvc.h +++ b/drivers/usb/gadget/function/uvc.h @@ -88,6 +88,7 @@ struct uvc_video { struct usb_ep *ep; struct work_struct pump; + struct workqueue_struct *async_wq; /* Frame parameters */ u8 bpp; diff --git a/drivers/usb/gadget/function/uvc_v4l2.c b/drivers/usb/gadget/function/uvc_v4l2.c index fd8f73bb726d..fddc392b8ab9 100644 --- a/drivers/usb/gadget/function/uvc_v4l2.c +++ b/drivers/usb/gadget/function/uvc_v4l2.c @@ -170,7 +170,7 @@ uvc_v4l2_qbuf(struct file *file, void *fh, struct v4l2_buffer *b) return ret; if (uvc->state == UVC_STATE_STREAMING) - schedule_work(&video->pump); + queue_work(video->async_wq, &video->pump); return ret; } diff --git a/drivers/usb/gadget/function/uvc_video.c b/drivers/usb/gadget/function/uvc_video.c index c00ce0e91f5d..bb037fcc90e6 100644 --- a/drivers/usb/gadget/function/uvc_video.c +++ b/drivers/usb/gadget/function/uvc_video.c @@ -277,7 +277,7 @@ uvc_video_complete(struct usb_ep *ep, struct usb_request *req) spin_unlock_irqrestore(&video->req_lock, flags); if (uvc->state == UVC_STATE_STREAMING) - schedule_work(&video->pump); + queue_work(video->async_wq, &video->pump); } static int @@ -485,7 +485,7 @@ int uvcg_video_enable(struct uvc_video *video, int enable) video->req_int_count = 0; - schedule_work(&video->pump); + queue_work(video->async_wq, &video->pump); return ret; } @@ -499,6 +499,11 @@ int uvcg_video_init(struct uvc_video *video, struct uvc_device *uvc) spin_lock_init(&video->req_lock); INIT_WORK(&video->pump, uvcg_video_pump); + /* Allocate a work queue for asynchronous video pump handler. */ + video->async_wq = alloc_workqueue("uvcgadget", WQ_UNBOUND | WQ_HIGHPRI, 0); + if (!video->async_wq) + return -EINVAL; + video->uvc = uvc; video->fcc = V4L2_PIX_FMT_YUYV; video->bpp = 16; From patchwork Wed Oct 19 08:34: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: 5003 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp244214wrs; Wed, 19 Oct 2022 03:32:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4XEs4gq+AKNyiCJahQZnc0SRBkyq7mKS7dUsteiOx2SN9JV1yd3T4obEoN5W8e6zF3HLfA X-Received: by 2002:a17:90a:e00a:b0:209:1545:74a7 with SMTP id u10-20020a17090ae00a00b00209154574a7mr9122006pjy.72.1666175551208; Wed, 19 Oct 2022 03:32:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666175551; cv=none; d=google.com; s=arc-20160816; b=dZqBT3QoShcvE5cgiAYw3rR1nmbpURANqaz4x4LV5NPkY5/6F1A/+NV96bDWW+KHTF kc0jz9eLKun7eMDib93vblmNnt7SmFQciEOCRAFIPBMbwM10GxuX5FhTExVizI27nVmR XkLGb/Dp+nZXtjownjhpa/JoztcRQ4oBDju2TUivnJ2gtQlS/Dg/AL7LZln5xNTcsM+t FPJWFcNAyRvOnAdn1FGmXVj2O1bD4rtGXJ2HvQS91PdTRhF9O1f2fwEBZlC4HlKrn5cM JN3mf7wRYnfcJ4BI/ozoofqP9fhv3l0V1748e9/pvuW1IvVtYCtwqpIrEQB+HmjhjmRB jPEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=mbeuuKyS1JYr9BJ4A8TldBavJoN2bhxICYGV6ZtSC3g=; b=K0xi1PlDgNiATbAd/m1+/MdhgKs3nGUTYsu5DhcDHZY8wttPaFN9TeFZgLEzlP3hLu T5GgUiXBe9ZxKUGByYl664Mk7fHbpA8JfcxS4+iBsKCI/fZRPkG/n0ehufvjvfnI9LZH uwXRIsdvkeqqMIf4pgfhuMCrynyW1H8FbZg3zpY3dcTOcHerK8uYvmsZK4IlU9tUce6l Q5HxniznropTIUqTU/n6SIgZrKiCwLR1eO2VtoZ+METz1gFBzywxgMg9NAFCTXgTTKeH dVbUAHOxwPbqL+2O5cOagrH1QI710g1VogvWEAMyCIR8KtysSybBwjh9R4tAirhjUCJ2 Csww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VJ6uXsN0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r7-20020a056a00216700b0053e15843f1fsi17030932pff.131.2022.10.19.03.32.14; Wed, 19 Oct 2022 03:32: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=VJ6uXsN0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231301AbiJSKG1 (ORCPT + 99 others); Wed, 19 Oct 2022 06:06:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231200AbiJSKFy (ORCPT ); Wed, 19 Oct 2022 06:05:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFE29229; Wed, 19 Oct 2022 02:44:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5B957617EB; Wed, 19 Oct 2022 09:13:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F2E3C433B5; Wed, 19 Oct 2022 09:13:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170837; bh=PyVuP224LTfOgKeY7PGhWDcswJIc+RIZ/ujbhn1tRm4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VJ6uXsN0P5w7KkgvZN2wCYMpmIPGwPYvL/iKnjPgzGgvbqEXhYPB4jH4tBfmsx2E6 f8nE7DiNxjQ1byFgzCdr8/IHEN/5LbQVvy5r7cjf5pCzeG28fM9kn5dqbiyNcldXPv ZAMHwVjcXSH8D7h6RnIEAucV6ZNLotlvcS8qofaU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wei Yongjun , Michael Hennerich , Sebastian Reichel , Sasha Levin Subject: [PATCH 6.0 805/862] power: supply: adp5061: fix out-of-bounds read in adp5061_get_chg_type() Date: Wed, 19 Oct 2022 10:34:52 +0200 Message-Id: <20221019083325.471951056@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747111694788680416?= X-GMAIL-MSGID: =?utf-8?q?1747111694788680416?= From: Wei Yongjun [ Upstream commit 9d47e01b9d807808224347935562f7043a358054 ] ADP5061_CHG_STATUS_1_CHG_STATUS is masked with 0x07, which means a length of 8, but adp5061_chg_type array size is 4, may end up reading 4 elements beyond the end of the adp5061_chg_type[] array. Signed-off-by: Wei Yongjun Acked-by: Michael Hennerich Signed-off-by: Sebastian Reichel Signed-off-by: Sasha Levin --- drivers/power/supply/adp5061.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/power/supply/adp5061.c b/drivers/power/supply/adp5061.c index 003557043ab3..daee1161c305 100644 --- a/drivers/power/supply/adp5061.c +++ b/drivers/power/supply/adp5061.c @@ -427,11 +427,11 @@ static int adp5061_get_chg_type(struct adp5061_state *st, if (ret < 0) return ret; - chg_type = adp5061_chg_type[ADP5061_CHG_STATUS_1_CHG_STATUS(status1)]; - if (chg_type > ADP5061_CHG_FAST_CV) + chg_type = ADP5061_CHG_STATUS_1_CHG_STATUS(status1); + if (chg_type >= ARRAY_SIZE(adp5061_chg_type)) val->intval = POWER_SUPPLY_STATUS_UNKNOWN; else - val->intval = chg_type; + val->intval = adp5061_chg_type[chg_type]; return ret; } From patchwork Wed Oct 19 08:34: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: 5038 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp247046wrs; Wed, 19 Oct 2022 03:39:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5O5vcrwe2x9naD8Sd1p7i5apcOPx7rCla281ztB5/AOY1b0UBhYgJW4I8qT5jvN3+LZP5l X-Received: by 2002:a17:906:5dd8:b0:78d:efa7:f78d with SMTP id p24-20020a1709065dd800b0078defa7f78dmr6185108ejv.641.1666175986348; Wed, 19 Oct 2022 03:39:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666175986; cv=none; d=google.com; s=arc-20160816; b=PxS6Kb/Rt9/A+F/t6IGyua84CDrcerjW55s+Xi/7U979WNpAf5lA4bc3fryL+wFQyQ WGA21Sjc7iRYwAuexJSfqO1C3LlAR2dCOO0AWQx8BEV/cCzUlMI3SEXKsKpoxiktDa29 h/evSMb0thsks6I7n6Fnng75mSSbCQxlhqgkywgwfbitIccVyEVFZHc3vJg/7tD1c1aW QmsE1mcroiI5jjNdAmqXbisZ6qa4ClStHl4m3Zw6OeZKBP2TCCCHihcDjTrySNHef44i WkuTiYBJUMSrnAquBtgM/DM2zotmuEJoihs9HGfjf5toK/5WF70nBsSmUOLWujwKL0Gi fwVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4GZl9/SiHE2unzVo8bktk8QESgBtq7Ij6wx8l6lmPW0=; b=zoLiMkgrD/CFK0/xajQyScClLNJnwKdx0g0NT0ziTEiODJ5arCzK6SNagPiS/Nmdsh i563JsjYySQ+8jHvuUEijNjmLRyle38egu8KmVPVX2wE46DopnCS/Cj5hL/QZ5KUYbry 2R23NOhTBAUN3OAxMCpmugphdhde9NVX5QR2Y1ejnZ3zkcypqqtYnfKqhkb2nyTOBcU8 9K0PD2K9J86K48oiohFnpJ46neVJ9FsBaEqi1vbpUN4nHuH/sqhx1VJFeJd7oLF5ag1u 7kkfdN8C65B1/JDvz51b3rWqMScaSRfdp2l3gatqjndI07TEZBcj8iTW80nmKUCWsnEN G0Ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="M/I1r/F8"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g25-20020a170906869900b0078dd22bc8d1si10863719ejx.198.2022.10.19.03.39.22; Wed, 19 Oct 2022 03:39: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="M/I1r/F8"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231860AbiJSKi3 (ORCPT + 99 others); Wed, 19 Oct 2022 06:38:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230106AbiJSKiB (ORCPT ); Wed, 19 Oct 2022 06:38:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E269A10B781; Wed, 19 Oct 2022 03:16: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 B68A6B824D1; Wed, 19 Oct 2022 09:14:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1855FC433C1; Wed, 19 Oct 2022 09:13:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170840; bh=BIVRl7gCxK+enNuH8o6/GH0jH9Xla0sqrWO3iXWl110=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M/I1r/F8N0dAKdFyy9ch/4jdI7TbVWKuhhji++r9/sAyevGoTihZ23p3z2hvsufqA f/zZdm0TyiDWUmWKW3LtwY4iK6ifgTQw6SaepCLzToTRgAG+1aQ1RlGmG3R2vsx7gu CmQ3zb+dvScVHTcTq+2BoiWxtXx1dvAbiRNTqgBI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Philipp Hortmann , Nam Cao , Sasha Levin Subject: [PATCH 6.0 806/862] staging: vt6655: fix potential memory leak Date: Wed, 19 Oct 2022 10:34:53 +0200 Message-Id: <20221019083325.512077150@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112151417342946?= X-GMAIL-MSGID: =?utf-8?q?1747112151417342946?= From: Nam Cao [ Upstream commit c8ff91535880d41b49699b3829fb6151942de29e ] In function device_init_td0_ring, memory is allocated for member td_info of priv->apTD0Rings[i], with i increasing from 0. In case of allocation failure, the memory is freed in reversed order, with i decreasing to 0. However, the case i=0 is left out and thus memory is leaked. Modify the memory freeing loop to include the case i=0. Tested-by: Philipp Hortmann Signed-off-by: Nam Cao Link: https://lore.kernel.org/r/20220909141338.19343-1-namcaov@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/staging/vt6655/device_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index d76f65756db8..ec7c991e745b 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -694,7 +694,7 @@ static int device_init_td0_ring(struct vnt_private *priv) return 0; err_free_desc: - while (--i) { + while (i--) { desc = &priv->apTD0Rings[i]; kfree(desc->td_info); } From patchwork Wed Oct 19 08:34: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: 4956 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp226527wrs; Wed, 19 Oct 2022 02:46:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM48mhSRbtBxnzp6vyx7ljQDWZcIqUV7lfyLWtxN73NBjlR2gPFV8vPEqlRroJNDI3F+a1hN X-Received: by 2002:a05:6402:f83:b0:458:8c97:29af with SMTP id eh3-20020a0564020f8300b004588c9729afmr6539892edb.210.1666172770304; Wed, 19 Oct 2022 02:46:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172770; cv=none; d=google.com; s=arc-20160816; b=cozP0d+JpMSyJlY8sYD5ksADH4sORl9QVqAsc52KKfCU2VdcAWPw45hQQ4dcd0GTQa rRBUzdBJzPaGd/R90b2BkXCDyzD4pwY3D7hABX6asIYie+pR6rxH4p/fu96c0GJuGbob ByVWIEZo7qm+d7l1wrQSCDaGWrHH9uKZjOiNf0fKqBR+Re+wOBECFSM/WCUxLqfyNmIS Ma8N7NUI6dYG+O3MmHMsr7FuE7GQwyBBSSQCjkEIgWDp2mitW8a61NlBmIlFdCO9Bvvv orQP4gXVPegR/Yv1WTBliPoKSEzH/waHhc+008bb6kC4QEzUMLnFuYXPXCImBWg22SFR T+KQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0lKUGf7Xmvsq4ZoptBmA6/tbTuqhrnxY+t4D8GLjY+Y=; b=AIe4Va0+mdZOvKrrs1RaymlA1THwgI5rl7ja3ReB595Padn3LY/11i6uM9LttOIHYU CHfUZwuXKC+5Xdfh7jRL9l/9Ij+UL11wtaE5Vgtj3SCKNy3nwUYtlV22n7da5MNDflm5 vc47q7pnxzC0GgZCdrfaDYkF7ZKlkxtQ8KsdlyxKv5Q+o5oVp5LP2K/ITRfVPBTtlAih W2Fxk7e6Xuyk5t9eQeOQY1pmj1e/Trha4ThoXk5AgvcEdM7nJuf7b28hRZV8Z6/h8Bzz jZkEgkZgCxwycCndBd9WgwVD1186LSdHhoPBS2yJjHf1crH8e41xkuIvaFnImTiF8P46 5zLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ftzSWO+e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id du17-20020a17090772d100b00783ca4d1c74si14076436ejc.520.2022.10.19.02.45.28; Wed, 19 Oct 2022 02: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=ftzSWO+e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234031AbiJSJmm (ORCPT + 99 others); Wed, 19 Oct 2022 05:42:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234193AbiJSJjL (ORCPT ); Wed, 19 Oct 2022 05:39: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 DCC51DED22; Wed, 19 Oct 2022 02:16: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 A8400617D4; Wed, 19 Oct 2022 09:14:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B671FC433D7; Wed, 19 Oct 2022 09:14:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170843; bh=FExqy90cvvKeQwgBS3G6vEsaIKxkIk3GIJCelzs91+g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ftzSWO+eC6HulXbNI8UJ63pYwCK6i+VcXgU2h9VAyJgIlpg69EXnQps8JKP9WZkZv mk5SRnj9GBHz0wVcKWIUs5KysclTyApt21i7O68V0R3VLWyCG+XTuRr82q6RhLwR36 wcKVQZjZW3oQqYkH1F7bU4g85UG5agWgO5yVr3Ag= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yu Kuai , Tejun Heo , Jens Axboe , Sasha Levin Subject: [PATCH 6.0 807/862] blk-throttle: prevent overflow while calculating wait time Date: Wed, 19 Oct 2022 10:34:54 +0200 Message-Id: <20221019083325.560259314@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108778485482880?= X-GMAIL-MSGID: =?utf-8?q?1747108778485482880?= From: Yu Kuai [ Upstream commit 8d6bbaada2e0a65f9012ac4c2506460160e7237a ] There is a problem found by code review in tg_with_in_bps_limit() that 'bps_limit * jiffy_elapsed_rnd' might overflow. Fix the problem by calling mul_u64_u64_div_u64() instead. Signed-off-by: Yu Kuai Acked-by: Tejun Heo Link: https://lore.kernel.org/r/20220829022240.3348319-3-yukuai1@huaweicloud.com Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- block/blk-throttle.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/block/blk-throttle.c b/block/blk-throttle.c index 3c02a9b3275a..35cf744ea9d1 100644 --- a/block/blk-throttle.c +++ b/block/blk-throttle.c @@ -806,7 +806,7 @@ static bool tg_with_in_bps_limit(struct throtl_grp *tg, struct bio *bio, u64 bps_limit, unsigned long *wait) { bool rw = bio_data_dir(bio); - u64 bytes_allowed, extra_bytes, tmp; + u64 bytes_allowed, extra_bytes; unsigned long jiffy_elapsed, jiffy_wait, jiffy_elapsed_rnd; unsigned int bio_size = throtl_bio_data_size(bio); @@ -824,10 +824,8 @@ static bool tg_with_in_bps_limit(struct throtl_grp *tg, struct bio *bio, jiffy_elapsed_rnd = tg->td->throtl_slice; jiffy_elapsed_rnd = roundup(jiffy_elapsed_rnd, tg->td->throtl_slice); - - tmp = bps_limit * jiffy_elapsed_rnd; - do_div(tmp, HZ); - bytes_allowed = tmp; + bytes_allowed = mul_u64_u64_div_u64(bps_limit, (u64)jiffy_elapsed_rnd, + (u64)HZ); if (tg->bytes_disp[rw] + bio_size <= bytes_allowed) { if (wait) From patchwork Wed Oct 19 08:34: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: 5065 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp248529wrs; Wed, 19 Oct 2022 03:43:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4bXUmvbKM+gxZ0DuALjp+pIR15eFiTc5aMW/W8B/y9FP0j/2Th4wCLrLU/4ezLJ6CHB2nU X-Received: by 2002:a17:90a:4607:b0:202:e22d:489c with SMTP id w7-20020a17090a460700b00202e22d489cmr45422573pjg.80.1666176231609; Wed, 19 Oct 2022 03:43:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176231; cv=none; d=google.com; s=arc-20160816; b=TIqaROA6dtawJKz9tEERZ7EE9v310ctxYU+s/OYox5N6rVRIIje2ql8Y4QTz0zcDVm n+KCKUNLaK+7TU+arrAvAXecGpqcmOPmERnUBYPBvjKA1g2A+nBvM1t+UR4wN9djorG1 /JvpaYlRFtL3bv5HOh46IX18L2D5a1h/Hhi6v547rqJ9i/2wx4fjV2YiyTSaWQd1oaUI wRii/OnX9CAL7d8ZHUEKRWiF6+NRptp7t2ksegkwXQ0HiRvPhbJ4aYBSysJx/h+sQ7Bf 9oAiZTHfhecRsNvOS8aziiTPzzTcm/du+dyUYhUSQsMX0c85jizxT8U+hLkFlQhw67Zg vO5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lTFY5OeVKumRcKrxOMgwJQOcmNa8efBx2Q4pZMeHoiU=; b=IgGtMB/Sfw98LMJMtQQODus2QrSXhyOSkyAjmiqkS57WjHlViejCsAhmS+P/dyTTf4 a1Dj2uvxTdhjuMBvPETeHw5CnqjKhanuUOMqPhTWCfBwnxYmhKLb5vwjXAy0Gtfm8wyv NUUAMUnUmSQyR4Ri1ABsJlYMp4/8/KpGykL3Ew3HecH4eal/Lpmqv6cjXcmdqPQJhSuh NidltubdVcMm1rhb1Nm74lEMdqZZVhUOaYD3JtORxIsa4vwxqMaCHvK9+RnGABhhOSI4 l+UV3C3wZmA4KrB70dmfxRHerWx9utFm53JQcyLYWszkyPQAFMDcDvsX2bdX3iT0aLA2 QQIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=by7wlY4a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d5-20020a170902b70500b0017f7e1387easi17353448pls.217.2022.10.19.03.43.38; Wed, 19 Oct 2022 03:43: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=by7wlY4a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232482AbiJSKm6 (ORCPT + 99 others); Wed, 19 Oct 2022 06:42:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232226AbiJSKmK (ORCPT ); Wed, 19 Oct 2022 06:42:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 408A598CAD; Wed, 19 Oct 2022 03:20:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id EDAC7B824D9; Wed, 19 Oct 2022 09:14:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51630C433C1; Wed, 19 Oct 2022 09:14:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170845; bh=YBukERdAxHkU57EcJR6ZhFZ2hlJha5Z6ys8hKW3Glgs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=by7wlY4aukB+vULi6cdZG9Gxx+j/HeHHIKoaxkpfff5rrRPzbKnRQFZPrw4RT0SUR vNwD1QlPp27c7JxZ5y8KbUErKKaR2c7LVp1bayvAcK4SfZnQkEDjTY4qDbPE11uFHe /yAcCcVGUIaQ1OCZteA4hbTBtH7kmrdwef9hV84Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Serge Semin , Hannes Reinecke , Damien Le Moal , Sasha Levin Subject: [PATCH 6.0 808/862] ata: libahci_platform: Sanity check the DT child nodes number Date: Wed, 19 Oct 2022 10:34:55 +0200 Message-Id: <20221019083325.611211745@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112408506465108?= X-GMAIL-MSGID: =?utf-8?q?1747112408506465108?= From: Serge Semin [ Upstream commit 3c132ea6508b34956e5ed88d04936983ec230601 ] Having greater than AHCI_MAX_PORTS (32) ports detected isn't that critical from the further AHCI-platform initialization point of view since exceeding the ports upper limit will cause allocating more resources than will be used afterwards. But detecting too many child DT-nodes doesn't seem right since it's very unlikely to have it on an ordinary platform. In accordance with the AHCI specification there can't be more than 32 ports implemented at least due to having the CAP.NP field of 5 bits wide and the PI register of dword size. Thus if such situation is found the DTB must have been corrupted and the data read from it shouldn't be reliable. Let's consider that as an erroneous situation and halt further resources allocation. Note it's logically more correct to have the nports set only after the initialization value is checked for being sane. So while at it let's make sure nports is assigned with a correct value. Signed-off-by: Serge Semin Reviewed-by: Hannes Reinecke Signed-off-by: Damien Le Moal Signed-off-by: Sasha Levin --- drivers/ata/libahci_platform.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c index 32495ae96567..986f1923a76d 100644 --- a/drivers/ata/libahci_platform.c +++ b/drivers/ata/libahci_platform.c @@ -451,14 +451,24 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev, } } - hpriv->nports = child_nodes = of_get_child_count(dev->of_node); + /* + * Too many sub-nodes most likely means having something wrong with + * the firmware. + */ + child_nodes = of_get_child_count(dev->of_node); + if (child_nodes > AHCI_MAX_PORTS) { + rc = -EINVAL; + goto err_out; + } /* * If no sub-node was found, we still need to set nports to * one in order to be able to use the * ahci_platform_[en|dis]able_[phys|regulators] functions. */ - if (!child_nodes) + if (child_nodes) + hpriv->nports = child_nodes; + else hpriv->nports = 1; hpriv->phys = devm_kcalloc(dev, hpriv->nports, sizeof(*hpriv->phys), GFP_KERNEL); From patchwork Wed Oct 19 08:34: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: 5379 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp302570wrs; Wed, 19 Oct 2022 05:39:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4PaqtoF0P9G9kqwg/zr1S/dkGfcXWm3r8Ad5aqk65dTdlE1/DvfMIPx4u1ltHwkgVSOcX3 X-Received: by 2002:a63:a548:0:b0:462:9d00:1835 with SMTP id r8-20020a63a548000000b004629d001835mr6977335pgu.442.1666183145583; Wed, 19 Oct 2022 05:39:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666183145; cv=none; d=google.com; s=arc-20160816; b=Hu+2J+vYslv8LXwdvmgqECm4/TlnHXZ74TMpdn/5LDJFxF7tFtv6ELVwDZTO6yiUTz UnGDIuNI/IFWzOXBEgZApvA0B/HO/S6zUm+LSq7RC70UX+mVbIDFN3Z4ZQL051jijifo f997PQCSxOwHdL3eJ8OKK4CJQ8AflnF3qPM8L0HJZjVoE6fFzZjVOd8XGUjM8c6WEZ7h A+5/meJTeo936OCcIUdQa1NNm9+tSBw42EGmyRIssAxOEOsv2RydeiZn1huDo3vNSQST feAsMbUScAEo+ND3pKk6l/UXhqWNK1KUlWiXrYvXJDnW9vNtmKmq8oXNOYri7xdv1VTx AITw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wcDkUeUQc/SkDILmiI0yP+JqNGi2jytDuErkXD01vOI=; b=WPBtmY57mcrPmYbpCR1vu5ivAqVwKD9ge1uJTiFd9M5lIz4UX7B+7raWwbGdwK8Xd2 FEx+Xd3hjCbZDlvw3XsBejcbOl0MB4ZvirXpb54SgLJWuH8C9do3n3/GkAjcP0Vcqgxr 3Xch7wizxXvwkhid2rL+1qsFkWM1IkVbv+lWnXeKjFP1ITJOOVuO24aTv2F38bGrNyMF 0z7IJnzYoRHpgoC3HQk1NtrUokySDnGnphFDD1CtfOiO6/9auRlSZHBLAHS96XAwaI6s WyHiRyOsFJBQf71Tnurn2EG06njacGZeupPm++gfcwlC7Upsbo9ALeLAk8M0L02ZFQA9 N1HQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HnFuyQ7q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s13-20020a17090a5d0d00b0020ae8f547d8si16489533pji.125.2022.10.19.05.38.48; Wed, 19 Oct 2022 05:39: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=HnFuyQ7q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232083AbiJSMbq (ORCPT + 99 others); Wed, 19 Oct 2022 08:31:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233033AbiJSMba (ORCPT ); Wed, 19 Oct 2022 08:31:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6C09FADA; Wed, 19 Oct 2022 05:09: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 E40E96174B; Wed, 19 Oct 2022 09:14:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE72AC433D6; Wed, 19 Oct 2022 09:14:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170848; bh=pyFqEjCsJm/B3AhoMs/+9UBXpGWPBTmE33Qm6IaChXk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HnFuyQ7qxqOnyY/uEjHDJq5Kv1sG9g0mbforwwHZdccwFChtanVBaFktGTzuC53fX JVbp2dLQtlflT8ujcul/ZWuq/KIYVPvu4wqUJ5Ov24r6O4i96+vxmipFkomnx3j9GV 4qbO2YqiQQ1oncqjdj6dPuen6P0xw+hVqCQyECdA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mingzhe Zou , Coly Li , Jens Axboe , Sasha Levin Subject: [PATCH 6.0 809/862] bcache: fix set_at_max_writeback_rate() for multiple attached devices Date: Wed, 19 Oct 2022 10:34:56 +0200 Message-Id: <20221019083325.659532040@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747119658213740663?= X-GMAIL-MSGID: =?utf-8?q?1747119658213740663?= From: Coly Li [ Upstream commit d2d05b88035d2d51a5bb6c5afec88a0880c73df4 ] Inside set_at_max_writeback_rate() the calculation in following if() check is wrong, if (atomic_inc_return(&c->idle_counter) < atomic_read(&c->attached_dev_nr) * 6) Because each attached backing device has its own writeback thread running and increasing c->idle_counter, the counter increates much faster than expected. The correct calculation should be, (counter / dev_nr) < dev_nr * 6 which equals to, counter < dev_nr * dev_nr * 6 This patch fixes the above mistake with correct calculation, and helper routine idle_counter_exceeded() is added to make code be more clear. Reported-by: Mingzhe Zou Signed-off-by: Coly Li Acked-by: Mingzhe Zou Link: https://lore.kernel.org/r/20220919161647.81238-6-colyli@suse.de Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- drivers/md/bcache/writeback.c | 73 +++++++++++++++++++++++++---------- 1 file changed, 52 insertions(+), 21 deletions(-) diff --git a/drivers/md/bcache/writeback.c b/drivers/md/bcache/writeback.c index 3f0ff3aab6f2..9c227e4a8465 100644 --- a/drivers/md/bcache/writeback.c +++ b/drivers/md/bcache/writeback.c @@ -157,6 +157,53 @@ static void __update_writeback_rate(struct cached_dev *dc) dc->writeback_rate_target = target; } +static bool idle_counter_exceeded(struct cache_set *c) +{ + int counter, dev_nr; + + /* + * If c->idle_counter is overflow (idel for really long time), + * reset as 0 and not set maximum rate this time for code + * simplicity. + */ + counter = atomic_inc_return(&c->idle_counter); + if (counter <= 0) { + atomic_set(&c->idle_counter, 0); + return false; + } + + dev_nr = atomic_read(&c->attached_dev_nr); + if (dev_nr == 0) + return false; + + /* + * c->idle_counter is increased by writeback thread of all + * attached backing devices, in order to represent a rough + * time period, counter should be divided by dev_nr. + * Otherwise the idle time cannot be larger with more backing + * device attached. + * The following calculation equals to checking + * (counter / dev_nr) < (dev_nr * 6) + */ + if (counter < (dev_nr * dev_nr * 6)) + return false; + + return true; +} + +/* + * Idle_counter is increased every time when update_writeback_rate() is + * called. If all backing devices attached to the same cache set have + * identical dc->writeback_rate_update_seconds values, it is about 6 + * rounds of update_writeback_rate() on each backing device before + * c->at_max_writeback_rate is set to 1, and then max wrteback rate set + * to each dc->writeback_rate.rate. + * In order to avoid extra locking cost for counting exact dirty cached + * devices number, c->attached_dev_nr is used to calculate the idle + * throushold. It might be bigger if not all cached device are in write- + * back mode, but it still works well with limited extra rounds of + * update_writeback_rate(). + */ static bool set_at_max_writeback_rate(struct cache_set *c, struct cached_dev *dc) { @@ -167,21 +214,8 @@ static bool set_at_max_writeback_rate(struct cache_set *c, /* Don't set max writeback rate if gc is running */ if (!c->gc_mark_valid) return false; - /* - * Idle_counter is increased everytime when update_writeback_rate() is - * called. If all backing devices attached to the same cache set have - * identical dc->writeback_rate_update_seconds values, it is about 6 - * rounds of update_writeback_rate() on each backing device before - * c->at_max_writeback_rate is set to 1, and then max wrteback rate set - * to each dc->writeback_rate.rate. - * In order to avoid extra locking cost for counting exact dirty cached - * devices number, c->attached_dev_nr is used to calculate the idle - * throushold. It might be bigger if not all cached device are in write- - * back mode, but it still works well with limited extra rounds of - * update_writeback_rate(). - */ - if (atomic_inc_return(&c->idle_counter) < - atomic_read(&c->attached_dev_nr) * 6) + + if (!idle_counter_exceeded(c)) return false; if (atomic_read(&c->at_max_writeback_rate) != 1) @@ -195,13 +229,10 @@ static bool set_at_max_writeback_rate(struct cache_set *c, dc->writeback_rate_change = 0; /* - * Check c->idle_counter and c->at_max_writeback_rate agagain in case - * new I/O arrives during before set_at_max_writeback_rate() returns. - * Then the writeback rate is set to 1, and its new value should be - * decided via __update_writeback_rate(). + * In case new I/O arrives during before + * set_at_max_writeback_rate() returns. */ - if ((atomic_read(&c->idle_counter) < - atomic_read(&c->attached_dev_nr) * 6) || + if (!idle_counter_exceeded(c) || !atomic_read(&c->at_max_writeback_rate)) return false; From patchwork Wed Oct 19 08:34: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: 5386 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp303755wrs; Wed, 19 Oct 2022 05:41:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM530M+xnguZjuNFkgLK4liOctZRtrQ6yI0FiMk/pGpF3JFn5xmPQM660d/ranNopp+6cUc6 X-Received: by 2002:a17:90a:3f86:b0:20a:e7dc:340a with SMTP id m6-20020a17090a3f8600b0020ae7dc340amr9781863pjc.157.1666183283559; Wed, 19 Oct 2022 05:41:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666183283; cv=none; d=google.com; s=arc-20160816; b=t4lDult8t2L5coZVsRwwrmJnAOLWDQSCtD6zi95FBfNl+2IVIUg1sM0picnZTjXs9M RUwmu0/YbRqPvrFyklCKL2lXX/a6AP11MAwYV7L+uqpBYL0vnWCMLQnb2Tk8+GMgtprD smZheWz5Xy/xSBXiX+wHrzLdAuTHN0CB0FDswKPDxasUw08hAC5yjSWybukqrss7Ck0M x+Dms2oh89FLxntH1gxO9pygbma2zJ848a7tewwXmUnQQMtld7rar785RL7YosqbtGOC 6QJrEhUtb6wDXrcGSwRkQbPdClY3L5V0Vv17tWPq2XiAbqPYtGUGc96vgmpKJVTTRkCV IaZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=SdgYdefcGCbU65olKFZB7iZPHeAGecHJXR2fG4geXHM=; b=PTwdJFiQdzIlVktNA+/m+PCHVdEQP1KRAklJgBxnjft0IGQYp6gsnY298yScPzmARE YjyqMPYk9cB3Gd/TMdG70M9vpmBHuj5dWC12nPx/Li6orCWmYB2fxpfix/7t1OMIaPzJ 5FiuYlx7e03jrsu2gtBc9PPrwohBAYc90jS+5bv2IC4cvB3Vq9CVmIFujHGJk+HL9Oat 3BAcmq5oxKa/51PgYl95q+HSnKs4oVnP7WPYmTStKYUMABsfCmTXQSoZMHBm1vA3iqof rs50qWWQ2xmIQ6F6OGv7Tq8qKz6pBUoFqqPWv8t3s0rsbwidv3oEHZxe22s5+OoiY28u dhEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Nt2wB8Co; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d21-20020a056a00199500b00563b7ea2d7fsi19904210pfl.144.2022.10.19.05.41.10; Wed, 19 Oct 2022 05:41: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=Nt2wB8Co; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231978AbiJSMdC (ORCPT + 99 others); Wed, 19 Oct 2022 08:33:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231489AbiJSMcm (ORCPT ); Wed, 19 Oct 2022 08:32:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D3181D0D74; Wed, 19 Oct 2022 05:11: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 049E8617E1; Wed, 19 Oct 2022 09:14:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C5F1C433C1; Wed, 19 Oct 2022 09:14:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170853; bh=VZBw5DsUX6oh/4FnMOXMdw0076F1lklCffGNz1UYs/M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Nt2wB8CoOeHpSrqC4ecYExZSI4ljq9k/oT3ron7CVqTRPgOkaq3+rBy4dSasHt/oK 8cJ/f0j1x/LLoKu8DMYSLdf2DOpcoAVkbFSPRmo9FcLM6K2/gDIpWkvT1pMgQbTr3q CZeQUpwMtVTkYDAAK1Sxl7e35ttNpAU9+ZLweAXU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Richard Fitzgerald , Pierre-Louis Bossart , Vinod Koul , Sasha Levin Subject: [PATCH 6.0 810/862] soundwire: cadence: Dont overwrite msg->buf during write commands Date: Wed, 19 Oct 2022 10:34:57 +0200 Message-Id: <20221019083325.708476346@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747119802636614254?= X-GMAIL-MSGID: =?utf-8?q?1747119802636614254?= From: Richard Fitzgerald [ Upstream commit ba05b39d265bdd16913f7684600d9d41e2796745 ] The buf passed in struct sdw_msg must only be written for a READ, in that case the RDATA part of the response is the data value of the register. For a write command there is no RDATA, and buf should be assumed to be const and unmodifable. The original caller should not expect its data buffer to be corrupted by an sdw_nwrite(). Signed-off-by: Richard Fitzgerald Reviewed-by: Pierre-Louis Bossart Link: https://lore.kernel.org/r/20220916103505.1562210-1-rf@opensource.cirrus.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/soundwire/cadence_master.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/soundwire/cadence_master.c b/drivers/soundwire/cadence_master.c index 4fbb19557f5e..42c5fae80efb 100644 --- a/drivers/soundwire/cadence_master.c +++ b/drivers/soundwire/cadence_master.c @@ -544,9 +544,12 @@ cdns_fill_msg_resp(struct sdw_cdns *cdns, return SDW_CMD_IGNORED; } - /* fill response */ - for (i = 0; i < count; i++) - msg->buf[i + offset] = FIELD_GET(CDNS_MCP_RESP_RDATA, cdns->response_buf[i]); + if (msg->flags == SDW_MSG_FLAG_READ) { + /* fill response */ + for (i = 0; i < count; i++) + msg->buf[i + offset] = FIELD_GET(CDNS_MCP_RESP_RDATA, + cdns->response_buf[i]); + } return SDW_CMD_OK; } From patchwork Wed Oct 19 08:34: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: 5032 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp246596wrs; Wed, 19 Oct 2022 03:38:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6NrpLwXQtQobwuOPAKbRW0zMA5l0azJf5V9FzbP8xh1RLb1klstKH1peEu/Z81rlpEWxWg X-Received: by 2002:a17:907:3e14:b0:78d:b14b:6fa0 with SMTP id hp20-20020a1709073e1400b0078db14b6fa0mr5994852ejc.650.1666175922514; Wed, 19 Oct 2022 03:38:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666175922; cv=none; d=google.com; s=arc-20160816; b=xIPBCWITPQR0Zu0e7TBpMYZa1TGxOcF4nQt69MSxnZ+hKw6lXmNHKHtRBeY6+8/32H 5N/0Wc2FdliwDyVtJ/aQapOQ0kehG6VVYdUpu7onZeBeXMAopTNcu9xrYIBcNakrKexv HBeHghZPshmgRtRMtHlI29vsYljFc/pPmmRiMNPYIFbqZE1REIL/m6FKXv/Cf3wDxZ0Q n75RxHFJcH/YqIKi4uazi3+k/YG4hOwYhJqC/f7p0b+CBiueeLC8o7flCjGUZCyzE3c+ Dj2RHuuT9nrX8jZys7Ihqa7YvBiiePaOLXTt8V6O+Y3Vt+ZWuty1QfSWuYRWTlUUCpmo Z64A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WJ4LsgIQWHhLIB0d5A9eJdg94sCUsF9Lg9Mc9tv+mIg=; b=qIu/srGqLwVk6IRFHQuV2JeB6l/K3u3nFa+XB9OgBzGx6arX4jVizDg11+GH557Ima TIxp30K0/W/Hml9NqPz21uZop45/iTWmtliG6JQfo9UGDQCLpa980pfhKC0zvMpBifl4 ImPIDAxA4TThv90o0MMZMImbwPEnI/YAiErLsX4PIMcqaVpjBRD/8/+gtTQk09F2D4Y5 +gRNP7x2KrrVRa4KDGqDn7eELTuf3tgstaLj1VD885QiONe1Y7lvT8rakz2CRfrg14+/ 6HwyUi+ivYXNWxhc347t8xFWevyVOdfiZMDzVupvSbgYaKKQzU9EcwIelfQXWlYmTTkb 99Uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=N2L4P1zC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gt39-20020a1709072da700b00787e1d77943si15438584ejc.49.2022.10.19.03.38.18; Wed, 19 Oct 2022 03:38: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=N2L4P1zC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231687AbiJSKhM (ORCPT + 99 others); Wed, 19 Oct 2022 06:37:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229649AbiJSKgk (ORCPT ); Wed, 19 Oct 2022 06:36:40 -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 CF68D10DC; Wed, 19 Oct 2022 03:15:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 8AA98CE21BF; Wed, 19 Oct 2022 09:14:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9AB8CC43470; Wed, 19 Oct 2022 09:14:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170856; bh=W5Sm+YPQ1xjDU381TURqrY9sM8XImPQc4XQ4uSH9l5E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N2L4P1zCKlzNkaWyAP4hlb85oFJRIGpRK9ZY5KXxuVJKMiFdTThqgwnp60Pc2u1JO M1Spxf855SAqAkEj5V4Jr7z4h1FvkBup8mQfwQ2/FTC8VjgO4mWoEJw+Cl+KY443Tb /n4zDJ7rBHNLNUM6vqglQomJKQldXLWZ0iapH6tg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pierre-Louis Bossart , Rander Wang , Bard Liao , Vinod Koul , Sasha Levin Subject: [PATCH 6.0 811/862] soundwire: intel: fix error handling on dai registration issues Date: Wed, 19 Oct 2022 10:34:58 +0200 Message-Id: <20221019083325.756535639@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112084211363511?= X-GMAIL-MSGID: =?utf-8?q?1747112084211363511?= From: Pierre-Louis Bossart [ Upstream commit c6867cda906aadbce5e71efde9c78a26108b2bad ] The call to intel_register_dai() may fail because of memory allocation issues or problems reported by the ASoC core. In all cases, when a error is thrown the component is not registered, it's invalid to unregister it. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Signed-off-by: Bard Liao Link: https://lore.kernel.org/r/20220919175721.354679-2-yung-chuan.liao@linux.intel.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/soundwire/intel.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c index 89d1d0d021fc..af6c1a93372d 100644 --- a/drivers/soundwire/intel.c +++ b/drivers/soundwire/intel.c @@ -1429,7 +1429,6 @@ int intel_link_startup(struct auxiliary_device *auxdev) ret = intel_register_dai(sdw); if (ret) { dev_err(dev, "DAI registration failed: %d\n", ret); - snd_soc_unregister_component(dev); goto err_interrupt; } From patchwork Wed Oct 19 08:34: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: 5058 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp248086wrs; Wed, 19 Oct 2022 03:42:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6J57iHQVo3+XZhj+5vzEHsT8tP9iUl6Rtdygx3o0l3bI30Tq+Y2Khx2OKjcXtBr4g8z4TW X-Received: by 2002:aa7:d39a:0:b0:458:a612:f805 with SMTP id x26-20020aa7d39a000000b00458a612f805mr6655236edq.49.1666176159641; Wed, 19 Oct 2022 03:42:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176159; cv=none; d=google.com; s=arc-20160816; b=Cj6Ollx+ed6smGSOXM3v3TgxkmdEBgMJwc5w2QctagGoAsbt7b6TWqW5Ls0HbsmlJw RKBtaZ2WwlKayxuZ2zfUuqPUtQ1kBuQSKBdxVzIxQ+nSzLC2xm9Thb0QEg6UzGxBlGsJ UsNGabcb6+RpBvnxYSDxn7UMK08nYPTD5FKaIVJrlAg0gwiaFeQ2H50OXFYLNuAac1wt 7/YYu1oPidsqv+ykIwicSQRlgxH3jS5/ZTBwRqI6pbCNm1mv6zJgCOvdlbOzEw5vMj5/ xul8Ow5EaIUXZTRvPHxeW8FKxf3gKNyryE5TSQMDlcm5GTZ2JoWp74H70zKfQmqO8BXF 5bUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XuBY26eDyeUiPTyr4pXC4Q1aOVNwnzFx9tJXr4bK9Mk=; b=GDiVX7Wu1S4XIsYnwj13t0c33QRI4Zsi2jhMyuxouyM/ISmczfEr+B1sj6jpbcU+M2 43LMBESdyL663MZ2iZjpflYV9LhM4qtp6ot8SoYYzXaFO0qKUEgfKksOpk8sF9m94DA6 +8bEfGmdvIKrS/bRtWc7boZ3L5vF4lI5C1JqzHs4aVfIdHIbgcpaB3s2BVEnIEugB/Bn ddRbwQeS4kKf3qKD2snl7jJOPM+/uMmIFJSHlq69wXz+0xqyJ24bBe7vEQDh6Lg1LVRr fDQS3pm2JV1p/qvzicfI4VttQN4lMPIF9R3bAQ+54divOquvpPRTiggKpB8wIFdKI+T/ 5nIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="p/oOdQW1"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a05640242d300b0045bd55b122fsi17761400edc.57.2022.10.19.03.42.14; Wed, 19 Oct 2022 03:42: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="p/oOdQW1"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232097AbiJSKln (ORCPT + 99 others); Wed, 19 Oct 2022 06:41:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231953AbiJSKkz (ORCPT ); Wed, 19 Oct 2022 06:40: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 360DC157468; Wed, 19 Oct 2022 03:19:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C524AB824DA; Wed, 19 Oct 2022 09:14:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2FD40C433D7; Wed, 19 Oct 2022 09:14:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170858; bh=2gknDB7yMjYAPtsyuOfnNQ4Ihb2WdIg0eTeSrpWUic4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p/oOdQW1CYvLKDjhzmQmCcSbYaGZFXGkxyKbyxgXDyU5Wwva+ytbMAe2baY3FTWno OrUb2+lzdzr0VnYgae0I+hpBC7yAuHvFULtpJnsizfoH0nn83/TCL5siw7XVfcezMG vOgYw2uTIjec3P9YBr4ybrlsAKbopzEZOCZfOWvA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Harry Stern , Benjamin Tissoires , Sasha Levin Subject: [PATCH 6.0 812/862] hid: topre: Add driver fixing report descriptor Date: Wed, 19 Oct 2022 10:34:59 +0200 Message-Id: <20221019083325.800819914@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112332379167474?= X-GMAIL-MSGID: =?utf-8?q?1747112332379167474?= From: Harry Stern [ Upstream commit a109d5c45b3d6728b9430716b915afbe16eef27c ] The Topre REALFORCE R2 firmware incorrectly reports that interface descriptor number 1, input report descriptor 2's events are array events rather than variable events. That particular report descriptor is used to report keypresses when there are more than 6 keys held at a time. This bug prevents events from this interface from being registered properly, so only 6 keypresses (from a different interface) can be registered at once, rather than full n-key rollover. This commit fixes the bug by setting the correct value in a report_fixup function. The original bug report can be found here: Link: https://gitlab.freedesktop.org/libinput/libinput/-/issues/804 Thanks to Benjamin Tissoires for diagnosing the issue with the report descriptor. Signed-off-by: Harry Stern Signed-off-by: Benjamin Tissoires Link: https://lore.kernel.org/r/20220911003614.297613-1-harry@harrystern.net Signed-off-by: Sasha Levin --- drivers/hid/Kconfig | 6 +++++ drivers/hid/Makefile | 1 + drivers/hid/hid-ids.h | 3 +++ drivers/hid/hid-topre.c | 49 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 59 insertions(+) create mode 100644 drivers/hid/hid-topre.c diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index 6ce92830b5d1..c4308d4988dc 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig @@ -1141,6 +1141,12 @@ config HID_TOPSEED Say Y if you have a TopSeed Cyberlink or BTC Emprex or Conceptronic CLLRCMCE remote control. +config HID_TOPRE + tristate "Topre REALFORCE keyboards" + depends on HID + help + Say Y for N-key rollover support on Topre REALFORCE R2 108 key keyboards. + config HID_THINGM tristate "ThingM blink(1) USB RGB LED" depends on HID diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile index b0bef8098139..bccaec0d77d3 100644 --- a/drivers/hid/Makefile +++ b/drivers/hid/Makefile @@ -123,6 +123,7 @@ obj-$(CONFIG_HID_GREENASIA) += hid-gaff.o obj-$(CONFIG_HID_THRUSTMASTER) += hid-tmff.o hid-thrustmaster.o obj-$(CONFIG_HID_TIVO) += hid-tivo.o obj-$(CONFIG_HID_TOPSEED) += hid-topseed.o +obj-$(CONFIG_HID_TOPRE) += hid-topre.o obj-$(CONFIG_HID_TWINHAN) += hid-twinhan.o obj-$(CONFIG_HID_U2FZERO) += hid-u2fzero.o hid-uclogic-objs := hid-uclogic-core.o \ diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index f80d6193fca6..50bab12d9476 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h @@ -1231,6 +1231,9 @@ #define USB_DEVICE_ID_TIVO_SLIDE 0x1201 #define USB_DEVICE_ID_TIVO_SLIDE_PRO 0x1203 +#define USB_VENDOR_ID_TOPRE 0x0853 +#define USB_DEVICE_ID_TOPRE_REALFORCE_R2_108 0x0148 + #define USB_VENDOR_ID_TOPSEED 0x0766 #define USB_DEVICE_ID_TOPSEED_CYBERLINK 0x0204 diff --git a/drivers/hid/hid-topre.c b/drivers/hid/hid-topre.c new file mode 100644 index 000000000000..88a91cdad5f8 --- /dev/null +++ b/drivers/hid/hid-topre.c @@ -0,0 +1,49 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * HID driver for Topre REALFORCE Keyboards + * + * Copyright (c) 2022 Harry Stern + * + * Based on the hid-macally driver + */ + +#include +#include + +#include "hid-ids.h" + +MODULE_AUTHOR("Harry Stern "); +MODULE_DESCRIPTION("REALFORCE R2 Keyboard driver"); +MODULE_LICENSE("GPL"); + +/* + * Fix the REALFORCE R2's non-boot interface's report descriptor to match the + * events it's actually sending. It claims to send array events but is instead + * sending variable events. + */ +static __u8 *topre_report_fixup(struct hid_device *hdev, __u8 *rdesc, + unsigned int *rsize) +{ + if (*rsize >= 119 && rdesc[69] == 0x29 && rdesc[70] == 0xe7 && + rdesc[71] == 0x81 && rdesc[72] == 0x00) { + hid_info(hdev, + "fixing up Topre REALFORCE keyboard report descriptor\n"); + rdesc[72] = 0x02; + } + return rdesc; +} + +static const struct hid_device_id topre_id_table[] = { + { HID_USB_DEVICE(USB_VENDOR_ID_TOPRE, + USB_DEVICE_ID_TOPRE_REALFORCE_R2_108) }, + { } +}; +MODULE_DEVICE_TABLE(hid, topre_id_table); + +static struct hid_driver topre_driver = { + .name = "topre", + .id_table = topre_id_table, + .report_fixup = topre_report_fixup, +}; + +module_hid_driver(topre_driver); From patchwork Wed Oct 19 08:35: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: 5280 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp280551wrs; Wed, 19 Oct 2022 05:00:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4x17TatLxuIgYC46VcPiH0Z2R8IrB2XAjzVA3FgUaSKUQB8ooXLwpFrj2Eun2BnwMx3c2l X-Received: by 2002:a17:907:7286:b0:78d:2848:bc88 with SMTP id dt6-20020a170907728600b0078d2848bc88mr6583494ejc.67.1666180856063; Wed, 19 Oct 2022 05:00:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666180856; cv=none; d=google.com; s=arc-20160816; b=KcJdjE8N3oP/tifTaegO1Xt/+ZGn8KyZDxHKxPp9M4Z3u2j/Byv0APlFl6Le5LLcz/ 34lI912gHCubIBETMnaGY4FVAqLT2s/1K9s4LUWXl4n2LnzPpyMGpNlwe4p+6jtAVOzO fTvcSNvYItvUwxSl+g5PDmvjPDq61Y1lzVpwFW5nUxqRUlRwWjL41FNS/fHY+Rqnd3tv nZy6DvwbM8cCNepolBwDZK7mHktY4T7lFLx3KAE5CdjQuiDb/XGNHQblU6IeU8ATRZ4q RivNtUT+OLu3RcOk6MnYgYoSeXADDSbVZZFuldHd4IO4a2mGHu0v6NLYKCWv4N8bUtg4 s6iA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5P7OA4B75wnBVFRAjCvIgkQqC+x3HUTAZ2cBg5af3nU=; b=KZLNJ6P2D8lSURAhsAynciYRAUc6Q4G3zguf+PvlXzVvVjMATwJpCkGpj1DDPfl7uL ZbnJ5uau7AaJ5hxDWhdc90optDRe5KinCpgv4DuOSlh5esvD3Q4dm9gwIBGstY7350FL exRy+q5/i1keN4Et63+82L5EaAbogQRoKwfAL4HSQAtUVHeMurRwsq5vNiJEoTwcWThU bS5IIhL5S1nkw3SZudSeN9gzxyADVoj04BjlQj1FtY61WybGriNain7Hu7wZeOl1gfSk mLRx3UxW46Ig4qlNHAY1hWdvxvq5BYHNzDxZf9+OhYmtqD/gYEbXtA23408pqWtUfApD fjRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lqhecLvK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mp16-20020a1709071b1000b0078db18d796dsi14288616ejc.982.2022.10.19.05.00.29; Wed, 19 Oct 2022 05:00: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=lqhecLvK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231376AbiJSLyW (ORCPT + 99 others); Wed, 19 Oct 2022 07:54:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232139AbiJSLxZ (ORCPT ); Wed, 19 Oct 2022 07:53: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 8F33F176524; Wed, 19 Oct 2022 04:32: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 7C52DB824DF; Wed, 19 Oct 2022 09:14:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9290C433C1; Wed, 19 Oct 2022 09:14:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170861; bh=D8ozL383GaaeAGtKQvIA9IdpVRSMEvGm6dPoBfIkAio=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lqhecLvKnvW+POkwpZbHlta8M/NlzSaKMbJ1CLSni0RyxqylK9HJRNqkqNNpxw9UR iBP9UJq6rA9dTqnb9sA6TIyWPmnC/pvRBGNRO8DKPk6ogsELUcbav3dBkQJ4I4Iizc EFdrc6gxGIwWeMh1lyG1X2cCB+xt6Y7NMkDwXYaI= 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 6.0 813/862] HID: roccat: Fix use-after-free in roccat_read() Date: Wed, 19 Oct 2022 10:35:00 +0200 Message-Id: <20221019083325.847526424@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747117257424407080?= X-GMAIL-MSGID: =?utf-8?q?1747117257424407080?= 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 26373b82fe81..6da80e442fdd 100644 --- a/drivers/hid/hid-roccat.c +++ b/drivers/hid/hid-roccat.c @@ -257,6 +257,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 */ @@ -276,6 +278,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 Wed Oct 19 08:35: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: 5278 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp280368wrs; Wed, 19 Oct 2022 05:00:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4/U23tyHjsv2JqTtzEYndHIKQOc371jInD3AE66rUe6jHGDoHlIbAFTIHCr+NjWuf18NKT X-Received: by 2002:aa7:db4d:0:b0:458:908f:a372 with SMTP id n13-20020aa7db4d000000b00458908fa372mr7119899edt.248.1666180842127; Wed, 19 Oct 2022 05:00:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666180842; cv=none; d=google.com; s=arc-20160816; b=G4Fbss99xd6Cg6UfQ7wDaonPZ3GvvYWBnprjnYNuSacmVEGXaaOu5Le0dupne/zCN/ p+NpuX9Xe3QVUjPDG4rIfsW9HKs8F1bCu9K5qLN5Lpxym9ohNAM5deyY0j8KpxzomrsV qAmNNHbtfBOdf8iYlsOHpjhomCXl1hoPv+CxHB9q8m9Y0h6/sHO7oPtJjVBdiWi6i44e Nrrlhjc/R2CNYfHCzjrU/679D+ZoljXE7gt3KyhcfWenlLJdfGddJBuUGJHoIu8fjRpI 6MyPkpgOZUrMhD2SU5wcJbHBW+DVkT610g0dOxRqCTvTzNZotR1y4tPz7hd/wc0Ojpsv wvXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=oE8v8I/OPPmIQvXUBMjTG2uCUa+g4At7jc105F86al0=; b=gz7gxY3wMIHlawHOe4JtDJrQTHxtg94goWgDkXgE+GjD42tN8JkrlTe4NTCkD3y/FT 9stNA0VIeoFtVTTLuJscsCZIQY7wMgg2/a0sQQNaPT0p14hiXqnHl8j999ILuNiq6PVB Btaw4vnGL+oa0jZb9oopQtTQXW3Nw7ayZ4h0yiAndAMLQMpB05qEbE5QX4xEHVocBMBx Kg+EHAXuHh1oh5VXyAnEfnJZLLu1NQt0j+Twvj3P1LV0cqOe10dS6nfQ1K7iTp8yXZUz u4B40TC6wJIoc2bGyArqDMcEImsIn5dA9ur2TRWpe/+zp21Cy9wlnro7pzqtj6CgNWd6 BceA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GKX77W1N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k20-20020a170906159400b0077bab1f707esi11727467ejd.159.2022.10.19.05.00.17; Wed, 19 Oct 2022 05:00: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=GKX77W1N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232026AbiJSLxQ (ORCPT + 99 others); Wed, 19 Oct 2022 07:53:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230471AbiJSLwu (ORCPT ); Wed, 19 Oct 2022 07:52:50 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A71A24D26E; Wed, 19 Oct 2022 04:31: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 sin.source.kernel.org (Postfix) with ESMTPS id A2668CE21C2; Wed, 19 Oct 2022 09:14:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9BE1CC433D7; Wed, 19 Oct 2022 09:14:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170864; bh=fSjG4RXvpX46fKNLE6mDdtR1CXfA7oy7Me+/3xuP4Bk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GKX77W1NPLH1iClqT2yqdCl01XZ+soa03y+WKH1xrGX1Dkv2o5pyY+0y/kkYF8q57 y87yY81xSUjBjWH0KV9D/V7qfMGkGegEt3espi04xYWCGXRONHOqkKkDa48tL0kmkL 5l4D35awjrFeIjNFWDEp66UX+UsGDG+4pTlTurGk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jianglei Nie , Sebastian Reichel , Sasha Levin Subject: [PATCH 6.0 814/862] HSI: ssi_protocol: fix potential resource leak in ssip_pn_open() Date: Wed, 19 Oct 2022 10:35:01 +0200 Message-Id: <20221019083325.888317761@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747117243009342399?= X-GMAIL-MSGID: =?utf-8?q?1747117243009342399?= From: Jianglei Nie [ Upstream commit b28dbcb379e6a7f80262c2732a57681b1ee548ca ] ssip_pn_open() claims the HSI client's port with hsi_claim_port(). When hsi_register_port_event() gets some error and returns a negetive value, the HSI client's port should be released with hsi_release_port(). Fix it by calling hsi_release_port() when hsi_register_port_event() fails. Signed-off-by: Jianglei Nie Signed-off-by: Sebastian Reichel Signed-off-by: Sasha Levin --- drivers/hsi/clients/ssi_protocol.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/hsi/clients/ssi_protocol.c b/drivers/hsi/clients/ssi_protocol.c index 21f11a5b965b..49ffd808d17f 100644 --- a/drivers/hsi/clients/ssi_protocol.c +++ b/drivers/hsi/clients/ssi_protocol.c @@ -931,6 +931,7 @@ static int ssip_pn_open(struct net_device *dev) if (err < 0) { dev_err(&cl->device, "Register HSI port event failed (%d)\n", err); + hsi_release_port(cl); return err; } dev_dbg(&cl->device, "Configuring SSI port\n"); From patchwork Wed Oct 19 08:35: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: 4964 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp226754wrs; Wed, 19 Oct 2022 02:46:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5/axA1RLr+yLTqfJocaoOLN2aVGbD5UeHgclKvM/IcaM0+Xlqjls/0ffl6TFYLMr/GXD4Y X-Received: by 2002:a17:907:b07:b0:78d:ce2b:1999 with SMTP id h7-20020a1709070b0700b0078dce2b1999mr6200462ejl.267.1666172808693; Wed, 19 Oct 2022 02:46:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172808; cv=none; d=google.com; s=arc-20160816; b=Af9YOIpuWNwjqSpOECB5MXJ1UTk3pPy3WEKt94QRCLvlkNDp15HE9Zf5KVX0tDg+T1 8XqNtYMnEBS/rOKKS/VW+32VX9R/Wgy6lwWsWY/e1azN4ePHr1/6OIvOyu5+JkHOw9hT s3Oj/qIIXqajbSdgKD1Yc2is6szwf1bIUmrEAmxdHzNAGjKgl18fyp1brEE7TWjmDtpR Mo+MehojMQwoqu/Ny6CG7hXPjARI8SVKElphfOlgf/3KGqf8apGXq95wyfuJiUpjV0sN /oGoh3DUBU0xxnAHdsAzOpUHel9n2U7VwRpQAaHE0p9KelYSUxzyD//Z9WkmPLwZhs+J mjMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QYafK7qP6iavHRZ+xlgwUz24cYhwPP0B/8fqD2tcwWA=; b=cwa2KVEEpVm3WT7CXnKub0EnMtNvF/BPsCt60DKwSR/5BOjK0QYivHhjaZXRB4nrhd KapcQY1FFaxF5SL1wTJTG70XoGwPXmG4FExij0tWiJTd7DeGtSAeqh5xI6jTIhhd4tG5 8k/eGRXxbMiOhPrUtyeQHUlRYYyfulsBzWvUyHRmjFJMiWXc4jWsZuvZfUy2o0zBznbe dtwpeY4lVapxNcHsPOfLGzWND8bj/VrRGkYO3gsO/sgvVJnCIkLVrclfUZMUGCsT/Yjh hOQ9man6H99TslIamLTjM67vIPVez0+oWITXD58jpFUrWYJv2Vo7vJJ84kx53RB5n8xb Ij/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ecJYFlw0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hs21-20020a1709073e9500b0073d8b93700csi14202847ejc.165.2022.10.19.02.46.14; Wed, 19 Oct 2022 02:46: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=ecJYFlw0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234435AbiJSJn6 (ORCPT + 99 others); Wed, 19 Oct 2022 05:43:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234510AbiJSJkh (ORCPT ); Wed, 19 Oct 2022 05:40:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBC3DEF5A0; Wed, 19 Oct 2022 02:16:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D52A7617D1; Wed, 19 Oct 2022 09:16:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EAE5DC433D6; Wed, 19 Oct 2022 09:16:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170972; bh=oJ6qJGlAT422qVkxzq0How+tDhfPxj4z7/qt5SBB8uE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ecJYFlw0KxivWM+pLOGoUXLozGfVz5gJrc7hehZrB+GgNJElZjKPSxhfGVIBztJdX KjiOi1pKbgZu+FhbMLNKdJ0qhdQhHmV/eD/EGX8f2I8Anb1iEMGtdLuUSZbe0QlNFW vL7axSsn2VIZr5KJs3g7NBr2YmlYxufglj+NUXzM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johnothan King , Benjamin Tissoires , Sasha Levin , Arne Wendt Subject: [PATCH 6.0 815/862] HID: nintendo: check analog user calibration for plausibility Date: Wed, 19 Oct 2022 10:35:02 +0200 Message-Id: <20221019083325.930357791@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108819018654303?= X-GMAIL-MSGID: =?utf-8?q?1747108819018654303?= From: Johnothan King [ Upstream commit 50503e360eeb968a3d00234c9cc4057d774c3e9a ] Arne Wendt writes: Cheap clone controllers may (falsely) report as having a user calibration for the analog sticks in place, but return wrong/impossible values for the actual calibration data. In the present case at mine, the controller reports having a user calibration in place and successfully executes the read commands. The reported user calibration however is min = center = max = 0. This pull request addresses problems of this kind by checking the provided user calibration-data for plausibility (min < center < max) and falling back to the default values if implausible. I'll note that I was experiencing a crash because of this bug when using the GuliKit KingKong 2 controller. The crash manifests as a divide by zero error in the kernel logs: kernel: divide error: 0000 [#1] PREEMPT SMP NOPTI Link: https://github.com/nicman23/dkms-hid-nintendo/pull/25 Link: https://github.com/DanielOgorchock/linux/issues/36 Co-authored-by: Arne Wendt Signed-off-by: Johnothan King Signed-off-by: Benjamin Tissoires Link: https://lore.kernel.org/r/gvpL2G6VwXGJPvxX5KRiu9pVjvTivgayug_jdKDY6zfuAaAqncP9BkKLosjwUXNlgVVTMfJSKfwPF1K79cKAkwGComyC21vCV3q9B3EXNkE=@protonmail.com Signed-off-by: Sasha Levin --- drivers/hid/hid-nintendo.c | 55 +++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/drivers/hid/hid-nintendo.c b/drivers/hid/hid-nintendo.c index 6028af3c3aae..c3774a468b22 100644 --- a/drivers/hid/hid-nintendo.c +++ b/drivers/hid/hid-nintendo.c @@ -760,12 +760,31 @@ static int joycon_read_stick_calibration(struct joycon_ctlr *ctlr, u16 cal_addr, cal_y->max = cal_y->center + y_max_above; cal_y->min = cal_y->center - y_min_below; - return 0; + /* check if calibration values are plausible */ + if (cal_x->min >= cal_x->center || cal_x->center >= cal_x->max || + cal_y->min >= cal_y->center || cal_y->center >= cal_y->max) + ret = -EINVAL; + + return ret; } static const u16 DFLT_STICK_CAL_CEN = 2000; static const u16 DFLT_STICK_CAL_MAX = 3500; static const u16 DFLT_STICK_CAL_MIN = 500; +static void joycon_use_default_calibration(struct hid_device *hdev, + struct joycon_stick_cal *cal_x, + struct joycon_stick_cal *cal_y, + const char *stick, int ret) +{ + hid_warn(hdev, + "Failed to read %s stick cal, using defaults; e=%d\n", + stick, ret); + + cal_x->center = cal_y->center = DFLT_STICK_CAL_CEN; + cal_x->max = cal_y->max = DFLT_STICK_CAL_MAX; + cal_x->min = cal_y->min = DFLT_STICK_CAL_MIN; +} + static int joycon_request_calibration(struct joycon_ctlr *ctlr) { u16 left_stick_addr = JC_CAL_FCT_DATA_LEFT_ADDR; @@ -793,38 +812,24 @@ static int joycon_request_calibration(struct joycon_ctlr *ctlr) &ctlr->left_stick_cal_x, &ctlr->left_stick_cal_y, true); - if (ret) { - hid_warn(ctlr->hdev, - "Failed to read left stick cal, using dflts; e=%d\n", - ret); - - ctlr->left_stick_cal_x.center = DFLT_STICK_CAL_CEN; - ctlr->left_stick_cal_x.max = DFLT_STICK_CAL_MAX; - ctlr->left_stick_cal_x.min = DFLT_STICK_CAL_MIN; - ctlr->left_stick_cal_y.center = DFLT_STICK_CAL_CEN; - ctlr->left_stick_cal_y.max = DFLT_STICK_CAL_MAX; - ctlr->left_stick_cal_y.min = DFLT_STICK_CAL_MIN; - } + if (ret) + joycon_use_default_calibration(ctlr->hdev, + &ctlr->left_stick_cal_x, + &ctlr->left_stick_cal_y, + "left", ret); /* read the right stick calibration data */ ret = joycon_read_stick_calibration(ctlr, right_stick_addr, &ctlr->right_stick_cal_x, &ctlr->right_stick_cal_y, false); - if (ret) { - hid_warn(ctlr->hdev, - "Failed to read right stick cal, using dflts; e=%d\n", - ret); - - ctlr->right_stick_cal_x.center = DFLT_STICK_CAL_CEN; - ctlr->right_stick_cal_x.max = DFLT_STICK_CAL_MAX; - ctlr->right_stick_cal_x.min = DFLT_STICK_CAL_MIN; - ctlr->right_stick_cal_y.center = DFLT_STICK_CAL_CEN; - ctlr->right_stick_cal_y.max = DFLT_STICK_CAL_MAX; - ctlr->right_stick_cal_y.min = DFLT_STICK_CAL_MIN; - } + if (ret) + joycon_use_default_calibration(ctlr->hdev, + &ctlr->right_stick_cal_x, + &ctlr->right_stick_cal_y, + "right", ret); hid_dbg(ctlr->hdev, "calibration:\n" "l_x_c=%d l_x_max=%d l_x_min=%d\n" From patchwork Wed Oct 19 08:35: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: 4949 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp226352wrs; Wed, 19 Oct 2022 02:45:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6MmAvKdqxYVh8zmosxiGVopo0393M7LFxKwUm0N31z1VELYth51y0FBWfbMK1Lnw0lz0Im X-Received: by 2002:a17:90b:1c06:b0:20a:f070:9f3c with SMTP id oc6-20020a17090b1c0600b0020af0709f3cmr8915436pjb.151.1666172738699; Wed, 19 Oct 2022 02:45:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172738; cv=none; d=google.com; s=arc-20160816; b=w3NXdXKzou/sX7mocSxBLgDUR/3V07zruppGqnZSJO2vMK9zC1rGJUBdqr7GnGSDLH niq3eOFvINez9cIY69ZDXE32acoxrNClclW5mOrE8IQuRdITqu4UGNhBwGaEFuNULrX9 OJtuS72Xh0XWpbJajD3Bthm5d4mk4eqK6/Jhgs9cnlJzNSYj3IELIKmzZHYGEgUBuEuh P0J31dY64zXX0sZrXIL22UTho7cNIQrYIl5/xX/V7O/ykPubB8HX4rRWVf3RJLos36JZ ctcI4jXTxzHJgaSbFKlhIk1JCElFZp+rwl8iwPWWDCEQxpOHgjoR2FV1F3ui4CuZZidN N7Tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5TP9SkiFcTasTcuV8EqRBb7EynzEQVEQDJz76WTBFag=; b=dXiq8WI5i5sRbzfqIu91htrMSXoKi9LKlMLbYslz20FZ570DWDeV8kLlmWTxQ78KAH nSpJDLTvbDTSBhlEV8w1U0Ihuxc4aSV52lbkAyy8ALAoRh9sPUnRj082Pb9jG5mfc+f2 yWI1rud3xt1vYSF5S3yaRhooE3bACwOCSp7nmf9ZZEX1GhMqrpbVcCAX7kyGv/rKNvu3 +s9KllUChfo05AdqmfE8ELVPAL31iaLeKPR6MuTzaiBGVPd2ZMuswxMbNJHvFJbmW4AS 2bL4mfDECNCDDHaATKR87V8Bp1G06jXchMKsH0E8vU63zl7mdIh700qZ3qjfd8RybesR NRkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QM2g3bEe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f126-20020a636a84000000b0043c01032729si17872327pgc.666.2022.10.19.02.45.19; Wed, 19 Oct 2022 02:45: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=QM2g3bEe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233945AbiJSJmh (ORCPT + 99 others); Wed, 19 Oct 2022 05:42:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234073AbiJSJiD (ORCPT ); Wed, 19 Oct 2022 05:38: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 2AA1E31F93; Wed, 19 Oct 2022 02:15:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 74752617F1; Wed, 19 Oct 2022 09:14:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D478C433D7; Wed, 19 Oct 2022 09:14:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170884; bh=hLea2Hywm1+dsu/QsFYNJPR4Xf8zvgrWQYrpjo5lmFA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QM2g3bEe9YC3tHsZQzvXzlZMJtaU9+vHqhG4woYWAVTaFc2A7wjaVS8rrFqdHLd+X uYEwBMGdU7HOiYa6GNDVN3LXSnOATSLOq44R3VDApbTXe3t/aPhdEgBysUaGQFL8bW DN3xQO/p55U5Kgo8rg8CX3m270kRo4XpsiLfWQsA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Logan Gunthorpe , Song Liu , Sasha Levin Subject: [PATCH 6.0 816/862] md/raid5: Wait for MD_SB_CHANGE_PENDING in raid5d Date: Wed, 19 Oct 2022 10:35:03 +0200 Message-Id: <20221019083325.973869233@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108745918437896?= X-GMAIL-MSGID: =?utf-8?q?1747108745918437896?= From: Logan Gunthorpe [ Upstream commit 5e2cf333b7bd5d3e62595a44d598a254c697cd74 ] A complicated deadlock exists when using the journal and an elevated group_thrtead_cnt. It was found with loop devices, but its not clear whether it can be seen with real disks. The deadlock can occur simply by writing data with an fio script. When the deadlock occurs, multiple threads will hang in different ways: 1) The group threads will hang in the blk-wbt code with bios waiting to be submitted to the block layer: io_schedule+0x70/0xb0 rq_qos_wait+0x153/0x210 wbt_wait+0x115/0x1b0 io_schedule+0x70/0xb0 rq_qos_wait+0x153/0x210 wbt_wait+0x115/0x1b0 __rq_qos_throttle+0x38/0x60 blk_mq_submit_bio+0x589/0xcd0 wbt_wait+0x115/0x1b0 __rq_qos_throttle+0x38/0x60 blk_mq_submit_bio+0x589/0xcd0 __submit_bio+0xe6/0x100 submit_bio_noacct_nocheck+0x42e/0x470 submit_bio_noacct+0x4c2/0xbb0 ops_run_io+0x46b/0x1a30 handle_stripe+0xcd3/0x36b0 handle_active_stripes.constprop.0+0x6f6/0xa60 raid5_do_work+0x177/0x330 Or: io_schedule+0x70/0xb0 rq_qos_wait+0x153/0x210 wbt_wait+0x115/0x1b0 __rq_qos_throttle+0x38/0x60 blk_mq_submit_bio+0x589/0xcd0 __submit_bio+0xe6/0x100 submit_bio_noacct_nocheck+0x42e/0x470 submit_bio_noacct+0x4c2/0xbb0 flush_deferred_bios+0x136/0x170 raid5_do_work+0x262/0x330 2) The r5l_reclaim thread will hang in the same way, submitting a bio to the block layer: io_schedule+0x70/0xb0 rq_qos_wait+0x153/0x210 wbt_wait+0x115/0x1b0 __rq_qos_throttle+0x38/0x60 blk_mq_submit_bio+0x589/0xcd0 __submit_bio+0xe6/0x100 submit_bio_noacct_nocheck+0x42e/0x470 submit_bio_noacct+0x4c2/0xbb0 submit_bio+0x3f/0xf0 md_super_write+0x12f/0x1b0 md_update_sb.part.0+0x7c6/0xff0 md_update_sb+0x30/0x60 r5l_do_reclaim+0x4f9/0x5e0 r5l_reclaim_thread+0x69/0x30b However, before hanging, the MD_SB_CHANGE_PENDING flag will be set for sb_flags in r5l_write_super_and_discard_space(). This flag will never be cleared because the submit_bio() call never returns. 3) Due to the MD_SB_CHANGE_PENDING flag being set, handle_stripe() will do no processing on any pending stripes and re-set STRIPE_HANDLE. This will cause the raid5d thread to enter an infinite loop, constantly trying to handle the same stripes stuck in the queue. The raid5d thread has a blk_plug that holds a number of bios that are also stuck waiting seeing the thread is in a loop that never schedules. These bios have been accounted for by blk-wbt thus preventing the other threads above from continuing when they try to submit bios. --Deadlock. To fix this, add the same wait_event() that is used in raid5_do_work() to raid5d() such that if MD_SB_CHANGE_PENDING is set, the thread will schedule and wait until the flag is cleared. The schedule action will flush the plug which will allow the r5l_reclaim thread to continue, thus preventing the deadlock. However, md_check_recovery() calls can also clear MD_SB_CHANGE_PENDING from the same thread and can thus deadlock if the thread is put to sleep. So avoid waiting if md_check_recovery() is being called in the loop. It's not clear when the deadlock was introduced, but the similar wait_event() call in raid5_do_work() was added in 2017 by this commit: 16d997b78b15 ("md/raid5: simplfy delaying of writes while metadata is updated.") Link: https://lore.kernel.org/r/7f3b87b6-b52a-f737-51d7-a4eec5c44112@deltatee.com Signed-off-by: Logan Gunthorpe Signed-off-by: Song Liu Signed-off-by: Sasha Levin --- drivers/md/raid5.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index db149d28f639..caaae10e33f8 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -36,6 +36,7 @@ */ #include +#include #include #include #include @@ -6780,7 +6781,18 @@ static void raid5d(struct md_thread *thread) spin_unlock_irq(&conf->device_lock); md_check_recovery(mddev); spin_lock_irq(&conf->device_lock); + + /* + * Waiting on MD_SB_CHANGE_PENDING below may deadlock + * seeing md_check_recovery() is needed to clear + * the flag when using mdmon. + */ + continue; } + + wait_event_lock_irq(mddev->sb_wait, + !test_bit(MD_SB_CHANGE_PENDING, &mddev->sb_flags), + conf->device_lock); } pr_debug("%d stripes handled\n", handled); From patchwork Wed Oct 19 08:35: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: 5107 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp250887wrs; Wed, 19 Oct 2022 03:50:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7njVIwa7NIR+zebHGHze8eCJdG7flNlUwRmSFv1rQO9c0bWFPNBgMK+Gj8zlof91VLjND2 X-Received: by 2002:a17:906:ee88:b0:78d:1a9a:b2db with SMTP id wt8-20020a170906ee8800b0078d1a9ab2dbmr6005195ejb.225.1666176617520; Wed, 19 Oct 2022 03:50:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176617; cv=none; d=google.com; s=arc-20160816; b=RidozJVL/z8A8r4H4CoWXACDhqoiGs7RaafrIjMTFU2pdahkduHRq7S8WKGfNPou45 UGhUdl3GQ8tiLgBzzuxzYN1zm/70DBPuJAnUCKMDd7e6MhGmTXKDVsO00Eme0zzMZPcj sWTjq9tnoF0O5O23C0Lfhkz9SBxehK0QuGqHw2Vh0s3JUnXRF3emjxucHK5BZi+aUsVm qm1gttssaEKtW0v49lVjJG/q8mANekAVpM0uD8bAeDyj6JNs75mt2r5McAnphVwQxsK+ tDRlbfrPpzpxJVs0/jXqD8pgCDbgEbYh/YdMPi0TauW0iqGr2xlEks8LsbSHtKyv7BwE 3mcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uyr7uFQITT7cUiRiakbXxfBQAjTfnvRmynMmmSOTFiU=; b=Fv57MBrvfAu1jBK92WLovo3UvBNT4vPxijznFTC9OBYXM2HsUZ5R4/0aM0DzCLc4rF ScsZvGwF2YcLt0NDGyeC/hlP1AS50P4yumPw4f+0QCZ01DjdW1HRwHaXdv6L4eIbM2l7 WHdwuHUtrqaDfLY4JWjCr+kwQGxce/cc4dx2Qs/Yl4rrsNvD5Lo+tcXPkwKAR7oUbFMn n4MKYXYEZq5YJ3vlfMsTrIEm3SVM0oa8SXagRu0+HN1hxWj6qQRhMlWIYO9gVc72GOm6 wxuYABq8TF2nIXRm2jPVQSund5/NurDL5VV3ShXkET+adFGigwC0VJ7QBV0JtK0Iux7r vOQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=B3E8gg24; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id di8-20020a170906730800b00783de095de7si14724826ejc.847.2022.10.19.03.49.52; Wed, 19 Oct 2022 03:50: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=B3E8gg24; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234212AbiJSKsU (ORCPT + 99 others); Wed, 19 Oct 2022 06:48:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233196AbiJSKqY (ORCPT ); Wed, 19 Oct 2022 06:46:24 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB8DE159D50; Wed, 19 Oct 2022 03:21: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 ECC83B824E4; Wed, 19 Oct 2022 09:15:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6DB47C433C1; Wed, 19 Oct 2022 09:15:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170913; bh=QmYPBt2tuHklhPv5OYIPoGItdJBIj0Kc3kuoPwcl3Q0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B3E8gg24wI/3rhy4VjLyNLJCPhBLI/7iptm3Hh9bxpbGYqjwpMzJ54UvhrAdzE9Oh AzQf5nEwT6zya9V6xUhpqKcrHTT73Gkd/tZUsFOHrKQxdSiVz8hRYP4i7Byv3v6nlG LJvxzOnuTvpq00fojvh7iD5aoCqv5z5N0H/b7MVk= 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 6.0 817/862] usb: host: xhci: Fix potential memory leak in xhci_alloc_stream_info() Date: Wed, 19 Oct 2022 10:35:04 +0200 Message-Id: <20221019083326.011394372@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112813157015151?= X-GMAIL-MSGID: =?utf-8?q?1747112813157015151?= 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 8c19e151a945..9e56aa28efcd 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c @@ -641,7 +641,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); @@ -702,6 +702,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 Wed Oct 19 08:35: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: 5418 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp316052wrs; Wed, 19 Oct 2022 06:07:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5YHZle4mffhJIQSZJeNuOSNVvcJsA70zUgEypmeyZbWRfeFBbd+1/TUu1nC2dplBGIkm7P X-Received: by 2002:a17:90b:110c:b0:205:cfeb:cfb with SMTP id gi12-20020a17090b110c00b00205cfeb0cfbmr9825784pjb.75.1666184830725; Wed, 19 Oct 2022 06:07:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666184830; cv=none; d=google.com; s=arc-20160816; b=n26nCWQwGTlY6NIMZNjroSVM3w9J+KVbgVf7UKSKRiOSe997nevwBRaGvPA317vYZ+ 0FycAZxnnYKFY67HZd3/q7Xq12ql0OL1j5LB7W9dunR45mpy3EKjtCiPkfyi8W8t5HiL KWU6XV242LdNFKxinBkVuNiKIRfVa+pEoQ7wjmnA+KGaXd1HZzDmMmjhMDHcexEpuKtz o13X2FuG1Ex4rigEt2YzITPSsYwvKQT3Z8HR/Gx+zEbgPjARt7pT8GdFHz6HLlr4Xd9N j13dg2XHK2Vwl/Xof5Db+hibIS93gpys190F/9zJQvq4ltR187kigdsOyMQ2+7pkD7ld EMgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pF2QpH++cQdHRepIMk45AciEjDxTON3yQuSr7Niwv0M=; b=pcnqNf26TG+b4m9uamYJVbmyVEY1KZD1+xo5DJM5Ks5W+KS1ZVi+mprldCIQjLdAlq w6RhNNjLqVtsx3Dus6Pz9PcobbkspBtQVmGTAZdYKOWzfQz6KcwxANnDHLo3Zg+bLVwu WScsu6ughnwQb6lzHF/r6Rw62UItIuxchQAnG59BathovFst40wgBTROEq1dZKgVl2i+ VgCJBejddTL29OP1oJ/dQ4MzB+lGnNHdj5lx+w6aJUtczZLnAaHawGhNLBZNWAQEQWZW uJby4medWvsfc1VBF4Ua+iFLfzRo4Z5nr5B+tAGnQYHsXewdX8+BKbfByPH7MlCzAfEt kFjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uOJjkhEX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a056a000ccd00b00536fa6bbb11si18628190pfv.344.2022.10.19.06.06.48; Wed, 19 Oct 2022 06:07: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=uOJjkhEX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231633AbiJSM6X (ORCPT + 99 others); Wed, 19 Oct 2022 08:58:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231417AbiJSM6L (ORCPT ); Wed, 19 Oct 2022 08:58:11 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD48F2408F; Wed, 19 Oct 2022 05:41:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 57213CE2167; Wed, 19 Oct 2022 09:15:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D9EEC433D7; Wed, 19 Oct 2022 09:15:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170943; bh=2fdLn/QEe5cJvzhuHn+H7MqMQb9Zx1z0xrlir9w8xYE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uOJjkhEX59WzL8hd+xffoA+Se9tUJOE5uHto+l8krl/umeOCjamRgHAFbunhR/wQx hQOWWhpJzXZGFK3cRUztp704LwHjcg0e0nQYkXFelMNqc/XPSljR/1KdeadRskIzr+ k4psaQzFUMk0oNl0jntJMFZIr9yZfDLNIV52uqb8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robin Guo , Sasha Levin Subject: [PATCH 6.0 818/862] usb: musb: Fix musb_gadget.c rxstate overflow bug Date: Wed, 19 Oct 2022 10:35:05 +0200 Message-Id: <20221019083326.051998588@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747121425316881698?= X-GMAIL-MSGID: =?utf-8?q?1747121425316881698?= 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 daada4b66a92..6704a62a1665 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c @@ -760,6 +760,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 Wed Oct 19 08:35: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: 5078 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp249315wrs; Wed, 19 Oct 2022 03:45:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4+ZumKFSnlwoJXos/zI1f+aGQiWPWF8ctamxIi+wmeqo/muqGDREpFPRI15ULE7kKDBQA8 X-Received: by 2002:a17:90a:1690:b0:20a:8f70:14bb with SMTP id o16-20020a17090a169000b0020a8f7014bbmr8980703pja.115.1666176353270; Wed, 19 Oct 2022 03:45:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176353; cv=none; d=google.com; s=arc-20160816; b=FpCMN81DSls/CQIiUStLRzTODBZfZuiuqOIb5kPd/VPaGx9i+ZPrAs28IXvOYpRZYe A4at2sd4OyMu8a3KWJd3uKKPkjqpMM1ma6zk4s4yCEg0IbSWKShxTrRJSolwCWlIKDaf B88d63W45AHYyQ/b8y2Sa8c+QMiEovAHPHZvfzlbz/JoaWXco745pcQWwOA/zvcWQZ9K Z+pfRevIWZG8YmKtRuKMAMNKPUFfKNbRLe2CXXPA6OhvECNA5InpZ0hBb8GiERgNbWWs SGgH+poWNgYbLK+24TZ3TAYq8O5VixWdAQxVJCeYAUyJXsJqGr/q7IrIfw0bVZMkZEVa 3VJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7QnVT+wK5o+ETy+yv5RPf7fLf3Q6MjjbJQaaSRTd15k=; b=q96N17qaus0Tsw8/KQbHaSoF1dZEvxqprGL/c+7ht7zc/s8BsWaW0qTbUQOZRJelmI UloYJK3AwqnKit8kSlhJMaSTqI63UeNH+7iXwa4CtEQkuTmFJGpYBmHOHqanSzlLJ1Bi ZGhql97tO6JIXyxVt9Swg/aleJqsGp8SjhW0IXB1XODmXg0h5T6PGkCvYy10SaPGra4p YS5uLf/WdP5Zha7gGdExiQzcoUaAAtnORNeeLdM0K2AbssVtDHpCI1jnPs7Uh+CYU1fq XIl/K6c5kxY+vVnuukgQUUu8wlRlCpHxoKwEvlTkn3BrgcRYYvcs6DbXNM3yXwcBODiQ Crjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bb1sUMhH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170902da8f00b001753958498dsi20684661plx.492.2022.10.19.03.45.39; Wed, 19 Oct 2022 03:45: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=bb1sUMhH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231843AbiJSKpW (ORCPT + 99 others); Wed, 19 Oct 2022 06:45:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232558AbiJSKnp (ORCPT ); Wed, 19 Oct 2022 06:43:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FA798F958; Wed, 19 Oct 2022 03:20: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 21AE0B824F3; Wed, 19 Oct 2022 09:15:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8BC37C433C1; Wed, 19 Oct 2022 09:15:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170956; bh=fcLNnv9u9K0j6yxnl1HXbVSr6g3bpmcU8/1pU2KX7P4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bb1sUMhH3iMKHohrttB/UdJqV0zpVPKCA/fnLG5HmuwHslRZHxxeC/cnExtrl+147 jxlWe/NtkkX/8RcqxgEL9rotou0tKAIOM9GMXUe8Mzx5/BT46qwD6sj5UwnA7E7zgX 5Dn/3GiiC+Nxi8Gjw1ph6XBEDMl4ozCJoDZAbYAw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Li Jun , Alexander Stein , Sasha Levin Subject: [PATCH 6.0 819/862] usb: dwc3: core: add gfladj_refclk_lpm_sel quirk Date: Wed, 19 Oct 2022 10:35:06 +0200 Message-Id: <20221019083326.100779024@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112535341166729?= X-GMAIL-MSGID: =?utf-8?q?1747112535341166729?= From: Alexander Stein [ Upstream commit a6fc2f1b092787e9d7dbe472d720cede81680315 ] This selects the SOF/ITP counter be running on ref_clk. As documented U2_FREECLK_EXISTS has to be set to 0 as well. Reviewed-by: Li Jun Signed-off-by: Alexander Stein Link: https://lore.kernel.org/r/20220915062855.751881-3-alexander.stein@ew.tq-group.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/dwc3/core.c | 8 +++++++- drivers/usb/dwc3/core.h | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 919d36fd0298..f7f1952b2901 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -407,6 +407,10 @@ static void dwc3_ref_clk_period(struct dwc3 *dwc) reg |= FIELD_PREP(DWC3_GFLADJ_REFCLK_FLADJ_MASK, fladj) | FIELD_PREP(DWC3_GFLADJ_240MHZDECR, decr >> 1) | FIELD_PREP(DWC3_GFLADJ_240MHZDECR_PLS1, decr & 1); + + if (dwc->gfladj_refclk_lpm_sel) + reg |= DWC3_GFLADJ_REFCLK_LPM_SEL; + dwc3_writel(dwc->regs, DWC3_GFLADJ, reg); } @@ -788,7 +792,7 @@ static int dwc3_phy_setup(struct dwc3 *dwc) else reg |= DWC3_GUSB2PHYCFG_ENBLSLPM; - if (dwc->dis_u2_freeclk_exists_quirk) + if (dwc->dis_u2_freeclk_exists_quirk || dwc->gfladj_refclk_lpm_sel) reg &= ~DWC3_GUSB2PHYCFG_U2_FREECLK_EXISTS; dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg); @@ -1524,6 +1528,8 @@ static void dwc3_get_properties(struct dwc3 *dwc) "snps,dis-tx-ipgap-linecheck-quirk"); dwc->parkmode_disable_ss_quirk = device_property_read_bool(dev, "snps,parkmode-disable-ss-quirk"); + dwc->gfladj_refclk_lpm_sel = device_property_read_bool(dev, + "snps,gfladj-refclk-lpm-sel-quirk"); dwc->tx_de_emphasis_quirk = device_property_read_bool(dev, "snps,tx_de_emphasis_quirk"); diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 4fe4287dc934..11975a03316f 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -391,6 +391,7 @@ #define DWC3_GFLADJ_30MHZ_SDBND_SEL BIT(7) #define DWC3_GFLADJ_30MHZ_MASK 0x3f #define DWC3_GFLADJ_REFCLK_FLADJ_MASK GENMASK(21, 8) +#define DWC3_GFLADJ_REFCLK_LPM_SEL BIT(23) #define DWC3_GFLADJ_240MHZDECR GENMASK(30, 24) #define DWC3_GFLADJ_240MHZDECR_PLS1 BIT(31) @@ -1312,6 +1313,7 @@ struct dwc3 { unsigned dis_del_phy_power_chg_quirk:1; unsigned dis_tx_ipgap_linecheck_quirk:1; unsigned parkmode_disable_ss_quirk:1; + unsigned gfladj_refclk_lpm_sel:1; unsigned tx_de_emphasis_quirk:1; unsigned tx_de_emphasis:2; From patchwork Wed Oct 19 08:35: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: 5218 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp265257wrs; Wed, 19 Oct 2022 04:21:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM74NQMIZhm8ojQX8jyasC5R5ohNyupbni8caI/7agcXEzjXhGi9BS/7ZXsJ5c7IISa3IFps X-Received: by 2002:a63:2bd5:0:b0:434:ea9a:ace2 with SMTP id r204-20020a632bd5000000b00434ea9aace2mr6863735pgr.323.1666178519304; Wed, 19 Oct 2022 04:21:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178519; cv=none; d=google.com; s=arc-20160816; b=H8/dvdLggl0iGpKY0SuROpColBhHmpfiZiw2MX6qYNAy9RYG6/mUn6LC+tEVTykJDs ElPm2qXgXvo9iYq2lT4x+juejfCYp/rUYfvzd/U5y7EcIZmidQagUk1cV0BDgtu7qWAW ZbaigTgMiItAUiCRWssOo4ZS9yDJpfiIJEXWw90LHMDThxuBRS7onhV+c2Hy0nZULTXU 2iQAy6zik1JLzGyMqrhVVKsCluS/XVr5+1MpUbqI5FASAp1wy32DvtR+0i7JakfkdLGN WjQAxkqQMbelEvgOIqsXifQ9uhD23l2bVGlCEaW9uUj61kJ1pIJT7J9y30DXnIoSvipz u1TA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=P9FEvlzXnUZO9pw945StzvA9THjvTbq5LIbk5geMC/I=; b=BqP0XiVeXF9GH2cg+pNGJZgs9si8IEwSWt/aKLtihJYKSv9yuRHcVZqePFCOXtBF1m YRqsAkDgs273sEfnV5ZpYOjF0Qhyaiftn3ql4gvztMzd7So2h88XxzoEDos21nFsWZPb aTJaj8tOS68x0isBVBHGorAC56E6AmPTo3tn3AedoI67rZIfSHAXBT9UIql7PNca57ql cP2ZolfN/Hcr1qmZZ9GQsfdUpvEyQCocKOCv10KDFCu5PXqMUz3INCxMHnsvCcC5r8Pi 9N2bMu1JciEMfvHCNavd5qGNCsvjf8vlJfECpGhgvDEJT1YKns/I9/RA4hguIGeSDhdW 3Pjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Hv9DxJb1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d4-20020a170902854400b0017dafc02313si18018918plo.92.2022.10.19.04.21.44; Wed, 19 Oct 2022 04:21: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=Hv9DxJb1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230124AbiJSLMB (ORCPT + 99 others); Wed, 19 Oct 2022 07:12:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231899AbiJSLK6 (ORCPT ); Wed, 19 Oct 2022 07:10:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5BB797D49; Wed, 19 Oct 2022 03:38: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 232966181D; Wed, 19 Oct 2022 09:16:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34278C433D6; Wed, 19 Oct 2022 09:15:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170959; bh=kJSvmnCUKBpQQPrqgufgzZONMyHBxLReVpmGlZLzIHs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hv9DxJb1d9lentrVth9dWZ4Gh6mkvB1oZhJVr92TdgrEM/01DmtrZiaKlsi+DPGiI 3DWWhtpEd7vGjsQHN6ExUnBa+7PxzB64uGfIEKweUH+yKUbm1HyIlZSXtxFrphyM3e TxPrM4HsWEEnFYyoD0XOnOe3FYCOfW8UgaOFN7mA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Stein , Sasha Levin Subject: [PATCH 6.0 820/862] arm64: dts: imx8mp: Add snps,gfladj-refclk-lpm-sel quirk to USB nodes Date: Wed, 19 Oct 2022 10:35:07 +0200 Message-Id: <20221019083326.139759326@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114806878461194?= X-GMAIL-MSGID: =?utf-8?q?1747114806878461194?= From: Alexander Stein [ Upstream commit 5c3d5ecf48ab06c709c012bf1e8f0c91e1fcd7ad ] With this set the SOF/ITP counter is based on ref_clk when 2.0 ports are suspended. snps,dis-u2-freeclk-exists-quirk can be removed as snps,gfladj-refclk-lpm-sel also clears the free running clock configuration bit. Signed-off-by: Alexander Stein Link: https://lore.kernel.org/r/20220915062855.751881-4-alexander.stein@ew.tq-group.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- arch/arm64/boot/dts/freescale/imx8mp.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/freescale/imx8mp.dtsi b/arch/arm64/boot/dts/freescale/imx8mp.dtsi index fe178b7d063c..522ab47426c3 100644 --- a/arch/arm64/boot/dts/freescale/imx8mp.dtsi +++ b/arch/arm64/boot/dts/freescale/imx8mp.dtsi @@ -1189,7 +1189,7 @@ interrupts = ; phys = <&usb3_phy0>, <&usb3_phy0>; phy-names = "usb2-phy", "usb3-phy"; - snps,dis-u2-freeclk-exists-quirk; + snps,gfladj-refclk-lpm-sel-quirk; }; }; @@ -1231,7 +1231,7 @@ interrupts = ; phys = <&usb3_phy1>, <&usb3_phy1>; phy-names = "usb2-phy", "usb3-phy"; - snps,dis-u2-freeclk-exists-quirk; + snps,gfladj-refclk-lpm-sel-quirk; }; }; From patchwork Wed Oct 19 08:35: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: 5540 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp348458wrs; Wed, 19 Oct 2022 07:10:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6QxmFNhOToYazUqn6AWOErH7nmJckEJBH7UrBfo7cwSBhIoXA0D5NJQm300w0xhvS7kxtu X-Received: by 2002:a17:903:2346:b0:183:fffb:1bff with SMTP id c6-20020a170903234600b00183fffb1bffmr8756064plh.55.1666188609137; Wed, 19 Oct 2022 07:10:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666188609; cv=none; d=google.com; s=arc-20160816; b=P6y1Op9CqGox3gCDjCtb9iQvahz7KpUlYUjOlKFOzMKpx6yBC1vnYJqdDn67UQq0eD k5lDQJTnl5Ds56LmbFgoSVEcI5gLkfwoMbmGXn1MiV5R7+RfzMVHDlEuHSH6UB1FVaIk jTkuLBb8Vtscxx1Nivjtd/PSoZ0IVsbJJQm1+xr+O2eFkY2ho/u8XZUKCdBdGkL7tLIN +1dKHhdHs/9OqI0lojcLtgkg3Jiuntj6aCpbRP0gCLveU05jMjJtvivj32DdAoXZXBwH 4LxsHkNQ2NkEMUDtXlGeDhmE+scNeVMMIifaZZuEJ1tSWC9/pmOj8E1ockF2XKRDf3if g+QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZxsFFKr7JQuZ4NTCoPv36zAIT5+3z5sCqxV6YeB4iKI=; b=UJoioVV8L33NESK8tZgfP4EjiulWKnJoauM5bOdWWOAJPeEIdekiAXrcpCAKaHs9YQ CAFwSC4sC3aLAI+whzQv2gA7M40i/sit4rw85J7qghW544HSTgriU7t6bvW9H1O5GdTp WaeSstXU6Eb1y4w/WUOV4Fi2XB55LTG37D6MQA7PElFVCvoV2MQ63ccquqizH8yKVzba mgex2uPGxt7hJseLA/yDdCD3ranhV/XKcgkIc6ghFBEDaSyB01p39XkM3d+hLdX42dXo BTChvX8sXEFCErZGjlRn8/ae1DzKCVTCghzqt8012Hw+xbn/uHTVrLJKckQL9P9h5Giq GOXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ubxDk+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 e3-20020a170902ed8300b00183e5698836si16369513plj.189.2022.10.19.07.09.44; Wed, 19 Oct 2022 07:10: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=ubxDk+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 S232255AbiJSNwn (ORCPT + 99 others); Wed, 19 Oct 2022 09:52:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233729AbiJSNwG (ORCPT ); Wed, 19 Oct 2022 09:52:06 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F147C106E00; Wed, 19 Oct 2022 06:35: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 DB2C0CE2179; Wed, 19 Oct 2022 09:16:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC9B4C4314D; Wed, 19 Oct 2022 09:16:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170962; bh=1IB80J7gN/8BTd5cQPn7K1RP9SCIs8k6JUiLfMEL1mw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ubxDk+eBo/DlwGCslvszr9BRIX3QJye3+NRKSkbDsgU/4w4rl/2FH/JwDdYjleDAY JYFi+TcU5ia+WmhE4Cl/tsbpyjUjvmBAXsUAmjFlvDTqYBrdkMkvwO8lyUXk49jhgy JljiVRyixac+N8RpPIkVRcLpvReteqAlLzn4FW9s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Piyush Mehta , Sasha Levin Subject: [PATCH 6.0 821/862] usb: dwc3: core: Enable GUCTL1 bit 10 for fixing termination error after resume bug Date: Wed, 19 Oct 2022 10:35:08 +0200 Message-Id: <20221019083326.186968148@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747125387334390196?= X-GMAIL-MSGID: =?utf-8?q?1747125387334390196?= From: Piyush Mehta [ Upstream commit 63d7f9810a38102cdb8cad214fac98682081e1a7 ] When configured in HOST mode, after issuing U3/L2 exit controller fails to send proper CRC checksum in CRC5 field. Because of this behavior Transaction Error is generated, resulting in reset and re-enumeration of usb device attached. Enabling chicken bit 10 of GUCTL1 will correct this problem. When this bit is set to '1', the UTMI/ULPI opmode will be changed to "normal" along with HS terminations, term, and xcvr signals after EOR. This option is to support certain legacy UTMI/ULPI PHYs. Added "snps,resume-hs-terminations" quirk to resolved the above issue. Signed-off-by: Piyush Mehta Link: https://lore.kernel.org/r/20220920052235.194272-3-piyush.mehta@amd.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/dwc3/core.c | 17 +++++++++++++++++ drivers/usb/dwc3/core.h | 4 ++++ 2 files changed, 21 insertions(+) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index f7f1952b2901..68d986361c49 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -1183,6 +1183,21 @@ static int dwc3_core_init(struct dwc3 *dwc) dwc3_writel(dwc->regs, DWC3_GUCTL2, reg); } + /* + * When configured in HOST mode, after issuing U3/L2 exit controller + * fails to send proper CRC checksum in CRC5 feild. Because of this + * behaviour Transaction Error is generated, resulting in reset and + * re-enumeration of usb device attached. All the termsel, xcvrsel, + * opmode becomes 0 during end of resume. Enabling bit 10 of GUCTL1 + * will correct this problem. This option is to support certain + * legacy ULPI PHYs. + */ + if (dwc->resume_hs_terminations) { + reg = dwc3_readl(dwc->regs, DWC3_GUCTL1); + reg |= DWC3_GUCTL1_RESUME_OPMODE_HS_HOST; + dwc3_writel(dwc->regs, DWC3_GUCTL1, reg); + } + if (!DWC3_VER_IS_PRIOR(DWC3, 250A)) { reg = dwc3_readl(dwc->regs, DWC3_GUCTL1); @@ -1526,6 +1541,8 @@ static void dwc3_get_properties(struct dwc3 *dwc) "snps,dis-del-phy-power-chg-quirk"); dwc->dis_tx_ipgap_linecheck_quirk = device_property_read_bool(dev, "snps,dis-tx-ipgap-linecheck-quirk"); + dwc->resume_hs_terminations = device_property_read_bool(dev, + "snps,resume-hs-terminations"); dwc->parkmode_disable_ss_quirk = device_property_read_bool(dev, "snps,parkmode-disable-ss-quirk"); dwc->gfladj_refclk_lpm_sel = device_property_read_bool(dev, diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 11975a03316f..3ac9313e66f9 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -263,6 +263,7 @@ #define DWC3_GUCTL1_DEV_FORCE_20_CLK_FOR_30_CLK BIT(26) #define DWC3_GUCTL1_DEV_L1_EXIT_BY_HW BIT(24) #define DWC3_GUCTL1_PARKMODE_DISABLE_SS BIT(17) +#define DWC3_GUCTL1_RESUME_OPMODE_HS_HOST BIT(10) /* Global Status Register */ #define DWC3_GSTS_OTG_IP BIT(10) @@ -1097,6 +1098,8 @@ struct dwc3_scratchpad_array { * change quirk. * @dis_tx_ipgap_linecheck_quirk: set if we disable u2mac linestate * check during HS transmit. + * @resume-hs-terminations: Set if we enable quirk for fixing improper crc + * generation after resume from suspend. * @parkmode_disable_ss_quirk: set if we need to disable all SuperSpeed * instances in park mode. * @tx_de_emphasis_quirk: set if we enable Tx de-emphasis quirk @@ -1312,6 +1315,7 @@ struct dwc3 { unsigned dis_u2_freeclk_exists_quirk:1; unsigned dis_del_phy_power_chg_quirk:1; unsigned dis_tx_ipgap_linecheck_quirk:1; + unsigned resume_hs_terminations:1; unsigned parkmode_disable_ss_quirk:1; unsigned gfladj_refclk_lpm_sel:1; From patchwork Wed Oct 19 08:35: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: 5486 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp334000wrs; Wed, 19 Oct 2022 06:42:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM62q3DEdwt0kzTKjxSlp0GU9TctkLK7a5Bs3eaBEaigW3C7ZIxto5EKlw+aLGpGktVd6G4d X-Received: by 2002:a17:906:9752:b0:78d:d2e1:d745 with SMTP id o18-20020a170906975200b0078dd2e1d745mr6705273ejy.452.1666186919822; Wed, 19 Oct 2022 06:41:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666186919; cv=none; d=google.com; s=arc-20160816; b=a5OJts97hscfUEYevVYbNFlwhbJCLZ5LokFWnggV235pnO6eZoTSeQUJIL2nGuanKD 2ZeBi6Y4eytoVMArF2TDuQZha5a84jqk4QlF5nxXfaqRFlOYy2bNqsXI928kXIH+jflG 7BsMWSIDX8QNVYPPVWcZG+eKFCLt1wLep9UEjNKJibg2i24ETQONb96udaQXf2ifETnF kXWYVQZQS5X/hn8SQT6Y/508pcgA+qTx/xsfpYPedsTSSgBh10uEkDFYHCJCY6l8iI0Q Q3hDYEaS2QIfzv64C1AlYlgsKDa3MMvDOUC22UPK60ePecJv1GzQESH2m4JdCemt9ohD JwvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xJQEd/tw+5bihUtS8xNDx4uOCFTFc7l87/IjfaVZf1w=; b=hirLuW7qj0zwmmjdyHxwx65lqxzThN6L7swMIvrkjxXgk2BJPx0++DsN/MxpNBhPlL PmfW+3YHFispeHALJht7Hxhe99lMBGM/wpvoq/9xuel0MNmo21lCKH49BM9f+q0RRa+U MxbkiesTD96/GI7brVWkmwXLC1PuJH8JsSWk9+vhWtFUPSnWYXva9PowPMz/midi0YYd vwVkcrl8lLLABnRq65Sm6XGYHgD+WcG4brPR5gsVuqF6cdfZBtLUfAqXyIMlMg+sIYWE e1OVuA9jOlKSUxRogWPhX2V34BLABGbquFzIZy+vzp19YPTpEvn1dfla/152HUqMIBEa xq+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Uz5CIb8C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r7-20020a05640251c700b0045d4f995ac0si12457351edd.588.2022.10.19.06.41.33; Wed, 19 Oct 2022 06:41: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=Uz5CIb8C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232630AbiJSNhn (ORCPT + 99 others); Wed, 19 Oct 2022 09:37:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232311AbiJSNgo (ORCPT ); Wed, 19 Oct 2022 09:36:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3F881633B3; Wed, 19 Oct 2022 06:25: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 E2EC9B824EC; Wed, 19 Oct 2022 09:16:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 52F35C433C1; Wed, 19 Oct 2022 09:16:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170964; bh=6vbKmmz0ryFxKZLGyy2yrARzgTOezGzvxGBhsplRrh8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Uz5CIb8CLGxofcZm65WllZlfFB0iRtpIBlYGhHEuqCzyrfJOXdfeaGIO5VMTwspqE 235mQUwRTHakFhNnDFiDlMM4UbyXOQc47y+nDi4ZBgD+5C++ol++yhHXlN3db2MEKV rqxkAMrJRNVnhszHfJo7EYksyvaVHYl1Pe/otJkw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, sunghwan jung , Sasha Levin Subject: [PATCH 6.0 822/862] Revert "usb: storage: Add quirk for Samsung Fit flash" Date: Wed, 19 Oct 2022 10:35:09 +0200 Message-Id: <20221019083326.232981997@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123615409036663?= X-GMAIL-MSGID: =?utf-8?q?1747123615409036663?= 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 4993227ab293..20dcbccb290b 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h @@ -1275,12 +1275,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 Wed Oct 19 08:35: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: 4991 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp227451wrs; Wed, 19 Oct 2022 02:48:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5T53D/Y+Cv+NBB6lg4YVIbhs+V7NwJuUVa2C5NuDk26PGHYHB+pSBxuVNK0iCsBci640m8 X-Received: by 2002:a17:907:3205:b0:770:8554:c4ee with SMTP id xg5-20020a170907320500b007708554c4eemr6024573ejb.39.1666172935603; Wed, 19 Oct 2022 02:48:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172935; cv=none; d=google.com; s=arc-20160816; b=mMfa3s4DB54pZrg22qyKdZuc5FPFQP/bH0zx2p677xSgesKWeH8WTDFNYCcIS4tDMC 2P4euZYwbU7lWcLwlOEGe7YR2ILvBg8auoUp3ZBNY3smQGyHvmy0ioKZwAq3+Ntxd1A2 P3I+xf4wqaSXKvLwLXT9SICpWdHc6cPUDvPCvGsh0mZQBPOrIvpnicJNRuJAn5MTXBLF 0TNQoIBR96FiNJrHC30Doi+XoUzTdBYfBsoEuIqOv/2pzNBy3Nd04JEgcai43tM0dzjs FBOA2HcL/gV9sktyJz1WR84/ZHJUDSYRPYf1SVcGop+MMeWEaX2d/NYKAg6Vti3/bcMr jDhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FvUb1ND+KWCa96sbn/UifRieQjbaVtLTcllfw6ZtSTQ=; b=e5N7V7snc39dc8hZGhCH7hnQ2P9W0+YoKsFU8u4VAxBvCxrmc0/kQE4DJ+qKd1jqNn /NId7oQdleVj1MZ3TimZmkvL5FR+joxafyt6Z5WpuIEinQIN3lFZwc+BmVGz0NnjQQF8 1PrNA+1fQC3UOo2toMDwAYH1+gBHUUgyoCxBrKhmP1vD9Cl/51rppLgEXa24P9utopMr etkXFKTryvrUkSeqUi30AfdP1kg3nUzq7TkG9xoGAKOgVte49TUuxERY5mdsC4DMlt3l jXU1MbqzMXWr3FtBelvWCQ2Gpxzt0/lBs/fy905OesHIZnPvQF6z1XqAYiLgj5ikLY7F iiMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HwxNMlfG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s5-20020a170906500500b0078255525a6fsi12646809ejj.671.2022.10.19.02.48.29; Wed, 19 Oct 2022 02:48: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=HwxNMlfG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234405AbiJSJnv (ORCPT + 99 others); Wed, 19 Oct 2022 05:43:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234499AbiJSJkf (ORCPT ); Wed, 19 Oct 2022 05:40:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8857EEA8B; Wed, 19 Oct 2022 02:16: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 B82D761824; Wed, 19 Oct 2022 09:16:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D21C2C433C1; Wed, 19 Oct 2022 09:16:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170967; bh=I4JT3s3BD2qLmN9713tI7x6k8PdkiCBRxTyGCGLdTEU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HwxNMlfGUg85JC9E1XoM6Vo24fEbsa/YwwD3R025KDkk2FcKpICnMyJ+e8wJy9ja6 vYfCBuDHOnAFA3SGmf6+AsfQbIKeMP0TXkrtbeDcg3/DpeWI1uy5LI2p427/o4hk3W sZD7QgQgZT/2+mEdDCLYHefDAh7tzrzVGjp3vkm0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dylan Yudaken , Pavel Begunkov , Jens Axboe , Sasha Levin Subject: [PATCH 6.0 823/862] io_uring: fix CQE reordering Date: Wed, 19 Oct 2022 10:35:10 +0200 Message-Id: <20221019083326.281411913@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108951892454876?= X-GMAIL-MSGID: =?utf-8?q?1747108951892454876?= From: Pavel Begunkov [ Upstream commit aa1df3a360a0c50e0f0086a785d75c2785c29967 ] Overflowing CQEs may result in reordering, which is buggy in case of links, F_MORE and so on. If we guarantee that we don't reorder for the unlikely event of a CQ ring overflow, then we can further extend this to not have to terminate multishot requests if it happens. For other operations, like zerocopy sends, we have no choice but to honor CQE ordering. Reported-by: Dylan Yudaken Signed-off-by: Pavel Begunkov Link: https://lore.kernel.org/r/ec3bc55687b0768bbe20fb62d7d06cfced7d7e70.1663892031.git.asml.silence@gmail.com Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- io_uring/io_uring.c | 12 ++++++++++-- io_uring/io_uring.h | 12 +++++++++--- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index a22a32acf590..c5dd483a7de2 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -567,7 +567,7 @@ static bool __io_cqring_overflow_flush(struct io_ring_ctx *ctx, bool force) io_cq_lock(ctx); while (!list_empty(&ctx->cq_overflow_list)) { - struct io_uring_cqe *cqe = io_get_cqe(ctx); + struct io_uring_cqe *cqe = io_get_cqe_overflow(ctx, true); struct io_overflow_cqe *ocqe; if (!cqe && !force) @@ -694,12 +694,19 @@ bool io_req_cqe_overflow(struct io_kiocb *req) * control dependency is enough as we're using WRITE_ONCE to * fill the cq entry */ -struct io_uring_cqe *__io_get_cqe(struct io_ring_ctx *ctx) +struct io_uring_cqe *__io_get_cqe(struct io_ring_ctx *ctx, bool overflow) { struct io_rings *rings = ctx->rings; unsigned int off = ctx->cached_cq_tail & (ctx->cq_entries - 1); unsigned int free, queued, len; + /* + * Posting into the CQ when there are pending overflowed CQEs may break + * ordering guarantees, which will affect links, F_MORE users and more. + * Force overflow the completion. + */ + if (!overflow && (ctx->check_cq & BIT(IO_CHECK_CQ_OVERFLOW_BIT))) + return NULL; /* userspace may cheat modifying the tail, be safe and do min */ queued = min(__io_cqring_events(ctx), ctx->cq_entries); @@ -2232,6 +2239,7 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events, do { io_cqring_overflow_flush(ctx); + if (io_cqring_events(ctx) >= min_events) return 0; if (!io_run_task_work()) diff --git a/io_uring/io_uring.h b/io_uring/io_uring.h index 2f73f83af960..45809ae6f64e 100644 --- a/io_uring/io_uring.h +++ b/io_uring/io_uring.h @@ -24,7 +24,7 @@ enum { IOU_STOP_MULTISHOT = -ECANCELED, }; -struct io_uring_cqe *__io_get_cqe(struct io_ring_ctx *ctx); +struct io_uring_cqe *__io_get_cqe(struct io_ring_ctx *ctx, bool overflow); bool io_req_cqe_overflow(struct io_kiocb *req); int io_run_task_work_sig(void); void io_req_complete_failed(struct io_kiocb *req, s32 res); @@ -91,7 +91,8 @@ static inline void io_cq_lock(struct io_ring_ctx *ctx) void io_cq_unlock_post(struct io_ring_ctx *ctx); -static inline struct io_uring_cqe *io_get_cqe(struct io_ring_ctx *ctx) +static inline struct io_uring_cqe *io_get_cqe_overflow(struct io_ring_ctx *ctx, + bool overflow) { if (likely(ctx->cqe_cached < ctx->cqe_sentinel)) { struct io_uring_cqe *cqe = ctx->cqe_cached; @@ -103,7 +104,12 @@ static inline struct io_uring_cqe *io_get_cqe(struct io_ring_ctx *ctx) return cqe; } - return __io_get_cqe(ctx); + return __io_get_cqe(ctx, overflow); +} + +static inline struct io_uring_cqe *io_get_cqe(struct io_ring_ctx *ctx) +{ + return io_get_cqe_overflow(ctx, false); } static inline bool __io_fill_cqe_req(struct io_ring_ctx *ctx, From patchwork Wed Oct 19 08:35: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: 5482 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp333406wrs; Wed, 19 Oct 2022 06:40:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ShdxZUkV9MS6OtlPXwrUwwTYKtyRfr6LIUXuRDRllz2TrO9Wl9Nhw+CDrB5plmHFF+dyT X-Received: by 2002:a17:907:c0e:b0:78d:f865:28b2 with SMTP id ga14-20020a1709070c0e00b0078df86528b2mr6727405ejc.179.1666186847367; Wed, 19 Oct 2022 06:40:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666186847; cv=none; d=google.com; s=arc-20160816; b=NuZRgQD36EIGj3/181AQcKqc0rVp45cOCrTLoerD2Zvi2SMGxTEWYfPz6dUJ3ytID+ qVmXOilSGlY7rOpyWkrNAFCfj90rtjdt4gWX3zehEUsPSZPj5C+77Ll1OA3WErdwDyYC mGzUx/Us7Aq6FXIbqjtQ2iy92aPR93Cn7Qtn0TwjuGqN92TO5bzTplWUFaNTw6WGJpoZ eh5Ns7D3jv5BDV3ug1zI5UlbSzqmQIEl/7TpKrgsvct9NudH/G494sx5te2vnA9X5ltr DnsGT/Qb+KwWMrUlzCvxRE99wUwQVELNc+9oq4vV2SUVaUPcg0FtdPHIDtQ+mRBlnKga VNVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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+BsHAJRDvz5QiRCJsFRXVtWVLW/Kh41cNxu5ogLHtc=; b=FIrlxqfZ+2YkTICF1XSeHotR6lwa29yoEPZLWYZSglA06wWYNiNJu9ilbwcXbgWwOf 7Sclf0U6HqNi8PBeynMSssL83l4VJLpO4E4Sb7MogZpE7m825qxFnekoW5kWVYgh/KZ3 cbwrEeNvwojmOhMEwcNARURyATG760yQLyGsqX5uYalrGzLZy17RgeLXgtrpLzLtELmw z+afPTJy8C7S1XHG4BMDlrvPb4R398eIPdwyfp1WJcLw3SE3L/m7UX1R2APxA+fmBAgO NQWadCwxk7tcM3BvlmsfTLOD4iuY69J/Rw4uN9uZR/WCEos9+7mqctZDnYPg5+j5UrRy 2rLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YNYQegpz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o11-20020a170906974b00b0079330b37fb5si1030097ejy.564.2022.10.19.06.40.22; Wed, 19 Oct 2022 06:40: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=YNYQegpz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232546AbiJSNhY (ORCPT + 99 others); Wed, 19 Oct 2022 09:37:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232058AbiJSNgi (ORCPT ); Wed, 19 Oct 2022 09:36:38 -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 2855C18B4B5; Wed, 19 Oct 2022 06:25: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 073EDB824F0; Wed, 19 Oct 2022 09:16:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 687F9C433D6; Wed, 19 Oct 2022 09:16:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170969; bh=v54vnW+bX4cKUN2tJYHQtuvmIGDk0z24Qkca/Gc9l6g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YNYQegpzo/M1LWT5tIeUpfFyWcR5/pKbOskirTQJ5pDxFfjw7qnHExgRRfZC+6kXk IIdA1uxXEoEr4G1QLub463cWZ7qs3WDYj8Q7vMs/BCUEGJvTGgGZAmkZadrCLn6rCE 9k/oYnCC4MQ/noSVlddJ9flJUChSRbNyx3xbzrBQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiaoke Wang , Sasha Levin Subject: [PATCH 6.0 824/862] staging: rtl8723bs: fix potential memory leak in rtw_init_drv_sw() Date: Wed, 19 Oct 2022 10:35:11 +0200 Message-Id: <20221019083326.330272358@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123539937570687?= X-GMAIL-MSGID: =?utf-8?q?1747123539937570687?= From: Xiaoke Wang [ Upstream commit 5a5aa9cce621e2c0e25a1e5d72d6be1749167cc0 ] In rtw_init_drv_sw(), there are various init functions are called to populate the padapter structure and some checks for their return value. However, except for the first one error path, the other five error paths do not properly release the previous allocated resources, which leads to various memory leaks. This patch fixes them and keeps the success and error separate. Note that these changes keep the form of `rtw_init_drv_sw()` in "drivers/staging/r8188eu/os_dep/os_intfs.c". As there is no proper device to test with, no runtime testing was performed. Signed-off-by: Xiaoke Wang Link: https://lore.kernel.org/r/tencent_C3B899D2FC3F1BC827F3552E0B0734056006@qq.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/staging/rtl8723bs/os_dep/os_intfs.c | 60 +++++++++++---------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/drivers/staging/rtl8723bs/os_dep/os_intfs.c b/drivers/staging/rtl8723bs/os_dep/os_intfs.c index 380d8c9e1239..68bba3c0e757 100644 --- a/drivers/staging/rtl8723bs/os_dep/os_intfs.c +++ b/drivers/staging/rtl8723bs/os_dep/os_intfs.c @@ -664,51 +664,36 @@ void rtw_reset_drv_sw(struct adapter *padapter) u8 rtw_init_drv_sw(struct adapter *padapter) { - u8 ret8 = _SUCCESS; - rtw_init_default_value(padapter); rtw_init_hal_com_default_value(padapter); - if (rtw_init_cmd_priv(&padapter->cmdpriv)) { - ret8 = _FAIL; - goto exit; - } + if (rtw_init_cmd_priv(&padapter->cmdpriv)) + return _FAIL; padapter->cmdpriv.padapter = padapter; - if (rtw_init_evt_priv(&padapter->evtpriv)) { - ret8 = _FAIL; - goto exit; - } + if (rtw_init_evt_priv(&padapter->evtpriv)) + goto free_cmd_priv; - - if (rtw_init_mlme_priv(padapter) == _FAIL) { - ret8 = _FAIL; - goto exit; - } + if (rtw_init_mlme_priv(padapter) == _FAIL) + goto free_evt_priv; init_mlme_ext_priv(padapter); - if (_rtw_init_xmit_priv(&padapter->xmitpriv, padapter) == _FAIL) { - ret8 = _FAIL; - goto exit; - } + if (_rtw_init_xmit_priv(&padapter->xmitpriv, padapter) == _FAIL) + goto free_mlme_ext; - if (_rtw_init_recv_priv(&padapter->recvpriv, padapter) == _FAIL) { - ret8 = _FAIL; - goto exit; - } + if (_rtw_init_recv_priv(&padapter->recvpriv, padapter) == _FAIL) + goto free_xmit_priv; /* add for CONFIG_IEEE80211W, none 11w also can use */ spin_lock_init(&padapter->security_key_mutex); /* We don't need to memset padapter->XXX to zero, because adapter is allocated by vzalloc(). */ /* memset((unsigned char *)&padapter->securitypriv, 0, sizeof (struct security_priv)); */ - if (_rtw_init_sta_priv(&padapter->stapriv) == _FAIL) { - ret8 = _FAIL; - goto exit; - } + if (_rtw_init_sta_priv(&padapter->stapriv) == _FAIL) + goto free_recv_priv; padapter->stapriv.padapter = padapter; padapter->setband = GHZ24_50; @@ -719,9 +704,26 @@ u8 rtw_init_drv_sw(struct adapter *padapter) rtw_hal_dm_init(padapter); -exit: + return _SUCCESS; + +free_recv_priv: + _rtw_free_recv_priv(&padapter->recvpriv); + +free_xmit_priv: + _rtw_free_xmit_priv(&padapter->xmitpriv); + +free_mlme_ext: + free_mlme_ext_priv(&padapter->mlmeextpriv); - return ret8; + rtw_free_mlme_priv(&padapter->mlmepriv); + +free_evt_priv: + rtw_free_evt_priv(&padapter->evtpriv); + +free_cmd_priv: + rtw_free_cmd_priv(&padapter->cmdpriv); + + return _FAIL; } void rtw_cancel_all_timer(struct adapter *padapter) From patchwork Wed Oct 19 08:35: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: 5008 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp244373wrs; Wed, 19 Oct 2022 03:32:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7rXbULRvHAx+UPRDISnMpaMFvqLWZBsZ7aE3BnUow2pHAYG3u4PU487TDjFs221m1biEW1 X-Received: by 2002:a05:6402:40c4:b0:45c:c718:54d1 with SMTP id z4-20020a05640240c400b0045cc71854d1mr6757851edb.319.1666175572103; Wed, 19 Oct 2022 03:32:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666175572; cv=none; d=google.com; s=arc-20160816; b=GbIu/zXY5oSPh7MSsnWCHdgX71kUqGsFhz6Q9MI8XuhjN7uopdK96pnnSVCauPcPel ahc1KFpxU/ZTd6RskfgB/dGs3r9/65vF5icd+3bbGAMiQgaeXJIr70j8vyrbCxfbk3F1 AzuuH5PJ5aOBunEfmflZ4dfEkLbe6PztU/NXqwf3ZwoaM2Y8BGYKgoWA93CqM4KjMNHK ZaUVVBV+poMSHeC8gNXaA4wAM7qGtN4secUNQ2kiEg1vZ3OMJRLI2qY8iai+MESWR++l 4+ca65iIMW28KeqNAfvN8wXw8SK9lyJaZDOli3mvCs5bIvu0vrj/JGOAQwrxzBkX3Rn4 cv8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sWvH+VtmPoJG7mrgB6m66v6mI7zgSRonMny6Q5/Knok=; b=D/PJuXR1MAjPMv18YqnkOPuNcxRlRPOt4Lj6zcyPWENvJJ7FZChz8GfGlCa7TW8kJi ozeMx0Lpdh8B42JZ0UkyiLdlHw7LHNm/t9b0keH9FyrKMBoaMCpKzs3kkBGlem/kV9XP ljHw0ADu0MF5ydzELBdrvIx2rWJIlP7w3fBSzxhmsDzHDke6/lUknEZBJTicnXn5eAR4 AzB/KNURqHOpGtjd4yX1atHBp3TAw5fQyxj9th7+qA1F9l+skOyo3rUSSuAObiRisYmR DdeBD5dVwy/+J1YowjRr0rhLcUwahM3J6R+RSKnUZV5vmyy0mf3OLAj/T0ltWQQwPYtj DVrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2wfKpETb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id tx7-20020a1709078e8700b00783b75ec298si12533805ejc.395.2022.10.19.03.32.11; Wed, 19 Oct 2022 03:32: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=2wfKpETb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232284AbiJSKEb (ORCPT + 99 others); Wed, 19 Oct 2022 06:04:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234507AbiJSKEA (ORCPT ); Wed, 19 Oct 2022 06:04:00 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C22996254; Wed, 19 Oct 2022 02:42: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 sin.source.kernel.org (Postfix) with ESMTPS id 1FC44CE21C5; Wed, 19 Oct 2022 09:14:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1FF8AC433D6; Wed, 19 Oct 2022 09:14:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170887; bh=lDR61PbfI7H5eQX4Ti6CnNOBp3xkPZ74M3x0TE5CuNE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2wfKpETbz7tWxeZvVao5VF3EXT4YvGD5DbtsMwIpkVLF6Nx5ZOrSxvWc6aVvGpXIF T6Of2oIWncFfGr1BjNy33+zFqyMVLtNTgWK5cB9CHPhgQ92X4HZsOCWeB6TSHPOWn4 WDwUlC1ulf4cKw0GRqR48sZzPtv32J1aw31ru0VQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiaoke Wang , Sasha Levin Subject: [PATCH 6.0 825/862] staging: rtl8723bs: fix a potential memory leak in rtw_init_cmd_priv() Date: Wed, 19 Oct 2022 10:35:12 +0200 Message-Id: <20221019083326.363842288@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747111716631243844?= X-GMAIL-MSGID: =?utf-8?q?1747111716631243844?= From: Xiaoke Wang [ Upstream commit 708056fba733a73d926772ea4ce9a42d240345da ] In rtw_init_cmd_priv(), if `pcmdpriv->rsp_allocated_buf` is allocated in failure, then `pcmdpriv->cmd_allocated_buf` will be not properly released. Besides, considering there are only two error paths and the first one can directly return, so we do not need implicitly jump to the `exit` tag to execute the error handler. So this patch added `kfree(pcmdpriv->cmd_allocated_buf);` on the error path to release the resource and simplified the return logic of rtw_init_cmd_priv(). As there is no proper device to test with, no runtime testing was performed. Signed-off-by: Xiaoke Wang Link: https://lore.kernel.org/r/tencent_2B7931B79BA38E22205C5A09EFDF11E48805@qq.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/staging/rtl8723bs/core/rtw_cmd.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c index b4170f64d118..03c2c66dbf66 100644 --- a/drivers/staging/rtl8723bs/core/rtw_cmd.c +++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c @@ -161,8 +161,6 @@ static struct cmd_hdl wlancmds[] = { int rtw_init_cmd_priv(struct cmd_priv *pcmdpriv) { - int res = 0; - init_completion(&pcmdpriv->cmd_queue_comp); init_completion(&pcmdpriv->terminate_cmdthread_comp); @@ -175,18 +173,16 @@ int rtw_init_cmd_priv(struct cmd_priv *pcmdpriv) pcmdpriv->cmd_allocated_buf = rtw_zmalloc(MAX_CMDSZ + CMDBUFF_ALIGN_SZ); - if (!pcmdpriv->cmd_allocated_buf) { - res = -ENOMEM; - goto exit; - } + if (!pcmdpriv->cmd_allocated_buf) + return -ENOMEM; pcmdpriv->cmd_buf = pcmdpriv->cmd_allocated_buf + CMDBUFF_ALIGN_SZ - ((SIZE_PTR)(pcmdpriv->cmd_allocated_buf) & (CMDBUFF_ALIGN_SZ-1)); pcmdpriv->rsp_allocated_buf = rtw_zmalloc(MAX_RSPSZ + 4); if (!pcmdpriv->rsp_allocated_buf) { - res = -ENOMEM; - goto exit; + kfree(pcmdpriv->cmd_allocated_buf); + return -ENOMEM; } pcmdpriv->rsp_buf = pcmdpriv->rsp_allocated_buf + 4 - ((SIZE_PTR)(pcmdpriv->rsp_allocated_buf) & 3); @@ -196,8 +192,8 @@ int rtw_init_cmd_priv(struct cmd_priv *pcmdpriv) pcmdpriv->rsp_cnt = 0; mutex_init(&pcmdpriv->sctx_mutex); -exit: - return res; + + return 0; } static void c2h_wk_callback(struct work_struct *work); From patchwork Wed Oct 19 08:35: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: 4996 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp228367wrs; Wed, 19 Oct 2022 02:51:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7F9V7ChXMSK2Zt+n8K60drOoXniw6CF/y9FWuGx0lAUTq6Nw+Lo2r+KgKf1tC9yUU8304j X-Received: by 2002:a05:6402:150a:b0:459:2575:99c6 with SMTP id f10-20020a056402150a00b00459257599c6mr6631662edw.231.1666173115689; Wed, 19 Oct 2022 02:51:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666173115; cv=none; d=google.com; s=arc-20160816; b=fUuYtgKIfcrUIbLQe3HskuJjR14K3prxlOb+FlYtmzvmqcATHlwNj98ZLMHNJpPP3Z wmA4JZjt6hejxfhnVii7WHO9YxDF2UGoCh/KaKVjNCI3sq2rX4XH++SduMCqKPQwWKDQ dk2GJWGFLDRzQTW1XBDfFH4xq81DR9RqlqGET2maAXIYJ8fcIPlaX9K5g1RLraQFr4wT 5RTb4uUiWE4Qe/KDeBlVay1l6apPJ7y4o8KR4MPYMKGJe2WbMZAtmVE61nfIsrz59Z6J h6pOR44/Hry0zBhQuZtgvYpd+JSsEXQRuRo/GvECCo/3Qh0DqJ+KA7q6QVC6IOH2TKCW xtKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=aCrVrmCgsXg/0gj68/SN/ZZ8DR1FtDZ1Blrqf3dGLX8=; b=ocpxcY1MH1ivZPzJ9W9imkEqe3GXXi1wRemk0uf5jgcHPvIdhnA/1kR9Txn/cH5JH9 tUF/9FMHPR3LoH2e45XE7F2NwY11QWXrZnjMqENCoFNRQUOL5MKuoSDa57ce7zydNYVm E8kzgCPphXI0/gzMAMTHkbRmvYz/ARYU2ymqAnEYdas4S5LvWNospP4JPKiitAenpOgq reatgOkyTMH5OknIlkoem2eQaA2N00+c6CqlX8+4bRNudZ6S9W/cIXoRhDutXCWKVhGu W4RS13ldZIJ9EssPSiwFwFysfpHQgBUWHcvU49tjRMac6xH34Woo/+U0unZIk+3uIDAC DtmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZqwEmFOa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hs21-20020a1709073e9500b0073d8b93700csi14202847ejc.165.2022.10.19.02.51.30; Wed, 19 Oct 2022 02: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=ZqwEmFOa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234301AbiJSJpb (ORCPT + 99 others); Wed, 19 Oct 2022 05:45:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234237AbiJSJj0 (ORCPT ); Wed, 19 Oct 2022 05:39:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17F8CEE0B6; Wed, 19 Oct 2022 02:16: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 94B3B61750; Wed, 19 Oct 2022 09:14:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC9A4C433D6; Wed, 19 Oct 2022 09:14:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170890; bh=AovMnUVFaDgnuucVmCvW2YnL6/FL1thsQNXgFxRaPiw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZqwEmFOaz8ofhCSS8VEJVXc2HlICKVOBTSxc+71SsZw5yQ/Iasmjsl3nrp444EzA/ v4D6OApHYLschNKZl2adGHm3e8D49yGusSJSTw+36te5umqXeugOK/n/X/ZvH3AhP9 WicW6ONDObuPzlsh8+THo46VjiHRmYlM+qtbHbOE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , "Steven Rostedt (Google)" , Arun Easi , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 6.0 826/862] scsi: tracing: Fix compile error in trace_array calls when TRACING is disabled Date: Wed, 19 Oct 2022 10:35:13 +0200 Message-Id: <20221019083326.403995743@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747109140869944468?= X-GMAIL-MSGID: =?utf-8?q?1747109140869944468?= From: Arun Easi [ Upstream commit 1a77dd1c2bb5d4a58c16d198cf593720787c02e4 ] Fix this compilation error seen when CONFIG_TRACING is not enabled: drivers/scsi/qla2xxx/qla_os.c: In function 'qla_trace_init': drivers/scsi/qla2xxx/qla_os.c:2854:25: error: implicit declaration of function 'trace_array_get_by_name'; did you mean 'trace_array_set_clr_event'? [-Werror=implicit-function-declaration] 2854 | qla_trc_array = trace_array_get_by_name("qla2xxx"); | ^~~~~~~~~~~~~~~~~~~~~~~ | trace_array_set_clr_event drivers/scsi/qla2xxx/qla_os.c: In function 'qla_trace_uninit': drivers/scsi/qla2xxx/qla_os.c:2869:9: error: implicit declaration of function 'trace_array_put' [-Werror=implicit-function-declaration] 2869 | trace_array_put(qla_trc_array); | ^~~~~~~~~~~~~~~ Link: https://lore.kernel.org/r/20220907233308.4153-2-aeasi@marvell.com Reported-by: kernel test robot Reviewed-by: Steven Rostedt (Google) Signed-off-by: Arun Easi Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- include/linux/trace.h | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/include/linux/trace.h b/include/linux/trace.h index bf169612ffe1..b5e16e438448 100644 --- a/include/linux/trace.h +++ b/include/linux/trace.h @@ -2,8 +2,6 @@ #ifndef _LINUX_TRACE_H #define _LINUX_TRACE_H -#ifdef CONFIG_TRACING - #define TRACE_EXPORT_FUNCTION BIT(0) #define TRACE_EXPORT_EVENT BIT(1) #define TRACE_EXPORT_MARKER BIT(2) @@ -28,6 +26,8 @@ struct trace_export { int flags; }; +#ifdef CONFIG_TRACING + int register_ftrace_export(struct trace_export *export); int unregister_ftrace_export(struct trace_export *export); @@ -48,6 +48,38 @@ void osnoise_arch_unregister(void); void osnoise_trace_irq_entry(int id); void osnoise_trace_irq_exit(int id, const char *desc); +#else /* CONFIG_TRACING */ +static inline int register_ftrace_export(struct trace_export *export) +{ + return -EINVAL; +} +static inline int unregister_ftrace_export(struct trace_export *export) +{ + return 0; +} +static inline void trace_printk_init_buffers(void) +{ +} +static inline int trace_array_printk(struct trace_array *tr, unsigned long ip, + const char *fmt, ...) +{ + return 0; +} +static inline int trace_array_init_printk(struct trace_array *tr) +{ + return -EINVAL; +} +static inline void trace_array_put(struct trace_array *tr) +{ +} +static inline struct trace_array *trace_array_get_by_name(const char *name) +{ + return NULL; +} +static inline int trace_array_destroy(struct trace_array *tr) +{ + return 0; +} #endif /* CONFIG_TRACING */ #endif /* _LINUX_TRACE_H */ From patchwork Wed Oct 19 08:35: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: 5054 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp247894wrs; Wed, 19 Oct 2022 03:42:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4u3wQQRPzCLIURtOs3PLghnbmgo7mqmh+6+1v08tM3teMib8plt1uAMTJVf7kIXft9HQE8 X-Received: by 2002:a17:907:2672:b0:734:a952:439a with SMTP id ci18-20020a170907267200b00734a952439amr5742464ejc.539.1666176127095; Wed, 19 Oct 2022 03:42:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176127; cv=none; d=google.com; s=arc-20160816; b=Bikahr6MJTT2YxtrFzm1YopNsChrJJz0t7UBTCOeLb/9Lel5kO/gt5KwmOTdXPHogc xX2B6Qu5LJ+ra1O3J82SknDBAkVhCgHFFlwEhW51wkCyF1YlAwY2sYXOU6AMgwZ5AQPk ZQ4tXXJv/2AgJumf93Op43ue/qhPiYf292EQBuS19sGa/VNA0Dz5a7/HoRKnPy16dX1i MSfF6sIonDODaiPNtw++sE7G7aA+aGGuNadqWvqX1bLOihwjKrf0pSK02C+/M8snLN8e fYgIW0gSyFMLD8GnHDc2ARNNaF3ggY2bAZJGjQCw9eW2kgIagHsasyj5khqv9I3HRffX OL6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=a+7VDpb9Pgmc5mWLUeC7I+y0BECPYDdeybO9GPHW0cE=; b=mYNERsSJd+j0rs/rdFZrUK2YurvAkzn/5VYmCO7JsiJ+UYMwYIj5I1bZOtYIM4QQMC B6a4puX3opKx7aIpYVrpvmUQKLeMkWoien//5SwP6STxH24HrcweYkV7mPNZmfRpGjWw mX0LgJIfCYE593XG4C38mmQbteaT8IbQUDjiFf2FmNlOoIWDxBIXdLxe+7nIQQotND5A 6tuxSONbqYRSaeXNo+/cTuI6GTmNFSPRtY6Z2RZvC7m6yaBRgJuHSWmgo1AgIj+rTxh7 UxS4Y2rXsFE0/u3v+5OCcrmhivFfyGmBzW/XcbGEJcZ2Y6X93nxVfH/sW/Rs/XiHJdnd 2P0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wvti6MUY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k16-20020a170906971000b0078307781936si12144206ejx.359.2022.10.19.03.41.41; Wed, 19 Oct 2022 03:42: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=wvti6MUY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232129AbiJSKlM (ORCPT + 99 others); Wed, 19 Oct 2022 06:41:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232099AbiJSKkN (ORCPT ); Wed, 19 Oct 2022 06:40: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 CF7A76B8ED; Wed, 19 Oct 2022 03:18:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CA8D5B824E1; Wed, 19 Oct 2022 09:14:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4AC03C433B5; Wed, 19 Oct 2022 09:14:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170892; bh=OxUnyWBNF9EL9wIWC7v/GzN4GWanOyfXdgikF9wmzdI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wvti6MUYHhKeYgk7IJVI5kMMeVaJdbxgbkxpf44D47ijnINwZ/7uRcQJPs0uqZXg4 wgT4cKdkiP9byPsraAmetbRp0ItRqYcP6JxJxvgbaQlPb0x9fNtkn8R3IygY2scbZv VYf/v4PYqn3BUKDK5YCA4hPPsB2/x5QHkYSx1Ka8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+0f2f7e65a3007d39539f@syzkaller.appspotmail.com, Jan Kara , Sasha Levin Subject: [PATCH 6.0 827/862] ext2: Use kvmalloc() for group descriptor array Date: Wed, 19 Oct 2022 10:35:14 +0200 Message-Id: <20221019083326.446951244@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112298695278231?= X-GMAIL-MSGID: =?utf-8?q?1747112298695278231?= From: Jan Kara [ Upstream commit e7c7fbb9a8574ebd89cc05db49d806c7476863ad ] Array of group descriptor block buffers can get rather large. In theory in can reach 1MB for perfectly valid filesystem and even more for maliciously crafted ones. Use kvmalloc() to allocate the array to avoid straining memory allocator with large order allocations unnecessarily. Reported-by: syzbot+0f2f7e65a3007d39539f@syzkaller.appspotmail.com Signed-off-by: Jan Kara Signed-off-by: Sasha Levin --- fs/ext2/super.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/ext2/super.c b/fs/ext2/super.c index afb31af9302d..03f2af98b1b4 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c @@ -163,7 +163,7 @@ static void ext2_put_super (struct super_block * sb) db_count = sbi->s_gdb_count; for (i = 0; i < db_count; i++) brelse(sbi->s_group_desc[i]); - kfree(sbi->s_group_desc); + kvfree(sbi->s_group_desc); kfree(sbi->s_debts); percpu_counter_destroy(&sbi->s_freeblocks_counter); percpu_counter_destroy(&sbi->s_freeinodes_counter); @@ -1092,7 +1092,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) } db_count = (sbi->s_groups_count + EXT2_DESC_PER_BLOCK(sb) - 1) / EXT2_DESC_PER_BLOCK(sb); - sbi->s_group_desc = kmalloc_array(db_count, + sbi->s_group_desc = kvmalloc_array(db_count, sizeof(struct buffer_head *), GFP_KERNEL); if (sbi->s_group_desc == NULL) { @@ -1218,7 +1218,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) for (i = 0; i < db_count; i++) brelse(sbi->s_group_desc[i]); failed_mount_group_desc: - kfree(sbi->s_group_desc); + kvfree(sbi->s_group_desc); kfree(sbi->s_debts); failed_mount: brelse(bh); From patchwork Wed Oct 19 08:35: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: 4989 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp227390wrs; Wed, 19 Oct 2022 02:48:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM56bM5mEbDA/1Es9kl8zuu7+uC1aa+E+QLYGWSXHpiCxhRFG4o4b7Cd0QcB2nhx4PnVuvcG X-Received: by 2002:a05:6402:1052:b0:459:2c49:1aed with SMTP id e18-20020a056402105200b004592c491aedmr6556271edu.212.1666172924063; Wed, 19 Oct 2022 02:48:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172924; cv=none; d=google.com; s=arc-20160816; b=XxAEEgsGwmRtscIYJf9QobrN1/rIbGj5s+pXoQb39bTqeUwuBf+VtyC26nRXwkek6l pB9aWq0FbxofqsI2/bMHJOhNBPsYi8DII8115xLf8UdDYy/Yj5hBhhZANWn2QJybPNrJ OdQ6AmVwwW2Kg3wt28RLb+ghmHsCnO/5rIvbkxsaoZ18DYHoHEPMCabTSx2jEZ15/A4O Vl6mQDRFuQ3NxZwRkspf5Zz8nAX0CLf/KkoEPouFxLnAW3SjCUddZ8u99uaHR4v4WCvp Z8ZC5dc2MA7wzOmyLIVMAssLQaToSGTy9iqAGm9Fus2EdY/q2sRkqCda2ogZX9b+NJu8 0lbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=29XhA/ewgTwuBBC6JjIeTtw8390aJtLXUrLFBgeATcA=; b=zzIr8VsIIgK+nXwEQiyBVoJXLjLFnD9d9eR7jaI3HMQw3ILodVFU0QCFmMYQQZI43X Kb17XVDUgOyrqpDh6ot2PptDFfaAE9/dEtDnxscPWk6J+TLA8TcEknIASp/gNgR1gMdr KtpZ4zVix/ucRC4LYg7r8njHfq+sAYGXzcIS8F7w8E1gJNK2UIWnbITmKXl4lhfRMiJp IoEjWeDf5GVa7b7mqQ0Rh+6fpU562K9EvXR9l9bM6iKulg6NHL7JOHW+aCf2sLofrzGw hFrtgiqtaXoBlUUv/V3LXoozCi3pi+cN1vDaDhbgrxduX8TORqovQ6Ua1Is9t27jl3a6 ZMKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=buc5oqVv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cz3-20020a0564021ca300b00459be46b0f4si11928211edb.131.2022.10.19.02.48.19; Wed, 19 Oct 2022 02:48: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=buc5oqVv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234559AbiJSJob (ORCPT + 99 others); Wed, 19 Oct 2022 05:44:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234757AbiJSJlS (ORCPT ); Wed, 19 Oct 2022 05:41: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 41BF0D57C1; Wed, 19 Oct 2022 02:17: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 D2222617ED; Wed, 19 Oct 2022 09:14:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF503C433D7; Wed, 19 Oct 2022 09:14:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170895; bh=P76NqlLy/+PZwCIIZvaC8DZgX9q9lu+DZUsFci9KUYg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=buc5oqVvmctq2dOwmW8N/va2w8b0xR1EhcFF+5BuNnAZREmonZQPDYltNJ7rNUQ4D q62DteNKSG7iRBe5r34nzrJro5k+OCgatVgolcyBAXCz5h5SJRxQ2iTVsDoWZ7D67O NOLrzS7xADYYg3q3Z2mDn6wKfZH0Psdok3Xmzll4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Derrick , Keith Busch , Sagi Grimberg , Chao Leng , Christoph Hellwig , Sasha Levin Subject: [PATCH 6.0 828/862] nvme: handle effects after freeing the request Date: Wed, 19 Oct 2022 10:35:15 +0200 Message-Id: <20221019083326.495237379@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108940246618939?= X-GMAIL-MSGID: =?utf-8?q?1747108940246618939?= From: Keith Busch [ Upstream commit bc8fb906b0ff9339b4286698cb7cd9cd5b8c53eb ] If a reset occurs after the scan work attempts to issue a command, the reset may quisce the admin queue, which blocks the scan work's command from dispatching. The scan work will not be able to complete while the queue is quiesced. Meanwhile, the reset work will cancel all outstanding admin tags and wait until all requests have transitioned to idle, which includes the passthrough request. But the passthrough request won't be set to idle until after the scan_work flushes, so we're deadlocked. Fix this by handling the end effects after the request has been freed. Link: https://bugzilla.kernel.org/show_bug.cgi?id=216354 Reported-by: Jonathan Derrick Signed-off-by: Keith Busch Reviewed-by: Sagi Grimberg Reviewed-by: Chao Leng Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin --- drivers/nvme/host/core.c | 17 ++++++----------- drivers/nvme/host/ioctl.c | 9 ++++++++- drivers/nvme/host/nvme.h | 4 +++- drivers/nvme/target/passthru.c | 7 ++++++- 4 files changed, 23 insertions(+), 14 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 8d5a7ae19844..7991d28e6a6a 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -1111,8 +1111,8 @@ static u32 nvme_passthru_start(struct nvme_ctrl *ctrl, struct nvme_ns *ns, return effects; } -static void nvme_passthru_end(struct nvme_ctrl *ctrl, u32 effects, - struct nvme_command *cmd, int status) +void nvme_passthru_end(struct nvme_ctrl *ctrl, u32 effects, + struct nvme_command *cmd, int status) { if (effects & NVME_CMD_EFFECTS_CSE_MASK) { nvme_unfreeze(ctrl); @@ -1148,21 +1148,16 @@ static void nvme_passthru_end(struct nvme_ctrl *ctrl, u32 effects, break; } } +EXPORT_SYMBOL_NS_GPL(nvme_passthru_end, NVME_TARGET_PASSTHRU); -int nvme_execute_passthru_rq(struct request *rq) +int nvme_execute_passthru_rq(struct request *rq, u32 *effects) { struct nvme_command *cmd = nvme_req(rq)->cmd; struct nvme_ctrl *ctrl = nvme_req(rq)->ctrl; struct nvme_ns *ns = rq->q->queuedata; - u32 effects; - int ret; - effects = nvme_passthru_start(ctrl, ns, cmd->common.opcode); - ret = nvme_execute_rq(rq, false); - if (effects) /* nothing to be done for zero cmd effects */ - nvme_passthru_end(ctrl, effects, cmd, ret); - - return ret; + *effects = nvme_passthru_start(ctrl, ns, cmd->common.opcode); + return nvme_execute_rq(rq, false); } EXPORT_SYMBOL_NS_GPL(nvme_execute_passthru_rq, NVME_TARGET_PASSTHRU); diff --git a/drivers/nvme/host/ioctl.c b/drivers/nvme/host/ioctl.c index 27614bee7380..d3281f87cd6e 100644 --- a/drivers/nvme/host/ioctl.c +++ b/drivers/nvme/host/ioctl.c @@ -136,9 +136,11 @@ static int nvme_submit_user_cmd(struct request_queue *q, unsigned bufflen, void __user *meta_buffer, unsigned meta_len, u32 meta_seed, u64 *result, unsigned timeout, bool vec) { + struct nvme_ctrl *ctrl; struct request *req; void *meta = NULL; struct bio *bio; + u32 effects; int ret; req = nvme_alloc_user_request(q, cmd, ubuffer, bufflen, meta_buffer, @@ -147,8 +149,9 @@ static int nvme_submit_user_cmd(struct request_queue *q, return PTR_ERR(req); bio = req->bio; + ctrl = nvme_req(req)->ctrl; - ret = nvme_execute_passthru_rq(req); + ret = nvme_execute_passthru_rq(req, &effects); if (result) *result = le64_to_cpu(nvme_req(req)->result.u64); @@ -158,6 +161,10 @@ static int nvme_submit_user_cmd(struct request_queue *q, if (bio) blk_rq_unmap_user(bio); blk_mq_free_request(req); + + if (effects) + nvme_passthru_end(ctrl, effects, cmd, ret); + return ret; } diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index 1bdf714dcd9e..a0bf9560cf67 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h @@ -1023,7 +1023,9 @@ static inline void nvme_auth_free(struct nvme_ctrl *ctrl) {}; u32 nvme_command_effects(struct nvme_ctrl *ctrl, struct nvme_ns *ns, u8 opcode); -int nvme_execute_passthru_rq(struct request *rq); +int nvme_execute_passthru_rq(struct request *rq, u32 *effects); +void nvme_passthru_end(struct nvme_ctrl *ctrl, u32 effects, + struct nvme_command *cmd, int status); struct nvme_ctrl *nvme_ctrl_from_file(struct file *file); struct nvme_ns *nvme_find_get_ns(struct nvme_ctrl *ctrl, unsigned nsid); void nvme_put_ns(struct nvme_ns *ns); diff --git a/drivers/nvme/target/passthru.c b/drivers/nvme/target/passthru.c index 6f39a29828b1..94d3153bae54 100644 --- a/drivers/nvme/target/passthru.c +++ b/drivers/nvme/target/passthru.c @@ -215,9 +215,11 @@ static void nvmet_passthru_execute_cmd_work(struct work_struct *w) { struct nvmet_req *req = container_of(w, struct nvmet_req, p.work); struct request *rq = req->p.rq; + struct nvme_ctrl *ctrl = nvme_req(rq)->ctrl; + u32 effects; int status; - status = nvme_execute_passthru_rq(rq); + status = nvme_execute_passthru_rq(rq, &effects); if (status == NVME_SC_SUCCESS && req->cmd->common.opcode == nvme_admin_identify) { @@ -238,6 +240,9 @@ static void nvmet_passthru_execute_cmd_work(struct work_struct *w) req->cqe->result = nvme_req(rq)->result; nvmet_req_complete(req, status); blk_mq_free_request(rq); + + if (effects) + nvme_passthru_end(ctrl, effects, req->cmd, status); } static void nvmet_passthru_req_done(struct request *rq, From patchwork Wed Oct 19 08:35: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: 4951 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp226450wrs; Wed, 19 Oct 2022 02:45:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6oYtCa8Al2IU1zconVHHGKiYdTDCkEsViaXxTqd/oX7SY9itKNDn1+LJGTPknA24RW37hF X-Received: by 2002:a63:1d22:0:b0:439:3e7c:8af7 with SMTP id d34-20020a631d22000000b004393e7c8af7mr6524104pgd.78.1666172757325; Wed, 19 Oct 2022 02:45:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172757; cv=none; d=google.com; s=arc-20160816; b=ftXplYlqS3wGOd7J97fGQ8amt6sVZnQJTAAWrBVMFiJJLQmLbploqlmSGAfLwHjSvH zRj0N+KJuJ/j4MEXHWOlfXvqPjopWHts+I+QlogUAM8ksBxvGGuhlwMMMZrktJvZJTF4 1W3d/2z4zBZLWj5dXXgIZRxAntxZFMC8/Z4WBzj8gnRm9hOBrX54tFygYf+BeVZBMXzL LU3KBf6jt7Yyaoox3Zgste1SldKM9PgtW8WbEdZp++vxu5x/JUcVtjE4w7oxV7f2kK40 kIjV9VGnhdJvRH7+Sx7mZo9SZxHMTLN2gHtU8Q8e2faRWqSpz7iSJyNbRedltZDsWZQK Gn+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=jlfuvXWu5SeTxVzVxrBULOJJVXhL5e/8NFuwjavM7A0=; b=YGWfCn+HgyX8hHNTYRzjWWKThB0vyuuO6WmBF3JZZRIOmqw8wCJ1+dclJRBgHdX0Zf plGUkRreUQnZBrNaSI7z9WZM3B8du5fW1Vl/UtReSDe0jH6dy49lVy12ZefhWVI0DVii +G30pR48R4g3S8h5v2t/nGY47p4RTyGSEjbOgbiO4f9hw0Yag1sa5VqncLJXUBjMWbYF x2tZooGgmew9jQ9EMTqeavywbUM4rQMG2eWgLohWIGkd5Lhsbpj9S7w9RCb6RvRUDzhe dec9azFndUa62vkGKYEHyg+9LqJW/iOkS5QQyUwQ4uBMFWcagXnt1VQkL5UncN+a5ZeZ aakg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HMgcIrRG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n10-20020a170902d2ca00b0016f1eb1317esi20345295plc.471.2022.10.19.02.45.34; Wed, 19 Oct 2022 02:45:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HMgcIrRG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234147AbiJSJmv (ORCPT + 99 others); Wed, 19 Oct 2022 05:42:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234348AbiJSJkK (ORCPT ); Wed, 19 Oct 2022 05:40:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56DBBEEAA9; Wed, 19 Oct 2022 02:16: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 8B713617EC; Wed, 19 Oct 2022 09:14:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8EC5CC433D6; Wed, 19 Oct 2022 09:14:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170898; bh=5qt8H4mypo9d3J9EVjpniftXE2g7dQ0BL2h2ZP4cgy0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HMgcIrRGdTULaoW/ZNmkf9oAJ6XbOb5uXiJRDHd+mI3wevSn1TZllVrN0g4E4LHaZ RKnHEmhjwH1WslLluKpikppMboNtAa/fKBeKTZKuDOXwdY81XXtcU093jPqvB70SoE ks1OtwLgztiWJh8UHf10gABcITPEZZplmfZdjXx8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeff Lien , Keith Busch , Sagi Grimberg , Chaitanya Kulkarni , Chao Leng , Christoph Hellwig , Sasha Levin Subject: [PATCH 6.0 829/862] nvme: copy firmware_rev on each init Date: Wed, 19 Oct 2022 10:35:16 +0200 Message-Id: <20221019083326.533671790@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108765109568010?= X-GMAIL-MSGID: =?utf-8?q?1747108765109568010?= From: Keith Busch [ Upstream commit a8eb6c1ba48bddea82e8d74cbe6e119f006be97d ] The firmware revision can change on after a reset so copy the most recent info each time instead of just the first time, otherwise the sysfs firmware_rev entry may contain stale data. Reported-by: Jeff Lien Signed-off-by: Keith Busch Reviewed-by: Sagi Grimberg Reviewed-by: Chaitanya Kulkarni Reviewed-by: Chao Leng Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin --- drivers/nvme/host/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 7991d28e6a6a..59e4b188fc71 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -2889,7 +2889,6 @@ static int nvme_init_subsystem(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id) nvme_init_subnqn(subsys, ctrl, id); memcpy(subsys->serial, id->sn, sizeof(subsys->serial)); memcpy(subsys->model, id->mn, sizeof(subsys->model)); - memcpy(subsys->firmware_rev, id->fr, sizeof(subsys->firmware_rev)); subsys->vendor_id = le16_to_cpu(id->vid); subsys->cmic = id->cmic; @@ -3108,6 +3107,8 @@ static int nvme_init_identify(struct nvme_ctrl *ctrl) ctrl->quirks |= core_quirks[i].quirks; } } + memcpy(ctrl->subsys->firmware_rev, id->fr, + sizeof(ctrl->subsys->firmware_rev)); if (force_apst && (ctrl->quirks & NVME_QUIRK_NO_DEEPEST_PS)) { dev_warn(ctrl->device, "forcibly allowing all power states due to nvme_core.force_apst -- use at your own risk\n"); From patchwork Wed Oct 19 08:35: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: 4954 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp226506wrs; Wed, 19 Oct 2022 02:46:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6kzse7p+b2Byzcg9g4rGzfr6ibNxRXTuxxARotDuRurCkWtiwSnuwU5bgDQSiEbPPuwEPd X-Received: by 2002:a05:6a00:1689:b0:557:9105:cf85 with SMTP id k9-20020a056a00168900b005579105cf85mr7788506pfc.55.1666172765559; Wed, 19 Oct 2022 02:46:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172765; cv=none; d=google.com; s=arc-20160816; b=ygbBmsK1qJ/PIT+AvFLpkic+cdgF/9QI3tvxo35W4WCcHAToDX7bXbDffJbLP/7A5R UAcsZ97BBG6Ia8WOv7h1Oza1Q8YAf9u1jEakU4qGeG+36zIZHyitNgfGycn5Rnaopk0C 3/Mo1+o6ZHhck3c8j9QQQCP2gNm3Mz+Up1amDz8NcOXx9pRdj031hyAsUAfgtEkfI1b7 MgQ427AWBirfCy4qJHMbgCSX1n6oKEpkWn1PDvsX9F8YsLH8/6zRG5DmUQFxAWvgkUby aepl44XLBbESlZ8oiWDbJLoO5ssbvWoaoYymYKwPy4YnBPKIa/4LTo1hq25nUlPlfFtY MgdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+2rjujWWhfgfG5tiQA0YDLR0d/ewQAf1OGHqtKrMnW4=; b=YxRUyYu/I3XEaryaINsnLGwVY2NTG35sUYo2U3StcV1mUm560kkk//5CXbhXEhH0N5 HZCtutFE/bFbOwE2OGLqW/mGclbvinILz/FN9WqFLXbxSvkiDoixprUICq/weg4wekj+ I1oofliJY2/7WNgh9+AFKB/xtm3LDdEEvr3de4hghdxeTejSQwvz+Gbomj40y0IbRzuH jLPSfLAUl7W0/pxDzfK7mdQSZMJWfY37kYxSgRvNQM2UWeuH42CtDqKrfjY/UAwTtyFd BqhRP/N/+c51dSihsLvNeMWnzVR/N7VbL6Vy0ARsuI/qIbbSFhJVtBM7Oh90Acn6v8PQ zD0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aOhI13vO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y10-20020a63180a000000b0045b1d6c87cfsi18513045pgl.432.2022.10.19.02.45.49; Wed, 19 Oct 2022 02:46: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=aOhI13vO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234254AbiJSJm7 (ORCPT + 99 others); Wed, 19 Oct 2022 05:42:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234377AbiJSJkS (ORCPT ); Wed, 19 Oct 2022 05:40: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 84748E8C49; Wed, 19 Oct 2022 02:16:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1C5D7617F4; Wed, 19 Oct 2022 09:15:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 298F7C433C1; Wed, 19 Oct 2022 09:15:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170900; bh=dwDcdLbwsITSd0znTm2jm+ojffy7JRp4bA5tasq8cI4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aOhI13vOZ4rtf3CTUG8ErM3fBuZSFIcxLAIwWag2rAmIPMw89BE3ujxF2aHbE0GjF 5OGMGhf1pvBCgS/PS5fAYmKYLZaL8H0I83T7wjkAXX4Q/ry2Cu/2FgIeSXOqs4nQ5e uL0dMc4hXw0pAV1V8t02j5RXUygh0ctPSXCc5vIc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Varun Prakash , Sagi Grimberg , Christoph Hellwig , Sasha Levin Subject: [PATCH 6.0 830/862] nvmet-tcp: add bounds check on Transfer Tag Date: Wed, 19 Oct 2022 10:35:17 +0200 Message-Id: <20221019083326.575072658@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108773805952810?= X-GMAIL-MSGID: =?utf-8?q?1747108773805952810?= From: Varun Prakash [ Upstream commit b6a545ffa2c192b1e6da4a7924edac5ba9f4ea2b ] ttag is used as an index to get cmd in nvmet_tcp_handle_h2c_data_pdu(), add a bounds check to avoid out-of-bounds access. Signed-off-by: Varun Prakash Reviewed-by: Sagi Grimberg Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin --- drivers/nvme/target/tcp.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c index a3694a32f6d5..7dcf88cde189 100644 --- a/drivers/nvme/target/tcp.c +++ b/drivers/nvme/target/tcp.c @@ -935,10 +935,17 @@ static int nvmet_tcp_handle_h2c_data_pdu(struct nvmet_tcp_queue *queue) struct nvme_tcp_data_pdu *data = &queue->pdu.data; struct nvmet_tcp_cmd *cmd; - if (likely(queue->nr_cmds)) + if (likely(queue->nr_cmds)) { + if (unlikely(data->ttag >= queue->nr_cmds)) { + pr_err("queue %d: received out of bound ttag %u, nr_cmds %u\n", + queue->idx, data->ttag, queue->nr_cmds); + nvmet_tcp_fatal_error(queue); + return -EPROTO; + } cmd = &queue->cmds[data->ttag]; - else + } else { cmd = &queue->connect; + } if (le32_to_cpu(data->data_offset) != cmd->rbytes_done) { pr_err("ttag %u unexpected data offset %u (expected %u)\n", From patchwork Wed Oct 19 08:35: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: 5190 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp263883wrs; Wed, 19 Oct 2022 04:18:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM535gM0l8sBi5EI+FwLb72eJtqTG9C40lA1AAkLw/fmgHH9MpGMMVEyeNFp4jQ0zvKoRmOz X-Received: by 2002:a17:903:2285:b0:185:44df:d916 with SMTP id b5-20020a170903228500b0018544dfd916mr7883124plh.120.1666178336727; Wed, 19 Oct 2022 04:18:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178336; cv=none; d=google.com; s=arc-20160816; b=czGghYV7j8Me48GpimPmgOhP8sKrqWmGTKiuNSnd8AUaqkhsBbA5P3im+TbsBj7y+D kpv+E9V5Sc77k30csGZum3/4Bkky90CgmCTIis3nhFhMC6LanNZCHSCWMMCQFNKL8D5M vmy7/Lr5vpbPf0en3RktBbVTBIs2NqL/AQ8I1t/2Qw//rvjYs+s8gezVd/vpiUOtj9LE tGrWO0er+iDGeCLT/xj+ybECO7J/77qO8Ht2h3eUkkoCSHnVrLBcyEE7BhHPy4vyNnG7 C8Cs3ERFZdRyQMBNJrhWO9isqQkQSN1m/4MNUhy4LvWLLYbodK0t4wjCi4dLm2yAIeWX sdzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=iEyLnsxdEbZpgMXxUMGXoRqchhpdzybvnC2uj9cSaYU=; b=GHD5kScGD0XgtkTGLQukwJUQ8qEnFw4fMEMPJ3gFLaSjOcip8KcdsrTUYCvIBED/IX Tu+bKcl9y3vzQbOY+/cRyvrm5gTSRYwTYOin2jLJTaY0LaJUIAeDcS395LbeIbLiiDwO oRmep/cWVE3p7o1cm7l3+fLdzIj795TbO5i+V7HnzTKseGLkp83Rr2Bc28TZyEL54Esd pFcGGaQgnz4SJCL8trS+YUOxfg/Ala9PFmE6ngYQqcX/n4KFfsTXZ+naA2pvXMqmqzuN l5jJTQQYfMcKK11Sljb5DkqWrqONzoRoYzonJjEyAo5yMUSpUfGijkClTmagEdJ/nmp+ oVhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lN18bBEy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d9-20020a170903230900b0018532e03614si20246268plh.470.2022.10.19.04.18.39; Wed, 19 Oct 2022 04:18: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=lN18bBEy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234803AbiJSLGH (ORCPT + 99 others); Wed, 19 Oct 2022 07:06:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231633AbiJSLFT (ORCPT ); Wed, 19 Oct 2022 07:05:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE69D193F5; Wed, 19 Oct 2022 03:34: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 C3464617F7; Wed, 19 Oct 2022 09:15:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5D59C433D6; Wed, 19 Oct 2022 09:15:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170903; bh=2ZxUg/1wAsgJI7Aj9gDfm/S13ITpUsPEtiIhR3IIIoc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lN18bBEyMhZ6OsE76f1xj8U5Gib3acWiVgu9MY4cHfT5HcmqjF2OUYYhB0axoCd/i RPrtKiCDnZJZekDOrs6gV3OzmXHQhLIKyenEpGnCmkTfRgqdgThLu08EMhwtSGnKCX XMjGkWnW1jmZji6qMupbYlI7yQqvEntqviB1jqCg= 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 6.0 831/862] usb: idmouse: fix an uninit-value in idmouse_open Date: Wed, 19 Oct 2022 10:35:18 +0200 Message-Id: <20221019083326.617645049@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114615604331419?= X-GMAIL-MSGID: =?utf-8?q?1747114615604331419?= 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 e9437a176518..ea39243efee3 100644 --- a/drivers/usb/misc/idmouse.c +++ b/drivers/usb/misc/idmouse.c @@ -177,10 +177,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) @@ -192,6 +188,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 Wed Oct 19 08:35: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: 4957 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp226556wrs; Wed, 19 Oct 2022 02:46:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4O+qGkp8nSwB6iLmJ7+DB8SnOX4tpWozigwrvfJ0TpRmonWEYrYQup64Yw7f2q4jGH/NOd X-Received: by 2002:a63:2d05:0:b0:460:55e3:df91 with SMTP id t5-20020a632d05000000b0046055e3df91mr6451748pgt.177.1666172774909; Wed, 19 Oct 2022 02:46:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172774; cv=none; d=google.com; s=arc-20160816; b=joXl3JVH28wHovLhIqaRIpilly6Strz+YxsNk6+9H7gI+7Yu4yGhpGfaxSzyFb1EZ1 9/dmLVxA/DAa6+A0U9fX2+y6u/LkQdkcahOb49PxIPXzeU2iDR9Ma8EZkfwocOCcw+QU /lGU7912Vb5wTYF+qk11V+Z9nW3e/kzT0tAcWt+eISzUmYqQ8rLeCQB37q646t8KZwII uCvYD1BbG4qU/zM+dGW71uP6FlkJZrvKSDlD4CvsIIRzvEJ3N6FTaNR06pNS7rfEiFCe xSMmoABoYAsqOXPkEB1+Yj/GJX/dNKOUp58G6ibP/2F95fbMja09WGj6288M5Fashn58 VnvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=IGfEvM7GXhHKsXR7oBkfOP5NIKMHjUXUWpluN2lJkBc=; b=gbHJP41A7HUdJefd60BTUpz9TP3qO6EgLtneMYvg28NH6HaUwcSWk2RKZtpLXuGoa0 /laQAof2ba7wEbo2LpmhTj+1nzFRnxnxQhwHSgncZ0VqeamEhY6lv3ar0MB+uVLmBIgV WNwaWmYnIuuopZREi6uL/wGhfg+p9Go4bHCm3KyrykJaljveUmtoRMpYIRUNm6l4h7YJ ytdKyaPo0OmV1VvUdf9xgNpNZ6dbKyAoFsVJtxjTdi1rw/Y7fVZqZE0RJXW677QuC3tb u3mQyeacAiFjPl0LZBfAYTnL3wwKw2NYWsqrB5iVTS2QaSIBpCCXrduV//6nZbPJBdr4 t1XA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fYivneM6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r11-20020a170902c7cb00b0017f8f649efesi15075456pla.503.2022.10.19.02.45.56; Wed, 19 Oct 2022 02:46: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=fYivneM6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234286AbiJSJnJ (ORCPT + 99 others); Wed, 19 Oct 2022 05:43:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234402AbiJSJkW (ORCPT ); Wed, 19 Oct 2022 05:40: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 7A1EAEF584; Wed, 19 Oct 2022 02:16:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7B190617E6; Wed, 19 Oct 2022 09:15:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76D31C433D6; Wed, 19 Oct 2022 09:15:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170905; bh=zEE9owPpFs4A8sJh3hD8BeRA5HFzdvgeo26rkxlE52M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fYivneM6oDjIwQPZBrZdQkr8qnjRD0OsTsy0lTXLfUYCYynyjRX84XLULO3fEODLx ZiGd1ybU5wt4d1k0p4yfOikwAaTDQiNmFVRMWYEOvxQ2i/UJWsidgwOSHRlx0uHwf0 0AhoAisAcROXqPxGMkontHLt3XC8QICMK0yTghY0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Keith Busch , Ming Lei , Christoph Hellwig , Jens Axboe , Sasha Levin Subject: [PATCH 6.0 832/862] blk-mq: use quiesced elevator switch when reinitializing queues Date: Wed, 19 Oct 2022 10:35:19 +0200 Message-Id: <20221019083326.657974784@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108783568432671?= X-GMAIL-MSGID: =?utf-8?q?1747108783568432671?= From: Keith Busch [ Upstream commit 8237c01f1696bc53c470493bf1fe092a107648a6 ] The hctx's run_work may be racing with the elevator switch when reinitializing hardware queues. The queue is merely frozen in this context, but that only prevents requests from allocating and doesn't stop the hctx work from running. The work may get an elevator pointer that's being torn down, and can result in use-after-free errors and kernel panics (example below). Use the quiesced elevator switch instead, and make the previous one static since it is now only used locally. nvme nvme0: resetting controller nvme nvme0: 32/0/0 default/read/poll queues BUG: kernel NULL pointer dereference, address: 0000000000000008 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 80000020c8861067 P4D 80000020c8861067 PUD 250f8c8067 PMD 0 Oops: 0000 [#1] SMP PTI Workqueue: kblockd blk_mq_run_work_fn RIP: 0010:kyber_has_work+0x29/0x70 ... Call Trace: __blk_mq_do_dispatch_sched+0x83/0x2b0 __blk_mq_sched_dispatch_requests+0x12e/0x170 blk_mq_sched_dispatch_requests+0x30/0x60 __blk_mq_run_hw_queue+0x2b/0x50 process_one_work+0x1ef/0x380 worker_thread+0x2d/0x3e0 Signed-off-by: Keith Busch Reviewed-by: Ming Lei Reviewed-by: Christoph Hellwig Link: https://lore.kernel.org/r/20220927155652.3260724-1-kbusch@fb.com Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- block/blk-mq.c | 6 +++--- block/blk.h | 3 +-- block/elevator.c | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index c96c8c4f751b..887b8682eb69 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -4473,14 +4473,14 @@ static bool blk_mq_elv_switch_none(struct list_head *head, list_add(&qe->node, head); /* - * After elevator_switch_mq, the previous elevator_queue will be + * After elevator_switch, the previous elevator_queue will be * released by elevator_release. The reference of the io scheduler * module get by elevator_get will also be put. So we need to get * a reference of the io scheduler module here to prevent it to be * removed. */ __module_get(qe->type->elevator_owner); - elevator_switch_mq(q, NULL); + elevator_switch(q, NULL); mutex_unlock(&q->sysfs_lock); return true; @@ -4512,7 +4512,7 @@ static void blk_mq_elv_switch_back(struct list_head *head, kfree(qe); mutex_lock(&q->sysfs_lock); - elevator_switch_mq(q, t); + elevator_switch(q, t); mutex_unlock(&q->sysfs_lock); } diff --git a/block/blk.h b/block/blk.h index d7142c4d2fef..52432eab621e 100644 --- a/block/blk.h +++ b/block/blk.h @@ -270,8 +270,7 @@ bool blk_bio_list_merge(struct request_queue *q, struct list_head *list, void blk_insert_flush(struct request *rq); -int elevator_switch_mq(struct request_queue *q, - struct elevator_type *new_e); +int elevator_switch(struct request_queue *q, struct elevator_type *new_e); void elevator_exit(struct request_queue *q); int elv_register_queue(struct request_queue *q, bool uevent); void elv_unregister_queue(struct request_queue *q); diff --git a/block/elevator.c b/block/elevator.c index c319765892bb..bd71f0fc4e4b 100644 --- a/block/elevator.c +++ b/block/elevator.c @@ -588,7 +588,7 @@ void elv_unregister(struct elevator_type *e) } EXPORT_SYMBOL_GPL(elv_unregister); -int elevator_switch_mq(struct request_queue *q, +static int elevator_switch_mq(struct request_queue *q, struct elevator_type *new_e) { int ret; @@ -723,7 +723,7 @@ void elevator_init_mq(struct request_queue *q) * need for the new one. this way we have a chance of going back to the old * one, if the new one fails init for some reason. */ -static int elevator_switch(struct request_queue *q, struct elevator_type *new_e) +int elevator_switch(struct request_queue *q, struct elevator_type *new_e) { int err; From patchwork Wed Oct 19 08:35: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: 5199 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp264472wrs; Wed, 19 Oct 2022 04:20:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4x33KP7WoO+IeUUmIIRwCZPejNBb5895/0jgKIqwdIruTttTVwFXH/uIOK8BXuCVisgRwJ X-Received: by 2002:a05:6402:540d:b0:450:bda7:f76e with SMTP id ev13-20020a056402540d00b00450bda7f76emr7022928edb.249.1666178406583; Wed, 19 Oct 2022 04:20:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178406; cv=none; d=google.com; s=arc-20160816; b=YReb6GBmgWV77ol2bGvhrqGUlsW9YE/XbtnzobGF24lt3kk/fHfGd8kHvooVpPWca+ IBtHhQPdPYR53lsyj91LCT/9Moou5ij/ZdAOZ54VboTkGCqtuYZHxoyNw3E1ILI0WDUr qLBDcGHk/gBrA+23/M+xvJjXoK16jmkfuKgU9NAVc8Wj+BjixLQC5o9gC7SrynXXJUq4 b8vmPn2zYgmiwdfQ8vSAUSJdgk6kAec40yUfw23/7f2oEOkBZjJF4n+3sX62SLr7pmyp nNov6g4QTGOxrwnkcJFq4WCV2fWEsIq/3ctrFfHqKB2BnzVOH7H+loUMOWtSYkq8663x YGUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nki1y1DMsRFEYFhPnOF0TVWggcZmELsmPUWXCfYbH4c=; b=RP5NwF4Ks4mOC5J9u9WPqyyE4RXFAHQ56wAr9HZHP79+s7kGhj982rTRVrPp6l9LTm GZaJpyk88U2QsbogNg99Ji/Z7hkJ8DMyv41uPVB6rTQxv/rRdF7P2xdelETNhR1OSBGk lvPyeRNqm6/NeumQ5G9UFzp32brWoDyDftD2WvR0nOHH2e8szyPQ5Y/AWI27n0XCQ+mt QTni+IWncSfp4ME/6O1RN8g2uXoUVenTK9p5ZUk/bdqBlBVj2+YhG+z3C2XYvAH7oN9c 6J3hjwtFXegJsBNDA3HfeRzFhTJFIWNrpyqAlqPfcXMVPp4OMrq0VN0friRsuXiDCKU7 y2bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EB2eA8dc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k16-20020a170906971000b0078307781936si12176493ejx.359.2022.10.19.04.19.41; Wed, 19 Oct 2022 04:20: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=EB2eA8dc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232845AbiJSLFV (ORCPT + 99 others); Wed, 19 Oct 2022 07:05:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234893AbiJSLEM (ORCPT ); Wed, 19 Oct 2022 07:04: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 047D914EC58; Wed, 19 Oct 2022 03: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 dfw.source.kernel.org (Postfix) with ESMTPS id 21874617F2; Wed, 19 Oct 2022 09:15:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39BD2C433D6; Wed, 19 Oct 2022 09:15:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170908; bh=3t7YvvkwEOPmixL8bgqdKSwqQRF35jS7csXR8qeViUw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EB2eA8dcYVU9/gkA4zioVNq3W9DNUGAxdsfYwr/gaSNlc2ZN5TfdxObtBwXcru7ar xnWEa0XPqC99FOw0/i/fbA12BbFxLTsvPGoI0jG2nNTKZ33to3EBCc7r4+stEidB1M RSNJzHZUi4gCEdVpoZLLwY5x37a7E9OJPOTqWlOM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eddie James , Guenter Roeck , Joel Stanley , Sasha Levin Subject: [PATCH 6.0 833/862] hwmon (occ): Retry for checksum failure Date: Wed, 19 Oct 2022 10:35:20 +0200 Message-Id: <20221019083326.697191417@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114688889170314?= X-GMAIL-MSGID: =?utf-8?q?1747114688889170314?= From: Eddie James [ Upstream commit dbed963ed62c4c2b8870a02c8b7dcb0c2af3ee0b ] Due to the OCC communication design with a shared SRAM area, checkum errors are expected due to corrupted buffer from OCC communications with other system components. Therefore, retry the command twice in the event of a checksum failure. Signed-off-by: Eddie James Acked-by: Guenter Roeck Link: https://lore.kernel.org/r/20220426154956.27205-3-eajames@linux.ibm.com Signed-off-by: Joel Stanley Signed-off-by: Sasha Levin --- drivers/hwmon/occ/p9_sbe.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/hwmon/occ/p9_sbe.c b/drivers/hwmon/occ/p9_sbe.c index c1e0a1d96cd4..f3791a589b01 100644 --- a/drivers/hwmon/occ/p9_sbe.c +++ b/drivers/hwmon/occ/p9_sbe.c @@ -14,6 +14,8 @@ #include "common.h" +#define OCC_CHECKSUM_RETRIES 3 + struct p9_sbe_occ { struct occ occ; bool sbe_error; @@ -80,18 +82,23 @@ static bool p9_sbe_occ_save_ffdc(struct p9_sbe_occ *ctx, const void *resp, static int p9_sbe_occ_send_cmd(struct occ *occ, u8 *cmd, size_t len, void *resp, size_t resp_len) { + size_t original_resp_len = resp_len; struct p9_sbe_occ *ctx = to_p9_sbe_occ(occ); - int rc; + int rc, i; - rc = fsi_occ_submit(ctx->sbe, cmd, len, resp, &resp_len); - if (rc < 0) { + for (i = 0; i < OCC_CHECKSUM_RETRIES; ++i) { + rc = fsi_occ_submit(ctx->sbe, cmd, len, resp, &resp_len); + if (rc >= 0) + break; if (resp_len) { if (p9_sbe_occ_save_ffdc(ctx, resp, resp_len)) sysfs_notify(&occ->bus_dev->kobj, NULL, bin_attr_ffdc.attr.name); + return rc; } - - return rc; + if (rc != -EBADE) + return rc; + resp_len = original_resp_len; } switch (((struct occ_response *)resp)->return_status) { From patchwork Wed Oct 19 08:35: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: 4958 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp226562wrs; Wed, 19 Oct 2022 02:46:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7pvi9b+UurKsnwfUjYBVjvPo7GP83jYycgYPBfArjxxIrQOdAHSUxAzWJQfxpYQWi9irEZ X-Received: by 2002:a65:45c1:0:b0:461:5855:8d86 with SMTP id m1-20020a6545c1000000b0046158558d86mr6373967pgr.436.1666172775870; Wed, 19 Oct 2022 02:46:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172775; cv=none; d=google.com; s=arc-20160816; b=PGLxeLkqoLofPhSA6hT60IIykUjuC2owDjzxQEyqoaKE32ttl0VkwXZ6w086z6IdRn rkhLCJK9fFKS7O6AEOPa1g4mGildGM2ZMhtBU1dBbwdaW/xnhMbsyUQEC3RvR3lOy0Q6 Wgj10m3/FqYdSzD9bQ6KFvB5gvgYrL0fIKZ/RImjKmR/bwxF6akak5CoF0R3+V6Q69xH AbMK110A5ahbvSPMj4EcRqD/gf6+BQKLlFJQlZQlUK176zDIncX/O6XUpSPFBz7p8/0M CNS+Xtrvf6QzoZkbAL90FquIDg1g1O3zhrsMNzVYmTkqH2ykgjE1ItKW0T9618xK+bwC CygA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gnoTKFganq8WlELK/iSYCLvh52KKTxuFVMqPOk/R5Tk=; b=0atu2rAMHvGi9zzymmq2mvUu9+eipMu7avYcRc6fJ4kPU4t1fB6HmLDDKSu0R4jlP4 GKpod83GVtwUfea9aP4f1C1XjCHXVx8EZWwQynNaE34LgStp8cNeSlhe7WPdy53hEwgG Q5iOKiUaAQ4cV4429SXJASSUi6DFdAA+8tnCvBU90Cm4f7luBt3kRGXH5yiE6uVSVvz6 CxWPyBwYZJIXNWfzFD8CcBNOMChodE8ufAC3doOJjd60B5Qq1+LuXQUcVrJst62rDPnd V1zOd/jSEu/vQV3IsfcmNIV1ntNMFWD/sRI86YXkOFMPSvuAyO1MXaW3oFY5pIJblxtr qXdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ejAue5PO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m11-20020a170902db0b00b0017872bc9843si10109699plx.137.2022.10.19.02.45.59; Wed, 19 Oct 2022 02:46: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=ejAue5PO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234197AbiJSJmz (ORCPT + 99 others); Wed, 19 Oct 2022 05:42:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234363AbiJSJkN (ORCPT ); Wed, 19 Oct 2022 05:40:13 -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 7B6BFCF87C; Wed, 19 Oct 2022 02:16:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BD3E761800; Wed, 19 Oct 2022 09:15:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CCC92C433D6; Wed, 19 Oct 2022 09:15:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170911; bh=GmRUeDbFgkpqIs8eExCjyoabv5cVnd0mR8YC0z3X1xw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ejAue5POvMRwis+kv4YijXWlaSBWyeCytmGtNZUueeClKpnn+/D9reqxG8kh/UClT 5+ykOoLymFkmBPw37ZdQL3i39I06Hw7sui122Z3COZ7PaFR7qfXgXLfpV+QIcVhzem 1U5NaqsoElirOqtmEvl1pnzU3W1TX1zu+WdwOSEA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eddie James , Guenter Roeck , Joel Stanley , Sasha Levin Subject: [PATCH 6.0 834/862] fsi: occ: Prevent use after free Date: Wed, 19 Oct 2022 10:35:21 +0200 Message-Id: <20221019083326.738514785@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108784634040416?= X-GMAIL-MSGID: =?utf-8?q?1747108784634040416?= From: Eddie James [ Upstream commit d3e1e24604031b0d83b6c2d38f54eeea265cfcc0 ] Use get_device and put_device in the open and close functions to make sure the device doesn't get freed while a file descriptor is open. Also, lock around the freeing of the device buffer and check the buffer before using it in the submit function. Signed-off-by: Eddie James Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20220513194424.53468-1-eajames@linux.ibm.com Signed-off-by: Joel Stanley Signed-off-by: Sasha Levin --- drivers/fsi/fsi-occ.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/fsi/fsi-occ.c b/drivers/fsi/fsi-occ.c index c9cc75fbdfb9..28c176d038a2 100644 --- a/drivers/fsi/fsi-occ.c +++ b/drivers/fsi/fsi-occ.c @@ -94,6 +94,7 @@ static int occ_open(struct inode *inode, struct file *file) client->occ = occ; mutex_init(&client->lock); file->private_data = client; + get_device(occ->dev); /* We allocate a 1-page buffer, make sure it all fits */ BUILD_BUG_ON((OCC_CMD_DATA_BYTES + 3) > PAGE_SIZE); @@ -197,6 +198,7 @@ static int occ_release(struct inode *inode, struct file *file) { struct occ_client *client = file->private_data; + put_device(client->occ->dev); free_page((unsigned long)client->buffer); kfree(client); @@ -493,12 +495,19 @@ int fsi_occ_submit(struct device *dev, const void *request, size_t req_len, for (i = 1; i < req_len - 2; ++i) checksum += byte_request[i]; - mutex_lock(&occ->occ_lock); + rc = mutex_lock_interruptible(&occ->occ_lock); + if (rc) + return rc; occ->client_buffer = response; occ->client_buffer_size = user_resp_len; occ->client_response_size = 0; + if (!occ->buffer) { + rc = -ENOENT; + goto done; + } + /* * Get a sequence number and update the counter. Avoid a sequence * number of 0 which would pass the response check below even if the @@ -671,10 +680,13 @@ static int occ_remove(struct platform_device *pdev) { struct occ *occ = platform_get_drvdata(pdev); - kvfree(occ->buffer); - misc_deregister(&occ->mdev); + mutex_lock(&occ->occ_lock); + kvfree(occ->buffer); + occ->buffer = NULL; + mutex_unlock(&occ->occ_lock); + device_for_each_child(&pdev->dev, NULL, occ_unregister_child); ida_simple_remove(&occ_ida, occ->idx); From patchwork Wed Oct 19 08:35: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: 5000 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp228919wrs; Wed, 19 Oct 2022 02:53:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM56/LVwEjBvVKtHcpCRuOU1z7TmVfDfhK4yXLFEd3wvcjKMRzNmIj7XbOIw3l5f6/42svFq X-Received: by 2002:a17:906:591:b0:73d:c3ef:84ae with SMTP id 17-20020a170906059100b0073dc3ef84aemr6018371ejn.155.1666173224505; Wed, 19 Oct 2022 02:53:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666173224; cv=none; d=google.com; s=arc-20160816; b=Nsyu5DTx5oNuO1l804SmnUEQpCDj9eOQKQmwmGsulwPim9doQTKdfb70t/8oVc1tsv rCYwzkNQlS/gsWy2zc4oyhlC2CGSlmS/xqfMALGoIkCKLUluLZ0qaESsi1kIRSFm+sF+ l7jYLYuP1TwbnKLXNdsWp2vT9r1sKGVn9FmG1vYDVJd5alVp3DXuFLNB7rIJY1vaYW44 hLdh2jq2kCgM8DiYKq5IczaWcmleLLMUBQ2x9XbPtZiM04UwmHevr8dyCcj/a+dNw03G l4YyMwp9W0hy69sKbwj8EA5QD/0tWchTIRV4cJjsnk1QbFkj0oPb+4v97Jj0ysNYOTuI bWaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZqkUbhqpgmEBwlazX4EETBQZQDAJn/bCIlmvwCWqRG0=; b=Z3kUZlji2iduCQQmnP77kLqFhFJglB13ow6svZrQ6pud1w5lR0B+XjTOe14WPTHTLe 8mW76Xcxp8KomN2UGPFr3uW/3IBUbKFb6oSVN9glOfdtH6kuzFC+Z71zM4ZNsHAI4FH/ 8MKTsDOic4Q4OrARnPlpay/K9aAwENuIZLWJOBNAWbVLYdF9ltVRolKqfOxqDlLkhhpq g/9WcY8ce6pVLW/ZcAcG3nlGjlg3kpwBsGD/oGecBfPgj3XZAbWMWPW+sYYL6c17/Qhs HfenwvdMSqW5ZsSHcdGz3iemfHDYTIo62QyROI1YZRciOnKFoPRpGq+VQZCdNoG43iHK ODhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BvCILIrP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v6-20020a1709061dc600b0078e1a6fbe15si12384106ejh.690.2022.10.19.02.53.19; Wed, 19 Oct 2022 02:53: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=BvCILIrP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234225AbiJSJqC (ORCPT + 99 others); Wed, 19 Oct 2022 05:46:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235118AbiJSJmP (ORCPT ); Wed, 19 Oct 2022 05:42:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C8BCD73F0; Wed, 19 Oct 2022 02:19:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EF0B7617FB; Wed, 19 Oct 2022 09:15:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 13464C433C1; Wed, 19 Oct 2022 09:15:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170916; bh=Wn3oSxO3heTPfc3NTmNAvwL+9w/ee0D9B9DE8PlDHrk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BvCILIrPnb7zHIYGP+v/Ktt27NvAoudo9I76oee7foDhDrJAPVVBavazlgg4HiM1d TADpQ+SZ8pKaWqNk3DH1AXmnZrdhk8w2UBu6fZ3Ro0OppEi0TXafGrD7cIt5lbHbVm cf42O33UQdHodtkKOcSW3Z69AfqLbKKeq7F3BF5A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zeal Robot , Lv Ruyi , Joel Stanley , Sasha Levin Subject: [PATCH 6.0 835/862] fsi: master-ast-cf: Fix missing of_node_put in fsi_master_acf_probe Date: Wed, 19 Oct 2022 10:35:22 +0200 Message-Id: <20221019083326.777737679@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747109255482962700?= X-GMAIL-MSGID: =?utf-8?q?1747109255482962700?= From: Lv Ruyi [ Upstream commit 182d98e00e4745fe253cb0c24c63bbac253464a2 ] of_parse_phandle returns node pointer with refcount incremented, use of_node_put() on it when done. Reported-by: Zeal Robot Signed-off-by: Lv Ruyi Link: https://lore.kernel.org/r/20220407085911.2491719-1-lv.ruyi@zte.com.cn Signed-off-by: Joel Stanley Signed-off-by: Sasha Levin --- drivers/fsi/fsi-master-ast-cf.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/fsi/fsi-master-ast-cf.c b/drivers/fsi/fsi-master-ast-cf.c index 24292acdbaf8..5f608ef8b53c 100644 --- a/drivers/fsi/fsi-master-ast-cf.c +++ b/drivers/fsi/fsi-master-ast-cf.c @@ -1324,12 +1324,14 @@ static int fsi_master_acf_probe(struct platform_device *pdev) } master->cvic = devm_of_iomap(&pdev->dev, np, 0, NULL); if (IS_ERR(master->cvic)) { + of_node_put(np); rc = PTR_ERR(master->cvic); dev_err(&pdev->dev, "Error %d mapping CVIC\n", rc); goto err_free; } rc = of_property_read_u32(np, "copro-sw-interrupts", &master->cvic_sw_irq); + of_node_put(np); if (rc) { dev_err(&pdev->dev, "Can't find coprocessor SW interrupt\n"); goto err_free; From patchwork Wed Oct 19 08:35: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: 5549 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp349199wrs; Wed, 19 Oct 2022 07:11:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5KupV8eOLZjnyfFKePfWXi6WOYtWdq0l5QA+hDhgKal/vLmVp8jTobPL0HtCLoucFoKXsS X-Received: by 2002:a17:902:be03:b0:17b:80c1:78c2 with SMTP id r3-20020a170902be0300b0017b80c178c2mr8743830pls.34.1666188680637; Wed, 19 Oct 2022 07:11:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666188680; cv=none; d=google.com; s=arc-20160816; b=xtVjefRN9YYx2nFIAnGMsq6gxrCCXthvf2mtJaE8DVpC8Jg6TVuTrd5NF4alwIp3vF sxyM4sAQw+ACIlPDEeAYg7sNz7VjsxcQO8AQq476Vk4xD/mFYjiRWCGU0QCU1dR3reTz +JSzYv7wPkqr2mT4lDjT0k9T7F5g6VM5GuawUUhXWmfM6eVIdxTb0nSU/SPlL0KJDEiY oZnovR2EDSpE3LaRm+ckJ2M25APY8wMKAflcJdYFnc+nbINg29wmtxCOySOlwge/7PwK KXc0OPlKdxdEux1S4mHa7AxXVtUeH3iXOZZyiYarmiQmc2dmisllcOFYRWuLmL/knqNl m+JA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HktMcbOT5K2DCNEzQXD0OC+qjCU7FKdadQWCKU4v76I=; b=pXGQDFp2AIJL7JdFrwHePkF9jUmS0LRb3q5T2Jyn9iTsVtxOIJiX1BEEJIkDplklyu VKfZsK9M9vnOC2FXHdohPnfoxtGcYcKSHgF5SZgI2HBfElRI0cfHXMniDCAQFlhgYGgd +bUUISNdZsyTBOnnkhrReKKDzhr6MAT/xpRaE/ws3SgFJ3qzB+gaVMPjCEfOd7TjcrpU PG0lj9dB3DbwGWHxnS8T4PGvZQfezB6XRKpkxRq+z5YL74pVmGH6fC4izZxMZyth+NAn TO8/HQR6sJAjtBVKHjuJj5FWDaaMmMWRh4GjzcGFaiYGVXoKmtkk1tsclLk97oVddEc/ 9J4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="pGqZ/gxw"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mq14-20020a17090b380e00b0020daab63f66si74768pjb.31.2022.10.19.07.10.50; Wed, 19 Oct 2022 07:11: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="pGqZ/gxw"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233684AbiJSN4X (ORCPT + 99 others); Wed, 19 Oct 2022 09:56:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230102AbiJSNxN (ORCPT ); Wed, 19 Oct 2022 09:53:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A60461CBAA3; Wed, 19 Oct 2022 06:36: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 55FB0B824E3; Wed, 19 Oct 2022 09:15:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC1CBC433C1; Wed, 19 Oct 2022 09:15:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170919; bh=UcMC/ohTlfSufjYNgla/y8KiliyHVdq5JfegDQggsIE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pGqZ/gxw51pz5lRNmKLeg31r/KhzFnuBMsgRx3hAWGQAymvm4Yu3Z5l9vaX9HgufB a61vYuopX3AJGZ+6t0+dgNrPvM7zy3jT3DFj5V5Wt0pkK+Zdh+IL4ZAfImCMG/q1u4 lHzlZekVMQw7nyG56dEIiMzmE+c2JWNvXIlL1pn4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Serge Semin , Frank Li , Manivannan Sadhasivam , Vinod Koul , Sasha Levin Subject: [PATCH 6.0 836/862] dmaengine: dw-edma: Remove runtime PM support Date: Wed, 19 Oct 2022 10:35:23 +0200 Message-Id: <20221019083326.826965155@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747125461885512160?= X-GMAIL-MSGID: =?utf-8?q?1747125461885512160?= From: Manivannan Sadhasivam [ Upstream commit a0188eb6e71c93ab7dd9bfa4305fac43c70db309 ] Currently, the dw-edma driver enables the runtime_pm for parent device (chip->dev) and increments/decrements the refcount during alloc/free chan resources callbacks. This leads to a problem when the eDMA driver has been probed, but the channels were not used. This scenario can happen when the DW PCIe driver probes eDMA driver successfully, but the PCI EPF driver decides not to use eDMA channels and use iATU instead for PCI transfers. In this case, the underlying device would be runtime suspended due to pm_runtime_enable() in dw_edma_probe() and the PCI EPF driver would have no knowledge of it. Ideally, the eDMA driver should not be the one doing the runtime PM of the parent device. The responsibility should instead belong to the client drivers like PCI EPF. So let's remove the runtime PM support from eDMA driver. Cc: Serge Semin Cc: Frank Li Reviewed-by: Serge Semin Signed-off-by: Manivannan Sadhasivam Link: https://lore.kernel.org/r/20220910054700.12205-1-manivannan.sadhasivam@linaro.org Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/dw-edma/dw-edma-core.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c index 07f756479663..c54b24ff5206 100644 --- a/drivers/dma/dw-edma/dw-edma-core.c +++ b/drivers/dma/dw-edma/dw-edma-core.c @@ -9,7 +9,6 @@ #include #include #include -#include #include #include #include @@ -682,15 +681,12 @@ static int dw_edma_alloc_chan_resources(struct dma_chan *dchan) if (chan->status != EDMA_ST_IDLE) return -EBUSY; - pm_runtime_get(chan->dw->chip->dev); - return 0; } static void dw_edma_free_chan_resources(struct dma_chan *dchan) { unsigned long timeout = jiffies + msecs_to_jiffies(5000); - struct dw_edma_chan *chan = dchan2dw_edma_chan(dchan); int ret; while (time_before(jiffies, timeout)) { @@ -703,8 +699,6 @@ static void dw_edma_free_chan_resources(struct dma_chan *dchan) cpu_relax(); } - - pm_runtime_put(chan->dw->chip->dev); } static int dw_edma_channel_setup(struct dw_edma *dw, bool write, @@ -977,9 +971,6 @@ int dw_edma_probe(struct dw_edma_chip *chip) if (err) goto err_irq_free; - /* Power management */ - pm_runtime_enable(dev); - /* Turn debugfs on */ dw_edma_v0_core_debugfs_on(dw); @@ -1009,9 +1000,6 @@ int dw_edma_remove(struct dw_edma_chip *chip) for (i = (dw->nr_irqs - 1); i >= 0; i--) free_irq(chip->ops->irq_vector(dev, i), &dw->irq[i]); - /* Power management */ - pm_runtime_disable(dev); - /* Deregister eDMA device */ dma_async_device_unregister(&dw->wr_edma); list_for_each_entry_safe(chan, _chan, &dw->wr_edma.channels, From patchwork Wed Oct 19 08:35: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: 4959 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp226583wrs; Wed, 19 Oct 2022 02:46:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Vt+Dl+ylSHSaScu9VucQTfXW6vhoXzJ5/lfvqxwMmcRGF3P0Mv/vyZzsJdUS5OYHVdshy X-Received: by 2002:a05:6a00:14d4:b0:563:9296:f320 with SMTP id w20-20020a056a0014d400b005639296f320mr7595789pfu.27.1666172779062; Wed, 19 Oct 2022 02:46:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172779; cv=none; d=google.com; s=arc-20160816; b=Goreo4ONFIpsm/tjiz633YMaCUN3Lmyi6cDGJTAg8sLlnkD+EFh621qfSQ5H6ZcIrc QCyY9NHDt2QmaE66i6jejm3ICWdbTUsps8uY5RdZ91Y3YLzVmbcubznOEPipMN6GS64k SKFNlzGIpIdIFzGgE50KwtL2Xkk/S8epoWR+73xPF4T2ZjqbbxnM14EXkGIfx1iMd1A7 um51SzZoedUiufirsypblEif8oVu2mN0cpcJCcTt0RjT07+4g712JV8GYkMOcQYZQSJj p3ro+diYqXfoO9pAYPEbQtCduN1BdGjOdJ23GSjsanq5hKW6ex8HZ5vfZNUES/xD3S2J 7ebQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kPlUaQ+iKtENq0IJ54RWWYW1ELX4S1Vhd46BLkycqF8=; b=LK388eAk3ju7/C3iqEq39fn4hC/xIMGorJjT6JDtQ8L0grU8Mb1cOEO1/qX7aXJcBs smqFaCjrVpliq0bKKSfGsWyWKTYChCE31+ASkBzvk3HWYQoLLGqSWM4KY4v/cS2MVFH1 LTxxXfQ+9Vf7Car5SJF50+Q5ianxHppxUYgKqbHZMZ741yCtGBFq3HAJwMH67JvHQbeS dcUVLe3d5GBTqn++5vr+l4SRkIdDk9Qm3QdVe11Ho3U8Z/rCOVtmlR7dj5CtsyrXUmD7 ppLEfVTXtg4xmqS0U2bIW1Xm5mkY6YD7MdoMs31SOETPG8mYu7hd+g6kuOdRV6dN+o7F 8MGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JqcRCss7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nl5-20020a17090b384500b00205dfd2c794si25130297pjb.167.2022.10.19.02.46.04; Wed, 19 Oct 2022 02:46: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=JqcRCss7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234369AbiJSJnY (ORCPT + 99 others); Wed, 19 Oct 2022 05:43:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234440AbiJSJk0 (ORCPT ); Wed, 19 Oct 2022 05:40:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C30AEF5B5; Wed, 19 Oct 2022 02:16: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 31B2061802; Wed, 19 Oct 2022 09:15:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46213C433C1; Wed, 19 Oct 2022 09:15:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170921; bh=pZTA8+b6t89yvqWaduEatUoC/Fpvy1u8fwa7q8EqwVU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JqcRCss7xi4u/Rzls9U8ey4doJ89DvP7IbQxoN4e6o88gMcbsd2HXykW2veO2Zbdm ah3YI0f3W7AXREnd+v3yQNlzewDqmTC0qy0og93eJZ9KNTuYBpUnnVieoEr91f3Lw+ SbHifRXOorWoFBEYjQw7Tv9u2fr4vaw/7L6cywKc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wayne Chang , Heikki Krogerus , Sasha Levin Subject: [PATCH 6.0 837/862] usb: typec: ucsi: Dont warn on probe deferral Date: Wed, 19 Oct 2022 10:35:24 +0200 Message-Id: <20221019083326.876259062@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108788214396182?= X-GMAIL-MSGID: =?utf-8?q?1747108788214396182?= From: Wayne Chang [ Upstream commit fce703a991b7e8c7e1371de95b9abaa832ecf9c3 ] Deferred probe is an expected return value for fwnode_usb_role_switch_get(). Given that the driver deals with it properly, there's no need to output a warning that may potentially confuse users. --- V2 -> V3: remove the Fixes and Cc V1 -> V2: adjust the coding style for better reading format. drivers/usb/typec/ucsi/ucsi.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) Signed-off-by: Wayne Chang Acked-by: Heikki Krogerus Link: https://lore.kernel.org/r/20220927134512.2651067-1-waynec@nvidia.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/typec/ucsi/ucsi.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c index 6364f0d467ea..74fb5a4c6f21 100644 --- a/drivers/usb/typec/ucsi/ucsi.c +++ b/drivers/usb/typec/ucsi/ucsi.c @@ -1067,11 +1067,9 @@ static int ucsi_register_port(struct ucsi *ucsi, int index) cap->fwnode = ucsi_find_fwnode(con); con->usb_role_sw = fwnode_usb_role_switch_get(cap->fwnode); - if (IS_ERR(con->usb_role_sw)) { - dev_err(ucsi->dev, "con%d: failed to get usb role switch\n", - con->num); - return PTR_ERR(con->usb_role_sw); - } + if (IS_ERR(con->usb_role_sw)) + return dev_err_probe(ucsi->dev, PTR_ERR(con->usb_role_sw), + "con%d: failed to get usb role switch\n", con->num); /* Delay other interactions with the con until registration is complete */ mutex_lock(&con->lock); From patchwork Wed Oct 19 08:35: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: 4994 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp228037wrs; Wed, 19 Oct 2022 02:50:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4LZRw3kH6bbXLZcYtkGW0eW9tJw40qFsBVLVDGppuRIsmbwxU/JIFB7wuyifTOVEr21m9x X-Received: by 2002:a17:907:c03:b0:781:fd5a:c093 with SMTP id ga3-20020a1709070c0300b00781fd5ac093mr6006697ejc.89.1666173052241; Wed, 19 Oct 2022 02:50:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666173052; cv=none; d=google.com; s=arc-20160816; b=zDiYTFS1MHr2n6H8w6VXuXXmk1wukyOZUeyRsSHNOCZP4bfClEmuEtUthYWc6RvGg1 HqyLM2jpe3ImigfL9b9ZUOvW2HhR3CufKW64CZT9PJqN7IBwSud0xzyUAorXeADJiVmU 7kANwY6n1EwOwT0UpYXZ1EdRJEV4pnMWAUeI//QyPSSwFplobStoD6P3PAtHONf8jzB6 hLHPmSxiCQK3eHB+Z1kRzrAz0ICqAexTpWECEvVHM1Fi3oE015KEiWcDHIXWZZLkg3lf pa4uIVkC2efF3s8vuLZYhQXI+ucXVr6W4xHE9wi6gogcu/oS3Uhl36QcrLQ5v6IWU3TG d8Yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=n9+3I6df9kyNB+5t+tXn/pRdnRxOnJ5haWzAoO44kfk=; b=uwnq4HEk5Gkrn4ZI4fujQt/Hu60MEiy+fL1JxhAVO7Mz4+KwESGwWcTpfQ67YQceem IOKYF+UfptR4+meyd0A6dJnEcbnZdpHkE6pHa2vvDdVibl9btCbrgoHGhxfycWhFU9Zc +u01U4SOVv+4JOkHUBGD2IphVrH9nMgl5ej5LSeBCM42v/1cQSCT0F7GIVjUy7hfMAMV 6D/OOB1JLMA5iMK3X53ez8idLqiQGgu89N6Vr+tRHUCD53JwKZ5KcHlApjgm6gbvFaJm F07NhrsF63yhHqLUBpfahl0Iy46BWVRhCy32ubuv4luiro6HBlxg9B3QZNn7S5to3GMq Fg7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uO1ifnZn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h21-20020a056402281500b0045b293121f1si11943022ede.12.2022.10.19.02.50.27; Wed, 19 Oct 2022 02: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=uO1ifnZn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234665AbiJSJpB (ORCPT + 99 others); Wed, 19 Oct 2022 05:45:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234890AbiJSJls (ORCPT ); Wed, 19 Oct 2022 05:41:48 -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 7A9AEF5CF4; Wed, 19 Oct 2022 02:18:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D5B4161807; Wed, 19 Oct 2022 09:15:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D605CC433D6; Wed, 19 Oct 2022 09:15:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170924; bh=5aitl3GEqiPMweqkIwJxZlH7zJawy7W/BWV5r8LclIQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uO1ifnZnBCUhaOF+j0x8BAOQGx1C4kDRaPjzU23VLZnz//hp+2hmtsJjLPiHl8XfD y/UpEvJ2yGj3DhzWdonQhYQS4o6JXX/rzp26dnuoX1/i+3VKwSnpORujO6cvzgMnU7 pfRnwEAgoQkhk9K38lJSQ5MXiM5eDV5grYPz2grk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Phil Elwell , "Ivan T. Ivanov" , Stefan Wahren , Stephen Boyd , Sasha Levin Subject: [PATCH 6.0 838/862] clk: bcm2835: Round UART input clock up Date: Wed, 19 Oct 2022 10:35:25 +0200 Message-Id: <20221019083326.915279544@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747109074117379104?= X-GMAIL-MSGID: =?utf-8?q?1747109074117379104?= From: Ivan T. Ivanov [ Upstream commit f690a4d7a8f66430662975511c86819dc9965bcc ] It was reported that RPi3[1] and RPi Zero 2W boards have issues with the Bluetooth. It turns out that when switching from initial to operation speed host and device no longer can talk each other because host uses incorrect UART baud rate. The UART driver used in this case is amba-pl011. Original fix, see below Github link[2], was inside pl011 module, but somehow it didn't look as the right place to fix. Beside that this original rounding function is not exactly perfect for all possible clock values. So I deiced to move the hack to the platform which actually need it. The UART clock is initialised to be as close to the requested frequency as possible without exceeding it. Now that there is a clock manager that returns the actual frequencies, an expected 48MHz clock is reported as 47999625. If the requested baud rate == requested clock/16, there is no headroom and the slight reduction in actual clock rate results in failure. If increasing a clock by less than 0.1% changes it from ..999.. to ..000.., round it up. [1] https://bugzilla.suse.com/show_bug.cgi?id=1188238 [2] https://github.com/raspberrypi/linux/commit/ab3f1b39537f6d3825b8873006fbe2fc5ff057b7 Cc: Phil Elwell Signed-off-by: Ivan T. Ivanov Reviewed-by: Stefan Wahren Link: https://lore.kernel.org/r/20220912081306.24662-1-iivanov@suse.de Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/bcm/clk-bcm2835.c | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c index f1102b4c7e88..e74fe6219d14 100644 --- a/drivers/clk/bcm/clk-bcm2835.c +++ b/drivers/clk/bcm/clk-bcm2835.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -502,6 +503,8 @@ struct bcm2835_clock_data { bool low_jitter; u32 tcnt_mux; + + bool round_up; }; struct bcm2835_gate_data { @@ -993,12 +996,34 @@ static unsigned long bcm2835_clock_rate_from_divisor(struct bcm2835_clock *clock return temp; } +static unsigned long bcm2835_round_rate(unsigned long rate) +{ + unsigned long scaler; + unsigned long limit; + + limit = rate / 100000; + + scaler = 1; + while (scaler < limit) + scaler *= 10; + + /* + * If increasing a clock by less than 0.1% changes it + * from ..999.. to ..000.., round up. + */ + if ((rate + scaler - 1) / scaler % 1000 == 0) + rate = roundup(rate, scaler); + + return rate; +} + static unsigned long bcm2835_clock_get_rate(struct clk_hw *hw, unsigned long parent_rate) { struct bcm2835_clock *clock = bcm2835_clock_from_hw(hw); struct bcm2835_cprman *cprman = clock->cprman; const struct bcm2835_clock_data *data = clock->data; + unsigned long rate; u32 div; if (data->int_bits == 0 && data->frac_bits == 0) @@ -1006,7 +1031,12 @@ static unsigned long bcm2835_clock_get_rate(struct clk_hw *hw, div = cprman_read(cprman, data->div_reg); - return bcm2835_clock_rate_from_divisor(clock, parent_rate, div); + rate = bcm2835_clock_rate_from_divisor(clock, parent_rate, div); + + if (data->round_up) + rate = bcm2835_round_rate(rate); + + return rate; } static void bcm2835_clock_wait_busy(struct bcm2835_clock *clock) @@ -2143,7 +2173,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = { .div_reg = CM_UARTDIV, .int_bits = 10, .frac_bits = 12, - .tcnt_mux = 28), + .tcnt_mux = 28, + .round_up = true), /* TV encoder clock. Only operating frequency is 108Mhz. */ [BCM2835_CLOCK_VEC] = REGISTER_PER_CLK( From patchwork Wed Oct 19 08:35: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: 4960 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp226610wrs; Wed, 19 Oct 2022 02:46:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7H/sEjepWDp/KE47yUKOs9QMIaD1KTxjEzW6JplSV9tV8ERM9RtkR4qTcOXABB1SGdd/uo X-Received: by 2002:a17:90b:38c5:b0:20d:2938:8123 with SMTP id nn5-20020a17090b38c500b0020d29388123mr8617732pjb.59.1666172783690; Wed, 19 Oct 2022 02:46:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172783; cv=none; d=google.com; s=arc-20160816; b=uLNooyZsDGqOCmP6t2OgrRLlGhCgRBeS4mPihoFQPPvuSITPj1xxVzhPCytjxVkSnA R0I3k10KGphfc1ALamOpVjBTmdhYYXykl5TWCqI1Dkh+xfoKOV2t/iNxlrEk5efrVa+i WWbqxdCzab6P3HWsqwhhF5vefcb53+xSEL5eWIJ9cXVQCS7yEJLzodt1D+w5akpxV8kx FsRvkkvbBwe28yNY6ffIODCTCRqWIvz+34b/PKXqulNn3mn/OVcze9Rc9SzKID2jKRzy gNh7ryLCmgzX+FjaUou03zVGEEYDdhrEcHdbNTPZ8db+uacYHYal8B31ni63wyXes/V1 VEig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=obhLpwC6+IBDnJXSrBqEpsPO+G6A1CLS1fwkjUSbJDM=; b=acrb35WyMH9jGlbYUabGU1qwRpYRudI2t1ojKKIur6BcNMHsv21UfkUXo9CNJRbT4j ic4/aAqVh8warQcepe6HYN49k0G/awvvsoSdPkARWy8h01P68GwcEUx0jaPJFYFcLXsL wGJVlV9BbaoUnELQNIQRs2FbX2XQ1IhMb67sukff6t79Jzw+yL/2xPGES3ZQalmWY0PD REsQrU7tJPLO45LMkMKAyVvNScz8Xc41YiVeJPFJJEMyKEZ016G++gXXYBFXMOqHnFJw bv6Lm++7BaJUOVUITuYCqFFuD82ej4OnQqhAoJEJPdn51GWuFZtqukl9XJbwT1ecTb9r 4fCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ucTIubPR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g8-20020a1709026b4800b001784c98bfddsi16633370plt.24.2022.10.19.02.46.05; Wed, 19 Oct 2022 02: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=ucTIubPR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230305AbiJSJn3 (ORCPT + 99 others); Wed, 19 Oct 2022 05:43:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234447AbiJSJk1 (ORCPT ); Wed, 19 Oct 2022 05:40:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A44F9B03E5; Wed, 19 Oct 2022 02:16: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 A418761803; Wed, 19 Oct 2022 09:15:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F308C433D6; Wed, 19 Oct 2022 09:15:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170927; bh=B/vyKcBqRXueM8on2fTuH4rYzLenjFoS2xDfiFPjq0M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ucTIubPRxAFPwCIGJKN4uTkXcAhKmpHGTQ08Zn5tSqY3xT6FisgqkmYxdji6tO8bR mWkfyklR/09oOkZXXHF8MOeETeNcC+utlhNFeQpVu+wtCTP+Z7UrY4AoTg5crqmW9t DzJOIf1NpEx/4pOZItSLGSvIHi5AyOyH0X7y8NbQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Namhyung Kim , Rob Herring , Leo Yan , Alexander Shishkin , Ingo Molnar , James Clark , Jiri Olsa , Mark Rutland , Peter Zijlstra , Arnaldo Carvalho de Melo Subject: [PATCH 6.0 839/862] perf: Skip and warn on unknown format configN attrs Date: Wed, 19 Oct 2022 10:35:26 +0200 Message-Id: <20221019083326.954245107@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108792883996642?= X-GMAIL-MSGID: =?utf-8?q?1747108792883996642?= From: Rob Herring commit e552b7be12ed62357df84392efa525ecb01910fb upstream. If the kernel exposes a new perf_event_attr field in a format attr, perf will return an error stating the specified PMU can't be found. For example, a format attr with 'config3:0-63' causes an error as config3 is unknown to perf. This causes a compatibility issue between a newer kernel with older perf tool. Before this change with a kernel adding 'config3' I get: $ perf record -e arm_spe// -- true event syntax error: 'arm_spe//' \___ Cannot find PMU `arm_spe'. Missing kernel support? Run 'perf list' for a list of valid events Usage: perf record [] [] or: perf record [] -- [] -e, --event event selector. use 'perf list' to list available events After this change, I get: $ perf record -e arm_spe// -- true WARNING: 'arm_spe_0' format 'inv_event_filter' requires 'perf_event_attr::config3' which is not supported by this version of perf! [ perf record: Woken up 2 times to write data ] [ perf record: Captured and wrote 0.091 MB perf.data ] To support unknown configN formats, rework the YACC implementation to pass any config[0-9]+ format to perf_pmu__new_format() to handle with a warning. Reviewed-by: Namhyung Kim Signed-off-by: Rob Herring Tested-by: Leo Yan Cc: Alexander Shishkin Cc: Ingo Molnar Cc: James Clark Cc: Jiri Olsa Cc: Mark Rutland Cc: Peter Zijlstra Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20220914-arm-perf-tool-spe1-2-v2-v4-1-83c098e6212e@kernel.org Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Greg Kroah-Hartman --- tools/perf/util/parse-events.c | 3 +++ tools/perf/util/pmu.c | 17 +++++++++++++++++ tools/perf/util/pmu.h | 2 ++ tools/perf/util/pmu.l | 2 -- tools/perf/util/pmu.y | 15 ++++----------- 5 files changed, 26 insertions(+), 13 deletions(-) --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -254,6 +254,9 @@ __add_event(struct list_head *list, int struct perf_cpu_map *cpus = pmu ? perf_cpu_map__get(pmu->cpus) : cpu_list ? perf_cpu_map__new(cpu_list) : NULL; + if (pmu) + perf_pmu__warn_invalid_formats(pmu); + if (pmu && attr->type == PERF_TYPE_RAW) perf_pmu__warn_invalid_config(pmu, attr->config, name); --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -1005,6 +1005,23 @@ err: return NULL; } +void perf_pmu__warn_invalid_formats(struct perf_pmu *pmu) +{ + struct perf_pmu_format *format; + + /* fake pmu doesn't have format list */ + if (pmu == &perf_pmu__fake) + return; + + list_for_each_entry(format, &pmu->format, list) + if (format->value >= PERF_PMU_FORMAT_VALUE_CONFIG_END) { + pr_warning("WARNING: '%s' format '%s' requires 'perf_event_attr::config%d'" + "which is not supported by this version of perf!\n", + pmu->name, format->name, format->value); + return; + } +} + static struct perf_pmu *pmu_find(const char *name) { struct perf_pmu *pmu; --- a/tools/perf/util/pmu.h +++ b/tools/perf/util/pmu.h @@ -17,6 +17,7 @@ enum { PERF_PMU_FORMAT_VALUE_CONFIG, PERF_PMU_FORMAT_VALUE_CONFIG1, PERF_PMU_FORMAT_VALUE_CONFIG2, + PERF_PMU_FORMAT_VALUE_CONFIG_END, }; #define PERF_PMU_FORMAT_BITS 64 @@ -139,6 +140,7 @@ int perf_pmu__caps_parse(struct perf_pmu void perf_pmu__warn_invalid_config(struct perf_pmu *pmu, __u64 config, const char *name); +void perf_pmu__warn_invalid_formats(struct perf_pmu *pmu); bool perf_pmu__has_hybrid(void); int perf_pmu__match(char *pattern, char *name, char *tok); --- a/tools/perf/util/pmu.l +++ b/tools/perf/util/pmu.l @@ -27,8 +27,6 @@ num_dec [0-9]+ {num_dec} { return value(10); } config { return PP_CONFIG; } -config1 { return PP_CONFIG1; } -config2 { return PP_CONFIG2; } - { return '-'; } : { return ':'; } , { return ','; } --- a/tools/perf/util/pmu.y +++ b/tools/perf/util/pmu.y @@ -20,7 +20,7 @@ do { \ %} -%token PP_CONFIG PP_CONFIG1 PP_CONFIG2 +%token PP_CONFIG %token PP_VALUE PP_ERROR %type PP_VALUE %type bit_term @@ -47,18 +47,11 @@ PP_CONFIG ':' bits $3)); } | -PP_CONFIG1 ':' bits +PP_CONFIG PP_VALUE ':' bits { ABORT_ON(perf_pmu__new_format(format, name, - PERF_PMU_FORMAT_VALUE_CONFIG1, - $3)); -} -| -PP_CONFIG2 ':' bits -{ - ABORT_ON(perf_pmu__new_format(format, name, - PERF_PMU_FORMAT_VALUE_CONFIG2, - $3)); + $2, + $4)); } bits: From patchwork Wed Oct 19 08:35: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: 4992 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp227480wrs; Wed, 19 Oct 2022 02:48:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM71uHUT8oSquOH9QL7GYGIks+N7SOh4RGvha8nZznpkJnvuzAmF2RvhfIYoTbXK7Rkbl14T X-Received: by 2002:a17:902:7c14:b0:17f:6303:f40 with SMTP id x20-20020a1709027c1400b0017f63030f40mr7427684pll.1.1666172939199; Wed, 19 Oct 2022 02:48:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172939; cv=none; d=google.com; s=arc-20160816; b=VGE6Mz3/O2/CKFBiT0GRII1U29woxKXNIxbthoLtb5xd0DeP0Mdbc/5g0gPf0C2GCB zn1IsGaQByIdn15WN8UMCwThSQ1cQwo72K3Gk244fBQutqJIoFqfRzOzRb98fIyHy4GQ 53UxR7rBCq1AHpc11QGTUZ2NWha56+JLQKK07ufE4Agu3sOfWS1k7y1lzOuPhXr9BHXn 5m7BdlX5CriBSiPL0Q51ipoZP4IXxKBBf6XShMe3I7fPgW4QVQRxUNyfJmy9KbPtP4AM zagE/SouLcGYLbssQxYAPpliwzysJGrLSuPG22DzVaRGmeSAR7FxViBU7M1hjxxXdeaM M9Jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=KnkOJevIMxVQ55F/TzQkOO48aMi3h4cjf0n+Nojdx7M=; b=W89QX2CjNEieZVd2fFeN3KMgGVAkBvoDiUkxqGIgu1FuqzfIj9LMil60PlNSsWXEPi 8vxJua4DH93k+oxTQGFVi27cJJl2rRqOlbgCpwoJFWpZeWKAhSd289ieHMPFPwUXsDbc YUJGblrvkd5LSritdAnbsEcvRgAjZFTQWSnGZUmE4Pwyttmzh/Uiy7rX1k5JEbqeQ6BO aeD3qEO5c7FqQQgI4JrVBmG3JDABLiNTAtMGgKMknaSNIqDlCahkbN45b/0NKIFb9pOx xmrK5yo4BWdeXJaxM2YcDPhw24SfK5Q9xykf5wAY1T2hZM4bCl26gWJHLwG0sTATlnUT aAZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ntG3Rq4f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k62-20020a638441000000b00439fbc1b5absi16920797pgd.797.2022.10.19.02.48.46; Wed, 19 Oct 2022 02:48: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=ntG3Rq4f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233748AbiJSJpF (ORCPT + 99 others); Wed, 19 Oct 2022 05:45:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234953AbiJSJl5 (ORCPT ); Wed, 19 Oct 2022 05:41:57 -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 9FDDCF5CDF; Wed, 19 Oct 2022 02:18:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4CF1F6181A; Wed, 19 Oct 2022 09:15:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E78AC433D6; Wed, 19 Oct 2022 09:15:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170929; bh=Cjo4WF83Lp3JlA7ZtBZMDCxCi1/3fmTXVCVb5izr2JY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ntG3Rq4fVdxT3EoUt/YBoAgTFK0pX70lZBDomp3Qkd5XElD0SdVPQ7SUphQWGsHN4 rzi+iBfcYGONEvi9cc7iQlVWq3i1WXx0WGObTsqPFmImlrUQSDBL29Ndf8M4gTvDxI 9SR/TvXkVY4JYOikOwm9ouphNuanbMRU2KymSMx4= 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 6.0 840/862] perf intel-pt: Fix segfault in intel_pt_print_info() with uClibc Date: Wed, 19 Oct 2022 10:35:27 +0200 Message-Id: <20221019083327.001758539@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108955889373233?= X-GMAIL-MSGID: =?utf-8?q?1747108955889373233?= 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 @@ -4033,6 +4033,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", @@ -4047,8 +4048,12 @@ static void intel_pt_print_info(__u64 *a 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 Wed Oct 19 08:35: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: 5047 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp247463wrs; Wed, 19 Oct 2022 03:40:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7X2uqV/rwN3KywgJNKQTRuy+tZdZO6KbsecCllVutgHgLxw/ygEbvaZqaQ5iO7FFR9JtJ6 X-Received: by 2002:a17:907:2c78:b0:78d:eacd:1060 with SMTP id ib24-20020a1709072c7800b0078deacd1060mr6038786ejc.244.1666176052396; Wed, 19 Oct 2022 03:40:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176052; cv=none; d=google.com; s=arc-20160816; b=QWyI+WRoTz1xoQsrmrMdnhsQ6l0jlBekCD245987L7ZRxyoyzpXxLJMFXWEeakzt3w KeiJX+tMapa3Ze95f1dUpOGGIGKjY7jD6wko1a+I43NBH2g0HZms8GJGoojznRcjWPlR VgW4Riz8uVa6Inl0wMgM/qYggZa9+9bqBD8k/IEQhl9Q/p2ZWBFuJJb88V6bzt+HaQJO 1hhaMEbiG0TxV6lcqag1DEsuRHSgfYQ/pm6oZgd4lQUvgKAS8TFFBfiIgaBeOKP4a9LG oXFsMWZUQy+xmrXG5eBibkvByfDKOXJNErOk7rfpL3e/ad4iaLkld/8VabxcQFPWXl84 VBtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=g4PC4xOrQIxZ0ydw36JaxPy1FgjMMgTstwR54iH0OOQ=; b=QhCp5T7u1ZL/Rrfe/sH7wNJgIuJTSqrNf2nj/TACG+NqU3d0vV+maNWryrN9P1dUXd viTti8TOLnk0yYbjK0MqTYcMzPfV3uoCtj5CREpUJZ2RJaYTaX6pQimTV2hA6t+BCrSA FmRbWJduf08o0Z4gwt2v9LZNQZbkLN3ALP/EckM7ApU71P895vv5zHK2sLNo7zutJ7Rj 3EDd08JGzgVK/jzY+4sUMkFe/0Lv6Ys1QoeIJHgF5blTGzSoIcao9kFAU86c0TYaQ5Kc 2fCewBJ0/A5hGCZxkObOlE3QYjaZiimWAsQsmfy9NP5k7pIRSf7yBNPFX4GEeMZgAcr1 pYxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nqonhaDo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h21-20020a056402281500b0045b293121f1si12019859ede.12.2022.10.19.03.40.26; Wed, 19 Oct 2022 03:40: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=nqonhaDo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231932AbiJSKjx (ORCPT + 99 others); Wed, 19 Oct 2022 06:39:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232271AbiJSKjF (ORCPT ); Wed, 19 Oct 2022 06:39:05 -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 AA85110D69E; Wed, 19 Oct 2022 03:18:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7A06AB824E0; Wed, 19 Oct 2022 09:15:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7604C433C1; Wed, 19 Oct 2022 09:15:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170932; bh=6HicgzDugBOerZVbAxSgXH2xBFYBrHxtY5zu4BuDnVg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nqonhaDovym4BaCrV1Gw6FqJVXilEjOwRQpbQRZJUknKhe1nbfwbBXmiPGmtroCJI ReLhR5zzSKhblf6klIFlbPxJG3E4qWzfJNcaF2I4YChFSgCF0BWaG/BmjJnDO+e3+n qG9zndaBjg841Ko4jhZ4e8C68UxfKNUcNEWpYiq8= 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 6.0 841/862] perf intel-pt: Fix system_wide dummy event for hybrid Date: Wed, 19 Oct 2022 10:35:28 +0200 Message-Id: <20221019083327.051777058@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112220265407376?= X-GMAIL-MSGID: =?utf-8?q?1747112220265407376?= From: Adrian Hunter commit 6cef7dab3e2e5cb23a13569c3880c0532326748c upstream. User space tasks can migrate between CPUs, so when tracing selected CPUs, system-wide sideband is still needed, however evlist->core.has_user_cpus is not set in the hybrid case, so check the target cpu_list instead. Fixes: 7d189cadbeebc778 ("perf intel-pt: Track sideband system-wide when needed") 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-3-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Greg Kroah-Hartman --- tools/perf/arch/x86/util/intel-pt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/tools/perf/arch/x86/util/intel-pt.c +++ b/tools/perf/arch/x86/util/intel-pt.c @@ -871,7 +871,7 @@ static int intel_pt_recording_options(st * User space tasks can migrate between CPUs, so when tracing * selected CPUs, sideband for all CPUs is still needed. */ - need_system_wide_tracking = evlist->core.has_user_cpus && + need_system_wide_tracking = opts->target.cpu_list && !intel_pt_evsel->core.attr.exclude_user; tracking_evsel = evlist__add_aux_dummy(evlist, need_system_wide_tracking); From patchwork Wed Oct 19 08:35: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: 5073 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp249157wrs; Wed, 19 Oct 2022 03:45:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7+wUhXSqcUkEdT0WNYVFMtBA5UmMaHQ29Yoo0GmCPiDKgSWMOrsqYzKfLupr8I6wLiQyjY X-Received: by 2002:a63:1b5d:0:b0:461:7362:e8b5 with SMTP id b29-20020a631b5d000000b004617362e8b5mr6605653pgm.83.1666176330232; Wed, 19 Oct 2022 03:45:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176330; cv=none; d=google.com; s=arc-20160816; b=oavItWG4tgMIP7ZBERjaEhCOYT4jJX9bd4kS0Ef7Pze+tQDu893tTG6iNdmrTxhyrk caVyEUoyK6FEimI+mJSQKJb7wN8tPtRnYLfTLFmis6zxX2p6BzQeWgrkCq6b/I68mMzO svvogSQoD6hZtU2A0PdeWLgqf2T/0T/i4JB0f1zD0mj8z4+54BCgqY6cthwn5SuAL+ky ZGeeSZB1ylZ7aRKsfZOdCytyRTEcx1DnWiDzxMw9AiyPGjm4nu9ZvE8DFwwIdNcsPjs+ JT0gCp/uEBtd5RMn1spA1DSE4OW4GgkqxU4ZF2fTVsXSBV7IT1Sw4sejvTH+MvF89097 DLNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Ny7L45gsfPKqOFxhhQ5alArxfjqCEGDduEhQYR3+BvI=; b=htwwOakjXHu/8L03NAqGV+0U0j/nt/HAtG1PULo3YtPrvjNRzXbq7PpnYLvjkVozgV pW/vYSFO8Cv4Q27TIn/aPAHXBNmhvi4PQgOc62DokHQL2vR6yQLA7xllgGOwdElaRBL7 CSW3i98Gf7viHxJwWIQUK52pP7FnPBPWcqP89xSRSxKGPzifi87nnNwfYy7w8hrlyGBG sP4t+wskbk2C5KkuA/55iFslnOKYbPH2qaxRnJkIuAYIPrypgwpmMaxGkYp7gBy08vup 9ihAFTxyiZ/RY5pud7vuZpO/Gacd5Puktq9EbRvJaDQAjJwe3V6kFp38dNfBsIR5YiuZ eang== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cunZMp4m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h1-20020a17090a710100b0020d48e8ecc5si15383662pjk.115.2022.10.19.03.45.17; Wed, 19 Oct 2022 03:45: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=cunZMp4m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232535AbiJSKpB (ORCPT + 99 others); Wed, 19 Oct 2022 06:45:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232402AbiJSKnU (ORCPT ); Wed, 19 Oct 2022 06:43: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 943254330F; Wed, 19 Oct 2022 03:20:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0F511B824E7; Wed, 19 Oct 2022 09:15:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82A64C433C1; Wed, 19 Oct 2022 09:15:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170934; bh=f0d2g5W7whvr5O2/g5p6rp6VsVXxSHcsF+rMJ5dvsOY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cunZMp4moJzdOEhcLbQiik2csL5VAD4dyejkOgK6/jSRpDrKLDATwKZSB5Uluz4Ap c3ALfW9izGGH9c+SAKUHu6dhurb3cX8fAgleCJTM5+a/cj1mZNBzhSt/IjKc1e+K4b b7GtM2owh9X+el5bTgfOSJiTxwZkD1Uif7psLj/4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Pavel Begunkov , Jens Axboe Subject: [PATCH 6.0 842/862] io_uring/net: refactor io_sr_msg types Date: Wed, 19 Oct 2022 10:35:29 +0200 Message-Id: <20221019083327.098536439@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112511525487308?= X-GMAIL-MSGID: =?utf-8?q?1747112511525487308?= From: Pavel Begunkov [ upstream commit 0b048557db761d287777360a100e1d010760d209 ] In preparation for using struct io_sr_msg for zerocopy sends, clean up types. First, flags can be u16 as it's provided by the userspace in u16 ioprio, as well as addr_len. This saves us 4 bytes. Also use unsigned for size and done_io, both are as well limited to u32. Signed-off-by: Pavel Begunkov Link: https://lore.kernel.org/r/42c2639d6385b8b2181342d2af3a42d3b1c5bcd2.1662639236.git.asml.silence@gmail.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- io_uring/net.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) --- a/io_uring/net.c +++ b/io_uring/net.c @@ -56,21 +56,21 @@ struct io_sr_msg { struct user_msghdr __user *umsg; void __user *buf; }; + unsigned len; + unsigned done_io; unsigned msg_flags; - unsigned flags; - size_t len; - size_t done_io; + u16 flags; }; struct io_sendzc { struct file *file; void __user *buf; - size_t len; + unsigned len; + unsigned done_io; unsigned msg_flags; - unsigned flags; - unsigned addr_len; + u16 flags; + u16 addr_len; void __user *addr; - size_t done_io; struct io_kiocb *notif; }; From patchwork Wed Oct 19 08:35: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: 5043 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp247238wrs; Wed, 19 Oct 2022 03:40:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4vajHzAXxtFym/+tSedWfSBtmkvj3yMrGbxRI+nVEMzQQyIGho/u4fRvGPm5x5zirJvTPD X-Received: by 2002:a17:906:8a6a:b0:78d:f18e:5d6f with SMTP id hy10-20020a1709068a6a00b0078df18e5d6fmr6195245ejc.489.1666176018752; Wed, 19 Oct 2022 03:40:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176018; cv=none; d=google.com; s=arc-20160816; b=NQz5s6Gx4ispBpcBqzV6FTF2Gf6Ryk/tS/HtjxyA5mNav+pmTkprKJW7NKf156MTjz jQLU/kSGP5+LC3bLE/D74fvU+IZfPKj4c8kQaZcOcuuVdawh5kFPfJVq2kSkw67MBTuV OgJeCz2KUiUWMU9gOE9TyRn5QdfNJuRKxD8DUSBUpZU7X0dpSB+1WdNt/zvn52JUaY8f iphboQTahq4k7lOvlRGRPwkTfwhXDJUmH9K5ypo7ze9RQMl799Nh9WiXkMoEAhKd6BJI qXt0f2gadLu95kZFKeEXN7Vf9Ai4lxVp4g5gLIo/5d3iMhdpJXuZvxiOxZHLqiqERURv +s0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=48Pxewd6eYEJy08J4bISQJ6ElY1OVWbCY8TD9tLGQWw=; b=dOiJAYf6klaPr0ihGNt2T0mjz1OdulwBCV2+tz7ZFbGxyp0/U4ZDCkttbw/HjuC5Kg ee/YUkn4WYxHsHyaX9taSJxJ+SsrQas0mo4FiYlmHZDZPHkVB2QHkEPzsV64uavjLKyG 1HTPmroQABPGSX25WhBVeNY5nevBzBmTSOa5LDQhYgeCAz8tSvYnmfWf1KgbzjvH1z1n /qWxgxtpM7zbViI3AJgo04h7h0fy+V1OqzOjEQxZvS6p9PFEq7o56gZkNmfA0w7yriOm weodV2kNw8vihY+jswN8Yt6FvFVhVNhOLnraXyE5N/bRyHM+VlzTgJ32cNleOr2ajHl+ c0RQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rrHJBRff; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q14-20020a056402040e00b0045d8bff7b1asi6560794edv.403.2022.10.19.03.39.53; Wed, 19 Oct 2022 03:40: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=rrHJBRff; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231853AbiJSKiv (ORCPT + 99 others); Wed, 19 Oct 2022 06:38:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231855AbiJSKi1 (ORCPT ); Wed, 19 Oct 2022 06:38:27 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD43D14706B; Wed, 19 Oct 2022 03:17: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 ams.source.kernel.org (Postfix) with ESMTPS id BD090B824DD; Wed, 19 Oct 2022 09:15:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22190C433C1; Wed, 19 Oct 2022 09:15:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170937; bh=j0VtTnG6a2Rj5CWn/UcXVfa2+8rJjuOPKJ8QZgolvfg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rrHJBRff6CRGwKMW40QEGJcV1Efjd6U8xSztnKq1LEW/bdpf6Khr4wIdTO6IIj1z7 myeWqcyXd+YGxzHYluQm+CzN7YrBTPX4XSRcxh/fhCu6TBnaNeOhU7gHJ3YEv0p4l3 4Fy6quk/5eu9HG4mQChk0pYUSMQap14MCf6/w3DE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Pavel Begunkov , Jens Axboe Subject: [PATCH 6.0 843/862] io_uring/net: use io_sr_msg for sendzc Date: Wed, 19 Oct 2022 10:35:30 +0200 Message-Id: <20221019083327.138150833@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112184994488798?= X-GMAIL-MSGID: =?utf-8?q?1747112184994488798?= From: Pavel Begunkov [ upstream commit ac9e5784bbe72f4f603d1af84760ec09bc0b5ccd ] Reuse struct io_sr_msg for zerocopy sends, which is handy. There is only one zerocopy specific field, namely .notif, and we have enough space for it. Signed-off-by: Pavel Begunkov Link: https://lore.kernel.org/r/408c5b1b2d8869e1a12da5f5a78ed72cac112149.1662639236.git.asml.silence@gmail.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- io_uring/net.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) --- a/io_uring/net.c +++ b/io_uring/net.c @@ -60,15 +60,7 @@ struct io_sr_msg { unsigned done_io; unsigned msg_flags; u16 flags; -}; - -struct io_sendzc { - struct file *file; - void __user *buf; - unsigned len; - unsigned done_io; - unsigned msg_flags; - u16 flags; + /* used only for sendzc */ u16 addr_len; void __user *addr; struct io_kiocb *notif; @@ -188,7 +180,7 @@ static int io_sendmsg_copy_hdr(struct io int io_sendzc_prep_async(struct io_kiocb *req) { - struct io_sendzc *zc = io_kiocb_to_cmd(req, struct io_sendzc); + struct io_sr_msg *zc = io_kiocb_to_cmd(req, struct io_sr_msg); struct io_async_msghdr *io; int ret; @@ -885,7 +877,7 @@ out_free: void io_sendzc_cleanup(struct io_kiocb *req) { - struct io_sendzc *zc = io_kiocb_to_cmd(req, struct io_sendzc); + struct io_sr_msg *zc = io_kiocb_to_cmd(req, struct io_sr_msg); zc->notif->flags |= REQ_F_CQE_SKIP; io_notif_flush(zc->notif); @@ -894,7 +886,7 @@ void io_sendzc_cleanup(struct io_kiocb * int io_sendzc_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) { - struct io_sendzc *zc = io_kiocb_to_cmd(req, struct io_sendzc); + struct io_sr_msg *zc = io_kiocb_to_cmd(req, struct io_sr_msg); struct io_ring_ctx *ctx = req->ctx; struct io_kiocb *notif; @@ -1000,7 +992,7 @@ static int io_sg_from_iter(struct sock * int io_sendzc(struct io_kiocb *req, unsigned int issue_flags) { struct sockaddr_storage __address, *addr = NULL; - struct io_sendzc *zc = io_kiocb_to_cmd(req, struct io_sendzc); + struct io_sr_msg *zc = io_kiocb_to_cmd(req, struct io_sr_msg); struct msghdr msg; struct iovec iov; struct socket *sock; From patchwork Wed Oct 19 08:35: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: 5033 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp246671wrs; Wed, 19 Oct 2022 03:38:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7PMbDw1HkXFOEmCwEFxQVKylJBax7o2jEI0wVgc17WKOc/ZjN8/LwaszOR3mekKyDN4Xmk X-Received: by 2002:aa7:d4d9:0:b0:45c:7eae:d8d8 with SMTP id t25-20020aa7d4d9000000b0045c7eaed8d8mr6792938edr.254.1666175935036; Wed, 19 Oct 2022 03:38:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666175935; cv=none; d=google.com; s=arc-20160816; b=GXF8M7o2s8uTGUGLkt8iDh8Cnsl5DvBb6j8xzh9RCshQU0zeWa5GPQVorBo1yLafqQ BZI0PB70MWS0YwX98tXjj0OPHIag6tlI2gs2e1x+4x+WS3Es8wKHn7z9GNmFuFE93eZT TiDqFc77ACFPB+oQ+3B2EVZaxpP/pIldOhqQ/A2a8Yn8pWLKo/a8y9wo26QwdTg+IsCH Gb6QpR5U8SuC6vG88Mr4flXOuxO/5xs7eCVEPWp0eDLsUtI2l6zurnnbE7aaQLvR2V01 v48YHtZpRnLOikfv9do/Evv+3dm5NivbL85009CynwyVTZXwOXlkmX2SUB1AGumPjvOJ KHoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yq4iV0RmamdtS+bAKzqVn+fZOy6Cp+dfvWLREcFnuoc=; b=vQvJG40w5xxb5kacOIuItpUqQwC0wo6EfszVwKIY7IsArtpqVMEoFlRe2qyGjjPL2u tdSX5uJTUgnXF0t7G4Ib6sb1pdnyxdK+CHa4A9eMUqf6/rblW4C3i3T/VT4Yyhumy6H1 luJyamD8FVb707CK6PlkntyfyWVxkuLw9/ziRsL9R9tkzidmuUf1OsQX/n1vLgZxEFaJ rQ5/cYzkK0zC+Fve7AR5PJ+a1v7PClVX4hzSch4LFVPNUgbcPMY0NzBV0usO8JpAQ4kH 8Jv3vDvBXyhd92TYpYSSasb55ORUEhXOfKJH1CIQniL7On7l759cr5hpX64hOaqUVUAl jt8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mRTqgi9z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a17090658c300b00730936657d1si14724006ejs.552.2022.10.19.03.38.30; Wed, 19 Oct 2022 03:38: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=mRTqgi9z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231767AbiJSKhV (ORCPT + 99 others); Wed, 19 Oct 2022 06:37:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231510AbiJSKgp (ORCPT ); Wed, 19 Oct 2022 06:36:45 -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 207D32DAAC; Wed, 19 Oct 2022 03:15: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 8987FCE20F8; Wed, 19 Oct 2022 09:15:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6B44C433C1; Wed, 19 Oct 2022 09:15:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170940; bh=MkIi4jrqmZHmgC/zrV72MkjhZQBFd9b63fKVqNoJHcY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mRTqgi9zVuPXXuoCgdCdLQZpK72VcrAwJGYGea9HwBx5fUYw/pKyuja+E9WixwZyb HMpwCKgsXeDHfiWBJ5TpkTouOKuSXM6q8bqJbeVUc+ziwY24UthZTXMyZnKskXhh6p 1NzClprVuDFA3wQoXWFy+SnDhM90L289KniPIsYk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Pavel Begunkov , Jens Axboe Subject: [PATCH 6.0 844/862] io_uring/net: dont lose partial send_zc on fail Date: Wed, 19 Oct 2022 10:35:31 +0200 Message-Id: <20221019083327.183139680@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112097607705367?= X-GMAIL-MSGID: =?utf-8?q?1747112097607705367?= From: Pavel Begunkov [ upstream commit 5693bcce892d7b8b15a7a92b011d3d40a023b53c ] Partial zc send may end up in io_req_complete_failed(), which not only would return invalid result but also mask out the notification leading to lifetime issues. Cc: stable@vger.kernel.org Signed-off-by: Pavel Begunkov Link: https://lore.kernel.org/r/5673285b5e83e6ceca323727b4ddaa584b5cc91e.1663668091.git.asml.silence@gmail.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- io_uring/net.c | 16 ++++++++++++++++ io_uring/net.h | 1 + io_uring/opdef.c | 1 + 3 files changed, 18 insertions(+) --- a/io_uring/net.c +++ b/io_uring/net.c @@ -1093,6 +1093,22 @@ void io_sendrecv_fail(struct io_kiocb *r io_req_set_res(req, res, req->cqe.flags); } +void io_send_zc_fail(struct io_kiocb *req) +{ + struct io_sr_msg *sr = io_kiocb_to_cmd(req, struct io_sr_msg); + int res = req->cqe.res; + + if (req->flags & REQ_F_PARTIAL_IO) { + if (req->flags & REQ_F_NEED_CLEANUP) { + io_notif_flush(sr->notif); + sr->notif = NULL; + req->flags &= ~REQ_F_NEED_CLEANUP; + } + res = sr->done_io; + } + io_req_set_res(req, res, req->cqe.flags); +} + int io_accept_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) { struct io_accept *accept = io_kiocb_to_cmd(req, struct io_accept); --- a/io_uring/net.h +++ b/io_uring/net.h @@ -58,6 +58,7 @@ int io_connect(struct io_kiocb *req, uns int io_sendzc(struct io_kiocb *req, unsigned int issue_flags); int io_sendzc_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe); void io_sendzc_cleanup(struct io_kiocb *req); +void io_send_zc_fail(struct io_kiocb *req); void io_netmsg_cache_free(struct io_cache_entry *entry); #else --- a/io_uring/opdef.c +++ b/io_uring/opdef.c @@ -494,6 +494,7 @@ const struct io_op_def io_op_defs[] = { .issue = io_sendzc, .prep_async = io_sendzc_prep_async, .cleanup = io_sendzc_cleanup, + .fail = io_send_zc_fail, #else .prep = io_eopnotsupp_prep, #endif From patchwork Wed Oct 19 08:35: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: 5010 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp244389wrs; Wed, 19 Oct 2022 03:32:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM58PEjQARq6JAwrMZz53ZugK3cHU3e0e2dzc1DabzqdKn6RA2xyI0WP2nNl/dWaexLrBPeF X-Received: by 2002:a05:6402:34cb:b0:45d:197e:718c with SMTP id w11-20020a05640234cb00b0045d197e718cmr6827260edc.365.1666175575018; Wed, 19 Oct 2022 03:32:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666175575; cv=none; d=google.com; s=arc-20160816; b=Rr2DikCUAeety3Eqk6DQLel5/KvdkXnhktIjWFck/4UZAxqEM8nVplkjR86kuKXVed megU0WQQ4SkMpeUlmSzRnI8wyOIcPFJBNfaK1nXKaUevbGVrXY3WUGaDixSciCgu6wbf LKbOTxqhGMIpEifmPkKISYeqbyLgCRG+dmBkaU5okXgq4MW5z67V3CuEC3gw6C4eHXrp zIrrf/JM3e4m04krY3W1OGXUxtQVYeeYTHNrLgAHYANbvlVZvwjIEaawZeOzlNnbZNfz 5M51dsmWdO3d8F4kt5bfVanpGOfRrfstE1wNyo/aQj0iYfItTaF7Otj8GK9WBdVONbcY njAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ktJ4zAAK/cfIWm6n1DWVtICS50QIO/aiRTBa76vGKIE=; b=VPsKABHduqfMl/yV7MXsyCZiJVPUfCNbSs8x1+QaM4NRExMa7oF2bNRTNV+3lKHZK0 /llHxPEPny918fLfIiRP+soH1v2YudIFChXeXNUiFn46RvVS8laojLYcsuTpHEsfNqOv oHLVlLAhsPM8mCRQXBx8RfhF39Ki6RX0xmq6W1P8UFhd4iV8Z1TL5SNSArzHRxWcgzSz buwkqYPRliiWz2IAaIMR6xViOwqVRQeDfP3oCA5vVB9i6bwcgAb4oIPs/NHmWDVmoBwR 1qy1j8lowiyr6pgrGf3xbYq8mQL7StCQBMfRD4h98vaBU8VCiPVzTqg7BvyxCrGPidHB WlCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=d6u9feQT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pk21-20020a170906d7b500b0078db6f488c2si12529394ejb.56.2022.10.19.03.32.19; Wed, 19 Oct 2022 03:32: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=d6u9feQT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233369AbiJSKIR (ORCPT + 99 others); Wed, 19 Oct 2022 06:08:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233537AbiJSKH5 (ORCPT ); Wed, 19 Oct 2022 06:07:57 -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 EA1A11372B0; Wed, 19 Oct 2022 02:46: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 C8A9961811; Wed, 19 Oct 2022 09:15:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E09EFC433C1; Wed, 19 Oct 2022 09:15:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170946; bh=YspMoVNdhe0Amkm/NqCNpfJEbXRl1gsIsi9AdqNL9yg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d6u9feQTMacoh6lmzv3TyozymyicoEpbQxAWRFCb0vDDxXbdU9AZtZgCGP1VTYkpI UGsuxBNux6Iykpn6nFC2FfrZVHhAu/anCY+B4thyLhx57BdCrwj5XJ50XAFTMp2voQ SghRGCiWIrNS909FILA9RJJ5a7E9iVWP+Y5NoADE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Pavel Begunkov , Jens Axboe Subject: [PATCH 6.0 845/862] io_uring/net: rename io_sendzc() Date: Wed, 19 Oct 2022 10:35:32 +0200 Message-Id: <20221019083327.225706381@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747111719377698557?= X-GMAIL-MSGID: =?utf-8?q?1747111719377698557?= From: Pavel Begunkov [ upstream commit b0e9b5517eb12fa80c72e205fe28534c2e2f39b9 ] Simple renaming of io_sendzc*() functions in preparatio to adding a zerocopy sendmsg variant. Signed-off-by: Pavel Begunkov Link: https://lore.kernel.org/r/265af46829e6076dd220011b1858dc3151969226.1663668091.git.asml.silence@gmail.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- io_uring/net.c | 6 +++--- io_uring/net.h | 6 +++--- io_uring/opdef.c | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) --- a/io_uring/net.c +++ b/io_uring/net.c @@ -875,7 +875,7 @@ out_free: return ret; } -void io_sendzc_cleanup(struct io_kiocb *req) +void io_send_zc_cleanup(struct io_kiocb *req) { struct io_sr_msg *zc = io_kiocb_to_cmd(req, struct io_sr_msg); @@ -884,7 +884,7 @@ void io_sendzc_cleanup(struct io_kiocb * zc->notif = NULL; } -int io_sendzc_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) +int io_send_zc_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) { struct io_sr_msg *zc = io_kiocb_to_cmd(req, struct io_sr_msg); struct io_ring_ctx *ctx = req->ctx; @@ -989,7 +989,7 @@ static int io_sg_from_iter(struct sock * return ret; } -int io_sendzc(struct io_kiocb *req, unsigned int issue_flags) +int io_send_zc(struct io_kiocb *req, unsigned int issue_flags) { struct sockaddr_storage __address, *addr = NULL; struct io_sr_msg *zc = io_kiocb_to_cmd(req, struct io_sr_msg); --- a/io_uring/net.h +++ b/io_uring/net.h @@ -55,9 +55,9 @@ int io_connect_prep_async(struct io_kioc int io_connect_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe); int io_connect(struct io_kiocb *req, unsigned int issue_flags); -int io_sendzc(struct io_kiocb *req, unsigned int issue_flags); -int io_sendzc_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe); -void io_sendzc_cleanup(struct io_kiocb *req); +int io_send_zc(struct io_kiocb *req, unsigned int issue_flags); +int io_send_zc_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe); +void io_send_zc_cleanup(struct io_kiocb *req); void io_send_zc_fail(struct io_kiocb *req); void io_netmsg_cache_free(struct io_cache_entry *entry); --- a/io_uring/opdef.c +++ b/io_uring/opdef.c @@ -490,10 +490,10 @@ const struct io_op_def io_op_defs[] = { .manual_alloc = 1, #if defined(CONFIG_NET) .async_size = sizeof(struct io_async_msghdr), - .prep = io_sendzc_prep, - .issue = io_sendzc, + .prep = io_send_zc_prep, + .issue = io_send_zc, .prep_async = io_sendzc_prep_async, - .cleanup = io_sendzc_cleanup, + .cleanup = io_send_zc_cleanup, .fail = io_send_zc_fail, #else .prep = io_eopnotsupp_prep, From patchwork Wed Oct 19 08:35: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: 5296 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp282111wrs; Wed, 19 Oct 2022 05:02:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6XJVdq7gxXqgGED3NRPRVPDcp2huc7BNYqDtLR3UKyTjiLA+RrgE+OBrt+z6swDkCrGoo7 X-Received: by 2002:a17:907:788:b0:741:4d1a:595d with SMTP id xd8-20020a170907078800b007414d1a595dmr6333182ejb.737.1666180971872; Wed, 19 Oct 2022 05:02:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666180971; cv=none; d=google.com; s=arc-20160816; b=i8Mo5iOGeKFe7BrV93mre66T6g2QqvpIY/iMxZn5kjTkzDE+o4rGdoNRGynLD2pOFu H1gompZssb2uWyiP5aPpCS37FmUX3oC1NbKLZ5EscbGm0cGEq3DjXeqmb2f+TCb/DD4J vNTDzuEwg8EG6Rz7WRw5pKn61bV9xlzXay1Km9FWH4hKJFH4fVRm+X/XQlSVNltYtZuK /3dMO2t2c3bI855vbmr5Qy6QTu2NWrSMleh/kiih13XGudCQqusQNaJjL+eCTGF5XlZJ 5hWhEXxYE85x1dSFDsqhVpQEV+GS80vgaDJtWNuqEQfDPCf5paL7tFybx4aJaYM/rv4c s+9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xQ/Zw/l0RXiIW0If32c/EH3jWTjWwGRd/uxRSno3efo=; b=Of3DxbDnAWd7FiPLfr6mR161TzHTdlF8as/Cn+P58WRKY7WxmrE0p/By8YYQ39HzAN yySavCbEW5Gi8Z4I0XSY8eildRCl20ipNP7blp0zvKWxgCybnG/bDrMPertdcAnh+iSE aSIyFYtgMpUdgNkHxejwCcyxWbMo5XKnKZzdnquDcB0AQAGKybGpjVVFNMVY2cXIk25q k/LXpo3lLsC6vQ3/dzJWw/6VabVVV2lX5k3SNUueOXd2bcjft9dhL27hdnPRrJr3jVUk aqCgZeJ/jP9zUGlmPyvSmD2xtskfK7OSuWuPBqUcGJHl3+anSxLTbvfY3XQ62RiVwsQi 4TWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OzgasE9f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fj3-20020a1709069c8300b007919c624eadsi4702157ejc.522.2022.10.19.05.02.23; Wed, 19 Oct 2022 05:02: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=OzgasE9f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232135AbiJSL4i (ORCPT + 99 others); Wed, 19 Oct 2022 07:56:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231991AbiJSLzb (ORCPT ); Wed, 19 Oct 2022 07:55:31 -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 2036924089; Wed, 19 Oct 2022 04:34: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 4AC7FB824E9; Wed, 19 Oct 2022 09:15:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A731C433C1; Wed, 19 Oct 2022 09:15:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170949; bh=6EIcCe0JCeCW2oNCqgy3kocnom5TmJAkZzMFCgsN+Uk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OzgasE9fF49qaAKCWaxI8ZXgUCJoBH3AMjbOtaVVLBCsDOyt+TVptUq6F0h8H11/j sjhHH+R9TR7vUnuTqjeUFyAgiYvb7ZKuzgkz9cP8iMT3nbNwgr5QOvQMOJSz3ErZpy NkpyPDloF6aaMRIHUMEqKgqWRcjqcr3cWngrkH7E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Stefan Metzmacher , Pavel Begunkov , Jens Axboe Subject: [PATCH 6.0 846/862] io_uring/net: dont skip notifs for failed requests Date: Wed, 19 Oct 2022 10:35:33 +0200 Message-Id: <20221019083327.264626413@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747117378487763610?= X-GMAIL-MSGID: =?utf-8?q?1747117378487763610?= From: Pavel Begunkov [ upstream commit 6ae91ac9a6aa7d6005c3c6d0f4d263fbab9f377f ] We currently only add a notification CQE when the send succeded, i.e. cqe.res >= 0. However, it'd be more robust to do buffer notifications for failed requests as well in case drivers decide do something fanky. Always return a buffer notification after initial prep, don't hide it. This behaviour is better aligned with documentation and the patch also helps the userspace to respect it. Cc: stable@vger.kernel.org # 6.0 Suggested-by: Stefan Metzmacher Signed-off-by: Pavel Begunkov Link: https://lore.kernel.org/r/9c8bead87b2b980fcec441b8faef52188b4a6588.1664292100.git.asml.silence@gmail.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- io_uring/net.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) --- a/io_uring/net.c +++ b/io_uring/net.c @@ -879,7 +879,6 @@ void io_send_zc_cleanup(struct io_kiocb { struct io_sr_msg *zc = io_kiocb_to_cmd(req, struct io_sr_msg); - zc->notif->flags |= REQ_F_CQE_SKIP; io_notif_flush(zc->notif); zc->notif = NULL; } @@ -996,7 +995,7 @@ int io_send_zc(struct io_kiocb *req, uns struct msghdr msg; struct iovec iov; struct socket *sock; - unsigned msg_flags, cflags; + unsigned msg_flags; int ret, min_ret = 0; sock = sock_from_file(req->file); @@ -1064,8 +1063,6 @@ int io_send_zc(struct io_kiocb *req, uns req->flags |= REQ_F_PARTIAL_IO; return io_setup_async_addr(req, addr, issue_flags); } - if (ret < 0 && !zc->done_io) - zc->notif->flags |= REQ_F_CQE_SKIP; if (ret == -ERESTARTSYS) ret = -EINTR; req_set_fail(req); @@ -1078,8 +1075,7 @@ int io_send_zc(struct io_kiocb *req, uns io_notif_flush(zc->notif); req->flags &= ~REQ_F_NEED_CLEANUP; - cflags = ret >= 0 ? IORING_CQE_F_MORE : 0; - io_req_set_res(req, ret, cflags); + io_req_set_res(req, ret, IORING_CQE_F_MORE); return IOU_OK; } @@ -1096,17 +1092,11 @@ void io_sendrecv_fail(struct io_kiocb *r void io_send_zc_fail(struct io_kiocb *req) { struct io_sr_msg *sr = io_kiocb_to_cmd(req, struct io_sr_msg); - int res = req->cqe.res; - if (req->flags & REQ_F_PARTIAL_IO) { - if (req->flags & REQ_F_NEED_CLEANUP) { - io_notif_flush(sr->notif); - sr->notif = NULL; - req->flags &= ~REQ_F_NEED_CLEANUP; - } - res = sr->done_io; - } - io_req_set_res(req, res, req->cqe.flags); + if (req->flags & REQ_F_PARTIAL_IO) + req->cqe.res = sr->done_io; + if (req->flags & REQ_F_NEED_CLEANUP) + req->cqe.flags |= IORING_CQE_F_MORE; } int io_accept_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) From patchwork Wed Oct 19 08:35: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: 5001 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp229011wrs; Wed, 19 Oct 2022 02:54:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ppxsBSQBoW7V0UNzEC9ZC1i4H//pBt5n4mycsOxnMno8d7WnncmxvF2O/DoROc6jLJCe3 X-Received: by 2002:a63:5d4e:0:b0:41d:dcc3:aa85 with SMTP id o14-20020a635d4e000000b0041ddcc3aa85mr6410117pgm.324.1666173241610; Wed, 19 Oct 2022 02:54:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666173241; cv=none; d=google.com; s=arc-20160816; b=s/YpxUlBAZVti+qFenIUz6d0Fze0lrHK6PR2RoXYnTNcrvHZOD4Z80DpxR099vUxtq 22NS56a8I4kMwWfXXQKXYIftw4AYO3wxCQ8+wF+z0RevpNFSyvodhbnW0R5RybH2bWrq uMVTXBrM4v6WaJI9f8DAoq/Vh0M5/mK6pcb5syamZkKw9aIa6DtIqltMH12QKqScTDe/ 6uAswQ5ujzpKQYO4LFb8TwKCQRxrA4+TGF6Zl2CJwjXz5wR+Op95RSI8Gfn+oEsOnwM0 IbMd+mnZoFh4vhJYA9oRUr/yncTuGc6XTbFbk5FboywQvhOpmcvlYe593BOFs3xuvg+t zGjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=q7nA9IVWl361R5KiY1R0XaqbDId0OUi6Dnq5RGVAyws=; b=cmPEtmoEEKryZloBSXTXLyMc18PgQqUUxDNbBwXemXNwv4jEo2A8W8KA1ineoFeCU4 SMz3RsJ3+gv4/Fggo9uFaFYfNH2JIq+ySo/v7bqdrOa3+E4umE7kGQi2vqYKMFYPMALw Nuaj+Bs6OI3dFMOQwrOP2+3a/7xXimQ+aWJoHgz89ioawv5h8wwIptXo1AH+B3Z/zIYv Pnm/Fl94VZ1CqhBHboqB2RdduhzZLvgEFbQKVlirh1JNh/xALR/p/m0CiBd3BIuJWu7F HreO2AC8Acn2o0nJM6aM82fW8qViJmwC5wl4cHFTdGJKdZ4Mgy3+7tkv6aMuYDSrSfsV gPqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LsqaxDul; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q18-20020a631f52000000b0043447486c84si17616616pgm.875.2022.10.19.02.53.48; Wed, 19 Oct 2022 02:54: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=LsqaxDul; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234370AbiJSJqG (ORCPT + 99 others); Wed, 19 Oct 2022 05:46:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235165AbiJSJmX (ORCPT ); Wed, 19 Oct 2022 05:42:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A9DC13D50; Wed, 19 Oct 2022 02:19: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 16B6B61826; Wed, 19 Oct 2022 09:15:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2BBA7C433C1; Wed, 19 Oct 2022 09:15:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170951; bh=furww8hO+9bHJEvRn56IiQow58Lk26dZ+/cLHdxJFq8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LsqaxDulwYNQKiHFlDg78rv9Td3L8OqOVhkDNIkOD9iN6F7hdNFfQwpb/kVeu9oIY rHyGWBeJIjPZn8z9nOUwFde1/PkYOEFt2ivOoL2mMgumpEVYeR4rA0Se7an7RMWK/6 WEtPyMpt8k/Nza+V0uQeEe3fjV2bbIS9nMHvmb0M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Pavel Begunkov , Jens Axboe Subject: [PATCH 6.0 847/862] io_uring/net: fix notif cqe reordering Date: Wed, 19 Oct 2022 10:35:34 +0200 Message-Id: <20221019083327.298431964@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747109272947784237?= X-GMAIL-MSGID: =?utf-8?q?1747109272947784237?= From: Pavel Begunkov [ upstream commit 108893ddcc4d3aa0a4a02aeb02d478e997001227 ] send zc is not restricted to !IO_URING_F_UNLOCKED anymore and so we can't use task-tw ordering trick to order notification cqes with requests completions. In this case leave it alone and let io_send_zc_cleanup() flush it. Cc: stable@vger.kernel.org Fixes: 53bdc88aac9a2 ("io_uring/notif: order notif vs send CQEs") Signed-off-by: Pavel Begunkov Link: https://lore.kernel.org/r/0031f3a00d492e814a4a0935a2029a46d9c9ba06.1664486545.git.asml.silence@gmail.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- io_uring/net.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) --- a/io_uring/net.c +++ b/io_uring/net.c @@ -1073,8 +1073,14 @@ int io_send_zc(struct io_kiocb *req, uns else if (zc->done_io) ret = zc->done_io; - io_notif_flush(zc->notif); - req->flags &= ~REQ_F_NEED_CLEANUP; + /* + * If we're in io-wq we can't rely on tw ordering guarantees, defer + * flushing notif to io_send_zc_cleanup() + */ + if (!(issue_flags & IO_URING_F_UNLOCKED)) { + io_notif_flush(zc->notif); + req->flags &= ~REQ_F_NEED_CLEANUP; + } io_req_set_res(req, ret, IORING_CQE_F_MORE); return IOU_OK; } From patchwork Wed Oct 19 08:35: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: 4962 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp226721wrs; Wed, 19 Oct 2022 02:46:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM47h7GmcYxGGFEE1SSHuq4XriF+av9hwvxVoKO/3u6bIxCuBiI36r3IBjIeZCjymrQv4TZE X-Received: by 2002:a17:90b:2243:b0:20b:42a:4c0d with SMTP id hk3-20020a17090b224300b0020b042a4c0dmr42923868pjb.123.1666172803908; Wed, 19 Oct 2022 02:46:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172803; cv=none; d=google.com; s=arc-20160816; b=fULT/QuqcIsDnnCz3OvORHhQ9+3N6AO+UhNx99xv7+MldgaA+srrV567MTnk6Etn5B oANdxcvySO29DwdtJueKfEMDmaAg/cxUmiHcwaUzywQNzWMzWoh67MikGez5nWqaGlQX yYpuPjuHND6T51vsoj0ZC7gvyyC9Mzo02pgXivRD+TRKJq76WAcbUaMTQs0NYAw1UNqz HpjwpyYowVb+q4WdOr40zliptOMNHSUfycQFBwyjaEjVWMqqyRH6FM9zYp2oUrUnhaSE LuqLWXBpb4QU7s4vmC0tfSJ82K2KEeUVP0BTTfP2rQnoHPpFfwW4nIU5H8oDboGJ0Exa lDZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5OYbouk4++68BLb27sw1+B5dJmB9ixjrqh78egN4rvw=; b=bY6jmYQvyFlH8mSUXZVdhERv/QcW+j0Mh5/D2QrfEFBXMmaBd8/1vEITi+OsPQZlMs FvLiwfd1cmFMM6+7H6YUd4a/N4STDGc3if1YTKksFk3CDgm/iAp+5LIMpZMpTgF6bUzh EddVvJBF31fDdyLi79AKjdwBMcTowVCpJQE1qgJbVJbvGqoEyAEjiC6B0l2WPd7qzdfh mRlboJHwWyefJ/buiyKvpjJByzphcy6Ov3vY22ZdIfhfpy0qo8ojDnxOjZXH4/lDPbAQ kSYQ5qQ2yt/97c5aF1dnhwCIiHbxPoeYHvykNcuaOtE3F+C08D/hzwSiAwXGIQD6/zEK dDWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=O9SV4eeP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pg9-20020a17090b1e0900b0020dbd4207fasi18612779pjb.46.2022.10.19.02.46.26; Wed, 19 Oct 2022 02:46: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=O9SV4eeP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234399AbiJSJnm (ORCPT + 99 others); Wed, 19 Oct 2022 05:43:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234469AbiJSJk3 (ORCPT ); Wed, 19 Oct 2022 05:40:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15AAD21A; Wed, 19 Oct 2022 02:16: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 B34E3617E9; Wed, 19 Oct 2022 09:15:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9FCE2C433C1; Wed, 19 Oct 2022 09:15:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170954; bh=lC9p0OqQqCZX6b9FuUy8Ig6O3v6yhsSoGJOijnrTgG0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O9SV4eePrz9f8BL2shS8bFqxi3k1auaHScuhGWr/d1NMAl35OzDx0c8J+ZWu+0ZGH OTsSfsuxgkYlHJKkwLZufgpJZv55R/1NNiMApliOdaoBYWmV2ie9Z7EAmzNwTSlPL/ V79qxe7nYlyVF/MJdYDNcPqjvYnDxpe767SB1GiE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liu Shixin , Kefeng Wang , syzbot+193f9cee8638750b23cf@syzkaller.appspotmail.com, Liu Zixian , Mike Kravetz , David Hildenbrand , John Hubbard , Muchun Song , Sidhartha Kumar , Andrew Morton Subject: [PATCH 6.0 848/862] mm: hugetlb: fix UAF in hugetlb_handle_userfault Date: Wed, 19 Oct 2022 10:35:35 +0200 Message-Id: <20221019083327.339557041@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108813777697364?= X-GMAIL-MSGID: =?utf-8?q?1747108813777697364?= From: Liu Shixin commit 958f32ce832ba781ac20e11bb2d12a9352ea28fc upstream. The vma_lock and hugetlb_fault_mutex are dropped before handling userfault and reacquire them again after handle_userfault(), but reacquire the vma_lock could lead to UAF[1,2] due to the following race, hugetlb_fault hugetlb_no_page /*unlock vma_lock */ hugetlb_handle_userfault handle_userfault /* unlock mm->mmap_lock*/ vm_mmap_pgoff do_mmap mmap_region munmap_vma_range /* clean old vma */ /* lock vma_lock again <--- UAF */ /* unlock vma_lock */ Since the vma_lock will unlock immediately after hugetlb_handle_userfault(), let's drop the unneeded lock and unlock in hugetlb_handle_userfault() to fix the issue. [1] https://lore.kernel.org/linux-mm/000000000000d5e00a05e834962e@google.com/ [2] https://lore.kernel.org/linux-mm/20220921014457.1668-1-liuzixian4@huawei.com/ Link: https://lkml.kernel.org/r/20220923042113.137273-1-liushixin2@huawei.com Fixes: 1a1aad8a9b7b ("userfaultfd: hugetlbfs: add userfaultfd hugetlb hook") Signed-off-by: Liu Shixin Signed-off-by: Kefeng Wang Reported-by: syzbot+193f9cee8638750b23cf@syzkaller.appspotmail.com Reported-by: Liu Zixian Reviewed-by: Mike Kravetz Cc: David Hildenbrand Cc: John Hubbard Cc: Muchun Song Cc: Sidhartha Kumar Cc: [4.14+] Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- mm/hugetlb.c | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -5482,7 +5482,6 @@ static inline vm_fault_t hugetlb_handle_ unsigned long addr, unsigned long reason) { - vm_fault_t ret; u32 hash; struct vm_fault vmf = { .vma = vma, @@ -5500,18 +5499,14 @@ static inline vm_fault_t hugetlb_handle_ }; /* - * hugetlb_fault_mutex and i_mmap_rwsem must be - * dropped before handling userfault. Reacquire - * after handling fault to make calling code simpler. + * vma_lock and hugetlb_fault_mutex must be dropped before handling + * userfault. Also mmap_lock will be dropped during handling + * userfault, any vma operation should be careful from here. */ hash = hugetlb_fault_mutex_hash(mapping, idx); mutex_unlock(&hugetlb_fault_mutex_table[hash]); i_mmap_unlock_read(mapping); - ret = handle_userfault(&vmf, reason); - i_mmap_lock_read(mapping); - mutex_lock(&hugetlb_fault_mutex_table[hash]); - - return ret; + return handle_userfault(&vmf, reason); } static vm_fault_t hugetlb_no_page(struct mm_struct *mm, @@ -5529,6 +5524,7 @@ static vm_fault_t hugetlb_no_page(struct spinlock_t *ptl; unsigned long haddr = address & huge_page_mask(h); bool new_page, new_pagecache_page = false; + u32 hash = hugetlb_fault_mutex_hash(mapping, idx); /* * Currently, we are forced to kill the process in the event the @@ -5539,7 +5535,7 @@ static vm_fault_t hugetlb_no_page(struct if (is_vma_resv_set(vma, HPAGE_RESV_UNMAPPED)) { pr_warn_ratelimited("PID %d killed due to inadequate hugepage pool\n", current->pid); - return ret; + goto out; } /* @@ -5556,12 +5552,10 @@ retry: page = find_lock_page(mapping, idx); if (!page) { /* Check for page in userfault range */ - if (userfaultfd_missing(vma)) { - ret = hugetlb_handle_userfault(vma, mapping, idx, + if (userfaultfd_missing(vma)) + return hugetlb_handle_userfault(vma, mapping, idx, flags, haddr, address, VM_UFFD_MISSING); - goto out; - } page = alloc_huge_page(vma, haddr, 0); if (IS_ERR(page)) { @@ -5621,10 +5615,9 @@ retry: if (userfaultfd_minor(vma)) { unlock_page(page); put_page(page); - ret = hugetlb_handle_userfault(vma, mapping, idx, + return hugetlb_handle_userfault(vma, mapping, idx, flags, haddr, address, VM_UFFD_MINOR); - goto out; } } @@ -5682,6 +5675,8 @@ retry: unlock_page(page); out: + mutex_unlock(&hugetlb_fault_mutex_table[hash]); + i_mmap_unlock_read(mapping); return ret; backout: @@ -5780,11 +5775,13 @@ vm_fault_t hugetlb_fault(struct mm_struc entry = huge_ptep_get(ptep); /* PTE markers should be handled the same way as none pte */ - if (huge_pte_none_mostly(entry)) { - ret = hugetlb_no_page(mm, vma, mapping, idx, address, ptep, + if (huge_pte_none_mostly(entry)) + /* + * hugetlb_no_page will drop vma lock and hugetlb fault + * mutex internally, which make us return immediately. + */ + return hugetlb_no_page(mm, vma, mapping, idx, address, ptep, entry, flags); - goto out_mutex; - } ret = 0; From patchwork Wed Oct 19 08:35: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: 5237 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp267333wrs; Wed, 19 Oct 2022 04:26:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4djfSVU4ktKP5H3KqJDySVdCIKozioPJTrCFU9FUhgjy/8NHKOH4IO8k6RWUIUtJnzWvwL X-Received: by 2002:a63:6b88:0:b0:46a:ff3c:b64a with SMTP id g130-20020a636b88000000b0046aff3cb64amr6799902pgc.196.1666178817866; Wed, 19 Oct 2022 04:26:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178817; cv=none; d=google.com; s=arc-20160816; b=bAJ99VRXVmdnFacrnR/n3xoHcMVdnvns2jN0bEBTOhLyaJE2D17WwVVmT41JeJHpjK bSe7WvJ8CVl9iqO9hS0/T94SqzUqjwz61Njydnytj1DU2jdVOHCYraffdSexfurS6R69 Cdiwdc5BjKCm3MV+SyxqG/Sm/16Vjyb8ZsfyBgb5l8uL3EqPVa+YsXhjlrCYsZVKzP58 Lfg/VwBX2eEGwm3zNol7y013B4QsGZmjsMn/CwzbAar1QjcdYjNOyF6x+9l97IR+pMMk CBN2Ic3WVN+7WJGTWkn3VGEfvqYxhz1u/u2k5NqbPrVUisuvozMBwvSBxfbuoDCgXqA7 FzXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gbCdJqhC/p7TIdq+qgmHmqp0p5N1FFC0pL42yEckEyA=; b=olNltwTQ02hCyz2lb8f1eqdL7nAp9NqM6+HjqxkAu5aqjUhAaHuNrqyc5iFejzMFop yfChXQLgS/kzdU3hRqpVLP1WMQOYUUTkQC9oDLSwSjxFxUAq9B5ZvM1PZC05mYvPP1t9 eEOhGkqNyH42I3yt79+jV4B3GAIXTiO/dgdw6zTFmBKv+h5dxLENVx3765q+q14GrrrX wHmLjFby7ex1SiDa+euqjL+qgjUDfWaeg6uH9IHWmxZz2izqx8ItS7xcLXpf5eyOMpyV dexCxCRAHPF9OzE6lvm67gUfzv3WHzcuWiML6s5GpEWRBOwDHcw+m+zc7EidaZxPmEKT crYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sZjpmTs7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v10-20020a1709029a0a00b001768452d4d0si17923212plp.30.2022.10.19.04.26.43; Wed, 19 Oct 2022 04:26: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=sZjpmTs7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231299AbiJSL0M (ORCPT + 99 others); Wed, 19 Oct 2022 07:26:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230467AbiJSLZx (ORCPT ); Wed, 19 Oct 2022 07:25:53 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 760EF262B; Wed, 19 Oct 2022 03:57: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 03842CE21FD; Wed, 19 Oct 2022 09:16:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02FCFC433C1; Wed, 19 Oct 2022 09:16:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666171008; bh=OjZ0L2KyAgkZPt75DZB7YHk9PytepHMPjogVsy2mw0A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sZjpmTs77JEA7QV8CRa2QbEeGkD6gsKwBp/StyeTEHuKVDpp6KBjHMrZkzcjti9YH 0EOIligLrBV+uw2U/rgP8iMGtYqzeX75EkpRP3bIfA4YUTEmrzQa1AVuBvHwXfE3qM mi6jVgs3hq0HWinBrXaoOQhrZ9BH1jkWMaWFCN+8= 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 6.0 849/862] net: ieee802154: return -EINVAL for unknown addr type Date: Wed, 19 Oct 2022 10:35:36 +0200 Message-Id: <20221019083327.373078021@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747115119955295564?= X-GMAIL-MSGID: =?utf-8?q?1747115119955295564?= 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 @@ -185,21 +185,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 Wed Oct 19 08:35: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: 5221 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp265450wrs; Wed, 19 Oct 2022 04:22:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4997PLfkopZLw3qnDEqY4+yoeZiacgp9S+bLcrRpzVgcX7gPGD7DaD/VU5kJr27LkMWPeo X-Received: by 2002:a17:907:c15:b0:78d:af58:4274 with SMTP id ga21-20020a1709070c1500b0078daf584274mr6383026ejc.150.1666178545593; Wed, 19 Oct 2022 04:22:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178545; cv=none; d=google.com; s=arc-20160816; b=kXXdyTxm1o6MR7Rjs31kXNOSFL85QuuT0e2bWPgtbpfA5g8ySQyeeT5bSvz/xYqUsT IE7QJfNYl6kMtAyfSSyQdLfEzvu+/aJOHBvAUGq1Ezj069EJBXx+hoMVvNn0Gt9tSRsd 5ZcjyAU655FNzP7ZHulxYm729ba+PrupCmY7uxdQgA75dv2A2bMH8rabh//BI0macCcc fTFKSZh1GZvJnuwVxvzS8o+Qe9DV0SDTwHdHi3yhR2BJLVCbTU53HoSRyqT9/5z6JedO JycrNIxkyYCDkFLBvGqQQbwieh0Lx2qJoi1hMe83s5sAvXLg+cEYQEO7DmRscodz3DQY JIGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/K/+pAbH0MDotvjlvaXwKwi5KdEBz8R3j8Q+jKXadIQ=; b=JcoMUVm3SZEhJV5lff5WtQaTE86lkbIGS0HJxEJ+PdA9+D6F7psDHvy2QoI7Zk1YBf srwlD1iOxuetTzB1ibjPi3SA4ue0HjiGxwKnNRxeLv8jMABGUxyoZ+CF7S5nWR3m/i2d mrzzVaM8iuPKc490Ei4Qxh4vKvhQy1xIbwiTs5A3CVr0yqjuQVO1b3rI4ospoj+svrDB I4ZP41b/yVyrkpl4Y+qDAWO+VzYEzKI4E76y7gUMQMd2NZfpkkDgkQS163bVxHPbvBtM qRchcJer+ON/7VmDJCYJaBdL20Mmn5rsM1EF6xXjs5IGVASD7hOx4z4+qYvVagGNWCtD Rmhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aVHHN6V7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k16-20020a170906971000b0078307781936si12176493ejx.359.2022.10.19.04.21.54; Wed, 19 Oct 2022 04:22:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aVHHN6V7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231872AbiJSLMD (ORCPT + 99 others); Wed, 19 Oct 2022 07:12:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231976AbiJSLK6 (ORCPT ); Wed, 19 Oct 2022 07:10:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AC01152C62; Wed, 19 Oct 2022 03:38: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 dfw.source.kernel.org (Postfix) with ESMTPS id 688B9617F1; Wed, 19 Oct 2022 09:16:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F373C433C1; Wed, 19 Oct 2022 09:16:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170974; bh=HqzInSWqetlXOUQs1l/ij7Z47hWlE+PPV581CXDV+lw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aVHHN6V7wZLEKnWFQfIU2iqN42SqlcZNpNedQss6IGOK0oydAC1Rycndf8uHJ/Kwk uGaMuZY7ogtmrKpK6Pexo+EMldqGsDZoED8klwGc4/TaDq0bftO8uLcG3v3hGmZp4q SByE/ct21GEKNI3VUoWo+hkwMnRXuAG+xdKSz/bc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 6.0 850/862] ALSA: usb-audio: Fix last interface check for registration Date: Wed, 19 Oct 2022 10:35:37 +0200 Message-Id: <20221019083327.413061636@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114834528457132?= X-GMAIL-MSGID: =?utf-8?q?1747114834528457132?= From: Takashi Iwai commit 39efc9c8a973ddff5918191525d1679d0fb368ea upstream. The recent fix in commit 6392dcd1d0c7 ("ALSA: usb-audio: Register card at the last interface") tried to delay the card registration until the last found interface is probed. It assumed that the probe callback gets called for those later interfaces, but it's not always true; as the driver loops over the descriptor and probes the matching ones, it's not separately called via multiple probe calls. This results in the missing card registration, i.e. no sound device. For addressing this problem, replace the check whether the last interface is processed with usb_interface_claimed() instead of the comparison with the probe interface number. Fixes: 6392dcd1d0c7 ("ALSA: usb-audio: Register card at the last interface") Link: https://lore.kernel.org/r/20220915085947.7922-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/usb/card.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/sound/usb/card.c +++ b/sound/usb/card.c @@ -884,7 +884,7 @@ static int usb_audio_probe(struct usb_in * one given via option */ if (check_delayed_register_option(chip) == ifnum || - chip->last_iface == ifnum) { + usb_interface_claimed(usb_ifnum_to_if(dev, chip->last_iface))) { err = snd_card_register(chip->card); if (err < 0) goto __error; From patchwork Wed Oct 19 08:35: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: 5489 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp334390wrs; Wed, 19 Oct 2022 06:42:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4VCdNG0xvbJnWxQpnHrvkFDn4/a/FgpWfUBiC196GCZnn1sSbbJfeYnCwBcntiM0fKifXG X-Received: by 2002:a05:6402:5ca:b0:445:c80a:3c2 with SMTP id n10-20020a05640205ca00b00445c80a03c2mr7548267edx.247.1666186965712; Wed, 19 Oct 2022 06:42:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666186965; cv=none; d=google.com; s=arc-20160816; b=vp5R9HiK4Ql0MGJwZEYlYdWij4kyPT20DKBZMHKo4I4P4xZnJQE7tDqBBrasEc2XSg AM/eYvsBYL2gQBt5KCSI87DxOdMdBVdsvlJXGey0HBXxSwEuzRSaJ8a6GAbMECFpCtRK kP8J7kLO5C8jnvfeVWplarzqRACl/5vK8J2+2ANVn76GU5aeNDrptGkmmMqM0p6hIfPP YJra+h/T3cqY6vOV5ue2r+HM4ane951DwF86pwUmMzrkze9OolOwM9mhNlG+bBGoJymi +5kEpkWSUEYx72GyL4NUfdDXozkiMRYLyIFU8wzSYDdHuPNBeOg4dKUL7NS//fzpyieR Qijg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=EYXui/K/o4mxhygMajTrivZ57jJQl0HpU/2o/P07m+g=; b=NJ2DaL7njSZf7SmxPEXl64dRV2w7hprjOsK7qlGFb2WTvx1piV6NGs4HC22jNwH1Ya Y3tlFgbqE3EOQD/29iJRacm+jqp5/dJDhRj3oImOJJJEu6IfyzlUphxrWyddl8ftvk6X vysPf4TFdE6anphqHqR03ZNSj/JgqhKn44EDeAk98JhEKKP8UFaRgxY/AV24JLiuyCkO jnSOJOrskqh+8ai6tK0wg3cXmlhXT3w4dwVJaM0tNMYQXZ5uBhINIMHQBxKwC4Zas1Jm e+7DJZQ4OkEe5YAfeiOfV5UKTcUTIMPL/kuxkC6UfLeTsuD2J757WONcJdNjkyYyQfLR 1Yww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZxS+6Vyk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m10-20020a50cc0a000000b00458d94f1a45si12566245edi.413.2022.10.19.06.42.21; Wed, 19 Oct 2022 06:42: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=ZxS+6Vyk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232296AbiJSNjW (ORCPT + 99 others); Wed, 19 Oct 2022 09:39:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232513AbiJSNij (ORCPT ); Wed, 19 Oct 2022 09:38:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D218F12344A; Wed, 19 Oct 2022 06:26: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 2F140B824ED; Wed, 19 Oct 2022 09:16:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93BCAC433C1; Wed, 19 Oct 2022 09:16:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170987; bh=407NwDvLPJKqzLB7rgTrwzWR7eY9drwpc2gxmRqi+5c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZxS+6VykgEAkOXrDLUL9mPmN5DQxuclId4GuBOBRES2FJAnbHWzCQTWKkwiMsJyAu hJSPsh+07zyI3QQyVr8m1YaTqr2pCW160dkreOh2qN577dEBRmg0NXf3uR989Bdgst AsDtdSa5N8hu/P59SwAhZJnAxEbGvA5EwLlaAlto= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Yu Kuai , Ming Lei , Jens Axboe Subject: [PATCH 6.0 851/862] blk-wbt: fix that rwb->wc is always set to 1 in wbt_init() Date: Wed, 19 Oct 2022 10:35:38 +0200 Message-Id: <20221019083327.461594272@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123663865687066?= X-GMAIL-MSGID: =?utf-8?q?1747123663865687066?= From: Yu Kuai commit 285febabac4a16655372d23ff43e89ff6f216691 upstream. commit 8c5035dfbb94 ("blk-wbt: call rq_qos_add() after wb_normal is initialized") moves wbt_set_write_cache() before rq_qos_add(), which is wrong because wbt_rq_qos() is still NULL. Fix the problem by removing wbt_set_write_cache() and setting 'rwb->wc' directly. Noted that this patch also remove the redundant setting of 'rab->wc'. Fixes: 8c5035dfbb94 ("blk-wbt: call rq_qos_add() after wb_normal is initialized") Reported-by: kernel test robot Link: https://lore.kernel.org/r/202210081045.77ddf59b-yujie.liu@intel.com Signed-off-by: Yu Kuai Reviewed-by: Ming Lei Link: https://lore.kernel.org/r/20221009101038.1692875-1-yukuai1@huaweicloud.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- block/blk-wbt.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/block/blk-wbt.c +++ b/block/blk-wbt.c @@ -841,12 +841,11 @@ int wbt_init(struct request_queue *q) rwb->last_comp = rwb->last_issue = jiffies; rwb->win_nsec = RWB_WINDOW_NSEC; rwb->enable_state = WBT_STATE_ON_DEFAULT; - rwb->wc = 1; + rwb->wc = test_bit(QUEUE_FLAG_WC, &q->queue_flags); rwb->rq_depth.default_depth = RWB_DEF_DEPTH; rwb->min_lat_nsec = wbt_default_latency_nsec(q); wbt_queue_depth_changed(&rwb->rqos); - wbt_set_write_cache(q, test_bit(QUEUE_FLAG_WC, &q->queue_flags)); /* * Assign rwb and add the stats callback. From patchwork Wed Oct 19 08:35: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: 4999 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp228893wrs; Wed, 19 Oct 2022 02:53:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6FDtYya9KiND2S5bC4U/aCMP8U9MceKO032iUY2xXN10Fn+yqCW9JqBHIgMPuqau995mKM X-Received: by 2002:a17:907:6e11:b0:78e:3057:f631 with SMTP id sd17-20020a1709076e1100b0078e3057f631mr5888895ejc.333.1666173217852; Wed, 19 Oct 2022 02:53:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666173217; cv=none; d=google.com; s=arc-20160816; b=LGP9muiy4zBKrE0fkLsjq9X7Rl4w4zzyhXSeyNGzGzstuQnt6auSZSTNwrEVrOfWAb tf86exI7JDekjlBbRKUMPEYqdjRC4sdSwgXMDvOVd70zwehNAyNq5h8+A+eVGnYAE2n7 dIO2FHXeI7gTknyB/SrFGaO69ty3t2XZJUfunI7MCc2bgXabpwjkM3p5tLsryzsU5OlP KMve8M6fW2rmi90Uzq3tbDuomRrnSEYdzgT4vxAItyNds3auzV1Qit73VgFxpy1sHgeK eUZIIJhiWRivjx3fT+HsgI1ItSkcxuy3ZnfDarmJ697uMDJ5Aq7zvQbFSDtNR2SFL7Ep i3eQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rk8oQncFKtlJDdo8BEdMJDvFz+WvwaV7IqPdh9sRpKA=; b=xCNWWG/seGfiqrEC1eOavYYxDiCMrjFdrlEu0y/ZajE7c1l+xEa6QjkWcMNwRWCjAW L8plrTLglpoVw8sxeZRpFwfNjKbwZ3c6EUdGTAy9eLxkV9UvIMqNUcVtnDshWHrOR9bp Fv1cOpzTqWmMncyrVkTZvLvFNOFJP8zxXobTjghTbJdbC4jgvtEDyXGRwEph17+Ya3/v /fWpiAv6qrqXTz6Tv5KXjYJQlIDz72spFQR99i9Pk+sAh2mY0Ia85K+zZzimrnyZqENT Tzo15yfExAeJ8CL5HmjFHnlHLljMfdGAVeXHKop6bfwy+X4qk1Df1FS+S1dtY2o5/g2/ jMfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QoU8bxzx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b4-20020a0564021f0400b0045d8bff7afesi6623963edb.376.2022.10.19.02.53.13; Wed, 19 Oct 2022 02: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=QoU8bxzx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234356AbiJSJpx (ORCPT + 99 others); Wed, 19 Oct 2022 05:45:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235109AbiJSJmO (ORCPT ); Wed, 19 Oct 2022 05:42: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 D8D90B1DFD; Wed, 19 Oct 2022 02:19: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 19B55617B0; Wed, 19 Oct 2022 09:16:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26EF0C433C1; Wed, 19 Oct 2022 09:16:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170990; bh=SfovaiwKGLjcp/SsOJAxEXvxF9kuiamt4gaWeahnRxA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QoU8bxzx6tf0UkEthkI7gJOK6k4X4cuGLVUe3Fx/wg3HNa1VDWIi7fu9eIV4QL3kt JRyXJcAavTUFl5n0UsaLedFca+oUmd8lee5uwAgofcDYnzKvbcXI9wXYVltm8vWiwS vrLwneVJ4ASvmD8T0bZuOBlQtZrvJcW4rPahT0sE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Randy Dunlap , Grygorii Strashko , Ravi Gunasekaran , Eric Dumazet , Paolo Abeni , Naresh Kamboju , "Sudip Mukherjee (Codethink)" , Jakub Kicinski Subject: [PATCH 6.0 852/862] net: ethernet: ti: davinci_mdio: fix build for mdio bitbang uses Date: Wed, 19 Oct 2022 10:35:39 +0200 Message-Id: <20221019083327.507859591@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747109248347149611?= X-GMAIL-MSGID: =?utf-8?q?1747109248347149611?= From: Randy Dunlap commit 35bbe652c421037822aba29423f5f1f7d0d69f3f upstream. davinci_mdio.c uses mdio bitbang APIs, so it should select MDIO_BITBANG to prevent build errors. arm-linux-gnueabi-ld: drivers/net/ethernet/ti/davinci_mdio.o: in function `davinci_mdio_remove': drivers/net/ethernet/ti/davinci_mdio.c:649: undefined reference to `free_mdio_bitbang' arm-linux-gnueabi-ld: drivers/net/ethernet/ti/davinci_mdio.o: in function `davinci_mdio_probe': drivers/net/ethernet/ti/davinci_mdio.c:545: undefined reference to `alloc_mdio_bitbang' arm-linux-gnueabi-ld: drivers/net/ethernet/ti/davinci_mdio.o: in function `davinci_mdiobb_read': drivers/net/ethernet/ti/davinci_mdio.c:236: undefined reference to `mdiobb_read' arm-linux-gnueabi-ld: drivers/net/ethernet/ti/davinci_mdio.o: in function `davinci_mdiobb_write': drivers/net/ethernet/ti/davinci_mdio.c:253: undefined reference to `mdiobb_write' Fixes: d04807b80691 ("net: ethernet: ti: davinci_mdio: Add workaround for errata i2329") Signed-off-by: Randy Dunlap Cc: Grygorii Strashko Cc: Ravi Gunasekaran Cc: Eric Dumazet Cc: Paolo Abeni Cc: Naresh Kamboju Cc: Sudip Mukherjee (Codethink) Link: https://lore.kernel.org/r/20220824024216.4939-1-rdunlap@infradead.org Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/ti/Kconfig | 1 + 1 file changed, 1 insertion(+) --- a/drivers/net/ethernet/ti/Kconfig +++ b/drivers/net/ethernet/ti/Kconfig @@ -33,6 +33,7 @@ config TI_DAVINCI_MDIO tristate "TI DaVinci MDIO Support" depends on ARCH_DAVINCI || ARCH_OMAP2PLUS || ARCH_KEYSTONE || ARCH_K3 || COMPILE_TEST select PHYLIB + select MDIO_BITBANG help This driver supports TI's DaVinci MDIO module. From patchwork Wed Oct 19 08:35: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: 5383 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp302846wrs; Wed, 19 Oct 2022 05:39:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5gaSlN+ruB2vt+vL/t3w/tfFt0dR8yVbXv30v3s8nNjN/x4OaLZpPrDEF2D4wC+LdLliIx X-Received: by 2002:a17:902:6944:b0:181:898b:6440 with SMTP id k4-20020a170902694400b00181898b6440mr8633804plt.78.1666183186083; Wed, 19 Oct 2022 05:39:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666183186; cv=none; d=google.com; s=arc-20160816; b=nBZFsPml4hFKOpvNwz2XRXwQzRAELW5yhoIFi/jdIG+3Do+FeDYkZ5YEt5mCHZkyEl F1GP48IkfSKdbt09prm6XpPqLV2FosB6lSkEvV6Fmeqvq0VCtCzkEQXENp5OJA7WLge/ uEnxoyLKFsILBxsiwPYIpw2z1AyMAZkdjcBKFVm4HxS3xCiybotXdqaZdwsNz5SVD4mM oegPSPh6/Qd0er2sIhXGXNcLNhholSKm32ojX+1A0JkB7NvMBhf1oCR/KpBhCPyHtdht lPE0oaSq1aWUclN8CO4nJdX+/C0aDYOk6hXNN0c/MfIFsEknrs8MygP7wPgwSS5OvQGF E0Xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=T8z6BcK6tQLQooD5JueFe3k9CfK5MfH9SE83lRrSjto=; b=QlCXuxKVifzK2QD0rSIaUR1LLTm2h3D7q0bEqw7L6SpFjHeh8X5fbUglr1TCV6W/S9 yeitieC8kBnjrEZpZkVGd3rkA/y8fK7J1dFOo3p2OMi/3QOPSjBSRjR3RLZNcMaum2HQ Yxv94sBbLDmjqylpWEDNi98erMe4mVxT5E1UpYqs7cZzMFi2STRqUl5o1ifuXBI7sqfw juajAoPaCIQIqYoq8c7OYB20jxWn6vHIEVFrD+95FdhkNvwjLp4gu7b8D9UEFYslUa5y lLlCmvBbV4yulFJDP2MryNxG3Rr3pUbUFJeLhgP62lJnswd30UDQZwm0sbQFaNnQ/waK zM1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=D8bhC0PO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n10-20020a1709026a8a00b00172ec19cb96si16791080plk.436.2022.10.19.05.39.26; Wed, 19 Oct 2022 05:39: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=D8bhC0PO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233142AbiJSMdc (ORCPT + 99 others); Wed, 19 Oct 2022 08:33:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231489AbiJSMdO (ORCPT ); Wed, 19 Oct 2022 08:33:14 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E3511781CB; Wed, 19 Oct 2022 05:12: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 sin.source.kernel.org (Postfix) with ESMTPS id AF02BCE217C; Wed, 19 Oct 2022 09:16:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B05B1C433D6; Wed, 19 Oct 2022 09:16:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170993; bh=9hn852ZhM0EfVIh1DYObpQhwk4metOXndls0I/VbDLc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D8bhC0POKDhJ9dC9gNSPCOB68ypQXcgpDimi7myfkrxm6h/qVAYozCpAFHOXxyrNn vcIRss6bSFwdy/jyA97Fkm4z7o0uxEkYURq5G8+5I7IZslvnLYk5waCvnDsJaeRE5v 72Lr7QOlNdz2cfDWIZePBfSckoyk0bfowk72iN7A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sherry Wang , Hamza Mahfooz , Aric Cyr , Alex Deucher Subject: [PATCH 6.0 853/862] Revert "drm/amd/display: correct hostvm flag" Date: Wed, 19 Oct 2022 10:35:40 +0200 Message-Id: <20221019083327.553350539@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747119700486661206?= X-GMAIL-MSGID: =?utf-8?q?1747119700486661206?= From: Aric Cyr commit 96ab3cb3b0f862308a03046d01d66c7b4154846b upstream. This reverts commit 796d6a37ff5ffaf9f2dc0f3f4bf9f4a1034c00de. 4K144 resolution isn't available on DCN31. Reviewed-by: Sherry Wang Acked-by: Hamza Mahfooz Signed-off-by: Aric Cyr Signed-off-by: Alex Deucher Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c +++ b/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c @@ -891,7 +891,7 @@ static const struct dc_debug_options deb .optimize_edp_link_rate = true, .enable_sw_cntl_psr = true, .enable_z9_disable_interface = true, /* Allow support for the PMFW interface for disable Z9*/ - .dml_hostvm_override = DML_HOSTVM_NO_OVERRIDE, + .dml_hostvm_override = DML_HOSTVM_OVERRIDE_FALSE, }; static const struct dc_debug_options debug_defaults_diags = { From patchwork Wed Oct 19 08:35: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: 4966 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp226791wrs; Wed, 19 Oct 2022 02:46:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4vP9327/mlwRx1SbNRv9oOegCZYSyueoa8CN2Vpo5BtO5pe8mntbkkvO0PFPG5phAiH1aQ X-Received: by 2002:a05:6a00:1707:b0:562:e790:dfc3 with SMTP id h7-20020a056a00170700b00562e790dfc3mr7764495pfc.59.1666172814288; Wed, 19 Oct 2022 02:46:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172814; cv=none; d=google.com; s=arc-20160816; b=Rt5DUDKHvoZrb79IsIutTOpWVQl3wzTYZSeHl7R0A7bcnNJ5z+q52eqQ/8wbMW8guw pH0GuFlEQK9h+oOS2bUQ2+Zabtf6e0lqR/gTVeNIn6xbbWtI/Rc6RGPenp5fAkVM5pDP vs0+2emY1l2Al3yNYaeMST1ExtfUgZNa1JCx3a2FHiDAE//KpjTFpC7pN0XDApCv2/lo w4oXfz15d6DARfq/bSmJ16+hBs/DHx2mdDUCElyLDmvDcPgq41fEl4kI4MwTglhtet47 DHYQRNF8vcChgU26Qq5f8dTQ8Ku6vcuaeyvw3QD6GEjB3FVH9Uj7bjRWnzkbuUM6ubBU RwZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nMJgdHT//sk6P9l3GtimaUZXH38U6bYfUMEFfCXiD6I=; b=fobSAeaK1PL7Oph4skH1i0wgvdGSkPbmXjbCg0a1rjvzvvycnrZLPsWhCZ8CmTj/1I P57oCT/o3ZE+ygEu+vIh6EJPnR12PEAliCnLMm1RfqDqi1UOlHXBd7TQhUXdQ9jdO64S PZE+dh4xF9nk1f7LUBwsRgr0XOZsmbuamTwoQcerJfByE180RHft07bW79D87bMyRTbX n0u72pXHwiFeBFn7n3NYdwOmX/gqaxm+tRgIGHYZO5GUV+rGvipDnJbCSHe11c781pHD 7rxgncL1p8LdN/d7yXnl91QqgMP1/XcP9Tk/NWtMa1mOwRcDrhWd/9EWSmPZkSLSzmFY WPKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qcDJXkLp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t2-20020a170902d20200b0017a09cc694dsi16208302ply.561.2022.10.19.02.46.41; Wed, 19 Oct 2022 02:46:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qcDJXkLp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234495AbiJSJoS (ORCPT + 99 others); Wed, 19 Oct 2022 05:44:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234576AbiJSJkr (ORCPT ); Wed, 19 Oct 2022 05:40: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 89530F0355; Wed, 19 Oct 2022 02:17: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 3C363617EC; Wed, 19 Oct 2022 09:16:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51E50C433C1; Wed, 19 Oct 2022 09:16:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170995; bh=cevrSgJp5/K+gljJsjmLJh8wwK0TipvFRgrsfKwaDf0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qcDJXkLpx2F1L0UT82hgswRruWgMU4B1RjbgtKnWC7S/bjc74PaCf4gnzuCi+6WyN EdK7VL2HwmR7ISC7w3ukPIQRIZvNtigc8o4SrobYEJo0R+DBCuHi+HUnXcIYIyiWot 6UUYPSVqDTWTLhHLVW0GCFePWfIaLNErOTG7tnWo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Aring , Stefan Schmidt , Sasha Levin Subject: [PATCH 6.0 854/862] Revert "net/ieee802154: reject zero-sized raw_sendmsg()" Date: Wed, 19 Oct 2022 10:35:41 +0200 Message-Id: <20221019083327.603406007@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108824463595532?= X-GMAIL-MSGID: =?utf-8?q?1747108824463595532?= From: Alexander Aring [ Upstream commit 2eb2756f6c9e9621e022d78321ce40a62c4520b5 ] This reverts commit 3a4d061c699bd3eedc80dc97a4b2a2e1af83c6f5. There is a v2 which does return zero if zero length is given. Signed-off-by: Alexander Aring Link: https://lore.kernel.org/r/20221005014750.3685555-1-aahringo@redhat.com Signed-off-by: Stefan Schmidt Signed-off-by: Sasha Levin --- net/ieee802154/socket.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/net/ieee802154/socket.c b/net/ieee802154/socket.c index cbd0e2ac4ffe..7889e1ef7fad 100644 --- a/net/ieee802154/socket.c +++ b/net/ieee802154/socket.c @@ -251,9 +251,6 @@ static int raw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size) return -EOPNOTSUPP; } - if (!size) - return -EINVAL; - lock_sock(sk); if (!sk->sk_bound_dev_if) dev = dev_getfirstbyhwtype(sock_net(sk), ARPHRD_IEEE802154); From patchwork Wed Oct 19 08:35: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: 5509 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp336619wrs; Wed, 19 Oct 2022 06:47:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4IghtnvgFQgSuaX5ns94NHSQNzuBqs8fhA2FtIi4WhEdG3p55h+i7S46hV8UbdYA5119Hc X-Received: by 2002:a17:903:1c2:b0:185:47ce:f4d2 with SMTP id e2-20020a17090301c200b0018547cef4d2mr8606094plh.101.1666187242062; Wed, 19 Oct 2022 06:47:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666187242; cv=none; d=google.com; s=arc-20160816; b=ub9gTjV6EM+E+79QYK0+HBV9XVWlJqs14IDv1lDfJNJ8xxgBaAHx/VTmlh5u2+N3El Rt5nynALfkTVI1bs/NHl5JUTq5p56kPYyw408/8BNRq+8NaA/IABYrr8Xj58d3M1iOEM 2uCUPWWL1K0ymh4SR4RX4D/cKHqNRGCA09xhVmk+L3NjH/8jYW4jWaf/8NEPY07S0hJw +4qrKWRR8ITaHMQu6yJ2V3ziUjf+aR5zRPyweP+iMtabVWLyCfQfb+upjRKEOSoltRy2 0N50tzwLyTIu0BdfB3Zc7+TeSjxzYyBnDl+BP+jXC+AQ6ZSHzUvLGSW22jPEg+fizZDI vJiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2XWnjJa5YEsFc81F+rAe2mXga1A+Lb+H/MGI5t9jqsA=; b=nPZWN0gziUEpbLQiUy5YJqMPVZsdRvKleJibXITFQ3GcfNefcAMKlWQ9a1zzLJAUqP jyHk2dZv5IJvydShmfit++tU43YqxgGlOfqADz4/hBGq+a+1/xmSUVqBSjF/nlvLP8Y+ wYvDaPhNpkHhH+HL7rJ2KrMmfuDJdUiWU2ozYs9O+lVlaGSNdZLCIY+2tHuxmziMLB7y 9iq1E9NcGvp7URZ5soHe80dSHt+vgi7vhHfvA1Smll/TgBb1X8gvmuoFQ2A8Dzbhi2fe ycaiMr3Hd7S0p6X8xc1KuX69aocyZofWp3LJEYUOa6YMkJMcvH6PwmbPyoxyViKVGMQE yYBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BJT3ECOn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k126-20020a636f84000000b004402f48dee0si17903815pgc.629.2022.10.19.06.47.09; Wed, 19 Oct 2022 06:47: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=BJT3ECOn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233167AbiJSNq4 (ORCPT + 99 others); Wed, 19 Oct 2022 09:46:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233166AbiJSNph (ORCPT ); Wed, 19 Oct 2022 09:45:37 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C19F717251E; Wed, 19 Oct 2022 06:32:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id D1539CE21FC; Wed, 19 Oct 2022 09:16:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD7E6C43470; Wed, 19 Oct 2022 09:16:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170998; bh=ImqWgvmSAO1Y+3CZ8wtg3E3cePx97fd8Hl1xN4HzMtY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BJT3ECOnWvGWEQP8Ne5okuJP2agMinCoV4eOfW/uXBO3w+4m4XEvuSNZ81JGLHPVl 8F4I3HFdvobW9pLwQ4jVWzUvfWfKgtRTudSL6zgIn8MAV5HF8rNXNl3Ig75unLt2VS 1+DvVenen+vWBa6dWrVKFMBh2jwuLHmag3pIGe3U= 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 6.0 855/862] net/ieee802154: dont warn zero-sized raw_sendmsg() Date: Wed, 19 Oct 2022 10:35:42 +0200 Message-Id: <20221019083327.647551693@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123953598392185?= X-GMAIL-MSGID: =?utf-8?q?1747123953598392185?= 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(+) --- a/net/ieee802154/socket.c +++ b/net/ieee802154/socket.c @@ -272,6 +272,10 @@ static int raw_sendmsg(struct sock *sk, err = -EMSGSIZE; goto out_dev; } + if (!size) { + err = 0; + goto out_dev; + } hlen = LL_RESERVED_SPACE(dev); tlen = dev->needed_tailroom; From patchwork Wed Oct 19 08:35: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: 4969 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp226873wrs; Wed, 19 Oct 2022 02:47:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM79ruv5jZ+IrBV9qzuHulbdZxzJFaLu5b0Jy0fuLcsLR8oXK5cF7gWap/+sCqq+/KaTfSwb X-Received: by 2002:a65:42c7:0:b0:462:7158:c863 with SMTP id l7-20020a6542c7000000b004627158c863mr6630899pgp.590.1666172829680; Wed, 19 Oct 2022 02:47:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172829; cv=none; d=google.com; s=arc-20160816; b=HnlMNa9LXMaWhVxWoWFdiqn7P5TlDMZffave6SRipGtW3kb/23gXx8Hdegwu67Txza 7b8bQTOLN5/eAgdg1c52koEVZvZw0z5YrEnVk4JW5foSke4Zjo6RnzPiljKtaVgvsuMB zs9yLru2EW6tsPGTsX6NAk5T92ciJfwonMVh2pF0jrrH01smZ2e18vHkP0LXTdVn12Je xelkdn9iQvSeIY0eOB/shhYch0CmdKOmN9JNwgxxn0jHxbtXkyYCtIh+3GiQCUYNUA5B VE4+kk51PnbPr1vku1ZCw0LZemy0dP38QH0NLAoT2WpWpK4Ytvzv9XTi313r+K+Pl5jg O55g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7qLPlh+qY61Vg0AVqBdPPqLOxPS0TKWJgcCBAzrOCvM=; b=M4FBYP+8KOnG9NQPi7cLr2pqxzDFouRgzRtGIwP5jrkL69aYIxHTHG+rdEUrpW/w+g Fi8bmj4agQdR+eyibhM9ibij802QpN2C9WzqlbcqqidnrqhsE0Y97gPA6invNu2/kJGs Lm+W1llGNI7agVgmrgj+UNTbyABGeU5ejQvbsdWQFht/OErlyTZnT3kzCZEgJZZhUuNb cADjkhvzzUpuDJQ65O2oZpSjEGcJeHBdHGxwmuiK4/6xxHv5WBY3x630SW3Ace2Ly58b VbeAOGVmvXQyIEyKpWrG+Mi+8as09yHnNQrUZ30wyciZecroqE+GTRBvFm8CzXLuavmC 8s7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ywmKqZuG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j14-20020a170903024e00b0018280f67482si20848155plh.113.2022.10.19.02.46.56; Wed, 19 Oct 2022 02: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=ywmKqZuG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234479AbiJSJoL (ORCPT + 99 others); Wed, 19 Oct 2022 05:44:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234577AbiJSJkr (ORCPT ); Wed, 19 Oct 2022 05:40: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 8C705F035F; Wed, 19 Oct 2022 02:17: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 3E53B61800; Wed, 19 Oct 2022 09:16:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56855C433C1; Wed, 19 Oct 2022 09:16:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666171000; bh=0fvtEFI43QThxu2xB2MBCAmBh4JcfuNcBuF2dhDcgv4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ywmKqZuGivTVQepAN3b+e1fTXAyOEo6M4EGLK+BNsbWacYurRSC1hekOEiwKhxMTI noForu5Y4v0goiBtsnIQ0xSrzTGKrBkhfv1M6lfrvUWsIt1EGayXOumbtQe8UqSFrQ EB1/1bz3TLTJvIKCRJVwyhOLHEq6hO9VSIIMo+5Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sachin Sant , Guenter Roeck , Nicholas Piggin , Michael Ellerman Subject: [PATCH 6.0 856/862] powerpc/64s/interrupt: Fix lost interrupts when returning to soft-masked context Date: Wed, 19 Oct 2022 10:35:43 +0200 Message-Id: <20221019083327.701054960@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108840616935004?= X-GMAIL-MSGID: =?utf-8?q?1747108840616935004?= From: Nicholas Piggin commit a4cb3651a174366cc85a677da9e3681fbe97fdae upstream. It's possible for an interrupt returning to an irqs-disabled context to lose a pending soft-masked irq because it branches to part of the exit code for irqs-enabled contexts, which is meant to clear only the PACA_IRQS_HARD_DIS flag from PACAIRQHAPPENED by zeroing the byte. This just looks like a simple thinko from a recent commit (if there was no hard mask pending, there would be no reason to clear it anyway). This also adds comment to the code that actually does need to clear the flag. Fixes: e485f6c751e0a ("powerpc/64/interrupt: Fix return to masked context after hard-mask irq becomes pending") Reported-by: Sachin Sant Reported-by: Guenter Roeck Signed-off-by: Nicholas Piggin Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20221013064418.1311104-1-npiggin@gmail.com Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/kernel/interrupt_64.S | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) --- a/arch/powerpc/kernel/interrupt_64.S +++ b/arch/powerpc/kernel/interrupt_64.S @@ -571,7 +571,7 @@ _ASM_NOKPROBE_SYMBOL(interrupt_return_\s beq .Lfast_kernel_interrupt_return_\srr\() // EE already disabled lbz r11,PACAIRQHAPPENED(r13) andi. r10,r11,PACA_IRQ_MUST_HARD_MASK - beq 1f // No HARD_MASK pending + beq .Lfast_kernel_interrupt_return_\srr\() // No HARD_MASK pending /* Must clear MSR_EE from _MSR */ #ifdef CONFIG_PPC_BOOK3S @@ -588,12 +588,23 @@ _ASM_NOKPROBE_SYMBOL(interrupt_return_\s b .Lfast_kernel_interrupt_return_\srr\() .Linterrupt_return_\srr\()_soft_enabled: + /* + * In the soft-enabled case, need to double-check that we have no + * pending interrupts that might have come in before we reached the + * restart section of code, and restart the exit so those can be + * handled. + * + * If there are none, it is be possible that the interrupt still + * has PACA_IRQ_HARD_DIS set, which needs to be cleared for the + * interrupted context. This clear will not clobber a new pending + * interrupt coming in, because we're in the restart section, so + * such would return to the restart location. + */ #ifdef CONFIG_PPC_BOOK3S lbz r11,PACAIRQHAPPENED(r13) andi. r11,r11,(~PACA_IRQ_HARD_DIS)@l bne- interrupt_return_\srr\()_kernel_restart #endif -1: li r11,0 stb r11,PACAIRQHAPPENED(r13) // clear the possible HARD_DIS From patchwork Wed Oct 19 08:35: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: 5487 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp334171wrs; Wed, 19 Oct 2022 06:42:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM55foptL0QCafVLlCE+oldhXMJsUeRQOrlRol+mMMJZ/geeHS8ow0pbVNpNJIz26a1othnP X-Received: by 2002:a05:6402:42c3:b0:45c:ec49:aacf with SMTP id i3-20020a05640242c300b0045cec49aacfmr7523180edc.40.1666186938945; Wed, 19 Oct 2022 06:42:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666186938; cv=none; d=google.com; s=arc-20160816; b=gCIy78MLtws3pvnOVrWnj0S5GC6XAuudubXF58SgL3a0d6hxq/7bhjfermXnin2fls p+TI0HpjqHqK4j7TVTuJ3FAe4oe4q/kCXu5p/QyqZo1eFM8QTDXJ2bTozY4Xf7Z3EQPf cbzYbl9oDhNmVxIobTpMhQWqYhfhY/7+pRro57pxS71kX2z+fiKzNcCcRbVKda2WZMdH 6kaBsBFj3kwgHZ3Mbv7Ukm+PMafTmGomN0nTokYLDXsiaoJ7aV03wao71XF8dfr+ybf+ o+55wxEZQdmRTJRsv+UaWT5fsbPUHuZXBDjcyzdvesps1VBxaU76ob9RkAd4jrZKC0/j sUQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Un9Z4ZV/6F/BD+BlZ9zE8ZhZL676DIBDF1Tv97vTw5w=; b=I4wq7FgWV6CN7Tu+p63B2hXthVtzrM+rwbUdDMqkmjz1PADCqvHpaHTvxkrCX1ueCn C9xcddicoXLGn7DGLnS9FBD+vRDCOIKMB07/JsXfR5AMd7xzi4065VS6CqEZC25vHYO9 TvvOozXE6ci1Moq6mtSufIBrY0qT+YpQOypIB25SGGpHTKL62i5gxTTjFjftBeA7S6Py YZwk5d6YptneaadZLib1/agZwUTBztiitc0Ak4wEJOQ7MfxOOoalLShNxgdpAlw1YHmi ZAlilVkxkEhd2CkTkqzDyR9xhURHnZmkC1M3x9LQkHgi63wc9f6T/j/hNuVbz4Ge+cNI h96w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PxBRxWlY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nb36-20020a1709071ca400b0078cba073ec3si15500581ejc.734.2022.10.19.06.41.52; Wed, 19 Oct 2022 06:42: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=PxBRxWlY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231905AbiJSNid (ORCPT + 99 others); Wed, 19 Oct 2022 09:38:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231683AbiJSNiG (ORCPT ); Wed, 19 Oct 2022 09:38:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F85D1D20ED; Wed, 19 Oct 2022 06:25: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 6C486B824EE; Wed, 19 Oct 2022 09:16:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2833C433D7; Wed, 19 Oct 2022 09:16:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666171003; bh=r2P7eIBGlzqeqgUonifqgm+qJb8JeaOUi/fYo6Y7x/I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PxBRxWlYvyJGkViUjv4Ch3qldE/coAGYYQMmsp+yi46wzUgREJ8R2ITQIpBRmYR5j /GKQ3WZ7qmyiBR2d+aFLyJKpoXufchfL/7NflcHWZtKd7G8NVjytmkpz/HxEzA46mW hAcLJpwEuYh75y8jffltT7B4UhGDLzmQ+b2dYXYs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Chancellor , Linus Torvalds Subject: [PATCH 6.0 857/862] drm/amd/display: Fix build breakage with CONFIG_DEBUG_FS=n Date: Wed, 19 Oct 2022 10:35:44 +0200 Message-Id: <20221019083327.749356475@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123635784005582?= X-GMAIL-MSGID: =?utf-8?q?1747123635784005582?= From: Nathan Chancellor commit 2130b87b2273389cafe6765bf09ef564cda01407 upstream. After commit 8799c0be89eb ("drm/amd/display: Fix vblank refcount in vrr transition"), a build with CONFIG_DEBUG_FS=n is broken due to a misplaced brace, along the lines of: In file included from drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm_trace.h:39, from drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:41: drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c: At top level: ./include/drm/drm_atomic.h:864:9: error: expected identifier or ‘(’ before ‘for’ 864 | for ((__i) = 0; \ | ^~~ drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:8317:9: note: in expansion of macro ‘for_each_new_crtc_in_state’ 8317 | for_each_new_crtc_in_state(state, crtc, new_crtc_state, j) | ^~~~~~~~~~~~~~~~~~~~~~~~~~ Move the brace within the #ifdef so that the file can be built with or without CONFIG_DEBUG_FS. Fixes: 8799c0be89eb ("drm/amd/display: Fix vblank refcount in vrr transition") Signed-off-by: Nathan Chancellor Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -8329,8 +8329,8 @@ static void amdgpu_dm_atomic_commit_tail crtc, dm_new_crtc_state, cur_crc_src)) DRM_DEBUG_DRIVER("Failed to configure crc source"); } -#endif } +#endif } for_each_new_crtc_in_state(state, crtc, new_crtc_state, j) From patchwork Wed Oct 19 08:35: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: 4965 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp226761wrs; Wed, 19 Oct 2022 02:46:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4p2qdn0bzKgsecqAwv7JbJSB2JSCJBO/R9z5aSkVf1gRaZjWYA2AQb6EMZd5LYeg0bPn0f X-Received: by 2002:a63:85c6:0:b0:46b:41a1:6322 with SMTP id u189-20020a6385c6000000b0046b41a16322mr6631405pgd.403.1666172809586; Wed, 19 Oct 2022 02:46:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172809; cv=none; d=google.com; s=arc-20160816; b=q6T9jSYOkWFe5p5VePheATtxtE7/e47PMZv9Xxuz3RUhX1CmCLvoUOKrLZDjJS0NsT l/4dNPH2YqV6EFnEBvlKYDHi3jxwHbm8jwQOM+A5zXZG30aOeQndOZh7UGdcm8viUmlk +MVi3TmRbh192KXUl+ky4G4V+EhCfb0DvcQ6P5nZllTQFrB3PTUa4pAez2c7W7sP3j6t a8evoGIX/2Q1znAMmXjGidz1yWrP+OlDYKr0hYvWQF/7Me3+80e3EH1mXrVzSqLTRtMZ m/iQChitq/icCSHHh+7mOq1hMu7hUV2hyHsCFiA5IGqNM2zwT7yAHZRf6+xuNm5sgTXl fEDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+JV4eGhallNZQy1tbM/go07E+phU8qcmKhznja7zYPk=; b=oIKfNpxS8Xy8DnfKCxibKQasDEkjTWpbaDSsc4aDT3GBzZMu6DAhdnwhqKBhmrKj6q 80+4mtygq+kGdUXDe2GdTx/SYVm2I85VLpN3WsYOIaLB/7/9m8eH9KycKSaQC40m1pX8 NG/luEHKHm4COr2/dTwvnvh8qWk+z4xhHvozMJbT4cqVo1oyAA4mWQGJdYhM0y9nD1PQ Qn3S8/zSLKmvZLKac1SBn9IVePIDvbdrw9jUg9egcE/vfh+zYUlKf8QdS6LNN5thj9Ib e+CPK5rZLO+mL1jAGroNum23IoDB7HebmK3ehPM2gpoV5pePB+uE96B+XCkhT1FKwJtt edSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hkwJ06WK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id on10-20020a17090b1d0a00b0020db486e32esi20182213pjb.158.2022.10.19.02.46.35; Wed, 19 Oct 2022 02: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=hkwJ06WK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234463AbiJSJoI (ORCPT + 99 others); Wed, 19 Oct 2022 05:44:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234530AbiJSJkj (ORCPT ); Wed, 19 Oct 2022 05:40:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62677F018B; Wed, 19 Oct 2022 02:17: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 6024361834; Wed, 19 Oct 2022 09:16:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73C0EC433B5; Wed, 19 Oct 2022 09:16:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666171005; bh=N5Fk36xhWE9Z2gJD+Mj+1ntG8BLl5wzMznG0J3oGd0c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hkwJ06WKwzCUgZIE3YUyZinW4i3eaIPo+U3avds+596YylDvKGna8c1p4JetkyCb9 SLI5cTA/i/hiLKBQsEjsLm1yNgadMzgK/fmbiogvMOSqPQJ6dhdxEroo9/+kP329sZ yJ2lWQZLcUInl5pO/cADjJ0mdOiLmi2ngCXm56no= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Begunkov , Jens Axboe , syzbot+e5198737e8a2d23d958c@syzkaller.appspotmail.com Subject: [PATCH 6.0 858/862] io_uring: fix fdinfo sqe offsets calculation Date: Wed, 19 Oct 2022 10:35:45 +0200 Message-Id: <20221019083327.799672854@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108819778135869?= X-GMAIL-MSGID: =?utf-8?q?1747108819778135869?= From: Pavel Begunkov commit 00927931cb630bbf8edb6d7f4dadb25139fc5e16 upstream. Only with the big sqe feature they take 128 bytes per entry, but we unconditionally advance by 128B. Fix it by using sq_shift. Fixes: 3b8fdd1dc35e3 ("io_uring/fdinfo: fix sqe dumping for IORING_SETUP_SQE128") Reported-and-tested-by: syzbot+e5198737e8a2d23d958c@syzkaller.appspotmail.com Signed-off-by: Pavel Begunkov Link: https://lore.kernel.org/r/8b41287cb75d5efb8fcb5cccde845ddbbadd8372.1665449983.git.asml.silence@gmail.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- io_uring/fdinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/io_uring/fdinfo.c +++ b/io_uring/fdinfo.c @@ -95,7 +95,7 @@ static __cold void __io_uring_show_fdinf sq_idx = READ_ONCE(ctx->sq_array[entry & sq_mask]); if (sq_idx > sq_mask) continue; - sqe = &ctx->sq_sqes[sq_idx << 1]; + sqe = &ctx->sq_sqes[sq_idx << sq_shift]; seq_printf(m, "%5u: opcode:%s, fd:%d, flags:%x, off:%llu, " "addr:0x%llx, rw_flags:0x%x, buf_index:%d " "user_data:%llu", From patchwork Wed Oct 19 08:35: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: 5474 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp332855wrs; Wed, 19 Oct 2022 06:39:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5GmDRwCiR2ORh1dg7Qdnp0xeU72ms5DEZ86Wq+I7jEsZkFZB77iOeahQsfnk2zlNyrE4Sd X-Received: by 2002:a17:902:ce09:b0:178:bb78:49a5 with SMTP id k9-20020a170902ce0900b00178bb7849a5mr8572408plg.100.1666186783492; Wed, 19 Oct 2022 06:39:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666186783; cv=none; d=google.com; s=arc-20160816; b=homdtrirkUxZphvNST/S4GZwDjvboGtlqnq+uw81n6e9Q+cZmurQ+hvAgu2yDb2qnb hsnpF7JZ5iVVO5x26Ra/uXidaacQbPWzhB9rwJcC3SwIANhwXHmKOgZIxv48A+gf6RZ1 5HFowOXUAqHxNrohyRhwelNtfieuxIFbK5o+R5fofg9k59govO7vu13p6d0lUcBPazEI 53wi87asjpz6PnOawzRE4FB3cDY2V8ZC0x2SIimtEYxZNjS0y4c2OYQ5+u1MwlZf/a4k s9fd8v5gbB5jKjphY44MJX/mGpej8Zz1mojS4sDvy9a5pT/o0oVvmrr/fGms4MmGmC/T pssg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4Dx7vCQwweHzUJuT8luJxOm1hgSu0foI8sN3lN/0/Ck=; b=TLVJizMytL0tv9MXX4NPBYq4fMXeUEXl//H6iFIl4Wb0y+kerBYtt3MDV+Q6Q3eSgm vXmQa2iebKoBVSoEqPdSfBrwzgKv3jgjwyOg+E4nFxvQaVmhLVuWpztdb8w4+iqsUSay KWAm5XXv6oEQ1V5tH5NZeMuzlSYDH9ugF6hAw9CmVv+5aOlIdz++fUZLd8x3n5RDevl/ v3x253k6xUmI5+oYsp1QY2F/Xec0/PQ8/Wva34mlZczoaVprf+pjcdC8r1kKGGo8fzK+ tLmTYEMaWTGCfROMdcjV6mlIXIfQwNnymLM0288m0yHcEW8kzYyuX1o9TTyX+Qh0l1II gfJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=K2Xf2CBc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j64-20020a638b43000000b0043941e5532dsi19153317pge.391.2022.10.19.06.39.19; Wed, 19 Oct 2022 06:39: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=K2Xf2CBc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230000AbiJSNfb (ORCPT + 99 others); Wed, 19 Oct 2022 09:35:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233008AbiJSNef (ORCPT ); Wed, 19 Oct 2022 09:34:35 -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 C13B9CE17; Wed, 19 Oct 2022 06:23: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 A9EF3B824EA; Wed, 19 Oct 2022 09:16:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 167FBC433D7; Wed, 19 Oct 2022 09:16:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170977; bh=s0Kxs9AhsSFwrBSiuSntUsIH+Tfr6lrXjjCETDydd48=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K2Xf2CBctxSrRy0+fI+Xz1joiaZ5kMMo3FAvcPmnbQV+liGdnHTfXVnseFMUslCVK Fx1TgoB6ntlTmwS0X5KiWZcE/NEbL8AcbwuVGRmgh+D4kWPten5i0IcjupjDxK/bAs uQjVxhMZ1oXjIROtRCmymOru1AoJHwM6RUTKvTzc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Chinner , Jens Axboe Subject: [PATCH 6.0 859/862] io_uring/rw: ensure kiocb_end_write() is always called Date: Wed, 19 Oct 2022 10:35:46 +0200 Message-Id: <20221019083327.847251927@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123472930139254?= X-GMAIL-MSGID: =?utf-8?q?1747123472930139254?= From: Jens Axboe commit 2ec33a6c3cca9fe2465e82050c81f5ffdc508b36 upstream. A previous commit moved the notifications and end-write handling, but it is now missing a few spots where we also want to call both of those. Without that, we can potentially be missing file notifications, and more importantly, have an imbalance in the super_block writers sem accounting. Fixes: b000145e9907 ("io_uring/rw: defer fsnotify calls to task context") Reported-by: Dave Chinner Link: https://lore.kernel.org/all/20221010050319.GC2703033@dread.disaster.area/ Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- io_uring/rw.c | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) --- a/io_uring/rw.c +++ b/io_uring/rw.c @@ -184,11 +184,34 @@ static void kiocb_end_write(struct io_ki } } +/* + * Trigger the notifications after having done some IO, and finish the write + * accounting, if any. + */ +static void io_req_io_end(struct io_kiocb *req) +{ + struct io_rw *rw = io_kiocb_to_cmd(req, struct io_rw); + + WARN_ON(!in_task()); + + if (rw->kiocb.ki_flags & IOCB_WRITE) { + kiocb_end_write(req); + fsnotify_modify(req->file); + } else { + fsnotify_access(req->file); + } +} + static bool __io_complete_rw_common(struct io_kiocb *req, long res) { if (unlikely(res != req->cqe.res)) { if ((res == -EAGAIN || res == -EOPNOTSUPP) && io_rw_should_reissue(req)) { + /* + * Reissue will start accounting again, finish the + * current cycle. + */ + io_req_io_end(req); req->flags |= REQ_F_REISSUE | REQ_F_PARTIAL_IO; return true; } @@ -214,15 +237,7 @@ static inline int io_fixup_rw_res(struct static void io_req_rw_complete(struct io_kiocb *req, bool *locked) { - struct io_rw *rw = io_kiocb_to_cmd(req, struct io_rw); - - if (rw->kiocb.ki_flags & IOCB_WRITE) { - kiocb_end_write(req); - fsnotify_modify(req->file); - } else { - fsnotify_access(req->file); - } - + io_req_io_end(req); io_req_task_complete(req, locked); } @@ -267,6 +282,11 @@ static int kiocb_done(struct io_kiocb *r req->file->f_pos = rw->kiocb.ki_pos; if (ret >= 0 && (rw->kiocb.ki_complete == io_complete_rw)) { if (!__io_complete_rw_common(req, ret)) { + /* + * Safe to call io_end from here as we're inline + * from the submission path. + */ + io_req_io_end(req); io_req_set_res(req, final_ret, io_put_kbuf(req, issue_flags)); return IOU_OK; From patchwork Wed Oct 19 08:35: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: 4993 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp227552wrs; Wed, 19 Oct 2022 02:49:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM73sn2mG1FINcLRcVuc7/mwZOmwuofruNb4rLHpD2qk4vNNOoJ6TNkfb6u8FklndRrmZL9O X-Received: by 2002:a17:907:968b:b0:78d:f5c2:70d8 with SMTP id hd11-20020a170907968b00b0078df5c270d8mr5830250ejc.564.1666172954776; Wed, 19 Oct 2022 02:49:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172954; cv=none; d=google.com; s=arc-20160816; b=gGS2F0v83X68cvAhWRZw6W0BsR4fBJATGqKHfuaLMCtM+ebBNeQpCE0HEukxnU9GN/ oH9g0+Fgewq4eYkMoMEt4SpVNAHwzUO5tbT75K8TOpuc/Uitu9wuEwAIe3o6xS3n9S8C 9mPukrtvE/+hiGPDGCntiAoqYEF0wvxNw0LxN1LAoU/9QNbGDGjZbTNJd6FZ5RmymG/Y au27Yg6xOofvp/fkDAoc1nayWPOm9Nrt8tT5msPUIem/kofrQ3oCKglLS+QHFzSUlbyl 2rbbAAIXEK9sCnRegFdnX3ItOkiaqSOvtKBPq2wPyhB3zmde/XrU1D6RRDMD/B83Qr4n 6ZWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vcGT7GhWP1SxoEl4/QEapGsTSLdDu7laD1vx7Yqcj/s=; b=hTaRR3QA2Z6GJPdyxBp0wEJMbRcn3h3zxTjsXtvktlfz2XkrTB9tPj6DFF9YIJ8uQ4 8vmplLqt8Tntirv3WlIcoXCcZXWrx80nF2ts5N+f/PAFsxsbim4h0depyqKn7PehKS4/ Pc+lYEPYmSebaV/KwA6P9lbuIsbfrCXhutsH4hiGdaFCwZ4VHK0ShalOJLIx5biDdIQ/ hBrq10AG1tHUXLfXGiG8aqegxmY0B2fRwpwPjYL4GKui+suORj5wykegmwh8pU9aS5TW 4faxohY3EUkeS2oTcYl4wBC+Ij7ilbRXUHhvSQxUArS2EOtIDyuSgN2OCO1v2IOWlE6S VsBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kVwSZxjA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e25-20020a170906c01900b0073d8a8fedbfsi12479022ejz.386.2022.10.19.02.48.49; Wed, 19 Oct 2022 02:49: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=kVwSZxjA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234042AbiJSJpK (ORCPT + 99 others); Wed, 19 Oct 2022 05:45:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234971AbiJSJl7 (ORCPT ); Wed, 19 Oct 2022 05:41:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42227F6C17; Wed, 19 Oct 2022 02:18: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 AE03961828; Wed, 19 Oct 2022 09:16:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BFCF5C433C1; Wed, 19 Oct 2022 09:16:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170980; bh=FYipOXVEh/W6XkjRwrcbJtXg1hEM0/kwaTD3dCXorOM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kVwSZxjA/M7QGu+qmO5WiBthuf9anPVXN6HXmomNDUru6DSlau6lhEt5JRVubWxfW g1pdzwsqeVcCsv/TR9RDHglVTs68Py9bcq4JsslMyU9YjjY7X0+Avxgrt58znO222r ZqB/fVBbYNptrX16pPkBOrpzHiFZS0W8/+ZmCH00= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Masahiro Yamada , Nathan Chancellor Subject: [PATCH 6.0 860/862] Kconfig.debug: simplify the dependency of DEBUG_INFO_DWARF4/5 Date: Wed, 19 Oct 2022 10:35:47 +0200 Message-Id: <20221019083327.899440801@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108972541281291?= X-GMAIL-MSGID: =?utf-8?q?1747108972541281291?= From: Masahiro Yamada commit 4f001a21080ff2e2f0e1c3692f5e119aedbb3bc1 upstream. Commit c0a5c81ca9be ("Kconfig.debug: drop GCC 5+ version check for DWARF5") could have cleaned up the code a bit more. "CC_IS_CLANG &&" is unneeded. No functional change is intended. Signed-off-by: Masahiro Yamada Reviewed-by: Nathan Chancellor Signed-off-by: Greg Kroah-Hartman --- lib/Kconfig.debug | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -264,7 +264,7 @@ config DEBUG_INFO_DWARF_TOOLCHAIN_DEFAUL config DEBUG_INFO_DWARF4 bool "Generate DWARF Version 4 debuginfo" select DEBUG_INFO - depends on !CC_IS_CLANG || (CC_IS_CLANG && (AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502))) + depends on !CC_IS_CLANG || AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502) help Generate DWARF v4 debug info. This requires gcc 4.5+, binutils 2.35.2 if using clang without clang's integrated assembler, and gdb 7.0+. @@ -276,7 +276,7 @@ config DEBUG_INFO_DWARF4 config DEBUG_INFO_DWARF5 bool "Generate DWARF Version 5 debuginfo" select DEBUG_INFO - depends on !CC_IS_CLANG || (CC_IS_CLANG && (AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502))) + depends on !CC_IS_CLANG || AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502) help Generate DWARF v5 debug info. Requires binutils 2.35.2, gcc 5.0+ (gcc 5.0+ accepts the -gdwarf-5 flag but only had partial support for some From patchwork Wed Oct 19 08:35: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: 4990 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp227418wrs; Wed, 19 Oct 2022 02:48:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4tOxeS8Dr0RBK/x7D1oNcc3x+KXjf1Y49A1m18e93ZKQ9qrbTi1wmaoc4eKe+Yn7kL+Eq4 X-Received: by 2002:a05:6a00:1344:b0:565:e95c:6da4 with SMTP id k4-20020a056a00134400b00565e95c6da4mr7514066pfu.45.1666172928492; Wed, 19 Oct 2022 02:48:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172928; cv=none; d=google.com; s=arc-20160816; b=HWfVIamwPfjGJDeXnoJPcmQu8ckXoOu/kYb3PbeRQudZC45r0H7fsJTP5yfjQ+YKme 6po1+Odc/UskuqLPnuLIcM7xyZeQVjz3OxMbOsDRD0U9r+pV2U00gKxdRWMCuet6UJdc P7pziChxXV3LkDy9fBx0hYsRGXCuUiCEE99+69Wa/XhV+9fJr/4roybmZRuoXwYEMMRI S5lYG9HlzuWwtmFQV6U08HcqBjy/m30NNlrdVrjbpRCMBi8LcGIE37EBvH/yZEvk3ufh LXQlQBgSDQq0wMSBCg65wv65sDRzlXgQPfoWoixYOO4yvtbOgki/NjyBq/bTwSRb2j0V xnjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dSP/WekZqdVNZMemNmsPhTMxr56aGuBQzy47HhWw5XA=; b=qjnzbK+3ALnCT9pMQJ/ZT3I5lVetY8Pb4IuzXZ8d0Vmp96/xNss951cQe2X+p/Ycx3 OI5jQJQ5cXjpMh1BbaJLY5Py/p0joO36RdolkKnHfU/ISkfZVUl1h5805Mvg1ItmbX9g QFBrTIjZu7s5M5jZ0ve9A4Bv9ymL40qK2AcL4xFL32Uq48nra+jMzX9/Qr62cXhjEFnN rWHb529zImgYUisqDieGezvgDkilQ8k62f7fa+Z9pz2gOv95HNcrbUhXv5gjlkeQI7QM ZlZAZ3xlCOegrvlltqI8jMXcUcO8rJ7gFGjXS83QNRsP61H8uzIjOKv+L4PKXFiPdJTL /PVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1cs5caDA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) 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-20020a170902e88800b00182c500d973si22009337plg.43.2022.10.19.02.48.34; Wed, 19 Oct 2022 02: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=1cs5caDA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234451AbiJSJoB (ORCPT + 99 others); Wed, 19 Oct 2022 05:44:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234518AbiJSJki (ORCPT ); Wed, 19 Oct 2022 05:40: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 E4987F0186; Wed, 19 Oct 2022 02:16: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 5E089617E8; Wed, 19 Oct 2022 09:16:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6ABDBC433C1; Wed, 19 Oct 2022 09:16:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170982; bh=nWENc6DvF0ptLyQFnc1HPQI6T98w4ylTIBF7MVi5LmY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1cs5caDAQSNgxRdC/6vTdtGTMqy99akFOz4isVSTaKjUTvycHHHhx38LonsgYMK0y tu3AUszACaep5Limq2ksTwOs+b683cRHeW+vFYt1eG6DuaHDZ1+exc+nI55RT4dEQM jbLYCllKW0C7G/Wdbi0uDwTH+BEMobtKq0YzZWsc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Masahiro Yamada , Nathan Chancellor Subject: [PATCH 6.0 861/862] Kconfig.debug: add toolchain checks for DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT Date: Wed, 19 Oct 2022 10:35:48 +0200 Message-Id: <20221019083327.950968833@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108944525819559?= X-GMAIL-MSGID: =?utf-8?q?1747108944525819559?= From: Masahiro Yamada commit bb1435f3f575b5213eaf27434efa3971f51c01de upstream. CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT does not give explicit -gdwarf-* flag. The actual DWARF version is up to the toolchain. The combination of GCC and GAS works fine, and Clang with the integrated assembler is good too. The combination of Clang and GAS is tricky, but at least, the -g flag works for Clang <=13, which defaults to DWARF v4. Clang 14 switched its default to DWARF v5. Now, CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT has the same issue as addressed by commit 98cd6f521f10 ("Kconfig: allow explicit opt in to DWARF v5"). CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y for Clang >= 14 and GAS < 2.35 produces a ton of errors like follows: /tmp/main-c2741c.s: Assembler messages: /tmp/main-c2741c.s:109: Error: junk at end of line, first unrecognized character is `"' /tmp/main-c2741c.s:109: Error: file number less than one Add 'depends on' to check toolchains. Signed-off-by: Masahiro Yamada Reviewed-by: Nathan Chancellor Signed-off-by: Greg Kroah-Hartman --- lib/Kconfig.debug | 1 + 1 file changed, 1 insertion(+) --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -253,6 +253,7 @@ config DEBUG_INFO_NONE config DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT bool "Rely on the toolchain's implicit default DWARF version" select DEBUG_INFO + depends on !CC_IS_CLANG || AS_IS_LLVM || CLANG_VERSION < 140000 || (AS_IS_GNU && AS_VERSION >= 23502) help The implicit default version of DWARF debug info produced by a toolchain changes over time. From patchwork Wed Oct 19 08:35: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: 4963 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp226735wrs; Wed, 19 Oct 2022 02:46:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4fyAP8c1ufpmOl64/RnNWkCWn9F2mSMczjc4JAukp0rMR5Fws9qI3Vsqbg5Mq+rBJQguCI X-Received: by 2002:a17:90b:3b50:b0:20d:93f3:9c8d with SMTP id ot16-20020a17090b3b5000b0020d93f39c8dmr42119032pjb.150.1666172806117; Wed, 19 Oct 2022 02:46:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172806; cv=none; d=google.com; s=arc-20160816; b=aMwm7t1ivx5uS/vcy2cqcIPXJlV0VQYviBDeSZQv3TtgLmKtVWfZLs1yNyVOYJlP9b qRFFPXKQfMZYFLEB+b8nHD8VWgEIJoPjrMOYR5LMJZxxBFZPFtPdwoR73OhCw+dD9B56 UJeXQE7n7VTPqXUh5HPCg/2BpQ/zoYju1uO4JOKOSfxNG0XUTrnrCtFbFRnWtjZD1yI0 RwSQJxk0rQkfjIWvAEv0K6ng7o3dwVUiIkn4Z93DHZ+8k6QzbOOXQegFRVGnr2C6yrpJ BnGSS10qKPfCITi2jELA/b3E7RZ6iqWl8IqtfIi5veyiKQToAhtGOE6v93uWNAZItHYX +tVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gEXdejJfQmrxPYr9JOX8OPpO9WnXqVJ8F6fxO6eXNGU=; b=Hd7mFaXNRxeStsY2+muccd5YL1BhCRD+h9pOR/ob+pK9s6MMmIrUYBcAQPkrOkD0xZ j0LNf9dKz+wOQs2TWzmUIN64R4d4Dl/Q/vOy7PXUdERXt1bZU/leN5QltI0WIKsAe4Bw r+sk7KHVAdrmjGD503pfD1nH2EaVahzyQzGhXM6cfWrwLxXIHBBR7c1hU1jG0dIGfnT6 YRED1Ra5yFk0P+t0+TXpejNJdCw5yzURO3l3WAaL2Q5HnIkOCtXprGxXZxck6ECoZVg6 R5pOxSy4bbBus+l7Cfmi7fwn5HZFnQ6dw3rZJcV9xHFlKp4kX7LHh10ZHPsWJDsSms7P 5Mtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TtiFKQ2Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cp2-20020a170902e78200b001789faa627csi17341517plb.396.2022.10.19.02.46.29; Wed, 19 Oct 2022 02:46: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=TtiFKQ2Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234233AbiJSJnq (ORCPT + 99 others); Wed, 19 Oct 2022 05:43:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234494AbiJSJke (ORCPT ); Wed, 19 Oct 2022 05:40: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 259FDF034C; Wed, 19 Oct 2022 02:17:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EC4D2617D4; Wed, 19 Oct 2022 09:16:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0AF97C433D6; Wed, 19 Oct 2022 09:16:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170985; bh=QexgGbePdpSUxSJVDrDa2mgDst0/2mVL7ZvWwc9hdg0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TtiFKQ2QcSimwPXZrXwENvmC7w4H0TsyGY9ZovRjrdu4TlCMrX5cXIix5TF8WMON0 UgniEYQ2gwLxEVryboTjTg3p6KfxsE9WJsnH/0G3CiHG1y3IzJ47JYi5y/JYaJRlBn znuWmjdweXTbTH9prsS3IxB2Qx927J1Pb/7B/plI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Chancellor , Nick Desaulniers , Masahiro Yamada Subject: [PATCH 6.0 862/862] lib/Kconfig.debug: Add check for non-constant .{s,u}leb128 support to DWARF5 Date: Wed, 19 Oct 2022 10:35:49 +0200 Message-Id: <20221019083327.989995776@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108816206854829?= X-GMAIL-MSGID: =?utf-8?q?1747108816206854829?= From: Nathan Chancellor commit 0a6de78cff600cb991f2a1b7ed376935871796a0 upstream. When building with a RISC-V kernel with DWARF5 debug info using clang and the GNU assembler, several instances of the following error appear: /tmp/vgettimeofday-48aa35.s:2963: Error: non-constant .uleb128 is not supported Dumping the .s file reveals these .uleb128 directives come from .debug_loc and .debug_ranges: .Ldebug_loc0: .byte 4 # DW_LLE_offset_pair .uleb128 .Lfunc_begin0-.Lfunc_begin0 # starting offset .uleb128 .Ltmp1-.Lfunc_begin0 # ending offset .byte 1 # Loc expr size .byte 90 # DW_OP_reg10 .byte 0 # DW_LLE_end_of_list .Ldebug_ranges0: .byte 4 # DW_RLE_offset_pair .uleb128 .Ltmp6-.Lfunc_begin0 # starting offset .uleb128 .Ltmp27-.Lfunc_begin0 # ending offset .byte 4 # DW_RLE_offset_pair .uleb128 .Ltmp28-.Lfunc_begin0 # starting offset .uleb128 .Ltmp30-.Lfunc_begin0 # ending offset .byte 0 # DW_RLE_end_of_list There is an outstanding binutils issue to support a non-constant operand to .sleb128 and .uleb128 in GAS for RISC-V but there does not appear to be any movement on it, due to concerns over how it would work with linker relaxation. To avoid these build errors, prevent DWARF5 from being selected when using clang and an assembler that does not have support for these symbol deltas, which can be easily checked in Kconfig with as-instr plus the small test program from the dwz test suite from the binutils issue. Link: https://sourceware.org/bugzilla/show_bug.cgi?id=27215 Link: https://github.com/ClangBuiltLinux/linux/issues/1719 Signed-off-by: Nathan Chancellor Reviewed-by: Nick Desaulniers Signed-off-by: Masahiro Yamada Signed-off-by: Greg Kroah-Hartman --- lib/Kconfig.debug | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -231,6 +231,11 @@ config DEBUG_INFO in the "Debug information" choice below, indicating that debug information will be generated for build targets. +# Clang is known to generate .{s,u}leb128 with symbol deltas with DWARF5, which +# some targets may not support: https://sourceware.org/bugzilla/show_bug.cgi?id=27215 +config AS_HAS_NON_CONST_LEB128 + def_bool $(as-instr,.uleb128 .Lexpr_end4 - .Lexpr_start3\n.Lexpr_start3:\n.Lexpr_end4:) + choice prompt "Debug information" depends on DEBUG_KERNEL @@ -253,7 +258,7 @@ config DEBUG_INFO_NONE config DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT bool "Rely on the toolchain's implicit default DWARF version" select DEBUG_INFO - depends on !CC_IS_CLANG || AS_IS_LLVM || CLANG_VERSION < 140000 || (AS_IS_GNU && AS_VERSION >= 23502) + depends on !CC_IS_CLANG || AS_IS_LLVM || CLANG_VERSION < 140000 || (AS_IS_GNU && AS_VERSION >= 23502 && AS_HAS_NON_CONST_LEB128) help The implicit default version of DWARF debug info produced by a toolchain changes over time. @@ -277,7 +282,7 @@ config DEBUG_INFO_DWARF4 config DEBUG_INFO_DWARF5 bool "Generate DWARF Version 5 debuginfo" select DEBUG_INFO - depends on !CC_IS_CLANG || AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502) + depends on !CC_IS_CLANG || AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502 && AS_HAS_NON_CONST_LEB128) help Generate DWARF v5 debug info. Requires binutils 2.35.2, gcc 5.0+ (gcc 5.0+ accepts the -gdwarf-5 flag but only had partial support for some