diff --git a/net/ipv6/calipso.c b/net/ipv6/calipso.c index 1578ed9e97d892eab85514a21ceff9a4aa79b22d..6d5630f194dc0caf3297c516e5ed034f64062c5f 100644 --- a/net/ipv6/calipso.c +++ b/net/ipv6/calipso.c @@ -1195,6 +1195,10 @@ static int calipso_req_setattr(struct request_sock *req, struct ipv6_opt_hdr *old, *new; struct sock *sk = sk_to_full_sk(req_to_sk(req)); + /* sk is NULL for SYN+ACK w/ SYN Cookie */ + if (!sk) + return -ENOMEM; + if (req_inet->ipv6_opt && req_inet->ipv6_opt->hopopt) old = req_inet->ipv6_opt->hopopt; else @@ -1235,6 +1239,10 @@ static void calipso_req_delattr(struct request_sock *req) struct ipv6_txoptions *txopts; struct sock *sk = sk_to_full_sk(req_to_sk(req)); + /* sk is NULL for SYN+ACK w/ SYN Cookie */ + if (!sk) + return; + if (!req_inet->ipv6_opt || !req_inet->ipv6_opt->hopopt) return;