s390/vfio-ap: Fix memory allocation for mdev_types array
Subsystems (3)
Jason J. Herne
maintainerPATCH 1/1 s390/vfio-ap: Fix memory allocation for mdev_types array
The vfio-ap crypto driver fails to allocate memory for an array of pointers used to pass supported mdev types to mdev_register_parent().
Since we only support a single mdev type, the fix is to allocate a single entry in the ap_matrix_dev->mdev_types array.
--- drivers/s390/crypto/vfio_ap_private.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/s390/crypto/vfio_ap_private.h +1 -1
@@ -52,7 +52,7 @@ struct ap_matrix_dev {struct mutex guests_lock;/* serializes access to each KVM guest */ struct mdev_parent parent;struct mdev_type mdev_type; -struct mdev_type *mdev_types[]; +struct mdev_type *mdev_types[1 ]; };extern struct ap_matrix_dev *matrix_dev;
Signature · 1 line
2.37.3
Quoted 7 lines · Jason J. Herne
The vfio-ap crypto driver fails to allocate memory for an array of pointers used to pass supported mdev types to
mdev_register_parent().Since we only support a single mdev type, the fix is to allocate a single entry in the
ap_matrix_dev->mdev_typesarray.Fixes 63e685747784 ("s390: vfio-ap: base implementation of VFIO AP device driver")
I think you want
Where *mdev_types[] was introduced. The fix you propose is the same way Christoph (added to CC) handled vfio-ccw, LGTM.
Quoted 21 lines
Cc Tony Krowiak <[email protected]>Reported-by Christian Borntraeger <[email protected]>Signed-off-by Jason J. Herne <[email protected]>--- drivers/s390/crypto/vfio_ap_private.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/s390/crypto/vfio_ap_private.h +1
-1@@ -52,7 +52,7 @@ struct ap_matrix_dev {struct mutex guests_lock;/* serializes access to each KVM guest */ struct mdev_parent parent;struct mdev_type mdev_type; -struct mdev_type *mdev_types[]; +struct mdev_type *mdev_types[1 ]; };extern struct ap_matrix_dev *matrix_dev;
Christian Borntraeger
reviewerAm 21.10.22 um 16:59 schrieb Jason J. Herne:
Quoted 20 lines
The vfio-ap crypto driver fails to allocate memory for an array of pointers used to pass supported mdev types to
mdev_register_parent().Since we only support a single mdev type, the fix is to allocate a single entry in the
ap_matrix_dev->mdev_typesarray.Fixes 63e685747784 ("s390: vfio-ap: base implementation of VFIO AP device driver")Cc Tony Krowiak <[email protected]>Reported-by Christian Borntraeger <[email protected]>Signed-off-by Jason J. Herne <[email protected]>--- drivers/s390/crypto/vfio_ap_private.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/s390/crypto/vfio_ap_private.h +0
-0
drivers/s390/crypto/vfio_ap_private.h struct ap_matrix_dev { · line 58
Quoted 8 lines
drivers/s390/crypto/vfio_ap_private.h +1
-1@@ -52,7 +52,7 @@ struct ap_matrix_dev {struct mutex guests_lock;/* serializes access to each KVM guest */ struct mdev_parent parent;struct mdev_type mdev_type; -struct mdev_type *mdev_types[]; +struct mdev_type *mdev_types[1 ]; };extern struct ap_matrix_dev *matrix_dev;
Thanks, will go via s390-fixes.
Alex, FYI.