[RAMEN9610-12695][COMMON][MODAP-20423] fix L2TP cfi_check_fail issue
authorJiyoung Jeong <ji_0.jeong@samsung.com>
Thu, 28 Feb 2019 01:06:44 +0000 (10:06 +0900)
committerCosmin Tanislav <demonsingur@gmail.com>
Mon, 22 Apr 2024 17:23:19 +0000 (20:23 +0300)
Change-Id: I9b517321289235d60d44f6f814a7a6c96235836e
Signed-off-by: Jiyoung Jeong <ji_0.jeong@samsung.com>
drivers/net/ppp/pppolac.c

index 95cc6be54ad5a058be577398c918c9f7511df690..14cdf07294f4c2830bdb0b5d64def3bc566a52c4 100644 (file)
@@ -47,6 +47,8 @@
 #define PPP_ADDR       0xFF
 #define PPP_CTRL       0x03
 
+#define NET_RX_L2TP_CONTROL_MSG        2
+
 union unaligned {
        __u32 u32;
 } __attribute__((packed));
@@ -82,8 +84,12 @@ static int pppolac_recv_core(struct sock *sk_udp, struct sk_buff *skb)
                goto drop;
 
        /* Put it back if it is a control packet. */
-       if (skb->data[sizeof(struct udphdr)] & L2TP_CONTROL_BIT)
+       if (skb->data[sizeof(struct udphdr)] & L2TP_CONTROL_BIT) {
+               if (!opt->backlog_rcv)
+                       return NET_RX_L2TP_CONTROL_MSG;
+
                return opt->backlog_rcv(sk_udp, skb);
+       }
 
        /* Skip UDP header. */
        skb_pull(skb, sizeof(struct udphdr));
@@ -190,8 +196,13 @@ drop:
 
 static int pppolac_recv(struct sock *sk_udp, struct sk_buff *skb)
 {
+       int ret = 0;
+
        sock_hold(sk_udp);
-       sk_receive_skb(sk_udp, skb, 0);
+       ret = sk_receive_skb(sk_udp, skb, 0);
+       if (ret == NET_RX_L2TP_CONTROL_MSG)
+               return 1;
+
        return 0;
 }