linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Thomas Weißschuh" <linux@weissschuh.net>
To: Hugh Dickins <hughd@google.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: "Thomas Weißschuh" <linux@weissschuh.net>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	"Thomas Weißschuh" <thomas.weissschuh@amadeus.com>
Subject: [PATCH] tmpfs: ensure O_LARGEFILE with generic_file_open()
Date: Wed, 28 Sep 2022 12:45:35 +0200	[thread overview]
Message-ID: <20220928104535.61186-1-linux@weissschuh.net> (raw)

From: Thomas Weißschuh <thomas.weissschuh@amadeus.com>

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 <thomas.weissschuh@amadeus.com>
---
 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



             reply	other threads:[~2022-09-28 10:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-28 10:45 Thomas Weißschuh [this message]
2022-09-28 20:27 ` Hugh Dickins
2022-09-28 21:45   ` Thomas Weißschuh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220928104535.61186-1-linux@weissschuh.net \
    --to=linux@weissschuh.net \
    --cc=akpm@linux-foundation.org \
    --cc=hughd@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=thomas.weissschuh@amadeus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox