]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
NET: ROSE: Don't dereference NULL neighbour pointer.
authorRalf Baechle <ralf@linux-mips.org>
Thu, 18 Jun 2015 22:46:53 +0000 (00:46 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 18 Sep 2015 11:52:13 +0000 (13:52 +0200)
commit d496f7842aada20c61e6044b3395383fa972872c upstream.

A ROSE socket doesn't necessarily always have a neighbour pointer so check
if the neighbour pointer is valid before dereferencing it.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Tested-by: Bernard Pidoux <f6bvp@free.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
(cherry picked from commit 8bbe4f448c01949084ef404eded3622086f052a6)

Signed-off-by: Willy Tarreau <w@1wt.eu>
net/rose/af_rose.c

index 7119ea634908094a639aee6c9c5aac3a8bb579ab..4457e9a04acaad7b6a7b18781f992b923c80da92 100644 (file)
@@ -194,7 +194,8 @@ static void rose_kill_by_device(struct net_device *dev)
 
                if (rose->device == dev) {
                        rose_disconnect(s, ENETUNREACH, ROSE_OUT_OF_ORDER, 0);
-                       rose->neighbour->use--;
+                       if (rose->neighbour)
+                               rose->neighbour->use--;
                        rose->device = NULL;
                }
        }