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 194E0C5AD4C for ; Thu, 23 Nov 2023 07:25:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234118AbjKWHZ3 (ORCPT ); Thu, 23 Nov 2023 02:25:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231744AbjKWHZY (ORCPT ); Thu, 23 Nov 2023 02:25:24 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E81E8112 for ; Wed, 22 Nov 2023 23:25:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=ymXPGuek+YUqZ+cTCcWRVVyz0cUPzd9VJqoG6IBQ/u4=; b=tx/ec7GkHS3eCYwtH2GmMOqqQH vJwfb1p3YMwuJucI9f24yWXTOuXlv16U5ABtNAWfbYM3l9VQ4KNAFXCy55GtyJPRtjpF+pv5T9c+C O6QfeD4T8jkLP1/k0QfO1nQUnMFlbMu1emuchcXz1YZagsxJPYwezcj3w8fXn+ZOEIbo4njJky9ZH w52qMOU9PA3XZDKZlWmT5NLCqpbXvcnm9VhbAtrG2I9GK3K63xxyykPsu8gUQK7ROwjXn1qwsjaRJ VhiKotQ5/IDWnZE5ATkI/Oh8Wto+GgF+H+uXU44f39S9g1ALAzWmxnaGj9cZRaNyo6Z+IdL+HjCUH iOF81E3w==; Received: from hch by bombadil.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1r645Y-0041tu-0V; Thu, 23 Nov 2023 07:25:28 +0000 Date: Wed, 22 Nov 2023 23:25:28 -0800 From: Christoph Hellwig To: Peter Xu Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Mike Kravetz , "Kirill A . Shutemov" , Lorenzo Stoakes , Axel Rasmussen , Matthew Wilcox , John Hubbard , Mike Rapoport , Hugh Dickins , David Hildenbrand , Andrea Arcangeli , Rik van Riel , James Houghton , Yang Shi , Jason Gunthorpe , Vlastimil Babka , Andrew Morton Subject: Re: [PATCH RFC 05/12] mm/gup: Fix follow_devmap_p[mu]d() to return even if NULL Message-ID: References: <20231116012908.392077-1-peterx@redhat.com> <20231116012908.392077-6-peterx@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231116012908.392077-6-peterx@redhat.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 15, 2023 at 08:29:01PM -0500, Peter Xu wrote: > This seems to be a bug not by any report but by code observations. > > When GUP sees a devpmd or devpud, it should return whatever value returned > from follow_devmap_p[mu]d(). If page==NULL returned, it means a fault is > probably required. Skipping return the NULL should allow the code to fall > through, which can cause unexpected behavior. > > It was there at least before the follow page rework (080dbb618b) in 2017, > so 6 years. Not yet digging for a Fixes, assuming it can hardly trigger > even if the logical bug does exist. > > Signed-off-by: Peter Xu I'd still add a fixes tag and send if off to Linux for 6.7-rc instead of letting it linger. Otherwise looks good: Reviewed-by: Christoph Hellwig