All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [net] rxrpc: fix uninitialized pointer dereference in debug code
@ 2016-08-08 10:13 Arnd Bergmann
  2016-08-08 12:48 ` David Howells
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2016-08-08 10:13 UTC (permalink / raw)
  To: David S. Miller, David Howells; +Cc: Arnd Bergmann, netdev, linux-kernel

A newly added bugfix caused an uninitialized variable to be
used for printing debug output. This is harmless as long
as the debug setting is disabled, but otherwise leads to an
immediate crash.

gcc warns about this when -Wmaybe-uninitialized is enabled:

net/rxrpc/call_object.c: In function 'rxrpc_release_call':
net/rxrpc/call_object.c:496:163: error: 'sp' may be used uninitialized in this function [-Werror=maybe-uninitialized]

The initialization was removed but one of the users remains.
This adds back the initialization.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 372ee16386bb ("rxrpc: Fix races between skb free, ACK generation and replying")
---
I have not tried to understand the longish bugfix patch that
caused this, so I'm not sure whether it's actually safe to
access rxrpc_skb(skb) in this function. Please check if this
is the right fix.
---
 net/rxrpc/call_object.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/rxrpc/call_object.c b/net/rxrpc/call_object.c
index c47f14fc5e88..e8c953c48cb8 100644
--- a/net/rxrpc/call_object.c
+++ b/net/rxrpc/call_object.c
@@ -493,6 +493,7 @@ void rxrpc_release_call(struct rxrpc_call *call)
 		       (skb = skb_dequeue(&call->rx_oos_queue))) {
 			spin_unlock_bh(&call->lock);
 
+			sp = rxrpc_skb(skb);
 			_debug("- zap %s %%%u #%u",
 			       rxrpc_pkts[sp->hdr.type],
 			       sp->hdr.serial, sp->hdr.seq);
-- 
2.9.0

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

* Re: [PATCH] [net] rxrpc: fix uninitialized pointer dereference in debug code
  2016-08-08 10:13 [PATCH] [net] rxrpc: fix uninitialized pointer dereference in debug code Arnd Bergmann
@ 2016-08-08 12:48 ` David Howells
  0 siblings, 0 replies; 2+ messages in thread
From: David Howells @ 2016-08-08 12:48 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: dhowells, David S. Miller, netdev, linux-kernel

Arnd Bergmann <arnd@arndb.de> wrote:

> A newly added bugfix caused an uninitialized variable to be
> used for printing debug output. This is harmless as long
> as the debug setting is disabled, but otherwise leads to an
> immediate crash.
> 
> gcc warns about this when -Wmaybe-uninitialized is enabled:
> 
> net/rxrpc/call_object.c: In function 'rxrpc_release_call':
> net/rxrpc/call_object.c:496:163: error: 'sp' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> 
> The initialization was removed but one of the users remains.
> This adds back the initialization.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: 372ee16386bb ("rxrpc: Fix races between skb free, ACK generation and replying")

Applied, thanks.

David

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

end of thread, other threads:[~2016-08-08 12:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-08 10:13 [PATCH] [net] rxrpc: fix uninitialized pointer dereference in debug code Arnd Bergmann
2016-08-08 12:48 ` David Howells

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.