summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2015-06-19 01:46:53 +0300
committerZefan Li <lizefan@huawei.com>2015-09-18 04:20:47 +0300
commitbee5f3e274eef419680b1349540a9d8032c99289 (patch)
tree8801d9617c76a0cc5cc24fb0e4f79e1914d917df
parentbd3fa7572a3793590ac024de5800b98cf2a1acfc (diff)
downloadlinux-bee5f3e274eef419680b1349540a9d8032c99289.tar.xz
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 <ralf@linux-mips.org> Tested-by: Bernard Pidoux <f6bvp@free.fr> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Zefan Li <lizefan@huawei.com>
-rw-r--r--net/rose/af_rose.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c
index bde7d69b440d..e89563655030 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;
}
}