All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Debin Zhu <mowenroot@163.com>
Cc: pabeni@redhat.com, 1985755126@qq.com, kuba@kernel.org,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	paul@paul-moore.com
Subject: Re: [PATCH v3] netlabel: Fix NULL pointer exception caused by CALIPSO on IPv4 sockets
Date: Wed, 2 Apr 2025 10:36:09 +0100	[thread overview]
Message-ID: <20250402093609.GK214849@horms.kernel.org> (raw)
In-Reply-To: <20250401124018.4763-1-mowenroot@163.com>

On Tue, Apr 01, 2025 at 08:40:18PM +0800, Debin Zhu wrote:
> When calling netlbl_conn_setattr(), addr->sa_family is used
> to determine the function behavior. If sk is an IPv4 socket,
> but the connect function is called with an IPv6 address,
> the function calipso_sock_setattr() is triggered.
> Inside this function, the following code is executed:
> 
> sk_fullsock(__sk) ? inet_sk(__sk)->pinet6 : NULL;
> 
> Since sk is an IPv4 socket, pinet6 is NULL, leading to a
> null pointer dereference.
> 
> This patch fixes the issue by checking if inet6_sk(sk)
> returns a NULL pointer before accessing pinet6.
> 
> Fixes: ceba1832b1b2("calipso: Set the calipso socket label to match the secattr.")

There is probably no need to repost for this, but
there is a missing space in the Fixes tag. It should be like this:

Fixes: ceba1832b1b2 ("calipso: Set the calipso socket label to match the secattr.")

> Signed-off-by: Debin Zhu <mowenroot@163.com>
> Signed-off-by: Bitao Ouyang <1985755126@qq.com>
> Acked-by: Paul Moore <paul@paul-moore.com>

...

  parent reply	other threads:[~2025-04-02  9:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-26  7:43 [PATCH] netlabel: Fix NULL pointer exception caused by CALIPSO on IPv4 sockets Debin Zhu
2025-03-26 19:38 ` Paul Moore
2025-03-28 12:02   ` Jakub Kicinski
2025-03-28 16:02     ` Paul Moore
2025-03-30 10:40       ` [PATCH v2] " Debin Zhu
2025-04-01 10:17         ` Paolo Abeni
2025-04-01 12:40           ` [PATCH v3] " Debin Zhu
2025-04-01 20:22             ` Paul Moore
2025-04-02  9:36             ` Simon Horman [this message]
2025-04-02 18:28               ` Paul Moore
2025-04-02 23:02                 ` Jakub Kicinski
2025-03-30 11:09       ` Re: [PATCH] " mowenroot

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=20250402093609.GK214849@horms.kernel.org \
    --to=horms@kernel.org \
    --cc=1985755126@qq.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mowenroot@163.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=paul@paul-moore.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.