Re: [PATCH] genetlink: fix usage of NLM_F_EXCL or NLM_F_REPLACE
From: David Miller <davem@davemloft.net>
Date: 2013-08-01 02:13:09
From: David Miller <davem@davemloft.net>
Date: 2013-08-01 02:13:09
From: Pablo Neira Ayuso <pablo@netfilter.org> Date: Thu, 1 Aug 2013 04:00:49 +0200
On Thu, Aug 01, 2013 at 02:37:10AM +0200, Pablo Neira Ayuso wrote:quoted
On Wed, Jul 31, 2013 at 05:03:48PM -0700, David Miller wrote:[...]quoted
quoted
Therefore I don't see how NLM_F_REPLACE and NLM_F_EXCL can be used at all, in those places, because the check is still "& NLM_F_DUMP"The kind = type&3; is doing the magic there for rtnetlink. kind == 2 means that this is a get command, and you can only set NLM_F_DUMP using the get command. Since it doesn't make sense to use NLM_F_EXCL or NLM_F_REPLACE for get commands, there is no room for ambiguity and rtnetlink is fine.I had re-read what I wrote to get your point. We can fix in a different way by checking for: ops->flags & GENL_CMD_CAP_DUMP, which means we have a .dumpit callback, so only in that case genetlink should interpret the flags as NLM_F_DUMP. Please, see patch attached.
Thanks for the RFC patch, I'll think about this some more and reply.