>From 0536ae81c430d007a81dbdf2989b736f4f5057f1 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Thu, 1 Aug 2013 03:32:11 +0200 Subject: [PATCH] genetlink: interpret NLM_F_DUMP if GENL_CMD_CAP_DUMP flag is set This patch reverts (e1ee367 genetlink: fix usage of NLM_F_EXCL or NLM_F_REPLACE) to fix the possible ambiguity for non-get commands in a different way. Basically, we assume that genetlink should only interpret the NLM_F_DUMP flags if the .dumpit callback is set, which is the common case for getoperation. This approach is similar to what rtnetlink does to resolve this ambiguity. Signed-off-by: Pablo Neira Ayuso --- net/netlink/genetlink.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c index 512718a..d034728 100644 --- a/net/netlink/genetlink.c +++ b/net/netlink/genetlink.c @@ -571,7 +571,8 @@ static int genl_family_rcv_msg(struct genl_family *family, !capable(CAP_NET_ADMIN)) return -EPERM; - if ((nlh->nlmsg_flags & NLM_F_DUMP) == NLM_F_DUMP) { + if ((ops->flags & GENL_CMD_CAP_DUMP) && + nlh->nlmsg_flags & NLM_F_DUMP) { struct netlink_dump_control c = { .dump = ops->dumpit, .done = ops->done, -- 1.7.10.4