Backports Archive on
 help / Atom feed
* [PATCH] backports: check if genl pre_doit and post_doit are set
@ 2018-11-01 13:08 Luca Coelho
  0 siblings, 0 replies; 1+ messages in thread
From: Luca Coelho @ 2018-11-01 13:08 UTC (permalink / raw)
  To: backports; +Cc: Luca Coelho

From: Luca Coelho <>

In the pre_doit and post_doit backports, we set the ops to our
backported version, so genetlink itself will always call it.  But then
we don't check if the actual ops are set before calling them, which
causes a call to a NULL pointer.  Fix this by checking if the ops are
actually set before calling them.

Fixes: ff6746638cf1 ("backports: genetlink: update completely")
Signed-off-by: Luca Coelho <>
 backport/compat/backport-genetlink.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/backport/compat/backport-genetlink.c b/backport/compat/backport-genetlink.c
index cc70cd73d0c0..71bf45adf88d 100644
--- a/backport/compat/backport-genetlink.c
+++ b/backport/compat/backport-genetlink.c
@@ -171,7 +171,7 @@ static int backport_pre_doit(__genl_const struct genl_ops *ops,
 	err = nlmsg_validate(info->nlhdr, GENL_HDRLEN + family->hdrsize,
 			     family->maxattr, ops->policy, extack);
-	if (!err)
+	if (!err && family->pre_doit)
 		err = family->pre_doit(ops, skb, info);
@@ -205,7 +205,8 @@ static void backport_post_doit(__genl_const struct genl_ops *ops,
 	if (1)
-		family->post_doit(ops, skb, info);
+		if (family->post_doit)
+			family->post_doit(ops, skb, info);

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

^ permalink raw reply	[flat|nested] 1+ messages in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-01 13:08 [PATCH] backports: check if genl pre_doit and post_doit are set Luca Coelho

Backports Archive on

Archives are clonable:
	git clone --mirror backports/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 backports backports/ \
	public-inbox-index backports

Newsgroup available over NNTP:

AGPL code for this site: git clone public-inbox