lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Mon, 26 Dec 2011 12:45:41 -0500
From:	Kautuk Consul <consul.kautuk@...il.com>
To:	Andrew Morton <akpm@...ux-foundation.org>,
	Cesar Eduardo Barros <cesarb@...arb.net>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
	Eric B Munson <emunson@...bm.net>,
	Pekka Enberg <penberg@...nel.org>
Cc:	linux-mm@...ck.org, linux-kernel@...r.kernel.org,
	Kautuk Consul <consul.kautuk@...il.com>
Subject: Re: [PATCH 1/1] swapfile: swap_info_get: Check for swap_info[type] == NULL

Hi,

Sorry, please ignore the patch file below.

I made a mistake in understanding the code logic.
I now understand that the first "bad_nofile" validation check
is good enough for checking the validity of the value in the "type" variable.


On Mon, Dec 26, 2011 at 6:56 AM, Kautuk Consul <consul.kautuk@...il.com> wrote:
> From: Kautuk Consul <consul.kautuk@...il.com>
>
> If the swapfile type encoded within entry.val is corrupted in
> such a way that the swap_info[type] == NULL, then the code in
> swap_info_get will cause a NULL pointer exception.
>
> Assuming that the code in swap_info_get attempts to validate the
> swapfile type by checking its range, another bad_nofile check would
> be to check for check whether the swap_info[type] pointer is NULL.
>
> Adding a NULL check for swap_info[type] to be reagrded as a "bad_nofile"
> error scenario.
>
> Signed-off-by: Kautuk Consul <consul.kautuk@...il.com>
> ---
>  mm/swapfile.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/mm/swapfile.c b/mm/swapfile.c
> index b1cd120..7bdbe91 100644
> --- a/mm/swapfile.c
> +++ b/mm/swapfile.c
> @@ -483,6 +483,8 @@ static struct swap_info_struct *swap_info_get(swp_entry_t entry)
>        if (type >= nr_swapfiles)
>                goto bad_nofile;
>        p = swap_info[type];
> +       if (!p)
> +               goto bad_nofile;
>        if (!(p->flags & SWP_USED))
>                goto bad_device;
>        offset = swp_offset(entry);
> --
> 1.7.6
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ