]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
rxrpc: Fix checker warnings and errors
authorDavid Howells <dhowells@redhat.com>
Fri, 30 Mar 2018 20:05:17 +0000 (21:05 +0100)
committerDavid Howells <dhowells@redhat.com>
Fri, 30 Mar 2018 20:05:17 +0000 (21:05 +0100)
Fix various issues detected by checker.

Errors:

 (*) rxrpc_discard_prealloc() should be using rcu_assign_pointer to set
     call->socket.

Warnings:

 (*) rxrpc_service_connection_reaper() should be passing NULL rather than 0 to
     trace_rxrpc_conn() as the where argument.

 (*) rxrpc_disconnect_client_call() should get its net pointer via the
     call->conn rather than call->sock to avoid a warning about accessing
     an RCU pointer without protection.

 (*) Proc seq start/stop functions need annotation as they pass locks
     between the functions.

False positives:

 (*) Checker doesn't correctly handle of seq-retry lock context balance in
     rxrpc_find_service_conn_rcu().

 (*) Checker thinks execution may proceed past the BUG() in
     rxrpc_publish_service_conn().

 (*) Variable length array warnings from SKCIPHER_REQUEST_ON_STACK() in
     rxkad.c.

Signed-off-by: David Howells <dhowells@redhat.com>
net/rxrpc/call_accept.c
net/rxrpc/call_object.c
net/rxrpc/conn_client.c
net/rxrpc/conn_object.c
net/rxrpc/proc.c
net/rxrpc/sendmsg.c

index 92ebd1d7e0bba665933c0a5ff2184f74926887c4..4ce24c00065327ec3b588a79be2aa04872719f8d 100644 (file)
@@ -225,7 +225,7 @@ void rxrpc_discard_prealloc(struct rxrpc_sock *rx)
        tail = b->call_backlog_tail;
        while (CIRC_CNT(head, tail, size) > 0) {
                struct rxrpc_call *call = b->call_backlog[tail];
-               call->socket = rx;
+               rcu_assign_pointer(call->socket, rx);
                if (rx->discard_new_call) {
                        _debug("discard %lx", call->user_call_ID);
                        rx->discard_new_call(call, call->user_call_ID);
@@ -456,6 +456,7 @@ struct rxrpc_call *rxrpc_accept_call(struct rxrpc_sock *rx,
                                     unsigned long user_call_ID,
                                     rxrpc_notify_rx_t notify_rx)
        __releases(&rx->sk.sk_lock.slock)
+       __acquires(call->user_mutex)
 {
        struct rxrpc_call *call;
        struct rb_node *parent, **pp;
index 147657dfe7577dc2b45e63ec7db986604153ee97..85b12c472522663b6daa404fb4aa3816ab2c9543 100644 (file)
@@ -219,6 +219,7 @@ struct rxrpc_call *rxrpc_new_client_call(struct rxrpc_sock *rx,
                                         gfp_t gfp,
                                         unsigned int debug_id)
        __releases(&rx->sk.sk_lock.slock)
+       __acquires(&call->user_mutex)
 {
        struct rxrpc_call *call, *xcall;
        struct rxrpc_net *rxnet = rxrpc_net(sock_net(&rx->sk));
index 06417506805933368dba2ae4f0bd0e7635496a1d..041da40dbf936d20f37b61cc12fc6803a4125524 100644 (file)
@@ -776,7 +776,7 @@ void rxrpc_disconnect_client_call(struct rxrpc_call *call)
        unsigned int channel = call->cid & RXRPC_CHANNELMASK;
        struct rxrpc_connection *conn = call->conn;
        struct rxrpc_channel *chan = &conn->channels[channel];
-       struct rxrpc_net *rxnet = rxrpc_net(sock_net(&call->socket->sk));
+       struct rxrpc_net *rxnet = conn->params.local->rxnet;
 
        trace_rxrpc_client(conn, channel, rxrpc_client_chan_disconnect);
        call->conn = NULL;
index ccbac190add1fa07bb35fe399572f2e7d3fdb015..bfc46fd69a621d6d25e5548223578f642e2e0347 100644 (file)
@@ -418,7 +418,7 @@ void rxrpc_service_connection_reaper(struct work_struct *work)
                 */
                if (atomic_cmpxchg(&conn->usage, 1, 0) != 1)
                        continue;
-               trace_rxrpc_conn(conn, rxrpc_conn_reap_service, 0, 0);
+               trace_rxrpc_conn(conn, rxrpc_conn_reap_service, 0, NULL);
 
                if (rxrpc_conn_is_client(conn))
                        BUG();
index f79f260c6ddce66254ee86997d70b14d4b455a67..7e45db0588236f9a0e370ed0809a1e889d0a977d 100644 (file)
@@ -29,6 +29,8 @@ static const char *const rxrpc_conn_states[RXRPC_CONN__NR_STATES] = {
  * generate a list of extant and dead calls in /proc/net/rxrpc_calls
  */
 static void *rxrpc_call_seq_start(struct seq_file *seq, loff_t *_pos)
+       __acquires(rcu)
+       __acquires(rxnet->call_lock)
 {
        struct rxrpc_net *rxnet = rxrpc_net(seq_file_net(seq));
 
@@ -45,6 +47,8 @@ static void *rxrpc_call_seq_next(struct seq_file *seq, void *v, loff_t *pos)
 }
 
 static void rxrpc_call_seq_stop(struct seq_file *seq, void *v)
+       __releases(rxnet->call_lock)
+       __releases(rcu)
 {
        struct rxrpc_net *rxnet = rxrpc_net(seq_file_net(seq));
 
@@ -135,6 +139,7 @@ const struct file_operations rxrpc_call_seq_fops = {
  * generate a list of extant virtual connections in /proc/net/rxrpc_conns
  */
 static void *rxrpc_connection_seq_start(struct seq_file *seq, loff_t *_pos)
+       __acquires(rxnet->conn_lock)
 {
        struct rxrpc_net *rxnet = rxrpc_net(seq_file_net(seq));
 
@@ -151,6 +156,7 @@ static void *rxrpc_connection_seq_next(struct seq_file *seq, void *v,
 }
 
 static void rxrpc_connection_seq_stop(struct seq_file *seq, void *v)
+       __releases(rxnet->conn_lock)
 {
        struct rxrpc_net *rxnet = rxrpc_net(seq_file_net(seq));
 
index 783c777fc6e79ac9b4b30c2946eae192f572d8a0..a62980a801517741d7220299606492cbbb0f6dc7 100644 (file)
@@ -556,6 +556,7 @@ static struct rxrpc_call *
 rxrpc_new_client_call_for_sendmsg(struct rxrpc_sock *rx, struct msghdr *msg,
                                  struct rxrpc_send_params *p)
        __releases(&rx->sk.sk_lock.slock)
+       __acquires(&call->user_mutex)
 {
        struct rxrpc_conn_parameters cp;
        struct rxrpc_call *call;
@@ -596,6 +597,7 @@ rxrpc_new_client_call_for_sendmsg(struct rxrpc_sock *rx, struct msghdr *msg,
  */
 int rxrpc_do_sendmsg(struct rxrpc_sock *rx, struct msghdr *msg, size_t len)
        __releases(&rx->sk.sk_lock.slock)
+       __releases(&call->user_mutex)
 {
        enum rxrpc_call_state state;
        struct rxrpc_call *call;