vduse: moving kvfree into caller
authorGuanjun <guanjun@linux.alibaba.com>
Mon, 6 Dec 2021 08:48:18 +0000 (16:48 +0800)
committerMichael S. Tsirkin <mst@redhat.com>
Fri, 14 Jan 2022 23:50:52 +0000 (18:50 -0500)
This free action should be moved into caller 'vduse_ioctl' in
concert with the allocation.

No functional change.

Signed-off-by: Guanjun <guanjun@linux.alibaba.com>
Link: https://lore.kernel.org/r/1638780498-55571-1-git-send-email-guanjun@linux.alibaba.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
drivers/vdpa/vdpa_user/vduse_dev.c

index eddcb64..f3cc7dd 100644 (file)
@@ -1357,7 +1357,6 @@ err_domain:
 err_str:
        vduse_dev_destroy(dev);
 err:
-       kvfree(config_buf);
        return ret;
 }
 
@@ -1408,6 +1407,8 @@ static long vduse_ioctl(struct file *file, unsigned int cmd,
                }
                config.name[VDUSE_NAME_MAX - 1] = '\0';
                ret = vduse_create_dev(&config, buf, control->api_version);
+               if (ret)
+                       kvfree(buf);
                break;
        }
        case VDUSE_DESTROY_DEV: {