net/packet: fix memory leak in packet_set_ring()
[ Upstream commit55655e3d11] syzbot found we can leak memory in packet_set_ring(), if user application provides buggy parameters. Fixes:7f953ab2ba("af_packet: TX_RING support for TPACKET_V3") Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Sowmini Varadhan <sowmini.varadhan@oracle.com> Reported-by: syzbot <syzkaller@googlegroups.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
7c92f3efba
commit
05dceb60e5
1 changed files with 2 additions and 1 deletions
|
|
@ -4316,7 +4316,7 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u,
|
|||
req3->tp_sizeof_priv ||
|
||||
req3->tp_feature_req_word) {
|
||||
err = -EINVAL;
|
||||
goto out;
|
||||
goto out_free_pg_vec;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -4380,6 +4380,7 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u,
|
|||
prb_shutdown_retire_blk_timer(po, rb_queue);
|
||||
}
|
||||
|
||||
out_free_pg_vec:
|
||||
if (pg_vec)
|
||||
free_pg_vec(pg_vec, order, req->tp_block_nr);
|
||||
out:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue