From patchwork Wed Jan 17 16:14:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 188888 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:414:b0:176:5f3:c5eb with SMTP id 20csp783690rwd; Wed, 17 Jan 2024 08:23:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IFduIzMYmCTq5miI4ogO5oq//ZKMf7c5cjuKJGGZLBS8/MAc4a5vkA5m4Fvsai8NiTCWXFz X-Received: by 2002:a05:6a20:b79c:b0:19b:1191:50a6 with SMTP id fh28-20020a056a20b79c00b0019b119150a6mr1133757pzb.53.1705508620597; Wed, 17 Jan 2024 08:23:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705508620; cv=pass; d=google.com; s=arc-20160816; b=KUdVw9yt0sQIa1YWqJfGRUOH1zYNlqDLt66d28FfC+937c/ly9dzPQgx721W6r8QT8 uITugbCrAq6Dfevj6wlBnGN/AiFxwR4f9t1sCTrlbkP9IVjxyVQGbaY7ySODq6MJhFya yPdkGVD2fPxtS15/KGto3mrdU/0P3VSPeimqhcnulSH6kimhUARG7PrM1jzegesdmSoP 6WvhgUmc40vSnweSktjSZkQZAEijDA/dJY1HZTPrtyk40gYuVCHjvFaIiJVNEuiSuAY2 fgN0VT98MpEqWBaOZbbPCNcm93cligBC/tTO1ygKGh1b6F0xk/ZXitMLq1FK4iqt5+I9 CsVw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:content-transfer-encoding:content-id:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:subject:cc:to :from:organization:dkim-signature; bh=LeaeQDlEh2LuJK20KLIGSOeAcFEeBt+olazsW/kSruE=; fh=N23S1vBP9xl2gY8to3CDHaBH+cnULDtBu+nhgxQYUQ4=; b=RppX/00MjBmehnAG/8Mqu3NsuTjTbf/q27vfzefdccGe69TuN1izYhP+0H7U6Twxwm wqZlRJKv5JTCW7FNw4uOEaiXinbbyovoCKdhn36S0PZIoFZk3Yd5iZM2vh4zPR/F3vtE wvPiKKqTVtHscGpMNRaa7VyE7sfdn5gYYBa3K4W85qDqOrY5AgF0CuXAWiQljbh3ln7U SkmrWbXLTLV/oGrgRzfcPeC9IoQAIyQcCv5piFNPsIfKmTeBwuKFESdZ9+SbzbzB30Pd krNcb+qdVE+HFGs9Zw5IIlWJLpb1EZVS4BsBIHw11tEBHhrlPtx3dFK51URx6RAs/lqz gGYA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JpgodsjU; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-29198-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29198-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id r6-20020a632b06000000b005ccf10e73b9si13366060pgr.726.2024.01.17.08.23.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 08:23:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-29198-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JpgodsjU; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-29198-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29198-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 24EB2B23F17 for ; Wed, 17 Jan 2024 16:15:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B60F3224CA; Wed, 17 Jan 2024 16:14:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="JpgodsjU" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 851AF2230A for ; Wed, 17 Jan 2024 16:14:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705508090; cv=none; b=ClKUYQTuw5Fz6Q8xFv2ToXxeWKKU2b+/eOwGBkc5WqvkvD1J6QM6yVNg0md6WqDdlDEF7en3vCfmWNTuojdk37v1PkcN0lJdgvny3b2WaneSj4vrB7FrLIEskUDTULwP/4TThHH4npKeJIb5TU6CRe3ahUTjTML78IqumDfslxI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705508090; c=relaxed/simple; bh=NNp7EBLIzaXw/7mCitS2vMhUdRanFmB9E2Mm7QsT++E=; h=DKIM-Signature:Received:X-MC-Unique:Received:Received: Organization:From:To:cc:Subject:MIME-Version:Content-Type: Content-ID:Content-Transfer-Encoding:Date:Message-ID:X-Scanned-By; b=isIpFiROjDOGVeFutE0mEkVGw7CoirqUJwT8yes9PDAZ75e30ma/P0y7W5FPHMqNc37yr7qNGDKew6VBUP1czHxQX+RfrHe+fRXLUW49hqWiI3uwD+59/D5UYY471jWtWE/z4nhc9S6kJMXiMJfU0NlKrWfpEL6uf4RHMPkef0M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=JpgodsjU; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705508087; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LeaeQDlEh2LuJK20KLIGSOeAcFEeBt+olazsW/kSruE=; b=JpgodsjU4OnnPGhLUlDeWFVdrlasHfudeUdaUgKQBJ0fuXptJlzZ9IJVVgXEQHbDEP9eUF pLq+Ya+3mrtGLaR6CiR63cI8taIbLVdttZyDkn3/VaidXu+GT0r29CSVGCLl8lPX5EdMtt teRSDmbSOYPMWs8domg21Vlyx39jP/8= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-61-V68_g6WuPauNusTbKnV1XA-1; Wed, 17 Jan 2024 11:14:43 -0500 X-MC-Unique: V68_g6WuPauNusTbKnV1XA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7B75D85A58F; Wed, 17 Jan 2024 16:14:43 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id D0DA12026D6F; Wed, 17 Jan 2024 16:14:42 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells To: Marc Dionne cc: dhowells@redhat.com, linux-afs@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] afs: Fix missing/incorrect unlocking of RCU read lock Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-ID: <2929033.1705508081.1@warthog.procyon.org.uk> Date: Wed, 17 Jan 2024 16:14:42 +0000 Message-ID: <2929034.1705508082@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788355358943240231 X-GMAIL-MSGID: 1788355407237882273 In afs_proc_addr_prefs_show(), we need to unlock the RCU read lock in both places before returning (and not lock it again). Fixes: f94f70d39cc2 ("afs: Provide a way to configure address priorities") Reported-by: Marc Dionne Signed-off-by: David Howells cc: linux-afs@lists.infradead.org cc: linux-fsdevel@vger.kernel.org --- fs/afs/proc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/afs/proc.c b/fs/afs/proc.c index 3bd02571f30d..15eab053af6d 100644 --- a/fs/afs/proc.c +++ b/fs/afs/proc.c @@ -166,7 +166,7 @@ static int afs_proc_addr_prefs_show(struct seq_file *m, void *v) if (!preflist) { seq_puts(m, "NO PREFS\n"); - return 0; + goto out; } seq_printf(m, "PROT SUBNET PRIOR (v=%u n=%u/%u/%u)\n", @@ -191,7 +191,8 @@ static int afs_proc_addr_prefs_show(struct seq_file *m, void *v) } } - rcu_read_lock(); +out: + rcu_read_unlock(); return 0; }