CVE-2026-89958: s390/vfio-ap: Fix dereference matrix_mdev->kvm without checking for NULL

Published Sep 16, 2026
·
Updated

In the Linux kernel, the following vulnerability has been resolved:

s390/vfio-ap: Fix dereference matrixmdev->kvm without checking for NULL

The apdriver structure has two fields which are function pointers to callbacks:

.onconfigchanged: called at the start of the AP bus scan function to notify the device driver that the host AP configuration has changed and the associated AP devices will be added or removed accordingly. This gives the implementor a chance to evaluate the configuration changes and respond to them before the associated devices are added or removed.

.onscancomplete: Called at the end of the AP bus scan function to notify the device driver that the host AP configuration has changed and the AP devices have been added or removed accordingly. This gives the implementor the opportunity to respond to the changes after the associated devices are added or removed.

These two callbacks are implemented in the vfioap device driver via the vfioaponcfgchanged and vfioaponscancomplete functions respectively.

Within the call stack of these two callback functions the matrixmdev->kvm->lock mutex is taken without checking whether matrixmdev->kvm is NULL or not. If matrixmdev->kvm has never been set, trying to take the lock will trigger a NULL pointer dereference. This patch adds checks for matrixmdev->kvm == NULL before taking the matrixmdev->kvm->lock mutex.

Note that the matrixmdev->kvm->lock mutex taken in the vfioapmdevhotplugconfig function is moved to the calling function along with the matrixdev->mdevslock which is needed there to access the fields of the matrixmdev. It makes little sense to make the change the check for matrixmdev->kvm there before taking the kvm->lock mutex only to have to move it out via another patch, so it is done in this patch.

It is important to make note of the following: 1. The matrixdev->guestslock is acquired at the start of both callback functions. This ensures that matrixmdev will not be removed via the vfioapmdevremove function because it too takes matrixdevguestslock before removing the object; so, matrixmdev will be available for the duration of the callback functions.

2. The matrixdev->mdevslock mutex must be taken in order to access fields within the matrixmdev structure

3. matrixmdev->kvm->lock mutex must be taken before the matrixdev->mdevslock to prevent a lockdep splat.

4: The kvm->lock must be held while plugging the guest's AP configuration into its SIE state description via the vfioapmdevupdateguestapcb function.

5. The vfioapmdevupdateguestapcb checks matrixmdev->kvm to verify it is not NULL before doing the hot plug of the guest's AP configuration.

Affected Software

1 affected component
Linux Linux kernel

Event History

Sep 16, 2026
CVE Published
via MITRE·10:32 AM
Data Sourced
via MITRE·10:32 AM
Description

Frequently Asked Questions

1

When can the NULL dereference occur?

It can occur during AP bus scanning after a host AP configuration change, in the vfio_ap driver's configuration-change or scan-complete callback paths. Those paths take matrix_mdev->kvm->lock without first confirming that matrix_mdev->kvm is non-NULL.

2

What environment is implicated by the affected code path?

The issue is in the Linux kernel's s390 vfio-ap driver and involves mediated matrix devices associated with KVM. The supplied information does not identify affected kernel versions or state whether a default configuration reaches this path.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203