Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752177Ab2JOH6A (ORCPT ); Mon, 15 Oct 2012 03:58:00 -0400 Received: from mail-lb0-f174.google.com ([209.85.217.174]:62296 "EHLO mail-lb0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751716Ab2JOH55 (ORCPT ); Mon, 15 Oct 2012 03:57:57 -0400 From: sjur.brandeland@stericsson.com To: Amit Shah , Rusty Russell Cc: "Michael S. Tsirkin" , Linus Walleij , Masami Hiramatsu , Ohad Ben-Cohen , linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, sjurbren@gmail.com, =?UTF-8?q?Sjur=20Br=C3=A6ndeland?= Subject: [PATCHv7 1/4] virtio_console: Free buffer if splice fails Date: Mon, 15 Oct 2012 09:57:33 +0200 Message-Id: <1350287856-5284-2-git-send-email-sjur.brandeland@stericsson.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1350287856-5284-1-git-send-email-sjur.brandeland@stericsson.com> References: <1350287856-5284-1-git-send-email-sjur.brandeland@stericsson.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 970 Lines: 31 From: Sjur Brændeland Free the allocated scatter list if send_pages fails in function port_splice_write. Signed-off-by: Sjur Brændeland --- 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/