From: gchen@itskywalker.com
To: pbonzini@redhat.com
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
Chen Gang <gchen@itskywalker.com>
Subject: [PATCH] KVM: return the error code from kvm_arch_create_vm_debugfs when it fails
Date: Thu, 23 Dec 2021 09:34:08 +0800 [thread overview]
Message-ID: <20211223013408.153595-1-gchen@itskywalker.com> (raw)
From: Chen Gang <gchen@itskywalker.com>
At present, kvm_arch_create_vm_debugfs is a new interface for arch, and
it assumes return an none-zero error code, so the caller need check it
and return it to the user mode.
Signed-off-by: Chen Gang <gchen@itskywalker.com>
---
virt/kvm/kvm_main.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index d8a1a17bcb7e..b2de428bd4c7 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -1015,7 +1015,7 @@ static int kvm_create_vm_debugfs(struct kvm *kvm, int fd)
ret = kvm_arch_create_vm_debugfs(kvm);
if (ret) {
kvm_destroy_vm_debugfs(kvm);
- return i;
+ return ret;
}
return 0;
@@ -4727,7 +4727,7 @@ EXPORT_SYMBOL_GPL(file_is_kvm);
static int kvm_dev_ioctl_create_vm(unsigned long type)
{
- int r;
+ int r, ret;
struct kvm *kvm;
struct file *file;
@@ -4759,10 +4759,11 @@ static int kvm_dev_ioctl_create_vm(unsigned long type)
* cases it will be called by the final fput(file) and will take
* care of doing kvm_put_kvm(kvm).
*/
- if (kvm_create_vm_debugfs(kvm, r) < 0) {
+ ret = kvm_create_vm_debugfs(kvm, r);
+ if (ret) {
put_unused_fd(r);
fput(file);
- return -ENOMEM;
+ return ret;
}
kvm_uevent_notify_change(KVM_EVENT_CREATE_VM, kvm);
--
2.24.0.308.g228f53135a
next reply other threads:[~2021-12-23 1:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-23 1:34 gchen [this message]
2021-12-25 5:03 ` Chen Gang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211223013408.153595-1-gchen@itskywalker.com \
--to=gchen@itskywalker.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®