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] [thread-next>] [day] [month] [year] [list]
Message-ID: <10ff30ad-52c3-798b-7a3d-07ab5b2e938d@fb.com>
Date:   Tue, 25 Apr 2017 23:13:43 -0700
From:   Jens Axboe <axboe@...com>
To:     Heloise <os@...as.ac.cn>, <hare@...e.com>, <jthumshirn@...e.de>,
        <keith.busch@...el.com>, <ming.lei@...hat.com>,
        <bianpan2016@....com>, <dan.j.williams@...el.com>,
        <sachin.s5@...sung.com>, <baoyou.xie@...aro.org>
CC:     <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] drivers:block:mtip32xx:mtip32xx:change the order of
 null-pointer dereference validation

On 04/25/2017 06:30 PM, Heloise wrote:
> Signed-off-by: Heloise <os@...as.ac.cn>
> 
> mtip_async_complete() uses the variable port 'port->dd'at the begining, then
> validates null-pointer dereference of port 'unlikely(!port)'. Change the order
> of validation.
> ---
>  drivers/block/mtip32xx/mtip32xx.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
> index 1d1dc11..feed61a 100644
> --- a/drivers/block/mtip32xx/mtip32xx.c
> +++ b/drivers/block/mtip32xx/mtip32xx.c
> @@ -228,10 +228,13 @@ static struct mtip_cmd *mtip_cmd_from_tag(struct driver_data *dd,
>  static void mtip_async_complete(struct mtip_port *port,
>  				int tag, struct mtip_cmd *cmd, int status)
>  {
> +	if (unlikely(!port))
> +		return;
> +
>  	struct driver_data *dd = port->dd;
>  	struct request *rq;
>  
> -	if (unlikely(!dd) || unlikely(!port))
> +	if (unlikely(!dd))
>  		return;

Doesn't matter, since 'dd' isn't dereferenced before checking if
'port' is NULL.

-- 
Jens Axboe

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ