summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2019-06-24 02:38:20 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-07-03 13:14:47 +0200
commit05dceb60e5dd7a40fd9b6c565a62ce272ed4e6a2 (patch)
treeac1469f89236ee5e544ba1977e5315674a3eae75 /net
parent7c92f3efbad04a8677ad75ddab9638c8006617c5 (diff)
downloadlinux-stable-05dceb60e5dd7a40fd9b6c565a62ce272ed4e6a2.tar.gz
linux-stable-05dceb60e5dd7a40fd9b6c565a62ce272ed4e6a2.tar.bz2
linux-stable-05dceb60e5dd7a40fd9b6c565a62ce272ed4e6a2.zip
net/packet: fix memory leak in packet_set_ring()
[ Upstream commit 55655e3d1197fff16a7a05088fb0e5eba50eac55 ] 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-rw-r--r--net/packet/af_packet.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 5ad6111657f8..93b5a4200585 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -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: