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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <517EA27A.8080109@panasas.com>
Date:	Mon, 29 Apr 2013 09:40:26 -0700
From:	Boaz Harrosh <bharrosh@...asas.com>
To:	Zhao Hongjiang <zhaohongjiang@...wei.com>
CC:	<bhalevy@...ian.com>, Andrew Morton <akpm@...ux-foundation.org>,
	<osd-dev@...n-osd.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] exofs: don't increase urilen if krealloc() fails

On 04/28/2013 04:46 AM, Zhao Hongjiang wrote:
> Without the patch, edp->urilen is increased before krealloc(). If krealloc() fails,
> edp->urilen is too high. Fix that by only updating edp->urilen if krealloc() is successful.
> 
> Signed-off-by: Zhao Hongjiang <zhaohongjiang@...wei.com>
> ---
>  fs/exofs/sys.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/exofs/sys.c b/fs/exofs/sys.c
> index 1b4f2f9..79b0a85 100644
> --- a/fs/exofs/sys.c
> +++ b/fs/exofs/sys.c
> @@ -82,11 +82,11 @@ static ssize_t uri_store(struct exofs_dev *edp, const char *buf, size_t len)
>  {
>  	uint8_t *new_uri;
>  
> -	edp->urilen = strlen(buf) + 1;
> -	new_uri = krealloc(edp->uri, edp->urilen, GFP_KERNEL);
> +	new_uri = krealloc(edp->uri, strlen(buf) + 1, GFP_KERNEL);
>  	if (new_uri == NULL)
>  		return -ENOMEM;
>  	edp->uri = new_uri;
> +	edp->urilen = strlen(buf) + 1;
>  	strncpy(edp->uri, buf, edp->urilen);
>  	return edp->urilen;
>  }
> -- 1.7.1
> 

Thank you, will apply

Boaz
--
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