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 BCF23563FB9; Wed, 9 Sep 2026 13:55:27 +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=1788962128; cv=none; b=hXYZuhQbrZd95C2wTHo2v/BlBKAxN3jpo0EpDJmJ0Wpf4iw3gUTp8BlRSOgrfqWYUM9BzGuybNjKQfIpNszVytUr7nm5kV2BjLZi75uzKd9P8uo75u4HZcM9utcqvX3yroRCTXeXHH2+6j3X6p5lU4RD/K5l4r43fJwDWwCQ2lg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788962128; c=relaxed/simple; bh=lkFLg8hGz71U0NdiLy/B/F+IhFv8ws278F2u9hTAszs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nAAU7mmeDbyNl0hwpeoCINgYrxXQzC0ZX/VKyC1qTzbgqvikeoCqFKEAkC+rBYaOgryyWBfVM4/466Hbb/5GkUpHe29SsIU0NpqgSTv/7b+NkROmA1TYMB3gTeMMi4CfYVYejhvI2f1oBI39iTtc7mGu8OB4VLT5tG/Lzp4et/g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=K6ljRK83; 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="K6ljRK83" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D41371F00A3D; Wed, 9 Sep 2026 13:55:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1788962127; bh=Z0NbhW3KJwQuDm+DF/gNSia2h945jGK1R685KK6A7mU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=K6ljRK837R/iHEAK8qyijKyLBCgB5ATCyQhXpJ2k6SM40e1fYr6RriT4RAw+/Vjc2 D00afwMwK9LiFT2/9uJQU/wGSDfQf8leqRyO7x+JxC7DPNe9p9G4l8my5bxW4wbBkH czpzYr3sf608n4s2MydinoQJWBsFnT90g1HqMpH4= 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 7.2 184/556] s390/vfio-ap: Fix stale do_remove flag across iterations in vfio_ap_mdev_cfg_remove Date: Wed, 9 Sep 2026 15:37:44 +0200 Message-ID: <20260909134236.882632766@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260909134230.441546314@linuxfoundation.org> References: <20260909134230.441546314@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 7.2-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 @@ -2598,15 +2598,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);