OSDN Git Service
(root)
/
sagit-ice-cold
/
kernel_xiaomi_msm8998.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
|
history
diff --git
a/drivers/vhost/vhost.c
b/drivers/vhost/vhost.c
index
e366202
..
da21ae9
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();