Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2733708pxj; Mon, 31 May 2021 09:22:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxmPGHfoTUZeM0B7c2vUYKJ3oKu03D8pa3R/NukhCrBt5vAncRXqmsrtd7E37QY3oHNrfgj X-Received: by 2002:a17:906:fc0d:: with SMTP id ov13mr23069677ejb.504.1622478137331; Mon, 31 May 2021 09:22:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622478137; cv=none; d=google.com; s=arc-20160816; b=GRQBC15yhWAWy7Hs3GsKbLAusZ06ytPs5yiCDRpgXQeCXQ9kdO1pr2CLbyS9ixIWvC EQyZF/R0HGZPmVyIlpHCV+ctBSJ6GiSpTlvK2zm1oUz1635ADf6l3WXekryTe8LYdw7E GcGesTtGukDLzwYGeUJlJUhfvDkgIbVP0FbHDvwjIY5c7bMRdh7z61udVVQ/c/YrvjBP KW7soAv6ms73Jcymgb6hcjcTGCjJZbx3N0tVfkvO7tuICzTjyXkLqCAM39YVHC/CKhTz LkXb1ZNw6r2SkvxvavE/yUzYKHV/aeJTEnEnsGkvwe2mB+i/sN3Vk0hKNyx7EIKGbUHV bMVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Mv3g0HjUMl/m4Ou7QMogNqDxVusnFJVk/NAyiILLpQ8=; b=AIMkCF8tNKtOkaFq+oWTNJ5qPpuwvKqOSgpyD8/fqNq39zf+CRt5syWU/LWjrBPZY8 siy5iVW+MEh55Zg7FC6K9O2xEpo1MVtFpNiHMEHgWjnCH6X+/FLy+NNRujJykHVoEW6t zig7alPhSKTMRaCbDRk4PgLLGyyWLWnJn/qKJzpJaiWh5JvuLU+dUXOIO9EM081W2QZx qmkOw/11Y+YTN9vKwmyLeI21DKcvQKmRsh63vz/ycWzCuqIYA3XJ3v+P8FOgZ9na4fUG EIB/ybyBeXjTOTzhIkRf+MXf4igF/bHu3HXXwZZyOxpyfx30SWUMPb5N5dHGEKK121nv TehQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pAvUJCRd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g16si12152385edr.585.2021.05.31.09.21.54; Mon, 31 May 2021 09:22:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pAvUJCRd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233114AbhEaQW3 (ORCPT + 99 others); Mon, 31 May 2021 12:22:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:37862 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234010AbhEaOn2 (ORCPT ); Mon, 31 May 2021 10:43:28 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5234361C78; Mon, 31 May 2021 13:54:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622469250; bh=x1pPOSprWzG+lSx5h3f4jjsqv/cvvuQH/fxPSt6chCc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pAvUJCRd0rSZ8sELLqKBStE8+MLcyVtI3WJVIJ4+tJzxCeWyNrLKubMy70ufpMVgC Q5GNDM37ChS6WZkqwXoel/X4kdxLR4vxeElrvElXLV6o12UaWDvM2kKju3uNU6IpcD 0PxJL6kAsTnzBCzd0+6+UlD3c2KFnOZUqYljz/wA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Roi Dayan , Maor Dickman , Saeed Mahameed Subject: [PATCH 5.12 125/296] net/mlx5e: Fix null deref accessing lag dev Date: Mon, 31 May 2021 15:13:00 +0200 Message-Id: <20210531130708.104524951@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130703.762129381@linuxfoundation.org> References: <20210531130703.762129381@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Roi Dayan commit 83026d83186bc48bb41ee4872f339b83f31dfc55 upstream. It could be the lag dev is null so stop processing the event. In bond_enslave() the active/backup slave being set before setting the upper dev so first event is without an upper dev. After setting the upper dev with bond_master_upper_dev_link() there is a second event and in that event we have an upper dev. Fixes: 7e51891a237f ("net/mlx5e: Use netdev events to set/del egress acl forward-to-vport rule") Signed-off-by: Roi Dayan Reviewed-by: Maor Dickman Signed-off-by: Saeed Mahameed Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/mellanox/mlx5/core/en/rep/bond.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/net/ethernet/mellanox/mlx5/core/en/rep/bond.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/rep/bond.c @@ -223,6 +223,8 @@ static void mlx5e_rep_changelowerstate_e rpriv = priv->ppriv; fwd_vport_num = rpriv->rep->vport; lag_dev = netdev_master_upper_dev_get(netdev); + if (!lag_dev) + return; netdev_dbg(netdev, "lag_dev(%s)'s slave vport(%d) is txable(%d)\n", lag_dev->name, fwd_vport_num, net_lag_port_dev_txable(netdev));