Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp894671yba; Thu, 18 Apr 2019 11:21:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqwU5oYlnkTVeQGz2b/NnLd/GUdmOp+oCW5DveFZ87COU6V6evQ2mo3sj6UjyUBIHcowcKCa X-Received: by 2002:a63:7949:: with SMTP id u70mr6950050pgc.418.1555611680045; Thu, 18 Apr 2019 11:21:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555611680; cv=none; d=google.com; s=arc-20160816; b=Wab49whzwXU4kRuks5buRznuLr9d93FmDBWfAWWYzAxsyvxr/x1L5MxuSrvmwCF2BA Z/5z/KCT6w3fg2aIHCXGtTqhA8SAbkJEeXrRpmvGnwIF9nu6y8KnFZC/Nejrxr56b31H M1wPI60Jvgktr2LvHseK3wPm58M5l9/GR9OiOw7OQDSrvqap85eMtJyqDYbpgUvI3ZP/ xgeNb13u7GlXgj5D2EBANSpakKstFZjqlnKdwqlj6KKAMDIGVqRh2CW5ogiAlk56Bc3N mSxnjX44dMqNqWPqRfkMlxW+URHpb+pZmzWO8vlR+f5FJofkUbLSY9kkh9+CkblR8C5H ErrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=t2YjuwTrz3cLDbpubE5ae/OBbXzYNUuXG0LaqWPuqQc=; b=nWoBBd9yWW0dM294j4tYcO10S4DpdYniLWBgFVBThQ11DRFm2z4lLLdUo20M+ddn1U 7JHjQQedhUpry3OtWM2C7E5/TVy/9jhi5lntnihajTjGtblBdrQksb+w07BN9tg7pUWD LFMvcSe7Lukm2JiIfh15o9/OF5uBdd2SI6BNvvakfRghisJ2UTXrIzSI3Tk+uA1FttFt JwELSTLKvYWcAmM+HzI61XE3FRCDVYTCp/cN8g5ESa3d5oiz5m6Jr0EddKeOa91hkLWR 7J2FiVGn9H8PywVPKvBj4IUJDIBgMvXywG4jX4jIi1kK67kBzyAYjIM6GJhiiKX/U8z1 uZRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="gS/1JOEe"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i9si2972284pfr.111.2019.04.18.11.21.05; Thu, 18 Apr 2019 11:21:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="gS/1JOEe"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391431AbfDRSJr (ORCPT + 99 others); Thu, 18 Apr 2019 14:09:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:41420 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391886AbfDRSJp (ORCPT ); Thu, 18 Apr 2019 14:09:45 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 96C4B21871; Thu, 18 Apr 2019 18:09:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555610985; bh=K4OBAaUL1645McQUoybnngqod54ZyJTQKxaJOic90VY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gS/1JOEeZxaAjCsaBXSNXphQQUdzuse21xvOWyhS/D8A9U207bmnUUGI04wNyLhYP JXMdlSkHHthglbxNcOIJR5+zdkTGRMgAadF2AdX1RW+4ADypMqvOl4YElMnsQztYKU EBRP6TWdGISNH/2fyj0ys0mQM26l2tpF78gT1EHU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Feng Tang , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.0 15/93] i40iw: Avoid panic when handling the inetdev event Date: Thu, 18 Apr 2019 19:56:53 +0200 Message-Id: <20190418160438.371064859@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190418160436.781762249@linuxfoundation.org> References: <20190418160436.781762249@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit ec4fe4bcc584b55e24e8d1768f5510a62c0fd619 ] There is a panic reported that on a system with x722 ethernet, when doing the operations like: # ip link add br0 type bridge # ip link set eno1 master br0 # systemctl restart systemd-networkd The system will panic "BUG: unable to handle kernel null pointer dereference at 0000000000000034", with call chain: i40iw_inetaddr_event notifier_call_chain blocking_notifier_call_chain notifier_call_chain __inet_del_ifa inet_rtm_deladdr rtnetlink_rcv_msg netlink_rcv_skb rtnetlink_rcv netlink_unicast netlink_sendmsg sock_sendmsg __sys_sendto It is caused by "local_ipaddr = ntohl(in->ifa_list->ifa_address)", while the in->ifa_list is NULL. So add a check for the "in->ifa_list == NULL" case, and skip the ARP operation accordingly. Signed-off-by: Feng Tang Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin --- drivers/infiniband/hw/i40iw/i40iw_utils.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/i40iw/i40iw_utils.c b/drivers/infiniband/hw/i40iw/i40iw_utils.c index 59e978141ad4..e99177533930 100644 --- a/drivers/infiniband/hw/i40iw/i40iw_utils.c +++ b/drivers/infiniband/hw/i40iw/i40iw_utils.c @@ -173,7 +173,12 @@ int i40iw_inetaddr_event(struct notifier_block *notifier, rcu_read_lock(); in = __in_dev_get_rcu(upper_dev); - local_ipaddr = ntohl(in->ifa_list->ifa_address); + + if (!in->ifa_list) + local_ipaddr = 0; + else + local_ipaddr = ntohl(in->ifa_list->ifa_address); + rcu_read_unlock(); } else { local_ipaddr = ntohl(ifa->ifa_address); @@ -185,6 +190,11 @@ int i40iw_inetaddr_event(struct notifier_block *notifier, case NETDEV_UP: /* Fall through */ case NETDEV_CHANGEADDR: + + /* Just skip if no need to handle ARP cache */ + if (!local_ipaddr) + break; + i40iw_manage_arp_cache(iwdev, netdev->dev_addr, &local_ipaddr, -- 2.19.1