Subject: Re: [Patch net] gtp: fix a potential NULL pointer dereference

From: Simon Horman <[email-masked]>
Date: Tue, 27 Aug 2024 15:41:13 +0100

On Sun, Aug 25, 2024 at 12:16:38PM -0700, Cong Wang wrote:
> From: Cong Wang <[email-masked]>
> 
> When sockfd_lookup() fails, gtp_encap_enable_socket() returns a
> NULL pointer, but its callers only check for error pointers thus miss
> the NULL pointer case.
> 
> Fix it by returning an error pointer with the error code carried from
> sockfd_lookup().
> 
> (I found this bug during code inspection.)
> 
> Fixes: 1e3a3abd8b28 ("gtp: make GTP sockets in gtp_newlink optional")
> Cc: Andreas Schultz <[email-masked]>
> Cc: Pablo Neira Ayuso <[email-masked]>
> Cc: Harald Welte <[email-masked]>
> Signed-off-by: Cong Wang <[email-masked]>

Thanks Cong,

I agree with your analysis.

Reviewed-by: Simon Horman <[email-masked]>