1. 07 Oct, 2012 40 commits
    • Wang YanQing's avatar
      video:uvesafb: Fix oops that uvesafb try to execute NX-protected page · a6f5fd97
      Wang YanQing authored
      commit b78f29ca upstream.
      
      This patch fix the oops below that catched in my machine
      
      [   81.560602] uvesafb: NVIDIA Corporation, GT216 Board - 0696a290, Chip Rev   , OEM: NVIDIA, VBE v3.0
      [   81.609384] uvesafb: protected mode interface info at c000:d350
      [   81.609388] uvesafb: pmi: set display start = c00cd3b3, set palette = c00cd40e
      [   81.609390] uvesafb: pmi: ports = 3b4 3b5 3ba 3c0 3c1 3c4 3c5 3c6 3c7 3c8 3c9 3cc 3ce 3cf 3d0 3d1 3d2 3d3 3d4 3d5 3da
      [   81.614558] uvesafb: VBIOS/hardware doesn't support DDC transfers
      [   81.614562] uvesafb: no monitor limits have been set, default refresh rate will be used
      [   81.614994] uvesafb: scrolling: ypan using protected mode interface, yres_virtual=4915
      [   81.744147] kernel tried to execute NX-protected page - exploit attempt? (uid: 0)
      [   81.744153] BUG: unable to handle kernel paging request at c00cd3b3
      [   81.744159] IP: [<c00cd3b3>] 0xc00cd3b2
      [   81.744167] *pdpt = 00000000016d6001 *pde = 0000000001c7b067 *pte = 80000000000cd163
      [   81.744171] Oops: 0011 [#1] SMP
      [   81.744174] Modules linked in: uvesafb(+) cfbcopyarea cfbimgblt cfbfillrect
      [   81.744178]
      [   81.744181] Pid: 3497, comm: modprobe Not tainted 3.3.0-rc4NX+ #71 Acer            Aspire 4741                    /Aspire 4741
      [   81.744185] EIP: 0060:[<c00cd3b3>] EFLAGS: 00010246 CPU: 0
      [   81.744187] EIP is at 0xc00cd3b3
      [   81.744189] EAX: 00004f07 EBX: 00000000 ECX: 00000000 EDX: 00000000
      [   81.744191] ESI: f763f000 EDI: f763f6e8 EBP: f57f3a0c ESP: f57f3a00
      [   81.744192]  DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
      [   81.744195] Process modprobe (pid: 3497, ti=f57f2000 task=f748c600 task.ti=f57f2000)
      [   81.744196] Stack:
      [   81.744197]  f82512c5 f759341c 00000000 f57f3a30 c124a9bc 00000001 00000001 000001e0
      [   81.744202]  f8251280 f763f000 f7593400 00000000 f57f3a40 c12598dd f5c0c000 00000000
      [   81.744206]  f57f3b10 c1255efe c125a21a 00000006 f763f09c 00000000 c1c6cb60 f7593400
      [   81.744210] Call Trace:
      [   81.744215]  [<f82512c5>] ? uvesafb_pan_display+0x45/0x60 [uvesafb]
      [   81.744222]  [<c124a9bc>] fb_pan_display+0x10c/0x160
      [   81.744226]  [<f8251280>] ? uvesafb_vbe_find_mode+0x180/0x180 [uvesafb]
      [   81.744230]  [<c12598dd>] bit_update_start+0x1d/0x50
      [   81.744232]  [<c1255efe>] fbcon_switch+0x39e/0x550
      [   81.744235]  [<c125a21a>] ? bit_cursor+0x4ea/0x560
      [   81.744240]  [<c129b6cb>] redraw_screen+0x12b/0x220
      [   81.744245]  [<c128843b>] ? tty_do_resize+0x3b/0xc0
      [   81.744247]  [<c129ef42>] vc_do_resize+0x3d2/0x3e0
      [   81.744250]  [<c129efb4>] vc_resize+0x14/0x20
      [   81.744253]  [<c12586bd>] fbcon_init+0x29d/0x500
      [   81.744255]  [<c12984c4>] ? set_inverse_trans_unicode+0xe4/0x110
      [   81.744258]  [<c129b378>] visual_init+0xb8/0x150
      [   81.744261]  [<c129c16c>] bind_con_driver+0x16c/0x360
      [   81.744264]  [<c129b47e>] ? register_con_driver+0x6e/0x190
      [   81.744267]  [<c129c3a1>] take_over_console+0x41/0x50
      [   81.744269]  [<c1257b7a>] fbcon_takeover+0x6a/0xd0
      [   81.744272]  [<c12594b8>] fbcon_event_notify+0x758/0x790
      [   81.744277]  [<c10929e2>] notifier_call_chain+0x42/0xb0
      [   81.744280]  [<c1092d30>] __blocking_notifier_call_chain+0x60/0x90
      [   81.744283]  [<c1092d7a>] blocking_notifier_call_chain+0x1a/0x20
      [   81.744285]  [<c124a5a1>] fb_notifier_call_chain+0x11/0x20
      [   81.744288]  [<c124b759>] register_framebuffer+0x1d9/0x2b0
      [   81.744293]  [<c1061c73>] ? ioremap_wc+0x33/0x40
      [   81.744298]  [<f82537c6>] uvesafb_probe+0xaba/0xc40 [uvesafb]
      [   81.744302]  [<c12bb81f>] platform_drv_probe+0xf/0x20
      [   81.744306]  [<c12ba558>] driver_probe_device+0x68/0x170
      [   81.744309]  [<c12ba731>] __device_attach+0x41/0x50
      [   81.744313]  [<c12b9088>] bus_for_each_drv+0x48/0x70
      [   81.744316]  [<c12ba7f3>] device_attach+0x83/0xa0
      [   81.744319]  [<c12ba6f0>] ? __driver_attach+0x90/0x90
      [   81.744321]  [<c12b991f>] bus_probe_device+0x6f/0x90
      [   81.744324]  [<c12b8a45>] device_add+0x5e5/0x680
      [   81.744329]  [<c122a1a3>] ? kvasprintf+0x43/0x60
      [   81.744332]  [<c121e6e4>] ? kobject_set_name_vargs+0x64/0x70
      [   81.744335]  [<c121e6e4>] ? kobject_set_name_vargs+0x64/0x70
      [   81.744339]  [<c12bbe9f>] platform_device_add+0xff/0x1b0
      [   81.744343]  [<f8252906>] uvesafb_init+0x50/0x9b [uvesafb]
      [   81.744346]  [<c100111f>] do_one_initcall+0x2f/0x170
      [   81.744350]  [<f82528b6>] ? uvesafb_is_valid_mode+0x66/0x66 [uvesafb]
      [   81.744355]  [<c10c6994>] sys_init_module+0xf4/0x1410
      [   81.744359]  [<c1157fc0>] ? vfsmount_lock_local_unlock_cpu+0x30/0x30
      [   81.744363]  [<c144cb10>] sysenter_do_call+0x12/0x36
      [   81.744365] Code: f5 00 00 00 32 f6 66 8b da 66 d1 e3 66 ba d4 03 8a e3 b0 1c 66 ef b0 1e 66 ef 8a e7 b0 1d 66 ef b0 1f 66 ef e8 fa 00 00 00 61 c3 <60> e8 c8 00 00 00 66 8b f3 66 8b da 66 ba d4 03 b0 0c 8a e5 66
      [   81.744388] EIP: [<c00cd3b3>] 0xc00cd3b3 SS:ESP 0068:f57f3a00
      [   81.744391] CR2: 00000000c00cd3b3
      [   81.744393] ---[ end trace 18b2c87c925b54d6 ]---
      Signed-off-by: default avatarWang YanQing <udknight@gmail.com>
      Cc: Michal Januszewski <spock@gentoo.org>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Signed-off-by: default avatarFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      a6f5fd97
    • David S. Miller's avatar
      sparc64: Fix bootup crash on sun4v. · 4c5a5473
      David S. Miller authored
      commit 9e0daff3 upstream.
      
      The DS driver registers as a subsys_initcall() but this can be too
      early, in particular this risks registering before we've had a chance
      to allocate and setup module_kset in kernel/params.c which is
      performed also as a subsyts_initcall().
      
      Register DS using device_initcall() insteal.
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      4c5a5473
    • Johan Hovold's avatar
      Bluetooth: hci_ldisc: fix NULL-pointer dereference on tty_close · 9a603990
      Johan Hovold authored
      commit 33b69bf8 upstream.
      
      Do not close protocol driver until device has been unregistered.
      
      This fixes a race between tty_close and hci_dev_open which can result in
      a NULL-pointer dereference.
      
      The line discipline closes the protocol driver while we may still have
      hci_dev_open sleeping on the req_lock mutex resulting in a NULL-pointer
      dereference when lock is acquired and hci_init_req called.
      
      Bug is 100% reproducible using hciattach and a disconnected serial port:
      
      0. # hciattach -n ttyO1 any noflow
      
      1. hci_dev_open called from hci_power_on grabs req lock
      2. hci_init_req executes but device fails to initialise (times out
         eventually)
      3. hci_dev_open is called from hci_sock_ioctl and sleeps on req lock
      4. hci_uart_tty_close detaches protocol driver and cancels init req
      5. hci_dev_open (1) releases req lock
      6. hci_dev_open (3) grabs req lock, calls hci_init_req, which triggers oops
         when request is prepared in hci_uart_send_frame
      
      [  137.201263] Unable to handle kernel NULL pointer dereference at virtual address 00000028
      [  137.209838] pgd = c0004000
      [  137.212677] [00000028] *pgd=00000000
      [  137.216430] Internal error: Oops: 17 [#1]
      [  137.220642] Modules linked in:
      [  137.223846] CPU: 0    Tainted: G        W     (3.3.0-rc6-dirty #406)
      [  137.230529] PC is at __lock_acquire+0x5c/0x1ab0
      [  137.235290] LR is at lock_acquire+0x9c/0x128
      [  137.239776] pc : [<c0071490>]    lr : [<c00733f8>]    psr: 20000093
      [  137.239776] sp : cf869dd8  ip : c0529554  fp : c051c730
      [  137.251800] r10: 00000000  r9 : cf8673c0  r8 : 00000080
      [  137.257293] r7 : 00000028  r6 : 00000002  r5 : 00000000  r4 : c053fd70
      [  137.264129] r3 : 00000000  r2 : 00000000  r1 : 00000000  r0 : 00000001
      [  137.270965] Flags: nzCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
      [  137.278717] Control: 10c5387d  Table: 8f0f4019  DAC: 00000015
      [  137.284729] Process kworker/u:1 (pid: 7, stack limit = 0xcf8682e8)
      [  137.291229] Stack: (0xcf869dd8 to 0xcf86a000)
      [  137.295776] 9dc0:                                                       c0529554 00000000
      [  137.304351] 9de0: cf8673c0 cf868000 d03ea1ef cf868000 000001ef 00000470 00000000 00000002
      [  137.312927] 9e00: cf8673c0 00000001 c051c730 c00716ec 0000000c 00000440 c0529554 00000001
      [  137.321533] 9e20: c051c730 cf868000 d03ea1f3 00000000 c053b978 00000000 00000028 cf868000
      [  137.330078] 9e40: 00000000 00000000 00000002 00000000 00000000 c00733f8 00000002 00000080
      [  137.338684] 9e60: 00000000 c02a1d50 00000000 00000001 60000013 c0969a1c 60000093 c053b96c
      [  137.347259] 9e80: 00000002 00000018 20000013 c02a1d50 cf0ac000 00000000 00000002 cf868000
      [  137.355834] 9ea0: 00000089 c0374130 00000002 00000000 c02a1d50 cf0ac000 0000000c cf0fc540
      [  137.364410] 9ec0: 00000018 c02a1d50 cf0fc540 00000000 cf0fc540 c0282238 c028220c cf178d80
      [  137.372985] 9ee0: 127525d8 c02821cc 9a1fa451 c032727c 9a1fa451 127525d8 cf0fc540 cf0ac4ec
      [  137.381561] 9f00: cf0ac000 cf0fc540 cf0ac584 c03285f4 c0328580 cf0ac4ec cf85c740 c05510cc
      [  137.390136] 9f20: ce825400 c004c914 00000002 00000000 c004c884 ce8254f5 cf869f48 00000000
      [  137.398712] 9f40: c0328580 ce825415 c0a7f914 c061af64 00000000 c048cf3c cf8673c0 cf85c740
      [  137.407287] 9f60: c05510cc c051a66c c05510ec c05510c4 cf85c750 cf868000 00000089 c004d6ac
      [  137.415863] 9f80: 00000000 c0073d14 00000001 cf853ed8 cf85c740 c004d558 00000013 00000000
      [  137.424438] 9fa0: 00000000 00000000 00000000 c00516b0 00000000 00000000 cf85c740 00000000
      [  137.433013] 9fc0: 00000001 dead4ead ffffffff ffffffff c0551674 00000000 00000000 c0450aa4
      [  137.441589] 9fe0: cf869fe0 cf869fe0 cf853ed8 c005162c c0013b30 c0013b30 00ffff00 00ffff00
      [  137.450164] [<c0071490>] (__lock_acquire+0x5c/0x1ab0) from [<c00733f8>] (lock_acquire+0x9c/0x128)
      [  137.459503] [<c00733f8>] (lock_acquire+0x9c/0x128) from [<c0374130>] (_raw_spin_lock_irqsave+0x44/0x58)
      [  137.469360] [<c0374130>] (_raw_spin_lock_irqsave+0x44/0x58) from [<c02a1d50>] (skb_queue_tail+0x18/0x48)
      [  137.479339] [<c02a1d50>] (skb_queue_tail+0x18/0x48) from [<c0282238>] (h4_enqueue+0x2c/0x34)
      [  137.488189] [<c0282238>] (h4_enqueue+0x2c/0x34) from [<c02821cc>] (hci_uart_send_frame+0x34/0x68)
      [  137.497497] [<c02821cc>] (hci_uart_send_frame+0x34/0x68) from [<c032727c>] (hci_send_frame+0x50/0x88)
      [  137.507171] [<c032727c>] (hci_send_frame+0x50/0x88) from [<c03285f4>] (hci_cmd_work+0x74/0xd4)
      [  137.516204] [<c03285f4>] (hci_cmd_work+0x74/0xd4) from [<c004c914>] (process_one_work+0x1a0/0x4ec)
      [  137.525604] [<c004c914>] (process_one_work+0x1a0/0x4ec) from [<c004d6ac>] (worker_thread+0x154/0x344)
      [  137.535278] [<c004d6ac>] (worker_thread+0x154/0x344) from [<c00516b0>] (kthread+0x84/0x90)
      [  137.543975] [<c00516b0>] (kthread+0x84/0x90) from [<c0013b30>] (kernel_thread_exit+0x0/0x8)
      [  137.552734] Code: e59f4e5c e5941000 e3510000 0a000031 (e5971000)
      [  137.559234] ---[ end trace 1b75b31a2719ed1e ]---
      Signed-off-by: default avatarJohan Hovold <jhovold@gmail.com>
      Acked-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      9a603990
    • Jun Nie's avatar
      Bluetooth: add NULL pointer check in HCI · c74bc8b7
      Jun Nie authored
      commit d9319560 upstream.
      
      If we fail to find a hci device pointer in hci_uart, don't try
      to deref the NULL one we do have.
      Signed-off-by: default avatarJun Nie <njun@marvell.com>
      Signed-off-by: default avatarGustavo F. Padovan <padovan@profusion.mobi>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      c74bc8b7
    • Salman Qazi's avatar
      sched/x86: Fix overflow in cyc2ns_offset · ab81b6ab
      Salman Qazi authored
      commit 9993bc63 upstream.
      
      When a machine boots up, the TSC generally gets reset.  However,
      when kexec is used to boot into a kernel, the TSC value would be
      carried over from the previous kernel.  The computation of
      cycns_offset in set_cyc2ns_scale is prone to an overflow, if the
      machine has been up more than 208 days prior to the kexec.  The
      overflow happens when we multiply *scale, even though there is
      enough room to store the final answer.
      
      We fix this issue by decomposing tsc_now into the quotient and
      remainder of division by CYC2NS_SCALE_FACTOR and then performing
      the multiplication separately on the two components.
      
      Refactor code to share the calculation with the previous
      fix in __cycles_2_ns().
      Signed-off-by: default avatarSalman Qazi <sqazi@google.com>
      Acked-by: default avatarJohn Stultz <john.stultz@linaro.org>
      Acked-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Turner <pjt@google.com>
      Cc: john stultz <johnstul@us.ibm.com>
      Link: http://lkml.kernel.org/r/20120310004027.19291.88460.stgit@dungbeetle.mtv.corp.google.comSigned-off-by: default avatarIngo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      ab81b6ab
    • Dan Carpenter's avatar
      nfsd: don't allow zero length strings in cache_parse() · 0d1e8b82
      Dan Carpenter authored
      commit 6d8d1749 upstream.
      
      There is no point in passing a zero length string here and quite a
      few of that cache_parse() implementations will Oops if count is
      zero.
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      0d1e8b82
    • Jan Kara's avatar
      xfs: Fix oops on IO error during xlog_recover_process_iunlinks() · df2c6845
      Jan Kara authored
      commit d97d32ed upstream.
      
      When an IO error happens during inode deletion run from
      xlog_recover_process_iunlinks() filesystem gets shutdown. Thus any subsequent
      attempt to read buffers fails. Code in xlog_recover_process_iunlinks() does not
      count with the fact that read of a buffer which was read a while ago can
      really fail which results in the oops on
        agi = XFS_BUF_TO_AGI(agibp);
      
      Fix the problem by cleaning up the buffer handling in
      xlog_recover_process_iunlinks() as suggested by Dave Chinner. We release buffer
      lock but keep buffer reference to AG buffer. That is enough for buffer to stay
      pinned in memory and we don't have to call xfs_read_agi() all the time.
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
      Signed-off-by: default avatarBen Myers <bpm@sgi.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      df2c6845
    • Theodore Ts'o's avatar
      ext4: check for zero length extent · 2e3380e6
      Theodore Ts'o authored
      commit 31d4f3a2 upstream.
      
      Explicitly test for an extent whose length is zero, and flag that as a
      corrupted extent.
      
      This avoids a kernel BUG_ON assertion failure.
      
      Tested: Without this patch, the file system image found in
      tests/f_ext_zero_len/image.gz in the latest e2fsprogs sources causes a
      kernel panic.  With this patch, an ext4 file system error is noted
      instead, and the file system is marked as being corrupted.
      
      https://bugzilla.kernel.org/show_bug.cgi?id=42859Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      2e3380e6
    • Trond Myklebust's avatar
      SUNRPC: We must not use list_for_each_entry_safe() in rpc_wake_up() · df79b5ef
      Trond Myklebust authored
      commit 540a0f75 upstream.
      
      The problem is that for the case of priority queues, we
      have to assume that __rpc_remove_wait_queue_priority will move new
      elements from the tk_wait.links lists into the queue->tasks[] list.
      We therefore cannot use list_for_each_entry_safe() on queue->tasks[],
      since that will skip these new tasks that __rpc_remove_wait_queue_priority
      is adding.
      
      Without this fix, rpc_wake_up and rpc_wake_up_status will both fail
      to wake up all functions on priority wait queues, which can result
      in some nasty hangs.
      Reported-by: default avatarAndy Adamson <andros@netapp.com>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      df79b5ef
    • Sasha Levin's avatar
      ntp: Fix integer overflow when setting time · 58c37cca
      Sasha Levin authored
      commit a078c6d0 upstream.
      
      'long secs' is passed as divisor to div_s64, which accepts a 32bit
      divisor. On 64bit machines that value is trimmed back from 8 bytes
      back to 4, causing a divide by zero when the number is bigger than
      (1 << 32) - 1 and all 32 lower bits are 0.
      
      Use div64_long() instead.
      Signed-off-by: default avatarSasha Levin <levinsasha928@gmail.com>
      Cc: johnstul@us.ibm.com
      Link: http://lkml.kernel.org/r/1331829374-31543-2-git-send-email-levinsasha928@gmail.comSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      [WT: div64_long() does not exist on 2.6.32 and needs a deeper backport than
       desired. Instead, address the issue by controlling that the divisor is
       correct for use as an s32 divisor]
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      58c37cca
    • Greg Kroah-Hartman's avatar
      USB: ftdi_sio: fix problem when the manufacture is a NULL string · f12847e2
      Greg Kroah-Hartman authored
      commit 656d2b39 upstream.
      
      On some misconfigured ftdi_sio devices, if the manufacturer string is
      NULL, the kernel will oops when the device is plugged in.  This patch
      fixes the problem.
      Reported-by: default avatarWojciech M Zabolotny <W.Zabolotny@elka.pw.edu.pl>
      Tested-by: default avatarWojciech M Zabolotny <W.Zabolotny@elka.pw.edu.pl>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      f12847e2
    • Ryusuke Konishi's avatar
      nilfs2: fix NULL pointer dereference in nilfs_load_super_block() · 9d899d1f
      Ryusuke Konishi authored
      commit d7178c79 upstream.
      
      According to the report from Slicky Devil, nilfs caused kernel oops at
      nilfs_load_super_block function during mount after he shrank the
      partition without resizing the filesystem:
      
       BUG: unable to handle kernel NULL pointer dereference at 00000048
       IP: [<d0d7a08e>] nilfs_load_super_block+0x17e/0x280 [nilfs2]
       *pde = 00000000
       Oops: 0000 [#1] PREEMPT SMP
       ...
       Call Trace:
        [<d0d7a87b>] init_nilfs+0x4b/0x2e0 [nilfs2]
        [<d0d6f707>] nilfs_mount+0x447/0x5b0 [nilfs2]
        [<c0226636>] mount_fs+0x36/0x180
        [<c023d961>] vfs_kern_mount+0x51/0xa0
        [<c023ddae>] do_kern_mount+0x3e/0xe0
        [<c023f189>] do_mount+0x169/0x700
        [<c023fa9b>] sys_mount+0x6b/0xa0
        [<c04abd1f>] sysenter_do_call+0x12/0x28
       Code: 53 18 8b 43 20 89 4b 18 8b 4b 24 89 53 1c 89 43 24 89 4b 20 8b 43
       20 c7 43 2c 00 00 00 00 23 75 e8 8b 50 68 89 53 28 8b 54 b3 20 <8b> 72
       48 8b 7a 4c 8b 55 08 89 b3 84 00 00 00 89 bb 88 00 00 00
       EIP: [<d0d7a08e>] nilfs_load_super_block+0x17e/0x280 [nilfs2] SS:ESP 0068:ca9bbdcc
       CR2: 0000000000000048
      
      This turned out due to a defect in an error path which runs if the
      calculated location of the secondary super block was invalid.
      
      This patch fixes it and eliminates the reported oops.
      Reported-by: default avatarSlicky Devil <slicky.dvl@gmail.com>
      Signed-off-by: default avatarRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
      Tested-by: default avatarSlicky Devil <slicky.dvl@gmail.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>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      9d899d1f
    • Dan Carpenter's avatar
      block, sx8: fix pointer math issue getting fw version · 3aeff240
      Dan Carpenter authored
      commit ea5f4db8 upstream.
      
      "mem" is type u8.  We need parenthesis here or it screws up the pointer
      math probably leading to an oops.
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Acked-by: default avatarJeff Garzik <jgarzik@redhat.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      3aeff240
    • Eric Dumazet's avatar
      ipsec: be careful of non existing mac headers · d67f05eb
      Eric Dumazet authored
      [ Upstream commit 03606895 ]
      
      Niccolo Belli reported ipsec crashes in case we handle a frame without
      mac header (atm in his case)
      
      Before copying mac header, better make sure it is present.
      
      Bugzilla reference:  https://bugzilla.kernel.org/show_bug.cgi?id=42809Reported-by: default avatarNiccol Belli <darkbasic@linuxsystems.it>
      Tested-by: default avatarNiccol Belli <darkbasic@linuxsystems.it>
      Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      d67f05eb
    • Thomas Gleixner's avatar
      x86: Derandom delay_tsc for 64 bit · 3a40b4fe
      Thomas Gleixner authored
      commit a7f4255f upstream.
      
      Commit f0fbf0ab ("x86: integrate delay functions") converted
      delay_tsc() into a random delay generator for 64 bit.  The reason is
      that it merged the mostly identical versions of delay_32.c and
      delay_64.c.  Though the subtle difference of the result was:
      
       static void delay_tsc(unsigned long loops)
       {
      -	unsigned bclock, now;
      +	unsigned long bclock, now;
      
      Now the function uses rdtscl() which returns the lower 32bit of the
      TSC. On 32bit that's not problematic as unsigned long is 32bit. On 64
      bit this fails when the lower 32bit are close to wrap around when
      bclock is read, because the following check
      
             if ((now - bclock) >= loops)
             	  	break;
      
      evaluated to true on 64bit for e.g. bclock = 0xffffffff and now = 0
      because the unsigned long (now - bclock) of these values results in
      0xffffffff00000001 which is definitely larger than the loops
      value. That explains Tvortkos observation:
      
      "Because I am seeing udelay(500) (_occasionally_) being short, and
       that by delaying for some duration between 0us (yep) and 491us."
      
      Make those variables explicitely u32 again, so this works for both 32
      and 64 bit.
      Reported-by: default avatarTvrtko Ursulin <tvrtko.ursulin@onelan.co.uk>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      3a40b4fe
    • David S. Miller's avatar
      tcp: Don't change unlocked socket state in tcp_v4_err(). · 386ca3f0
      David S. Miller authored
      commit 8f49c270 upstream.
      
      Alexey Kuznetsov noticed a regression introduced by
      commit f1ecd5d9
      ("Revert Backoff [v3]: Revert RTO on ICMP destination unreachable")
      
      The RTO and timer modification code added to tcp_v4_err()
      doesn't check sock_owned_by_user(), which if true means we
      don't have exclusive access to the socket and therefore cannot
      modify it's critical state.
      
      Just skip this new code block if sock_owned_by_user() is true
      and eliminate the now superfluous sock_owned_by_user() code
      block contained within.
      Reported-by: default avatarAlexey Kuznetsov <kuznet@ms2.inr.ac.ru>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      CC: Damian Lukowski <damian@tvk.rwth-aachen.de>
      Acked-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
      Cc: Ben Hutchings <ben@decadent.org.uk>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      386ca3f0
    • Oleg Nesterov's avatar
      cred: copy_process() should clear child->replacement_session_keyring · 66174b0e
      Oleg Nesterov authored
      commit 79549c6d upstream
      
      keyctl_session_to_parent(task) sets ->replacement_session_keyring,
      it should be processed and cleared by key_replace_session_keyring().
      
      However, this task can fork before it notices TIF_NOTIFY_RESUME and
      the new child gets the bogus ->replacement_session_keyring copied by
      dup_task_struct(). This is obviously wrong and, if nothing else, this
      leads to put_cred(already_freed_cred).
      
      change copy_creds() to clear this member. If copy_process() fails
      before this point the wrong ->replacement_session_keyring doesn't
      matter, exit_creds() won't be called.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
      Acked-by: default avatarDavid Howells <dhowells@redhat.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      66174b0e
    • Greg Kroah-Hartman's avatar
      hfsplus: Fix potential buffer overflows · 092c87ce
      Greg Kroah-Hartman authored
      commit 6f24f892 upstream
      
      Commit ec81aecb ("hfs: fix a potential buffer overflow") fixed a few
      potential buffer overflows in the hfs filesystem.  But as Timo Warns
      pointed out, these changes also need to be made on the hfsplus
      filesystem as well.
      Reported-by: default avatarTimo Warns <warns@pre-sense.de>
      Acked-by: default avatarWANG Cong <amwang@redhat.com>
      Cc: Alexey Khoroshilov <khoroshilov@ispras.ru>
      Cc: Miklos Szeredi <mszeredi@suse.cz>
      Cc: Sage Weil <sage@newdream.net>
      Cc: Eugene Teo <eteo@redhat.com>
      Cc: Roman Zippel <zippel@linux-m68k.org>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Alexey Dobriyan <adobriyan@gmail.com>
      Cc: Dave Anderson <anderson@redhat.com>
      Cc: stable <stable@vger.kernel.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      [dannf: backported to Debian's 2.6.32]
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      092c87ce
    • Jeff Mahoney's avatar
      dl2k: Clean up rio_ioctl · 4b3eb7bc
      Jeff Mahoney authored
      commit 1bb57e94 upstream
      
      The dl2k driver's rio_ioctl call has a few issues:
      - No permissions checking
      - Implements SIOCGMIIREG and SIOCGMIIREG using the SIOCDEVPRIVATE numbers
      - Has a few ioctls that may have been used for debugging at one point
        but have no place in the kernel proper.
      
      This patch removes all but the MII ioctls, renumbers them to use the
      standard ones, and adds the proper permission check for SIOCSMIIREG.
      
      We can also get rid of the dl2k-specific struct mii_data in favor of
      the generic struct mii_ioctl_data.
      
      Since we have the phyid on hand, we can add the SIOCGMIIPHY ioctl too.
      
      Most of the MII code for the driver could probably be converted to use
      the generic MII library but I don't have a device to test the results.
      Reported-by: default avatarStephan Mueller <stephan.mueller@atsec.com>
      Signed-off-by: default avatarJeff Mahoney <jeffm@suse.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      [dannf: backported to Debian's 2.6.32]
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      4b3eb7bc
    • Francois Romieu's avatar
      dl2k: use standard #defines from mii.h. · aecd9f48
      Francois Romieu authored
      commit 78f6a6bd upstream
      Signed-off-by: default avatarFrancois Romieu <romieu@fr.zoreil.com>
      [dannf: backported to Debian's 2.6.32]
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      aecd9f48
    • Jason Wang's avatar
      net: sock: validate data_len before allocating skb in sock_alloc_send_pskb() · facdf585
      Jason Wang authored
      commit cc9b17ad upstream
      
      We need to validate the number of pages consumed by data_len, otherwise frags
      array could be overflowed by userspace. So this patch validate data_len and
      return -EMSGSIZE when data_len may occupies more frags than MAX_SKB_FRAGS.
      Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      [dannf: backported to Debian's 2.6.32]
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      facdf585
    • David Gibson's avatar
      hugepages: fix use after free bug in "quota" handling · 989e1ffd
      David Gibson authored
      commit 90481622 upstream
      
      hugetlbfs_{get,put}_quota() are badly named.  They don't interact with the
      general quota handling code, and they don't much resemble its behaviour.
      Rather than being about maintaining limits on on-disk block usage by
      particular users, they are instead about maintaining limits on in-memory
      page usage (including anonymous MAP_PRIVATE copied-on-write pages)
      associated with a particular hugetlbfs filesystem instance.
      
      Worse, they work by having callbacks to the hugetlbfs filesystem code from
      the low-level page handling code, in particular from free_huge_page().
      This is a layering violation of itself, but more importantly, if the
      kernel does a get_user_pages() on hugepages (which can happen from KVM
      amongst others), then the free_huge_page() can be delayed until after the
      associated inode has already been freed.  If an unmount occurs at the
      wrong time, even the hugetlbfs superblock where the "quota" limits are
      stored may have been freed.
      
      Andrew Barry proposed a patch to fix this by having hugepages, instead of
      storing a pointer to their address_space and reaching the superblock from
      there, had the hugepages store pointers directly to the superblock,
      bumping the reference count as appropriate to avoid it being freed.
      Andrew Morton rejected that version, however, on the grounds that it made
      the existing layering violation worse.
      
      This is a reworked version of Andrew's patch, which removes the extra, and
      some of the existing, layering violation.  It works by introducing the
      concept of a hugepage "subpool" at the lower hugepage mm layer - that is a
      finite logical pool of hugepages to allocate from.  hugetlbfs now creates
      a subpool for each filesystem instance with a page limit set, and a
      pointer to the subpool gets added to each allocated hugepage, instead of
      the address_space pointer used now.  The subpool has its own lifetime and
      is only freed once all pages in it _and_ all other references to it (i.e.
      superblocks) are gone.
      
      subpools are optional - a NULL subpool pointer is taken by the code to
      mean that no subpool limits are in effect.
      
      Previous discussion of this bug found in:  "Fix refcounting in hugetlbfs
      quota handling.". See:  https://lkml.org/lkml/2011/8/11/28 or
      http://marc.info/?l=linux-mm&m=126928970510627&w=1
      
      v2: Fixed a bug spotted by Hillf Danton, and removed the extra parameter to
      alloc_huge_page() - since it already takes the vma, it is not necessary.
      Signed-off-by: default avatarAndrew Barry <abarry@cray.com>
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Minchan Kim <minchan.kim@gmail.com>
      Cc: Hillf Danton <dhillf@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      [dannf: backported to Debian's 2.6.32]
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      989e1ffd
    • Jonghwan Choi's avatar
      security: fix compile error in commoncap.c · c15f065a
      Jonghwan Choi authored
      commit 51b79bee upstream
      
      Add missing "personality.h"
      security/commoncap.c: In function 'cap_bprm_set_creds':
      security/commoncap.c:510: error: 'PER_CLEAR_ON_SETID' undeclared (first use in this function)
      security/commoncap.c:510: error: (Each undeclared identifier is reported only once
      security/commoncap.c:510: error: for each function it appears in.)
      Signed-off-by: default avatarJonghwan Choi <jhbird.choi@samsung.com>
      Acked-by: default avatarSerge Hallyn <serge.hallyn@canonical.com>
      Signed-off-by: default avatarJames Morris <james.l.morris@oracle.com>
      [dannf: adjusted to apply to Debian's 2.6.32]
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      c15f065a
    • Eric Paris's avatar
      fcaps: clear the same personality flags as suid when fcaps are used · 39c46db9
      Eric Paris authored
      commit d52fc5dd upstream
      
      If a process increases permissions using fcaps all of the dangerous
      personality flags which are cleared for suid apps should also be cleared.
      Thus programs given priviledge with fcaps will continue to have address space
      randomization enabled even if the parent tried to disable it to make it
      easier to attack.
      Signed-off-by: default avatarEric Paris <eparis@redhat.com>
      Reviewed-by: default avatarSerge Hallyn <serge.hallyn@canonical.com>
      Signed-off-by: default avatarJames Morris <james.l.morris@oracle.com>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      39c46db9
    • Jan Kara's avatar
      xfs: Fix missing xfs_iunlock() on error recovery path in xfs_readlink() · 595cf5bd
      Jan Kara authored
      commit 9b025eb3 upstream.
      
      Commit b52a360b forgot to call xfs_iunlock() when it detected corrupted
      symplink and bailed out. Fix it by jumping to 'out' instead of doing return.
      
      CC: stable@kernel.org
      CC: Carlos Maiolino <cmaiolino@redhat.com>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Reviewed-by: default avatarAlex Elder <elder@kernel.org>
      Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
      Signed-off-by: default avatarBen Myers <bpm@sgi.com>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      595cf5bd
    • Carlos Maiolino's avatar
      xfs: Fix possible memory corruption in xfs_readlink · 19b28052
      Carlos Maiolino authored
      commit b52a360b upstream
      
      Fixes a possible memory corruption when the link is larger than
      MAXPATHLEN and XFS_DEBUG is not enabled. This also remove the
      S_ISLNK assert, since the inode mode is checked previously in
      xfs_readlink_by_handle() and via VFS.
      
      Updated to address concerns raised by Ben Hutchings about the loose
      attention paid to 32- vs 64-bit values, and the lack of handling a
      potentially negative pathlen value:
       - Changed type of "pathlen" to be xfs_fsize_t, to match that of
         ip->i_d.di_size
       - Added checking for a negative pathlen to the too-long pathlen
         test, and generalized the message that gets reported in that case
         to reflect the change
      As a result, if a negative pathlen were encountered, this function
      would return EFSCORRUPTED (and would fail an assertion for a debug
      build)--just as would a too-long pathlen.
      Signed-off-by: default avatarAlex Elder <aelder@sgi.com>
      Signed-off-by: default avatarCarlos Maiolino <cmaiolino@redhat.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      [dannf: backported to Debian's 2.6.32]
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      19b28052
    • Avi Kivity's avatar
      KVM: ia64: fix build due to typo · 575a0a98
      Avi Kivity authored
      commit 8281715b upstream.
      
      s/kcm/kvm/.
      Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
      Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      575a0a98
    • Avi Kivity's avatar
      KVM: Ensure all vcpus are consistent with in-kernel irqchip settings · ac802e6a
      Avi Kivity authored
      commit 3e515705 upstream
      
      If some vcpus are created before KVM_CREATE_IRQCHIP, then
      irqchip_in_kernel() and vcpu->arch.apic will be inconsistent, leading
      to potential NULL pointer dereferences.
      
      Fix by:
      - ensuring that no vcpus are installed when KVM_CREATE_IRQCHIP is called
      - ensuring that a vcpu has an apic if it is installed after KVM_CREATE_IRQCHIP
      
      This is somewhat long winded because vcpu->arch.apic is created without
      kvm->lock held.
      
      Based on earlier patch by Michael Ellerman.
      Signed-off-by: default avatarMichael Ellerman <michael@ellerman.id.au>
      Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
      [dannf: backported to Debian's 2.6.32]
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      ac802e6a
    • Marcelo Tosatti's avatar
      KVM: x86: disallow multiple KVM_CREATE_IRQCHIP · 49ef5906
      Marcelo Tosatti authored
      commit 3ddea128 upstream
      
      Otherwise kvm will leak memory on multiple KVM_CREATE_IRQCHIP.
      Also serialize multiple accesses with kvm->lock.
      Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
      Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      49ef5906
    • Louis Rilling's avatar
      block: Fix io_context leak after failure of clone with CLONE_IO · 6ace7773
      Louis Rilling authored
      commit b69f2292 upstream
      
      With CLONE_IO, parent's io_context->nr_tasks is incremented, but never
      decremented whenever copy_process() fails afterwards, which prevents
      exit_io_context() from calling IO schedulers exit functions.
      
      Give a task_struct to exit_io_context(), and call exit_io_context() instead of
      put_io_context() in copy_process() cleanup path.
      Signed-off-by: default avatarLouis Rilling <louis.rilling@kerlabs.com>
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      6ace7773
    • Louis Rilling's avatar
      block: Fix io_context leak after clone with CLONE_IO · 36cea38d
      Louis Rilling authored
      commit 61cc74fb upstream
      
      With CLONE_IO, copy_io() increments both ioc->refcount and ioc->nr_tasks.
      However exit_io_context() only decrements ioc->refcount if ioc->nr_tasks
      reaches 0.
      
      Always call put_io_context() in exit_io_context().
      Signed-off-by: default avatarLouis Rilling <louis.rilling@kerlabs.com>
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      36cea38d
    • Stephan Bärwolf's avatar
      KVM: x86: fix missing checks in syscall emulation · b9a6939d
      Stephan Bärwolf authored
      commit c2226fc9 upstream
      
      On hosts without this patch, 32bit guests will crash (and 64bit guests
      may behave in a wrong way) for example by simply executing following
      nasm-demo-application:
      
      [bits 32]
      global _start
      SECTION .text
      _start: syscall
      
      (I tested it with winxp and linux - both always crashed)
      
      Disassembly of section .text:
      
      00000000 <_start>:
         0:   0f 05                   syscall
      
      The reason seems a missing "invalid opcode"-trap (int6) for the
      syscall opcode "0f05", which is not available on Intel CPUs
      within non-longmodes, as also on some AMD CPUs within legacy-mode.
      (depending on CPU vendor, MSR_EFER and cpuid)
      
      Because previous mentioned OSs may not engage corresponding
      syscall target-registers (STAR, LSTAR, CSTAR), they remain
      NULL and (non trapping) syscalls are leading to multiple
      faults and finally crashs.
      
      Depending on the architecture (AMD or Intel) pretended by
      guests, various checks according to vendor's documentation
      are implemented to overcome the current issue and behave
      like the CPUs physical counterparts.
      
      [mtosatti: cleanup/beautify code]
      
      [bwh: Backport to 2.6.32:
       - Add the prerequisite read of EFER
       - Return -1 in the error cases rather than invoking emulate_ud()
         directly
       - Adjust context]
      [dannf: fix build by passing x86_emulate_ops through each call]
      Signed-off-by: default avatarStephan Baerwolf <stephan.baerwolf@tu-ilmenau.de>
      Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      b9a6939d
    • Stephan Bärwolf's avatar
      KVM: x86: extend "struct x86_emulate_ops" with "get_cpuid" · a0c74fba
      Stephan Bärwolf authored
      commit bdb42f5a upstream
      
      In order to be able to proceed checks on CPU-specific properties
      within the emulator, function "get_cpuid" is introduced.
      With "get_cpuid" it is possible to virtually call the guests
      "cpuid"-opcode without changing the VM's context.
      
      [mtosatti: cleanup/beautify code]
      
      [bwh: Backport to 2.6.32:
       - Don't use emul_to_vcpu
       - Adjust context]
      Signed-off-by: default avatarStephan Baerwolf <stephan.baerwolf@tu-ilmenau.de>
      Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      a0c74fba
    • Ben Hutchings's avatar
      rose: Add length checks to CALL_REQUEST parsing · db9faaa3
      Ben Hutchings authored
      commit e0bccd31 upstream
      
      Define some constant offsets for CALL_REQUEST based on the description
      at <http://www.techfest.com/networking/wan/x25plp.htm> and the
      definition of ROSE as using 10-digit (5-byte) addresses.  Use them
      consistently.  Validate all implicit and explicit facilities lengths.
      Validate the address length byte rather than either trusting or
      assuming its value.
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      [dannf: backported to Debian's 2.6.32]
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      db9faaa3
    • Jan Kiszka's avatar
      KVM: x86: Prevent starting PIT timers in the absence of irqchip support · 8949ae78
      Jan Kiszka authored
      commit 0924ab2c upstream
      
      User space may create the PIT and forgets about setting up the irqchips.
      In that case, firing PIT IRQs will crash the host:
      
      BUG: unable to handle kernel NULL pointer dereference at 0000000000000128
      IP: [<ffffffffa10f6280>] kvm_set_irq+0x30/0x170 [kvm]
      ...
      Call Trace:
       [<ffffffffa11228c1>] pit_do_work+0x51/0xd0 [kvm]
       [<ffffffff81071431>] process_one_work+0x111/0x4d0
       [<ffffffff81071bb2>] worker_thread+0x152/0x340
       [<ffffffff81075c8e>] kthread+0x7e/0x90
       [<ffffffff815a4474>] kernel_thread_helper+0x4/0x10
      
      Prevent this by checking the irqchip mode before starting a timer. We
      can't deny creating the PIT if the irqchips aren't set up yet as
      current user land expects this order to work.
      Signed-off-by: default avatarJan Kiszka <jan.kiszka@siemens.com>
      Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
      [dannf: backported to Debian's 2.6.32]
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      8949ae78
    • Alex Williamson's avatar
      KVM: Device assignment permission checks · e642da01
      Alex Williamson authored
      commit 3d27e23b upstream
      
      Only allow KVM device assignment to attach to devices which:
      
       - Are not bridges
       - Have BAR resources (assume others are special devices)
       - The user has permissions to use
      
      Assigning a bridge is a configuration error, it's not supported, and
      typically doesn't result in the behavior the user is expecting anyway.
      Devices without BAR resources are typically chipset components that
      also don't have host drivers.  We don't want users to hold such devices
      captive or cause system problems by fencing them off into an iommu
      domain.  We determine "permission to use" by testing whether the user
      has access to the PCI sysfs resource files.  By default a normal user
      will not have access to these files, so it provides a good indication
      that an administration agent has granted the user access to the device.
      
      [Yang Bai: add missing #include]
      [avi: fix comment style]
      Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
      Signed-off-by: default avatarYang Bai <hamo.by@gmail.com>
      Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
      [dannf: backported to Debian's 2.6.32]
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      e642da01
    • Alex Williamson's avatar
      KVM: Remove ability to assign a device without iommu support · 4d092c1f
      Alex Williamson authored
      commit 42387373 upstream
      
      This option has no users and it exposes a security hole that we
      can allow devices to be assigned without iommu protection.  Make
      KVM_DEV_ASSIGN_ENABLE_IOMMU a mandatory option.
      Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
      Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
      [dannf: backported to Debian's 2.6.32]
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      4d092c1f
    • Willy Tarreau's avatar
      PNP: fix "work around Dell 1536/1546 BIOS MMCONFIG bug that breaks USB" · 46e8a56a
      Willy Tarreau authored
      Initial stable commit : 2215d910
      
      This patch backported into 2.6.32.55 is enabled when CONFIG_AMD_NB is set,
      but this config option does not exist in 2.6.32, it was called CONFIG_K8_NB,
      so the fix was never applied. Some other changes were needed to make it work.
      first, the correct include file name was asm/k8.h and not asm/amd_nb.h, and
      second, amd_get_mmconfig_range() is needed and was merged by previous patch.
      
      Thanks to Jiri Slabi who reported the issue and diagnosed all the dependencies.
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      Cc: Jiri Slaby <jslaby@suse.cz>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      46e8a56a
    • Bjorn Helgaas's avatar
      x86/PCI: amd: factor out MMCONFIG discovery · 08dd6464
      Bjorn Helgaas authored
      commit 24d25dbf upstream.
      
      This factors out the AMD native MMCONFIG discovery so we can use it
      outside amd_bus.c.
      
      amd_bus.c reads AMD MSRs so it can remove the MMCONFIG area from the
      PCI resources.  We may also need the MMCONFIG information to work
      around BIOS defects in the ACPI MCFG table.
      
      Cc: Borislav Petkov <borislav.petkov@amd.com>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: stable@kernel.org
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
      [WT: this patch was initially not planned for 2.6.32 but is required by commit
       2215d910 merged into 2.6.32.55 and which relies on amd_get_mmconfig_range() ]
      Cc: Jiri Slaby <jslaby@suse.cz>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      08dd6464
    • Mike Galbraith's avatar
      sched: Fix signed unsigned comparison in check_preempt_tick() · 2c224ae6
      Mike Galbraith authored
      commit d7d82944 upstream.
      
      Signed unsigned comparison may lead to superfluous resched if leftmost
      is right of the current task, wasting a few cycles, and inadvertently
      _lengthening_ the current task's slice.
      Reported-by: default avatarVenkatesh Pallipadi <venki@google.com>
      Signed-off-by: default avatarMike Galbraith <efault@gmx.de>
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <1294202477.9384.5.camel@marge.simson.net>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      2c224ae6