summaryrefslogtreecommitdiff
path: root/net/ipv4/tcp.c
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2018-05-10 01:25:18 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2018-05-10 01:25:18 -0700
commit6e5dae3ae1af25ac48b005ccfb2cf7e033d312ce (patch)
treeae877abfc5e691423dd5dbafab2a2eda81760e58 /net/ipv4/tcp.c
parentd7521d9bb9408dd4225b9838e23a80ecc41f80fa (diff)
parent028ce831e8f14cc94f14929f1a91d198ea2d9b93 (diff)
Merge "Merge android-4.4.131 (d5d6526) into msm-4.4"
Diffstat (limited to 'net/ipv4/tcp.c')
-rw-r--r--net/ipv4/tcp.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 1c04dad774a7..c381ef51aa69 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2598,8 +2598,10 @@ static int do_tcp_setsockopt(struct sock *sk, int level,
#ifdef CONFIG_TCP_MD5SIG
case TCP_MD5SIG:
- /* Read the IP->Key mappings from userspace */
- err = tp->af_specific->md5_parse(sk, optval, optlen);
+ if ((1 << sk->sk_state) & (TCPF_CLOSE | TCPF_LISTEN))
+ err = tp->af_specific->md5_parse(sk, optval, optlen);
+ else
+ err = -EINVAL;
break;
#endif
case TCP_USER_TIMEOUT: