From: David Miller <davem@davemloft.net>
To: Jason@zx2c4.com
Cc: johannes@sipsolutions.net, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] netlink: do not set cb_running if dump's start() errs
Date: Mon, 09 Oct 2017 10:29:08 -0700 (PDT) [thread overview]
Message-ID: <20171009.102908.912133092174394094.davem@davemloft.net> (raw)
In-Reply-To: <20171009121451.26815-1-Jason@zx2c4.com>
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
Date: Mon, 9 Oct 2017 14:14:51 +0200
> It turns out that multiple places can call netlink_dump(), which means
> it's still possible to dereference partially initialized values in
> dump() that were the result of a faulty returned start().
>
> This fixes the issue by calling start() _before_ setting cb_running to
> true, so that there's no chance at all of hitting the dump() function
> through any indirect paths.
>
> It also moves the call to start() to be when the mutex is held. This has
> the nice side effect of serializing invocations to start(), which is
> likely desirable anyway. It also prevents any possible other races that
> might come out of this logic.
>
> In testing this with several different pieces of tricky code to trigger
> these issues, this commit fixes all avenues that I'm aware of.
>
> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Applied and queued up for -stable.
next prev parent reply other threads:[~2017-10-09 17:29 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-09 11:56 [PATCH] netlink: do not set cb_running if dump's start() errs Jason A. Donenfeld
2017-10-09 11:57 ` Jason A. Donenfeld
2017-10-09 11:58 ` Johannes Berg
2017-10-09 12:12 ` Jason A. Donenfeld
2017-10-09 12:14 ` [PATCH v2] " Jason A. Donenfeld
2017-10-09 12:31 ` Johannes Berg
2017-10-09 17:02 ` Jason A. Donenfeld
2017-10-09 17:29 ` David Miller [this message]
2017-10-09 12:27 ` [PATCH] " Johannes Berg
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=20171009.102908.912133092174394094.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=Jason@zx2c4.com \
--cc=johannes@sipsolutions.net \
--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;
as well as URLs for NNTP newsgroup(s).