Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5c67c52b authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

Merge branch 'android11-5.4' into branch 'android11-5.4-lts'



This catches the android11-5.4-lts branch up with recent changes made in
the android11-5.4 branch.  Changes included in here are:

* 564901bd ANDROID: 16K: Only check basename of linker context
* 73b793dd UPSTREAM: af_unix: Do not use atomic ops for unix_sk(sk)->inflight.
* ff29a6cf ANDROID: ABI fixup for abi break in struct dst_ops
* 8b6880fc BACKPORT: net: fix __dst_negative_advice() race

Change-Id: I7fa20e52026e7bf98e973e632d9cedead8fb0aaf
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parents 4b533a55 564901bd
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -12,6 +12,16 @@ struct sk_buff;
struct sock;
struct net;

/* *** ANDROID FIXUP ***
 * These typedefs are used to help fixup the ABI break caused by commit
 * 92f1655aa2b2 ("net: fix __dst_negative_advice() race") where the
 * negative_advice callback changed function signatures.
 * See b/343727534 for more details.
 * *** ANDROID FIXUP ***
 */
typedef void (*android_dst_ops_negative_advice_new_t)(struct sock *sk, struct dst_entry *);
typedef struct dst_entry * (*android_dst_ops_negative_advice_old_t)(struct dst_entry *);

struct dst_ops {
	unsigned short		family;
	unsigned int		gc_thresh;
+9 −8
Original line number Diff line number Diff line
@@ -1955,18 +1955,19 @@ sk_dst_get(struct sock *sk)

static inline void dst_negative_advice(struct sock *sk)
{
	struct dst_entry *ndst, *dst = __sk_dst_get(sk);
	/* *** ANDROID FIXUP ***
	 * See b/343727534 for more details why this typedef is needed here.
	 * *** ANDROID FIXUP ***
	 */
	android_dst_ops_negative_advice_new_t negative_advice;

	struct dst_entry *dst = __sk_dst_get(sk);

	sk_rethink_txhash(sk);

	if (dst && dst->ops->negative_advice) {
		ndst = dst->ops->negative_advice(dst);

		if (ndst != dst) {
			rcu_assign_pointer(sk->sk_dst_cache, ndst);
			sk_tx_queue_clear(sk);
			WRITE_ONCE(sk->sk_dst_pending_confirm, 0);
		}
		negative_advice = (android_dst_ops_negative_advice_new_t)dst->ops->negative_advice;
		negative_advice(sk, dst);
	}
}

+10 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#include <linux/mm.h>
#include <linux/sched/task_stack.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/sysfs.h>

typedef void (*show_pad_maps_fn)	(struct seq_file *m, struct vm_area_struct *vma);
@@ -183,7 +184,15 @@ static inline bool linker_ctx(void)
		memset(buf, 0, bufsize);
		path = d_path(&file->f_path, buf, bufsize);

		if (!strcmp(path, "/system/bin/linker64"))
		/*
		 * Depending on interpreter requested, valid paths could be any of:
		 *   1. /system/bin/bootstrap/linker64
		 *   2. /system/bin/linker64
		 *   3. /apex/com.android.runtime/bin/linker64
		 *
		 * Check the base name (linker64).
		 */
		if (!strcmp(kbasename(path), "linker64"))
			return true;
	}

+9 −15
Original line number Diff line number Diff line
@@ -137,7 +137,8 @@ static int ip_rt_gc_timeout __read_mostly = RT_GC_TIMEOUT;
static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie);
static unsigned int	 ipv4_default_advmss(const struct dst_entry *dst);
static unsigned int	 ipv4_mtu(const struct dst_entry *dst);
static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst);
static void		ipv4_negative_advice(struct sock *sk,
					     struct dst_entry *dst);
static void		 ipv4_link_failure(struct sk_buff *skb);
static void		 ip_rt_update_pmtu(struct dst_entry *dst, struct sock *sk,
					   struct sk_buff *skb, u32 mtu,
@@ -164,7 +165,7 @@ static struct dst_ops ipv4_dst_ops = {
	.mtu =			ipv4_mtu,
	.cow_metrics =		ipv4_cow_metrics,
	.destroy =		ipv4_dst_destroy,
	.negative_advice =	ipv4_negative_advice,
	.negative_advice =	(android_dst_ops_negative_advice_old_t)ipv4_negative_advice,
	.link_failure =		ipv4_link_failure,
	.update_pmtu =		ip_rt_update_pmtu,
	.redirect =		ip_do_redirect,
@@ -856,22 +857,15 @@ static void ip_do_redirect(struct dst_entry *dst, struct sock *sk, struct sk_buf
	__ip_do_redirect(rt, skb, &fl4, true);
}

static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst)
static void ipv4_negative_advice(struct sock *sk,
				 struct dst_entry *dst)
{
	struct rtable *rt = (struct rtable *)dst;
	struct dst_entry *ret = dst;

	if (rt) {
		if (dst->obsolete > 0) {
			ip_rt_put(rt);
			ret = NULL;
		} else if ((rt->rt_flags & RTCF_REDIRECTED) ||
			   rt->dst.expires) {
			ip_rt_put(rt);
			ret = NULL;
		}
	}
	return ret;
	if ((dst->obsolete > 0) ||
	    (rt->rt_flags & RTCF_REDIRECTED) ||
	    rt->dst.expires)
		sk_dst_reset(sk);
}

/*
+16 −15
Original line number Diff line number Diff line
@@ -84,7 +84,8 @@ enum rt6_nud_state {
static struct dst_entry	*ip6_dst_check(struct dst_entry *dst, u32 cookie);
static unsigned int	 ip6_default_advmss(const struct dst_entry *dst);
static unsigned int	 ip6_mtu(const struct dst_entry *dst);
static struct dst_entry *ip6_negative_advice(struct dst_entry *);
static void		ip6_negative_advice(struct sock *sk,
					    struct dst_entry *dst);
static void		ip6_dst_destroy(struct dst_entry *);
static void		ip6_dst_ifdown(struct dst_entry *,
				       struct net_device *dev, int how);
@@ -249,7 +250,7 @@ static struct dst_ops ip6_dst_ops_template = {
	.cow_metrics		=	dst_cow_metrics_generic,
	.destroy		=	ip6_dst_destroy,
	.ifdown			=	ip6_dst_ifdown,
	.negative_advice	=	ip6_negative_advice,
	.negative_advice	=	(android_dst_ops_negative_advice_old_t)ip6_negative_advice,
	.link_failure		=	ip6_link_failure,
	.update_pmtu		=	ip6_rt_update_pmtu,
	.redirect		=	rt6_do_redirect,
@@ -2658,24 +2659,24 @@ static struct dst_entry *ip6_dst_check(struct dst_entry *dst, u32 cookie)
	return dst_ret;
}

static struct dst_entry *ip6_negative_advice(struct dst_entry *dst)
static void ip6_negative_advice(struct sock *sk,
				struct dst_entry *dst)
{
	struct rt6_info *rt = (struct rt6_info *) dst;

	if (rt) {
	if (rt->rt6i_flags & RTF_CACHE) {
		rcu_read_lock();
		if (rt6_check_expired(rt)) {
			/* counteract the dst_release() in sk_dst_reset() */
			dst_hold(dst);
			sk_dst_reset(sk);

			rt6_remove_exception_rt(rt);
				dst = NULL;
		}
		rcu_read_unlock();
		} else {
			dst_release(dst);
			dst = NULL;
		}
		return;
	}
	return dst;
	sk_dst_reset(sk);
}

static void ip6_link_failure(struct sk_buff *skb)
Loading