From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A5797322749; Sat, 12 Sep 2026 13:57:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789221461; cv=none; b=TTCp94UKmsay3pdijg+KsGO6JSYYkoTxlDo26MTBUFkDToWcHFb7vpUxh4Uf4ZJV16g9FNFTYsnR2Joz0whGnvvKLgfPxv7xdlT4IU525VFwxigizKA2phYPAIUt3yqtUJvWZy2osymvaehHN6NUV5RbHUQqN+Bl31wLERO31qI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789221461; c=relaxed/simple; bh=RZ6d5CefRW9frGcXMz6epeMaDemU0iDP9UCCwKqMSk0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Lusfrpu4+U+mse9GJuSaTPnFiR1OGTn6VkRM+lgpfgT9A+JjneLG//5SY7nHmXnxCEn7tc+fk7fbOvqJ2ptY6TXFYAGmQr/mD0AVqcen9Fr0WIWgD6hiDZKFvdrqXlCjCq6GO97nVsVyBWizLrkCPblPuFH5akoVnLOQVoeLuTE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=h2Fx6aRI; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="h2Fx6aRI" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26B161F000FF; Sat, 12 Sep 2026 13:57:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789221460; bh=/Cbi6QteI/vJRY9xPbNTadT7SzMAtvvp807tQjIeYhQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=h2Fx6aRI2kx4LWX2FPqgxU63zzH5jCR/fwgK/OnK7bR82QGSW2TXmfK5kgu6eeuxg 0nv23I+4e0dxqkJqDHtwgVuYzfnPJShQG1ZR+524QTCmGvypgip3AZZlmt0iZJBWx4 RQyXt4/TMXl0SSW8ODzoCB3TsXHn/+WZwQol0gLw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Anthony Krowiak , Matthew Rosato , Christian Borntraeger Subject: [PATCH 6.6 0385/1424] s390/vfio-ap: Fix stale do_remove flag across iterations in vfio_ap_mdev_cfg_remove Date: Sat, 12 Sep 2026 08:46:57 +0200 Message-ID: <20260912065615.913052428@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065607.279695368@linuxfoundation.org> References: <20260912065607.279695368@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Anthony Krowiak commit b1f092d94f621307927f145e3cc31893da51fc08 upstream. The do_remove flag in vfio_ap_mdev_cfg_remove() is initialised to zero before the loop that iterates over the list of matrix mdevs, but is never reset at the start of each iteration. Since do_remove is OR-accumulated across iterations, a positive result from one mdev carries over to subsequent mdevs. The fix is to set the do_remove flag with the first call to bitmap_and; for example: do_remove = bitmap_an rather than do_remove |= bitmap_and. Fixes: eeb386aeb5b7 ("s390/vfio-ap: handle config changed and scan complete notification") Cc: stable@vger.kernel.org Signed-off-by: Anthony Krowiak Reviewed-by: Matthew Rosato Signed-off-by: Christian Borntraeger Signed-off-by: Greg Kroah-Hartman --- drivers/s390/crypto/vfio_ap_ops.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/drivers/s390/crypto/vfio_ap_ops.c +++ b/drivers/s390/crypto/vfio_ap_ops.c @@ -2353,15 +2353,15 @@ static void vfio_ap_mdev_cfg_remove(unsi DECLARE_BITMAP(aprem, AP_DEVICES); DECLARE_BITMAP(aqrem, AP_DOMAINS); DECLARE_BITMAP(cdrem, AP_DOMAINS); - int do_remove = 0; + int do_remove; list_for_each_entry(matrix_mdev, &matrix_dev->mdev_list, node) { mutex_lock(&matrix_mdev->kvm->lock); mutex_lock(&matrix_dev->mdevs_lock); - do_remove |= bitmap_and(aprem, ap_remove, - matrix_mdev->matrix.apm, - AP_DEVICES); + do_remove = bitmap_and(aprem, ap_remove, + matrix_mdev->matrix.apm, + AP_DEVICES); do_remove |= bitmap_and(aqrem, aq_remove, matrix_mdev->matrix.aqm, AP_DOMAINS);