From: Ralf Baechle Date: Thu, 18 Jun 2015 22:46:53 +0000 (+0200) Subject: NET: ROSE: Don't dereference NULL neighbour pointer. X-Git-Tag: v2.6.32.68~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7b61d03d0469e6771280da41a638bfe9c7169129;p=thirdparty%2Fkernel%2Fstable.git NET: ROSE: Don't dereference NULL neighbour pointer. 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 Tested-by: Bernard Pidoux Signed-off-by: David S. Miller Signed-off-by: Ben Hutchings (cherry picked from commit 8bbe4f448c01949084ef404eded3622086f052a6) Signed-off-by: Willy Tarreau --- diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c index 7119ea6349080..4457e9a04acaa 100644 --- a/net/rose/af_rose.c +++ b/net/rose/af_rose.c @@ -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; } }