* [PATCH net] rxrpc: Fix wrong error return in rxrpc_connect_call()
@ 2023-01-11 18:07 David Howells
2023-01-12 16:57 ` Alexander H Duyck
2023-01-13 19:40 ` Jakub Kicinski
0 siblings, 2 replies; 3+ messages in thread
From: David Howells @ 2023-01-11 18:07 UTC (permalink / raw)
To: netdev
Cc: dhowells, Marc Dionne, Dan Carpenter, kernel test robot,
syzbot+4bb6356bb29d6299360e, linux-afs, linux-kernel
Fix rxrpc_connect_call() to return -ENOMEM rather than 0 if it fails to
look up a peer.
This generated a smatch warning:
net/rxrpc/call_object.c:303 rxrpc_connect_call() warn: missing error code 'ret'
I think this also fixes a syzbot-found bug:
rxrpc: Assertion failed - 1(0x1) == 11(0xb) is false
------------[ cut here ]------------
kernel BUG at net/rxrpc/call_object.c:645!
where the call being put is in the wrong state - as would be the case if we
failed to clear up correctly after the error in rxrpc_connect_call().
Fixes: 9d35d880e0e4 ("rxrpc: Move client call connection to the I/O thread")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <error27@gmail.com>
Reported-and-tested-by: syzbot+4bb6356bb29d6299360e@syzkaller.appspotmail.com
Signed-off-by: David Howells <dhowells@redhat.com>
Link: https://lore.kernel.org/r/202301111153.9eZRYLf1-lkp@intel.com/
---
net/rxrpc/call_object.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/rxrpc/call_object.c b/net/rxrpc/call_object.c
index 3ded5a24627c..f3c9f0201c15 100644
--- a/net/rxrpc/call_object.c
+++ b/net/rxrpc/call_object.c
@@ -294,7 +294,7 @@ static void rxrpc_put_call_slot(struct rxrpc_call *call)
static int rxrpc_connect_call(struct rxrpc_call *call, gfp_t gfp)
{
struct rxrpc_local *local = call->local;
- int ret = 0;
+ int ret = -ENOMEM;
_enter("{%d,%lx},", call->debug_id, call->user_call_ID);
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net] rxrpc: Fix wrong error return in rxrpc_connect_call()
2023-01-11 18:07 [PATCH net] rxrpc: Fix wrong error return in rxrpc_connect_call() David Howells
@ 2023-01-12 16:57 ` Alexander H Duyck
2023-01-13 19:40 ` Jakub Kicinski
1 sibling, 0 replies; 3+ messages in thread
From: Alexander H Duyck @ 2023-01-12 16:57 UTC (permalink / raw)
To: David Howells, netdev
Cc: Marc Dionne, Dan Carpenter, kernel test robot,
syzbot+4bb6356bb29d6299360e, linux-afs, linux-kernel
On Wed, 2023-01-11 at 18:07 +0000, David Howells wrote:
>
> Fix rxrpc_connect_call() to return -ENOMEM rather than 0 if it fails to
> look up a peer.
>
> This generated a smatch warning:
> net/rxrpc/call_object.c:303 rxrpc_connect_call() warn: missing error code 'ret'
>
> I think this also fixes a syzbot-found bug:
>
> rxrpc: Assertion failed - 1(0x1) == 11(0xb) is false
> ------------[ cut here ]------------
> kernel BUG at net/rxrpc/call_object.c:645!
>
> where the call being put is in the wrong state - as would be the case if we
> failed to clear up correctly after the error in rxrpc_connect_call().
>
> Fixes: 9d35d880e0e4 ("rxrpc: Move client call connection to the I/O thread")
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <error27@gmail.com>
> Reported-and-tested-by: syzbot+4bb6356bb29d6299360e@syzkaller.appspotmail.com
> Signed-off-by: David Howells <dhowells@redhat.com>
> Link: https://lore.kernel.org/r/202301111153.9eZRYLf1-lkp@intel.com/
> ---
> net/rxrpc/call_object.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/rxrpc/call_object.c b/net/rxrpc/call_object.c
> index 3ded5a24627c..f3c9f0201c15 100644
> --- a/net/rxrpc/call_object.c
> +++ b/net/rxrpc/call_object.c
> @@ -294,7 +294,7 @@ static void rxrpc_put_call_slot(struct rxrpc_call *call)
> static int rxrpc_connect_call(struct rxrpc_call *call, gfp_t gfp)
> {
> struct rxrpc_local *local = call->local;
> - int ret = 0;
> + int ret = -ENOMEM;
>
> _enter("{%d,%lx},", call->debug_id, call->user_call_ID);
>
Looks good to me.
Reviewed-by: Alexander Duyck <alexanderduyck@fb.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] rxrpc: Fix wrong error return in rxrpc_connect_call()
2023-01-11 18:07 [PATCH net] rxrpc: Fix wrong error return in rxrpc_connect_call() David Howells
2023-01-12 16:57 ` Alexander H Duyck
@ 2023-01-13 19:40 ` Jakub Kicinski
1 sibling, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2023-01-13 19:40 UTC (permalink / raw)
To: David Howells
Cc: netdev, Marc Dionne, Dan Carpenter, kernel test robot,
syzbot+4bb6356bb29d6299360e, linux-afs, linux-kernel
On Wed, 11 Jan 2023 18:07:15 +0000 David Howells wrote:
> Fix rxrpc_connect_call() to return -ENOMEM rather than 0 if it fails to
> look up a peer.
>
> This generated a smatch warning:
> net/rxrpc/call_object.c:303 rxrpc_connect_call() warn: missing error code 'ret'
>
> I think this also fixes a syzbot-found bug:
>
> rxrpc: Assertion failed - 1(0x1) == 11(0xb) is false
> ------------[ cut here ]------------
> kernel BUG at net/rxrpc/call_object.c:645!
>
> where the call being put is in the wrong state - as would be the case if we
> failed to clear up correctly after the error in rxrpc_connect_call().
Applied, thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-01-13 19:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-11 18:07 [PATCH net] rxrpc: Fix wrong error return in rxrpc_connect_call() David Howells
2023-01-12 16:57 ` Alexander H Duyck
2023-01-13 19:40 ` Jakub Kicinski
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.