Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp912362rdg; Wed, 11 Oct 2023 08:51:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEW2zZVUaEfCZBt0NmBZio2EYiT2HdTrvDTAQSQHdj7bUyVtofJIwA9eXru2gcbU4jSjzol X-Received: by 2002:a05:6871:78d:b0:19f:aee0:e169 with SMTP id o13-20020a056871078d00b0019faee0e169mr27215761oap.30.1697039478553; Wed, 11 Oct 2023 08:51:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697039478; cv=none; d=google.com; s=arc-20160816; b=d6nrHsXpCsfcCSGiRFayrD1Kglx56KVA20JdvyxNL6+kUsYjjWWylz5rGpaQh9EjyS TV/q5Slj4JrtIv2fC75dSfHL/xFs6yD01EQd8uyykf9BsrVwfmo9m3v8k90L8xNKanyw P24Jm2oY80knecucxfBjRrsYg0sM3c0NbLefs3TeSrOTu9YVahdyAK129pPpIb7vihmb 8FrWDneN3yG/BLFO9892eM1jQrheRYKdxoOmwTVZr5SaXe0oTnYd2a+QOzSVze7w9x9G gL72ZTd0QgEMsSKGi4FoS6bJec+GLbLb/IUfk9lyjxvuFAd8SR8FsjCEolhNgHVi68wY x5IA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=sDYBKIS55V1uI8CU7rsbxpgMy6trEjU+BP4wxaqMQ+0=; fh=upQMVrpKjNR6eMdMJUq+2crUgtTzaZJkYYkytXvjEG4=; b=r9k3pqgSS4wzlYVabba+uA7fpPDkR/LPeg6X969r3SGqG97osv+hpwac5arfQn0fK8 fztC34UCkvoWVL1VsYwOCckdPob0MWOp0Y5h4ISHAoUorRr+Eru0cb+4hsBm5VayG766 PSPlArQksOK1P4mJpbKnrND/UEnsIBp8fW7rNxVdefqggn6wa9y2Yphbp+DYmp3qQ+bD TsHna1gsXOTQFpgaJB6UyL7v+TdKu/lkRD4zhAbcKbBV3HfyEcFheo1lkavHfALu6SSb WhL14dbUf11vOCS46Ps0l3Veo4y/J5BE7TpGcBK+cimWhJvSuKgTvf1yHkCoIIDDV61c v2ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=RbpiWXiT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id l8-20020a635b48000000b005775c7e503csi60244pgm.116.2023.10.11.08.51.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 08:51:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=RbpiWXiT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 6DDC6807C559; Wed, 11 Oct 2023 08:50:13 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232013AbjJKPuF (ORCPT + 99 others); Wed, 11 Oct 2023 11:50:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232741AbjJKPuD (ORCPT ); Wed, 11 Oct 2023 11:50:03 -0400 Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07CB4AF; Wed, 11 Oct 2023 08:50:02 -0700 (PDT) Received: by mail-pg1-x52b.google.com with SMTP id 41be03b00d2f7-55b5a37acb6so784703a12.0; Wed, 11 Oct 2023 08:50:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697039401; x=1697644201; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=sDYBKIS55V1uI8CU7rsbxpgMy6trEjU+BP4wxaqMQ+0=; b=RbpiWXiThoJuR4h0y/Qaunp6jjoPgMue3yLOXZCkq5MmfMmkFakTa6WzQFqdlnZDNm x12Rsp6ipYngIIzSvdu59/VFhEd0E+1o31MkAjS2Hcz2PG76jtLdLrW2TKdqffF43LA0 lkH2SPtF1OuXLHVo8K43KAdeIajhZv1Y1KFG7B2q5mzez2cQK7+k/8gnwwNZx8BHCVGl nt1Y6F1IS4lX7d/FdsVt6X4uw0jwBIdAlU2sP9ss792MsBYnFrZ+OMGdcjLSWNuYZI9Z tr4RqhnDu0ippyaT7IEwxd7Lz0XQkTSNhRFwOacJm8uj1jtVgnlETrlA2HyFywibzsh/ KHyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697039401; x=1697644201; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=sDYBKIS55V1uI8CU7rsbxpgMy6trEjU+BP4wxaqMQ+0=; b=DLWUxhet/yVkWZFlYDafQKPlSa2dZQrw+CfxZSJ3LJThHJUcfTUXKfB7120e4Jp8EQ rHDnbRMpqf2h7SlPv1TUx3nf/bvnXadkYx+3tFCeMntJMoyeQD1vRswkrfxDldFQgbHf H+GhrnGhlxcHXgjKRTYYYoAglDUZqZz2w6DXOlRbqqcwTmvLfm33Nj1/noDZikWfDEdh 92V0LTaRbx5itSLf1Hplcm/RN7A8J3LkxD5QwhoshtBTa7nGXETXz58nWPy8lSnDjTMa RELI1lPaAjq9jfD0iWpqOdZudoaEl0O+9WhqOdr8k+mzd3fLVavE/HvIUIWd5u2fm6ff Trfg== X-Gm-Message-State: AOJu0YyDWTb44cjcBe5lsSwIC/sXxYKunzBKxQJ9mgKMX0yJDe3bzveW IQAO1rhRghs5EUza6im4x48= X-Received: by 2002:a17:90b:1496:b0:27c:f88f:11a5 with SMTP id js22-20020a17090b149600b0027cf88f11a5mr3826613pjb.2.1697039401382; Wed, 11 Oct 2023 08:50:01 -0700 (PDT) Received: from [192.168.0.152] ([103.75.161.210]) by smtp.gmail.com with ESMTPSA id mz14-20020a17090b378e00b0027722832498sm59877pjb.52.2023.10.11.08.49.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 11 Oct 2023 08:50:00 -0700 (PDT) Message-ID: <3073e9a6-9f10-4326-9734-7e203d509888@gmail.com> Date: Wed, 11 Oct 2023 21:19:51 +0530 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] Remove extra unlock for the mutex Content-Language: en-US To: Greg KH Cc: davem@davemloft.net, dsahern@kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, linux-kernel@vger.kernel.org References: <20231010224630.238254-1-singhabhinav9051571833@gmail.com> <2023101136-irritate-shrine-cde6@gregkh> From: Abhinav Singh In-Reply-To: <2023101136-irritate-shrine-cde6@gregkh> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=3.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_SBL_CSS, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Wed, 11 Oct 2023 08:50:13 -0700 (PDT) X-Spam-Level: ** On 10/11/23 12:00, Greg KH wrote: > On Wed, Oct 11, 2023 at 04:16:30AM +0530, Abhinav Singh wrote: >> There is a double unlock on mutex. This can cause undefined behaviour. >> >> Signed-off-by: Abhinav Singh >> --- >> net/ipv4/inet_connection_sock.c | 1 - >> 1 file changed, 1 deletion(-) >> >> diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c >> index aeebe8816689..f11fe8c727a4 100644 >> --- a/net/ipv4/inet_connection_sock.c >> +++ b/net/ipv4/inet_connection_sock.c >> @@ -597,7 +597,6 @@ int inet_csk_get_port(struct sock *sk, unsigned short snum) >> } >> if (head2_lock_acquired) >> spin_unlock(&head2->lock); >> - spin_unlock_bh(&head->lock); > > How was this tested? > > And where is the now-needed unlock of the head->lock? > > How was this change found? > > And your subject line needs a lot of work... > > thanks, > > greg k-h Hello, I used sparse tool and got it this warning message "warning: context imbalance in 'inet_csk_get_port' - unexpected unlock" Due to my over excitement of sending a good patch to kernel I didnt see correctly and misread `head` as `head2` and thought it was double unlocking the mutex. I m very sorry. But on a different note think we should do a check for `head->lock` as well before unlocking. Unlocking a non locked mutex can also trigger a undefined behaviour. Thank you, Abhinav Singh