Commit 7a6691f1 authored by Eli Cohen's avatar Eli Cohen Committed by Michael S. Tsirkin

vdpa: Fix error logic in vdpa_nl_cmd_dev_get_doit

In vdpa_nl_cmd_dev_get_doit(), if the call to genlmsg_reply() fails we
must not call nlmsg_free() since this is done inside genlmsg_reply().

Fix it.

Fixes: bc0d90ee ("vdpa: Enable user to query vdpa device info")
Reviewed-by: default avatarSi-Wei Liu <si-wei.liu@oracle.com>
Acked-by: default avatarJason Wang <jasowang@redhat.com>
Signed-off-by: default avatarEli Cohen <elic@nvidia.com>
Message-Id: <20220518133804.1075129-2-elic@nvidia.com>
Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
parent 8ab2afa2
...@@ -756,14 +756,19 @@ static int vdpa_nl_cmd_dev_get_doit(struct sk_buff *skb, struct genl_info *info) ...@@ -756,14 +756,19 @@ static int vdpa_nl_cmd_dev_get_doit(struct sk_buff *skb, struct genl_info *info)
goto mdev_err; goto mdev_err;
} }
err = vdpa_dev_fill(vdev, msg, info->snd_portid, info->snd_seq, 0, info->extack); err = vdpa_dev_fill(vdev, msg, info->snd_portid, info->snd_seq, 0, info->extack);
if (!err) if (err)
err = genlmsg_reply(msg, info); goto mdev_err;
err = genlmsg_reply(msg, info);
put_device(dev);
mutex_unlock(&vdpa_dev_mutex);
return err;
mdev_err: mdev_err:
put_device(dev); put_device(dev);
err: err:
mutex_unlock(&vdpa_dev_mutex); mutex_unlock(&vdpa_dev_mutex);
if (err) nlmsg_free(msg);
nlmsg_free(msg);
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment