Commit 31d35a02 authored by David Howells's avatar David Howells Committed by David S. Miller

rxrpc: Fix the return value of rxrpc_new_incoming_call()

Dan Carpenter sayeth[1]:

  The patch 5e6ef4f1: "rxrpc: Make the I/O thread take over the
  call and local processor work" from Jan 23, 2020, leads to the
  following Smatch static checker warning:

	net/rxrpc/io_thread.c:283 rxrpc_input_packet()
	warn: bool is not less than zero.

Fix this (for now) by changing rxrpc_new_incoming_call() to return an int
with 0 or error code rather than bool.  Note that the actual return value
of rxrpc_input_packet() is currently ignored.  I have a separate patch to
clean that up.

Fixes: 5e6ef4f1 ("rxrpc: Make the I/O thread take over the call and local processor work")
Reported-by: default avatarDan Carpenter <error27@gmail.com>
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
Link: http://lists.infradead.org/pipermail/linux-afs/2022-December/006123.html [1]
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 11e1706b
...@@ -812,9 +812,9 @@ extern struct workqueue_struct *rxrpc_workqueue; ...@@ -812,9 +812,9 @@ extern struct workqueue_struct *rxrpc_workqueue;
*/ */
int rxrpc_service_prealloc(struct rxrpc_sock *, gfp_t); int rxrpc_service_prealloc(struct rxrpc_sock *, gfp_t);
void rxrpc_discard_prealloc(struct rxrpc_sock *); void rxrpc_discard_prealloc(struct rxrpc_sock *);
bool rxrpc_new_incoming_call(struct rxrpc_local *, struct rxrpc_peer *, int rxrpc_new_incoming_call(struct rxrpc_local *, struct rxrpc_peer *,
struct rxrpc_connection *, struct sockaddr_rxrpc *, struct rxrpc_connection *, struct sockaddr_rxrpc *,
struct sk_buff *); struct sk_buff *);
void rxrpc_accept_incoming_calls(struct rxrpc_local *); void rxrpc_accept_incoming_calls(struct rxrpc_local *);
int rxrpc_user_charge_accept(struct rxrpc_sock *, unsigned long); int rxrpc_user_charge_accept(struct rxrpc_sock *, unsigned long);
......
...@@ -326,11 +326,11 @@ static struct rxrpc_call *rxrpc_alloc_incoming_call(struct rxrpc_sock *rx, ...@@ -326,11 +326,11 @@ static struct rxrpc_call *rxrpc_alloc_incoming_call(struct rxrpc_sock *rx,
* If we want to report an error, we mark the skb with the packet type and * If we want to report an error, we mark the skb with the packet type and
* abort code and return false. * abort code and return false.
*/ */
bool rxrpc_new_incoming_call(struct rxrpc_local *local, int rxrpc_new_incoming_call(struct rxrpc_local *local,
struct rxrpc_peer *peer, struct rxrpc_peer *peer,
struct rxrpc_connection *conn, struct rxrpc_connection *conn,
struct sockaddr_rxrpc *peer_srx, struct sockaddr_rxrpc *peer_srx,
struct sk_buff *skb) struct sk_buff *skb)
{ {
const struct rxrpc_security *sec = NULL; const struct rxrpc_security *sec = NULL;
struct rxrpc_skb_priv *sp = rxrpc_skb(skb); struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
...@@ -342,7 +342,7 @@ bool rxrpc_new_incoming_call(struct rxrpc_local *local, ...@@ -342,7 +342,7 @@ bool rxrpc_new_incoming_call(struct rxrpc_local *local,
/* Don't set up a call for anything other than the first DATA packet. */ /* Don't set up a call for anything other than the first DATA packet. */
if (sp->hdr.seq != 1 || if (sp->hdr.seq != 1 ||
sp->hdr.type != RXRPC_PACKET_TYPE_DATA) sp->hdr.type != RXRPC_PACKET_TYPE_DATA)
return true; /* Just discard */ return 0; /* Just discard */
rcu_read_lock(); rcu_read_lock();
...@@ -413,7 +413,7 @@ bool rxrpc_new_incoming_call(struct rxrpc_local *local, ...@@ -413,7 +413,7 @@ bool rxrpc_new_incoming_call(struct rxrpc_local *local,
_leave(" = %p{%d}", call, call->debug_id); _leave(" = %p{%d}", call, call->debug_id);
rxrpc_input_call_event(call, skb); rxrpc_input_call_event(call, skb);
rxrpc_put_call(call, rxrpc_call_put_input); rxrpc_put_call(call, rxrpc_call_put_input);
return true; return 0;
unsupported_service: unsupported_service:
trace_rxrpc_abort(0, "INV", sp->hdr.cid, sp->hdr.callNumber, sp->hdr.seq, trace_rxrpc_abort(0, "INV", sp->hdr.cid, sp->hdr.callNumber, sp->hdr.seq,
...@@ -425,10 +425,10 @@ bool rxrpc_new_incoming_call(struct rxrpc_local *local, ...@@ -425,10 +425,10 @@ bool rxrpc_new_incoming_call(struct rxrpc_local *local,
reject: reject:
rcu_read_unlock(); rcu_read_unlock();
_leave(" = f [%u]", skb->mark); _leave(" = f [%u]", skb->mark);
return false; return -EPROTO;
discard: discard:
rcu_read_unlock(); rcu_read_unlock();
return true; return 0;
} }
/* /*
......
...@@ -292,7 +292,7 @@ static int rxrpc_input_packet(struct rxrpc_local *local, struct sk_buff **_skb) ...@@ -292,7 +292,7 @@ static int rxrpc_input_packet(struct rxrpc_local *local, struct sk_buff **_skb)
skb->mark = RXRPC_SKB_MARK_REJECT_ABORT; skb->mark = RXRPC_SKB_MARK_REJECT_ABORT;
reject_packet: reject_packet:
rxrpc_reject_packet(local, skb); rxrpc_reject_packet(local, skb);
return ret; return 0;
} }
/* /*
...@@ -384,7 +384,7 @@ static int rxrpc_input_packet_on_conn(struct rxrpc_connection *conn, ...@@ -384,7 +384,7 @@ static int rxrpc_input_packet_on_conn(struct rxrpc_connection *conn,
if (rxrpc_to_client(sp)) if (rxrpc_to_client(sp))
goto bad_message; goto bad_message;
if (rxrpc_new_incoming_call(conn->local, conn->peer, conn, if (rxrpc_new_incoming_call(conn->local, conn->peer, conn,
peer_srx, skb)) peer_srx, skb) == 0)
return 0; return 0;
goto reject_packet; goto reject_packet;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment