Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp1361073pxb; Fri, 21 Jan 2022 16:31:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJzkp2uYdpVkWYPYPcF4BJkyWQAbGCzewY5eulTaN4p/C7Y6TxwWFuCqHJl+K6O2tHl7O+gN X-Received: by 2002:a65:498e:: with SMTP id r14mr4508184pgs.47.1642811462717; Fri, 21 Jan 2022 16:31:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642811462; cv=none; d=google.com; s=arc-20160816; b=GIFTEtPOlt7ScZUnsFNkwgJYgl5cATSI0G8CocCufJjnfhsOZpvgcjEptvoQAfFD3p TYalBL/FQQcW+XW2zisKhZ6avYmfdDLRuuSs+Cha+ElJM3G9cPS0nT4g9FGN3yfqXh6h WHbRVgJOvlsCMs0HJSRVZHaV+cK52hpd+AJP0wRRqU6FBcSLVvJu+WX7gMI0ID6rY8rP vapT6sI4JmEEzlOmo814XKc7ouaBMQq3vVRqLBfcn5xRj7NSWDspg1pwURUERQl8BL6v gVya6lVhLRTaa1YdXZDWFjcL9dp+gTiQq7ZogRW0X5nZ1hoGkJ+5KfScugT6kHKv4FmP xkfA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=i4QbHTZsLroI/F3v7ghAzppSaB2PYGF736LCpyMu98s=; b=ouKzPwtFOlzqKplnmhndKqXHCCoZ/vaFO1UV3sOBUcntW4xZELYA3Fs4YohGe6GQN8 S9VOQZWvkRh6Mc4cLaE2k5nuX6NAlWz51U3mYUAGPoPAEnD0CdFBr9ZiP61ulN476Wag 8v/El/fTwQ87xuLd0xgggNhIT1uvn2lB4SLFvOP6Yboa0B1gxBb0sBYWe8kFt8oxjEw4 AjtGLJawUNAXz5eoC+OZGYLCaLhcyllzkz2Uk9q3LOvojtHXAypoW23TQiW6T37KBW+D 1lZZ6MtIUyhO21/skVPtr79KT4pyCFPSlsD3IPsRY8GPqsl5Mn/QDtlTjrA+Vmo+XQav AAKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=V71yUYiX; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j13si7598453pgk.413.2022.01.21.16.30.50; Fri, 21 Jan 2022 16:31:02 -0800 (PST) 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=@gmail.com header.s=20210112 header.b=V71yUYiX; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233236AbiAUDYU (ORCPT + 99 others); Thu, 20 Jan 2022 22:24:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230304AbiAUDYT (ORCPT ); Thu, 20 Jan 2022 22:24:19 -0500 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEC2AC061574; Thu, 20 Jan 2022 19:24:18 -0800 (PST) Received: by mail-pf1-x436.google.com with SMTP id e28so3226245pfj.5; Thu, 20 Jan 2022 19:24:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=i4QbHTZsLroI/F3v7ghAzppSaB2PYGF736LCpyMu98s=; b=V71yUYiX4CJSgycnC0ue1TNs1tWa8PBmT2UCUblhD9gggziNxe4obJD4QyZVY7YLc5 XoEelx2xKEDn7kDN82F4rpcQzsAp+BkJkJuT9y/sBYVugp7suY1kwK4OfE5w51RdwBdB 2Us0/z70hEkQc5AaNU3FxpD1gTt0fZ2x1PZd3G3DgLdOHEUpsVwvzRWU8XvLI3zAvB67 tA2YFCUZuuSJulXadTg8iy0E4lxKM6e4X+OuqcDYzbOXGoInOeAG5BEDnnrn5PP1dx6w yHi8p8ttY1qokesI0mQmrOO57qw2w6AO1jiMkQjq48Md2ZbH9MECTURM18z7vEzvGrKH a9Gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=i4QbHTZsLroI/F3v7ghAzppSaB2PYGF736LCpyMu98s=; b=wAJtU79eclhyjnakGCtoWUjGJDfVknbTJWn7T9WcQU6iyZWl0t5T9jxOXTvDJ+fgBR NSCvf+b1+a22ANTDZ9r3pgB+b51l0Q0smTDZ164oo7cOU7Mgdh1f7P6WRIIGr9mpiTDK U4y6raq4erMaA54fBpHASKqKJxiTaImerAJ+9lSqRGjGuke2pZCDwLvJD5FAbooXYq/R +AAbTKqqPqVTT8OLxJtvqsaAGJNEDzBY95kk8Bzj83TpYklI9aZ7ISKs/PSdak7rfDjH hBRKslHOxUVALx+nFAHsjnPDJGZmibvL8AEt91wcEtaKajEWgxJq6yLrz3nCfv9tF+kp bJDg== X-Gm-Message-State: AOAM531q7bq3tnr6nmzibdeOUrk+XJ3eEQLjVkRUZ1tLo1LA6cQYIZO0 VUk2W/fxPCkX8cTs4DuOeRM= X-Received: by 2002:a63:8ac4:: with SMTP id y187mr1495104pgd.261.1642735458292; Thu, 20 Jan 2022 19:24:18 -0800 (PST) Received: from localhost.localdomain ([106.11.30.62]) by smtp.gmail.com with ESMTPSA id n22sm4553312pfu.193.2022.01.20.19.24.16 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Jan 2022 19:24:18 -0800 (PST) From: ycaibb To: davem@davemloft.net, yoshfuji@linux-ipv6.org, dsahern@kernel.org, kuba@kernel.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, ycaibb@gmail.com Subject: [PATCH] net: missing lock releases in ipmr_base.c Date: Fri, 21 Jan 2022 11:22:10 +0800 Message-Id: <20220121032210.5829-1-ycaibb@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ryan Cai In method mr_mfc_seq_idx, the lock it->lock and rcu_read_lock are not released when pos-- == 0 is true. Signed-off-by: Ryan Cai --- net/ipv4/ipmr_base.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/ipv4/ipmr_base.c b/net/ipv4/ipmr_base.c index aa8738a91210..c4a247024c85 100644 --- a/net/ipv4/ipmr_base.c +++ b/net/ipv4/ipmr_base.c @@ -154,6 +154,7 @@ void *mr_mfc_seq_idx(struct net *net, it->cache = &mrt->mfc_cache_list; list_for_each_entry_rcu(mfc, &mrt->mfc_cache_list, list) if (pos-- == 0) + rcu_read_unlock(); return mfc; rcu_read_unlock(); @@ -161,6 +162,7 @@ void *mr_mfc_seq_idx(struct net *net, it->cache = &mrt->mfc_unres_queue; list_for_each_entry(mfc, it->cache, list) if (pos-- == 0) + spin_unlock_bh(it->lock); return mfc; spin_unlock_bh(it->lock); -- 2.33.0