diff options
| author | Jani Nikula <jani.nikula@intel.com> | 2017-09-04 21:40:34 +0300 |
|---|---|---|
| committer | Jani Nikula <jani.nikula@intel.com> | 2017-09-04 21:40:34 +0300 |
| commit | d149d6ae17197ce23e2cd6bc5fcdacf7b593e55e (patch) | |
| tree | 2fb8d66199080f6d7b41690f6e8616ccd79a1943 /net/packet/af_packet.c | |
| parent | afe722bee4bf8afc88c6ff7d6f781515d9428595 (diff) | |
| parent | 7846b12fe0b5feab5446d892f41b5140c1419109 (diff) | |
Merge drm-upstream/drm-next into drm-intel-next-queued
Catch up with upstream while it's easy.
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Diffstat (limited to 'net/packet/af_packet.c')
| -rw-r--r-- | net/packet/af_packet.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 008bb34ee324..008a45ca3112 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c @@ -3700,14 +3700,19 @@ packet_setsockopt(struct socket *sock, int level, int optname, char __user *optv if (optlen != sizeof(val)) return -EINVAL; - if (po->rx_ring.pg_vec || po->tx_ring.pg_vec) - return -EBUSY; if (copy_from_user(&val, optval, sizeof(val))) return -EFAULT; if (val > INT_MAX) return -EINVAL; - po->tp_reserve = val; - return 0; + lock_sock(sk); + if (po->rx_ring.pg_vec || po->tx_ring.pg_vec) { + ret = -EBUSY; + } else { + po->tp_reserve = val; + ret = 0; + } + release_sock(sk); + return ret; } case PACKET_LOSS: { @@ -4329,7 +4334,7 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u, register_prot_hook(sk); } spin_unlock(&po->bind_lock); - if (closing && (po->tp_version > TPACKET_V2)) { + if (pg_vec && (po->tp_version > TPACKET_V2)) { /* Because we don't support block-based V3 on tx-ring */ if (!tx_ring) prb_shutdown_retire_blk_timer(po, rb_queue); |
