Re: [patch 4/7] BSD Secure Levels: memory alloc failure check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tuesday 17 May 2005 19:27, Michael Halcrow wrote:
> It adds a check for a memory allocation failure
> condition.

And leaks tfm if such failure occurs.

> --- linux-2.6.12-rc4-mm2-seclvl.orig/security/seclvl.c
> +++ linux-2.6.12-rc4-mm2-seclvl/security/seclvl.c

>  static int
>  plaintext_to_sha1(unsigned char *hash, const char *plaintext, int len)
>  {

	tfm = crypto_alloc_tfm("sha1", 0);
	if (tfm == NULL) {
		seclvl_printk(0, KERN_ERR, "Failed to load transform for SHA1\n");
		return -ENOSYS;
>  	}
>  	// Just get a new page; don't play around with page boundaries
>  	// and scatterlists.
> -	pgVirtAddr = (char *)__get_free_page(GFP_KERNEL);
> -	sg[0].page = virt_to_page(pgVirtAddr);
> +	pg_virt_addr = (char *)__get_free_page(GFP_KERNEL);
> +	if (!pg_virt_addr) {
> +		seclvl_printk(0, KERN_ERR "%s: Out of memory\n", __FUNCTION__);
> +		return -ENOMEM;
> +	}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux