In 2.5.2 swapfile.c was broken:
In sys_swapon() we see
swap_file = filp_open(name, O_RDWR, 0);
if (IS_ERR(swap_file))
goto bad_swap_2;
bad_swap_2:
...
if (swap_file)
filp_close(swap_file, NULL);
and this oopses the kernel.
Below a trivial fix. Somebody with more time may come
back and polish stuff a little.
Andries
--- swapfile.c~ Sat Mar 2 18:23:19 2002
+++ swapfile.c Sun Mar 3 23:08:48 2002
@@ -905,8 +905,10 @@
swap_file = filp_open(name, O_RDWR, 0);
putname(name);
error = PTR_ERR(swap_file);
- if (IS_ERR(swap_file))
+ if (IS_ERR(swap_file)) {
+ swap_file = NULL;
goto bad_swap_2;
+ }
p->swap_file = swap_file;
[this was a patch relative to 2.5.6-pre2]
On Сбт, Мар 02, 2002 at 09:25:16 +0000, [email protected] wrote:
> In 2.5.2 swapfile.c was broken:
> In sys_swapon() we see
>
> swap_file = filp_open(name, O_RDWR, 0);
> if (IS_ERR(swap_file))
> goto bad_swap_2;
>
> bad_swap_2:
> ...
> if (swap_file)
> filp_close(swap_file, NULL);
>
> and this oopses the kernel.
Fixed in -dj tree.
--
Andrey Panin | Embedded systems software engineer
[email protected] | PGP key: wwwkeys.eu.pgp.net
On Mon, 2002-03-04 at 06:28, Andrey Panin wrote:
> On ???, ??? 02, 2002 at 09:25:16 +0000, [email protected] wrote:
> > In 2.5.2 swapfile.c was broken:
> > In sys_swapon() we see
> >
> > swap_file = filp_open(name, O_RDWR, 0);
> > if (IS_ERR(swap_file))
> > goto bad_swap_2;
> >
> > bad_swap_2:
> > ...
> > if (swap_file)
> > filp_close(swap_file, NULL);
> >
> > and this oopses the kernel.
>
> Fixed in -dj tree.
Eww, nice spotting Andries. If it is in the -dj tree, someone want to
push that bit to Linus?
Robert Love
On Mon, Mar 04, 2002 at 01:48:08PM -0500, Robert Love wrote:
> > Fixed in -dj tree.
> Eww, nice spotting Andries. If it is in the -dj tree, someone want to
> push that bit to Linus?
Actually, I only just applied that to my tree last night.
Possibly Andrey was mixing it up to the IS_ERR fix that went in
a while ago..
--
| Dave Jones. http://www.codemonkey.org.uk
| SuSE Labs