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: <5C437537.8010304@redhat.com>
Date:   Sat, 19 Jan 2019 13:06:31 -0600
From:   Mike Christie <mchristi@...hat.com>
To:     Kangjie Lu <kjlu@....edu>
Cc:     pakki001@....edu, "Nicholas A. Bellinger" <nab@...ux-iscsi.org>,
        linux-scsi@...r.kernel.org, target-devel@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] target: fix a missing check of match_int

On 01/11/2019 11:31 PM, Kangjie Lu wrote:
> When match_int fails, "arg" is left uninitialized and may contain random
> value, thus should not be used.
> The fix checks if match_int fails, and if so, returns its error code.
> 
> Signed-off-by: Kangjie Lu <kjlu@....edu>
> ---
>  drivers/target/target_core_rd.c | 15 +++++++++++++--
>  1 file changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/target/target_core_rd.c b/drivers/target/target_core_rd.c
> index a6e8106abd6f..3b7657b2f2f1 100644
> --- a/drivers/target/target_core_rd.c
> +++ b/drivers/target/target_core_rd.c
> @@ -559,6 +559,7 @@ static ssize_t rd_set_configfs_dev_params(struct se_device *dev,
>  	char *orig, *ptr, *opts;
>  	substring_t args[MAX_OPT_ARGS];
>  	int arg, token;
> +	int ret;
>  
>  	opts = kstrdup(page, GFP_KERNEL);
>  	if (!opts)
> @@ -573,14 +574,24 @@ static ssize_t rd_set_configfs_dev_params(struct se_device *dev,
>  		token = match_token(ptr, tokens, args);
>  		switch (token) {
>  		case Opt_rd_pages:
> -			match_int(args, &arg);
> +			ret = match_int(args, &arg);
> +			if (ret) {
> +				kfree(orig);
> +				return ret;

Just set ret to the return value and then break, so all the error and
success paths are going through the same code path.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ