lkml.org 
[lkml]   [2018]   [Mar]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.15 080/122] net/mlx5: Fix error handling when adding flow rules
    Date
    4.15-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Vlad Buslov <vladbu@mellanox.com>


    [ 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 <vladbu@mellanox.com>
    Reviewed-by: Maor Gottlieb <maorg@mellanox.com>
    Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ---
    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);

    \
     
     \ /
      Last update: 2018-03-07 21:30    [W:4.288 / U:0.092 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site