diff options
| author | Srinivasa Rao Kuppala <srkupp@codeaurora.org> | 2016-11-30 14:55:36 -0800 |
|---|---|---|
| committer | Srinivasa Rao Kuppala <srkupp@codeaurora.org> | 2018-06-13 11:10:43 +0530 |
| commit | e51372325864feeed93cabaf483a5ae689382071 (patch) | |
| tree | 04059b39baf7d1bf6ce14f6af479e1ad07a00b5a | |
| parent | 5cb5749cd7fc25ad09fce7ce083aeb38e2a42fe5 (diff) | |
packet: fix race condition in packet_set_ring
commit 5a01eaf19858 ("packet: fix race condition
in packet_set_ring") was incorrectly resolved.
Add the missing lock_sock(sk) and release_sock(sk) calls.
Change-Id: I6565bf3e3c6a15d6f1b93cab0536424dbacb187b
Signed-off-by: Srinivasa Rao Kuppala <srkupp@codeaurora.org>
| -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 f165514a4db5..3236d97fb784 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c @@ -4154,6 +4154,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"); @@ -4289,6 +4290,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; } |
