Received: by 10.223.185.116 with SMTP id b49csp5482176wrg; Wed, 7 Mar 2018 12:32:01 -0800 (PST) X-Google-Smtp-Source: AG47ELtmYhQ9gku+qTdBpprMlPakfSiIpZfh61lTuKJxpfUvVHNqjhJMkJ0unWB6qdlofgLbvAAB X-Received: by 10.101.97.67 with SMTP id o3mr19662348pgv.251.1520454721366; Wed, 07 Mar 2018 12:32:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520454721; cv=none; d=google.com; s=arc-20160816; b=f1JKZfWBy41KrPfO8QFMsMxNpoUwKgeEEBA1Bv0bkvfeI9tOcw0GuJkk4TVfRY37v5 iV+3R0LRYgYgitDkjp0MYS53P5ulDER3EThLsGt3AFYgFaUjyDJcql1Nz2o8eLz+EdDP l8zwT9xS0xyNormEuLOka+N9HAUmD7YnPL0SEeQOyMNZi0fHDky5kRvokF+MIEbfIwoi bnGMX5Xh9psTPwmKnxyOWWQpPOaF6mb5lLlLtAp0LkhFw+QlJkk0FW168EVJw8XQ+Jnb EfDynfleOfnYEaoyO8b1RnrHRjzhMBw3oOmwksLgMR9Ud9liHsFU9gJF/4ITEMM0JzS8 2y3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=ZlhBeRPP2mqVnzEys3ckyXhwjhYBjM+FNra0ecO3JPw=; b=RDHT7wd5ClGSk/tku4uwPJzSNyuTgo+hRkNVipZiJ5DtUalMwIoWtZZq4udzKiPqrK mF3l/8HZbkP3Jx/AZM0+LR4j9DUkokIin0371NAcEwcojNPVCg3FmgAReAqmVbqhZ4E/ V3qIO32tYgC2Y4C6Kkf5t43OYXKXzB+GBq8m7qQZNBgEAhFqpbNtSo+40wDDiL2giEGA RpdJ35KrWIQcgGk8PSPW/naNAfvupjEQ6WQXu2a5TVmypYEyNxmEq7EIP7Yht6+hB76V XfdKAnCw5k0FO0puVPg4zXG+x13SMGzZQT9udzyirj2BPDALgwf9GnTbl+SMvEs4ccZi vHRQ== ARC-Authentication-Results: i=1; mx.google.com; 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 u64si11814522pgc.295.2018.03.07.12.31.46; Wed, 07 Mar 2018 12:32:01 -0800 (PST) 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; 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 S964819AbeCGTmc (ORCPT + 99 others); Wed, 7 Mar 2018 14:42:32 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:42396 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934522AbeCGTm2 (ORCPT ); Wed, 7 Mar 2018 14:42:28 -0500 Received: from localhost (unknown [185.236.200.248]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 7F8E1107C; Wed, 7 Mar 2018 19:42:22 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vlad Buslov , Maor Gottlieb , Saeed Mahameed Subject: [PATCH 4.15 080/122] net/mlx5: Fix error handling when adding flow rules Date: Wed, 7 Mar 2018 11:38:12 -0800 Message-Id: <20180307191740.821519832@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180307191729.190879024@linuxfoundation.org> References: <20180307191729.190879024@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Vlad Buslov [ Upstream commit 9238e380e823a39983ee8d6b6ee8d1a9c4ba8a65 ] If building match list or adding existing fg fails when node is locked, function returned without unlocking it. This happened if node version changed or adding existing fg returned with EAGAIN after jumping to search_again_locked label. Fixes: bd71b08ec2ee ("net/mlx5: Support multiple updates of steering rules in parallel") Signed-off-by: Vlad Buslov Reviewed-by: Maor Gottlieb Signed-off-by: Saeed Mahameed Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c @@ -1755,8 +1755,11 @@ search_again_locked: /* Collect all fgs which has a matching match_criteria */ err = build_match_list(&match_head, ft, spec); - if (err) + if (err) { + if (take_write) + up_write_ref_node(&ft->node); return ERR_PTR(err); + } if (!take_write) up_read_ref_node(&ft->node); @@ -1765,8 +1768,11 @@ search_again_locked: dest_num, version); free_match_list(&match_head); if (!IS_ERR(rule) || - (PTR_ERR(rule) != -ENOENT && PTR_ERR(rule) != -EAGAIN)) + (PTR_ERR(rule) != -ENOENT && PTR_ERR(rule) != -EAGAIN)) { + if (take_write) + up_write_ref_node(&ft->node); return rule; + } if (!take_write) { nested_down_write_ref_node(&ft->node, FS_LOCK_GRANDPARENT);