summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Lambiris2016-12-17 17:55:00 -0500
committerTony Lambiris2016-12-17 18:00:00 -0500
commitd48165352e95535b798852f9afced7371549ee23 (patch)
treed2a7b2f7101503424d9eeac79b75072eccb33b06
parent854f450e06d8bf89aa58596ffaf1f621f3f7b679 (diff)
downloadaur-d48165352e95535b798852f9afced7371549ee23.tar.gz
Sync with core/linux, add service file
-rw-r--r--.SRCINFO26
-rw-r--r--99-linux-macbook.hook11
-rw-r--r--PKGBUILD59
-rw-r--r--fix_race_condition_in_packet_set_ring.diff84
-rw-r--r--linux-macbook.install21
-rw-r--r--linux-macbook.preset8
-rw-r--r--net_handle_no_dst_on_skb_in_icmp6_send.patch68
7 files changed, 219 insertions, 58 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 72ed1303cedb..0b3aa38052cb 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = linux-macbook
- pkgver = 4.8.14
+ pkgver = 4.8.15
pkgrel = 1
- url = http://www.kernel.org/
+ url = https://www.kernel.org/
arch = i686
arch = x86_64
license = GPL2
@@ -14,32 +14,38 @@ pkgbase = linux-macbook
options = !strip
source = https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.8.tar.xz
source = https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.8.tar.sign
- source = https://www.kernel.org/pub/linux/kernel/v4.x/patch-4.8.14.xz
- source = https://www.kernel.org/pub/linux/kernel/v4.x/patch-4.8.14.sign
+ source = https://www.kernel.org/pub/linux/kernel/v4.x/patch-4.8.15.xz
+ source = https://www.kernel.org/pub/linux/kernel/v4.x/patch-4.8.15.sign
source = config
source = config.x86_64
- source = macbook-wakeup.service
+ source = 99-linux-macbook.hook
source = linux-macbook.preset
+ source = macbook-wakeup.service
+ source = change-default-console-loglevel.patch
source = apple-gmux.patch
source = macbook-suspend.patch
source = poweroff-quirk-workaround.patch
source = intel-pstate-backport.patch
source = change-default-console-loglevel.patch
+ source = net_handle_no_dst_on_skb_in_icmp6_send.patch
validpgpkeys = ABAF11C65A2970B130ABE3C479BE3E4300411886
validpgpkeys = 647F28654894E3BD457199BE38DBBDC86092693E
sha256sums = 3e9150065f193d3d94bcf46a1fe9f033c7ef7122ab71d75a7fb5a2f0c9a7e11a
sha256sums = SKIP
- sha256sums = efa9b7d87a6ca67426e3d7f206ac987eb7cb31602ad2011e81060626de790fcb
+ sha256sums = cdeff3a6e0dc3d6189d1b1d4d6318f0942b9a28409491cf65592879e4c42b1f7
sha256sums = SKIP
sha256sums = 1e72cd2e9e1fa8bf1478f7a7d9b9719d1fd2d1754dbe915a6b6d7e0d0a92da0a
sha256sums = 8646ab1d39f1755de240a27dd1970be39b8b81b1f1caca0dd77c0a4b157292d9
+ sha256sums = 834bd254b56ab71d73f59b3221f056c72f559553c04718e350ab2a3e2991afe0
+ sha256sums = ad6344badc91ad0630caacde83f7f9b97276f80d26a20619a87952be65492c65
sha256sums = 72f0b3ce04f33dfae305297bd045fba8cb5e5c8594ffd7a68a4d8ed293b1b1b5
- sha256sums = f0d90e756f14533ee67afda280500511a62465b4f76adcc5effa95a40045179c
+ sha256sums = 1256b241cd477b265a3c2d64bdc19ffe3c9bbcee82ea3994c590c2c76e767d99
sha256sums = bb8af32880059e681396a250d8e78f600f248da8ad4f0e76d7923badb5ee8b42
sha256sums = 4d4a622733c2ba742256f369c32a1e98fc216966589f260c7457d299dbb55971
sha256sums = 09189eb269a9fd16898cf90a477df23306236fb897791e8d04e5a75d5007bbff
sha256sums = c0a25b413bc542472868c63318213dfe788beeece750d15f7ff1568aca8968ec
sha256sums = 1256b241cd477b265a3c2d64bdc19ffe3c9bbcee82ea3994c590c2c76e767d99
+ sha256sums = b595a1588bafb3d732841cd1b73633970706914f57f2d215c9f1494212d13989
pkgname = linux-macbook
pkgdesc = The Linux-macbook kernel and modules (with brightness key and suspend patches)
@@ -53,13 +59,7 @@ pkgname = linux-macbook
pkgname = linux-macbook-headers
pkgdesc = Header files and scripts for building modules for Linux-macbook kernel (with brightness key and suspend patches)
- depends = linux-macbook
- provides = linux-macbook-headers=4.8.14
- provides = linux-headers=4.8.14
pkgname = linux-macbook-docs
pkgdesc = Kernel hackers manual - HTML documentation that comes with the Linux-macbook kernel (with brightness key and suspend patches)
- depends = linux-macbook
- provides = linux-macbook-docs=4.8.14
- provides = linux-docs=4.8.14
diff --git a/99-linux-macbook.hook b/99-linux-macbook.hook
new file mode 100644
index 000000000000..9851151995bc
--- /dev/null
+++ b/99-linux-macbook.hook
@@ -0,0 +1,11 @@
+[Trigger]
+Type = File
+Operation = Install
+Operation = Upgrade
+Target = boot/vmlinuz-%PKGBASE%
+Target = usr/lib/initcpio/*
+
+[Action]
+Description = Updating %PKGBASE% initcpios
+When = PostTransaction
+Exec = /usr/bin/mkinitcpio -p %PKGBASE%
diff --git a/PKGBUILD b/PKGBUILD
index 2897876a721a..5c9439546457 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,15 +1,14 @@
-# $Id: PKGBUILD 267890 2016-05-12 16:05:36Z tpowa $
+# Id: PKGBUILD 277473 2016-09-30 19:28:40Z tpowa $
# Maintainer: Tobias Powalowski <tpowa@archlinux.org>
# Maintainer: Thomas Baechler <thomas@archlinux.org>
# Maintainer: Tony Lambiris <tony@critialstack.com>
-pkgbase=linux-macbook # Build kernel with a different name
-_kernelname=-macbook
+pkgbase=linux-macbook
_srcname=linux-4.8
-pkgver=4.8.14
+pkgver=4.8.15
pkgrel=1
arch=('i686' 'x86_64')
-url="http://www.kernel.org/"
+url="https://www.kernel.org/"
license=('GPL2')
makedepends=('xmlto' 'docbook-xsl' 'kmod' 'inetutils' 'bc' 'libelf')
options=('!strip')
@@ -19,29 +18,37 @@ source=("https://www.kernel.org/pub/linux/kernel/v4.x/${_srcname}.tar.xz"
"https://www.kernel.org/pub/linux/kernel/v4.x/patch-${pkgver}.sign"
# the main kernel config files
'config' 'config.x86_64'
- # service file for suspend/resume events
- 'macbook-wakeup.service'
+ # pacman hook for initramfs regeneration
+ '99-linux-macbook.hook'
# standard config files for mkinitcpio ramdisk
'linux-macbook.preset'
+ # service file for suspend/resume events
+ 'macbook-wakeup.service'
+ 'change-default-console-loglevel.patch'
'apple-gmux.patch'
'macbook-suspend.patch'
'poweroff-quirk-workaround.patch'
'intel-pstate-backport.patch'
- 'change-default-console-loglevel.patch')
+ 'change-default-console-loglevel.patch'
+ net_handle_no_dst_on_skb_in_icmp6_send.patch
+ )
sha256sums=('3e9150065f193d3d94bcf46a1fe9f033c7ef7122ab71d75a7fb5a2f0c9a7e11a'
'SKIP'
- 'efa9b7d87a6ca67426e3d7f206ac987eb7cb31602ad2011e81060626de790fcb'
+ 'cdeff3a6e0dc3d6189d1b1d4d6318f0942b9a28409491cf65592879e4c42b1f7'
'SKIP'
'1e72cd2e9e1fa8bf1478f7a7d9b9719d1fd2d1754dbe915a6b6d7e0d0a92da0a'
'8646ab1d39f1755de240a27dd1970be39b8b81b1f1caca0dd77c0a4b157292d9'
+ '834bd254b56ab71d73f59b3221f056c72f559553c04718e350ab2a3e2991afe0'
+ 'ad6344badc91ad0630caacde83f7f9b97276f80d26a20619a87952be65492c65'
'72f0b3ce04f33dfae305297bd045fba8cb5e5c8594ffd7a68a4d8ed293b1b1b5'
- 'f0d90e756f14533ee67afda280500511a62465b4f76adcc5effa95a40045179c'
+ '1256b241cd477b265a3c2d64bdc19ffe3c9bbcee82ea3994c590c2c76e767d99'
'bb8af32880059e681396a250d8e78f600f248da8ad4f0e76d7923badb5ee8b42'
'4d4a622733c2ba742256f369c32a1e98fc216966589f260c7457d299dbb55971'
'09189eb269a9fd16898cf90a477df23306236fb897791e8d04e5a75d5007bbff'
'c0a25b413bc542472868c63318213dfe788beeece750d15f7ff1568aca8968ec'
- '1256b241cd477b265a3c2d64bdc19ffe3c9bbcee82ea3994c590c2c76e767d99')
+ '1256b241cd477b265a3c2d64bdc19ffe3c9bbcee82ea3994c590c2c76e767d99'
+ 'b595a1588bafb3d732841cd1b73633970706914f57f2d215c9f1494212d13989')
validpgpkeys=(
'ABAF11C65A2970B130ABE3C479BE3E4300411886' # Linus Torvalds
'647F28654894E3BD457199BE38DBBDC86092693E' # Greg Kroah-Hartman
@@ -55,6 +62,9 @@ prepare() {
# add upstream patch
patch -p1 -i "${srcdir}/patch-${pkgver}"
+ # https://bugzilla.kernel.org/show_bug.cgi?id=189851
+ patch --verbose -p1 -i "${srcdir}/net_handle_no_dst_on_skb_in_icmp6_send.patch"
+
# add latest fixes from stable queue, if needed
# http://git.kernel.org/?p=linux/kernel/git/stable/stable-queue.git
@@ -128,21 +138,17 @@ _package() {
cp arch/$KARCH/boot/bzImage "${pkgdir}/boot/vmlinuz-${pkgbase}"
# set correct depmod command for install
- cp -f "${startdir}/${install}" "${startdir}/${install}.pkg"
+ sed -e "s|%PKGBASE%|${pkgbase}|g;s|%KERNVER%|${_kernver}|g" \
+ "${startdir}/${install}" > "${startdir}/${install}.pkg"
true && install=${install}.pkg
- sed \
- -e "s/KERNEL_NAME=.*/KERNEL_NAME=${_kernelname}/" \
- -e "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_kernver}/" \
- -i "${startdir}/${install}"
# install mkinitcpio preset file for kernel
- install -D -m644 "${srcdir}/linux-macbook.preset" "${pkgdir}/etc/mkinitcpio.d/${pkgbase}.preset"
- sed \
- -e "1s|'linux.*'|'${pkgbase}'|" \
- -e "s|ALL_kver=.*|ALL_kver=\"/boot/vmlinuz-${pkgbase}\"|" \
- -e "s|default_image=.*|default_image=\"/boot/initramfs-${pkgbase}.img\"|" \
- -e "s|fallback_image=.*|fallback_image=\"/boot/initramfs-${pkgbase}-fallback.img\"|" \
- -i "${pkgdir}/etc/mkinitcpio.d/${pkgbase}.preset"
+ sed "s|%PKGBASE%|${pkgbase}|g" "${srcdir}/linux-macbook.preset" |
+ install -D -m644 /dev/stdin "${pkgdir}/etc/mkinitcpio.d/${pkgbase}.preset"
+
+ # install pacman hook for initramfs regeneration
+ sed "s|%PKGBASE%|${pkgbase}|g" "${srcdir}/99-linux-macbook.hook" |
+ install -D -m644 /dev/stdin "${pkgdir}/usr/share/libalpm/hooks/99-${pkgbase}.hook"
# remove build and source links
rm -f "${pkgdir}"/lib/modules/${_kernver}/{source,build}
@@ -171,8 +177,7 @@ _package() {
_package-headers() {
pkgdesc="Header files and scripts for building modules for ${pkgbase/linux/Linux} kernel (with brightness key and suspend patches)"
- depends=('linux-macbook') # added to keep kernel and headers packages matched
- provides=("linux-macbook-headers=${pkgver}" "linux-headers=${pkgver}")
+
install -dm755 "${pkgdir}/usr/lib/modules/${_kernver}"
cd "${srcdir}/${_srcname}"
@@ -300,8 +305,6 @@ _package-headers() {
_package-docs() {
pkgdesc="Kernel hackers manual - HTML documentation that comes with the ${pkgbase/linux/Linux} kernel (with brightness key and suspend patches)"
- depends=('linux-macbook') # added to keep kernel and headers packages matched
- provides=("linux-macbook-docs=${pkgver}" "linux-docs=${pkgver}")
cd "${srcdir}/${_srcname}"
@@ -321,3 +324,5 @@ for _p in ${pkgname[@]}; do
_package${_p#${pkgbase}}
}"
done
+
+# vim:set ts=8 sts=2 sw=2 et:
diff --git a/fix_race_condition_in_packet_set_ring.diff b/fix_race_condition_in_packet_set_ring.diff
new file mode 100644
index 000000000000..12048f611d1a
--- /dev/null
+++ b/fix_race_condition_in_packet_set_ring.diff
@@ -0,0 +1,84 @@
+From: Philip Pettersson <philip.pettersson@gmail.com>
+
+When packet_set_ring creates a ring buffer it will initialize a
+struct timer_list if the packet version is TPACKET_V3. This value
+can then be raced by a different thread calling setsockopt to
+set the version to TPACKET_V1 before packet_set_ring has finished.
+
+This leads to a use-after-free on a function pointer in the
+struct timer_list when the socket is closed as the previously
+initialized timer will not be deleted.
+
+The bug is fixed by taking lock_sock(sk) in packet_setsockopt when
+changing the packet version while also taking the lock at the start
+of packet_set_ring.
+
+Fixes: f6fb8f100b80 ("af-packet: TPACKET_V3 flexible buffer implementation.")
+Signed-off-by: Philip Pettersson <philip.pettersson@gmail.com>
+Signed-off-by: Eric Dumazet <edumazet@google.com>
+---
+ net/packet/af_packet.c | 18 ++++++++++++------
+ 1 file changed, 12 insertions(+), 6 deletions(-)
+
+diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
+index d2238b204691b8e4f2e3acb9bc167b553ba32d50..dd2332390c45bbff7c3fc5d259453f2e1ca352bf 100644
+--- a/net/packet/af_packet.c
++++ b/net/packet/af_packet.c
+@@ -3648,19 +3648,25 @@ packet_setsockopt(struct socket *sock, int level, int optname, char __user *optv
+
+ if (optlen != sizeof(val))
+ return -EINVAL;
+- if (po->rx_ring.pg_vec || po->tx_ring.pg_vec)
+- return -EBUSY;
+ if (copy_from_user(&val, optval, sizeof(val)))
+ return -EFAULT;
+ switch (val) {
+ case TPACKET_V1:
+ case TPACKET_V2:
+ case TPACKET_V3:
+- po->tp_version = val;
+- return 0;
++ break;
+ default:
+ return -EINVAL;
+ }
++ lock_sock(sk);
++ if (po->rx_ring.pg_vec || po->tx_ring.pg_vec) {
++ ret = -EBUSY;
++ } else {
++ po->tp_version = val;
++ ret = 0;
++ }
++ release_sock(sk);
++ return ret;
+ }
+ case PACKET_RESERVE:
+ {
+@@ -4164,6 +4170,7 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u,
+ /* Added to avoid minimal code churn */
+ struct tpacket_req *req = &req_u->req;
+
++ lock_sock(sk);
+ /* Opening a Tx-ring is NOT supported in TPACKET_V3 */
+ if (!closing && tx_ring && (po->tp_version > TPACKET_V2)) {
+ net_warn_ratelimited("Tx-ring is not supported.\n");
+@@ -4245,7 +4252,6 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u,
+ goto out;
+ }
+
+- lock_sock(sk);
+
+ /* Detach socket from network */
+ spin_lock(&po->bind_lock);
+@@ -4294,11 +4300,11 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u,
+ if (!tx_ring)
+ prb_shutdown_retire_blk_timer(po, rb_queue);
+ }
+- release_sock(sk);
+
+ if (pg_vec)
+ free_pg_vec(pg_vec, order, req->tp_block_nr);
+ out:
++ release_sock(sk);
+ return err;
+ }
diff --git a/linux-macbook.install b/linux-macbook.install
index 818e0fe587d8..094b55c80175 100644
--- a/linux-macbook.install
+++ b/linux-macbook.install
@@ -1,9 +1,3 @@
-# arg 1: the new package version
-# arg 2: the old package version
-
-KERNEL_NAME=-macbook-pro
-KERNEL_VERSION=
-
display_requirements () {
cat <<-EOF
@@ -14,6 +8,9 @@ cat <<-EOF
in /etc/default/grub and then ran the following command as root:
grub-mkconfig -o /boot/grub/grub.cfg
+ Optionally, include the kernel boot option processor.ignore_ppc=1
+ to allow frequency changing on battery power.
+
Enable the macbook-wakeup service for suspend/resume on LID events:
systemctl enable --now macbook-wakeup.service
@@ -23,9 +20,7 @@ EOF
post_install () {
# updating module dependencies
echo ">>> Updating module dependencies. Please wait ..."
- depmod ${KERNEL_VERSION}
- echo ">>> Generating initial ramdisk, using mkinitcpio. Please wait..."
- mkinitcpio -p linux${KERNEL_NAME}
+ depmod %KERNVER%
display_requirements
}
@@ -37,9 +32,7 @@ post_upgrade() {
# updating module dependencies
echo ">>> Updating module dependencies. Please wait ..."
- depmod ${KERNEL_VERSION}
- echo ">>> Generating initial ramdisk, using mkinitcpio. Please wait..."
- mkinitcpio -p linux${KERNEL_NAME}
+ depmod %KERNVER%
if [ $(vercmp $2 3.13) -lt 0 ]; then
echo ">>> WARNING: AT keyboard support is no longer built into the kernel."
@@ -52,6 +45,6 @@ post_upgrade() {
post_remove() {
# also remove the compat symlinks
- rm -f boot/initramfs-linux${KERNEL_NAME}.img
- rm -f boot/initramfs-linux${KERNEL_NAME}-fallback.img
+ rm -f boot/initramfs-%PKGBASE%.img
+ rm -f boot/initramfs-%PKGBASE%-fallback.img
}
diff --git a/linux-macbook.preset b/linux-macbook.preset
index b06292d104ef..66709a8c1537 100644
--- a/linux-macbook.preset
+++ b/linux-macbook.preset
@@ -1,14 +1,14 @@
-# mkinitcpio preset file for the 'linux' package
+# mkinitcpio preset file for the '%PKGBASE%' package
ALL_config="/etc/mkinitcpio.conf"
-ALL_kver="/boot/vmlinuz-linux"
+ALL_kver="/boot/vmlinuz-%PKGBASE%"
PRESETS=('default' 'fallback')
#default_config="/etc/mkinitcpio.conf"
-default_image="/boot/initramfs-linux.img"
+default_image="/boot/initramfs-%PKGBASE%.img"
#default_options=""
#fallback_config="/etc/mkinitcpio.conf"
-fallback_image="/boot/initramfs-linux-fallback.img"
+fallback_image="/boot/initramfs-%PKGBASE%-fallback.img"
fallback_options="-S autodetect"
diff --git a/net_handle_no_dst_on_skb_in_icmp6_send.patch b/net_handle_no_dst_on_skb_in_icmp6_send.patch
new file mode 100644
index 000000000000..06448a90affe
--- /dev/null
+++ b/net_handle_no_dst_on_skb_in_icmp6_send.patch
@@ -0,0 +1,68 @@
+From 79dc7e3f1cd323be4c81aa1a94faa1b3ed987fb2 Mon Sep 17 00:00:00 2001
+From: David Ahern <dsa@cumulusnetworks.com>
+Date: Sun, 27 Nov 2016 18:52:53 -0800
+Subject: [PATCH] net: handle no dst on skb in icmp6_send
+
+Andrey reported the following while fuzzing the kernel with syzkaller:
+
+kasan: CONFIG_KASAN_INLINE enabled
+kasan: GPF could be caused by NULL-ptr deref or user memory access
+general protection fault: 0000 [#1] SMP KASAN
+Modules linked in:
+CPU: 0 PID: 3859 Comm: a.out Not tainted 4.9.0-rc6+ #429
+Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
+task: ffff8800666d4200 task.stack: ffff880067348000
+RIP: 0010:[<ffffffff833617ec>] [<ffffffff833617ec>]
+icmp6_send+0x5fc/0x1e30 net/ipv6/icmp.c:451
+RSP: 0018:ffff88006734f2c0 EFLAGS: 00010206
+RAX: ffff8800666d4200 RBX: 0000000000000000 RCX: 0000000000000000
+RDX: 0000000000000000 RSI: dffffc0000000000 RDI: 0000000000000018
+RBP: ffff88006734f630 R08: ffff880064138418 R09: 0000000000000003
+R10: dffffc0000000000 R11: 0000000000000005 R12: 0000000000000000
+R13: ffffffff84e7e200 R14: ffff880064138484 R15: ffff8800641383c0
+FS: 00007fb3887a07c0(0000) GS:ffff88006cc00000(0000) knlGS:0000000000000000
+CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
+CR2: 0000000020000000 CR3: 000000006b040000 CR4: 00000000000006f0
+Stack:
+ ffff8800666d4200 ffff8800666d49f8 ffff8800666d4200 ffffffff84c02460
+ ffff8800666d4a1a 1ffff1000ccdaa2f ffff88006734f498 0000000000000046
+ ffff88006734f440 ffffffff832f4269 ffff880064ba7456 0000000000000000
+Call Trace:
+ [<ffffffff83364ddc>] icmpv6_param_prob+0x2c/0x40 net/ipv6/icmp.c:557
+ [< inline >] ip6_tlvopt_unknown net/ipv6/exthdrs.c:88
+ [<ffffffff83394405>] ip6_parse_tlv+0x555/0x670 net/ipv6/exthdrs.c:157
+ [<ffffffff8339a759>] ipv6_parse_hopopts+0x199/0x460 net/ipv6/exthdrs.c:663
+ [<ffffffff832ee773>] ipv6_rcv+0xfa3/0x1dc0 net/ipv6/ip6_input.c:191
+ ...
+
+icmp6_send / icmpv6_send is invoked for both rx and tx paths. In both
+cases the dst->dev should be preferred for determining the L3 domain
+if the dst has been set on the skb. Fallback to the skb->dev if it has
+not. This covers the case reported here where icmp6_send is invoked on
+Rx before the route lookup.
+
+Fixes: 5d41ce29e ("net: icmp6_send should use dst dev to determine L3 domain")
+Reported-by: Andrey Konovalov <andreyknvl@google.com>
+Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ net/ipv6/icmp.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
+index 7370ad2..2772004 100644
+--- a/net/ipv6/icmp.c
++++ b/net/ipv6/icmp.c
+@@ -447,8 +447,10 @@ static void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info,
+
+ if (__ipv6_addr_needs_scope_id(addr_type))
+ iif = skb->dev->ifindex;
+- else
+- iif = l3mdev_master_ifindex(skb_dst(skb)->dev);
++ else {
++ dst = skb_dst(skb);
++ iif = l3mdev_master_ifindex(dst ? dst->dev : skb->dev);
++ }
+
+ /*
+ * Must not send error if the source does not uniquely