Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1684181
| From | Sowmini Varadhan <sowmini.varadhan@oracle.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [GIT] Networking |
| Date | 2017-07-10 14:20 +0200 |
| Message-ID | <u1FPs-4Ta-27@gated-at.bofh.it> (permalink) |
| References | <u0VjA-11F-9@gated-at.bofh.it> <u1pAZ-2UI-15@gated-at.bofh.it> <u1pUm-3gg-3@gated-at.bofh.it> <u1rjr-43b-3@gated-at.bofh.it> <u1DNF-3IW-11@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On (07/10/17 18:05), Herbert Xu wrote:
>
> Hmm, I can't see the problem in af_alg_accept. The struct socket
> comes directly from sys_accept() which creates it using sock_alloc.
>
> So the only thing I can think of is that the memory returned by
> sock_alloc is not zeroed and therefore the WARN_ON is just reading
> garbage.
Then it is odd that this WARN_ON is not triggered for other sockets
(e.g., for TCP sockets), though it happens easily with AF_ALG.
But it's not sock_alloc() - that function is returning a properly
zeroed ->sk.
The reason that the WARN_ON is triggered is that af_alg_accept() calls
sock_init_data() which does
2636 if (sock) {
:
2639 sock->sk = sk;
So we can do one of the following:
1. drop the WARN_ON(), which makes true leaks hard to detect
2. change the WARN_ON() to WARN_ON(parent->sk && parent->sk != sk)
#2 assumes that all the refcount book-keeping is being done
correctly (there is the danger that we end up taking 2 refs on the sk)
--Sowmini
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[GIT] Networking David Miller <davem@davemloft.net> - 2017-07-08 12:40 +0200
Re: [GIT] Networking Linus Torvalds <torvalds@linux-foundation.org> - 2017-07-09 21:00 +0200
Re: [GIT] Networking Sowmini Varadhan <sowmini.varadhan@oracle.com> - 2017-07-09 21:20 +0200
Re: [GIT] Networking David Miller <davem@davemloft.net> - 2017-07-09 22:50 +0200
Re: [GIT] Networking Herbert Xu <herbert@gondor.apana.org.au> - 2017-07-10 12:10 +0200
Re: [GIT] Networking Sowmini Varadhan <sowmini.varadhan@oracle.com> - 2017-07-10 14:20 +0200
Re: [GIT] Networking Herbert Xu <herbert@gondor.apana.org.au> - 2017-07-10 16:10 +0200
Re: [GIT] Networking David Miller <davem@davemloft.net> - 2017-07-11 22:40 +0200
Re: [GIT] Networking Herbert Xu <herbert@gondor.apana.org.au> - 2017-07-12 03:50 +0200
csiph-web