backports.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luca Coelho <luca@coelho.fi>
To: backports@vger.kernel.org
Cc: Luca Coelho <luciano.coelho@intel.com>
Subject: [PATCH 04/10] backport: update genl_dump_check_consistent() backport
Date: Sun, 18 Feb 2018 15:24:53 +0200	[thread overview]
Message-ID: <20180218132459.11011-5-luca@coelho.fi> (raw)
In-Reply-To: <20180218132459.11011-1-luca@coelho.fi>

From: Luca Coelho <luciano.coelho@intel.com>

The genl_dump_check_consistent() function was changed in v4.15 to use
only two arguments.  The family is not needed anymore, because we were
erroneously subtracting the header size and that was fixed in v4.15.

Since the family was only used to check the header size, we can create
a dummy with hdrsize = 0, which will allow us to call the old version
of the function.  There is a good side-effect to doing this: the bug
is going to be fixed, because with hdrsize = 0 we will not subtract
anything and it will have the same effect as the fix.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 backport/backport-include/net/genetlink.h | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/backport/backport-include/net/genetlink.h b/backport/backport-include/net/genetlink.h
index f620b99da280..dfbacbf40723 100644
--- a/backport/backport-include/net/genetlink.h
+++ b/backport/backport-include/net/genetlink.h
@@ -56,9 +56,25 @@ static inline void *genl_info_userhdr(struct genl_info *info)
 #endif
 
 #if LINUX_VERSION_IS_LESS(3,1,0)
-#define genl_dump_check_consistent(cb, user_hdr, family)
+#define genl_dump_check_consistent(cb, user_hdr)
 #endif
 
+#if LINUX_VERSION_IS_LESS(4,15,0)
+#ifndef genl_dump_check_consistent
+static inline
+void backport_genl_dump_check_consistent(struct netlink_callback *cb,
+					 void *user_hdr)
+{
+	struct genl_family dummy_family = {
+		.hdrsize = 0,
+	};
+
+	genl_dump_check_consistent(cb, user_hdr, &dummy_family);
+}
+#define genl_dump_check_consistent LINUX_BACKPORT(genl_dump_check_consistent)
+#endif
+#endif /* LINUX_VERSION_IS_LESS(4,15,0) */
+
 #if LINUX_VERSION_IS_LESS(3,13,0) && RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,0)
 static inline int __real_genl_register_family(struct genl_family *family)
 {
@@ -139,10 +155,7 @@ extern void genl_notify(struct sk_buff *skb, struct net *net, u32 pid,
 	genlmsg_put(_skb, _pid, _seq, &(_fam)->family, _flags, _cmd)
 #define genlmsg_nlhdr(_hdr, _fam)					\
 	genlmsg_nlhdr(_hdr, &(_fam)->family)
-#ifndef genl_dump_check_consistent
-#define genl_dump_check_consistent(_cb, _hdr, _fam)			\
-	genl_dump_check_consistent(_cb, _hdr, &(_fam)->family)
-#endif
+
 #ifndef genlmsg_put_reply /* might already be there from _info override above */
 #define genlmsg_put_reply(_skb, _info, _fam, _flags, _cmd)		\
 	genlmsg_put_reply(_skb, _info, &(_fam)->family, _flags, _cmd)
-- 
2.15.1

--
To unsubscribe from this list: send the line "unsubscribe backports" in

  parent reply	other threads:[~2018-02-18 13:55 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-18 13:24 [PATCH 00/10] backport: updates for v4.16 Luca Coelho
2018-02-18 13:24 ` [PATCH 01/10] compat: only define thermal backports if CONFIG_THERMAL is enabled Luca Coelho
2018-02-18 13:24 ` [PATCH 02/10] backport: add pcie_find_root_port() Luca Coelho
2018-02-18 13:24 ` [PATCH 03/10] backport: include lib/bucket_locks.c Luca Coelho
2018-02-18 13:24 ` Luca Coelho [this message]
2018-02-18 13:24 ` [PATCH 05/10] backport: remove pkcs7_verify.c patch hunk Luca Coelho
2018-02-18 13:24 ` [PATCH 06/10] backport: add new build_bug.h file Luca Coelho
2018-02-18 13:24 ` [PATCH 07/10] backports: fix typo "TIMKEEPING" and fix gfp.h Luca Coelho
2018-02-18 13:24 ` [PATCH 08/10] backport: remove stddef.h inclusions Luca Coelho
2018-02-18 13:24 ` [PATCH 09/10] backport: increase max stack frame size compiler check to 1280 Luca Coelho
2018-02-18 13:24 ` [PATCH 10/10] backport: implement alloc_percpu_gfp() for < 3.18 Luca Coelho
2018-02-18 16:10   ` Hauke Mehrtens
2018-02-18 17:58     ` Luciano Coelho
2018-02-28 18:32   ` Hauke Mehrtens
2018-02-28 18:48     ` Luca Coelho
2018-02-18 16:11 ` [PATCH 00/10] backport: updates for v4.16 Hauke Mehrtens
2018-02-19  8:08   ` Luciano Coelho
2018-02-23 11:35 ` 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=20180218132459.11011-5-luca@coelho.fi \
    --to=luca@coelho.fi \
    --cc=backports@vger.kernel.org \
    --cc=luciano.coelho@intel.com \
    /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).