[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1350287856-5284-2-git-send-email-sjur.brandeland@stericsson.com>
Date: Mon, 15 Oct 2012 09:57:33 +0200
From: sjur.brandeland@...ricsson.com
To: Amit Shah <amit.shah@...hat.com>,
Rusty Russell <rusty@...tcorp.com.au>
Cc: "Michael S. Tsirkin" <mst@...hat.com>,
Linus Walleij <linus.walleij@...aro.org>,
Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>,
Ohad Ben-Cohen <ohad@...ery.com>, linux-kernel@...r.kernel.org,
virtualization@...ts.linux-foundation.org, sjurbren@...il.com,
Sjur Brændeland <sjur.brandeland@...ricsson.com>
Subject: [PATCHv7 1/4] virtio_console: Free buffer if splice fails
From: Sjur Brændeland <sjur.brandeland@...ricsson.com>
Free the allocated scatter list if send_pages fails in function
port_splice_write.
Signed-off-by: Sjur Brændeland <sjur.brandeland@...ricsson.com>
---
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 8ab9c3d..c36b2f6 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -879,6 +879,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;
}
--
1.7.5.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists