Prevent from passing NULL pointer to tcp_v4_md5_do_lookup()
Subsystems (3)
PATCH 2/3 Prevent from passing NULL pointer to tcp_v4_md5_do_lookup()
If skb->sk == NULL when calling tcp_v4_md5_do_lookup(), kernel will panic. Don't let this thing happen.
Signed-off-by Gui Jianfeng <[email protected]>
--- net/ipv4/tcp_ipv4.c | 4 ++-- net/ipv4/tcp_minisocks.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
net/ipv4/tcp_ipv4.c +2 -2
@@ -687,14 +687,14 @@ static void tcp_v4_timewait_ack(struct sock *sk, struct sk_buff *skb)inet_twsk_put (tw); } -static void tcp_v4_reqsk_send_ack (struct sk_buff *skb, +static void tcp_v4_reqsk_send_ack (struct sock *sk,struct sk_buff *skb,struct request_sock *req) {tcp_v4_send_ack (skb,tcp_rsk (req)->snt_isn +1 ,tcp_rsk (req)->rcv_isn +1 , req->rcv_wnd, req->ts_recent,0 , -tcp_v4_md5_do_lookup (skb->sk,ip_hdr (skb)->daddr)); +tcp_v4_md5_do_lookup (sk,ip_hdr (skb)->daddr)); }/*
net/ipv4/tcp_minisocks.c +1 -1
@@ -609,7 +609,7 @@ struct sock *tcp_check_req(struct sock *sk,struct sk_buff *skb, tcp_rsk(req)->rcv_isn + 1, tcp_rsk(req)->rcv_isn + 1 + req->rcv_wnd)) {/* Out of window: send ACK and drop. */ if (!(flg &TCP_FLAG_RST )) - req->rsk_ops->send_ack (skb, req); + req->rsk_ops->send_ack (sk, skb, req);if (paws_reject)NET_INC_STATS_BH (sock_net (sk),LINUX_MIB_PAWSESTABREJECTED );return NULL ;
Signature · 1 line
1.5.3