Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp613728rdb; Fri, 17 Nov 2023 07:57:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IFQS3z9MablmCXKop8MJW3Z3i1wKYsLdTrwDAG9Q7VUiFw/s2xtoADzjITrk1B+gsNflgX9 X-Received: by 2002:a05:6a20:1607:b0:15e:9923:3e35 with SMTP id l7-20020a056a20160700b0015e99233e35mr8085735pzj.19.1700236679513; Fri, 17 Nov 2023 07:57:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700236679; cv=none; d=google.com; s=arc-20160816; b=NcnGuHSKCt9FilwAKmSXkve+6eJ35RKzHVYRqO/spk19lPPYyD9XLxpzAlTVlH/WYE ZgIxhFZZa62hmVFfjAyxV+rlyNfjAFaNqBbchn0s2DeR91AZykpK9yVY1jSBds/ljU+W 31G3en/YEKS0YlPI1JD+Xs0R/nAQw63b8vuDUTXiRAThmHdmfLHinVkpZoViCabE892s CRdZJkZwriL6rxih2Ak+t34IBZgJCxIsnpcUXdg/jq+0ib5nM2qGj0EkfVBfwEeTfgWP fVIVwNF9vkOQTwE3R74nVowtAhN26fuhibwyTyt39icAvNmaFCVzvxRcFWNPUT5q0vjF tSQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=8r8XQO/iZuog4x2O4uOT2Mh6z9zFHISlZnqdIDEabAE=; fh=20CwuCdTqc/M7aUNuGvc7MigwPvKHVIP79cSoTphTxs=; b=rZJDN0DKiJydvpPzPdIb4j0yJBbA1GU9uW2qRV+f+HXoYzEv+KiqISWi7XzuwGdmYc 0sRxbZPnp+FxkskmufBPrN6yGbrykBhyjPpafuL8I4VjvRU1aE+jLrDteqGIz34l4ZI5 gtvntTJtta02V8dbZMB9Zs1m3oi18/IbchRvRBgPWnzZNMRGkZ4PvsZRuzjgHPljR0CC GSydGOIl7XVac/GhEKZF2NXUmwLK8tVtwyUiqlyO7wvY5FzV7F/Y2S5KbAcHEDf+cIqs K3tI+rgU10TdEsbse1MHkmg+IhuIJaZ00XdEZoTTXZMcJmZrbLewAy7gCXG3OBQU39aZ ying== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=auristor.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id y38-20020a634b26000000b0059d48c43152si2101964pga.40.2023.11.17.07.57.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 07:57:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=auristor.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 2D22181EB0F2; Fri, 17 Nov 2023 07:57:57 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231562AbjKQP5v convert rfc822-to-8bit (ORCPT + 99 others); Fri, 17 Nov 2023 10:57:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230383AbjKQP5u (ORCPT ); Fri, 17 Nov 2023 10:57:50 -0500 Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1690A5; Fri, 17 Nov 2023 07:57:46 -0800 (PST) Received: by mail-ed1-f42.google.com with SMTP id 4fb4d7f45d1cf-5431614d90eso3172775a12.1; Fri, 17 Nov 2023 07:57:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700236665; x=1700841465; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+N8Rkxs1VdZPQNYmn5RsQKxDMuZgXUMJtgtu8KsLn60=; b=epjJ1NHMn5+CoTBPqudJHiWFubTn4inB4G+QKnF4y4jJm6mFcLOVCY7Me8KcournOv Ffmfds7e5+9dWBKoId4URRAv+y2jW6rMA8mdBVWzYH87SjuZ9WpsNrMLKqy7AugEe1iE MKEa2YNhrJFY7oWUStB2xk9sgNnXOiqTpfPSN24Rw097BXAWEDWV/0CLZUxcDlJAG0dk 99EgZTo6QvI22fCv1IdJSed55JE11yBh1GLE2Y0t2JZK0Xagrd9CFkH+oe7d3UnjRzS7 1E45NbMVmgjVPkeP5hoRbeqSBWSBh13tGh6X5bN6t6gwqVfDpjxfpSsuaUWYh/v2HJPu GzVA== X-Gm-Message-State: AOJu0YxQokOk/69P5SLpgZpMKyoeeJRnwOWnwHvcyMHYaBzHrR5hxn5K vflHFSmdrxfaS1/f6npIVlc5D4ad9hwybQ== X-Received: by 2002:a05:6402:42d0:b0:548:656b:629b with SMTP id i16-20020a05640242d000b00548656b629bmr51755edc.25.1700236664789; Fri, 17 Nov 2023 07:57:44 -0800 (PST) Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com. [209.85.218.47]) by smtp.gmail.com with ESMTPSA id m21-20020aa7d355000000b00546dc1b5515sm831507edr.94.2023.11.17.07.57.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 17 Nov 2023 07:57:44 -0800 (PST) Received: by mail-ej1-f47.google.com with SMTP id a640c23a62f3a-9ae2cc4d17eso302832066b.1; Fri, 17 Nov 2023 07:57:44 -0800 (PST) X-Received: by 2002:a17:907:7819:b0:9c3:d356:ad0c with SMTP id la25-20020a170907781900b009c3d356ad0cmr13299716ejc.24.1700236664516; Fri, 17 Nov 2023 07:57:44 -0800 (PST) MIME-Version: 1.0 References: <20231116155312.156593-1-dhowells@redhat.com> <20231116155312.156593-2-dhowells@redhat.com> In-Reply-To: <20231116155312.156593-2-dhowells@redhat.com> From: Marc Dionne Date: Fri, 17 Nov 2023 11:57:33 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/5] afs: Fix afs_server_list to be cleaned up with RCU To: David Howells Cc: linux-afs@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-0.8 required=5.0 tests=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 agentk.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 (agentk.vger.email [0.0.0.0]); Fri, 17 Nov 2023 07:57:57 -0800 (PST) On Thu, Nov 16, 2023 at 11:53 AM David Howells wrote: > > 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); > } > } Reviewed-by: Marc Dionne Marc