Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2118647pxb; Mon, 12 Apr 2021 15:06:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNt1LczQjbd0BQ+SbSsMnZi4qcQeEDgHtKrAHlfZfOi6hKU1cQb6OYSME5zFz1yX3hfOHk X-Received: by 2002:a17:906:3295:: with SMTP id 21mr29042807ejw.88.1618265186274; Mon, 12 Apr 2021 15:06:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618265186; cv=none; d=google.com; s=arc-20160816; b=EKO+D16sQIRZRLe6k0tuFjOTypnlLal+vLE7dHhRRT0n9UwIK1UfggPd4WVTj3MYK8 7WddWK2CYAwaBoTLunNwUVHinjEfXM8L2lHaZHifOAJv3eQ5y/9NM/0AeChV3yWAJL3S 5G6SbLDzM8muSaGGmzzuon6pknEkwYGJu8po5JpGZ6CqMeXL6PbOpFwVZlPc8zLv/UOv eelTd5Cl8nUvUPF/dUskTh7EK24JCvLYfV2PHJKXKHA1eWOVA7cKxk8oCyMN7QCjNbww puBSkM8aiVhNTpKAxPBmgjPq0JdNRX4rpz1jpzBAsOsXYyHpRXPYzxn1oZJPkHR/mLot 63DA== 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=S86SG/E0xxrOlZcYfGoRWepLW47KVG+aEP40weWnjqs=; b=k9WQxe30EZwQqeDTRG3vsE7Kf6olEtQyzQCHw8JxvODrcNK1XoNbID0hjdpt+j0DXC wqvFKbN0noJRYToUZFVjgrJStrSYjBasaWWNk0fNPvDr+Cu8USYfZZtX1ypDmtOlNLlu 4X1jZX6YRhevejfPbxJr9WkelGPEjiDsORq+ENTfjn9U5wuPJQeV1m5jZ5Z+9I/7zRQX 6zVt0hP1nvTy/nJUVjdvCqSTwIkfOWFYRzLwTV0KEbPvvZR3XBpoQG9cFvI6A2vaRoCe 6CIU/KjPuVJnaB8xLxd9BBs6kzDL+m4SvQb4NvLKQVoGo54aDc4+7ZzrOUsrEjxmSbJY TDVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MkzsPQR0; 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 r15si6822139edo.29.2021.04.12.15.06.02; Mon, 12 Apr 2021 15:06:26 -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=MkzsPQR0; 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 S241117AbhDLJZW (ORCPT + 99 others); Mon, 12 Apr 2021 05:25:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:54844 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238755AbhDLJCC (ORCPT ); Mon, 12 Apr 2021 05:02:02 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B876561261; Mon, 12 Apr 2021 09:00:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618218033; bh=dk+lvJImiLR5d06gTnY+sHYtaNze9DgCnXPeQgz/YMk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MkzsPQR05OMjU3LEjj/i9qSYwQGyqR4KzjYoSHnaTIPOnijgXQYbqrtr3CfSEGIqQ eQHIGcdmccmRxj3hMAyirPeUEyrHvnnvVWpW6UNDY3yk71LU69/mEiks4QZl0fXt9+ lqmpIuUstGnDj+p9Wo1t6mCkgRFHR6WJzJ9/LG28= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Jacek=20Bu=C5=82atek?= , Haiyue Wang , Tony Brelinski , Tony Nguyen Subject: [PATCH 5.11 045/210] ice: Fix for dereference of NULL pointer Date: Mon, 12 Apr 2021 10:39:10 +0200 Message-Id: <20210412084017.513414309@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210412084016.009884719@linuxfoundation.org> References: <20210412084016.009884719@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: Jacek Bułatek commit 7a91d3f02b04b2fb18c2dfa8b6c4e5a40a2753f5 upstream. Add handling of allocation fault for ice_vsi_list_map_info. Also *fi should not be NULL pointer, it is a reference to raw data field, so remove this variable and use the reference directly. Fixes: 9daf8208dd4d ("ice: Add support for switch filter programming") Signed-off-by: Jacek Bułatek Co-developed-by: Haiyue Wang Signed-off-by: Haiyue Wang Tested-by: Tony Brelinski Signed-off-by: Tony Nguyen Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/intel/ice/ice_switch.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) --- a/drivers/net/ethernet/intel/ice/ice_switch.c +++ b/drivers/net/ethernet/intel/ice/ice_switch.c @@ -1238,6 +1238,9 @@ ice_add_update_vsi_list(struct ice_hw *h ice_create_vsi_list_map(hw, &vsi_handle_arr[0], 2, vsi_list_id); + if (!m_entry->vsi_list_info) + return ICE_ERR_NO_MEMORY; + /* If this entry was large action then the large action needs * to be updated to point to FWD to VSI list */ @@ -2220,6 +2223,7 @@ ice_vsi_uses_fltr(struct ice_fltr_mgmt_l return ((fm_entry->fltr_info.fltr_act == ICE_FWD_TO_VSI && fm_entry->fltr_info.vsi_handle == vsi_handle) || (fm_entry->fltr_info.fltr_act == ICE_FWD_TO_VSI_LIST && + fm_entry->vsi_list_info && (test_bit(vsi_handle, fm_entry->vsi_list_info->vsi_map)))); } @@ -2292,14 +2296,12 @@ ice_add_to_vsi_fltr_list(struct ice_hw * return ICE_ERR_PARAM; list_for_each_entry(fm_entry, lkup_list_head, list_entry) { - struct ice_fltr_info *fi; - - fi = &fm_entry->fltr_info; - if (!fi || !ice_vsi_uses_fltr(fm_entry, vsi_handle)) + if (!ice_vsi_uses_fltr(fm_entry, vsi_handle)) continue; status = ice_add_entry_to_vsi_fltr_list(hw, vsi_handle, - vsi_list_head, fi); + vsi_list_head, + &fm_entry->fltr_info); if (status) return status; }