From patchwork Mon Aug 6 13:55:29 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasiliy Kulikov X-Patchwork-Id: 175362 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 AC9FC2C0086 for ; Mon, 6 Aug 2012 23:55:56 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756106Ab2HFNzi (ORCPT ); Mon, 6 Aug 2012 09:55:38 -0400 Received: from mail-lb0-f174.google.com ([209.85.217.174]:37562 "EHLO mail-lb0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754867Ab2HFNzh (ORCPT ); Mon, 6 Aug 2012 09:55:37 -0400 Received: by lbbgm6 with SMTP id gm6so2823922lbb.19 for ; Mon, 06 Aug 2012 06:55:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=65QmcSrWtJCa6taasvG/dPXqdjrYi1wHzOek7YkZUd4=; b=nuibf5Jkv3qkTx3mZsgwCT1negn01PcVpQGc/LG5C5Marld3oTdjkjF2hbiDzm48YW MXP9d4no/LWIUnf18ihSw/d2VG3vNcAkXjmzvsVB3aMQ7AYqtU63DV8bQwIzXZ8psLfn ydtShJEHSdFMaZVhuhej5aYjPVyg3VUZ/pqiMYetsQC7UvhRvmAZcUIcTVnD0nJFla5W lio6+jlxdSGwFoVKaYlRQpWcd+d9BMxyXRP3O0hDVAetSZxEGdRUdAMPi693cm7lWgrl pE3xVt5PziMdOkOQc1MctekzgquCB6iBpfrek89RIlt+/imW49hjK5o4JclTXuoZKtgc Zg6A== Received: by 10.152.104.44 with SMTP id gb12mr10853594lab.29.1344261335456; Mon, 06 Aug 2012 06:55:35 -0700 (PDT) Received: from localhost (ppp83-237-19-106.pppoe.mtu-net.ru. [83.237.19.106]) by mx.google.com with ESMTPS id o5sm3763069lbg.5.2012.08.06.06.55.33 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 06 Aug 2012 06:55:34 -0700 (PDT) Date: Mon, 6 Aug 2012 17:55:29 +0400 From: Vasily Kulikov To: "David S. Miller" Cc: Alexey Kuznetsov , James Morris , Hideaki YOSHIFUJI , Patrick McHardy , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] ip: fix error handling in ip_finish_output2() Message-ID: <20120806135529.GA30699@albatros> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org __neigh_create() returns either a pointer to struct neighbour or PTR_ERR(). But the caller expects it to return either a pointer or NULL. Replace the NULL check with IS_ERR() check. The bug was introduced in a263b3093641fb1ec377582c90986a7fd0625184. Signed-off-by: Vasily Kulikov --- Compile tested only. net/ipv4/ip_output.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index ba39a52..76dde25 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c @@ -197,7 +197,7 @@ static inline int ip_finish_output2(struct sk_buff *skb) neigh = __ipv4_neigh_lookup_noref(dev, nexthop); if (unlikely(!neigh)) neigh = __neigh_create(&arp_tbl, &nexthop, dev, false); - if (neigh) { + if (!IS_ERR(neigh)) { int res = dst_neigh_output(dst, neigh, skb); rcu_read_unlock_bh();