Netdev Archive on
help / color / mirror / Atom feed
From: Kangmin Park <>
To: "David S. Miller" <>
Cc: Hideaki YOSHIFUJI <>,
	David Ahern <>,
	Jakub Kicinski <>,,
Subject: [PATCH v2] ipv4: fix error path in fou_create()
Date: Sun,  8 Aug 2021 14:49:17 +0900	[thread overview]
Message-ID: <> (raw)

sock is always NULL when udp_sock_create() is failed and fou is
always NULL when kzalloc() is failed.

So, add error_sock and error_alloc label and fix the error path
in those cases.

Signed-off-by: Kangmin Park <>
 - change commit message
 - fix error path

 net/ipv4/fou.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/fou.c b/net/ipv4/fou.c
index 60d67ae76880..f1d99e776bb8 100644
--- a/net/ipv4/fou.c
+++ b/net/ipv4/fou.c
@@ -578,7 +578,7 @@ static int fou_create(struct net *net, struct fou_cfg *cfg,
 	fou = kzalloc(sizeof(*fou), GFP_KERNEL);
 	if (!fou) {
 		err = -ENOMEM;
-		goto error;
+		goto error_alloc;
 	sk = sock->sk;
@@ -627,9 +627,10 @@ static int fou_create(struct net *net, struct fou_cfg *cfg,
 	if (sock)
 	return err;

                 reply	other threads:[~2021-08-08  5:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \
    --subject='Re: [PATCH v2] ipv4: fix error path in fou_create()' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).