netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] rxrpc: uninitialized variable in rxrpc_send_ack_packet()
@ 2022-11-17  7:44 Dan Carpenter
  2022-11-17  9:44 ` David Howells
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Dan Carpenter @ 2022-11-17  7:44 UTC (permalink / raw)
  To: David Howells
  Cc: Marc Dionne, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, linux-afs, netdev, kernel-janitors

The "pkt" was supposed to have been deleted in a previous patch.  It
leads to an uninitialized variable bug.

Fixes: 72f0c6fb0579 ("rxrpc: Allocate ACK records at proposal and queue for transmission")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Applies to net-next.

 net/rxrpc/output.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/net/rxrpc/output.c b/net/rxrpc/output.c
index 46432e70a16b..04f945e042ab 100644
--- a/net/rxrpc/output.c
+++ b/net/rxrpc/output.c
@@ -202,7 +202,6 @@ static void rxrpc_cancel_rtt_probe(struct rxrpc_call *call,
 static int rxrpc_send_ack_packet(struct rxrpc_local *local, struct rxrpc_txbuf *txb)
 {
 	struct rxrpc_connection *conn;
-	struct rxrpc_ack_buffer *pkt;
 	struct rxrpc_call *call = txb->call;
 	struct msghdr msg;
 	struct kvec iov[1];
@@ -270,7 +269,6 @@ static int rxrpc_send_ack_packet(struct rxrpc_local *local, struct rxrpc_txbuf *
 		rxrpc_set_keepalive(call);
 	}
 
-	kfree(pkt);
 	return ret;
 }
 
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH net-next] rxrpc: uninitialized variable in rxrpc_send_ack_packet()
  2022-11-17  7:44 [PATCH net-next] rxrpc: uninitialized variable in rxrpc_send_ack_packet() Dan Carpenter
@ 2022-11-17  9:44 ` David Howells
  2022-11-17 10:34   ` Dan Carpenter
  2022-11-17 11:59   ` David Howells
  2022-11-17 12:04 ` David Howells
  2022-11-18 12:10 ` patchwork-bot+netdevbpf
  2 siblings, 2 replies; 7+ messages in thread
From: David Howells @ 2022-11-17  9:44 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: dhowells, Marc Dionne, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, linux-afs, netdev, kernel-janitors

Dan Carpenter <error27@gmail.com> wrote:

> The "pkt" was supposed to have been deleted in a previous patch.  It
> leads to an uninitialized variable bug.

Weird.  I don't get a compiler warning and the kernel doesn't crash, despite
transmitting millions of acks.

If I disassemble the built code, I see:

   0xffffffff81b09e89 <+723>:   xor    %edi,%edi
   0xffffffff81b09e8b <+725>:   call   0xffffffff811c0bc1 <kfree>

I'm not sure why it's sticking 0 in EDI, though.

David


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH net-next] rxrpc: uninitialized variable in rxrpc_send_ack_packet()
  2022-11-17  9:44 ` David Howells
@ 2022-11-17 10:34   ` Dan Carpenter
  2022-11-17 11:59   ` David Howells
  1 sibling, 0 replies; 7+ messages in thread
From: Dan Carpenter @ 2022-11-17 10:34 UTC (permalink / raw)
  To: David Howells
  Cc: Marc Dionne, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, linux-afs, netdev, kernel-janitors

On Thu, Nov 17, 2022 at 09:44:24AM +0000, David Howells wrote:
> Dan Carpenter <error27@gmail.com> wrote:
> 
> > The "pkt" was supposed to have been deleted in a previous patch.  It
> > leads to an uninitialized variable bug.
> 
> Weird.  I don't get a compiler warning and the kernel doesn't crash, despite
> transmitting millions of acks.
> 
> If I disassemble the built code, I see:
> 
>    0xffffffff81b09e89 <+723>:   xor    %edi,%edi
>    0xffffffff81b09e8b <+725>:   call   0xffffffff811c0bc1 <kfree>
> 
> I'm not sure why it's sticking 0 in EDI, though.

We disabled GCC's check for uninitialized variables.  It could be that
you have the .config to automatically zero out stack variables.

CONFIG_CC_HAS_AUTO_VAR_INIT_PATTERN=y
CONFIG_CC_HAS_AUTO_VAR_INIT_ZERO_BARE=y
CONFIG_CC_HAS_AUTO_VAR_INIT_ZERO=y

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH net-next] rxrpc: uninitialized variable in rxrpc_send_ack_packet()
  2022-11-17  9:44 ` David Howells
  2022-11-17 10:34   ` Dan Carpenter
@ 2022-11-17 11:59   ` David Howells
  2022-11-17 13:35     ` Dan Carpenter
  1 sibling, 1 reply; 7+ messages in thread
From: David Howells @ 2022-11-17 11:59 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: dhowells, Marc Dionne, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, linux-afs, netdev, kernel-janitors

Dan Carpenter <error27@gmail.com> wrote:

> We disabled GCC's check for uninitialized variables.  It could be that
> you have the .config to automatically zero out stack variables.
> 
> CONFIG_CC_HAS_AUTO_VAR_INIT_PATTERN=y
> CONFIG_CC_HAS_AUTO_VAR_INIT_ZERO_BARE=y
> CONFIG_CC_HAS_AUTO_VAR_INIT_ZERO=y

Ah.  Is there a way to reenable that?

David


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH net-next] rxrpc: uninitialized variable in rxrpc_send_ack_packet()
  2022-11-17  7:44 [PATCH net-next] rxrpc: uninitialized variable in rxrpc_send_ack_packet() Dan Carpenter
  2022-11-17  9:44 ` David Howells
@ 2022-11-17 12:04 ` David Howells
  2022-11-18 12:10 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 7+ messages in thread
From: David Howells @ 2022-11-17 12:04 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: dhowells, Marc Dionne, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, linux-afs, netdev, kernel-janitors

Dan Carpenter <error27@gmail.com> wrote:

> The "pkt" was supposed to have been deleted in a previous patch.  It
> leads to an uninitialized variable bug.
> 
> Fixes: 72f0c6fb0579 ("rxrpc: Allocate ACK records at proposal and queue for transmission")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Acked-by: David Howells <dhowells@redhat.com>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH net-next] rxrpc: uninitialized variable in rxrpc_send_ack_packet()
  2022-11-17 11:59   ` David Howells
@ 2022-11-17 13:35     ` Dan Carpenter
  0 siblings, 0 replies; 7+ messages in thread
From: Dan Carpenter @ 2022-11-17 13:35 UTC (permalink / raw)
  To: David Howells
  Cc: Marc Dionne, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, linux-afs, netdev, kernel-janitors

On Thu, Nov 17, 2022 at 11:59:32AM +0000, David Howells wrote:
> Dan Carpenter <error27@gmail.com> wrote:
> 
> > We disabled GCC's check for uninitialized variables.  It could be that
> > you have the .config to automatically zero out stack variables.
> > 
> > CONFIG_CC_HAS_AUTO_VAR_INIT_PATTERN=y
> > CONFIG_CC_HAS_AUTO_VAR_INIT_ZERO_BARE=y
> > CONFIG_CC_HAS_AUTO_VAR_INIT_ZERO=y
> 
> Ah.  Is there a way to reenable that?

make W=2 will do it, but W=2 sucks...

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH net-next] rxrpc: uninitialized variable in rxrpc_send_ack_packet()
  2022-11-17  7:44 [PATCH net-next] rxrpc: uninitialized variable in rxrpc_send_ack_packet() Dan Carpenter
  2022-11-17  9:44 ` David Howells
  2022-11-17 12:04 ` David Howells
@ 2022-11-18 12:10 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 7+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-11-18 12:10 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: dhowells, marc.dionne, davem, edumazet, kuba, pabeni, linux-afs,
	netdev, kernel-janitors

Hello:

This patch was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:

On Thu, 17 Nov 2022 10:44:02 +0300 you wrote:
> The "pkt" was supposed to have been deleted in a previous patch.  It
> leads to an uninitialized variable bug.
> 
> Fixes: 72f0c6fb0579 ("rxrpc: Allocate ACK records at proposal and queue for transmission")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> Applies to net-next.
> 
> [...]

Here is the summary with links:
  - [net-next] rxrpc: uninitialized variable in rxrpc_send_ack_packet()
    https://git.kernel.org/netdev/net-next/c/38461894838b

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-11-18 12:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-17  7:44 [PATCH net-next] rxrpc: uninitialized variable in rxrpc_send_ack_packet() Dan Carpenter
2022-11-17  9:44 ` David Howells
2022-11-17 10:34   ` Dan Carpenter
2022-11-17 11:59   ` David Howells
2022-11-17 13:35     ` Dan Carpenter
2022-11-17 12:04 ` David Howells
2022-11-18 12:10 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).