1. 04 Dec, 2013 40 commits
    • Ujjal Roy's avatar
      mwifiex: fix wrong eth_hdr usage for bridged packets in AP mode · 968eba90
      Ujjal Roy authored
      commit 8d93f1f3 upstream.
      
      The eth_hdr is never defined in this driver but it gets compiled
      without any warning/error because kernel has defined eth_hdr.
      
      Fix it by defining our own p_ethhdr and use it instead of eth_hdr.
      Signed-off-by: default avatarUjjal Roy <royujjal@gmail.com>
      Signed-off-by: default avatarAmitkumar Karwar <akarwar@marvell.com>
      Signed-off-by: default avatarBing Zhao <bzhao@marvell.com>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      968eba90
    • Avinash Patil's avatar
      mwifiex: correct packet length for packets from SDIO interface · c94aee0b
      Avinash Patil authored
      commit d03b4aa7 upstream.
      
      While receiving a packet on SDIO interface, we allocate skb with
      size multiple of SDIO block size. We need to resize this skb
      after RX using packet length from RX header.
      Signed-off-by: default avatarAvinash Patil <patila@marvell.com>
      Signed-off-by: default avatarBing Zhao <bzhao@marvell.com>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c94aee0b
    • Pavel Shilovsky's avatar
      CIFS: Fix symbolic links usage · 167f34b7
      Pavel Shilovsky authored
      commit eb85d94b upstream.
      
      Now we treat any reparse point as a symbolic link and map it to a Unix
      one that is not true in a common case due to many reparse point types
      supported by SMB servers.
      
      Distinguish reparse point types into two groups:
      1) that can be accessed directly through a reparse point
      (junctions, deduplicated files, NFS symlinks);
      2) that need to be processed manually (Windows symbolic links, DFS);
      
      and map only Windows symbolic links to Unix ones.
      Acked-by: default avatarJeff Layton <jlayton@redhat.com>
      Reported-and-tested-by: default avatarJoao Correia <joaomiguelcorreia@gmail.com>
      Signed-off-by: default avatarPavel Shilovsky <piastry@etersoft.ru>
      Signed-off-by: default avatarSteve French <smfrench@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      167f34b7
    • Kent Overstreet's avatar
      bcache: Fix dirty_data accounting · a8ffbb93
      Kent Overstreet authored
      commit 1fa8455d upstream.
      
      Dirty data accounting wasn't quite right - firstly, we were adding the key we're
      inserting after it could have merged with another dirty key already in the
      btree, and secondly we could sometimes pass the wrong offset to
      bcache_dev_sectors_dirty_add() for dirty data we were overwriting - which is
      important when tracking dirty data by stripe.
      Signed-off-by: default avatarKent Overstreet <kmo@daterainc.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a8ffbb93
    • Dave Airlie's avatar
      drm/qxl: fix memory leak in release list handling · b5cdb8f6
      Dave Airlie authored
      commit 1b28c3e6 upstream.
      
      wow no idea how I got this far without seeing this,
      leaking the entries in the list makes kmalloc-64 slab grow.
      
      References: https://bugzilla.kernel.org/show_bug.cgi?id=65121Reported-by: default avatarMatthew Stapleton <matthew4196@gmail.com>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b5cdb8f6
    • Dave Airlie's avatar
      qxl: avoid an oops in the deferred io code. · df69034f
      Dave Airlie authored
      commit cc87509d upstream.
      
      If we are using deferred io due to plymouth or X.org fbdev driver
      we will oops in memcpy due to this pointless multiply here,
      
      removing it fixes fbdev to start and not oops.
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      df69034f
    • Rafael J. Wysocki's avatar
      PM / Hibernate: Do not crash kernel in free_basic_memory_bitmaps() · 41557e51
      Rafael J. Wysocki authored
      commit 6a0c7cd3 upstream.
      
      I have received a report about the BUG_ON() in free_basic_memory_bitmaps()
      triggering mysteriously during an aborted s2disk hibernation attempt.
      The only way I can explain that is that /dev/snapshot was first
      opened for writing (resume mode), then closed and then opened again
      for reading and closed again without freezing tasks.  In that case
      the first invocation of snapshot_open() would set the free_bitmaps
      flag in snapshot_state, which is a static variable.  That flag
      wouldn't be cleared later and the second invocation of snapshot_open()
      would just leave it like that, so the subsequent snapshot_release()
      would see data->frozen set and free_basic_memory_bitmaps() would be
      called unnecessarily.
      
      To prevent that from happening clear data->free_bitmaps in
      snapshot_open() when the file is being opened for reading (hibernate
      mode).
      
      In addition to that, replace the BUG_ON() in free_basic_memory_bitmaps()
      with a WARN_ON() as the kernel can continue just fine if the condition
      checked by that macro occurs.
      
      Fixes: aab17289 (PM / hibernate: Fix user space driven resume regression)
      Reported-by: default avatarOliver Lorenz <olli@olorenz.org>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      41557e51
    • Rafael J. Wysocki's avatar
      PM / runtime: Use pm_runtime_put_sync() in __device_release_driver() · 0dd3f357
      Rafael J. Wysocki authored
      commit baab52de upstream.
      
      Commit fa180eb4 (PM / Runtime: Idle devices asynchronously after
      probe|release) modified __device_release_driver() to call
      pm_runtime_put(dev) instead of pm_runtime_put_sync(dev) before
      detaching the driver from the device.  However, that was a mistake,
      because pm_runtime_put(dev) causes rpm_idle() to be queued up and
      the driver may be gone already when that function is executed.
      That breaks the assumptions the drivers have the right to make
      about the core's behavior on the basis of the existing documentation
      and actually causes problems to happen, so revert that part of
      commit fa180eb4 and restore the previous behavior of
      __device_release_driver().
      Reported-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
      Fixes: fa180eb4 (PM / Runtime: Idle devices asynchronously after probe|release)
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: default avatarKevin Hilman <khilman@linaro.org>
      Acked-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0dd3f357
    • Aaron Lu's avatar
      PM / hibernate: Avoid overflow in hibernate_preallocate_memory() · e670b9b8
      Aaron Lu authored
      commit fd432b9f upstream.
      
      When system has a lot of highmem (e.g. 16GiB using a 32 bits kernel),
      the code to calculate how much memory we need to preallocate in
      normal zone may cause overflow. As Leon has analysed:
      
       It looks that during computing 'alloc' variable there is overflow:
       alloc = (3943404 - 1970542) - 1978280 = -5418 (signed)
       And this function goes to err_out.
      
      Fix this by avoiding that overflow.
      
      References: https://bugzilla.kernel.org/show_bug.cgi?id=60817Reported-and-tested-by: default avatarLeon Drugi <eyak@wp.pl>
      Signed-off-by: default avatarAaron Lu <aaron.lu@intel.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e670b9b8
    • Mikulas Patocka's avatar
      blk-core: Fix memory corruption if blkcg_init_queue fails · f5360a4c
      Mikulas Patocka authored
      commit fff4996b upstream.
      
      If blkcg_init_queue fails, blk_alloc_queue_node doesn't call bdi_destroy
      to clean up structures allocated by the backing dev.
      
      ------------[ cut here ]------------
      WARNING: at lib/debugobjects.c:260 debug_print_object+0x85/0xa0()
      ODEBUG: free active (active state 0) object type: percpu_counter hint:           (null)
      Modules linked in: dm_loop dm_mod ip6table_filter ip6_tables uvesafb cfbcopyarea cfbimgblt cfbfillrect fbcon font bitblit fbcon_rotate fbcon_cw fbcon_ud fbcon_ccw softcursor fb fbdev ipt_MASQUERADE iptable_nat nf_nat_ipv4 msr nf_conntrack_ipv4 nf_defrag_ipv4 xt_state ipt_REJECT xt_tcpudp iptable_filter ip_tables x_tables bridge stp llc tun ipv6 cpufreq_userspace cpufreq_stats cpufreq_powersave cpufreq_ondemand cpufreq_conservative spadfs fuse hid_generic usbhid hid raid0 md_mod dmi_sysfs nf_nat_ftp nf_nat nf_conntrack_ftp nf_conntrack lm85 hwmon_vid snd_usb_audio snd_pcm_oss snd_mixer_oss snd_pcm snd_timer snd_page_alloc snd_hwdep snd_usbmidi_lib snd_rawmidi snd soundcore acpi_cpufreq freq_table mperf sata_svw serverworks kvm_amd ide_core ehci_pci ohci_hcd libata ehci_hcd kvm usbcore tg3 usb_common libphy k10temp pcspkr ptp i2c_piix4 i2c_core evdev microcode hwmon rtc_cmos pps_core e100 skge floppy mii processor button unix
      CPU: 0 PID: 2739 Comm: lvchange Tainted: G        W
      3.10.15-devel #14
      Hardware name: empty empty/S3992-E, BIOS 'V1.06   ' 06/09/2009
       0000000000000009 ffff88023c3c1ae8 ffffffff813c8fd4 ffff88023c3c1b20
       ffffffff810399eb ffff88043d35cd58 ffffffff81651940 ffff88023c3c1bf8
       ffffffff82479d90 0000000000000005 ffff88023c3c1b80 ffffffff81039a67
      Call Trace:
       [<ffffffff813c8fd4>] dump_stack+0x19/0x1b
       [<ffffffff810399eb>] warn_slowpath_common+0x6b/0xa0
       [<ffffffff81039a67>] warn_slowpath_fmt+0x47/0x50
       [<ffffffff8122aaaf>] ? debug_check_no_obj_freed+0xcf/0x250
       [<ffffffff81229a15>] debug_print_object+0x85/0xa0
       [<ffffffff8122abe3>] debug_check_no_obj_freed+0x203/0x250
       [<ffffffff8113c4ac>] kmem_cache_free+0x20c/0x3a0
       [<ffffffff811f6709>] blk_alloc_queue_node+0x2a9/0x2c0
       [<ffffffff811f672e>] blk_alloc_queue+0xe/0x10
       [<ffffffffa04c0093>] dm_create+0x1a3/0x530 [dm_mod]
       [<ffffffffa04c6bb0>] ? list_version_get_info+0xe0/0xe0 [dm_mod]
       [<ffffffffa04c6c07>] dev_create+0x57/0x2b0 [dm_mod]
       [<ffffffffa04c6bb0>] ? list_version_get_info+0xe0/0xe0 [dm_mod]
       [<ffffffffa04c6bb0>] ? list_version_get_info+0xe0/0xe0 [dm_mod]
       [<ffffffffa04c6528>] ctl_ioctl+0x268/0x500 [dm_mod]
       [<ffffffff81097662>] ? get_lock_stats+0x22/0x70
       [<ffffffffa04c67ce>] dm_ctl_ioctl+0xe/0x20 [dm_mod]
       [<ffffffff81161aad>] do_vfs_ioctl+0x2ed/0x520
       [<ffffffff8116cfc7>] ? fget_light+0x377/0x4e0
       [<ffffffff81161d2b>] SyS_ioctl+0x4b/0x90
       [<ffffffff813cff16>] system_call_fastpath+0x1a/0x1f
      ---[ end trace 4b5ff0d55673d986 ]---
      ------------[ cut here ]------------
      
      This fix should be backported to stable kernels starting with 2.6.37. Note
      that in the kernels prior to 3.5 the affected code is different, but the
      bug is still there - bdi_init is called and bdi_destroy isn't.
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Acked-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f5360a4c
    • Nicholas Bellinger's avatar
      target: Fix delayed Task Aborted Status (TAS) handling bug · 2db811c4
      Nicholas Bellinger authored
      commit 29f4c090 upstream.
      
      This patch fixes a bug in delayed Task Aborted Status (TAS) handling,
      where transport_send_task_abort() was not returning for the case
      when the se_tfo->write_pending() callback indicated that last fabric
      specific WRITE PDU had not yet been received.
      
      It also adds an explicit cmd->scsi_status = SAM_STAT_TASK_ABORTED
      assignment within transport_check_aborted_status() to avoid the case
      where se_tfo->queue_status() is called when the SAM_STAT_TASK_ABORTED
      assignment + ->queue_status() in transport_send_task_abort() does not
      occur once SCF_SENT_DELAYED_TAS has been set.
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2db811c4
    • Vu Pham's avatar
      iser-target: Avoid using FRMR for single dma entry requests · ba104050
      Vu Pham authored
      commit f01b9f73 upstream.
      
      This patch changes isert_reg_rdma_frwr() to not use FRMR for single
      dma entry requests from small I/Os, in order to avoid the associated
      memory registration overhead.
      
      Using DMA MR is sufficient here for the single dma entry requests,
      and addresses a >= v3.12 performance regression.
      Signed-off-by: default avatarVu Pham <vu@mellanox.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ba104050
    • Dan Williams's avatar
      ioatdma: fix selection of 16 vs 8 source path · a009902c
      Dan Williams authored
      commit 21e96c73 upstream.
      
      When performing continuations there are implied sources that need to be
      added to the source count. Quoting dma_set_maxpq:
      
      /* dma_maxpq - reduce maxpq in the face of continued operations
       * @dma - dma device with PQ capability
       * @flags - to check if DMA_PREP_CONTINUE and DMA_PREP_PQ_DISABLE_P are set
       *
       * When an engine does not support native continuation we need 3 extra
       * source slots to reuse P and Q with the following coefficients:
       * 1/ {00} * P : remove P from Q', but use it as a source for P'
       * 2/ {01} * Q : use Q to continue Q' calculation
       * 3/ {00} * Q : subtract Q from P' to cancel (2)
       *
       * In the case where P is disabled we only need 1 extra source:
       * 1/ {01} * Q : use Q to continue Q' calculation
       */
      
      ...fix the selection of the 16 source path to take these implied sources
      into account.
      
      Note this also kills the BUG_ON(src_cnt < 9) check in
      __ioat3_prep_pq16_lock().  Besides not accounting for implied sources
      the check is redundant given we already made the path selection.
      
      Cc: Dave Jiang <dave.jiang@intel.com>
      Acked-by: default avatarDave Jiang <dave.jiang@intel.com>
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a009902c
    • Dan Williams's avatar
      ioatdma: fix sed pool selection · 1bb87f93
      Dan Williams authored
      commit 5d48b9b5 upstream.
      
      The array to lookup the sed pool based on the number of sources
      (pq16_idx_to_sedi) is 16 entries and expects a max source index.
      However, we pass the total source count which runs off the end of the
      array when src_cnt == 16.  The minimal fix is to just pass src_cnt-1,
      but given we know the source count is > 8 we can just calculate the sed
      pool by (src_cnt - 2) >> 3.
      
      Cc: Dave Jiang <dave.jiang@intel.com>
      Acked-by: default avatarDave Jiang <dave.jiang@intel.com>
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1bb87f93
    • Dave Jiang's avatar
      ioatdma: Fix bug in selftest after removal of DMA_MEMSET. · b9c4b04c
      Dave Jiang authored
      commit ac7d631f upstream.
      
      Commit 48a9db46 (3.11) removed the memset op in the xor selftest for ioatdma.
      The issue is that with the removal of that op, it never replaced the memset
      with a CPU memset. The memory being operated on is expected to be zeroes but
      was not. This is causing the xor selftest to fail.
      Signed-off-by: default avatarDave Jiang <dave.jiang@intel.com>
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b9c4b04c
    • Mikulas Patocka's avatar
      dm: allocate buffer for messages with small number of arguments using GFP_NOIO · 9afdbf0a
      Mikulas Patocka authored
      commit f36afb39 upstream.
      
      dm-mpath and dm-thin must process messages even if some device is
      suspended, so we allocate argv buffer with GFP_NOIO. These messages have
      a small fixed number of arguments.
      
      On the other hand, dm-switch needs to process bulk data using messages
      so excessive use of GFP_NOIO could cause trouble.
      
      The patch also lowers the default number of arguments from 64 to 8, so
      that there is smaller load on GFP_NOIO allocations.
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Acked-by: default avatarAlasdair G Kergon <agk@redhat.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9afdbf0a
    • Joe Thornber's avatar
      dm cache: fix a race condition between queuing new migrations and quiescing for a shutdown · 901dfc02
      Joe Thornber authored
      commit 66cb1910 upstream.
      
      The code that was trying to do this was inadequate.  The postsuspend
      method (in ioctl context), needs to wait for the worker thread to
      acknowledge the request to quiesce.  Otherwise the migration count may
      drop to zero temporarily before the worker thread realises we're
      quiescing.  In this case the target will be taken down, but the worker
      thread may have issued a new migration, which will cause an oops when
      it completes.
      Signed-off-by: default avatarJoe Thornber <ejt@redhat.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      901dfc02
    • Joe Thornber's avatar
      dm array: fix bug in growing array · 884d5952
      Joe Thornber authored
      commit 9c1d4de5 upstream.
      
      Entries would be lost if the old tail block was partially filled.
      Signed-off-by: default avatarJoe Thornber <ejt@redhat.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      884d5952
    • Shiva Krishna Merla's avatar
      dm mpath: fix race condition between multipath_dtr and pg_init_done · 0cc9fcd4
      Shiva Krishna Merla authored
      commit 954a73d5 upstream.
      
      Whenever multipath_dtr() is happening we must prevent queueing any
      further path activation work.  Implement this by adding a new
      'pg_init_disabled' flag to the multipath structure that denotes future
      path activation work should be skipped if it is set.  By disabling
      pg_init and then re-enabling in flush_multipath_work() we also avoid the
      potential for pg_init to be initiated while suspending an mpath device.
      
      Without this patch a race condition exists that may result in a kernel
      panic:
      
      1) If after pg_init_done() decrements pg_init_in_progress to 0, a call
         to wait_for_pg_init_completion() assumes there are no more pending path
         management commands.
      2) If pg_init_required is set by pg_init_done(), due to retryable
         mode_select errors, then process_queued_ios() will again queue the
         path activation work.
      3) If free_multipath() completes before activate_path() work is called a
         NULL pointer dereference like the following can be seen when
         accessing members of the recently destructed multipath:
      
      BUG: unable to handle kernel NULL pointer dereference at 0000000000000090
      RIP: 0010:[<ffffffffa003db1b>]  [<ffffffffa003db1b>] activate_path+0x1b/0x30 [dm_multipath]
      [<ffffffff81090ac0>] worker_thread+0x170/0x2a0
      [<ffffffff81096c80>] ? autoremove_wake_function+0x0/0x40
      
      [switch to disabling pg_init in flush_multipath_work & header edits by Mike Snitzer]
      Signed-off-by: default avatarShiva Krishna Merla <shivakrishna.merla@netapp.com>
      Reviewed-by: default avatarKrishnasamy Somasundaram <somasundaram.krishnasamy@netapp.com>
      Tested-by: default avatarSpeagle Andy <Andy.Speagle@netapp.com>
      Acked-by: default avatarJunichi Nomura <j-nomura@ce.jp.nec.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0cc9fcd4
    • Rodolfo Giometti's avatar
      mmc: atmel-mci: fix oops in atmci_tasklet_func · aa54481e
      Rodolfo Giometti authored
      commit fbd986cd upstream.
      
      In some cases, a NULL pointer dereference happens because data is NULL when
      STATE_END_REQUEST case is reached in atmci_tasklet_func.
      Signed-off-by: default avatarRodolfo Giometti <giometti@enneenne.com>
      Acked-by: default avatarLudovic Desroches <ludovic.desroches@atmel.com>
      Acked-by: default avatarNicolas Ferre <nicolas.ferre@atmel.com>
      Signed-off-by: default avatarChris Ball <cjb@laptop.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      aa54481e
    • Ludovic Desroches's avatar
      mmc: atmel-mci: abort transfer on timeout error · 491e7886
      Ludovic Desroches authored
      commit c1fa3426 upstream.
      
      When a software timeout occurs, the transfer is not stopped. In DMA case,
      it causes DMA channel to be stuck because the transfer is still active
      causing following transfers to be queued but not computed.
      Signed-off-by: default avatarLudovic Desroches <ludovic.desroches@atmel.com>
      Reported-by: default avatarAlexander Morozov <etesial@gmail.com>
      Acked-by: default avatarNicolas Ferre <nicolas.ferre@atmel.com>
      Signed-off-by: default avatarChris Ball <cjb@laptop.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      491e7886
    • Weijie Yang's avatar
      mm/zswap: bugfix: memory leak when invalidate and reclaim occur concurrently · 7edd86e5
      Weijie Yang authored
      commit 67d13fe8 upstream.
      
      Consider the following scenario:
      
      thread 0: reclaim entry x (get refcount, but not call zswap_get_swap_cache_page)
      thread 1: call zswap_frontswap_invalidate_page to invalidate entry x.
      	finished, entry x and its zbud is not freed as its refcount != 0
      	now, the swap_map[x] = 0
      thread 0: now call zswap_get_swap_cache_page
      	swapcache_prepare return -ENOENT because entry x is not used any more
      	zswap_get_swap_cache_page return ZSWAP_SWAPCACHE_NOMEM
      	zswap_writeback_entry do nothing except put refcount
      
      Now, the memory of zswap_entry x and its zpage leak.
      
      Modify:
       - check the refcount in fail path, free memory if it is not referenced.
      
       - use ZSWAP_SWAPCACHE_FAIL instead of ZSWAP_SWAPCACHE_NOMEM as the fail path
         can be not only caused by nomem but also by invalidate.
      Signed-off-by: default avatarWeijie Yang <weijie.yang@samsung.com>
      Reviewed-by: default avatarBob Liu <bob.liu@oracle.com>
      Reviewed-by: default avatarMinchan Kim <minchan@kernel.org>
      Acked-by: default avatarSeth Jennings <sjenning@linux.vnet.ibm.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>
      7edd86e5
    • Akira Takeuchi's avatar
      mm: ensure get_unmapped_area() returns higher address than mmap_min_addr · e360d51f
      Akira Takeuchi authored
      commit 2afc745f upstream.
      
      This patch fixes the problem that get_unmapped_area() can return illegal
      address and result in failing mmap(2) etc.
      
      In case that the address higher than PAGE_SIZE is set to
      /proc/sys/vm/mmap_min_addr, the address lower than mmap_min_addr can be
      returned by get_unmapped_area(), even if you do not pass any virtual
      address hint (i.e.  the second argument).
      
      This is because the current get_unmapped_area() code does not take into
      account mmap_min_addr.
      
      This leads to two actual problems as follows:
      
      1. mmap(2) can fail with EPERM on the process without CAP_SYS_RAWIO,
         although any illegal parameter is not passed.
      
      2. The bottom-up search path after the top-down search might not work in
         arch_get_unmapped_area_topdown().
      
      Note: The first and third chunk of my patch, which changes "len" check,
      are for more precise check using mmap_min_addr, and not for solving the
      above problem.
      
      [How to reproduce]
      
      	--- test.c -------------------------------------------------
      	#include <stdio.h>
      	#include <unistd.h>
      	#include <sys/mman.h>
      	#include <sys/errno.h>
      
      	int main(int argc, char *argv[])
      	{
      		void *ret = NULL, *last_map;
      		size_t pagesize = sysconf(_SC_PAGESIZE);
      
      		do {
      			last_map = ret;
      			ret = mmap(0, pagesize, PROT_NONE,
      				MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
      	//		printf("ret=%p\n", ret);
      		} while (ret != MAP_FAILED);
      
      		if (errno != ENOMEM) {
      			printf("ERR: unexpected errno: %d (last map=%p)\n",
      			errno, last_map);
      		}
      
      		return 0;
      	}
      	---------------------------------------------------------------
      
      	$ gcc -m32 -o test test.c
      	$ sudo sysctl -w vm.mmap_min_addr=65536
      	vm.mmap_min_addr = 65536
      	$ ./test  (run as non-priviledge user)
      	ERR: unexpected errno: 1 (last map=0x10000)
      Signed-off-by: default avatarAkira Takeuchi <takeuchi.akr@jp.panasonic.com>
      Signed-off-by: default avatarKiyoshi Owada <owada.kiyoshi@jp.panasonic.com>
      Reviewed-by: default avatarNaoya Horiguchi <n-horiguchi@ah.jp.nec.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>
      e360d51f
    • Stanislaw Gruszka's avatar
      rt2400pci: fix RSSI read · be200404
      Stanislaw Gruszka authored
      commit 2bf127a5 upstream.
      
      RSSI value is provided on word3 not on word2.
      Signed-off-by: default avatarStanislaw Gruszka <stf_xl@wp.pl>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      be200404
    • Ursula Braun's avatar
      qeth: avoid buffer overflow in snmp ioctl · 8abbf7ce
      Ursula Braun authored
      commit 6fb392b1 upstream.
      
      Check user-defined length in snmp ioctl request and allow request
      only if it fits into a qeth command buffer.
      Signed-off-by: default avatarUrsula Braun <ursula.braun@de.ibm.com>
      Signed-off-by: default avatarFrank Blaschka <frank.blaschka@de.ibm.com>
      Reviewed-by: default avatarHeiko Carstens <heicars2@linux.vnet.ibm.com>
      Reported-by: default avatarNico Golde <nico@ngolde.de>
      Reported-by: default avatarFabian Yamaguchi <fabs@goesec.de>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8abbf7ce
    • Felix Fietkau's avatar
      ath5k: fix regression in tx status processing · 0d654144
      Felix Fietkau authored
      commit 7ede612f upstream.
      
      The regression was introduced in the following commit:
      
      0967e01e
      "ath5k: make use of the new rate control API"
      
      ath5k_tx_frame_completed saves the intended per-rate retry counts before
      they are cleared by ieee80211_tx_info_clear_status, however at this
      point the information in info->status.rates is incomplete.
      
      This causes significant throughput degradation and excessive packet loss
      on links where high bit rates don't work properly.
      
      Move the copy from bf->rates a few lines up to ensure that the saved
      retry counts are updated, and that they are really cleared in
      info->status.rates after the call to ieee80211_tx_info_clear_status.
      
      Cc: Thomas Huehn <thomas@net.t-labs.tu-berlin.de>
      Cc: Benjamin Vahl <bvahl@net.t-labs.tu-berlin.de>
      Reported-by: default avatarBen West <ben@gowasabi.net>
      Signed-off-by: default avatarFelix Fietkau <nbd@openwrt.org>
      Acked-by: default avatarThomas Huehn <thomas@net.t-labs.tu-berlin.de>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0d654144
    • Larry Finger's avatar
      rtlwifi: rtl8192cu: Fix incorrect signal strength for unassociated AP · f9a7e9f5
      Larry Finger authored
      commit 78dbfecb upstream.
      
      The routine that processes received frames was returning the RSSI value for the
      signal strength; however, that value is available only for associated APs. As
      a result, the strength was the absurd value of 10 dBm. As a result, scans
      return incorrect values for the strength, which causes unwanted attempts to roam.
      Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f9a7e9f5
    • Larry Finger's avatar
      rtlwifi: rtl8192se: Fix incorrect signal strength for unassociated AP · 6c72ff6c
      Larry Finger authored
      commit b4ade797 upstream.
      
      The routine that processes received frames was returning the RSSI value for the
      signal strength; however, that value is available only for associated APs. As
      a result, the strength was the absurd value of 10 dBm. As a result, scans
      return incorrect values for the strength, which causes unwanted attempts to roam.
      
      This patch fixes https://bugzilla.kernel.org/show_bug.cgi?id=63881.
      Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
      Reported-by: default avatarMatthieu Baerts <matttbe@gmail.com>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6c72ff6c
    • Larry Finger's avatar
      rtlwifi: rtl8192de: Fix incorrect signal strength for unassociated AP · 28a55f32
      Larry Finger authored
      commit 3545f3d5 upstream.
      
      The routine that processes received frames was returning the RSSI value for the
      signal strength; however, that value is available only for associated APs. As
      a result, the strength was the absurd value of 10 dBm. As a result, scans
      return incorrect values for the strength, which causes unwanted attempts to roam.
      Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      28a55f32
    • Vegard Nossum's avatar
      xen/blkback: fix reference counting · 27c3c863
      Vegard Nossum authored
      commit ea5ec76d upstream.
      
      If the permission check fails, we drop a reference to the blkif without
      having taken it in the first place. The bug was introduced in commit
      604c499c (xen/blkback: Check device
      permissions before allowing OP_DISCARD).
      
      Cc: Jan Beulich <JBeulich@suse.com>
      Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: default avatarVegard Nossum <vegard.nossum@oracle.com>
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      27c3c863
    • Theodore Ts'o's avatar
    • Huang Shijie's avatar
      mtd: gpmi: fix the NULL pointer · dba6d8ec
      Huang Shijie authored
      commit 885d71e5 upstream.
      
      The imx23 board will check the fingerprint, so it will call the
      mx23_check_transcription_stamp. This function will use @chip->buffers->databuf
      as its buffer which is allocated in the nand_scan_tail().
      
      Unfortunately, the mx23_check_transcription_stamp is called before the
      nand_scan_tail(). So we will meet a NULL pointer bug:
      
      --------------------------------------------------------------------
      [    1.150000] NAND device: Manufacturer ID: 0xec, Chip ID: 0xd7 (Samsung NAND 4GiB 3,3V 8-bit), 4096MiB, page size: 4096, OOB size: 8
      [    1.160000] Unable to handle kernel NULL pointer dereference at virtual address 000005d0
      [    1.170000] pgd = c0004000
      [    1.170000] [000005d0] *pgd=00000000
      [    1.180000] Internal error: Oops: 5 [#1] ARM
      [    1.180000] Modules linked in:
      [    1.180000] CPU: 0 PID: 1 Comm: swapper Not tainted 3.12.0 #89
      [    1.180000] task: c7440000 ti: c743a000 task.ti: c743a000
      [    1.180000] PC is at memcmp+0x10/0x54
      [    1.180000] LR is at gpmi_nand_probe+0x42c/0x894
      [    1.180000] pc : [<c025fcb0>]    lr : [<c02f6a68>]    psr: 20000053
      [    1.180000] sp : c743be2c  ip : 600000d3  fp : ffffffff
      [    1.180000] r10: 000005d0  r9 : c02f5f08  r8 : 00000000
      [    1.180000] r7 : c75858a8  r6 : c75858a8  r5 : c7585b18  r4 : c7585800
      [    1.180000] r3 : 000005d0  r2 : 00000004  r1 : c05c33e4  r0 : 000005d0
      [    1.180000] Flags: nzCv  IRQs on  FIQs off  Mode SVC_32  ISA ARM  Segment kernel
      [    1.180000] Control: 0005317f  Table: 40004000  DAC: 00000017
      [    1.180000] Process swapper (pid: 1, stack limit = 0xc743a1c0)
      --------------------------------------------------------------------
      
      This patch rearrange the init procedure:
         Set the NAND_SKIP_BBTSCAN to skip the nand scan firstly, and after we
         set the proper settings, we will call the chip->scan_bbt() manually.
      Signed-off-by: default avatarHuang Shijie <b32955@freescale.com>
      Reported-by: default avatarFabio Estevam <festevam@gmail.com>
      Tested-by: default avatarFabio Estevam <fabio.estevam@freescale.com>
      Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      dba6d8ec
    • Huang Shijie's avatar
      mtd: gpmi: fix kernel BUG due to racing DMA operations · 55968759
      Huang Shijie authored
      commit 7b3d2fb9 upstream.
      
      [1] The gpmi uses the nand_command_lp to issue the commands to NAND chips.
          The gpmi issues a DMA operation with gpmi_cmd_ctrl when it handles
          a NAND_CMD_NONE control command. So when we read a page(NAND_CMD_READ0)
          from the NAND, we may send two DMA operations back-to-back.
      
          If we do not serialize the two DMA operations, we will meet a bug when
      
          1.1) we enable CONFIG_DMA_API_DEBUG, CONFIG_DMADEVICES_DEBUG,
               and CONFIG_DEBUG_SG.
      
          1.2) Use the following commands in an UART console and a SSH console:
               cmd 1: while true;do dd if=/dev/mtd0 of=/dev/null;done
               cmd 1: while true;do dd if=/dev/mmcblk0 of=/dev/null;done
      
          The kernel log shows below:
          -----------------------------------------------------------------
          kernel BUG at lib/scatterlist.c:28!
          Unable to handle kernel NULL pointer dereference at virtual address 00000000
            .........................
          [<80044a0c>] (__bug+0x18/0x24) from [<80249b74>] (sg_next+0x48/0x4c)
          [<80249b74>] (sg_next+0x48/0x4c) from [<80255398>] (debug_dma_unmap_sg+0x170/0x1a4)
          [<80255398>] (debug_dma_unmap_sg+0x170/0x1a4) from [<8004af58>] (dma_unmap_sg+0x14/0x6c)
          [<8004af58>] (dma_unmap_sg+0x14/0x6c) from [<8027e594>] (mxs_dma_tasklet+0x18/0x1c)
          [<8027e594>] (mxs_dma_tasklet+0x18/0x1c) from [<8007d444>] (tasklet_action+0x114/0x164)
          -----------------------------------------------------------------
      
          1.3) Assume the two DMA operations is X (first) and Y (second).
      
               The root cause of the bug:
      	   Assume process P issues DMA X, and sleep on the completion
      	 @this->dma_done. X's tasklet callback is dma_irq_callback. It firstly
      	 wake up the process sleeping on the completion @this->dma_done,
      	 and then trid to unmap the scatterlist S. The waked process P will
      	 issue Y in another ARM core. Y initializes S->sg_magic to zero
      	 with sg_init_one(), while dma_irq_callback is unmapping S at the same
      	 time.
      
      	 See the diagram:
      
                         ARM core 0              |         ARM core 1
      	 -------------------------------------------------------------
               (P issues DMA X, then sleep)  --> |
                                                 |
               (X's tasklet wakes P)         --> |
                                                 |
                                                 | <-- (P begin to issue DMA Y)
                                                 |
               (X's tasklet unmap the            |
            scatterlist S with dma_unmap_sg) --> | <-- (Y calls sg_init_one() to init
                                                 |      scatterlist S)
                                                 |
      
      [2] This patch serialize both the X and Y in the following way:
           Unmap the DMA scatterlist S firstly, and wake up the process at the end
           of the DMA callback, in such a way, Y will be executed after X.
      
           After this patch:
      
                         ARM core 0              |         ARM core 1
      	 -------------------------------------------------------------
               (P issues DMA X, then sleep)  --> |
                                                 |
               (X's tasklet unmap the            |
            scatterlist S with dma_unmap_sg) --> |
                                                 |
               (X's tasklet wakes P)         --> |
                                                 |
                                                 | <-- (P begin to issue DMA Y)
                                                 |
                                                 | <-- (Y calls sg_init_one() to init
                                                 |     scatterlist S)
                                                 |
      Signed-off-by: default avatarHuang Shijie <b32955@freescale.com>
      Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      55968759
    • Josh Wu's avatar
      mtd: atmel_nand: fix bug driver will in a dead lock if no nand detected · 8a631f3a
      Josh Wu authored
      commit a749d13a upstream.
      
      In the atmel driver probe function, the code shows like following:
        atmel_nand_probe(...) {
              ...
      
        err_nand_ioremap:
              platform_driver_unregister(&atmel_nand_nfc_driver);
              return res;
        }
      
      If no nand flash detected, the driver probe function will goto
      err_nand_ioremap label.
      Then platform_driver_unregister() will be called. It will get the
      lock of atmel_nand device since it is parent of nfc_device. The
      problem is the lock is already hold by atmel_nand_probe itself.
      So system will be in a dead lock.
      
      This patch just simply removed to platform_driver_unregister() call.
      When atmel_nand driver is quit the platform_driver_unregister() will
      be called in atmel_nand_remove().
      
      [Brian: the NAND platform probe really has no business
       registering/unregistering another driver; this fixes the deadlock, but
       we should follow up the likely racy behavior here with a better
       architecture]
      Signed-off-by: default avatarJosh Wu <josh.wu@atmel.com>
      Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8a631f3a
    • Wang Haitao's avatar
      mtd: map: fixed bug in 64-bit systems · 7524987e
      Wang Haitao authored
      commit a4d62bab upstream.
      
      Hardware:
      	CPU: XLP832,the 64-bit OS
      	NOR Flash:S29GL128S 128M
      Software:
      	Kernel:2.6.32.41
      	Filesystem:JFFS2
      When writing files, errors appear:
      	Write len 182  but return retlen 180
      	Write of 182 bytes at 0x072c815c failed. returned -5, retlen 180
      	Write len 186  but return retlen 184
      	Write of 186 bytes at 0x072caff4 failed. returned -5, retlen 184
      These errors exist only in 64-bit systems,not in 32-bit systems. After analysis, we
      found that the left shift operation is wrong in map_word_load_partial. For instance:
      	unsigned char buf[3] ={0x9e,0x3a,0xea};
      	map_bankwidth(map) is 4;
      	for (i=0; i < 3; i++) {
      		int bitpos;
      		bitpos = (map_bankwidth(map)-1-i)*8;
      		orig.x[0] &= ~(0xff << bitpos);
      		orig.x[0] |= buf[i] << bitpos;
      	}
      
      The value of orig.x[0] is expected to be 0x9e3aeaff, but in this situation(64-bit
      System) we'll get the wrong value of 0xffffffff9e3aeaff due to the 64-bit sign
      extension:
      buf[i] is defined as "unsigned char" and the left-shift operation will convert it
      to the type of "signed int", so when left-shift buf[i] by 24 bits, the final result
      will get the wrong value: 0xffffffff9e3aeaff.
      
      If the left-shift bits are less than 24, then sign extension will not occur. Whereas
      the bankwidth of the nor flash we used is 4, therefore this BUG emerges.
      Signed-off-by: default avatarPang Xunlei <pang.xunlei@zte.com.cn>
      Signed-off-by: default avatarZhang Yi <zhang.yi20@zte.com.cn>
      Signed-off-by: default avatarLu Zhongjun <lu.zhongjun@zte.com.cn>
      Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7524987e
    • Brian Norris's avatar
      mtd: m25p80: fix allocation size · 0e2155be
      Brian Norris authored
      commit 778d226a upstream.
      
      This patch fixes two memory errors:
      
      1. During a probe failure (in mtd_device_parse_register?) the command
         buffer would not be freed.
      
      2. The command buffer's size is determined based on the 'fast_read'
         boolean, but the assignment of fast_read is made after this
         allocation. Thus, the buffer may be allocated "too small".
      
      To fix the first, just switch to the devres version of kzalloc.
      
      To fix the second, increase MAX_CMD_SIZE unconditionally. It's not worth
      saving a byte to fiddle around with the conditions here.
      
      This problem was reported by Yuhang Wang a while back.
      Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
      Reported-by: default avatarYuhang Wang <wangyuhang2014@gmail.com>
      Reviewed-by: default avatarSourav Poddar <sourav.poddar@ti.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0e2155be
    • Brian Norris's avatar
      mtd: nand: hack ONFI for non-power-of-2 dimensions · 87ce636f
      Brian Norris authored
      commit 4355b70c upstream.
      
      Some bright specification writers decided to write this in the ONFI spec
      (from ONFI 3.0, Section 3.1):
      
        "The number of blocks and number of pages per block is not required to
        be a power of two. In the case where one of these values is not a
        power of two, the corresponding address shall be rounded to an
        integral number of bits such that it addresses a range up to the
        subsequent power of two value. The host shall not access upper
        addresses in a range that is shown as not supported."
      
      This breaks every assumption MTD makes about NAND block/chip-size
      dimensions -- they *must* be a power of two!
      
      And of course, an enterprising manufacturer has made use of this lovely
      freedom. Exhibit A: Micron MT29F32G08CBADAWP
      
        "- Plane size: 2 planes x 1064 blocks per plane
         - Device size: 32Gb: 2128 blockss [sic]"
      
      This quickly hits a BUG() in nand_base.c, since the extra dimensions
      overflow so we think it's a second chip (on my single-chip setup):
      
          ONFI param page 0 valid
          ONFI flash detected
          NAND device: Manufacturer ID: 0x2c, Chip ID: 0x44 (Micron MT29F32G08CBADAWP), 4256MiB, page size: 8192, OOB size: 744
          ------------[ cut here ]------------
          kernel BUG at drivers/mtd/nand/nand_base.c:203!
          Internal error: Oops - BUG: 0 [#1] SMP ARM
          [... trim ...]
          [<c02cf3e4>] (nand_select_chip+0x18/0x2c) from [<c02d25c0>] (nand_do_read_ops+0x90/0x424)
          [<c02d25c0>] (nand_do_read_ops+0x90/0x424) from [<c02d2dd8>] (nand_read+0x54/0x78)
          [<c02d2dd8>] (nand_read+0x54/0x78) from [<c02ad2c8>] (mtd_read+0x84/0xbc)
          [<c02ad2c8>] (mtd_read+0x84/0xbc) from [<c02d4b28>] (scan_read.clone.4+0x4c/0x64)
          [<c02d4b28>] (scan_read.clone.4+0x4c/0x64) from [<c02d4c88>] (search_bbt+0x148/0x290)
          [<c02d4c88>] (search_bbt+0x148/0x290) from [<c02d4ea4>] (nand_scan_bbt+0xd4/0x5c0)
          [... trim ...]
          ---[ end trace 0c9363860d865ff2 ]---
      
      So to fix this, just truncate these dimensions down to the greatest
      power-of-2 dimension that is less than or equal to the specified
      dimension.
      Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      87ce636f
    • Mikulas Patocka's avatar
      loop: fix crash when using unassigned loop device · b9762e28
      Mikulas Patocka authored
      commit ef7e7c82 upstream.
      
      When the loop module is loaded, it creates 8 loop devices /dev/loop[0-7].
      The devices have no request routine and thus, when they are used without
      being assigned, a crash happens.
      
      For example, these commands cause crash (assuming there are no used loop
      devices):
      
      Kernel Fault: Code=26 regs=000000007f420980 (Addr=0000000000000010)
      CPU: 1 PID: 50 Comm: kworker/1:1 Not tainted 3.11.0 #1
      Workqueue: ksnaphd do_metadata [dm_snapshot]
      task: 000000007fcf4078 ti: 000000007f420000 task.ti: 000000007f420000
      [  116.319988]
           YZrvWESTHLNXBCVMcbcbcbcbOGFRQPDI
      PSW: 00001000000001001111111100001111 Not tainted
      r00-03  000000ff0804ff0f 00000000408bf5d0 00000000402d8204 000000007b7ff6c0
      r04-07  00000000408a95d0 000000007f420950 000000007b7ff6c0 000000007d06c930
      r08-11  000000007f4205c0 0000000000000001 000000007f4205c0 000000007f4204b8
      r12-15  0000000000000010 0000000000000000 0000000000000000 0000000000000000
      r16-19  000000001108dd48 000000004061cd7c 000000007d859800 000000000800000f
      r20-23  0000000000000000 0000000000000008 0000000000000000 0000000000000000
      r24-27  00000000ffffffff 000000007b7ff6c0 000000007d859800 00000000408a95d0
      r28-31  0000000000000000 000000007f420950 000000007f420980 000000007f4208e8
      sr00-03  0000000000000000 0000000000000000 0000000000000000 0000000000303000
      sr04-07  0000000000000000 0000000000000000 0000000000000000 0000000000000000
      [  117.549988]
      IASQ: 0000000000000000 0000000000000000 IAOQ: 00000000402d82fc 00000000402d8300
       IIR: 53820020    ISR: 0000000000000000  IOR: 0000000000000010
       CPU:        1   CR30: 000000007f420000 CR31: ffffffffffffffff
       ORIG_R28: 0000000000000001
       IAOQ[0]: generic_make_request+0x11c/0x1a0
       IAOQ[1]: generic_make_request+0x120/0x1a0
       RP(r2): generic_make_request+0x24/0x1a0
      Backtrace:
       [<00000000402d83f0>] submit_bio+0x70/0x140
       [<0000000011087c4c>] dispatch_io+0x234/0x478 [dm_mod]
       [<0000000011087f44>] sync_io+0xb4/0x190 [dm_mod]
       [<00000000110883bc>] dm_io+0x2c4/0x310 [dm_mod]
       [<00000000110bfcd0>] do_metadata+0x28/0xb0 [dm_snapshot]
       [<00000000401591d8>] process_one_work+0x160/0x460
       [<0000000040159bc0>] worker_thread+0x300/0x478
       [<0000000040161a70>] kthread+0x118/0x128
       [<0000000040104020>] end_fault_vector+0x20/0x28
       [<0000000040177220>] task_tick_fair+0x420/0x4d0
       [<00000000401aa048>] invoke_rcu_core+0x50/0x60
       [<00000000401ad5b8>] rcu_check_callbacks+0x210/0x8d8
       [<000000004014aaa0>] update_process_times+0xa8/0xc0
       [<00000000401ab86c>] rcu_process_callbacks+0x4b4/0x598
       [<0000000040142408>] __do_softirq+0x250/0x2c0
       [<00000000401789d0>] find_busiest_group+0x3c0/0xc70
      [  119.379988]
      Kernel panic - not syncing: Kernel Fault
      Rebooting in 1 seconds..
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b9762e28
    • Mikulas Patocka's avatar
      loop: fix crash if blk_alloc_queue fails · ec25370c
      Mikulas Patocka authored
      commit 3ec981e3 upstream.
      
      loop: fix crash if blk_alloc_queue fails
      
      If blk_alloc_queue fails, loop_add cleans up, but it doesn't clean up the
      identifier allocated with idr_alloc. That causes crash on module unload in
      idr_for_each(&loop_index_idr, &loop_exit_cb, NULL); where we attempt to
      remove non-existed device with that id.
      
      BUG: unable to handle kernel NULL pointer dereference at 0000000000000380
      IP: [<ffffffff812057c9>] del_gendisk+0x19/0x2d0
      PGD 43d399067 PUD 43d0ad067 PMD 0
      Oops: 0000 [#1] PREEMPT SMP
      Modules linked in: loop(-) dm_snapshot dm_zero dm_mirror dm_region_hash dm_log dm_loop dm_mod ip6table_filter ip6_tables uvesafb cfbcopyarea cfbimgblt cfbfillrect fbcon font bitblit fbcon_rotate fbcon_cw fbcon_ud fbcon_ccw softcursor fb fbdev msr ipt_MASQUERADE iptable_nat nf_nat_ipv4 nf_conntrack_ipv4 nf_defrag_ipv4 xt_state ipt_REJECT xt_tcpudp iptable_filter ip_tables x_tables bridge stp llc tun ipv6 cpufreq_userspace cpufreq_stats cpufreq_ondemand cpufreq_conservative cpufreq_powersave spadfs fuse hid_generic usbhid hid raid0 md_mod dmi_sysfs nf_nat_ftp nf_nat nf_conntrack_ftp nf_conntrack snd_usb_audio snd_pcm_oss snd_mixer_oss snd_pcm snd_timer snd_page_alloc lm85 hwmon_vid snd_hwdep snd_usbmidi_lib snd_rawmidi snd soundcore acpi_cpufreq ohci_hcd freq_table tg3 ehci_pci mperf ehci_hcd kvm_amd kvm sata_svw serverworks libphy libata ide_core k10temp usbcore hwmon microcode ptp pcspkr pps_core e100 skge mii usb_common i2c_piix4 floppy evdev rtc_cmos i2c_core processor but!
       ton unix
      CPU: 7 PID: 2735 Comm: rmmod Tainted: G        W    3.10.15-devel #15
      Hardware name: empty empty/S3992-E, BIOS 'V1.06   ' 06/09/2009
      task: ffff88043d38e780 ti: ffff88043d21e000 task.ti: ffff88043d21e000
      RIP: 0010:[<ffffffff812057c9>]  [<ffffffff812057c9>] del_gendisk+0x19/0x2d0
      RSP: 0018:ffff88043d21fe10  EFLAGS: 00010282
      RAX: ffffffffa05102e0 RBX: 0000000000000000 RCX: 0000000000000000
      RDX: 0000000000000000 RSI: ffff88043ea82800 RDI: 0000000000000000
      RBP: ffff88043d21fe48 R08: 0000000000000000 R09: 0000000000000001
      R10: 0000000000000001 R11: 0000000000000000 R12: 00000000000000ff
      R13: 0000000000000080 R14: 0000000000000000 R15: ffff88043ea82800
      FS:  00007ff646534700(0000) GS:ffff880447000000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
      CR2: 0000000000000380 CR3: 000000043e9bf000 CR4: 00000000000007e0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
      Stack:
       ffffffff8100aba4 0000000000000092 ffff88043d21fe48 ffff88043ea82800
       00000000000000ff ffff88043d21fe98 0000000000000000 ffff88043d21fe60
       ffffffffa05102b4 0000000000000000 ffff88043d21fe70 ffffffffa05102ec
      Call Trace:
       [<ffffffff8100aba4>] ? native_sched_clock+0x24/0x80
       [<ffffffffa05102b4>] loop_remove+0x14/0x40 [loop]
       [<ffffffffa05102ec>] loop_exit_cb+0xc/0x10 [loop]
       [<ffffffff81217b74>] idr_for_each+0x104/0x190
       [<ffffffffa05102e0>] ? loop_remove+0x40/0x40 [loop]
       [<ffffffff8109adc5>] ? trace_hardirqs_on_caller+0x105/0x1d0
       [<ffffffffa05135dc>] loop_exit+0x34/0xa58 [loop]
       [<ffffffff810a98ea>] SyS_delete_module+0x13a/0x260
       [<ffffffff81221d5e>] ? trace_hardirqs_on_thunk+0x3a/0x3f
       [<ffffffff813cff16>] system_call_fastpath+0x1a/0x1f
      Code: f0 4c 8b 6d f8 c9 c3 66 66 2e 0f 1f 84 00 00 00 00 00 55 48 89 e5 41 56 41 55 4c 8d af 80 00 00 00 41 54 53 48 89 fb 48 83 ec 18 <48> 83 bf 80 03 00
      00 00 74 4d e8 98 fe ff ff 31 f6 48 c7 c7 20
      RIP  [<ffffffff812057c9>] del_gendisk+0x19/0x2d0
       RSP <ffff88043d21fe10>
      CR2: 0000000000000380
      ---[ end trace 64ec069ec70f1309 ]---
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Acked-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ec25370c
    • Bart Van Assche's avatar
      IB/srp: Report receive errors correctly · cd8875d6
      Bart Van Assche authored
      commit cd4e3854 upstream.
      
      The IB spec does not guarantee that the opcode is available in error
      completions.  Hence do not rely on it.  See also commit 948d1e88
      ("IB/srp: Introduce srp_handle_qp_err()").
      Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
      Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      cd8875d6