diff options
author | Eric Dumazet <edumazet@google.com> | 2019-06-24 11:38:20 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-06-24 16:57:59 +0200 |
commit | 55655e3d1197fff16a7a05088fb0e5eba50eac55 (patch) | |
tree | 38288bcb9ab2cfdfb597a9872e82ba3bf9dddb44 /net/packet/af_packet.c | |
parent | net/tls: fix page double free on TX cleanup (diff) | |
download | linux-55655e3d1197fff16a7a05088fb0e5eba50eac55.tar.xz linux-55655e3d1197fff16a7a05088fb0e5eba50eac55.zip |
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 <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>
Diffstat (limited to 'net/packet/af_packet.c')
-rw-r--r-- | net/packet/af_packet.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index a29d66da7394..0b4cf94f0233 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c @@ -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: |