Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp3242515imc; Wed, 13 Mar 2019 12:31:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqwer7+VPAsu9sQRkniXWV41yuGOWtXY15TnubftQ+ZK7af1/503m+hmS+78T/LVb8GzC/sd X-Received: by 2002:a17:902:6b08:: with SMTP id o8mr46874065plk.105.1552505476119; Wed, 13 Mar 2019 12:31:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552505476; cv=none; d=google.com; s=arc-20160816; b=Zqai8JpvnltRw/U6Rv2LgYHzKfRWNl26V5bq/21Mf8FRMEXWflLrKM1dmBIyrPZ/RM fRB94bTZHrWcQ8j/ePnvqzXCLn/7/Af+Ia1kwVC6OU46CSTAvJCEqdOZYJSqf1zzYbkJ 7IsSCWJVsI/OcxJBBqVZKI0GnPzJfKvUVE2Ds8Tw5QOReMTLhypedeY3m6oUgOAiXmL5 pubWlAXNwMvNHBWffaYUVqa5yzyZ95vjBptNvcLEKaU5XMqNqVxeo5LPl4xTT9skc3Pc AsEWedYOD71TZkOPriblww9pUfB2b+L7f1OifuiTMQGDj05CpD5175xFu88PFSZuv21G MGow== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=GOzgIydtVRXOY3wFj9GAdJX6+wXbYDGyQi3hAU1vzJc=; b=vGEsF2GmY5kfJabhcP6E3iq1ISbGObE+3eqJcomwQcB8/KJUyff1eX77r5+gU8xuME 3l1hO2Sq5iftPJPHQvr04p34keKHwA40j3iBttyGWhRh+c2U/vOl4hUMnzxegssX3dXR LBkhMJDulm3wYNMGHMDWqwYtUxrWoR2J8Xk6Yz2/emgqKe2ljwYhnSgG+N/FqmUht/JU UPj3wx6k7t9j9CyK9kQScvlXEbVruWKar5DiSOeSF17lYftwaI87vBNyJ28WpNmTUsMc aykDBIn+dipKgAqZddr3blqKyVLaQ4uEU0hVBj1PHd0RopuXBzYO2BXSHkL4pPvk4pJ2 lw7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kTlE88xU; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q1si2847070plb.148.2019.03.13.12.30.59; Wed, 13 Mar 2019 12:31:16 -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=kTlE88xU; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727869AbfCMTaG (ORCPT + 99 others); Wed, 13 Mar 2019 15:30:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:43114 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727743AbfCMTMc (ORCPT ); Wed, 13 Mar 2019 15:12:32 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1FEA62075C; Wed, 13 Mar 2019 19:12:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1552504351; bh=vi/vH8pyOAlrCZUrjN+SwGrbS8OfUm+zrqmnWIEMZxU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kTlE88xUTGMS2Pv+M9PzPfJQY+MiTpZafMj4zM83yI5uWNWsUhld/ViTM3N5kH0sO 1+0kwKmVndQsSFqZayqxheEZ489i8Uosvn0+jIOI9Pa5wDIlZk5dlq7oHSuc1YtZ6g QUCNQ54GoiMxpmM2jC1GzWFPfbyCwgTumTn78lN0= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Vadim Lomovtsev , "David S . Miller" , Sasha Levin , netdev@vger.kernel.org Subject: [PATCH AUTOSEL 4.20 53/60] net: thunderx: add nicvf_send_msg_to_pf result check for set_rx_mode_task Date: Wed, 13 Mar 2019 15:10:14 -0400 Message-Id: <20190313191021.158171-53-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190313191021.158171-1-sashal@kernel.org> References: <20190313191021.158171-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vadim Lomovtsev [ Upstream commit 7db730d9d2f7b6af6aeac621b1890ea477a0cb8d ] The rx_set_mode invokes number of messages to be send to PF for receive mode configuration. In case if there any issues we need to stop sending messages and release allocated memory. This commit is to implement check of nicvf_msg_send_to_pf() result. Signed-off-by: Vadim Lomovtsev Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/cavium/thunder/nicvf_main.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_main.c b/drivers/net/ethernet/cavium/thunder/nicvf_main.c index 4eb24e10ba4d..9800738448ec 100644 --- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c +++ b/drivers/net/ethernet/cavium/thunder/nicvf_main.c @@ -1950,7 +1950,8 @@ static void __nicvf_set_rx_mode_task(u8 mode, struct xcast_addr_list *mc_addrs, /* flush DMAC filters and reset RX mode */ mbx.xcast.msg = NIC_MBOX_MSG_RESET_XCAST; - nicvf_send_msg_to_pf(nic, &mbx); + if (nicvf_send_msg_to_pf(nic, &mbx) < 0) + goto free_mc; if (mode & BGX_XCAST_MCAST_FILTER) { /* once enabling filtering, we need to signal to PF to add @@ -1958,7 +1959,8 @@ static void __nicvf_set_rx_mode_task(u8 mode, struct xcast_addr_list *mc_addrs, */ mbx.xcast.msg = NIC_MBOX_MSG_ADD_MCAST; mbx.xcast.data.mac = 0; - nicvf_send_msg_to_pf(nic, &mbx); + if (nicvf_send_msg_to_pf(nic, &mbx) < 0) + goto free_mc; } /* check if we have any specific MACs to be added to PF DMAC filter */ @@ -1967,9 +1969,9 @@ static void __nicvf_set_rx_mode_task(u8 mode, struct xcast_addr_list *mc_addrs, for (idx = 0; idx < mc_addrs->count; idx++) { mbx.xcast.msg = NIC_MBOX_MSG_ADD_MCAST; mbx.xcast.data.mac = mc_addrs->mc[idx]; - nicvf_send_msg_to_pf(nic, &mbx); + if (nicvf_send_msg_to_pf(nic, &mbx) < 0) + goto free_mc; } - kfree(mc_addrs); } /* and finally set rx mode for PF accordingly */ @@ -1977,6 +1979,8 @@ static void __nicvf_set_rx_mode_task(u8 mode, struct xcast_addr_list *mc_addrs, mbx.xcast.data.mode = mode; nicvf_send_msg_to_pf(nic, &mbx); +free_mc: + kfree(mc_addrs); } static void nicvf_set_rx_mode_task(struct work_struct *work_arg) -- 2.19.1