lkml.org 
[lkml]   [2006]   [Jun]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 2.6.17-rc5-mm1
Christoph Lameter wrote:
> Sigh the patch that I sent earlier will make swapon fail when adding more
> entries if 32 entries have been defined before even if some of these are
> later freed. Plus maybe we better leave the probing intact for arches that
> support less than 32 swap devices and also return -EPERM like before. I
> guess we need this one instead:
>
>
> Do proper boundary checking in sys_swapon().
>
> sys_swapon currently does not limit the number of swap devices. It may as
> a result overwrite memory following the swap_info array and get into
> entanglements with page migration since it may usethe swap types reserved
> for page migration.
>
> Fix this by limiting the number of swap devices in swapon to
> MAX_SWAPFILES
>
> Signed-off-by: Christoph Lameter <clameter@sgi.com>
>
> Index: linux-2.6.17-rc5-mm2/mm/swapfile.c
> ===================================================================
> --- linux-2.6.17-rc5-mm2.orig/mm/swapfile.c 2006-06-01 10:03:07.127259731 -0700
> +++ linux-2.6.17-rc5-mm2/mm/swapfile.c 2006-06-05 13:40:45.887291175 -0700
> @@ -1408,8 +1408,13 @@ asmlinkage long sys_swapon(const char __
> spin_unlock(&swap_lock);
> goto out;
> }
> - if (type >= nr_swapfiles)
> + if (type >= nr_swapfiles) {
> + if (nr_swapfiles >= MAX_SWAPFILES) {
> + spin_unlock(&swap_lock);
> + goto out;
> + }
> nr_swapfiles = type+1;
> + }
> INIT_LIST_HEAD(&p->extent_list);
> p->flags = SWP_USED;
> p->swap_file = NULL;

I'll shove this one onto the machine causing all the trouble.

-apw
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-06-06 13:43    [W:0.110 / U:0.588 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site