Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit ba8b3b55 authored by Pablo Neira's avatar Pablo Neira Committed by Ahmad Kholaif
Browse files

genetlink: fix usage of NLM_F_EXCL or NLM_F_REPLACE



Currently, it is not possible to use neither NLM_F_EXCL nor
NLM_F_REPLACE from genetlink. This is due to this checking in
genl_family_rcv_msg:

	if (nlh->nlmsg_flags & NLM_F_DUMP)

NLM_F_DUMP is NLM_F_MATCH|NLM_F_ROOT. Thus, if NLM_F_EXCL or
NLM_F_REPLACE flag is set, genetlink believes that you're
requesting a dump and it calls the .dumpit callback.

The solution that I propose is to refine this checking to
make it stricter:

	if ((nlh->nlmsg_flags & NLM_F_DUMP) == NLM_F_DUMP)

And given the combination NLM_F_REPLACE and NLM_F_EXCL does
not make sense to me, it removes the ambiguity.

There was a patch that tried to fix this some time ago (0ab03c2b
netlink: test for all flags of the NLM_F_DUMP composite) but it
tried to resolve this ambiguity in *all* existing netlink subsystems,
not only genetlink. That patch was reverted since it broke iproute2,
which is using NLM_F_ROOT to request the dump of the routing cache.

Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Git-commit: e1ee3673a83cc02b6b5e43c9e647d8dd5e1c4e26
Git-repo : git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git


Change-Id: Idca03ab6c79551e302467d3c515818d91cbad1e1
CRs-fixed: 636257
[akholaif@codeaurora.org: resolved conflicts manually]
Signed-off-by: default avatarAhmad Kholaif <akholaif@codeaurora.org>
parent 46086ca3
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment