CC: kbuild-...@lists.01.org
TO: David Howells <dhowe...@redhat.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git 
master
head:   7ce53e3a447bced7b85ed181c4d027e93c062e07
commit: b7a7d67408032843c14071711d6259aada9392f0 [6050/6654] rxrpc: Impose a 
maximum number of client calls
:::::: branch date: 24 hours ago
:::::: commit date: 2 days ago
config: i386-randconfig-m021-20200911 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <l...@intel.com>
Reported-by: Dan Carpenter <dan.carpen...@oracle.com>

New smatch warnings:
net/rxrpc/call_object.c:375 rxrpc_new_client_call() warn: inconsistent returns 
'*limiter'.

Old smatch warnings:
net/rxrpc/call_object.c:375 rxrpc_new_client_call() warn: inconsistent returns 
'call->user_mutex'.

# 
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=b7a7d67408032843c14071711d6259aada9392f0
git remote add linux-next 
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
git fetch --no-tags linux-next master
git checkout b7a7d67408032843c14071711d6259aada9392f0
vim +375 net/rxrpc/call_object.c

b7a7d6740803284 net/rxrpc/call_object.c David Howells 2020-07-02  244  
17926a79320afa9 net/rxrpc/ar-call.c     David Howells 2007-04-26  245  /*
540b1c48c37ac0a net/rxrpc/call_object.c David Howells 2017-02-27  246   * Set 
up a call for the given parameters.
540b1c48c37ac0a net/rxrpc/call_object.c David Howells 2017-02-27  247   * - 
Called with the socket lock held, which it must release.
540b1c48c37ac0a net/rxrpc/call_object.c David Howells 2017-02-27  248   * - If 
it returns a call, the call's lock will need releasing by the caller.
17926a79320afa9 net/rxrpc/ar-call.c     David Howells 2007-04-26  249   */
2341e0775747864 net/rxrpc/ar-call.c     David Howells 2016-06-09  250  struct 
rxrpc_call *rxrpc_new_client_call(struct rxrpc_sock *rx,
19ffa01c9c45861 net/rxrpc/call_object.c David Howells 2016-04-04  251           
                         struct rxrpc_conn_parameters *cp,
999b69f89241c93 net/rxrpc/call_object.c David Howells 2016-06-17  252           
                         struct sockaddr_rxrpc *srx,
4812417894770f8 net/rxrpc/call_object.c David Howells 2017-11-24  253           
                         struct rxrpc_call_params *p,
a25e21f0bcd2567 net/rxrpc/call_object.c David Howells 2018-03-27  254           
                         gfp_t gfp,
a25e21f0bcd2567 net/rxrpc/call_object.c David Howells 2018-03-27  255           
                         unsigned int debug_id)
540b1c48c37ac0a net/rxrpc/call_object.c David Howells 2017-02-27  256   
__releases(&rx->sk.sk_lock.slock)
88f2a8257c9aa7d net/rxrpc/call_object.c David Howells 2018-03-30  257   
__acquires(&call->user_mutex)
17926a79320afa9 net/rxrpc/ar-call.c     David Howells 2007-04-26  258  {
2341e0775747864 net/rxrpc/ar-call.c     David Howells 2016-06-09  259   struct 
rxrpc_call *call, *xcall;
d3be4d244330f7e net/rxrpc/call_object.c David Howells 2018-03-30  260   struct 
rxrpc_net *rxnet;
b7a7d6740803284 net/rxrpc/call_object.c David Howells 2020-07-02  261   struct 
semaphore *limiter;
2341e0775747864 net/rxrpc/ar-call.c     David Howells 2016-06-09  262   struct 
rb_node *parent, **pp;
e34d4234b0b77a8 net/rxrpc/call_object.c David Howells 2016-08-30  263   const 
void *here = __builtin_return_address(0);
999b69f89241c93 net/rxrpc/call_object.c David Howells 2016-06-17  264   int ret;
17926a79320afa9 net/rxrpc/ar-call.c     David Howells 2007-04-26  265  
4812417894770f8 net/rxrpc/call_object.c David Howells 2017-11-24  266   
_enter("%p,%lx", rx, p->user_call_ID);
17926a79320afa9 net/rxrpc/ar-call.c     David Howells 2007-04-26  267  
b7a7d6740803284 net/rxrpc/call_object.c David Howells 2020-07-02  268   limiter 
= rxrpc_get_call_slot(p, gfp);
b7a7d6740803284 net/rxrpc/call_object.c David Howells 2020-07-02  269   if 
(!limiter)
b7a7d6740803284 net/rxrpc/call_object.c David Howells 2020-07-02  270           
return ERR_PTR(-ERESTARTSYS);
b7a7d6740803284 net/rxrpc/call_object.c David Howells 2020-07-02  271  
a25e21f0bcd2567 net/rxrpc/call_object.c David Howells 2018-03-27  272   call = 
rxrpc_alloc_client_call(rx, srx, gfp, debug_id);
2341e0775747864 net/rxrpc/ar-call.c     David Howells 2016-06-09  273   if 
(IS_ERR(call)) {
540b1c48c37ac0a net/rxrpc/call_object.c David Howells 2017-02-27  274           
release_sock(&rx->sk);
b7a7d6740803284 net/rxrpc/call_object.c David Howells 2020-07-02  275           
up(limiter);
2341e0775747864 net/rxrpc/ar-call.c     David Howells 2016-06-09  276           
_leave(" = %ld", PTR_ERR(call));
2341e0775747864 net/rxrpc/ar-call.c     David Howells 2016-06-09  277           
return call;
17926a79320afa9 net/rxrpc/ar-call.c     David Howells 2007-04-26  278   }
17926a79320afa9 net/rxrpc/ar-call.c     David Howells 2007-04-26  279  
e138aa7d3271ac1 net/rxrpc/call_object.c David Howells 2020-03-13  280   
call->interruptibility = p->interruptibility;
4812417894770f8 net/rxrpc/call_object.c David Howells 2017-11-24  281   
call->tx_total_len = p->tx_total_len;
48c9e0ec7cbbb73 net/rxrpc/call_object.c David Howells 2019-10-07  282   
trace_rxrpc_call(call->debug_id, rxrpc_call_new_client,
48c9e0ec7cbbb73 net/rxrpc/call_object.c David Howells 2019-10-07  283           
         atomic_read(&call->usage),
4812417894770f8 net/rxrpc/call_object.c David Howells 2017-11-24  284           
         here, (const void *)p->user_call_ID);
b7a7d6740803284 net/rxrpc/call_object.c David Howells 2020-07-02  285   if 
(p->kernel)
b7a7d6740803284 net/rxrpc/call_object.c David Howells 2020-07-02  286           
__set_bit(RXRPC_CALL_KERNEL, &call->flags);
e34d4234b0b77a8 net/rxrpc/call_object.c David Howells 2016-08-30  287  
540b1c48c37ac0a net/rxrpc/call_object.c David Howells 2017-02-27  288   /* We 
need to protect a partially set up call against the user as we
540b1c48c37ac0a net/rxrpc/call_object.c David Howells 2017-02-27  289    * will 
be acting outside the socket lock.
540b1c48c37ac0a net/rxrpc/call_object.c David Howells 2017-02-27  290    */
540b1c48c37ac0a net/rxrpc/call_object.c David Howells 2017-02-27  291   
mutex_lock(&call->user_mutex);
540b1c48c37ac0a net/rxrpc/call_object.c David Howells 2017-02-27  292  
999b69f89241c93 net/rxrpc/call_object.c David Howells 2016-06-17  293   /* 
Publish the call, even though it is incompletely set up as yet */
17926a79320afa9 net/rxrpc/ar-call.c     David Howells 2007-04-26  294   
write_lock(&rx->call_lock);
17926a79320afa9 net/rxrpc/ar-call.c     David Howells 2007-04-26  295  
17926a79320afa9 net/rxrpc/ar-call.c     David Howells 2007-04-26  296   pp = 
&rx->calls.rb_node;
17926a79320afa9 net/rxrpc/ar-call.c     David Howells 2007-04-26  297   parent 
= NULL;
17926a79320afa9 net/rxrpc/ar-call.c     David Howells 2007-04-26  298   while 
(*pp) {
17926a79320afa9 net/rxrpc/ar-call.c     David Howells 2007-04-26  299           
parent = *pp;
2341e0775747864 net/rxrpc/ar-call.c     David Howells 2016-06-09  300           
xcall = rb_entry(parent, struct rxrpc_call, sock_node);
17926a79320afa9 net/rxrpc/ar-call.c     David Howells 2007-04-26  301  
4812417894770f8 net/rxrpc/call_object.c David Howells 2017-11-24  302           
if (p->user_call_ID < xcall->user_call_ID)
17926a79320afa9 net/rxrpc/ar-call.c     David Howells 2007-04-26  303           
        pp = &(*pp)->rb_left;
4812417894770f8 net/rxrpc/call_object.c David Howells 2017-11-24  304           
else if (p->user_call_ID > xcall->user_call_ID)
17926a79320afa9 net/rxrpc/ar-call.c     David Howells 2007-04-26  305           
        pp = &(*pp)->rb_right;
17926a79320afa9 net/rxrpc/ar-call.c     David Howells 2007-04-26  306           
else
357f5ef64628c2d net/rxrpc/call_object.c David Howells 2016-09-17  307           
        goto error_dup_user_ID;
17926a79320afa9 net/rxrpc/ar-call.c     David Howells 2007-04-26  308   }
17926a79320afa9 net/rxrpc/ar-call.c     David Howells 2007-04-26  309  
248f219cb8bcbfb net/rxrpc/call_object.c David Howells 2016-09-08  310   
rcu_assign_pointer(call->socket, rx);
4812417894770f8 net/rxrpc/call_object.c David Howells 2017-11-24  311   
call->user_call_ID = p->user_call_ID;
357f5ef64628c2d net/rxrpc/call_object.c David Howells 2016-09-17  312   
__set_bit(RXRPC_CALL_HAS_USERID, &call->flags);
fff72429c2e83bd net/rxrpc/call_object.c David Howells 2016-09-07  313   
rxrpc_get_call(call, rxrpc_call_got_userid);
17926a79320afa9 net/rxrpc/ar-call.c     David Howells 2007-04-26  314   
rb_link_node(&call->sock_node, parent, pp);
17926a79320afa9 net/rxrpc/ar-call.c     David Howells 2007-04-26  315   
rb_insert_color(&call->sock_node, &rx->calls);
248f219cb8bcbfb net/rxrpc/call_object.c David Howells 2016-09-08  316   
list_add(&call->sock_link, &rx->sock_calls);
248f219cb8bcbfb net/rxrpc/call_object.c David Howells 2016-09-08  317  
17926a79320afa9 net/rxrpc/ar-call.c     David Howells 2007-04-26  318   
write_unlock(&rx->call_lock);
17926a79320afa9 net/rxrpc/ar-call.c     David Howells 2007-04-26  319  
d3be4d244330f7e net/rxrpc/call_object.c David Howells 2018-03-30  320   rxnet = 
call->rxnet;
2baec2c3f854d1f net/rxrpc/call_object.c David Howells 2017-05-24  321   
write_lock(&rxnet->call_lock);
2baec2c3f854d1f net/rxrpc/call_object.c David Howells 2017-05-24  322   
list_add_tail(&call->link, &rxnet->calls);
2baec2c3f854d1f net/rxrpc/call_object.c David Howells 2017-05-24  323   
write_unlock(&rxnet->call_lock);
17926a79320afa9 net/rxrpc/ar-call.c     David Howells 2007-04-26  324  
540b1c48c37ac0a net/rxrpc/call_object.c David Howells 2017-02-27  325   /* From 
this point on, the call is protected by its own lock. */
540b1c48c37ac0a net/rxrpc/call_object.c David Howells 2017-02-27  326   
release_sock(&rx->sk);
540b1c48c37ac0a net/rxrpc/call_object.c David Howells 2017-02-27  327  
248f219cb8bcbfb net/rxrpc/call_object.c David Howells 2016-09-08  328   /* Set 
up or get a connection record and set the protocol parameters,
248f219cb8bcbfb net/rxrpc/call_object.c David Howells 2016-09-08  329    * 
including channel number and call ID.
248f219cb8bcbfb net/rxrpc/call_object.c David Howells 2016-09-08  330    */
5e33a23ba4b56c1 net/rxrpc/call_object.c David Howells 2018-10-05  331   ret = 
rxrpc_connect_call(rx, call, cp, srx, gfp);
999b69f89241c93 net/rxrpc/call_object.c David Howells 2016-06-17  332   if (ret 
< 0)
65550098c1c4db5 net/rxrpc/call_object.c David Howells 2020-07-29  333           
goto error_attached_to_socket;
999b69f89241c93 net/rxrpc/call_object.c David Howells 2016-06-17  334  
48c9e0ec7cbbb73 net/rxrpc/call_object.c David Howells 2019-10-07  335   
trace_rxrpc_call(call->debug_id, rxrpc_call_connected,
48c9e0ec7cbbb73 net/rxrpc/call_object.c David Howells 2019-10-07  336           
         atomic_read(&call->usage), here, NULL);
a84a46d73050f70 net/rxrpc/call_object.c David Howells 2016-09-17  337  
248f219cb8bcbfb net/rxrpc/call_object.c David Howells 2016-09-08  338   
rxrpc_start_call_timer(call);
248f219cb8bcbfb net/rxrpc/call_object.c David Howells 2016-09-08  339  
17926a79320afa9 net/rxrpc/ar-call.c     David Howells 2007-04-26  340   
_net("CALL new %d on CONN %d", call->debug_id, call->conn->debug_id);
17926a79320afa9 net/rxrpc/ar-call.c     David Howells 2007-04-26  341  
17926a79320afa9 net/rxrpc/ar-call.c     David Howells 2007-04-26  342   
_leave(" = %p [new]", call);
17926a79320afa9 net/rxrpc/ar-call.c     David Howells 2007-04-26  343   return 
call;
17926a79320afa9 net/rxrpc/ar-call.c     David Howells 2007-04-26  344  
2341e0775747864 net/rxrpc/ar-call.c     David Howells 2016-06-09  345   /* We 
unexpectedly found the user ID in the list after taking
2341e0775747864 net/rxrpc/ar-call.c     David Howells 2016-06-09  346    * the 
call_lock.  This shouldn't happen unless the user races
2341e0775747864 net/rxrpc/ar-call.c     David Howells 2016-06-09  347    * with 
itself and tries to add the same user ID twice at the
2341e0775747864 net/rxrpc/ar-call.c     David Howells 2016-06-09  348    * same 
time in different threads.
2341e0775747864 net/rxrpc/ar-call.c     David Howells 2016-06-09  349    */
357f5ef64628c2d net/rxrpc/call_object.c David Howells 2016-09-17  350  
error_dup_user_ID:
17926a79320afa9 net/rxrpc/ar-call.c     David Howells 2007-04-26  351   
write_unlock(&rx->call_lock);
540b1c48c37ac0a net/rxrpc/call_object.c David Howells 2017-02-27  352   
release_sock(&rx->sk);
357f5ef64628c2d net/rxrpc/call_object.c David Howells 2016-09-17  353   
__rxrpc_set_call_completion(call, RXRPC_CALL_LOCAL_ERROR,
65550098c1c4db5 net/rxrpc/call_object.c David Howells 2020-07-29  354           
                    RX_CALL_DEAD, -EEXIST);
48c9e0ec7cbbb73 net/rxrpc/call_object.c David Howells 2019-10-07  355   
trace_rxrpc_call(call->debug_id, rxrpc_call_error,
65550098c1c4db5 net/rxrpc/call_object.c David Howells 2020-07-29  356           
         atomic_read(&call->usage), here, ERR_PTR(-EEXIST));
357f5ef64628c2d net/rxrpc/call_object.c David Howells 2016-09-17  357   
rxrpc_release_call(rx, call);
540b1c48c37ac0a net/rxrpc/call_object.c David Howells 2017-02-27  358   
mutex_unlock(&call->user_mutex);
357f5ef64628c2d net/rxrpc/call_object.c David Howells 2016-09-17  359   
rxrpc_put_call(call, rxrpc_call_put);
65550098c1c4db5 net/rxrpc/call_object.c David Howells 2020-07-29  360   
_leave(" = -EEXIST");
65550098c1c4db5 net/rxrpc/call_object.c David Howells 2020-07-29  361   return 
ERR_PTR(-EEXIST);
65550098c1c4db5 net/rxrpc/call_object.c David Howells 2020-07-29  362  
65550098c1c4db5 net/rxrpc/call_object.c David Howells 2020-07-29  363   /* We 
got an error, but the call is attached to the socket and is in
65550098c1c4db5 net/rxrpc/call_object.c David Howells 2020-07-29  364    * need 
of release.  However, we might now race with recvmsg() when
65550098c1c4db5 net/rxrpc/call_object.c David Howells 2020-07-29  365    * 
completing the call queues it.  Return 0 from sys_sendmsg() and
65550098c1c4db5 net/rxrpc/call_object.c David Howells 2020-07-29  366    * 
leave the error to recvmsg() to deal with.
65550098c1c4db5 net/rxrpc/call_object.c David Howells 2020-07-29  367    */
65550098c1c4db5 net/rxrpc/call_object.c David Howells 2020-07-29  368  
error_attached_to_socket:
65550098c1c4db5 net/rxrpc/call_object.c David Howells 2020-07-29  369   
trace_rxrpc_call(call->debug_id, rxrpc_call_error,
65550098c1c4db5 net/rxrpc/call_object.c David Howells 2020-07-29  370           
         atomic_read(&call->usage), here, ERR_PTR(ret));
65550098c1c4db5 net/rxrpc/call_object.c David Howells 2020-07-29  371   
set_bit(RXRPC_CALL_DISCONNECTED, &call->flags);
65550098c1c4db5 net/rxrpc/call_object.c David Howells 2020-07-29  372   
__rxrpc_set_call_completion(call, RXRPC_CALL_LOCAL_ERROR,
65550098c1c4db5 net/rxrpc/call_object.c David Howells 2020-07-29  373           
                    RX_CALL_DEAD, ret);
65550098c1c4db5 net/rxrpc/call_object.c David Howells 2020-07-29  374   
_leave(" = c=%08x [err]", call->debug_id);
65550098c1c4db5 net/rxrpc/call_object.c David Howells 2020-07-29 @375   return 
call;
17926a79320afa9 net/rxrpc/ar-call.c     David Howells 2007-04-26  376  }
17926a79320afa9 net/rxrpc/ar-call.c     David Howells 2007-04-26  377  

:::::: The code at line 375 was first introduced by commit
:::::: 65550098c1c4db528400c73acf3e46bfa78d9264 rxrpc: Fix race between recvmsg 
and sendmsg on immediate call failure

:::::: TO: David Howells <dhowe...@redhat.com>
:::::: CC: David S. Miller <da...@davemloft.net>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org

Attachment: .config.gz
Description: application/gzip

_______________________________________________
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org

Reply via email to