summaryrefslogtreecommitdiff
path: root/net/core
diff options
context:
space:
mode:
authorMichael Bestas <mkbestas@lineageos.org>2020-09-19 12:58:54 +0300
committerMichael Bestas <mkbestas@lineageos.org>2020-09-19 12:58:54 +0300
commit3b601dd398b0f8a66744c0ecf384a6cbe65e36e7 (patch)
tree570d5895dfced5d2e443a7f9b8f6fa5f9a7560f3 /net/core
parenta638073161e90ac6dc0ffc2e27cbc4bcd3ff88c3 (diff)
parent5fd2d19eeb9767339e1338eb6789495d1812065b (diff)
Merge branch 'android-4.4-p' of https://android.googlesource.com/kernel/common into lineage-17.1-caf-msm8998
This brings LA.UM.8.4.r1-05900-8x98.0 up to date with https://android.googlesource.com/kernel/common/ android-4.4-p at commit: 5fd2d19eeb976 Merge 4.4.236 into android-4.4-p Conflicts: drivers/scsi/ufs/ufshcd.c Change-Id: I22282a0d571bdb72f50d3fc1e2cee4443de1f7f4
Diffstat (limited to 'net/core')
-rw-r--r--net/core/dev.c3
-rw-r--r--net/core/netpoll.c2
-rw-r--r--net/core/skbuff.c4
-rw-r--r--net/core/sock.c21
4 files changed, 26 insertions, 4 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index e6d091dc276b..1dc4781807ce 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4873,13 +4873,14 @@ void netif_napi_add(struct net_device *dev, struct napi_struct *napi,
pr_err_once("netif_napi_add() called with weight %d on device %s\n",
weight, dev->name);
napi->weight = weight;
- list_add(&napi->dev_list, &dev->napi_list);
napi->dev = dev;
#ifdef CONFIG_NETPOLL
spin_lock_init(&napi->poll_lock);
napi->poll_owner = -1;
#endif
set_bit(NAPI_STATE_SCHED, &napi->state);
+ set_bit(NAPI_STATE_NPSVC, &napi->state);
+ list_add_rcu(&napi->dev_list, &dev->napi_list);
}
EXPORT_SYMBOL(netif_napi_add);
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 8f445f6e8328..48101b0f1aea 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -178,7 +178,7 @@ static void poll_napi(struct net_device *dev)
{
struct napi_struct *napi;
- list_for_each_entry(napi, &dev->napi_list, dev_list) {
+ list_for_each_entry_rcu(napi, &dev->napi_list, dev_list) {
if (napi->poll_owner != smp_processor_id() &&
spin_trylock(&napi->poll_lock)) {
poll_one_napi(napi);
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 144f655afe8b..7b8bd8562879 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -4396,8 +4396,8 @@ struct sk_buff *skb_vlan_untag(struct sk_buff *skb)
skb = skb_share_check(skb, GFP_ATOMIC);
if (unlikely(!skb))
goto err_free;
-
- if (unlikely(!pskb_may_pull(skb, VLAN_HLEN)))
+ /* We may access the two bytes after vlan_hdr in vlan_set_encap_proto(). */
+ if (unlikely(!pskb_may_pull(skb, VLAN_HLEN + sizeof(unsigned short))))
goto err_free;
vhdr = (struct vlan_hdr *)skb->data;
diff --git a/net/core/sock.c b/net/core/sock.c
index 66a192395398..cdf2ca201a4f 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -2287,6 +2287,27 @@ int sock_no_mmap(struct file *file, struct socket *sock, struct vm_area_struct *
}
EXPORT_SYMBOL(sock_no_mmap);
+/*
+ * When a file is received (via SCM_RIGHTS, etc), we must bump the
+ * various sock-based usage counts.
+ */
+void __receive_sock(struct file *file)
+{
+ struct socket *sock;
+ int error;
+
+ /*
+ * The resulting value of "error" is ignored here since we only
+ * need to take action when the file is a socket and testing
+ * "sock" for NULL is sufficient.
+ */
+ sock = sock_from_file(file, &error);
+ if (sock) {
+ sock_update_netprioidx(sock->sk);
+ sock_update_classid(sock->sk);
+ }
+}
+
ssize_t sock_no_sendpage(struct socket *sock, struct page *page, int offset, size_t size, int flags)
{
ssize_t res;