Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4959257rwl; Mon, 10 Apr 2023 21:01:39 -0700 (PDT) X-Google-Smtp-Source: AKy350aGkrki319HcIZacsztcmaOrk+29wyGyk4h+axZaqLEPGY2zRvxoFOYxR9HsreVBd2hgwA1 X-Received: by 2002:a17:906:58:b0:8b1:7ae9:647 with SMTP id 24-20020a170906005800b008b17ae90647mr8648744ejg.76.1681185699560; Mon, 10 Apr 2023 21:01:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681185699; cv=none; d=google.com; s=arc-20160816; b=gWH1Vm6F4vKjL4WvnWD882NQmKMmCpb3onUeurHs1ztNM60+ReDJYdU6rE9Ug11gBp 429LdawnnHs8IoHHjaDtjcDMrYwwASzUdb7bXNogcoWo2ZYx5p7NJG8aQ1Aki5V3wNQ8 kJYQbQkb5NTQp4s4ElW1S5YEcpqJM2tExWvDhcYfPNgYiu6nIGDKbugc542KQd/coef/ j9IPuJZ0qEA+jHFKUA25ARCMooz+WBplWK3U5mJHuI3LIwyvNRkojsy9q9BwiTnG2Qe2 NjnC4ag569RgTdueDLDPn7BG8pistsk9vQpkQKvA9B+CM74yS5XM8fLng3Pi1oerysBo TFcA== 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:subject:cc:to:from:date :dkim-signature; bh=oZ6b4IvXomOLMZcsdxc1um7Ep1fw1jWLtt/lNkkj+cc=; b=KoU53OyITgjOvsihFH8F9gtcoq+6+Hb4Hwl+UUS/eutNF5QKcf4hzj/cAPE9Fjbntr HelhTZOCQrUxg3ACE7Ea+HkS2X3wlrx9YZLc709oNfdBSAAdSDdMnLh67xK3u+N5cy2/ GwN5AKiox+DgHbO5nCyHnVK8yYt7ILphMnTpZIpKf5WCZpiFEKN3bCC99O9BPhydEFaC OmjQKmO/BcKFFhHXou8IAIN9egFAN0HonFECdNwFMTd0RhjVoJDlUt6aAVlvS3Y51Tty 0vJJuRUi6ntQxvJfuJpvx0A3lR5HQviuk+hEMeCpZMcD/7NKMqWBNDV+9rxgS/dvuGeG Brqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=mfhMjkon; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i7-20020a170906114700b0094a6a7b7501si4088902eja.1022.2023.04.10.21.01.14; Mon, 10 Apr 2023 21:01:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=mfhMjkon; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229878AbjDKDxV (ORCPT + 99 others); Mon, 10 Apr 2023 23:53:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229688AbjDKDxU (ORCPT ); Mon, 10 Apr 2023 23:53:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A85E91BE8; Mon, 10 Apr 2023 20:53:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4602262103; Tue, 11 Apr 2023 03:53:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2CF66C433D2; Tue, 11 Apr 2023 03:53:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1681185198; bh=VneM/8GV+SlOghqkLJDB+EPmgjM+OaU8GzefY4bkqOg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=mfhMjkonqMODs2Cp+/3AS8hxWUpg3g9lpO0zaU1R2z0r0E4J2Q9HeRV+Ce6w5f6Qp x0u1AWmPa6WLo317fBrQ9GPBAU06LswGMSaMnNmpPI0C/iJUSvrQjDMdMRucQgkqWt /zibjUB6F+1YsXQUkjmgBGT6ZbEQhhHE84Qo9L+I= Date: Mon, 10 Apr 2023 20:53:17 -0700 From: Andrew Morton To: Baokun Li Cc: , , , , , , , , , , , Subject: Re: [PATCH v2] writeback, cgroup: fix null-ptr-deref write in bdi_split_work_to_wbs Message-Id: <20230410205317.dcb186166b9603eeb876dfda@linux-foundation.org> In-Reply-To: <20230410130826.1492525-1-libaokun1@huawei.com> References: <20230410130826.1492525-1-libaokun1@huawei.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 10 Apr 2023 21:08:26 +0800 Baokun Li wrote: > > ... > > To solve this problem, percpu_ref_exit() is called under RCU protection > to avoid race between cgwb_release_workfn() and bdi_split_work_to_wbs(). > Moreover, replace wb_get() with wb_tryget() in bdi_split_work_to_wbs(), > and skip the current wb if wb_tryget() fails because the wb has already > been shutdown. > > Fixes: b817525a4a80 ("writeback: bdi_writeback iteration must not skip dying ones") > Fixes: f3b6a6df38aa ("writeback, cgroup: keep list of inodes attached to bdi_writeback") Two Fixes: is awkward. The Fixes: serves a guide to which kernel versions should be patched, but those two commits are six years apart. So... how far back should this fix be backported? > fs/fs-writeback.c | 17 ++++++++++------- > mm/backing-dev.c | 12 ++++++++++-- Jens, which tree do you think should carry this?