From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796382579; b=ifTuJ52sQOGy54RGjQ0Li/BtQbzinpE6M56V3Z9Ih7OSCH/4Ywz6+dalWOjd24Do7HQt UHlmP7IeQPgUGI2j1KmMJrlTv9fuKmhV0MqN4kKgMvIepc3JWrkFYlD7JtE0YKa9J1U6P P/5z/UEqGyO8FVf7GOEpFF0YXs8Oo0j9+oHMW228o/Rpj+QEbkwf+OHIBNM3YpFFsq668 /kcHlFbhsUO5HhLK+0DTUMy0oqbeyjFEECoCt/aW7J5d6lF512pcviYqBnyjNp49eqx8G R3wVvDgVDOm7rJOqPFqs+oknu1lMGHcSvfrO+lMNnewyeOTi1SNRY58ddfOdIMClgAA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796382579; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=jMwkbBGEkpK4BcmFXHUlxJWmu8GFI41md5wQ1ICprM8=; b=iBuhH55ineJF3ySg6SBs0s0tOgEDFj6w58IyA/Iic2Srm54E3EScYBefczwFs6YRQhiQ dsFEWnEe7sA3dMbVf0hqwaHnKJIOQVphpgkog0dn477JdmGsV0WjLuwsboe6bWNDEGmM6 iNwbrd27l8NsmiV3+VXfyqTMX/QFV0tilwSOR4JUrq2mLp1TIfE0hKFfVygdrVAj801NM 8pVAlbojeKCsS4iMMnRfvNPk/oJFtKj7Uk2Mv2zYj/ZKGwaR4u4i9218l3vx0Tw6EherW XfDvFYjXmDmK/5LrJqU1N2MYvGq2KddyQkoic1QrCgCu3fk6IbWCH59iAgzA8lKacUw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=Au8Ke2LH; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3D3F4606A322; Fri, 4 Dec 2026 11:09:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=Au8Ke2LH Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7C65A1F000CE; Fri, 4 Dec 2026 11:09:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796382578; bh=jMwkbBGEkpK4BcmFXHUlxJWmu8GFI41md5wQ1ICprM8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Au8Ke2LHA/Q9zjyg5ayasb4HuBOx850CSJhqXP754hAwvC5OT/I13p/U3k55y0cm7 ghm8GglAUjNfkDql3eifohLuBexao72PM4IlvOkDPpStq9jaB35lYhlNY1Yk2/MgXO CoURDupdudgU+b8P54vVXfz7YPogyAeU69kUFt7A= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Gerald Schaefer , Heiko Carstens , Alexander Gordeev Subject: [PATCH 6.18 514/703] s390/appldata: Fix error handling in appldata_generic_handler() Date: Fri, 4 Dec 2026 19:06:53 +0900 Message-ID: <20261204100641.471455531@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100627.522266145@linuxfoundation.org> References: <20261204100627.522266145@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Gerald Schaefer commit 0f01f3156f260a5fbce3b4017e1f1ff93cb29465 upstream. appldata_generic_handler() always returns 0 after starting or stopping monitor recording. So "echo {0,1} > /proc/sys/appldata/{os,mem,net_sum}" returns success even when DIAG 0xDC failed. A failed start would keep ops->active as 0, so reading the sysctl later would correctly reflect this. A failed stop would falsely set ops->active to 0 and decrement module refcount. This would allow the data gathering module to be removed, and the data buffer to be freed, while z/VM monitor service is still collecting data from that buffer. Fix this by returning -EIO when appldata_diag() failed, and only set ops->active to 0 and decrement module refcount when it succeeded on stop path. Cc: stable@vger.kernel.org Signed-off-by: Gerald Schaefer Reviewed-by: Heiko Carstens Signed-off-by: Heiko Carstens Signed-off-by: Alexander Gordeev Signed-off-by: Greg Kroah-Hartman --- arch/s390/appldata/appldata_base.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) --- a/arch/s390/appldata/appldata_base.c +++ b/arch/s390/appldata/appldata_base.c @@ -320,21 +320,25 @@ appldata_generic_handler(const struct ct pr_err("Starting the data collection for %s " "failed with rc=%d\n", ops->name, rc); module_put(ops->owner); + rc = -EIO; } else ops->active = 1; } else if (!active && (ops->active == 1)) { - ops->active = 0; rc = appldata_diag(ops->record_nr, APPLDATA_STOP_REC, (unsigned long) ops->data, ops->size, ops->mod_lvl); - if (rc != 0) + if (rc != 0) { pr_err("Stopping the data collection for %s " "failed with rc=%d\n", ops->name, rc); - module_put(ops->owner); + rc = -EIO; + } else { + ops->active = 0; + module_put(ops->owner); + } } mutex_unlock(&appldata_ops_mutex); module_put(ops->owner); - return 0; + return rc; } /*************************** /proc stuff *******************************/