1. 21 Nov, 2014 35 commits
    • Luciano Coelho's avatar
      mac80211: use secondary channel offset IE also beacons during CSA · b0255bc3
      Luciano Coelho authored
      commit 84469a45 upstream.
      
      If we are switching from an HT40+ to an HT40- channel (or vice-versa),
      we need the secondary channel offset IE to specify what is the
      post-CSA offset to be used.  This applies both to beacons and to probe
      responses.
      
      In ieee80211_parse_ch_switch_ie() we were ignoring this IE from
      beacons and using the *current* HT information IE instead.  This was
      causing us to use the same offset as before the switch.
      
      Fix that by using the secondary channel offset IE also for beacons and
      don't ever use the pre-switch offset.  Additionally, remove the
      "beacon" argument from ieee80211_parse_ch_switch_ie(), since it's not
      needed anymore.
      Reported-by: default avatarJouni Malinen <j@w1.fi>
      Signed-off-by: default avatarLuciano Coelho <luciano.coelho@intel.com>
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b0255bc3
    • Johannes Berg's avatar
      mac80211: properly flush delayed scan work on interface removal · b77034fb
      Johannes Berg authored
      commit 46238845 upstream.
      
      When an interface is deleted, an ongoing hardware scan is canceled and
      the driver must abort the scan, at the very least reporting completion
      while the interface is removed.
      
      However, if it scheduled the work that might only run after everything
      is said and done, which leads to cfg80211 warning that the scan isn't
      reported as finished yet; this is no fault of the driver, it already
      did, but mac80211 hasn't processed it.
      
      To fix this situation, flush the delayed work when the interface being
      removed is the one that was executing the scan.
      Reported-by: default avatarSujith Manoharan <sujith@msujith.org>
      Tested-by: default avatarSujith Manoharan <sujith@msujith.org>
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b77034fb
    • Junjie Mao's avatar
      mac80211_hwsim: release driver when ieee80211_register_hw fails · 39630ccb
      Junjie Mao authored
      commit 805dbe17 upstream.
      
      The driver is not released when ieee80211_register_hw fails in
      mac80211_hwsim_create_radio, leading to the access to the unregistered (and
      possibly freed) device in platform_driver_unregister:
      
      [    0.447547] mac80211_hwsim: ieee80211_register_hw failed (-2)
      [    0.448292] ------------[ cut here ]------------
      [    0.448854] WARNING: CPU: 0 PID: 1 at ../include/linux/kref.h:47 kobject_get+0x33/0x50()
      [    0.449839] CPU: 0 PID: 1 Comm: swapper Not tainted 3.17.0-00001-gdd46990-dirty #2
      [    0.450813] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
      [    0.451512]  00000000 00000000 78025e38 7967c6c6 78025e68 7905e09b 7988b480 00000000
      [    0.452579]  00000001 79887d62 0000002f 79170bb3 79170bb3 78397008 79ac9d74 00000001
      [    0.453614]  78025e78 7905e15d 00000009 00000000 78025e84 79170bb3 78397000 78025e8c
      [    0.454632] Call Trace:
      [    0.454921]  [<7967c6c6>] dump_stack+0x16/0x18
      [    0.455453]  [<7905e09b>] warn_slowpath_common+0x6b/0x90
      [    0.456067]  [<79170bb3>] ? kobject_get+0x33/0x50
      [    0.456612]  [<79170bb3>] ? kobject_get+0x33/0x50
      [    0.457155]  [<7905e15d>] warn_slowpath_null+0x1d/0x20
      [    0.457748]  [<79170bb3>] kobject_get+0x33/0x50
      [    0.458274]  [<7925824f>] get_device+0xf/0x20
      [    0.458779]  [<7925b5cd>] driver_detach+0x3d/0xa0
      [    0.459331]  [<7925a3ff>] bus_remove_driver+0x8f/0xb0
      [    0.459927]  [<7925bf80>] ? class_unregister+0x40/0x80
      [    0.460660]  [<7925bad7>] driver_unregister+0x47/0x50
      [    0.461248]  [<7925c033>] ? class_destroy+0x13/0x20
      [    0.461824]  [<7925d07b>] platform_driver_unregister+0xb/0x10
      [    0.462507]  [<79b51ba0>] init_mac80211_hwsim+0x3e8/0x3f9
      [    0.463161]  [<79b30c58>] do_one_initcall+0x106/0x1a9
      [    0.463758]  [<79b517b8>] ? if_spi_init_module+0xac/0xac
      [    0.464393]  [<79b517b8>] ? if_spi_init_module+0xac/0xac
      [    0.465001]  [<79071935>] ? parse_args+0x2f5/0x480
      [    0.465569]  [<7906b41e>] ? __usermodehelper_set_disable_depth+0x3e/0x50
      [    0.466345]  [<79b30dd9>] kernel_init_freeable+0xde/0x17d
      [    0.466972]  [<79b304d6>] ? do_early_param+0x7a/0x7a
      [    0.467546]  [<79677b1b>] kernel_init+0xb/0xe0
      [    0.468072]  [<79075f42>] ? schedule_tail+0x12/0x40
      [    0.468658]  [<79686580>] ret_from_kernel_thread+0x20/0x30
      [    0.469303]  [<79677b10>] ? rest_init+0xc0/0xc0
      [    0.469829] ---[ end trace ad8ac403ff8aef5c ]---
      [    0.470509] ------------[ cut here ]------------
      [    0.471047] WARNING: CPU: 0 PID: 1 at ../kernel/locking/lockdep.c:3161 __lock_acquire.isra.22+0x7aa/0xb00()
      [    0.472163] DEBUG_LOCKS_WARN_ON(id >= MAX_LOCKDEP_KEYS)
      [    0.472774] CPU: 0 PID: 1 Comm: swapper Tainted: G        W      3.17.0-00001-gdd46990-dirty #2
      [    0.473815] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
      [    0.474492]  78025de0 78025de0 78025da0 7967c6c6 78025dd0 7905e09b 79888931 78025dfc
      [    0.475515]  00000001 79888a93 00000c59 7907f33a 7907f33a 78028000 fffe9d09 00000000
      [    0.476519]  78025de8 7905e10e 00000009 78025de0 79888931 78025dfc 78025e24 7907f33a
      [    0.477523] Call Trace:
      [    0.477821]  [<7967c6c6>] dump_stack+0x16/0x18
      [    0.478352]  [<7905e09b>] warn_slowpath_common+0x6b/0x90
      [    0.478976]  [<7907f33a>] ? __lock_acquire.isra.22+0x7aa/0xb00
      [    0.479658]  [<7907f33a>] ? __lock_acquire.isra.22+0x7aa/0xb00
      [    0.480417]  [<7905e10e>] warn_slowpath_fmt+0x2e/0x30
      [    0.480479]  [<7907f33a>] __lock_acquire.isra.22+0x7aa/0xb00
      [    0.480479]  [<79078aa5>] ? sched_clock_cpu+0xb5/0xf0
      [    0.480479]  [<7907fd06>] lock_acquire+0x56/0x70
      [    0.480479]  [<7925b5e8>] ? driver_detach+0x58/0xa0
      [    0.480479]  [<79682d11>] mutex_lock_nested+0x61/0x2a0
      [    0.480479]  [<7925b5e8>] ? driver_detach+0x58/0xa0
      [    0.480479]  [<7925b5e8>] ? driver_detach+0x58/0xa0
      [    0.480479]  [<7925b5e8>] driver_detach+0x58/0xa0
      [    0.480479]  [<7925a3ff>] bus_remove_driver+0x8f/0xb0
      [    0.480479]  [<7925bf80>] ? class_unregister+0x40/0x80
      [    0.480479]  [<7925bad7>] driver_unregister+0x47/0x50
      [    0.480479]  [<7925c033>] ? class_destroy+0x13/0x20
      [    0.480479]  [<7925d07b>] platform_driver_unregister+0xb/0x10
      [    0.480479]  [<79b51ba0>] init_mac80211_hwsim+0x3e8/0x3f9
      [    0.480479]  [<79b30c58>] do_one_initcall+0x106/0x1a9
      [    0.480479]  [<79b517b8>] ? if_spi_init_module+0xac/0xac
      [    0.480479]  [<79b517b8>] ? if_spi_init_module+0xac/0xac
      [    0.480479]  [<79071935>] ? parse_args+0x2f5/0x480
      [    0.480479]  [<7906b41e>] ? __usermodehelper_set_disable_depth+0x3e/0x50
      [    0.480479]  [<79b30dd9>] kernel_init_freeable+0xde/0x17d
      [    0.480479]  [<79b304d6>] ? do_early_param+0x7a/0x7a
      [    0.480479]  [<79677b1b>] kernel_init+0xb/0xe0
      [    0.480479]  [<79075f42>] ? schedule_tail+0x12/0x40
      [    0.480479]  [<79686580>] ret_from_kernel_thread+0x20/0x30
      [    0.480479]  [<79677b10>] ? rest_init+0xc0/0xc0
      [    0.480479] ---[ end trace ad8ac403ff8aef5d ]---
      [    0.495478] BUG: unable to handle kernel paging request at 00200200
      [    0.496257] IP: [<79682de5>] mutex_lock_nested+0x135/0x2a0
      [    0.496923] *pde = 00000000
      [    0.497290] Oops: 0002 [#1]
      [    0.497653] CPU: 0 PID: 1 Comm: swapper Tainted: G        W      3.17.0-00001-gdd46990-dirty #2
      [    0.498659] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
      [    0.499321] task: 78028000 ti: 78024000 task.ti: 78024000
      [    0.499955] EIP: 0060:[<79682de5>] EFLAGS: 00010097 CPU: 0
      [    0.500620] EIP is at mutex_lock_nested+0x135/0x2a0
      [    0.501145] EAX: 00200200 EBX: 78397434 ECX: 78397460 EDX: 78025e70
      [    0.501816] ESI: 00000246 EDI: 78028000 EBP: 78025e8c ESP: 78025e54
      [    0.502497]  DS: 007b ES: 007b FS: 0000 GS: 0000 SS: 0068
      [    0.503076] CR0: 8005003b CR2: 00200200 CR3: 01b9d000 CR4: 00000690
      [    0.503773] Stack:
      [    0.503998]  00000000 00000001 00000000 7925b5e8 78397460 7925b5e8 78397474 78397460
      [    0.504944]  00200200 11111111 78025e70 78397000 79ac9d74 00000001 78025ea0 7925b5e8
      [    0.505451]  79ac9d74 fffffffe 00000001 78025ebc 7925a3ff 7a251398 78025ec8 7925bf80
      [    0.505451] Call Trace:
      [    0.505451]  [<7925b5e8>] ? driver_detach+0x58/0xa0
      [    0.505451]  [<7925b5e8>] ? driver_detach+0x58/0xa0
      [    0.505451]  [<7925b5e8>] driver_detach+0x58/0xa0
      [    0.505451]  [<7925a3ff>] bus_remove_driver+0x8f/0xb0
      [    0.505451]  [<7925bf80>] ? class_unregister+0x40/0x80
      [    0.505451]  [<7925bad7>] driver_unregister+0x47/0x50
      [    0.505451]  [<7925c033>] ? class_destroy+0x13/0x20
      [    0.505451]  [<7925d07b>] platform_driver_unregister+0xb/0x10
      [    0.505451]  [<79b51ba0>] init_mac80211_hwsim+0x3e8/0x3f9
      [    0.505451]  [<79b30c58>] do_one_initcall+0x106/0x1a9
      [    0.505451]  [<79b517b8>] ? if_spi_init_module+0xac/0xac
      [    0.505451]  [<79b517b8>] ? if_spi_init_module+0xac/0xac
      [    0.505451]  [<79071935>] ? parse_args+0x2f5/0x480
      [    0.505451]  [<7906b41e>] ? __usermodehelper_set_disable_depth+0x3e/0x50
      [    0.505451]  [<79b30dd9>] kernel_init_freeable+0xde/0x17d
      [    0.505451]  [<79b304d6>] ? do_early_param+0x7a/0x7a
      [    0.505451]  [<79677b1b>] kernel_init+0xb/0xe0
      [    0.505451]  [<79075f42>] ? schedule_tail+0x12/0x40
      [    0.505451]  [<79686580>] ret_from_kernel_thread+0x20/0x30
      [    0.505451]  [<79677b10>] ? rest_init+0xc0/0xc0
      [    0.505451] Code: 89 d8 e8 cf 9b 9f ff 8b 4f 04 8d 55 e4 89 d8 e8 72 9d 9f ff 8d 43 2c 89 c1 89 45 d8 8b 43 30 8d 55 e4 89 53 30 89 4d e4 89 45 e8 <89> 10 8b 55 dc 8b 45 e0 89 7d ec e8 db af 9f ff eb 11 90 31 c0
      [    0.505451] EIP: [<79682de5>] mutex_lock_nested+0x135/0x2a0 SS:ESP 0068:78025e54
      [    0.505451] CR2: 0000000000200200
      [    0.505451] ---[ end trace ad8ac403ff8aef5e ]---
      [    0.505451] Kernel panic - not syncing: Fatal exception
      
      Fixes: 9ea92774 ("mac80211_hwsim: Register and bind to driver")
      Reported-by: default avatarFengguang Wu <fengguang.wu@intel.com>
      Signed-off-by: default avatarJunjie Mao <eternal.n08@gmail.com>
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      39630ccb
    • Herbert Xu's avatar
      macvtap: Fix csum_start when VLAN tags are present · b3101caa
      Herbert Xu authored
      commit 3ce9b20f upstream.
      
      When VLAN is in use in macvtap_put_user, we end up setting
      csum_start to the wrong place.  The result is that the whoever
      ends up doing the checksum setting will corrupt the packet instead
      of writing the checksum to the expected location, usually this
      means writing the checksum with an offset of -4.
      
      This patch fixes this by adjusting csum_start when VLAN tags are
      detected.
      
      Fixes: f09e2249 ("macvtap: restore vlan header on user read")
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b3101caa
    • Ilya Dryomov's avatar
      libceph: do not crash on large auth tickets · 5ab7aeed
      Ilya Dryomov authored
      commit aaef3170 upstream.
      
      Large (greater than 32k, the value of PAGE_ALLOC_COSTLY_ORDER) auth
      tickets will have their buffers vmalloc'ed, which leads to the
      following crash in crypto:
      
      [   28.685082] BUG: unable to handle kernel paging request at ffffeb04000032c0
      [   28.686032] IP: [<ffffffff81392b42>] scatterwalk_pagedone+0x22/0x80
      [   28.686032] PGD 0
      [   28.688088] Oops: 0000 [#1] PREEMPT SMP
      [   28.688088] Modules linked in:
      [   28.688088] CPU: 0 PID: 878 Comm: kworker/0:2 Not tainted 3.17.0-vm+ #305
      [   28.688088] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2007
      [   28.688088] Workqueue: ceph-msgr con_work
      [   28.688088] task: ffff88011a7f9030 ti: ffff8800d903c000 task.ti: ffff8800d903c000
      [   28.688088] RIP: 0010:[<ffffffff81392b42>]  [<ffffffff81392b42>] scatterwalk_pagedone+0x22/0x80
      [   28.688088] RSP: 0018:ffff8800d903f688  EFLAGS: 00010286
      [   28.688088] RAX: ffffeb04000032c0 RBX: ffff8800d903f718 RCX: ffffeb04000032c0
      [   28.688088] RDX: 0000000000000000 RSI: 0000000000000001 RDI: ffff8800d903f750
      [   28.688088] RBP: ffff8800d903f688 R08: 00000000000007de R09: ffff8800d903f880
      [   28.688088] R10: 18df467c72d6257b R11: 0000000000000000 R12: 0000000000000010
      [   28.688088] R13: ffff8800d903f750 R14: ffff8800d903f8a0 R15: 0000000000000000
      [   28.688088] FS:  00007f50a41c7700(0000) GS:ffff88011fc00000(0000) knlGS:0000000000000000
      [   28.688088] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
      [   28.688088] CR2: ffffeb04000032c0 CR3: 00000000da3f3000 CR4: 00000000000006b0
      [   28.688088] Stack:
      [   28.688088]  ffff8800d903f698 ffffffff81392ca8 ffff8800d903f6e8 ffffffff81395d32
      [   28.688088]  ffff8800dac96000 ffff880000000000 ffff8800d903f980 ffff880119b7e020
      [   28.688088]  ffff880119b7e010 0000000000000000 0000000000000010 0000000000000010
      [   28.688088] Call Trace:
      [   28.688088]  [<ffffffff81392ca8>] scatterwalk_done+0x38/0x40
      [   28.688088]  [<ffffffff81392ca8>] scatterwalk_done+0x38/0x40
      [   28.688088]  [<ffffffff81395d32>] blkcipher_walk_done+0x182/0x220
      [   28.688088]  [<ffffffff813990bf>] crypto_cbc_encrypt+0x15f/0x180
      [   28.688088]  [<ffffffff81399780>] ? crypto_aes_set_key+0x30/0x30
      [   28.688088]  [<ffffffff8156c40c>] ceph_aes_encrypt2+0x29c/0x2e0
      [   28.688088]  [<ffffffff8156d2a3>] ceph_encrypt2+0x93/0xb0
      [   28.688088]  [<ffffffff8156d7da>] ceph_x_encrypt+0x4a/0x60
      [   28.688088]  [<ffffffff8155b39d>] ? ceph_buffer_new+0x5d/0xf0
      [   28.688088]  [<ffffffff8156e837>] ceph_x_build_authorizer.isra.6+0x297/0x360
      [   28.688088]  [<ffffffff8112089b>] ? kmem_cache_alloc_trace+0x11b/0x1c0
      [   28.688088]  [<ffffffff8156b496>] ? ceph_auth_create_authorizer+0x36/0x80
      [   28.688088]  [<ffffffff8156ed83>] ceph_x_create_authorizer+0x63/0xd0
      [   28.688088]  [<ffffffff8156b4b4>] ceph_auth_create_authorizer+0x54/0x80
      [   28.688088]  [<ffffffff8155f7c0>] get_authorizer+0x80/0xd0
      [   28.688088]  [<ffffffff81555a8b>] prepare_write_connect+0x18b/0x2b0
      [   28.688088]  [<ffffffff81559289>] try_read+0x1e59/0x1f10
      
      This is because we set up crypto scatterlists as if all buffers were
      kmalloc'ed.  Fix it.
      Signed-off-by: default avatarIlya Dryomov <idryomov@redhat.com>
      Reviewed-by: default avatarSage Weil <sage@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5ab7aeed
    • Max Filippov's avatar
      xtensa: re-wire umount syscall to sys_oldumount · b120357f
      Max Filippov authored
      commit 2651cc69 upstream.
      
      Userspace actually passes single parameter (path name) to the umount
      syscall, so new umount just fails. Fix it by requesting old umount
      syscall implementation and re-wiring umount to it.
      Signed-off-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b120357f
    • Takashi Iwai's avatar
      ALSA: usb-audio: Fix memory leak in FTU quirk · 1d9e7837
      Takashi Iwai authored
      commit 1a290581 upstream.
      
      M-audio FastTrack Ultra quirk doesn't release the kzalloc'ed memory.
      This patch adds the private_free callback to release it properly.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1d9e7837
    • Tejun Heo's avatar
      ahci: disable MSI instead of NCQ on Samsung pci-e SSDs on macbooks · ee693dc0
      Tejun Heo authored
      commit 66a7cbc3 upstream.
      
      Samsung pci-e SSDs on macbooks failed miserably on NCQ commands, so
      67809f85 ("ahci: disable NCQ on Samsung pci-e SSDs on macbooks")
      disabled NCQ on them.  It turns out that NCQ is fine as long as MSI is
      not used, so let's turn off MSI and leave NCQ on.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=60731
      Tested-by: <dorin@i51.org>
      Tested-by: default avatarImre Kaloz <kaloz@openwrt.org>
      Fixes: 67809f85 ("ahci: disable NCQ on Samsung pci-e SSDs on macbooks")
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ee693dc0
    • James Ralston's avatar
      ahci: Add Device IDs for Intel Sunrise Point PCH · 5706021e
      James Ralston authored
      commit 690000b9 upstream.
      
      This patch adds the AHCI-mode SATA Device IDs for the Intel Sunrise Point PCH.
      Signed-off-by: default avatarJames Ralston <james.d.ralston@intel.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5706021e
    • Miklos Szeredi's avatar
      audit: keep inode pinned · a5d002ba
      Miklos Szeredi authored
      commit 799b6014 upstream.
      
      Audit rules disappear when an inode they watch is evicted from the cache.
      This is likely not what we want.
      
      The guilty commit is "fsnotify: allow marks to not pin inodes in core",
      which didn't take into account that audit_tree adds watches with a zero
      mask.
      
      Adding any mask should fix this.
      
      Fixes: 90b1e7a5 ("fsnotify: allow marks to not pin inodes in core")
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
      Signed-off-by: default avatarPaul Moore <pmoore@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a5d002ba
    • Richard Guy Briggs's avatar
      audit: AUDIT_FEATURE_CHANGE message format missing delimiting space · 10358970
      Richard Guy Briggs authored
      commit 897f1acb upstream.
      
      Add a space between subj= and feature= fields to make them parsable.
      Signed-off-by: default avatarRichard Guy Briggs <rgb@redhat.com>
      Signed-off-by: default avatarPaul Moore <pmoore@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      10358970
    • Richard Guy Briggs's avatar
      audit: correct AUDIT_GET_FEATURE return message type · 374f0609
      Richard Guy Briggs authored
      commit 9ef91514 upstream.
      
      When an AUDIT_GET_FEATURE message is sent from userspace to the kernel, it
      should reply with a message tagged as an AUDIT_GET_FEATURE type with a struct
      audit_feature.  The current reply is a message tagged as an AUDIT_GET
      type with a struct audit_feature.
      
      This appears to have been a cut-and-paste-eo in commit b0fed402.
      Reported-by: default avatarSteve Grubb <sgrubb@redhat.com>
      Signed-off-by: default avatarRichard Guy Briggs <rgb@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      374f0609
    • Andy Lutomirski's avatar
      x86, x32, audit: Fix x32's AUDIT_ARCH wrt audit · 406ad132
      Andy Lutomirski authored
      commit 81f49a8f upstream.
      
      is_compat_task() is the wrong check for audit arch; the check should
      be is_ia32_task(): x32 syscalls should be AUDIT_ARCH_X86_64, not
      AUDIT_ARCH_I386.
      
      CONFIG_AUDITSYSCALL is currently incompatible with x32, so this has
      no visible effect.
      Signed-off-by: default avatarAndy Lutomirski <luto@amacapital.net>
      Link: http://lkml.kernel.org/r/a0138ed8c709882aec06e4acc30bfa9b623b8717.1409954077.git.luto@amacapital.netSigned-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      406ad132
    • Herbert Xu's avatar
      tun: Fix csum_start with VLAN acceleration · 6b037909
      Herbert Xu authored
      commit a8f9bfdf upstream.
      
      When VLAN acceleration is in use on the xmit path, we end up
      setting csum_start to the wrong place.  The result is that the
      whoever ends up doing the checksum setting will corrupt the packet
      instead of writing the checksum to the expected location, usually
      this means writing the checksum with an offset of -4.
      
      This patch fixes this by adjusting csum_start when VLAN acceleration
      is detected.
      
      Fixes: 6680ec68 ("tuntap: hardware vlan tx support")
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6b037909
    • Greg Kurz's avatar
      hwrng: pseries - port to new read API and fix stack corruption · fe658f87
      Greg Kurz authored
      commit 24c65bc7 upstream.
      
      The add_early_randomness() function in drivers/char/hw_random/core.c passes
      a 16-byte buffer to pseries_rng_data_read(). Unfortunately, plpar_hcall()
      returns four 64-bit values and trashes 16 bytes on the stack.
      
      This bug has been lying around for a long time. It got unveiled by:
      
      commit d3cc7996
      Author: Amit Shah <amit.shah@redhat.com>
      Date:   Thu Jul 10 15:42:34 2014 +0530
      
          hwrng: fetch randomness only after device init
      
      It may trig a oops while loading or unloading the pseries-rng module for both
      PowerVM and PowerKVM guests.
      
      This patch does two things:
      - pass an intermediate well sized buffer to plpar_hcall(). This is acceptalbe
        since we're not on a hot path.
      - move to the new read API so that we know the return buffer size for sure.
      Signed-off-by: default avatarGreg Kurz <gkurz@linux.vnet.ibm.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fe658f87
    • Cristian Stoica's avatar
      crypto: caam - remove duplicated sg copy functions · c9ccfcc2
      Cristian Stoica authored
      commit 307fd543 upstream.
      
      Replace equivalent (and partially incorrect) scatter-gather functions
      with ones from crypto-API.
      
      The replacement is motivated by page-faults in sg_copy_part triggered
      by successive calls to crypto_hash_update. The following fault appears
      after calling crypto_ahash_update twice, first with 13 and then
      with 285 bytes:
      
      Unable to handle kernel paging request for data at address 0x00000008
      Faulting instruction address: 0xf9bf9a8c
      Oops: Kernel access of bad area, sig: 11 [#1]
      SMP NR_CPUS=8 CoreNet Generic
      Modules linked in: tcrypt(+) caamhash caam_jr caam tls
      CPU: 6 PID: 1497 Comm: cryptomgr_test Not tainted
      3.12.19-rt30-QorIQ-SDK-V1.6+g9fda9f2 #75
      task: e9308530 ti: e700e000 task.ti: e700e000
      NIP: f9bf9a8c LR: f9bfcf28 CTR: c0019ea0
      REGS: e700fb80 TRAP: 0300   Not tainted
      (3.12.19-rt30-QorIQ-SDK-V1.6+g9fda9f2)
      MSR: 00029002 <CE,EE,ME>  CR: 44f92024  XER: 20000000
      DEAR: 00000008, ESR: 00000000
      
      GPR00: f9bfcf28 e700fc30 e9308530 e70b1e55 00000000 ffffffdd e70b1e54 0bebf888
      GPR08: 902c7ef5 c0e771e2 00000002 00000888 c0019ea0 00000000 00000000 c07a4154
      GPR16: c08d0000 e91a8f9c 00000001 e98fb400 00000100 e9c83028 e70b1e08 e70b1d48
      GPR24: e992ce10 e70b1dc8 f9bfe4f4 e70b1e55 ffffffdd e70b1ce0 00000000 00000000
      NIP [f9bf9a8c] sg_copy+0x1c/0x100 [caamhash]
      LR [f9bfcf28] ahash_update_no_ctx+0x628/0x660 [caamhash]
      Call Trace:
      [e700fc30] [f9bf9c50] sg_copy_part+0xe0/0x160 [caamhash] (unreliable)
      [e700fc50] [f9bfcf28] ahash_update_no_ctx+0x628/0x660 [caamhash]
      [e700fcb0] [f954e19c] crypto_tls_genicv+0x13c/0x300 [tls]
      [e700fd10] [f954e65c] crypto_tls_encrypt+0x5c/0x260 [tls]
      [e700fd40] [c02250ec] __test_aead.constprop.9+0x2bc/0xb70
      [e700fe40] [c02259f0] alg_test_aead+0x50/0xc0
      [e700fe60] [c02241e4] alg_test+0x114/0x2e0
      [e700fee0] [c022276c] cryptomgr_test+0x4c/0x60
      [e700fef0] [c004f658] kthread+0x98/0xa0
      [e700ff40] [c000fd04] ret_from_kernel_thread+0x5c/0x64
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Cc: Cristian Stoica <cristian.stoica@freescale.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c9ccfcc2
    • Cristian Stoica's avatar
      crypto: caam - fix missing dma unmap on error path · 77204ef5
      Cristian Stoica authored
      commit 738459e3 upstream.
      
      If dma mapping for dma_addr_out fails, the descriptor memory is freed
      but the previous dma mapping for dma_addr_in remains.
      This patch resolves the missing dma unmap and groups resource
      allocations at function start.
      Signed-off-by: default avatarCristian Stoica <cristian.stoica@freescale.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      77204ef5
    • Weijie Yang's avatar
      zram: avoid kunmap_atomic() of a NULL pointer · 340eb9b2
      Weijie Yang authored
      commit c4065152 upstream.
      
      zram could kunmap_atomic() a NULL pointer in a rare situation: a zram
      page becomes a full-zeroed page after a partial write io.  The current
      code doesn't handle this case and performs kunmap_atomic() on a NULL
      pointer, which panics the kernel.
      
      This patch fixes this issue.
      Signed-off-by: default avatarWeijie Yang <weijie.yang@samsung.com>
      Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Cc: Dan Streetman <ddstreet@ieee.org>
      Cc: Nitin Gupta <ngupta@vflare.org>
      Cc: Weijie Yang <weijie.yang.kh@gmail.com>
      Acked-by: default avatarJerome Marchand <jmarchan@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      340eb9b2
    • Andreas Larsson's avatar
      sparc32: Implement xchg and atomic_xchg using ATOMIC_HASH locks · 882b3ba4
      Andreas Larsson authored
      [ Upstream commit 1a17fdc4 ]
      
      Atomicity between xchg and cmpxchg cannot be guaranteed when xchg is
      implemented with a swap and cmpxchg is implemented with locks.
      Without this, e.g. mcs_spin_lock and mcs_spin_unlock are broken.
      Signed-off-by: default avatarAndreas Larsson <andreas@gaisler.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      882b3ba4
    • David S. Miller's avatar
      sparc64: Do irq_{enter,exit}() around generic_smp_call_function*(). · ca9811bf
      David S. Miller authored
      [ Upstream commit ab5c7809 ]
      
      Otherwise rcu_irq_{enter,exit}() do not happen and we get dumps like:
      
      ====================
      [  188.275021] ===============================
      [  188.309351] [ INFO: suspicious RCU usage. ]
      [  188.343737] 3.18.0-rc3-00068-g20f3963d-dirty #54 Not tainted
      [  188.394786] -------------------------------
      [  188.429170] include/linux/rcupdate.h:883 rcu_read_lock() used
      illegally while idle!
      [  188.505235]
      other info that might help us debug this:
      
      [  188.554230]
      RCU used illegally from idle CPU!
      rcu_scheduler_active = 1, debug_locks = 0
      [  188.637587] RCU used illegally from extended quiescent state!
      [  188.690684] 3 locks held by swapper/7/0:
      [  188.721932]  #0:  (&x->wait#11){......}, at: [<0000000000495de8>] complete+0x8/0x60
      [  188.797994]  #1:  (&p->pi_lock){-.-.-.}, at: [<000000000048510c>] try_to_wake_up+0xc/0x400
      [  188.881343]  #2:  (rcu_read_lock){......}, at: [<000000000048a910>] select_task_rq_fair+0x90/0xb40
      [  188.973043]stack backtrace:
      [  188.993879] CPU: 7 PID: 0 Comm: swapper/7 Not tainted 3.18.0-rc3-00068-g20f3963d-dirty #54
      [  189.076187] Call Trace:
      [  189.089719]  [0000000000499360] lockdep_rcu_suspicious+0xe0/0x100
      [  189.147035]  [000000000048a99c] select_task_rq_fair+0x11c/0xb40
      [  189.202253]  [00000000004852d8] try_to_wake_up+0x1d8/0x400
      [  189.252258]  [000000000048554c] default_wake_function+0xc/0x20
      [  189.306435]  [0000000000495554] __wake_up_common+0x34/0x80
      [  189.356448]  [00000000004955b4] __wake_up_locked+0x14/0x40
      [  189.406456]  [0000000000495e08] complete+0x28/0x60
      [  189.448142]  [0000000000636e28] blk_end_sync_rq+0x8/0x20
      [  189.496057]  [0000000000639898] __blk_mq_end_request+0x18/0x60
      [  189.550249]  [00000000006ee014] scsi_end_request+0x94/0x180
      [  189.601286]  [00000000006ee334] scsi_io_completion+0x1d4/0x600
      [  189.655463]  [00000000006e51c4] scsi_finish_command+0xc4/0xe0
      [  189.708598]  [00000000006ed958] scsi_softirq_done+0x118/0x140
      [  189.761735]  [00000000006398ec] __blk_mq_complete_request_remote+0xc/0x20
      [  189.827383]  [00000000004c75d0] generic_smp_call_function_single_interrupt+0x150/0x1c0
      [  189.906581]  [000000000043e514] smp_call_function_single_client+0x14/0x40
      ====================
      
      Based almost entirely upon a patch by Paul E. McKenney.
      Reported-by: default avatarMeelis Roos <mroos@linux.ee>
      Tested-by: default avatarMeelis Roos <mroos@linux.ee>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ca9811bf
    • David S. Miller's avatar
      sparc64: Fix crashes in schizo_pcierr_intr_other(). · b51182e6
      David S. Miller authored
      [ Upstream commit 7da89a2a ]
      
      Meelis Roos reports crashes during bootup on a V480 that look like
      this:
      
      ====================
      [   61.300577] PCI: Scanning PBM /pci@9,600000
      [   61.304867] schizo f009b070: PCI host bridge to bus 0003:00
      [   61.310385] pci_bus 0003:00: root bus resource [io  0x7ffe9000000-0x7ffe9ffffff] (bus address [0x0000-0xffffff])
      [   61.320515] pci_bus 0003:00: root bus resource [mem 0x7fb00000000-0x7fbffffffff] (bus address [0x00000000-0xffffffff])
      [   61.331173] pci_bus 0003:00: root bus resource [bus 00]
      [   61.385344] Unable to handle kernel NULL pointer dereference
      [   61.390970] tsk->{mm,active_mm}->context = 0000000000000000
      [   61.396515] tsk->{mm,active_mm}->pgd = fff000b000002000
      [   61.401716]               \|/ ____ \|/
      [   61.401716]               "@'/ .. \`@"
      [   61.401716]               /_| \__/ |_\
      [   61.401716]                  \__U_/
      [   61.416362] swapper/0(0): Oops [#1]
      [   61.419837] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.18.0-rc1-00422-g2cc91884-dirty #24
      [   61.427975] task: fff000b0fd8e9c40 ti: fff000b0fd928000 task.ti: fff000b0fd928000
      [   61.435426] TSTATE: 0000004480e01602 TPC: 00000000004455e4 TNPC: 00000000004455e8 Y: 00000000    Not tainted
      [   61.445230] TPC: <schizo_pcierr_intr+0x104/0x560>
      [   61.449897] g0: 0000000000000000 g1: 0000000000000000 g2: 0000000000a10f78 g3: 000000000000000a
      [   61.458563] g4: fff000b0fd8e9c40 g5: fff000b0fdd82000 g6: fff000b0fd928000 g7: 000000000000000a
      [   61.467229] o0: 000000000000003d o1: 0000000000000000 o2: 0000000000000006 o3: fff000b0ffa5fc7e
      [   61.475894] o4: 0000000000060000 o5: c000000000000000 sp: fff000b0ffa5f3c1 ret_pc: 00000000004455cc
      [   61.484909] RPC: <schizo_pcierr_intr+0xec/0x560>
      [   61.489500] l0: fff000b0fd8e9c40 l1: 0000000000a20800 l2: 0000000000000000 l3: 000000000119a430
      [   61.498164] l4: 0000000001742400 l5: 00000000011cfbe0 l6: 00000000011319c0 l7: fff000b0fd8ea348
      [   61.506830] i0: 0000000000000000 i1: fff000b0fdb34000 i2: 0000000320000000 i3: 0000000000000000
      [   61.515497] i4: 00060002010b003f i5: 0000040004e02000 i6: fff000b0ffa5f481 i7: 00000000004a9920
      [   61.524175] I7: <handle_irq_event_percpu+0x40/0x140>
      [   61.529099] Call Trace:
      [   61.531531]  [00000000004a9920] handle_irq_event_percpu+0x40/0x140
      [   61.537681]  [00000000004a9a58] handle_irq_event+0x38/0x80
      [   61.543145]  [00000000004ac77c] handle_fasteoi_irq+0xbc/0x200
      [   61.548860]  [00000000004a9084] generic_handle_irq+0x24/0x40
      [   61.554500]  [000000000042be0c] handler_irq+0xac/0x100
      ====================
      
      The problem is that pbm->pci_bus->self is NULL.
      
      This code is trying to go through the standard PCI config space
      interfaces to read the PCI controller's PCI_STATUS register.
      
      This doesn't work, because we more often than not do not enumerate
      the PCI controller as a bonafide PCI device during the OF device
      node scan.  Therefore bus->self remains NULL.
      
      Existing common code for PSYCHO and PSYCHO-like PCI controllers
      handles this properly, by doing the config space access directly.
      
      Do the same here, pbm->pci_ops->{read,write}().
      Reported-by: default avatarMeelis Roos <mroos@linux.ee>
      Tested-by: default avatarMeelis Roos <mroos@linux.ee>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b51182e6
    • Dwight Engen's avatar
      sunvdc: don't call VD_OP_GET_VTOC · 3698c493
      Dwight Engen authored
      [ Upstream commit 85b0c6e6 ]
      
      The VD_OP_GET_VTOC operation will succeed only if the vdisk backend has a
      VTOC label, otherwise it will fail. In particular, it will return error
      48 (ENOTSUP) if the disk has an EFI label. VTOC disk labels are already
      handled by directly reading the disk in block/partitions/sun.c (enabled by
      CONFIG_SUN_PARTITION which defaults to y on SPARC). Since port->label is
      unused in the driver, remove the call and the field.
      Signed-off-by: default avatarDwight Engen <dwight.engen@oracle.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3698c493
    • Dwight Engen's avatar
      vio: fix reuse of vio_dring slot · 89f94e26
      Dwight Engen authored
      [ Upstream commit d0aedcd4 ]
      
      vio_dring_avail() will allow use of every dring entry, but when the last
      entry is allocated then dr->prod == dr->cons which is indistinguishable from
      the ring empty condition. This causes the next allocation to reuse an entry.
      When this happens in sunvdc, the server side vds driver begins nack'ing the
      messages and ends up resetting the ldc channel. This problem does not effect
      sunvnet since it checks for < 2.
      
      The fix here is to just never allocate the very last dring slot so that full
      and empty are not the same condition. The request start path was changed to
      check for the ring being full a bit earlier, and to stop the blk_queue if
      there is no space left. The blk_queue will be restarted once the ring is
      only half full again. The number of ring entries was increased to 512 which
      matches the sunvnet and Solaris vdc drivers, and greatly reduces the
      frequency of hitting the ring full condition and the associated blk_queue
      stop/starting. The checks in sunvent were adjusted to account for
      vio_dring_avail() returning 1 less.
      
      Orabug: 19441666
      OraBZ: 14983
      Signed-off-by: default avatarDwight Engen <dwight.engen@oracle.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      89f94e26
    • Dwight Engen's avatar
      sunvdc: limit each sg segment to a page · 42f107f9
      Dwight Engen authored
      [ Upstream commit 5eed69ff ]
      
      ldc_map_sg() could fail its check that the number of pages referred to
      by the sg scatterlist was <= the number of cookies.
      
      This fixes the issue by doing a similar thing to the xen-blkfront driver,
      ensuring that the scatterlist will only ever contain a segment count <=
      port->ring_cookies, and each segment will be page aligned, and <= page
      size. This ensures that the scatterlist is always mappable.
      
      Orabug: 19347817
      OraBZ: 15945
      Signed-off-by: default avatarDwight Engen <dwight.engen@oracle.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      42f107f9
    • Allen Pais's avatar
      sunvdc: compute vdisk geometry from capacity · b3c23e4a
      Allen Pais authored
      [ Upstream commit de5b73f0 ]
      
      The LDom diskserver doesn't return reliable geometry data. In addition,
      the types for all fields in the vio_disk_geom are u16, which were being
      truncated in the cast into the u8's of the Linux struct hd_geometry.
      
      Modify vdc_getgeo() to compute the geometry from the disk's capacity in a
      manner consistent with xen-blkfront::blkif_getgeo().
      Signed-off-by: default avatarDwight Engen <dwight.engen@oracle.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b3c23e4a
    • Allen Pais's avatar
      sunvdc: add cdrom and v1.1 protocol support · caa0a8a8
      Allen Pais authored
      [ Upstream commit 9bce2182 ]
      
      Interpret the media type from v1.1 protocol to support CDROM/DVD.
      
      For v1.0 protocol, a disk's size continues to be calculated from the
      geometry returned by the vdisk server. The geometry returned by the server
      can be less than the actual number of sectors available in the backing
      image/device due to the rounding in the division used to compute the
      geometry in the vdisk server.
      
      In v1.1 protocol a disk's actual size in sectors is returned during the
      handshake. Use this size when v1.1 protocol is negotiated. Since this size
      will always be larger than the former geometry computed size, disks created
      under v1.0 will be forwards compatible to v1.1, but not vice versa.
      Signed-off-by: default avatarDwight Engen <dwight.engen@oracle.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      caa0a8a8
    • Enric Balletbo i Serra's avatar
      smsc911x: power-up phydev before doing a software reset. · fa4f20e2
      Enric Balletbo i Serra authored
      [ Upstream commit ccf899a2 ]
      
      With commit be9dad1f ("net: phy: suspend phydev when going
      to HALTED"), the PHY device will be put in a low-power mode using
      BMCR_PDOWN if the the interface is set down. The smsc911x driver does
      a software_reset opening the device driver (ndo_open). In such case,
      the PHY must be powered-up before access to any register and before
      calling the software_reset function. Otherwise, as the PHY is powered
      down the software reset fails and the interface can not be enabled
      again.
      
      This patch fixes this scenario that is easy to reproduce setting down
      the network interface and setting up again.
      
          $ ifconfig eth0 down
          $ ifconfig eth0 up
          ifconfig: SIOCSIFFLAGS: Input/output error
      Signed-off-by: default avatarEnric Balletbo i Serra <eballetbo@iseebcn.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fa4f20e2
    • Daniel Borkmann's avatar
      net: sctp: fix memory leak in auth key management · f58ee885
      Daniel Borkmann authored
      [ Upstream commit 4184b2a7 ]
      
      A very minimal and simple user space application allocating an SCTP
      socket, setting SCTP_AUTH_KEY setsockopt(2) on it and then closing
      the socket again will leak the memory containing the authentication
      key from user space:
      
      unreferenced object 0xffff8800837047c0 (size 16):
        comm "a.out", pid 2789, jiffies 4296954322 (age 192.258s)
        hex dump (first 16 bytes):
          01 00 00 00 04 00 00 00 00 00 00 00 00 00 00 00  ................
        backtrace:
          [<ffffffff816d7e8e>] kmemleak_alloc+0x4e/0xb0
          [<ffffffff811c88d8>] __kmalloc+0xe8/0x270
          [<ffffffffa0870c23>] sctp_auth_create_key+0x23/0x50 [sctp]
          [<ffffffffa08718b1>] sctp_auth_set_key+0xa1/0x140 [sctp]
          [<ffffffffa086b383>] sctp_setsockopt+0xd03/0x1180 [sctp]
          [<ffffffff815bfd94>] sock_common_setsockopt+0x14/0x20
          [<ffffffff815beb61>] SyS_setsockopt+0x71/0xd0
          [<ffffffff816e58a9>] system_call_fastpath+0x12/0x17
          [<ffffffffffffffff>] 0xffffffffffffffff
      
      This is bad because of two things, we can bring down a machine from
      user space when auth_enable=1, but also we would leave security sensitive
      keying material in memory without clearing it after use. The issue is
      that sctp_auth_create_key() already sets the refcount to 1, but after
      allocation sctp_auth_set_key() does an additional refcount on it, and
      thus leaving it around when we free the socket.
      
      Fixes: 65b07e5d ("[SCTP]: API updates to suport SCTP-AUTH extensions.")
      Signed-off-by: default avatarDaniel Borkmann <dborkman@redhat.com>
      Cc: Vlad Yasevich <vyasevich@gmail.com>
      Acked-by: default avatarNeil Horman <nhorman@tuxdriver.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f58ee885
    • Daniel Borkmann's avatar
      net: sctp: fix NULL pointer dereference in af->from_addr_param on malformed packet · 35890526
      Daniel Borkmann authored
      [ Upstream commit e40607cb ]
      
      An SCTP server doing ASCONF will panic on malformed INIT ping-of-death
      in the form of:
      
        ------------ INIT[PARAM: SET_PRIMARY_IP] ------------>
      
      While the INIT chunk parameter verification dissects through many things
      in order to detect malformed input, it misses to actually check parameters
      inside of parameters. E.g. RFC5061, section 4.2.4 proposes a 'set primary
      IP address' parameter in ASCONF, which has as a subparameter an address
      parameter.
      
      So an attacker may send a parameter type other than SCTP_PARAM_IPV4_ADDRESS
      or SCTP_PARAM_IPV6_ADDRESS, param_type2af() will subsequently return 0
      and thus sctp_get_af_specific() returns NULL, too, which we then happily
      dereference unconditionally through af->from_addr_param().
      
      The trace for the log:
      
      BUG: unable to handle kernel NULL pointer dereference at 0000000000000078
      IP: [<ffffffffa01e9c62>] sctp_process_init+0x492/0x990 [sctp]
      PGD 0
      Oops: 0000 [#1] SMP
      [...]
      Pid: 0, comm: swapper Not tainted 2.6.32-504.el6.x86_64 #1 Bochs Bochs
      RIP: 0010:[<ffffffffa01e9c62>]  [<ffffffffa01e9c62>] sctp_process_init+0x492/0x990 [sctp]
      [...]
      Call Trace:
       <IRQ>
       [<ffffffffa01f2add>] ? sctp_bind_addr_copy+0x5d/0xe0 [sctp]
       [<ffffffffa01e1fcb>] sctp_sf_do_5_1B_init+0x21b/0x340 [sctp]
       [<ffffffffa01e3751>] sctp_do_sm+0x71/0x1210 [sctp]
       [<ffffffffa01e5c09>] ? sctp_endpoint_lookup_assoc+0xc9/0xf0 [sctp]
       [<ffffffffa01e61f6>] sctp_endpoint_bh_rcv+0x116/0x230 [sctp]
       [<ffffffffa01ee986>] sctp_inq_push+0x56/0x80 [sctp]
       [<ffffffffa01fcc42>] sctp_rcv+0x982/0xa10 [sctp]
       [<ffffffffa01d5123>] ? ipt_local_in_hook+0x23/0x28 [iptable_filter]
       [<ffffffff8148bdc9>] ? nf_iterate+0x69/0xb0
       [<ffffffff81496d10>] ? ip_local_deliver_finish+0x0/0x2d0
       [<ffffffff8148bf86>] ? nf_hook_slow+0x76/0x120
       [<ffffffff81496d10>] ? ip_local_deliver_finish+0x0/0x2d0
      [...]
      
      A minimal way to address this is to check for NULL as we do on all
      other such occasions where we know sctp_get_af_specific() could
      possibly return with NULL.
      
      Fixes: d6de3097 ("[SCTP]: Add the handling of "Set Primary IP Address" parameter to INIT")
      Signed-off-by: default avatarDaniel Borkmann <dborkman@redhat.com>
      Cc: Vlad Yasevich <vyasevich@gmail.com>
      Acked-by: default avatarNeil Horman <nhorman@tuxdriver.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      35890526
    • Marcelo Leitner's avatar
      vxlan: Do not reuse sockets for a different address family · b101a7ae
      Marcelo Leitner authored
      [ Upstream commit 19ca9fc1 ]
      
      Currently, we only match against local port number in order to reuse
      socket. But if this new vxlan wants an IPv6 socket and a IPv4 one bound
      to that port, vxlan will reuse an IPv4 socket as IPv6 and a panic will
      follow. The following steps reproduce it:
      
         # ip link add vxlan6 type vxlan id 42 group 229.10.10.10 \
             srcport 5000 6000 dev eth0
         # ip link add vxlan7 type vxlan id 43 group ff0e::110 \
             srcport 5000 6000 dev eth0
         # ip link set vxlan6 up
         # ip link set vxlan7 up
         <panic>
      
      [    4.187481] BUG: unable to handle kernel NULL pointer dereference at 0000000000000058
      ...
      [    4.188076] Call Trace:
      [    4.188085]  [<ffffffff81667c4a>] ? ipv6_sock_mc_join+0x3a/0x630
      [    4.188098]  [<ffffffffa05a6ad6>] vxlan_igmp_join+0x66/0xd0 [vxlan]
      [    4.188113]  [<ffffffff810a3430>] process_one_work+0x220/0x710
      [    4.188125]  [<ffffffff810a33c4>] ? process_one_work+0x1b4/0x710
      [    4.188138]  [<ffffffff810a3a3b>] worker_thread+0x11b/0x3a0
      [    4.188149]  [<ffffffff810a3920>] ? process_one_work+0x710/0x710
      
      So address family must also match in order to reuse a socket.
      Reported-by: default avatarJean-Tsung Hsiao <jhsiao@redhat.com>
      Signed-off-by: default avatarMarcelo Ricardo Leitner <mleitner@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b101a7ae
    • Steffen Klassert's avatar
      gre6: Move the setting of dev->iflink into the ndo_init functions. · 4dd750b4
      Steffen Klassert authored
      [ Upstream commit f03eb128 ]
      
      Otherwise it gets overwritten by register_netdev().
      Signed-off-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4dd750b4
    • Steffen Klassert's avatar
      sit: Use ipip6_tunnel_init as the ndo_init function. · 6dfa82b4
      Steffen Klassert authored
      [ Upstream commit ebe084aa ]
      
      ipip6_tunnel_init() sets the dev->iflink via a call to
      ipip6_tunnel_bind_dev(). After that, register_netdevice()
      sets dev->iflink = -1. So we loose the iflink configuration
      for ipv6 tunnels. Fix this by using ipip6_tunnel_init() as the
      ndo_init function. Then ipip6_tunnel_init() is called after
      dev->iflink is set to -1 from register_netdevice().
      Signed-off-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6dfa82b4
    • Steffen Klassert's avatar
      vti6: Use vti6_dev_init as the ndo_init function. · 466f1a5f
      Steffen Klassert authored
      [ Upstream commit 16a0231b ]
      
      vti6_dev_init() sets the dev->iflink via a call to
      vti6_link_config(). After that, register_netdevice()
      sets dev->iflink = -1. So we loose the iflink configuration
      for vti6 tunnels. Fix this by using vti6_dev_init() as the
      ndo_init function. Then vti6_dev_init() is called after
      dev->iflink is set to -1 from register_netdevice().
      Signed-off-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      466f1a5f
    • Steffen Klassert's avatar
      ip6_tunnel: Use ip6_tnl_dev_init as the ndo_init function. · ba4ac5f9
      Steffen Klassert authored
      [ Upstream commit 6c6151da ]
      
      ip6_tnl_dev_init() sets the dev->iflink via a call to
      ip6_tnl_link_config(). After that, register_netdevice()
      sets dev->iflink = -1. So we loose the iflink configuration
      for ipv6 tunnels. Fix this by using ip6_tnl_dev_init() as the
      ndo_init function. Then ip6_tnl_dev_init() is called after
      dev->iflink is set to -1 from register_netdevice().
      Signed-off-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ba4ac5f9
    • Greg Kroah-Hartman's avatar
      Revert "drivers/net: Disable UFO through virtio" · 41e88110
      Greg Kroah-Hartman authored
      This reverts commit 2b52d6c6 which was
      commit 3d0ad094 upstream.
      
      Ben writes:
      
      	Please drop this patch for 3.14 and 3.17.  It causes problems
      	for migration of VMs and we're probably going to revert part of
      	this.  The following patch ("drivers/net, ipv6: Select IPv6
      	fragment idents for virtio UFO packets") might no longer apply,
      	in which case you can drop that as well until we have this
      	sorted out upstream.
      
      Cc: Ben Hutchings <ben@decadent.org.uk>
      Cc: David S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      41e88110
  2. 14 Nov, 2014 5 commits
    • Greg Kroah-Hartman's avatar
      Linux 3.14.24 · 9c3da881
      Greg Kroah-Hartman authored
      9c3da881
    • Johannes Weiner's avatar
      mm: page_alloc: fix zone allocation fairness on UP · 6619741f
      Johannes Weiner authored
      commit abe5f972 upstream.
      
      The zone allocation batches can easily underflow due to higher-order
      allocations or spills to remote nodes.  On SMP that's fine, because
      underflows are expected from concurrency and dealt with by returning 0.
      But on UP, zone_page_state will just return a wrapped unsigned long,
      which will get past the <= 0 check and then consider the zone eligible
      until its watermarks are hit.
      
      Commit 3a025760 ("mm: page_alloc: spill to remote nodes before
      waking kswapd") already made the counter-resetting use
      atomic_long_read() to accomodate underflows from remote spills, but it
      didn't go all the way with it.
      
      Make it clear that these batches are expected to go negative regardless
      of concurrency, and use atomic_long_read() everywhere.
      
      Fixes: 81c0a2bb ("mm: page_alloc: fair zone allocator policy")
      Reported-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Reported-by: default avatarLeon Romanovsky <leon@leon.nu>
      Signed-off-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
      Acked-by: default avatarMel Gorman <mgorman@suse.de>
      Cc: <stable@vger.kernel.org>	[3.12+]
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6619741f
    • Chris Mason's avatar
      Btrfs: fix kfree on list_head in btrfs_lookup_csums_range error cleanup · 7adcd472
      Chris Mason authored
      commit 6e5aafb2 upstream.
      
      If we hit any errors in btrfs_lookup_csums_range, we'll loop through all
      the csums we allocate and free them.  But the code was using list_entry
      incorrectly, and ended up trying to free the on-stack list_head instead.
      
      This bug came from commit 0678b618
      
      btrfs: Don't BUG_ON kzalloc error in btrfs_lookup_csums_range()
      Signed-off-by: default avatarChris Mason <clm@fb.com>
      Reported-by: default avatarErik Berg <btrfs@slipsprogrammoer.no>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7adcd472
    • Grant Likely's avatar
      of: Fix overflow bug in string property parsing functions · 09b6f88e
      Grant Likely authored
      commit a87fa1d8 upstream.
      
      The string property read helpers will run off the end of the buffer if
      it is handed a malformed string property. Rework the parsers to make
      sure that doesn't happen. At the same time add new test cases to make
      sure the functions behave themselves.
      
      The original implementations of of_property_read_string_index() and
      of_property_count_strings() both open-coded the same block of parsing
      code, each with it's own subtly different bugs. The fix here merges
      functions into a single helper and makes the original functions static
      inline wrappers around the helper.
      
      One non-bugfix aspect of this patch is the addition of a new wrapper,
      of_property_read_string_array(). The new wrapper is needed by the
      device_properties feature that Rafael is working on and planning to
      merge for v3.19. The implementation is identical both with and without
      the new static inline wrapper, so it just got left in to reduce the
      churn on the header file.
      Signed-off-by: default avatarGrant Likely <grant.likely@linaro.org>
      Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
      Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Darren Hart <darren.hart@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      09b6f88e
    • Yijing Wang's avatar
      sysfs: driver core: Fix glue dir race condition by gdp_mutex · 09a30e59
      Yijing Wang authored
      commit e4a60d13 upstream.
      
      There is a race condition when removing glue directory.
      It can be reproduced in following test:
      
      path 1: Add first child device
      device_add()
          get_device_parent()
                  /*find parent from glue_dirs.list*/
                  list_for_each_entry(k, &dev->class->p->glue_dirs.list, entry)
                          if (k->parent == parent_kobj) {
                                  kobj = kobject_get(k);
                                  break;
                          }
                  ....
                  class_dir_create_and_add()
      
      path2: Remove last child device under glue dir
      device_del()
          cleanup_device_parent()
                  cleanup_glue_dir()
                          kobject_put(glue_dir);
      
      If path2 has been called cleanup_glue_dir(), but not
      call kobject_put(glue_dir), the glue dir is still
      in parent's kset list. Meanwhile, path1 find the glue
      dir from the glue_dirs.list. Path2 may release glue dir
      before path1 call kobject_get(). So kernel will report
      the warning and bug_on.
      
      This is a "classic" problem we have of a kref in a list
      that can be found while the last instance could be removed
      at the same time.
      
      This patch reuse gdp_mutex to fix this race condition.
      
      The following calltrace is captured in kernel 3.4, but
      the latest kernel still has this bug.
      
      -----------------------------------------------------
      <4>[ 3965.441471] WARNING: at ...include/linux/kref.h:41 kobject_get+0x33/0x40()
      <4>[ 3965.441474] Hardware name: Romley
      <4>[ 3965.441475] Modules linked in: isd_iop(O) isd_xda(O)...
      ...
      <4>[ 3965.441605] Call Trace:
      <4>[ 3965.441611]  [<ffffffff8103717a>] warn_slowpath_common+0x7a/0xb0
      <4>[ 3965.441615]  [<ffffffff810371c5>] warn_slowpath_null+0x15/0x20
      <4>[ 3965.441618]  [<ffffffff81215963>] kobject_get+0x33/0x40
      <4>[ 3965.441624]  [<ffffffff812d1e45>] get_device_parent.isra.11+0x135/0x1f0
      <4>[ 3965.441627]  [<ffffffff812d22d4>] device_add+0xd4/0x6d0
      <4>[ 3965.441631]  [<ffffffff812d0dbc>] ? dev_set_name+0x3c/0x40
      ....
      <2>[ 3965.441912] kernel BUG at ..../fs/sysfs/group.c:65!
      <4>[ 3965.441915] invalid opcode: 0000 [#1] SMP
      ...
      <4>[ 3965.686743]  [<ffffffff811a677e>] sysfs_create_group+0xe/0x10
      <4>[ 3965.686748]  [<ffffffff810cfb04>] blk_trace_init_sysfs+0x14/0x20
      <4>[ 3965.686753]  [<ffffffff811fcabb>] blk_register_queue+0x3b/0x120
      <4>[ 3965.686756]  [<ffffffff812030bc>] add_disk+0x1cc/0x490
      ....
      -------------------------------------------------------
      Signed-off-by: default avatarYijing Wang <wangyijing@huawei.com>
      Signed-off-by: default avatarWeng Meiling <wengmeiling.weng@huawei.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      09a30e59