Linux-RDMA Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] RDMA/i40iw: fix potential use after free
@ 2019-11-06  6:44 Pan Bian
  2019-11-06  7:44 ` Leon Romanovsky
  2019-11-14 15:53 ` Jason Gunthorpe
  0 siblings, 2 replies; 3+ messages in thread
From: Pan Bian @ 2019-11-06  6:44 UTC (permalink / raw)
  To: Faisal Latif, Shiraz Saleem, Doug Ledford, Jason Gunthorpe
  Cc: linux-rdma, linux-kernel, Pan Bian

Release variable dst after logging dst->error to avoid possible use after
free.

Signed-off-by: Pan Bian <bianpan2016@163.com>
---
 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);
+			dst_release(dst);
 		}
 		return rc;
 	}
-- 
2.7.4


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] RDMA/i40iw: fix potential use after free
  2019-11-06  6:44 [PATCH] RDMA/i40iw: fix potential use after free Pan Bian
@ 2019-11-06  7:44 ` Leon Romanovsky
  2019-11-14 15:53 ` Jason Gunthorpe
  1 sibling, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2019-11-06  7:44 UTC (permalink / raw)
  To: Pan Bian
  Cc: Faisal Latif, Shiraz Saleem, Doug Ledford, Jason Gunthorpe,
	linux-rdma, linux-kernel

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@163.com>
> ---
>  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
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] RDMA/i40iw: fix potential use after free
  2019-11-06  6:44 [PATCH] RDMA/i40iw: fix potential use after free Pan Bian
  2019-11-06  7:44 ` Leon Romanovsky
@ 2019-11-14 15:53 ` Jason Gunthorpe
  1 sibling, 0 replies; 3+ messages in thread
From: Jason Gunthorpe @ 2019-11-14 15:53 UTC (permalink / raw)
  To: Pan Bian
  Cc: Faisal Latif, Shiraz Saleem, Doug Ledford, linux-rdma, linux-kernel

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@163.com>
> ---
>  drivers/infiniband/hw/i40iw/i40iw_cm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied to for-next, thanks

Jason

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-06  6:44 [PATCH] RDMA/i40iw: fix potential use after free Pan Bian
2019-11-06  7:44 ` Leon Romanovsky
2019-11-14 15:53 ` Jason Gunthorpe

Linux-RDMA Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-rdma/0 linux-rdma/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-rdma linux-rdma/ https://lore.kernel.org/linux-rdma \
		linux-rdma@vger.kernel.org
	public-inbox-index linux-rdma

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-rdma


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git