summaryrefslogtreecommitdiffstats
path: root/drivers/char/virtio_console.c
diff options
context:
space:
mode:
authorSjur Brændeland <sjur.brandeland@stericsson.com>2012-10-15 09:57:33 +0200
committerRusty Russell <rusty@rustcorp.com.au>2012-12-18 15:20:39 +1030
commitfe5295374ec9ac56ba3b619c5c1792b3fd66d859 (patch)
tree63fc2e035669b7b44b3babc452b48ae49769787d /drivers/char/virtio_console.c
parentde929b04450f2ec984c2febb1249d0e0f993d0a2 (diff)
downloadop-kernel-dev-fe5295374ec9ac56ba3b619c5c1792b3fd66d859.zip
op-kernel-dev-fe5295374ec9ac56ba3b619c5c1792b3fd66d859.tar.gz
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/virtio_console.c')
-rw-r--r--drivers/char/virtio_console.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index 6a36994..09d193d 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;
}
OpenPOWER on IntegriCloud