linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix sys_mount not to free_page(0)
@ 1999-08-06 23:12 Kanoj Sarcar
  1999-08-06 23:18 ` Linus Torvalds
  0 siblings, 1 reply; 4+ messages in thread
From: Kanoj Sarcar @ 1999-08-06 23:12 UTC (permalink / raw)
  To: torvalds, alan; +Cc: linux-mm, linux-kernel

Linus/Alan,

Could you please take this patch into the 2.2 and 2.3 streams? It
basically prevents sys_mount() from trying to invoke free_page(0).
Note that copy_mount_options() might return 0 both in the case
where it allocates a page, and in the case it does not.

Thanks.

Kanoj
kanoj@engr.sgi.com

--- /usr/tmp/p_rdiff_a005Eo/super.c	Fri Aug  6 16:01:57 1999
+++ fs/super.c	Fri Aug  6 15:00:35 1999
@@ -1037,7 +1037,8 @@
 		retval = do_remount(dir_name,
 				    new_flags & ~MS_MGC_MSK & ~MS_REMOUNT,
 				    (char *) page);
-		free_page(page);
+		if (page)
+			free_page(page);
 		goto out;
 	}
 
@@ -1045,7 +1046,8 @@
 	if (retval < 0)
 		goto out;
 	fstype = get_fs_type((char *) page);
-	free_page(page);
+	if (page)
+		free_page(page);
 	retval = -ENODEV;
 	if (!fstype)		
 		goto out;
@@ -1099,7 +1101,8 @@
 	}
 	retval = do_mount(dev, dev_name, dir_name, fstype->name, flags,
 				(void *) page);
-	free_page(page);
+	if (page)
+		free_page(page);
 	if (retval)
 		goto clean_up;
 
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://humbolt.geo.uu.nl/Linux-MM/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix sys_mount not to free_page(0)
  1999-08-06 23:12 [PATCH] Fix sys_mount not to free_page(0) Kanoj Sarcar
@ 1999-08-06 23:18 ` Linus Torvalds
  1999-08-06 23:51   ` Kanoj Sarcar
  0 siblings, 1 reply; 4+ messages in thread
From: Linus Torvalds @ 1999-08-06 23:18 UTC (permalink / raw)
  To: Kanoj Sarcar; +Cc: alan, linux-mm, linux-kernel


On Fri, 6 Aug 1999, Kanoj Sarcar wrote:
> 
> Could you please take this patch into the 2.2 and 2.3 streams? It
> basically prevents sys_mount() from trying to invoke free_page(0).

Hmm..

free_page(0) is actually supposed to work. Doesn't it?

		Linus

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://humbolt.geo.uu.nl/Linux-MM/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix sys_mount not to free_page(0)
  1999-08-06 23:18 ` Linus Torvalds
@ 1999-08-06 23:51   ` Kanoj Sarcar
  1999-08-07  0:00     ` Linus Torvalds
  0 siblings, 1 reply; 4+ messages in thread
From: Kanoj Sarcar @ 1999-08-06 23:51 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: alan, linux-mm, linux-kernel

> 
> 
> 
> On Fri, 6 Aug 1999, Kanoj Sarcar wrote:
> > 
> > Could you please take this patch into the 2.2 and 2.3 streams? It
> > basically prevents sys_mount() from trying to invoke free_page(0).
> 
> Hmm..
> 
> free_page(0) is actually supposed to work. Doesn't it?
> 
> 		Linus
> 

Umm, it does ... I was thinking it was happenstance, and not by design.
I ran into a panic with some code I am trying to write and ran into 
this ... maybe I should fix my code ...

Is it worthwhile to clean this up, or do other places in the code rely
on this behavior of free_page?

Kanoj
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://humbolt.geo.uu.nl/Linux-MM/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix sys_mount not to free_page(0)
  1999-08-06 23:51   ` Kanoj Sarcar
@ 1999-08-07  0:00     ` Linus Torvalds
  0 siblings, 0 replies; 4+ messages in thread
From: Linus Torvalds @ 1999-08-07  0:00 UTC (permalink / raw)
  To: Kanoj Sarcar; +Cc: alan, linux-mm, linux-kernel


On Fri, 6 Aug 1999, Kanoj Sarcar wrote:
> > 
> > free_page(0) is actually supposed to work. Doesn't it?
> 
> Umm, it does ... I was thinking it was happenstance, and not by design.

It's by design - I am of the religion that thinks that

	free(malloc());

is always legal, even when the malloc() fails.

> Is it worthwhile to clean this up, or do other places in the code rely
> on this behavior of free_page?

There might be any number of places who just free a page, it doesn't even
slow down free_page(), because the 0 case just falls out quite naturally
from having to test for out-of-range and reserved pages anyway.

		Linus

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://humbolt.geo.uu.nl/Linux-MM/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1999-08-07  0:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-08-06 23:12 [PATCH] Fix sys_mount not to free_page(0) Kanoj Sarcar
1999-08-06 23:18 ` Linus Torvalds
1999-08-06 23:51   ` Kanoj Sarcar
1999-08-07  0:00     ` Linus Torvalds

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox