From patchwork Mon Nov 30 22:14:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konstantin Khlebnikov X-Patchwork-Id: 550476 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 246051400CB for ; Tue, 1 Dec 2015 09:14:59 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=srI3VScE; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755253AbbK3WOy (ORCPT ); Mon, 30 Nov 2015 17:14:54 -0500 Received: from mail-lf0-f65.google.com ([209.85.215.65]:35323 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755214AbbK3WOx (ORCPT ); Mon, 30 Nov 2015 17:14:53 -0500 Received: by lffu14 with SMTP id u14so21245208lff.2; Mon, 30 Nov 2015 14:14:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:from:to:cc:date:message-id:user-agent:mime-version :content-type:content-transfer-encoding; bh=aXDsmXr9OUm+nQ+Hh2Ur9mh+mmO4wDhHheLMTbt+F/g=; b=srI3VScE47pNYAIolUOifTwBUcEfIAWSKuHbszzwh2NwfkRD0TTLmXtvm8myylvIBO I01AnG9BVByXXxO5VcViaAIgBFs9CNTYd9nLOHPlAyTnl6WaGr6s0jx/t/HRg7mIUyBb JKtnTeP7kkCSKL996BCVvYOjTZaFftrvoaFlzFajrSWd5mls8AyUNix2AOlNena/4GME Q8xKdvV1ol2s5XmBcZ/qt3HE9xBVz+mSpfVinf8i+8Awd9Sre/GoTK3wIFMDzWYJdopK J4iqnbry9kBpQ5qu3I5n46HiG7f0G8VzWbYIgocd0/MpV6LSYTsGczsjF1/f/+SS3W2+ h8oA== X-Received: by 10.25.137.84 with SMTP id l81mr15751894lfd.45.1448921691597; Mon, 30 Nov 2015 14:14:51 -0800 (PST) Received: from localhost (ppp79-139-147-94.pppoe.spdop.ru. [79.139.147.94]) by smtp.gmail.com with ESMTPSA id j83sm4916195lfi.47.2015.11.30.14.14.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Nov 2015 14:14:50 -0800 (PST) Subject: [PATCH] net/neighbour: fix crash at dumping device-agnostic proxy entries From: Konstantin Khlebnikov To: netdev@vger.kernel.org, "David S. Miller" Cc: stable@vger.kernel.org Date: Tue, 01 Dec 2015 01:14:48 +0300 Message-ID: <144892168886.1956.12514575216454077256.stgit@zurg> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Proxy entries could have null pointer to net-device. Signed-off-by: Konstantin Khlebnikov Fixes: 84920c1420e2 ("net: Allow ipv6 proxies and arp proxies be shown with iproute2") Cc: # v3.4 --- net/core/neighbour.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 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/core/neighbour.c b/net/core/neighbour.c index e6af42da28d9..f18ae91b652e 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c @@ -2215,7 +2215,7 @@ static int pneigh_fill_info(struct sk_buff *skb, struct pneigh_entry *pn, ndm->ndm_pad2 = 0; ndm->ndm_flags = pn->flags | NTF_PROXY; ndm->ndm_type = RTN_UNICAST; - ndm->ndm_ifindex = pn->dev->ifindex; + ndm->ndm_ifindex = pn->dev ? pn->dev->ifindex : 0; ndm->ndm_state = NUD_NONE; if (nla_put(skb, NDA_DST, tbl->key_len, pn->key)) @@ -2333,7 +2333,7 @@ static int pneigh_dump_table(struct neigh_table *tbl, struct sk_buff *skb, if (h > s_h) s_idx = 0; for (n = tbl->phash_buckets[h], idx = 0; n; n = n->next) { - if (dev_net(n->dev) != net) + if (pneigh_net(n) != net) continue; if (idx < s_idx) goto next;