]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
KVM: nSVM: Replace kzalloc() + copy_from_user() with memdup_user()
authorThorsten Blum <thorsten.blum@linux.dev>
Wed, 3 Sep 2025 00:29:50 +0000 (02:29 +0200)
committerSean Christopherson <seanjc@google.com>
Thu, 11 Sep 2025 16:03:14 +0000 (09:03 -0700)
commitfc55b4cda00aff08ea6dfe86411efa13bdb728c5
tree8ca56343fe3575413731a9f96277927cfabf9878
parent2f5f8fb9de095e9b255a89269827f1761c714690
KVM: nSVM: Replace kzalloc() + copy_from_user() with memdup_user()

Replace kzalloc() followed by copy_from_user() with memdup_user() to
improve and simplify svm_set_nested_state().

Return early if an error occurs instead of trying to allocate memory for
'save' when memory allocation for 'ctl' already failed.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Link: https://lore.kernel.org/r/20250903002951.118912-1-thorsten.blum@linux.dev
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/svm/nested.c