Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp3371333rdb; Thu, 16 Nov 2023 07:53:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IHlhYJgv5X7Xh56xDxNXZTO5Y+HAHhEhmm6FzxI8R9Hf3k7EKg7OP+W6HVvUzTbMdZJH6w3 X-Received: by 2002:a05:6a20:42a8:b0:187:d380:fd98 with SMTP id o40-20020a056a2042a800b00187d380fd98mr1455345pzj.44.1700150033835; Thu, 16 Nov 2023 07:53:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700150033; cv=none; d=google.com; s=arc-20160816; b=AZg+9Cysfv+GA4pWRpyqAbKSB7VcvRjqUpx6w1QNYZ6TcvFzggPAEnM4UvkHIy7k7V ZNKhOaIBy/Gry7IUGzs94tRaZ644J3trHDgMfGliQTA0rOe3lKqtXFEUUOO1Tiv2hLIr SYUtzdrFCgxej2BS6Gn56arVPmMVp8gF+WxUHzY7gO1zW+XCbi0QYumXVy3HbzaP3pIP UL4EYG3tXNr02TInuoVsiDlId33QDDF5HX8BE67RT0byTI32F/npQE59f/+f7/gPddMu 4i1KaLDLkjo03lRU4cIjrkGQXLDDRk7UwfvDwECiRIyc0bFTb0Ky+s7PMLKCSHbsRFLD 6miw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=S3Nkl26BdZ6XNwFHoko5KRDQDv/tiZrd51e5XRL9ph4=; fh=9hT4l0EMR1D2zdgUoRXiqFwsybSJyrmM/FC/blQlPsI=; b=M5FG7MWpwIqZ37NYkZM2++6/iVW+toX8xISjvY35uUZ0gSBkHbRdKvKxKYmDHTYcOB mdfwwyByKHDDRKFhKce8fGQq3Olnlk18bZy+beg+V689diJuweKyLhTRJsyXpuF00Kvu 09HajJCoOYjuJfOqQ5rPZYK2ari5OYKYBsde/JJVrjmkJmDBSdhC7mf/ufaQ9ooZcku5 cMdjusHAlIALKoeRYdxXBr19rAJnJt2hqBK1v5wqnHCZ5Cgyk5Pl2QidYpa9nBg6DPlO mNUY/c2OK8sYFEP7+ycw7V8IbFTYGM5nq5btSiiJIHrNF1mJ2Lp2NKa9SR6lXu0YurJd x1xQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ZuR36NRB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id q17-20020a62ae11000000b00690d8c05582si12206008pff.372.2023.11.16.07.53.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 07:53:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ZuR36NRB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 04E5A817C8A1; Thu, 16 Nov 2023 07:53:47 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345400AbjKPPx1 (ORCPT + 99 others); Thu, 16 Nov 2023 10:53:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345330AbjKPPxX (ORCPT ); Thu, 16 Nov 2023 10:53:23 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 644CF11F for ; Thu, 16 Nov 2023 07:53:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700149999; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=S3Nkl26BdZ6XNwFHoko5KRDQDv/tiZrd51e5XRL9ph4=; b=ZuR36NRBtX4DcVuNyzU0p+Dcd/tkcCiYx0aNE25IGclxGRBhZpdSh/qDDwynyIJNXIXbDC yOfkVIZqpmGJO4NC0gjh1vDx08kFlLI4CDzKavzuajUqZYvcx0poP4YJe2T+7W+GoNHTBt 698E3a3+ChdW7sosQcf3LvihTuZegOs= 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-414-TBf8Q3zzNiyerMSqa1Uyuw-1; Thu, 16 Nov 2023 10:53:18 -0500 X-MC-Unique: TBf8Q3zzNiyerMSqa1Uyuw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (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 BC8C28528C9; Thu, 16 Nov 2023 15:53:17 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id E770BC157E5; Thu, 16 Nov 2023 15:53:16 +0000 (UTC) From: David Howells To: Marc Dionne Cc: David Howells , linux-afs@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/5] afs: Fix afs_server_list to be cleaned up with RCU Date: Thu, 16 Nov 2023 15:53:08 +0000 Message-ID: <20231116155312.156593-2-dhowells@redhat.com> In-Reply-To: <20231116155312.156593-1-dhowells@redhat.com> References: <20231116155312.156593-1-dhowells@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.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 (lipwig.vger.email [0.0.0.0]); Thu, 16 Nov 2023 07:53:47 -0800 (PST) afs_server_list is accessed with the rcu_read_lock() held from volume->servers, so it needs to be cleaned up correctly. Fix this by using kfree_rcu() instead of kfree(). Fixes: 8a070a964877 ("afs: Detect cell aliases 1 - Cells with root volumes") Signed-off-by: David Howells cc: Marc Dionne cc: linux-afs@lists.infradead.org --- fs/afs/internal.h | 1 + fs/afs/server_list.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/afs/internal.h b/fs/afs/internal.h index c9cef3782b4a..a812952be1c9 100644 --- a/fs/afs/internal.h +++ b/fs/afs/internal.h @@ -553,6 +553,7 @@ struct afs_server_entry { }; struct afs_server_list { + struct rcu_head rcu; afs_volid_t vids[AFS_MAXTYPES]; /* Volume IDs */ refcount_t usage; unsigned char nr_servers; diff --git a/fs/afs/server_list.c b/fs/afs/server_list.c index ed9056703505..b59896b1de0a 100644 --- a/fs/afs/server_list.c +++ b/fs/afs/server_list.c @@ -17,7 +17,7 @@ void afs_put_serverlist(struct afs_net *net, struct afs_server_list *slist) for (i = 0; i < slist->nr_servers; i++) afs_unuse_server(net, slist->servers[i].server, afs_server_trace_put_slist); - kfree(slist); + kfree_rcu(slist, rcu); } }