2020-03-11 01:11:02

by Jules Irenge

[permalink] [raw]
Subject: [PATCH 3/8] tcp: Add missing annotation for tcp_child_process()

Sparse reports warning at tcp_child_process()
warning: context imbalance in tcp_child_process() - unexpected unlock
The root cause is the missing annotation at tcp_child_process()

Add the missing __releases(&((child)->sk_lock.slock)) annotation

Signed-off-by: Jules Irenge <[email protected]>
---
net/ipv4/tcp_minisocks.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index ad3b56d9fa71..0e8a5b6e477c 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -817,6 +817,7 @@ EXPORT_SYMBOL(tcp_check_req);

int tcp_child_process(struct sock *parent, struct sock *child,
struct sk_buff *skb)
+ __releases(&((child)->sk_lock.slock))
{
int ret = 0;
int state = child->sk_state;
--
2.24.1


2020-03-11 01:15:46

by Eric Dumazet

[permalink] [raw]
Subject: Re: [PATCH 3/8] tcp: Add missing annotation for tcp_child_process()

On Tue, Mar 10, 2020 at 6:09 PM Jules Irenge <[email protected]> wrote:
>
> Sparse reports warning at tcp_child_process()
> warning: context imbalance in tcp_child_process() - unexpected unlock
> The root cause is the missing annotation at tcp_child_process()
>
> Add the missing __releases(&((child)->sk_lock.slock)) annotation
>
> Signed-off-by: Jules Irenge <[email protected]>
> ---
> net/ipv4/tcp_minisocks.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
> index ad3b56d9fa71..0e8a5b6e477c 100644
> --- a/net/ipv4/tcp_minisocks.c
> +++ b/net/ipv4/tcp_minisocks.c
> @@ -817,6 +817,7 @@ EXPORT_SYMBOL(tcp_check_req);
>
> int tcp_child_process(struct sock *parent, struct sock *child,
> struct sk_buff *skb)
> + __releases(&((child)->sk_lock.slock))
> {
> int ret = 0;
> int state = child->sk_state;


Yeah, although we prefer to use lockdep these days ;)

Reviewed-by: Eric Dumazet <[email protected]>

2020-03-11 01:30:07

by Jules Irenge

[permalink] [raw]
Subject: Re: [PATCH 3/8] tcp: Add missing annotation for tcp_child_process()

Thanks for the feedbacks. Good to know I have not used lockdep but I will
try it.

On Tue, 10 Mar 2020, Eric Dumazet wrote:

> On Tue, Mar 10, 2020 at 6:09 PM Jules Irenge <[email protected]> wrote:
> >
> > Sparse reports warning at tcp_child_process()
> > warning: context imbalance in tcp_child_process() - unexpected unlock
> > The root cause is the missing annotation at tcp_child_process()
> >
> > Add the missing __releases(&((child)->sk_lock.slock)) annotation
> >
> > Signed-off-by: Jules Irenge <[email protected]>
> > ---
> > net/ipv4/tcp_minisocks.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
> > index ad3b56d9fa71..0e8a5b6e477c 100644
> > --- a/net/ipv4/tcp_minisocks.c
> > +++ b/net/ipv4/tcp_minisocks.c
> > @@ -817,6 +817,7 @@ EXPORT_SYMBOL(tcp_check_req);
> >
> > int tcp_child_process(struct sock *parent, struct sock *child,
> > struct sk_buff *skb)
> > + __releases(&((child)->sk_lock.slock))
> > {
> > int ret = 0;
> > int state = child->sk_state;
>
>
> Yeah, although we prefer to use lockdep these days ;)
>
> Reviewed-by: Eric Dumazet <[email protected]>
>

2020-03-12 06:20:51

by David Miller

[permalink] [raw]
Subject: Re: [PATCH 3/8] tcp: Add missing annotation for tcp_child_process()

From: Jules Irenge <[email protected]>
Date: Wed, 11 Mar 2020 01:09:03 +0000

> Sparse reports warning at tcp_child_process()
> warning: context imbalance in tcp_child_process() - unexpected unlock
> The root cause is the missing annotation at tcp_child_process()
>
> Add the missing __releases(&((child)->sk_lock.slock)) annotation
>
> Signed-off-by: Jules Irenge <[email protected]>

Applied.