]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
virtio_console: Free buffer if splice fails
authorSjur Brændeland <sjur.brandeland@stericsson.com>
Mon, 15 Oct 2012 07:57:33 +0000 (09:57 +0200)
committerRusty Russell <rusty@rustcorp.com.au>
Tue, 18 Dec 2012 04:50:39 +0000 (15:20 +1030)
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>
drivers/char/virtio_console.c

index 6a369942da84fa3ff913b486608e35af153a78db..09d193dbb23320570ecc1c8d47e8757c57cdca6e 100644 (file)
@@ -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;
 }