RE: [PATCH for-rc] IB/core: Add null pointer check in addr_resolve

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

 




> -----Original Message-----
> From: linux-rdma-owner@xxxxxxxxxxxxxxx [mailto:linux-rdma-
> owner@xxxxxxxxxxxxxxx] On Behalf Of Muneendra
> Sent: Monday, February 26, 2018 9:46 PM
> To: linux-rdma@xxxxxxxxxxxxxxx
> Cc: muneendra.kumar@xxxxxxxxxxxx
> Subject: [PATCH for-rc] IB/core: Add null pointer check in addr_resolve
> 
> Adds the missing NULL pointer check in  addr_resolve.
> Checks the pointer before accessing the same.
> 
Please include the call trace you posted last time and reproduction steps and simple explaination indicating that this check avoids such crash.

> Fixes: 200298326b27 ("IB/core: Validate route when we init ah")
> Signed-off-by: Muneendra <muneendra.kumar@xxxxxxxxxxxx>
> ---
>  drivers/infiniband/core/addr.c | 15 +++++----------
>  1 file changed, 5 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c index
> a5b4cf0..9183d148d 100644
> --- a/drivers/infiniband/core/addr.c
> +++ b/drivers/infiniband/core/addr.c
> @@ -550,18 +550,13 @@ static int addr_resolve(struct sockaddr *src_in,
>  		dst_release(dst);
>  	}
> 
> -	if (ndev->flags & IFF_LOOPBACK) {
> -		ret = rdma_translate_ip(dst_in, addr);
> -		/*
> -		 * Put the loopback device and get the translated
> -		 * device instead.
> -		 */
> +	if (ndev) {
> +		if (ndev->flags & IFF_LOOPBACK)
> +			ret = rdma_translate_ip(dst_in, addr);
> +		else
> +			addr->bound_dev_if = ndev->ifindex;
>  		dev_put(ndev);
> -		ndev = dev_get_by_index(addr->net, addr->bound_dev_if);
> -	} else {
> -		addr->bound_dev_if = ndev->ifindex;
>  	}
> -	dev_put(ndev);
> 
>  	return ret;
>  }
> --
> 1.8.3.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body
> of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at
> http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[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