diff mbox series

infiniband: hw: cxgb4: fix error return code of close_listsrv_rpl()

Message ID 20210306135548.17939-1-baijiaju1990@gmail.com (mailing list archive)
State Rejected
Delegated to: Leon Romanovsky
Headers show
Series infiniband: hw: cxgb4: fix error return code of close_listsrv_rpl() | expand

Commit Message

Jia-Ju Bai March 6, 2021, 1:55 p.m. UTC
When ep is NULL, no error code of close_listsrv_rpl() is returned.
To fix this bug, close_listsrv_rpl() returns -EINVAL in this case.

Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
---
 drivers/infiniband/hw/cxgb4/cm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Leon Romanovsky March 7, 2021, 9:13 a.m. UTC | #1
On Sat, Mar 06, 2021 at 05:55:48AM -0800, Jia-Ju Bai wrote:
> When ep is NULL, no error code of close_listsrv_rpl() is returned.
> To fix this bug, close_listsrv_rpl() returns -EINVAL in this case.

I don't think that this is an error.

>
> Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
> ---
>  drivers/infiniband/hw/cxgb4/cm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c
> index 8769e7aa097f..94492d2dfdc7 100644
> --- a/drivers/infiniband/hw/cxgb4/cm.c
> +++ b/drivers/infiniband/hw/cxgb4/cm.c
> @@ -2400,7 +2400,7 @@ static int close_listsrv_rpl(struct c4iw_dev *dev, struct sk_buff *skb)
>
>  	if (!ep) {
>  		pr_warn("%s stid %d lookup failure!\n", __func__, stid);
> -		goto out;
> +		return -EINVAL;
>  	}
>  	pr_debug("ep %p\n", ep);
>  	c4iw_wake_up_noref(ep->com.wr_waitp, status2errno(rpl->status));
> --
> 2.17.1
>
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c
index 8769e7aa097f..94492d2dfdc7 100644
--- a/drivers/infiniband/hw/cxgb4/cm.c
+++ b/drivers/infiniband/hw/cxgb4/cm.c
@@ -2400,7 +2400,7 @@  static int close_listsrv_rpl(struct c4iw_dev *dev, struct sk_buff *skb)
 
 	if (!ep) {
 		pr_warn("%s stid %d lookup failure!\n", __func__, stid);
-		goto out;
+		return -EINVAL;
 	}
 	pr_debug("ep %p\n", ep);
 	c4iw_wake_up_noref(ep->com.wr_waitp, status2errno(rpl->status));