net/packet: fix memory leak in packet_set_ring()
Subsystems (3)
PATCH 1/1 net/packet: fix memory leak in packet_set_ring()
syzbot found we can leak memory in packet_set_ring(), if user application provides buggy parameters.
Fixes 7f953ab2ba46 ("af_packet: TX_RING support for TPACKET_V3")
Signed-off-by Eric Dumazet <[email protected]>
Cc Sowmini Varadhan <[email protected]>
Reported-by syzbot <[email protected]>
--- net/packet/af_packet.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/packet/af_packet.c +2 -1
@@ -4314,7 +4314,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 ;
@@ -4378,6 +4378,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:
Signature · 1 line
2.22.0.410.gd8fdbe21b5-goog
David Miller
maintainerFrom: Eric Dumazet <[email protected]>
Date: Mon, 24 Jun 2019 02:38:20 -0700
Quoted 7 lines
syzbot found we can leak memory in
packet_set_ring(), if user application provides buggy parameters.Fixes 7f953ab2ba46 ("af_packet: TX_RING support for TPACKET_V3")Signed-off-by Eric Dumazet <[email protected]>Cc Sowmini Varadhan <[email protected]>Reported-by syzbot <[email protected]>
Applied and queued up for -stable, thanks Eric.