Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp443928ybz; Wed, 29 Apr 2020 03:08:45 -0700 (PDT) X-Google-Smtp-Source: APiQypIa1uVU13xrTtGlFzWQDf0CtJrJfk1mY1lmiZdVp2ZD+VN9Y1l5o2sRBwFAHDejAm8dwQZe X-Received: by 2002:aa7:cf94:: with SMTP id z20mr1586468edx.302.1588154925779; Wed, 29 Apr 2020 03:08:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588154925; cv=none; d=google.com; s=arc-20160816; b=gKJ042A0Hs9lKjELRS8IeXIxNsOWSfBARTrMSLO3E35/07/+0FwryI+vNJXLOlCzC1 PDzXzZ3qc3DdMfBULg4NP3dfPRIhgqlRLRY4c+ridQJogEk3727O8MmPUU/h9fFVZ4MQ bJKzLZW/EY+njpKnD1UL24gqyCFVxZKroTJkZK/vRdZy4qMruIyms80fxcs708WHw9G7 8pDVPgfxCWv7yRDt4VH4mMWP3meyBziT6v+4ZNfyqKlz9XgaEvYrxZb6an+w+2thd4Gd E3CuSNTpJEodtelB061G+07Kliwc3hxCuerIlZjqsL62qeO25JenyMnt5rjxf3W2wLxe wijw== 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=c/UH3Lz8UpllzExG3i9isFfsDyna9aZhQQaKA33NG2U=; b=IXUpRZBKRfWTFqR3EBOojWs+4pRgrD/NHUkOepVFrWy2KqFemKeAtSWRCJtuqnzkoP b8L2ynDvUG0wufhPkZ4m9iqoFqfZvlt8adLLKigqejRUN7Zsj7oVJ8ugo8SfVsH3/Y6+ //37zHS/7a9uXo5Es6znl2UsZl9FLxgOXxqcnt6zmerNfNTFkwddZZ0EJ/ax2FJyaLc5 VYDl/1wjmzd5O4iA3hBi2QU0qHa6CsDvNM4y/2JrI3/LUO/uzXllQIHfoyQfcTA0YIrM uQc0IiUCPHSRA6NnuEzjJfuFVLSuj93B4OX+nn3yU5dGQ1xImoW4xs7JzxmrDL5yYJIn 9OWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oPjxlQW7; 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 c16si2643262edw.172.2020.04.29.03.08.22; Wed, 29 Apr 2020 03:08:45 -0700 (PDT) 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=20161025 header.b=oPjxlQW7; 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 S1726862AbgD2KGx (ORCPT + 99 others); Wed, 29 Apr 2020 06:06:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726765AbgD2KGr (ORCPT ); Wed, 29 Apr 2020 06:06:47 -0400 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83131C035493; Wed, 29 Apr 2020 03:06:47 -0700 (PDT) Received: by mail-wr1-x443.google.com with SMTP id x18so1793397wrq.2; Wed, 29 Apr 2020 03:06:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=c/UH3Lz8UpllzExG3i9isFfsDyna9aZhQQaKA33NG2U=; b=oPjxlQW77C9agVidyEJWF8dsdIZ1WaFCRAecF8V/z1nEUZTODgmjOlbYt01DNFhJZY Yp1JgAvJjJH7eDCEyIMLeOAPK+bUurZKaTS6IOSq8bYdsF0ngcFr+QQMSH53VfJmPa1D 00rT6TnmzQVdmVxh+kGqRqtWOJT/oLNOpYqAyRXgsFCZ3gVHp4U4EGBukli3cPfJkhru TL6eAqrmxPC9eKiPhN/LgAjQSzrsMzjHYwoYzmsOHPtshJXj+YgbQfWXhSXFbt86IW0/ Gi4LH2SxpKGm7N7FtPDRIbYyG8yRdWI1iBoJ5YTJMfonPlY5U6sVDCfx5C5B35mm7Ihm eT7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=c/UH3Lz8UpllzExG3i9isFfsDyna9aZhQQaKA33NG2U=; b=ozDns+OFUnmEPZZAIBcwAOVm91vL600TqrXnAbnYd4Oy2rkgYMHNXqFoXy6LXLzpYr +hXnPZ8t3mVOnYd3c0eE8/su0Ny1w02Jsu3Yc4bY5av6MZoQvxQ/F+54oO+Jz1BAxt9T EhZhNhJA7Q2noC7A9N8nOFOu3rkR51UhNEk4+5kZeTyn2pX0FlyTpQghKGqaJ2JLbOX9 m3oj2gtbLrL8iLKvwsTETgJYlRy6+C/9tEh3Ct2E8i6Mqm6TMZ3mXcjClQV26lwWEvZa IsiBkDN4wf+VprsAHa/cniWFHeDA9wdPYtRJ5m5zU+5Kc7greWZrKjS8Hj04vMow9ony Hong== X-Gm-Message-State: AGi0PuaPuTWZUOMQpxSws9wxmS3o0V9MVgp6xdAbNyp7iUzt63bvslq6 ICc3gnDUmccB+ev04cNX0UPcdJN3XP2d X-Received: by 2002:adf:b310:: with SMTP id j16mr40764270wrd.95.1588154805951; Wed, 29 Apr 2020 03:06:45 -0700 (PDT) Received: from ninjahost.lan (host-2-102-14-195.as13285.net. [2.102.14.195]) by smtp.gmail.com with ESMTPSA id 1sm7205478wmi.0.2020.04.29.03.06.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Apr 2020 03:06:45 -0700 (PDT) From: Jules Irenge To: linux-kernel@vger.kernel.org Cc: "David S. Miller" , Alexey Kuznetsov , Hideaki YOSHIFUJI , Jakub Kicinski , netdev@vger.kernel.org (open list:NETWORKING [IPv4/IPv6]) Subject: [PATCH 3/6] udp: Add annotations for udp_rmem_release() Date: Wed, 29 Apr 2020 11:05:25 +0100 Message-Id: <20200429100529.19645-4-jbi.octave@gmail.com> X-Mailer: git-send-email 2.25.3 In-Reply-To: <20200429100529.19645-1-jbi.octave@gmail.com> References: <0/6> <20200429100529.19645-1-jbi.octave@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Sparse reports a warning warning: context imbalance in udp_rmem_release() - unexpected unlock To fix this, __acquire(&sk_queue->lock) and __release(&sk_queue->lock) annotations are added in case the condition is not met. This add basically tell Sparse and not GCC to shutdown the warning Add __acquire(&sk_queue->lock) annotation Add the __release(&sk_queue->lock) annotation Signed-off-by: Jules Irenge --- net/ipv4/udp.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 5ca12a945ac3..175bd14bfac8 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -1382,6 +1382,9 @@ static void udp_rmem_release(struct sock *sk, int size, int partial, sk_queue = &sk->sk_receive_queue; if (!rx_queue_lock_held) spin_lock(&sk_queue->lock); + else + /* annotation for sparse */ + __acquire(&sk_queue->lock); sk->sk_forward_alloc += size; @@ -1398,6 +1401,9 @@ static void udp_rmem_release(struct sock *sk, int size, int partial, if (!rx_queue_lock_held) spin_unlock(&sk_queue->lock); + else + /* annotation for sparse */ + __release(&sk_queue->lock); } /* Note: called with reader_queue.lock held. -- 2.25.3