public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Rohland <cr@sap.com>
To: Chris Wedgwood <cw@f00f.org>
Cc: Linus Torvalds <torvalds@transmeta.com>,
	Rik van Riel <riel@conectiva.com.br>,
	Ivan Kalvatchev <iive@yahoo.com>,
	linux-kernel@vger.kernel.org
Subject: [Patch2] Re: DoS with tmpfs #3
Date: 07 Aug 2001 11:09:47 +0200	[thread overview]
Message-ID: <m37kwg5jb1.fsf_-_@linux.local> (raw)
In-Reply-To: <20010803163409.62191.qmail@web13609.mail.yahoo.com> <Pine.LNX.4.33L.0108040303030.2526-100000@imladris.rielhome.conectiva> <20010805063657.C20164@weta.f00f.org> <m3ofpturpx.fsf@linux.local>
In-Reply-To: <m3ofpturpx.fsf@linux.local>

Hi ,

On 06 Aug 2001, Christoph Rohland wrote:
> Since there are enough persons having trouble with the current
> behaviour I append a patch (against 2.4.8-pre4) to implement the
> default to be ram/2.

The following patch is needed on top of the previous one to compile
without CONFIG_TMPFS.

Greetings
		Christoph

--- 8-pre4-def/mm/shmem.c	Tue Aug  7 10:43:14 2001
+++ m8-pre4/mm/shmem.c	Tue Aug  7 10:47:38 2001
@@ -537,6 +537,30 @@
 	return inode;
 }
 
+static int shmem_set_size(struct shmem_sb_info *info,
+			  unsigned long max_blocks, unsigned long max_inodes)
+{
+	int error;
+	unsigned long blocks, inodes;
+
+	spin_lock(&info->stat_lock);
+	blocks = info->max_blocks - info->free_blocks;
+	inodes = info->max_inodes - info->free_inodes;
+	error = -EINVAL;
+	if (max_blocks < blocks)
+		goto out;
+	if (max_inodes < inodes)
+		goto out;
+	error = 0;
+	info->max_blocks  = max_blocks;
+	info->free_blocks = max_blocks - blocks;
+	info->max_inodes  = max_inodes;
+	info->free_inodes = max_inodes - inodes;
+out:
+	spin_unlock(&info->stat_lock);
+	return error;
+}
+
 #ifdef CONFIG_TMPFS
 static ssize_t
 shmem_file_write(struct file *file,const char *buf,size_t count,loff_t *ppos)
@@ -1001,30 +1025,6 @@
 			return 1;
 	}
 	return 0;
-}
-
-static int shmem_set_size(struct shmem_sb_info *info,
-			  unsigned long max_blocks, unsigned long max_inodes)
-{
-	int error;
-	unsigned long blocks, inodes;
-
-	spin_lock(&info->stat_lock);
-	blocks = info->max_blocks - info->free_blocks;
-	inodes = info->max_inodes - info->free_inodes;
-	error = -EINVAL;
-	if (max_blocks < blocks)
-		goto out;
-	if (max_inodes < inodes)
-		goto out;
-	error = 0;
-	info->max_blocks  = max_blocks;
-	info->free_blocks = max_blocks - blocks;
-	info->max_inodes  = max_inodes;
-	info->free_inodes = max_inodes - inodes;
-out:
-	spin_unlock(&info->stat_lock);
-	return error;
 }
 
 static int shmem_remount_fs (struct super_block *sb, int *flags, char *data)


  parent reply	other threads:[~2001-08-07  9:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-03 16:34 DoS with tmpfs #3 Ivan Kalvatchev
2001-08-04  6:07 ` Rik van Riel
2001-08-04 18:36   ` Chris Wedgwood
2001-08-04 19:53     ` Rik van Riel
2001-08-06 16:28     ` [Patch] " Christoph Rohland
2001-08-06 16:29       ` [Patch-ac] " Christoph Rohland
2001-08-07  9:09       ` Christoph Rohland [this message]
2001-08-08 17:17         ` [Patch2] " Ivan Kalvatchev
2001-08-09  6:29           ` Helge Hafting
2001-08-09  7:08             ` Thoughts on tmpfs and swapfs Riley Williams
2001-08-09 10:22             ` DoS with tmpfs #dynamic Ivan Kalvatchev

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=m37kwg5jb1.fsf_-_@linux.local \
    --to=cr@sap.com \
    --cc=cw@f00f.org \
    --cc=iive@yahoo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=riel@conectiva.com.br \
    --cc=torvalds@transmeta.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