[PATCH 04/10] backport: update genl_dump_check_consistent() backport

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


From: Luca Coelho <luciano.coelho@xxxxxxxxx>

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@xxxxxxxxx>
 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)
-#define genl_dump_check_consistent(cb, user_hdr, family)
+#define genl_dump_check_consistent(cb, user_hdr)
+#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 /* LINUX_VERSION_IS_LESS(4,15,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)
 #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)

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

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux