]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
crypto: af_alg - Avoid sock_graft call warning
authorHerbert Xu <herbert@gondor.apana.org.au>
Mon, 10 Jul 2017 14:00:48 +0000 (22:00 +0800)
committerJack Vogel <jack.vogel@oracle.com>
Fri, 23 Mar 2018 05:38:10 +0000 (22:38 -0700)
The newly added sock_graft warning triggers in af_alg_accept.
It's harmless as we're essentially doing sock->sk = sock->sk.

The sock_graft call is actually redundant because all the work
it does is subsumed by sock_init_data.  However, it was added
to placate SELinux as it uses it to initialise its internal state.

This patch avoisd the warning by making the SELinux call directly.

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Acked-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 2acce6aa9f6569d4e135b2c4cfb56acce95efaeb)

Orabug: 26895616,27426147

Signed-off-by: Ethan Zhao <ethan.zhao@oracle.com>
Reviewed-by: Jack Vogel <jack.vogel@oracle.com>
crypto/af_alg.c

index 3cb08d00c31db263a2c7b2fe2f712bd30abb2abb..30c48b223db9e3c6d0c1771aaf8c30b1b6ce31e9 100644 (file)
@@ -284,7 +284,7 @@ int af_alg_accept(struct sock *sk, struct socket *newsock)
                goto unlock;
 
        sock_init_data(newsock, sk2);
-       sock_graft(sk2, newsock);
+       security_sock_graft(sk2, newsock);
        security_sk_clone(sk, sk2);
 
        err = type->accept(ask->private, sk2);