All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: mdshahid03@gmail.com
Cc: davem@davemloft.net, edumazet@kernel.org, pabeni@redhat.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rtnetlink: fix NULL pointer dereference in rtnl_get_link()
Date: Fri, 20 Nov 2026 10:04:15 -0800	[thread overview]
Message-ID: <20261120100415.363fcb19@kernel.org> (raw)
In-Reply-To: <20261120134548.214126-1-mdshahid03@gmail.com>

On Fri, 20 Nov 2026 19:15:48 +0530 mdshahid03@gmail.com wrote:
> From: Mohammad Shahid <mdshahid03@gmail.com>
> 
> The rtnl_get_link() function falls back to the PF_UNSPEC
> handler table when no handler table is registered for the
> requested protocol.
> 
> However, the fallback table can also be NULL,for example
> after rtnl_unregister_all(PF_UNSPEC) clears it.
> 
> In that cass, dereferencing tab[msgtyp] results in a NULL
> pointer dereference.

How can this happen? If you can't answer that - please do
not submit any patches to Linux networking for at least
6 months.

> diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
> index e141340172ce..b552cbf17d76 100644
> --- a/net/core/rtnetlink.c
> +++ b/net/core/rtnetlink.c
> @@ -406,6 +406,9 @@ static struct rtnl_link *rtnl_get_link(int protocol, int msgtype)
>  	if (!tab)
>  		tab = rcu_dereference_rtnl(rtnl_msg_handlers[PF_UNSPEC]);
>  
> +	if (!tab)
> +		return NULL;
> +
>  	return rcu_dereference_rtnl(tab[msgtype]);
>  }
>  


      parent reply	other threads:[~2026-11-20 18:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20 13:45 [PATCH] rtnetlink: fix NULL pointer dereference in rtnl_get_link() mdshahid03
2026-11-20 13:49 ` netdev-bot+sinfo
2026-11-20 18:04 ` Jakub Kicinski [this message]

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=20261120100415.363fcb19@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mdshahid03@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.