public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: "David S. Miller" <davem@davemloft.net>,
	David Howells <dhowells@redhat.com>
Cc: netdev@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] rxrpc: fix undefined behavior in rxrpc_mark_call_released
Date: Wed, 31 Aug 2016 14:39:02 +0200	[thread overview]
Message-ID: <20160831123911.3467676-2-arnd@arndb.de> (raw)
In-Reply-To: <20160831123911.3467676-1-arnd@arndb.de>

gcc -Wmaybe-initialized correctly points out a newly introduced bug
through which we can end up calling rxrpc_queue_call() for a dead
connection:

net/rxrpc/call_object.c: In function 'rxrpc_mark_call_released':
net/rxrpc/call_object.c:600:5: error: 'sched' may be used uninitialized in this function [-Werror=maybe-uninitialized]

This sets the 'sched' variable to zero to restore the previous
behavior.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: f5c17aaeb2ae ("rxrpc: Calls should only have one terminal state")
---
 net/rxrpc/call_object.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/rxrpc/call_object.c b/net/rxrpc/call_object.c
index 104ee8b1de06..2daec1eaec6f 100644
--- a/net/rxrpc/call_object.c
+++ b/net/rxrpc/call_object.c
@@ -595,6 +595,8 @@ static void rxrpc_mark_call_released(struct rxrpc_call *call)
 		sched = __rxrpc_abort_call(call, RX_CALL_DEAD, ECONNRESET);
 		if (!test_and_set_bit(RXRPC_CALL_EV_RELEASE, &call->events))
 			sched = true;
+	} else {
+		sched = 0;
 	}
 	write_unlock(&call->state_lock);
 	if (sched)
-- 
2.9.0

  reply	other threads:[~2016-08-31 12:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-31 12:39 [PATCH 1/2] NFSv4.1: work around -Wmaybe-uninitialized warning Arnd Bergmann
2016-08-31 12:39 ` Arnd Bergmann [this message]
2016-08-31 17:39   ` [PATCH 2/2] rxrpc: fix undefined behavior in rxrpc_mark_call_released David Howells
2016-08-31 19:40     ` Arnd Bergmann
2016-08-31 20:25   ` David Howells
2016-08-31 20:31     ` Arnd Bergmann
2016-08-31 20:52     ` David Miller
2016-08-31 20:26   ` David Howells
2016-08-31 20:37     ` Arnd Bergmann
2016-08-31 21:05       ` David Howells
2016-08-31 13:17 ` [PATCH 1/2] NFSv4.1: work around -Wmaybe-uninitialized warning Trond Myklebust
     [not found]   ` <9F99A562-A4F6-457A-A78F-44BAC3B5734F-7I+n7zu2hftEKMMhf/gKZA@public.gmane.org>
2016-08-31 13:37     ` Arnd Bergmann
2016-08-31 15:02       ` Trond Myklebust
2016-08-31 15:52         ` Arnd Bergmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160831123911.3467676-2-arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=davem@davemloft.net \
    --cc=dhowells@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox