From patchwork Thu Jun 18 22:46:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ralf Baechle X-Patchwork-Id: 486521 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 0487D1401F0 for ; Fri, 19 Jun 2015 08:47:19 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751955AbbFRWrF (ORCPT ); Thu, 18 Jun 2015 18:47:05 -0400 Received: from eddie.linux-mips.org ([148.251.95.138]:57619 "EHLO cvs.linux-mips.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750997AbbFRWrD (ORCPT ); Thu, 18 Jun 2015 18:47:03 -0400 Received: from localhost.localdomain ([127.0.0.1]:51883 "EHLO linux-mips.org" rhost-flags-OK-OK-OK-FAIL) by eddie.linux-mips.org with ESMTP id S27008955AbbFRWrAghFiD (ORCPT + 2 others); Fri, 19 Jun 2015 00:47:00 +0200 Received: from scotty.linux-mips.net (localhost.localdomain [127.0.0.1]) by scotty.linux-mips.net (8.15.1/8.14.8) with ESMTP id t5IMkwtX019703; Fri, 19 Jun 2015 00:46:58 +0200 Received: (from ralf@localhost) by scotty.linux-mips.net (8.15.1/8.15.1/Submit) id t5IMkrw7019702; Fri, 19 Jun 2015 00:46:53 +0200 Date: Fri, 19 Jun 2015 00:46:53 +0200 From: Ralf Baechle To: "David S. Miller" , netdev@vger.kernel.org, linux-hams@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH] NET: ROSE: Don't dereference NULL neighbour pointer. Message-ID: <20150618224652.GB17494@linux-mips.org> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 Cc: stable@vger.kernel.org #2.6.11+ --- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c index 8ae6030..dd304bc 100644 --- a/net/rose/af_rose.c +++ b/net/rose/af_rose.c @@ -192,7 +192,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; } }