Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp66528rwl; Thu, 6 Apr 2023 14:56:36 -0700 (PDT) X-Google-Smtp-Source: AKy350ZB6L8bDUZgdO+kSIkdeJE3jZUpVfqPbpxOHkVXsBqGONv8pJlTN82Au9/psahXyTtO5c5n X-Received: by 2002:a17:902:ced1:b0:19c:be03:d1ba with SMTP id d17-20020a170902ced100b0019cbe03d1bamr513781plg.6.1680818195827; Thu, 06 Apr 2023 14:56:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680818195; cv=none; d=google.com; s=arc-20160816; b=TqGl8N895o7+n3zQneh1y+Ip7ysit9R5UnazkVs1K4Oe6Cjo8Em4rpi0lV0gMQPnYZ hNpMlfRyQ9fQrTCBzZkGviBDzRh+dTkguEZDq5YkIFtFH2Mw1ChXx6IzBU3mrZ9tuo0O TWG59beNYZxIcQQVOGlvvXgNopSohqlIEoaxGqsVUmhoKk8++1YtDzccr8yXHLgcX6Gm ZNykM0T8mU7JGotFSNRSQzOuyCLSUqWo/7CrDF6ZD+sFShzIIlaRveoANKi+DpxGZp9B Qli0yKvgVVYi7PqS1lUiGv67OddmCGBbftFbz8c/O5+nBcLpxhIXToRuAt19APj6DiHJ /9mA== 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=TbRTu/ZvsFlUHpyj6WCUNoptLsGdLvhoNNPY7Sw5L84=; b=IfsygjYljhWaV6UVpS/fyhkF6Q6nFQs/O0Qg4Y6xfu8nP6fn/+WaQ5d5NgJqoHaRvh kH74b33tMzTNHz2JaYxuukkaPBy8AxgJtR4uT79Qc5B9elX2yYkwlHkAaQ9R+/rYGR2R CRKyrXaMyn9HqsvZeCa9XTbf+tS3w1MtMMY/8P7oELYCQPuznNEZbW6ukW7JkmWxMxjD h+F+eSelB2DzsbIKmPsbrergbBpszwN8c8YqaNEli4VGZTbTZGZC5l40xR0frP+8m0D/ QK4xikg0Uy8ORstEt8GJvO/bWf8+guLJ5UYnzikJm3eM4Fl9hSxXi7F0rGazt4/j5s9z ZfjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=PfHJsdlo; 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 d4-20020a170902cec400b001a19bd8aa63si2788187plg.36.2023.04.06.14.56.24; Thu, 06 Apr 2023 14:56:35 -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=PfHJsdlo; 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 S238742AbjDFVxu (ORCPT + 99 others); Thu, 6 Apr 2023 17:53:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238602AbjDFVxs (ORCPT ); Thu, 6 Apr 2023 17:53:48 -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 C0A4EAD2A; Thu, 6 Apr 2023 14:53:47 -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 5D03D64733; Thu, 6 Apr 2023 21:53:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89577C433EF; Thu, 6 Apr 2023 21:53:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1680818026; bh=LGynFdLpXdAw06RcdZ1IJ8GRpyk9viwFXtp1CMy3Wds=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=PfHJsdloNeSJFGbIpuAf8ez32Le6aBFxLwe2RLMpelS4FLIASRIXkDABBcuRJdqpt avXFdK5fJ+s/6YRl2MvorAusAvoSqw12YQ35vejlnQwr0eCshu50RCEDSFfMPf0+XD V9xXKrUuUxd81wn02Pss6/UcMwdiLXIfXQLAfCXA= Date: Thu, 6 Apr 2023 14:53:45 -0700 From: Andrew Morton To: "Liam R. Howlett" Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-next@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] mm/mprotect: Fix do_mprotect_pkey() return on error Message-Id: <20230406145345.9c5e4c91461cbf42509a92a9@linux-foundation.org> In-Reply-To: <20230406193050.1363476-1-Liam.Howlett@oracle.com> References: <20230406193050.1363476-1-Liam.Howlett@oracle.com> X-Mailer: Sylpheed 3.8.0beta1 (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=-4.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 Thu, 6 Apr 2023 15:30:50 -0400 "Liam R. Howlett" wrote: > When the loop over the VMA is terminated early due to an error, the > return code could be overwritten with ENOMEM. Fix the return code by > only setting the error on early loop termination when the error is not > set. > > Fixes: 2286a6914c77 ("mm: change mprotect_fixup to vma iterator") > Cc: I do think we should always describe the user-visible effects when proposing a backport. a) so the -stable maintainers understand why we're recommending the backport and b) to help some poor soul who is looking at the patch wondering if it will fix his customer's bug report. How's this? : User-visible effects include: attempts to run mprotect() against a special : mapping or with a poorly-aligned hugetlb address should return -EINVAL, : but they presently return -ENOMEM.