]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - net/rose/rose_route.c
net: rose: fix a possible stack overflow
[mirror_ubuntu-bionic-kernel.git] / net / rose / rose_route.c
index 8ca3124df83fdae0af653a1dafd7737a9893100e..05c75b5120584c6363197bddc67cf2b416042e16 100644 (file)
@@ -850,6 +850,7 @@ void rose_link_device_down(struct net_device *dev)
 
 /*
  *     Route a frame to an appropriate AX.25 connection.
+ *     A NULL ax25_cb indicates an internally generated frame.
  */
 int rose_route_frame(struct sk_buff *skb, ax25_cb *ax25)
 {
@@ -867,6 +868,10 @@ int rose_route_frame(struct sk_buff *skb, ax25_cb *ax25)
 
        if (skb->len < ROSE_MIN_LEN)
                return res;
+
+       if (!ax25)
+               return rose_loopback_queue(skb, NULL);
+
        frametype = skb->data[2];
        lci = ((skb->data[0] << 8) & 0xF00) + ((skb->data[1] << 0) & 0x0FF);
        if (frametype == ROSE_CALL_REQUEST &&