From: Johannes Berg <johannes@sipsolutions.net>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>,
davem@davemloft.net, Netdev <netdev@vger.kernel.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] netlink: do not set cb_running if dump's start() errs
Date: Mon, 09 Oct 2017 14:27:44 +0200 [thread overview]
Message-ID: <1507552064.26041.50.camel@sipsolutions.net> (raw)
In-Reply-To: <1507550326.26041.39.camel@sipsolutions.net>
Just decided to take another look:
On Mon, 2017-10-09 at 13:58 +0200, Johannes Berg wrote:
> On Mon, 2017-10-09 at 13:56 +0200, Jason A. Donenfeld wrote:
>
> > @@ -2266,16 +2266,17 @@ int __netlink_dump_start(struct sock *ssk,
> > struct sk_buff *skb,
> > cb->min_dump_alloc = control->min_dump_alloc;
> > cb->skb = skb;
> >
> > + if (cb->start) {
> > + ret = cb->start(cb);
> > + if (ret)
> > + goto error_unlock;
> > + }
> > +
> > nlk->cb_running = true;
> >
> > mutex_unlock(nlk->cb_mutex);
>
> Hmm. Now start is invoked with the mutex held, I'm not sure it
> actually _matters_, but that should probably be reviewed and
> mentioned in the commit log?
It sort of seems designed to run ->start outside the lock, otherwise we
wouldn't really have to acquire it again in netlink_dump() but could
just keep it across the call (with some locking changes in
netlink_recvmsg())?
Then again, clearly none of the (few) existing users actually care.
Btw - we should (separately) also remove "start" from struct
netlink_callback, it's only ever used within this function and we can
use control->start instead of cb->start here.
johannes
prev parent reply other threads:[~2017-10-09 12:27 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
2017-10-09 12:27 ` Johannes Berg [this message]
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=1507552064.26041.50.camel@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=Jason@zx2c4.com \
--cc=davem@davemloft.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