From: "Gao Feng" <gfree.wind@vip.163.com>
To: "Cong Wang" <xiyou.wangcong@gmail.com>
Cc: xeb@mail.ru, "David Miller" <davem@davemloft.net>,
"Linux Kernel Network Developers" <netdev@vger.kernel.org>
Subject: Re:Re: [PATCH net-next 1/1] driver: pptp: Remove unnecessary statements in pptp_sock_destruct
Date: Thu, 10 Aug 2017 11:54:50 +0800 (CST) [thread overview]
Message-ID: <3024ec22.eb85.15dca47d1ea.Coremail.gfree.wind@vip.163.com> (raw)
In-Reply-To: <CAM_iQpUXRV6DamR_U1_bvBUBOk6SQ6jF3xLKBpVZrjYE74LXiw@mail.gmail.com>
At 2017-08-10 02:08:30, "Cong Wang" <xiyou.wangcong@gmail.com> wrote:
>On Wed, Aug 9, 2017 at 8:57 AM, <gfree.wind@vip.163.com> wrote:
>> From: Gao Feng <gfree.wind@vip.163.com>
>>
>> In the commit ddab82821fa6 ("ppp: Fix a scheduling-while-atomic bug in
>> del_chan"), I moved the synchronize_rcu() from del_chan() to pptp_release
>> after del_chan() to avoid one scheduling-while-atomic bug.
>>
>> Actually the del_chan() and pppox_unbind_sock are unneccessary in the
>> pptp_sock_destruct. Because the pptp sock refcnt wouldn't reach zero until
>> sk_state is set as PPPOX_DEAD in pptp_release. By that time, the del_chan()
>> and pppox_unbind_sock() have been invoked already and the condition check
>> "!(sk->sk_state & PPPOX_DEAD)" of this sock must be false in pptp_sock_destruct.
>
>I am not sure. The check for sock->sk in the beginning of pptp_release()
>indicates there could be a case we could skip del_chan() in pptp_release(),
>although I can't figure out how.
>
>Also there is a suspicious sock_put() in pptp_release().
Hi Cong,
Thank you. I also failed to find the case which causes the sock->sk is null in release().
There is a suspicious case in __sock_create following.
err = pf->create(net, sock, protocol, kern);
if (err < 0)
goto out_module_put;
.......
out_module_put:
sock->ops = NULL;
module_put(pf->owner);
out_sock_release:
sock_release(sock);
return err;
In the beginning, I thought when create is failed and the sock->sk is null, then the sock_release is invoked.
It could cause the sk is null in the release().
But I find it has already reset the sock->ops as NULL before sock_release later, so the release() wouldn't be invoked actually.
Best Regards
Feng
prev parent reply other threads:[~2017-08-10 3:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-09 15:57 [PATCH net-next 1/1] driver: pptp: Remove unnecessary statements in pptp_sock_destruct gfree.wind
2017-08-09 18:08 ` Cong Wang
2017-08-10 3:54 ` Gao Feng [this message]
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:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3024ec22.eb85.15dca47d1ea.Coremail.gfree.wind@vip.163.com \
--to=gfree.wind@vip.163.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=xeb@mail.ru \
--cc=xiyou.wangcong@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox