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 E58433F4DE2; Sat, 12 Sep 2026 15:48:32 +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=1789228114; cv=none; b=CgrPKEe02/4vBjF/b6o/30l+n07b11rLiSIcRf8glXQVr+SfcXC06wuihG9Rjlu+7Zfq++pD+bnqrfyRScbHaclMjkIkOKcyW7IoXBE1KhwwOqEorB1ozbXe+3sYkRnaff6pHuxCjaEfiVh5S8Tyh5IrqUf8G9RJr1bQAcYK15E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789228114; c=relaxed/simple; bh=5YwjhaL7cnOpb5dgrFmk22Om5GO0efFdCt+nO6uc6t0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=A5z3i/PCFtBp61RuoD42o9a5i4d4HU/pFzGtj9pBiTzy/zrsepgwl0F+HKcmxN22q24P006D41rvSZBZmlC5KAODtqkvwYKTvqh0P/qWW94LMArjTCrLap1DmjGR/FrgeAyLVx57ftWcNrtpeF5k3y8NqwuMaQZOdwAWXlpdetc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=hdGkIS9V; 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="hdGkIS9V" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B5D11F000FF; Sat, 12 Sep 2026 15:48:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789228112; bh=s7AKbWsiy68kXL+I35yWI0WCjECwPhqsq6ki/twooVE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=hdGkIS9VCHUnL9ZuSQV+OuYShWdE/TtJI3+X7dUZ10KFZMbCLGuFBkD2Td4fNWGBN 9h5mZA3uEMPBMRo6QWPsgp5IDXenlkbXNBNNcYunEgAcBurps8OE53fukvWWSSDD6y SfehineLQny371yX8tEtdRBCf4ku1bwKH+dOwTAs= 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.1 0318/1191] s390/vfio-ap: Fix stale do_remove flag across iterations in vfio_ap_mdev_cfg_remove Date: Sat, 12 Sep 2026 08:50:46 +0200 Message-ID: <20260912065555.373102720@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065548.086904252@linuxfoundation.org> References: <20260912065548.086904252@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.1-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 @@ -2032,15 +2032,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);