--- a/drivers/vhost/vdpa.c +++ b/drivers/vhost/vdpa.c @@ -335,8 +335,12 @@ static long vhost_vdpa_set_config_call(s if (!IS_ERR_OR_NULL(ctx)) eventfd_ctx_put(ctx); - if (IS_ERR(v->config_ctx)) - return PTR_ERR(v->config_ctx); + if (IS_ERR(v->config_ctx)) { + long ret = PTR_ERR(v->config_ctx); + + v->config_ctx = NULL; + return ret; + } v->vdpa->config->set_config_cb(v->vdpa, &cb);