key = tcp_md5_do_lookup(sk, addr, AF_INET);
        } else if (hash_location) {
                const union tcp_md5_addr *addr;
+               int sdif = tcp_v4_sdif(skb);
+               int dif = inet_iif(skb);
 
                /*
                 * active side is lost. Try to find listening socket through
                sk1 = __inet_lookup_listener(net, &tcp_hashinfo, NULL, 0,
                                             ip_hdr(skb)->saddr,
                                             th->source, ip_hdr(skb)->daddr,
-                                            ntohs(th->source), inet_iif(skb),
-                                            tcp_v4_sdif(skb));
+                                            ntohs(th->source), dif, sdif);
                /* don't send rst if it can't find key */
                if (!sk1)
                        goto out;
 
 /* Called with rcu_read_lock() */
 static bool tcp_v4_inbound_md5_hash(const struct sock *sk,
-                                   const struct sk_buff *skb)
+                                   const struct sk_buff *skb,
+                                   int dif, int sdif)
 {
 #ifdef CONFIG_TCP_MD5SIG
        /*
        struct net *net = dev_net(skb->dev);
        struct sk_buff *skb_to_free;
        int sdif = inet_sdif(skb);
+       int dif = inet_iif(skb);
        const struct iphdr *iph;
        const struct tcphdr *th;
        bool refcounted;
                struct sock *nsk;
 
                sk = req->rsk_listener;
-               if (unlikely(tcp_v4_inbound_md5_hash(sk, skb))) {
+               if (unlikely(tcp_v4_inbound_md5_hash(sk, skb, dif, sdif))) {
                        sk_drops_add(sk, skb);
                        reqsk_put(req);
                        goto discard_it;
        if (!xfrm4_policy_check(sk, XFRM_POLICY_IN, skb))
                goto discard_and_relse;
 
-       if (tcp_v4_inbound_md5_hash(sk, skb))
+       if (tcp_v4_inbound_md5_hash(sk, skb, dif, sdif))
                goto discard_and_relse;
 
        nf_reset_ct(skb);