Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp1360993pxb; Fri, 21 Jan 2022 16:30:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJyn0qGhEAvJsRXkKQ2lUDpL3V+kll6IJ95NJ1Fg7qDd7ZVXgdlHiWYECP08lsIqouI0A30t X-Received: by 2002:a17:903:1250:b0:149:907d:afdc with SMTP id u16-20020a170903125000b00149907dafdcmr6038053plh.59.1642811455541; Fri, 21 Jan 2022 16:30:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642811455; cv=none; d=google.com; s=arc-20160816; b=BZbo7ygZ6L3pkpL89cPuARBH8JJKjKoU545f1YKojdUKaoD8XDNIMShwFeiFcBOW+V 0kAalPbhzi/SlSw5XVsfvMfC2gUKvsny3bg8MKM8b6nV02kE785a6x316E5jLI4khOt7 JHUO0Tsp9Z1SgtcqLcPdTHRurDf5s4wff6VR//J3gowcdMNOtAnIlIvV0d5BQngkg+EN 4DDwz09O52kKtCNlCqYWEJ48OwIxTvL7dhH4FftdlWSOZhmHT6NauMowEFqD0/vw6uo/ sRMecOSeF361OoRiDZG0ifdSwjV+uhOlNGcqgfhnU7Hy8Gj0itmzekR6etddeDUmpLaz O55g== 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=qTWPgy4C4f7UzSODMqHX14vkvQj4GpRA6whe421B97A=; b=i4ZPlRsC7ST6TOpoeamysYymeJ/9EJaK7cataNoTV1VdkzGUT1aaUWVnUPece927Jb EdL5lth07tOU8HmDTwjXgMQZAf2zAAPJioB4E3hkFLOhwk0aBO7FZOXYCX5f26eMv8YA BdHfBEPQLSxbwlZFqQX7gM6pelYOjzvVQWsw8OheHv7Un4GUVjUWOZW47Q7ZeihT9n8/ xIOLIYlmhqYvgtHoA5zuMWCfmkM+wea3KKam3OVPJ+6IcviJ0B4lb7D7eua90CObfT+8 9gYq6Z/lhxiFtVKvjJpYQ4zp9ONtEi5+r1t9GZFkvA5NPZMni1YEb46fC5ftxls877U5 xtJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=PSHXzJx+; 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 h4si7737583pgc.795.2022.01.21.16.30.43; Fri, 21 Jan 2022 16:30:55 -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=PSHXzJx+; 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 S232597AbiAUDQP (ORCPT + 99 others); Thu, 20 Jan 2022 22:16:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230085AbiAUDQO (ORCPT ); Thu, 20 Jan 2022 22:16:14 -0500 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38F8DC061574; Thu, 20 Jan 2022 19:16:14 -0800 (PST) Received: by mail-pj1-x1034.google.com with SMTP id d10-20020a17090a498a00b001b33bc40d01so5208089pjh.1; Thu, 20 Jan 2022 19:16:14 -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=qTWPgy4C4f7UzSODMqHX14vkvQj4GpRA6whe421B97A=; b=PSHXzJx+8QfHQGwM//vKlk5vUHTIkRZ7hfe7g5kIEgxmaNvEdYSRwfXTxVGvCNVqle RcyPkJ94e7woYYXMRskxLwe2oheXsTK+t9QCcLKV8H2W4tk9ulIdKVJbUO0H9wQGyJSq oBa02NZEgrymvL/U3xb8aMa109zaB4TGcGPuh0dApOqHmmXOYmjMyO0EsAN0lOLdKE79 2/7mhL2fOU//SDu+k5WR86On3ghlKCCwv0Z2VkDKR6KdqxTydRw+XcxUdBV3zt7xds9K 2rCxQY+tku+nkCzqer3w7f/wFAkUINkuuDLXacJyqyBWdqzEmJZrYSPUoHcpj4tU4JsE IgQg== 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=qTWPgy4C4f7UzSODMqHX14vkvQj4GpRA6whe421B97A=; b=iMxroYfLyNN8qzOSqbvWhEf+qPoLsLhOpZpmVcmdKM5qMeFAKSVf680BTaO30xSm+c hVCf1wRyC/8xKwCD1FhmNL+7nIAznpY16rxYZzlbHvwFL5dXLqWKUFBit+2f6BZ4ru8z aXGSdbH8bz9DDNez4gl91f3pEUv19n+sharPDP5q9sYfgCdX6SGn3i6iAnOgv9lj/t9l R1V+Y4tNuQLsW4ZQsmYf2kNgr81K/EsfqvTq1ayaRjPX2XC5+j0XAbL8DYda/bBSTKfC KgXXPqns0/7GFyF+KSIuauoZjOe+Y1Rr7Nsh1lzwghyczh10pPlsbGTjOeLyqQ01PdWb 9SXQ== X-Gm-Message-State: AOAM5335eGrImC0Ne6r4lxsBE33gFoGUDWdgn0tqSMGYLNmzh/0palW1 YZeo3y+gbk1Ffo7IOUBhMMc= X-Received: by 2002:a17:902:dacf:b0:14b:2081:1c20 with SMTP id q15-20020a170902dacf00b0014b20811c20mr155152plx.13.1642734973709; Thu, 20 Jan 2022 19:16:13 -0800 (PST) Received: from localhost.localdomain ([106.11.30.62]) by smtp.gmail.com with ESMTPSA id t2sm4954821pfj.170.2022.01.20.19.16.10 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Jan 2022 19:16:13 -0800 (PST) From: ycaibb To: davem@davemloft.net, yoshfuji@linux-ipv6.org, dsahern@kernel.org, kuba@kernel.org, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, kafai@fb.com, songliubraving@fb.com, yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org Cc: netdev@vger.kernel.org, ycaibb@gmail.com, linux-kernel@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH] inet: missing lock releases in udp.c Date: Fri, 21 Jan 2022 11:15:53 +0800 Message-Id: <20220121031553.5342-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 udp_get_first, the lock hslot->lock is not released when afinfo->family == AF_UNSPEC || sk->sk_family == afinfo->family is true. This patch fixes the problem by adding the unlock statement. Signed-off-by: Ryan Cai --- net/ipv4/udp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 23b05e28490b..f7d573ecaafb 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -2967,6 +2967,7 @@ static struct sock *udp_get_first(struct seq_file *seq, int start) continue; if (afinfo->family == AF_UNSPEC || sk->sk_family == afinfo->family) + spin_unlock_bh(&hslot->lock); goto found; } spin_unlock_bh(&hslot->lock); -- 2.33.0