Re: [PATCH] RDMA/i40iw: fix potential use after free

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

 



On Wed, Nov 06, 2019 at 02:44:11PM +0800, Pan Bian wrote:
> Release variable dst after logging dst->error to avoid possible use after
> free.
>
> Signed-off-by: Pan Bian <bianpan2016@xxxxxxx>
> ---
>  drivers/infiniband/hw/i40iw/i40iw_cm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/infiniband/hw/i40iw/i40iw_cm.c b/drivers/infiniband/hw/i40iw/i40iw_cm.c
> index 2d6a378e8560..bb78d3280acc 100644
> --- a/drivers/infiniband/hw/i40iw/i40iw_cm.c
> +++ b/drivers/infiniband/hw/i40iw/i40iw_cm.c
> @@ -2079,9 +2079,9 @@ static int i40iw_addr_resolve_neigh_ipv6(struct i40iw_device *iwdev,
>  	dst = i40iw_get_dst_ipv6(&src_addr, &dst_addr);
>  	if (!dst || dst->error) {
>  		if (dst) {
> -			dst_release(dst);
>  			i40iw_pr_err("ip6_route_output returned dst->error = %d\n",
>  				     dst->error);

I suggest to remove those prints together with "if (dst)" check because
dst_release() already has such check.

Thanks

> +			dst_release(dst);
>  		}
>  		return rc;
>  	}
> --
> 2.7.4
>



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux