diff options
author | Linux Build Service Account <lnxbuild@localhost> | 2018-06-15 10:28:01 -0700 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2018-06-15 10:28:00 -0700 |
commit | 9963b625f3a719e66e6d955eb0af09c703bb58b7 (patch) | |
tree | 2847a23b1ffde513dde98bf9aa957f59f995729f /net | |
parent | 53c73b71906f5ce07686603d9ff7fb20a06d296e (diff) | |
parent | e51372325864feeed93cabaf483a5ae689382071 (diff) |
Merge "packet: fix race condition in packet_set_ring"
Diffstat (limited to 'net')
-rw-r--r-- | net/packet/af_packet.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 392d4e2c0a24..e9a2ff863d9b 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c @@ -4156,6 +4156,7 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u, /* Added to avoid minimal code churn */ struct tpacket_req *req = &req_u->req; + lock_sock(sk); /* Opening a Tx-ring is NOT supported in TPACKET_V3 */ if (!closing && tx_ring && (po->tp_version > TPACKET_V2)) { WARN(1, "Tx-ring is not supported.\n"); @@ -4291,6 +4292,7 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u, if (pg_vec) free_pg_vec(pg_vec, order, req->tp_block_nr); out: + release_sock(sk); return err; } |