Skip to content

Commit

Permalink
virtio_console: Free buffer if splice fails
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Sjur Brændeland authored and Rusty Russell committed Dec 18, 2012
1 parent de929b0 commit fe52953
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/char/virtio_console.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit fe52953

Please sign in to comment.