From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A4A19C38141 for ; Sat, 21 Jan 2023 01:06:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229535AbjAUBGN (ORCPT ); Fri, 20 Jan 2023 20:06:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229644AbjAUBGN (ORCPT ); Fri, 20 Jan 2023 20:06:13 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC65D71BC8 for ; Fri, 20 Jan 2023 17:06:11 -0800 (PST) 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 5ECE5620A1 for ; Sat, 21 Jan 2023 01:06:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4798C433EF; Sat, 21 Jan 2023 01:06:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1674263170; bh=oqmli+LUVMKhX0B6MRvY1/pEo9HK+RZv29BZr96BSCQ=; h=Date:To:From:Subject:From; b=ibFcXwQGr/Af95D1wbTkPqRAqAGPqX9XlsbFEOb98JfLHD9KcYx+BzuDoRCC4oYEB 7xoUXITD5bSvSh/cWInmoBHGUOvp8aLHDGF5OR6G0s+BytOjDeqSZAJmxb/MGdJQYX +POYU8OmMrLVhh6VnXkE18ljQllobXQkWBsOihME= Date: Fri, 20 Jan 2023 17:06:10 -0800 To: mm-commits@vger.kernel.org, syzbot+502859d610c661e56545@syzkaller.appspotmail.com, Liam.Howlett@oracle.com, akpm@linux-foundation.org From: Andrew Morton Subject: + maple_tree-fix-mas_prev-and-mas_find-state-handling.patch added to mm-unstable branch Message-Id: <20230121010610.B4798C433EF@smtp.kernel.org> Precedence: bulk Reply-To: linux-kernel@vger.kernel.org List-ID: X-Mailing-List: mm-commits@vger.kernel.org The patch titled Subject: maple_tree: fix mas_prev() and mas_find() state handling has been added to the -mm mm-unstable branch. Its filename is maple_tree-fix-mas_prev-and-mas_find-state-handling.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/maple_tree-fix-mas_prev-and-mas_find-state-handling.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: "Liam R. Howlett" Subject: maple_tree: fix mas_prev() and mas_find() state handling Date: Fri, 20 Jan 2023 11:26:07 -0500 When mas_prev() does not find anything, set the state to MAS_NONE. Handle the MAS_NONE in mas_find() like a MAS_START. Link: https://lkml.kernel.org/r/20230120162650.984577-7-Liam.Howlett@oracle.com Signed-off-by: Liam R. Howlett Reported-by: Signed-off-by: Andrew Morton --- --- a/lib/maple_tree.c~maple_tree-fix-mas_prev-and-mas_find-state-handling +++ a/lib/maple_tree.c @@ -4844,7 +4844,7 @@ static inline void *mas_prev_entry(struc if (mas->index < min) { mas->index = mas->last = min; - mas_pause(mas); + mas->node = MAS_NONE; return NULL; } retry: @@ -5918,6 +5918,7 @@ void *mas_prev(struct ma_state *mas, uns if (!mas->index) { /* Nothing comes before 0 */ mas->last = 0; + mas->node = MAS_NONE; return NULL; } @@ -6008,6 +6009,9 @@ void *mas_find(struct ma_state *mas, uns mas->index = ++mas->last; } + if (unlikely(mas_is_none(mas))) + mas->node = MAS_START; + if (unlikely(mas_is_start(mas))) { /* First run or continue */ void *entry; _ Patches currently in -mm which might be from Liam.Howlett@oracle.com are maple_tree-fix-handle-of-invalidated-state-in-mas_wr_store_setup.patch maple_tree-fix-mas_prev-and-mas_find-state-handling.patch nommu-pass-through-vma-iterator-to-shrink_vma.patch mm-damon-vaddr-testh-stop-using-vma_mas_store-for-maple-tree-store.patch mm-mremap-convert-vma_adjust-to-vma_expand.patch