Re: [bug report] i40iw: add connection management code

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

 



On Fri, Jul 14, 2017 at 02:35:14PM +0300, Dan Carpenter wrote:
> Hello Faisal Latif,
> 
> This is a semi-automatic email about new static checker warnings.
> 
> The patch f27b4746f378: "i40iw: add connection management code" from
> Jan 20, 2016, leads to the following Smatch complaint:
> 
>     drivers/infiniband/hw/i40iw/i40iw_cm.c:3691 i40iw_accept()
>     error: we previously assumed 'cm_node->listener' could be null (see line 3689)
> 
>     drivers/infiniband/hw/i40iw/i40iw_cm.c:4061 i40iw_cm_event_connected()
>     error: we previously assumed 'cm_node->listener' could be null (see line 4059)
>
Dan - Thank you for reporting.

The NULL check at 3689 is incorrect as we will always have
a listener at this point in i40iw_accept. 

The code 4058-4063 also needs to be removed as we are in active node
context and cm_node->accept_pend is always 0.

We ll send a patch to fix this soon.

> 
> drivers/infiniband/hw/i40iw/i40iw_cm.c
>   3688		if (cm_node->accept_pend) {
>   3689			if (!cm_node->listener)
>                              ^^^^^^^^^^^^^^^^^
> Check
> 
>   3690				i40iw_pr_err("cm_node->listener NULL for passive node\n");
>   3691			atomic_dec(&cm_node->listener->pend_accepts_cnt);
>                                     ^^^^^^^^^^^^^^^^^
> Unchecked dereference
> 
>   3692			cm_node->accept_pend = 0;
>   3693		}
> 
> 	[ snip ]
> 
>   4058		if (cm_node->accept_pend) {
>   4059			if (!cm_node->listener)
>                              ^^^^^^^^^^^^^^^^^
>   4060				i40iw_pr_err("listener is null for passive node\n");
>   4061			atomic_dec(&cm_node->listener->pend_accepts_cnt);
>                                     ^^^^^^^^^^^^^^^^^
>   4062			cm_node->accept_pend = 0;
>   4063		}
> 
> regards,
> dan carpenter
> --
> 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