diff options
author | Sjur Brændeland <sjur.brandeland@stericsson.com> | 2012-10-15 11:57:33 +0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2012-12-18 08:50:39 +0400 |
commit | fe5295374ec9ac56ba3b619c5c1792b3fd66d859 (patch) | |
tree | 63fc2e035669b7b44b3babc452b48ae49769787d /drivers/char | |
parent | de929b04450f2ec984c2febb1249d0e0f993d0a2 (diff) | |
download | linux-fe5295374ec9ac56ba3b619c5c1792b3fd66d859.tar.xz |
virtio_console: Free buffer if splice fails
Free the allocated scatter list if send_pages fails in function
port_splice_write.
Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/virtio_console.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 6a369942da84..09d193dbb233 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c @@ -881,6 +881,8 @@ static ssize_t port_fops_splice_write(struct pipe_inode_info *pipe, if (likely(ret > 0)) ret = send_pages(port, sgl.sg, sgl.n, sgl.len, true); + if (unlikely(ret <= 0)) + kfree(sgl.sg); return ret; } |