diff mbox series

[v3,2/2,RESEND] resolve gtp possible deadlock warning

Message ID c2ac8e30806af319eb96f67103196b7cda22d562.1729031472.git.danielyangkang@gmail.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series [v3,1/2,RESEND] resolve gtp possible deadlock warning | expand

Checks

Context Check Description
netdev/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

Daniel Yang Oct. 15, 2024, 10:48 p.m. UTC
From: Daniel Yang <danielyangkang@gmail.com>

Moved lockdep annotation to separate function for readability.

Signed-off-by: Daniel Yang <danielyangkang@gmail.com>
Reported-by: syzbot+e953a8f3071f5c0a28fd@syzkaller.appspotmail.com

---
 net/smc/smc_inet.c | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

Comments

Kuniyuki Iwashima Oct. 16, 2024, 12:03 a.m. UTC | #1
From: Daniel Yang <danielyangkang@gmail.com>
Date: Tue, 15 Oct 2024 15:48:05 -0700
> From: Daniel Yang <danielyangkang@gmail.com>
> 
> Moved lockdep annotation to separate function for readability.
> 
> Signed-off-by: Daniel Yang <danielyangkang@gmail.com>
> Reported-by: syzbot+e953a8f3071f5c0a28fd@syzkaller.appspotmail.com

This tag is bogus, why not squash to patch 1 ?

Also, patch 1 needs Fixes: tag.
Daniel Yang Oct. 16, 2024, 12:24 a.m. UTC | #2
On Tue, Oct 15, 2024 at 5:03 PM Kuniyuki Iwashima <kuniyu@amazon.com> wrote:
>
> From: Daniel Yang <danielyangkang@gmail.com>
> Date: Tue, 15 Oct 2024 15:48:05 -0700
> > From: Daniel Yang <danielyangkang@gmail.com>
> >
> > Moved lockdep annotation to separate function for readability.
> >
> > Signed-off-by: Daniel Yang <danielyangkang@gmail.com>
> > Reported-by: syzbot+e953a8f3071f5c0a28fd@syzkaller.appspotmail.com
>
> This tag is bogus, why not squash to patch 1 ?
>
> Also, patch 1 needs Fixes: tag.

I wanted to split them up since D. Wythe suggested the fix when I was
having trouble finding where the packets were being created so I
wanted to give credit.
Daniel Yang Oct. 16, 2024, 12:30 a.m. UTC | #3
On Tue, Oct 15, 2024 at 5:24 PM Daniel Yang <danielyangkang@gmail.com> wrote:
>
> On Tue, Oct 15, 2024 at 5:03 PM Kuniyuki Iwashima <kuniyu@amazon.com> wrote:
> >
> > From: Daniel Yang <danielyangkang@gmail.com>
> > Date: Tue, 15 Oct 2024 15:48:05 -0700
> > > From: Daniel Yang <danielyangkang@gmail.com>
> > >
> > > Moved lockdep annotation to separate function for readability.
> > >
> > > Signed-off-by: Daniel Yang <danielyangkang@gmail.com>
> > > Reported-by: syzbot+e953a8f3071f5c0a28fd@syzkaller.appspotmail.com
> >
> > This tag is bogus, why not squash to patch 1 ?
> >
> > Also, patch 1 needs Fixes: tag.
>
> I wanted to split them up since D. Wythe suggested the fix when I was
> having trouble finding where the packets were being created so I
> wanted to give credit.

I'll squash and resend with the Fixes: tag and put him in the
Suggested-by: or something since it matters to you.
D. Wythe Oct. 22, 2024, 2 a.m. UTC | #4
On 10/16/24 6:48 AM, Daniel Yang wrote:
> From: Daniel Yang <danielyangkang@gmail.com>
> 
> Moved lockdep annotation to separate function for readability.
> 
> Signed-off-by: Daniel Yang <danielyangkang@gmail.com>
> Reported-by: syzbot+e953a8f3071f5c0a28fd@syzkaller.appspotmail.com
> 
> ---
>   net/smc/smc_inet.c | 28 +++++++++++++++-------------
>   1 file changed, 15 insertions(+), 13 deletions(-)
> 
> diff --git a/net/smc/smc_inet.c b/net/smc/smc_inet.c
> index 7ae49ffd2..b3eedc3b0 100644
> --- a/net/smc/smc_inet.c
> +++ b/net/smc/smc_inet.c
> @@ -111,18 +111,7 @@ static struct inet_protosw smc_inet6_protosw = {
>   static struct lock_class_key smc_slock_keys[2];
>   static struct lock_class_key smc_keys[2];
>   
> -static int smc_inet_init_sock(struct sock *sk)
> -{
> -	struct net *net = sock_net(sk);
> -	int rc;
> -
> -	/* init common smc sock */
> -	smc_sk_init(net, sk, IPPROTO_SMC);
> -	/* create clcsock */
> -	rc = smc_create_clcsk(net, sk, sk->sk_family);
> -	if (rc)
> -		return rc;
> -
> +static inline void smc_inet_lockdep_annotate(struct sock *sk) {
>   	switch (sk->sk_family) {
>   		case AF_INET:
>   			sock_lock_init_class_and_name(sk, "slock-AF_INET-SMC",
> @@ -139,8 +128,21 @@ static int smc_inet_init_sock(struct sock *sk)
>   		default:
>   			WARN_ON_ONCE(1);
>   	}
> +}
>   
> -	return 0;
> +static int smc_inet_init_sock(struct sock *sk)
> +{
> +	struct net *net = sock_net(sk);
> +	int rc;
> +
> +	/* init common smc sock */
> +	smc_sk_init(net, sk, IPPROTO_SMC);
> +	/* create clcsock */
> +	rc = smc_create_clcsk(net, sk, sk->sk_family);
> +	if (!rc)
> +		smc_inet_lockdep_annotate(sk);
> +
> +	return rc;
>   }
>   
>   int __init smc_inet_init(void)

I need to check why you said Wang Cong's patch cannot fix the issue.
As soon as I reach a conclusion, I'll inform you right away.

D. Wythe
diff mbox series

Patch

diff --git a/net/smc/smc_inet.c b/net/smc/smc_inet.c
index 7ae49ffd2..b3eedc3b0 100644
--- a/net/smc/smc_inet.c
+++ b/net/smc/smc_inet.c
@@ -111,18 +111,7 @@  static struct inet_protosw smc_inet6_protosw = {
 static struct lock_class_key smc_slock_keys[2];
 static struct lock_class_key smc_keys[2];
 
-static int smc_inet_init_sock(struct sock *sk)
-{
-	struct net *net = sock_net(sk);
-	int rc;
-
-	/* init common smc sock */
-	smc_sk_init(net, sk, IPPROTO_SMC);
-	/* create clcsock */
-	rc = smc_create_clcsk(net, sk, sk->sk_family);
-	if (rc)
-		return rc;
-
+static inline void smc_inet_lockdep_annotate(struct sock *sk) {
 	switch (sk->sk_family) {
 		case AF_INET:
 			sock_lock_init_class_and_name(sk, "slock-AF_INET-SMC",
@@ -139,8 +128,21 @@  static int smc_inet_init_sock(struct sock *sk)
 		default:
 			WARN_ON_ONCE(1);
 	}
+}
 
-	return 0;
+static int smc_inet_init_sock(struct sock *sk)
+{
+	struct net *net = sock_net(sk);
+	int rc;
+
+	/* init common smc sock */
+	smc_sk_init(net, sk, IPPROTO_SMC);
+	/* create clcsock */
+	rc = smc_create_clcsk(net, sk, sk->sk_family);
+	if (!rc)
+		smc_inet_lockdep_annotate(sk);
+
+	return rc;
 }
 
 int __init smc_inet_init(void)