1. 20 Dec, 2013 2 commits
    • Stefano Panella's avatar
      ALSA: memalloc.h - fix wrong truncation of dma_addr_t · 50a715f2
      Stefano Panella authored
      commit 932e9dec upstream.
      
      When running a 32bit kernel the hda_intel driver is still reporting
      a 64bit dma_mask if the HW supports it.
      
      From sound/pci/hda/hda_intel.c:
      
              /* allow 64bit DMA address if supported by H/W */
              if ((gcap & ICH6_GCAP_64OK) && !pci_set_dma_mask(pci, DMA_BIT_MASK(64)))
                      pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(64));
              else {
                      pci_set_dma_mask(pci, DMA_BIT_MASK(32));
                      pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32));
              }
      
      which means when there is a call to dma_alloc_coherent from
      snd_malloc_dev_pages a machine address bigger than 32bit can be returned.
      This can be true in particular if running  the 32bit kernel as a pv dom0
      under the Xen Hypervisor or PAE on bare metal.
      
      The problem is that when calling setup_bdle to program the BLE the
      dma_addr_t returned from the dma_alloc_coherent is wrongly truncated
      from snd_sgbuf_get_addr if running a 32bit kernel:
      
      static inline dma_addr_t snd_sgbuf_get_addr(struct snd_dma_buffer *dmab,
                                                 size_t offset)
      {
              struct snd_sg_buf *sgbuf = dmab->private_data;
              dma_addr_t addr = sgbuf->table[offset >> PAGE_SHIFT].addr;
              addr &= PAGE_MASK;
              return addr + offset % PAGE_SIZE;
      }
      
      where PAGE_MASK in a 32bit kernel is zeroing the upper 32bit af addr.
      
      Without this patch the HW will fetch the 32bit truncated address,
      which is not the one obtained from dma_alloc_coherent and will result
      to a non working audio but can corrupt host memory at a random location.
      
      The current patch apply to v3.13-rc3-74-g6c843f5
      Signed-off-by: default avatarStefano Panella <stefano.panella@citrix.com>
      Reviewed-by: default avatarFrediano Ziglio <frediano.ziglio@citrix.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      50a715f2
    • Jim Quinlan's avatar
      MIPS: DMA: For BMIPS5000 cores flush region just like non-coherent R10000 · a6079a37
      Jim Quinlan authored
      commit f86f55d3 upstream.
      
      The BMIPS5000 (Zephyr) processor utilizes instruction speculation. A
      stale misprediction address in either the JTB or the CRS may trigger
      a prefetch inside a region that is currently being used by a DMA engine,
      which is not IO-coherent.  This prefetch will fetch a line into the
      scache, and that line will soon become stale (ie wrong) during/after the
      DMA.  Mayhem ensues.
      
      In dma-default.c, the r10000 is handled as a special case in the same way
      that we want to handle Zephyr.  So we generalize the exception cases into
      a function, and include Zephyr as one of the processors that needs this
      special care.
      Signed-off-by: default avatarJim Quinlan <jim2101024@gmail.com>
      Cc: linux-mips@linux-mips.org
      Cc: cernekee@gmail.com
      Patchwork: https://patchwork.linux-mips.org/patch/5776/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      Cc: John Ulvr <julvr@broadcom.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a6079a37
  2. 12 Dec, 2013 27 commits
  3. 08 Dec, 2013 11 commits
    • Greg Kroah-Hartman's avatar
      Linux 3.4.73 · 50b673d2
      Greg Kroah-Hartman authored
      50b673d2
    • Mikulas Patocka's avatar
      blk-core: Fix memory corruption if blkcg_init_queue fails · 78530a1a
      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>
      78530a1a
    • Mikulas Patocka's avatar
      dm: fix truncated status strings · d8b8a43e
      Mikulas Patocka authored
      commit fd7c092e upstream.
      
      Avoid returning a truncated table or status string instead of setting
      the DM_BUFFER_FULL_FLAG when the last target of a table fills the
      buffer.
      
      When processing a table or status request, the function retrieve_status
      calls ti->type->status. If ti->type->status returns non-zero,
      retrieve_status assumes that the buffer overflowed and sets
      DM_BUFFER_FULL_FLAG.
      
      However, targets don't return non-zero values from their status method
      on overflow. Most targets returns always zero.
      
      If a buffer overflow happens in a target that is not the last in the
      table, it gets noticed during the next iteration of the loop in
      retrieve_status; but if a buffer overflow happens in the last target, it
      goes unnoticed and erroneously truncated data is returned.
      
      In the current code, the targets behave in the following way:
      * dm-crypt returns -ENOMEM if there is not enough space to store the
        key, but it returns 0 on all other overflows.
      * dm-thin returns errors from the status method if a disk error happened.
        This is incorrect because retrieve_status doesn't check the error
        code, it assumes that all non-zero values mean buffer overflow.
      * all the other targets always return 0.
      
      This patch changes the ti->type->status function to return void (because
      most targets don't use the return code). Overflow is detected in
      retrieve_status: if the status method fills up the remaining space
      completely, it is assumed that buffer overflow happened.
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d8b8a43e
    • Tomoki Sekiyama's avatar
      elevator: acquire q->sysfs_lock in elevator_change() · 9e23d8bd
      Tomoki Sekiyama authored
      commit 7c8a3679 upstream.
      
      Add locking of q->sysfs_lock into elevator_change() (an exported function)
      to ensure it is held to protect q->elevator from elevator_init(), even if
      elevator_change() is called from non-sysfs paths.
      sysfs path (elv_iosched_store) uses __elevator_change(), non-locking
      version, as the lock is already taken by elv_iosched_store().
      Signed-off-by: default avatarTomoki Sekiyama <tomoki.sekiyama@hds.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Cc: Josh Boyer <jwboyer@fedoraproject.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9e23d8bd
    • Julian Stecklina's avatar
      iommu/vt-d: Fixed interaction of VFIO_IOMMU_MAP_DMA with IOMMU address limits · 3dc062d2
      Julian Stecklina authored
      commit f9423606 upstream.
      
      The BUG_ON in drivers/iommu/intel-iommu.c:785 can be triggered from userspace via
      VFIO by calling the VFIO_IOMMU_MAP_DMA ioctl on a vfio device with any address
      beyond the addressing capabilities of the IOMMU. The problem is that the ioctl code
      calls iommu_iova_to_phys before it calls iommu_map. iommu_map handles the case that
      it gets addresses beyond the addressing capabilities of its IOMMU.
      intel_iommu_iova_to_phys does not.
      
      This patch fixes iommu_iova_to_phys to return NULL for addresses beyond what the
      IOMMU can handle. This in turn causes the ioctl call to fail in iommu_map and
      (correctly) return EFAULT to the user with a helpful warning message in the kernel
      log.
      Signed-off-by: default avatarJulian Stecklina <jsteckli@os.inf.tu-dresden.de>
      Acked-by: default avatarAlex Williamson <alex.williamson@redhat.com>
      Signed-off-by: default avatarJoerg Roedel <joro@8bytes.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3dc062d2
    • Sasha Levin's avatar
      video: kyro: fix incorrect sizes when copying to userspace · 6fa8c5d6
      Sasha Levin authored
      commit 2ab68ec9 upstream.
      
      kyro would copy u32s and specify sizeof(unsigned long) as the size to copy.
      
      This would copy more data than intended and cause memory corruption and might
      leak kernel memory.
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6fa8c5d6
    • Stanislav Kinsbursky's avatar
      nfsd: use "init_net" for portmapper · b79811fc
      Stanislav Kinsbursky authored
      commit f7fb86c6 upstream.
      
      There could be a situation, when NFSd was started in one network namespace, but
      stopped in another one.
      This will trigger kernel panic, because RPCBIND client is stored on per-net
      NFSd data, and will be NULL on NFSd shutdown.
      Signed-off-by: default avatarStanislav Kinsbursky <skinsbursky@parallels.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      Signed-off-by: default avatarWeng Meiling <wengmeiling.weng@huawei.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b79811fc
    • KOBAYASHI Yoshitake's avatar
      mmc: block: fix a bug of error handling in MMC driver · 98048d9b
      KOBAYASHI Yoshitake authored
      commit c8760069 upstream.
      
      Current MMC driver doesn't handle generic error (bit19 of device
      status) in write sequence. As a result, write data gets lost when
      generic error occurs. For example, a generic error when updating a
      filesystem management information causes a loss of write data and
      corrupts the filesystem. In the worst case, the system will never
      boot.
      
      This patch includes the following functionality:
        1. To enable error checking for the response of CMD12 and CMD13
           in write command sequence
        2. To retry write sequence when a generic error occurs
      
      Messages are added for v2 to show what occurs.
      Signed-off-by: default avatarKOBAYASHI Yoshitake <yoshitake.kobayashi@toshiba.co.jp>
      Signed-off-by: default avatarChris Ball <cjb@laptop.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      98048d9b
    • Kees Cook's avatar
      HID: picolcd_core: validate output report details · 12c1f610
      Kees Cook authored
      commit 1e87a245 upstream.
      
      A HID device could send a malicious output report that would cause the
      picolcd HID driver to trigger a NULL dereference during attr file writing.
      
      [jkosina@suse.cz: changed
      
      	report->maxfield < 1
      
      to
      
      	report->maxfield != 1
      
      as suggested by Bruno].
      
      CVE-2013-2899
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Cc: stable@kernel.org
      Reviewed-by: default avatarBruno Prémont <bonbons@linux-vserver.org>
      Acked-by: default avatarBruno Prémont <bonbons@linux-vserver.org>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      [Kefeng: backported to stable 3.4: adjust filename]
      Signed-off-by: default avatarKefeng Wang <wangkefeng.wang@huawei.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      12c1f610
    • fan.du's avatar
      {pktgen, xfrm} Update IPv4 header total len and checksum after tranformation · d92c9bfe
      fan.du authored
      [ Upstream commit 3868204d ]
      
      commit a553e4a6 ("[PKTGEN]: IPSEC support")
      tried to support IPsec ESP transport transformation for pktgen, but acctually
      this doesn't work at all for two reasons(The orignal transformed packet has
      bad IPv4 checksum value, as well as wrong auth value, reported by wireshark)
      
      - After transpormation, IPv4 header total length needs update,
        because encrypted payload's length is NOT same as that of plain text.
      
      - After transformation, IPv4 checksum needs re-caculate because of payload
        has been changed.
      
      With this patch, armmed pktgen with below cofiguration, Wireshark is able to
      decrypted ESP packet generated by pktgen without any IPv4 checksum error or
      auth value error.
      
      pgset "flag IPSEC"
      pgset "flows 1"
      Signed-off-by: default avatarFan Du <fan.du@windriver.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d92c9bfe
    • Hannes Frederic Sowa's avatar
      ipv6: fix possible seqlock deadlock in ip6_finish_output2 · 8799b15a
      Hannes Frederic Sowa authored
      [ Upstream commit 7f88c6b2 ]
      
      IPv6 stats are 64 bits and thus are protected with a seqlock. By not
      disabling bottom-half we could deadlock here if we don't disable bh and
      a softirq reentrantly updates the same mib.
      
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: default avatarHannes Frederic Sowa <hannes@stressinduktion.org>
      Acked-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8799b15a