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: <0CE8B6BE3C4AD74AB97D9D29BD24E5520210D5A4@CORPEXCH1.na.ads.idt.com>
Date:	Mon, 29 Aug 2011 06:51:53 -0700
From:	"Bounine, Alexandre" <Alexandre.Bounine@....com>
To:	"Dan Carpenter" <error27@...il.com>,
	"Matt Porter" <mporter@...nel.crashing.org>
Cc:	"open list" <linux-kernel@...r.kernel.org>,
	<kernel-janitors@...r.kernel.org>
Subject: RE: [patch] rapidio: potential null deref in rio_setup_device()

Dan Carpenter <error27@...il.com> wrote:

> The "goto cleanup" path can dereference "rswitch" which is NULL here.
> 
> Signed-off-by: Dan Carpenter <error27@...il.com>
> ---
> This is sort of embarrassing, I've patched this function before but
> missed this.  Hopefully it's right now.
> 
> diff --git a/drivers/rapidio/rio-scan.c b/drivers/rapidio/rio-scan.c
> index 0914f49..882cef9 100644
> --- a/drivers/rapidio/rio-scan.c
> +++ b/drivers/rapidio/rio-scan.c
> @@ -432,7 +432,7 @@ static struct rio_dev __devinit
> *rio_setup_device(struct rio_net *net,
>  		/* Assign component tag to device */
>  		if (next_comptag >= 0x10000) {
>  			pr_err("RIO: Component Tag Counter Overflow\n");
> -			goto cleanup;
> +			goto out_rdev;
>  		}
>  		rio_mport_write_config_32(port, destid, hopcount,
>  					  RIO_COMPONENT_TAG_CSR,
next_comptag);
> @@ -518,7 +518,7 @@ static struct rio_dev __devinit
> *rio_setup_device(struct rio_net *net,
>  cleanup:
>  	if (rio_is_switch(rdev))
>  		kfree(rswitch->route_table);

Because rswitch is set not-NULL only for switch devices the check below
can make things simpler: 
  cleanup:
	if (rswitch)
  		kfree(rswitch->route_table);

> -
> +out_rdev:
>  	kfree(rdev);
>  	return NULL;
>  }
--
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