Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp795391pxy; Wed, 28 Apr 2021 14:27:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzGsjmHml3ek6dt/rXXTQ99yMPSNZYopJ/RMd2c/d1PENz27qlNskV7UM2/3SadKA7nefPq X-Received: by 2002:a17:906:c289:: with SMTP id r9mr9712331ejz.469.1619645236124; Wed, 28 Apr 2021 14:27:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619645236; cv=none; d=google.com; s=arc-20160816; b=yj/AvHL901ZGEJo8VwGLmN0XTVLNnlSqQe7LHh/2EtSm+Ofhwlmx3yzzRua2hQDhG0 1+v+Vy+7qqFbXgojEDg4mttTj1PRfEAk4XVhknN1zVoRuvaKmwN8bSlgN7/RCiCSp1e2 s2qYmEX1Pl8PTevnBFb8/MMmIt6kRr9l2NZJQkFQmKfutaGPXlQ5kqgCYTG9iwxKqmP2 +7dEfDBwiIaWanvrfyQyvRmXRkAO9YYq1WFF8aI3iFJPytMLFQOYBQKchZZvJgxFmrKy U+nnRH8JqcGxBS/E+mOX2QWjpgBNIu3q+46CN6OiO/dpMlkbhaRBbPcQJ0ttP1JW8rto jMrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=EFCzP5qJK5eGZax8gq5U3Ft3JKE+J1wlXK63qQnyBD8=; b=eUqwgeZOxOQOwXz+OxjJqnJtzJKlzQe7p2TYfxKDIORH1OfTaR9E1I/lBLkhEWE+9O qI1m7WwRWbZ9VsyGtF+3B7bzBJGYnPZbWZENLb71xqPNJQ08BrN6DTjIsDvyiTC/jiJT w/+POkXPBa0axBTdXqh7R77Lm84kekaDpDtiWnEO8NmsTcQ4wIGAXko30Pa6JII2TLh4 hBRKQEiXh9EWvliux6QSK4Ea06hRd2Llbv/WjWd5uD7w5ADWMrGZ4IIg5MkrL8NpnTv2 fDzQMQLfltMHwrO5s+Qi3IE6F4AqnK+etsbWRPOLdaiSSAEfCDufRu6Oc6MoORwggQZn nkkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Qk3zEfxr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jz13si1084875ejc.634.2021.04.28.14.26.52; Wed, 28 Apr 2021 14:27:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Qk3zEfxr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229805AbhD1VZX (ORCPT + 99 others); Wed, 28 Apr 2021 17:25:23 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:45219 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229589AbhD1VZW (ORCPT ); Wed, 28 Apr 2021 17:25:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619645075; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=EFCzP5qJK5eGZax8gq5U3Ft3JKE+J1wlXK63qQnyBD8=; b=Qk3zEfxrGJJqHn97B8V1k2eZwPXSlgsdHP28KXdPXglGO91WT06kNogR7jRFp/eE23MVa9 WpLcoTwQFqRMZEGxJj3AO7hKb5aMoUO1kxOOrMOBpYH9ARdgk1ypxCcW6kClPJ2h1ibaM9 BpfvvBWi06GOr+k3l8zMBfInRowJQDQ= Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-43-fU0aMV52McWlPoSlfGUcPQ-1; Wed, 28 Apr 2021 17:24:33 -0400 X-MC-Unique: fU0aMV52McWlPoSlfGUcPQ-1 Received: by mail-qk1-f198.google.com with SMTP id 81-20020a370c540000b02902e4d7b9e448so4673680qkm.16 for ; Wed, 28 Apr 2021 14:24:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=EFCzP5qJK5eGZax8gq5U3Ft3JKE+J1wlXK63qQnyBD8=; b=W2oT8qQX7A/dXlNSG0XpRb1aNktWI3Q+mYiE5/0kYUiyqnHMpqPOMDy1PmmsshJYh3 CnvdzcJc6huqh8sBvPp/7y/+rrzMP8C2e4v4muD9VrjkuJUIpvPwb/C0mRuCjMFYwYkQ MNl6QNX0QWkWNW9YHFb2WSzBAlTjzSntyU1o2c4kGAoF7pP6R2H+IYKdycKbhw+cx/hd H8z9ZrNW9tlAgu/IAfYcmifoJcR+j4y0QS67sxOpSWeQW8lgLHOrDeHC53tD1MVQlrpG +DQw0Ao4e8NydQgJXoaClqNMYrqJCUcX1+Xr3M10tInlKV3gqu6h8+5jyCNQc1ifg09G VyfA== X-Gm-Message-State: AOAM533FSFZGV/c6xa+PLUtEpr7yWApD7heKIe29BHMr/zW9myxJ3DrD U+4RPdxuQDmzW5EbD7a0/lojQrIdhIvuVkr8CMHpLJwOP66Ky5LW+JNZe5HVV6PdQDuhRXfW93j J6KDBQVsKQ864c735tQXQs8be X-Received: by 2002:ac8:7686:: with SMTP id g6mr27970068qtr.388.1619645071814; Wed, 28 Apr 2021 14:24:31 -0700 (PDT) X-Received: by 2002:ac8:7686:: with SMTP id g6mr27970050qtr.388.1619645071537; Wed, 28 Apr 2021 14:24:31 -0700 (PDT) Received: from xz-x1 (bras-base-toroon474qw-grc-77-184-145-104-227.dsl.bell.ca. [184.145.104.227]) by smtp.gmail.com with ESMTPSA id i23sm842088qtp.61.2021.04.28.14.24.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Apr 2021 14:24:31 -0700 (PDT) Date: Wed, 28 Apr 2021 17:24:30 -0400 From: Peter Xu To: Hugh Dickins Cc: Axel Rasmussen , Andrea Arcangeli , Andrew Morton , Lokesh Gidra , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] userfaultfd: release page in error path to avoid BUG_ON Message-ID: <20210428212430.GA6462@xz-x1> References: <20210428180109.293606-1-axelrasmussen@google.com> <20210428183943.GH6584@xz-x1> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 28, 2021 at 02:03:05PM -0700, Hugh Dickins wrote: [...] > > > + put_page(*pagep); > > > + *pagep = NULL; > > > + } > > > goto out; > > > > All "goto out" in this functions looks weird as it returns directly... so if > > you're touching this after all, I suggest we do "return -ENOMEM" directly and > > drop the "ret = -ENOMEM". > > No strong feeling either way from me on that: whichever looks best > to you. But I suspect the "ret = -ENOMEM" cannot be dropped, > because it's relied on further down too? Ah sorry I just noticed Axel didn't really touch that line.. :) So yeah please also feel free to keep it as is. If to drop it, "ret = -ENOMEM" can go as well, I think.. since all later errors should always reset variable "ret". Thanks, -- Peter Xu