From: Sjur Brændeland Date: Mon, 15 Oct 2012 07:57:33 +0000 (+0200) Subject: virtio_console: Free buffer if splice fails X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=fe5295374ec9ac56ba3b619c5c1792b3fd66d859;p=linux-beck.git 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 Signed-off-by: Rusty Russell --- 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; }