Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp383605rwb; Wed, 28 Sep 2022 04:10:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7eVyBCGSrXHJgsQFfzenrbrQnJ6RISArF/hO7ncnAoH37RlpHOOqEV+Zl1OZfmCk27Fimu X-Received: by 2002:a65:6cc4:0:b0:412:35fa:5bce with SMTP id g4-20020a656cc4000000b0041235fa5bcemr28360935pgw.466.1664363444546; Wed, 28 Sep 2022 04:10:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664363444; cv=none; d=google.com; s=arc-20160816; b=ycRZOeroOJbU3LceBrXsr+SVmxuQ0nJjyPuump7IPRF8MzwaDrW5qPAlTSuxIIlkSR xVBl1ZZhjTBZ6SYZqQYusu76VYxm021mDSJsranzVbc02zhZ/B/vvtQZ/zbnBFeYKHX2 3suMWdzOFexuyBK9FJoAqu+jQVU93xNBksvqS4Vxts10mcbGx5Jo4S26brEtIE4b+zSp N3QWONz0LTMB3CIHZlkWTw0sX/TFESsX2aY7KINHu5mNYnJ7SI2W4A8QXZqStNesd5LJ zO4oa6NLGWBnVYAdQUeOCr+gX5LM5stEm1rupevhy1qFNaSCB+nGaZIXxPeUrX274izm cK7g== 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 :message-id:date:subject:cc:to:dkim-signature:from; bh=heMTOg+m21LM9fK+ii8bVcNKwgGdOMtRNvGqb0nIcyk=; b=zdUXi8znhK7ffTt7+fQnwXEFhqSq+wdRBzFkFS3YZMbxH7RutjFOYHQ/7dEV8ngbmj QLxj7ah7cYM4nfwNYPhB+5fHOMxuiEcoqqaKmpHpcBcZnWDsmCJ0sWueTbYNxa0jNSza SEVvHjZWoqLa9epeiuzeD3WjgasZnopTj8Zfuga9+w1Sw7GGWfh8ChmvqDUym0TPkVQS rbESNO76R3yzUcThBUJXjzjR7GQOKLsK2O5rgoAPISzIKdkjihBVX1HtvBg1Rry+9GkQ EzccpYHZSh/9yrKUUmjtDd7OodIUa54ZhthB0/cCKyL1cmdgXiQGpGyLJpz6gbn/Mo1o VlKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@weissschuh.net header.s=mail header.b=Qa9qhGRL; 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 mh11-20020a17090b4acb00b001f021b4f1d5si2357739pjb.1.2022.09.28.04.10.32; Wed, 28 Sep 2022 04:10:44 -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=fail header.i=@weissschuh.net header.s=mail header.b=Qa9qhGRL; 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 S233217AbiI1Kz5 (ORCPT + 99 others); Wed, 28 Sep 2022 06:55:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233469AbiI1Kzc (ORCPT ); Wed, 28 Sep 2022 06:55:32 -0400 X-Greylist: delayed 475 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Wed, 28 Sep 2022 03:53:53 PDT Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6873140F4 for ; Wed, 28 Sep 2022 03:53:53 -0700 (PDT) From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=weissschuh.net; s=mail; t=1664361955; bh=4jcq0VaC/iDXcd4j2uJ4w0vNny9swybKQkCYoOfOC5k=; h=From:To:Cc:Subject:Date:From; b=Qa9qhGRLkpREYaE4iLS0o/hjjWX1Wzj56X+39n6KNg7ShMYFrVzF8pjEQanUDQN6G nEsK1vk4b/wpIHEGpsP0RUwqY3tZwKYK2NsszSf2Rkgg0KtQZRFsWaB0/26T4IfWmt GcMAWT34lxZGkIJcdcufgZASwm73J8WloKwbbC94= To: Hugh Dickins , Andrew Morton Cc: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , linux-mm@kvack.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= Subject: [PATCH] tmpfs: ensure O_LARGEFILE with generic_file_open() Date: Wed, 28 Sep 2022 12:45:35 +0200 Message-Id: <20220928104535.61186-1-linux@weissschuh.net> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Developer-Signature: v=1; a=ed25519-sha256; t=1664361931; l=887; i=linux@weissschuh.net; s=20211113; h=from:subject; bh=d66fuy49WyqPJLzFDKOViGXYieS8rDSH8RKJPKnQnVU=; b=a8GADzUi4rhImJ18q5ENvGnE0+4c+H6JL0fbYL7u3mDoLpE4BpFBjsL/oBthgtnwVGEBUnzCk44H 5YLhloXkC2HEYVLv9fvjqfeZgv0Hzkh9R/YXEfnk4E+VlUbnN1Ze X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=9LP6KM4vD/8CwHW7nouRBhWLyQLcK1MkP6aTZbzUlj4= Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 From: Thomas Weißschuh Without this check open() will open large files on tmpfs although O_LARGEFILE was not specified. This is inconsistent with other filesystems. Also it will later result in EOVERFLOW on stat() or EFBIG on write(). Link: https://lore.kernel.org/lkml/76bedae6-22ea-4abc-8c06-b424ceb39217@t-8ch.de/ Signed-off-by: Thomas Weißschuh --- mm/shmem.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/shmem.c b/mm/shmem.c index 42e5888bf84d..902c5550fabc 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -3876,6 +3876,7 @@ EXPORT_SYMBOL(shmem_aops); static const struct file_operations shmem_file_operations = { .mmap = shmem_mmap, + .open = generic_file_open, .get_unmapped_area = shmem_get_unmapped_area, #ifdef CONFIG_TMPFS .llseek = shmem_file_llseek, base-commit: f76349cf41451c5c42a99f18a9163377e4b364ff -- 2.37.3