From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 D664B370D5E for ; Mon, 3 Aug 2026 09:31:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785749524; cv=none; b=KnTz1aLEgdqJ/6+gxVCEyQ0unu5+ENTOGA9mlF/eUcE84Do+Y4Czc4zTgX5hWAJQvServZVJ3YbQ+2kHmSfEZEEynCacCtdBR6wPf0kMrAQ3Ur+ZoTAsL3LnfPdWSDKQY49Mt0UR6RNjtPKHItRCJb49jCWGRQQv8otIrrcjHAs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785749524; c=relaxed/simple; bh=j+9YgFfjOxpqbIyBkXCrSq3FceanZKsIuakXnH/rBWs=; h=Message-ID:Date:MIME-Version:Cc:Subject:To:References:From: In-Reply-To:Content-Type; b=h8l33wpAHJCz1r5nMMs+M0YlWb4rDAx4+oqA2q4n6fbWDBnxdgAEx5/gq5mYG5126bN+quDRG0VTw8PQG0zul3nWdUXpJpgeS//TlK9ul/RKXHZ9Rwo8ja1HbFQJC+NNRxHBTio1PgboW41Q+aSTx6bbvSPKw7GJnCafLa/w/Og= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LgL/97RU; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LgL/97RU" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5D591F000E9; Mon, 3 Aug 2026 09:31:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1785749510; bh=oaBLOP9AFgMylfQ9JuKvumZBzT5RDhSyXI9epCNyMHY=; h=Date:Cc:Subject:To:References:From:In-Reply-To; b=LgL/97RUsuglTZYA3bmGlgXetp6OvGKHObeyoby/KdoU9MM6uLKtwzY2M9Yc7+N+f 9VOMpHWZOeK/byYmoVAmxHZZmhjOUyZqP84T+2G5Hr0qKD04/NXkqxFB6uWjtM7e15 iuBV5RUZZ0h83h/nebFCfwCeyuRavzaNzNQcR6MuTyseOGUOmg8GtCEUk2bQ6/Q1gy ItfWOHmwoGQazmaWqNuPSWgU5avc1gAKhztf5Q/kp0UWOXwq3yL4in/IrPzgXN6C6Z Vva9DzdO2f8lvgQOyBgJpRWY09RxaXkGUaWowiCJ9FHOtYioUmgsjogBlM5jSAPf+5 FFmOUud7lRS+w== Message-ID: Date: Mon, 3 Aug 2026 17:31:46 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Cc: chao@kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, qiwenjie@xiaomi.com, stable@kernel.org Subject: Re: [PATCH v2 1/2] f2fs: avoid NULL checkpoint thread access in sysfs To: Wenjie Qi , jaegeuk@kernel.org References: <20260803092307.1437283-1-qiwenjie@xiaomi.com> Content-Language: en-US From: Chao Yu In-Reply-To: <20260803092307.1437283-1-qiwenjie@xiaomi.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit This patch should include below change? otherwise it's not a self-contained fix. @@ -1007,13 +1007,15 @@ static ssize_t f2fs_sbi_store(struct f2fs_attr *a, ssize_t ret; bool gc_entry = (!strcmp(a->attr.name, "gc_urgent") || a->struct_type == GC_THREAD); + bool thread_entry = !strcmp(a->attr.name, "ckpt_thread_ioprio"); - if (gc_entry) { + if (gc_entry || thread_entry) { if (!down_read_trylock(&sbi->sb->s_umount)) return -EAGAIN; } ret = __sbi_store(a, sbi, buf, count); - if (gc_entry) + if (gc_entry || thread_entry) up_read(&sbi->sb->s_umount); On 8/3/26 17:23, Wenjie Qi wrote: > checkpoint_merge can be enabled even when no checkpoint merge thread is > running. A read-only mount is one case: f2fs does not start > f2fs_issue_ckpt there, but ckpt_thread_ioprio is still writable through > sysfs. > > The ckpt_thread_ioprio store path updates the saved ioprio value and, > when checkpoint_merge is enabled, calls set_task_ioprio() for the > checkpoint thread. If cprc->f2fs_issue_ckpt is NULL, that dereferences a > NULL task pointer. > > Keep storing the requested ioprio, but apply it only when the > checkpoint thread exists. > > Fixes: e65920661708 ("f2fs: add ckpt_thread_ioprio sysfs node") > Cc: stable@kernel.org > Signed-off-by: Wenjie Qi > --- > fs/f2fs/sysfs.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c > index be92c05a5420..070f9807ae81 100644 > --- a/fs/f2fs/sysfs.c > +++ b/fs/f2fs/sysfs.c > @@ -557,7 +557,7 @@ static ssize_t __sbi_store(struct f2fs_attr *a, > return -EINVAL; > > cprc->ckpt_thread_ioprio = IOPRIO_PRIO_VALUE(class, level); > - if (test_opt(sbi, MERGE_CHECKPOINT)) { > + if (cprc->f2fs_issue_ckpt) { > ret = set_task_ioprio(cprc->f2fs_issue_ckpt, > cprc->ckpt_thread_ioprio); > if (ret)