mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 02:21:52 +09:00
Revert "bpf, sockmap: af_unix stream sockets need to hold ref for pair sock"
This reverts commit90d1f74c3cwhich is commitbffdeaa8a5upstream. It breaks the Android kernel abi and can be brought back in the future in an abi-safe way if it is really needed. Bug: 161946584 Change-Id: I8f9ee72f8269598b93fe7abb14acd0d190242dcc Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
@@ -106,7 +106,6 @@ struct sk_psock {
|
||||
struct mutex work_mutex;
|
||||
struct sk_psock_work_state work_state;
|
||||
struct delayed_work work;
|
||||
struct sock *sk_pair;
|
||||
struct rcu_work rwork;
|
||||
};
|
||||
|
||||
|
||||
@@ -77,7 +77,6 @@ static inline struct unix_sock *unix_sk(const struct sock *sk)
|
||||
{
|
||||
return (struct unix_sock *)sk;
|
||||
}
|
||||
#define unix_peer(sk) (unix_sk(sk)->peer)
|
||||
|
||||
#define peer_wait peer_wq.wait
|
||||
|
||||
|
||||
@@ -825,8 +825,6 @@ static void sk_psock_destroy(struct work_struct *work)
|
||||
|
||||
if (psock->sk_redir)
|
||||
sock_put(psock->sk_redir);
|
||||
if (psock->sk_pair)
|
||||
sock_put(psock->sk_pair);
|
||||
sock_put(psock->sk);
|
||||
kfree(psock);
|
||||
}
|
||||
|
||||
@@ -211,6 +211,8 @@ static inline bool unix_secdata_eq(struct scm_cookie *scm, struct sk_buff *skb)
|
||||
}
|
||||
#endif /* CONFIG_SECURITY_NETWORK */
|
||||
|
||||
#define unix_peer(sk) (unix_sk(sk)->peer)
|
||||
|
||||
static inline int unix_our_peer(struct sock *sk, struct sock *osk)
|
||||
{
|
||||
return unix_peer(osk) == sk;
|
||||
|
||||
@@ -159,17 +159,12 @@ int unix_dgram_bpf_update_proto(struct sock *sk, struct sk_psock *psock, bool re
|
||||
|
||||
int unix_stream_bpf_update_proto(struct sock *sk, struct sk_psock *psock, bool restore)
|
||||
{
|
||||
struct sock *sk_pair;
|
||||
|
||||
if (restore) {
|
||||
sk->sk_write_space = psock->saved_write_space;
|
||||
sock_replace_proto(sk, psock->sk_proto);
|
||||
return 0;
|
||||
}
|
||||
|
||||
sk_pair = unix_peer(sk);
|
||||
sock_hold(sk_pair);
|
||||
psock->sk_pair = sk_pair;
|
||||
unix_stream_bpf_check_needs_rebuild(psock->sk_proto);
|
||||
sock_replace_proto(sk, &unix_stream_bpf_prot);
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user