[Devel] Re: [PATCH] Fix acquiring socket lock before reading RTNETLINK response
Serge E. Hallyn
serue at us.ibm.com
Thu Apr 22 15:54:44 PDT 2010
Quoting Dan Smith (danms at us.ibm.com):
> Signed-off-by: Dan Smith <danms at us.ibm.com>
Looks good to my limited understanding.
Acked-by: Serge Hallyn <serue at us.ibm.com>
> ---
> net/checkpoint_dev.c | 7 ++++---
> 1 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/net/checkpoint_dev.c b/net/checkpoint_dev.c
> index 7ccb899..2787892 100644
> --- a/net/checkpoint_dev.c
> +++ b/net/checkpoint_dev.c
> @@ -136,11 +136,12 @@ static struct nlmsghdr *rtnl_get_response(struct socket *rtnl,
>
> *skb = NULL;
>
> + lock_sock(rtnl->sk);
> ret = sk_wait_data(rtnl->sk, &timeo);
> - if (!ret)
> - return ERR_PTR(-EPIPE);
> + if (ret)
> + *skb = skb_dequeue(&rtnl->sk->sk_receive_queue);
> + release_sock(rtnl->sk);
>
> - *skb = skb_dequeue(&rtnl->sk->sk_receive_queue);
> if (!*skb)
> return ERR_PTR(-EPIPE);
>
> --
> 1.6.2.5
>
> _______________________________________________
> Containers mailing list
> Containers at lists.linux-foundation.org
> https://lists.linux-foundation.org/mailman/listinfo/containers
_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
More information about the Devel
mailing list