backport: Fix double fetch in hlist_for_each_entry*_rcu

Upstream commit: 3a1429a6e59f0e61720bb523e3b93d015a9fa63a

The backported (<3.9) version of hlist_for_each_entry_rcu and
hlist_for_each_entry_safe uses the new macro hlist_entry_safe. It is called
with an ACCESS_ONCE parameter for the first parameter ptr. This disallows
merging of the two loads which the current version of the macro uses.

This is problematic because this macro must only generate one load. Otherwise
with two contexts (or CPUs) following could happen:

1. context 1 fetches the ptr to the last entry in hlist_entry_safe() and
   accepts this non-NULL ptr

2. context 2 deletes the last entry and terminates the list with NULL

3. context 1 re-fetches the pointer, doesn't check for zero, calculates the
   entry based on a NULL pointer

4. context 1 crashes because it tries to load/write data from/to the invalid
   address

Instead use a single load to a temporary variable and do the NULL-check and
calculation based on that one. This is also the approach used in the current
Linux versions and was introduced by Paul E. McKenney.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
headers: delete the list in unregister_netdevice_many()

Upstream commit: 97666f936e0656a1b28c40cc33981a8db65e1a11

unregister_netdevice_many() now deletes the list after running, in the
earlier days mac80211 and so on, did this on their own. We extended the
old unregister_netdevice_many() function for all kernel versions that
do not have a fixed unregister_netdevice_many().

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
headers: fix problem when unloading mac80211 on Ubuntu 14.04

Upstream commit: 7f3a23738b01aa405c99bcf8f2be48ddf1956da4

When unloading mac80211 on the default kernel which is currently
shipped in Ubuntu 14.04 this commit causes a kernel error message. Now
we check if the list was deleted before and only do so if it was not
done before. Ubuntu probably backported this patch in their kernel.

commit 97666f936e0656a1b28c40cc33981a8db65e1a11
Author: Hauke Mehrtens <hauke@hauke-m.de>
Date:   Sun Nov 16 14:23:24 2014 +0100

    headers: delete the list in unregister_netdevice_many()

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
backports: add include/uapi/linux/pci_regs.h to copy-list

Upstream commit: bda1096b3dfe00f19b30fc85f282b2a9ad2f67f0

Fixes a recent iwlwifi build error

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
headers: remove pci_regs.h

Upstream commit: 78b1b80ba1e0d7f52be5e8f147b80a942bdf8994

This file is now copied from the kernel and we do not have to ship an
own version. Coping this from the kernel is safe because it only
contains constants.

commit bda1096b3dfe00f19b30fc85f282b2a9ad2f67f0
Author: Felix Fietkau <nbd@openwrt.org>
Date:   Sun Nov 16 14:39:58 2014 +0100

    backports: add include/uapi/linux/pci_regs.h to copy-list

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
backport: add pci_device_is_present()

Upstream commit: e36407c24a58a6497b286824a1336e9d3cf4efb7

This is needed by igb driver.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
patches: refresh patches on top of v3.18.1

1   3.0.101             [  OK  ]
2   3.1.10              [  OK  ]
3   3.2.65              [  OK  ]
4   3.3.8               [  OK  ]
5   3.4.105             [  OK  ]
6   3.5.7               [  OK  ]
7   3.6.11              [  OK  ]
8   3.7.10              [  OK  ]
9   3.8.13              [  OK  ]
10  3.9.11              [  OK  ]
11  3.10.63             [  OK  ]
12  3.11.10             [  OK  ]
13  3.12.35             [  OK  ]
14  3.13.11             [  OK  ]
15  3.14.27             [  OK  ]
16  3.15.10             [  OK  ]
17  3.16.6              [  OK  ]
18  3.17.7              [  OK  ]
19  3.18.1              [  OK  ]

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>