projects
/
GitHub
/
LineageOS
/
android_kernel_motorola_exynos9610.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d3553a5
)
vhost: fix the memory leak which will happen when memory_access_ok fails
author
Takuya Yoshikawa
<yoshikawa.takuya@oss.ntt.co.jp>
Thu, 27 May 2010 10:03:56 +0000
(19:03 +0900)
committer
Michael S. Tsirkin
<mst@redhat.com>
Thu, 27 May 2010 10:55:17 +0000
(13:55 +0300)
We need to free newmem when vhost_set_memory() fails to complete.
Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
drivers/vhost/vhost.c
patch
|
blob
|
blame
|
history
diff --git
a/drivers/vhost/vhost.c
b/drivers/vhost/vhost.c
index e36620272715e061f5e7f5ff502a8d527b34769c..da21ae9518260f8f66b75498ec04141a3ef0cf60 100644
(file)
--- a/
drivers/vhost/vhost.c
+++ b/
drivers/vhost/vhost.c
@@
-337,8
+337,10
@@
static long vhost_set_memory(struct vhost_dev *d, struct vhost_memory __user *m)
return -EFAULT;
}
- if (!memory_access_ok(d, newmem, vhost_has_feature(d, VHOST_F_LOG_ALL)))
+ if (!memory_access_ok(d, newmem, vhost_has_feature(d, VHOST_F_LOG_ALL))) {
+ kfree(newmem);
return -EFAULT;
+ }
oldmem = d->memory;
rcu_assign_pointer(d->memory, newmem);
synchronize_rcu();