pds_vdpa: clear config callback when status goes to 0
authorShannon Nelson <shannon.nelson@amd.com>
Fri, 10 Nov 2023 22:18:01 +0000 (14:18 -0800)
committerMichael S. Tsirkin <mst@redhat.com>
Fri, 1 Dec 2023 14:55:01 +0000 (09:55 -0500)
If the client driver is setting status to 0, something is
getting shutdown and possibly removed.  Make sure we clear
the config_cb so that it doesn't end up crashing when
trying to call a bogus callback.

Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>
Message-Id: <20231110221802.46841-3-shannon.nelson@amd.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
drivers/vdpa/pds/vdpa_dev.c

index 52b2449182ad71976cc68cb58aa8b52a77ff5cea..9fc89c82d1f015c69e6cd8c2656c05932db59c08 100644 (file)
@@ -461,8 +461,10 @@ static void pds_vdpa_set_status(struct vdpa_device *vdpa_dev, u8 status)
 
        pds_vdpa_cmd_set_status(pdsv, status);
 
-       /* Note: still working with FW on the need for this reset cmd */
        if (status == 0) {
+               struct vdpa_callback null_cb = { };
+
+               pds_vdpa_set_config_cb(vdpa_dev, &null_cb);
                pds_vdpa_cmd_reset(pdsv);
 
                for (i = 0; i < pdsv->num_vqs; i++) {