1. 17 12月, 2015 1 次提交
    • D
      dma-debug: Fix dma_debug_entry offset calculation · 0354aec1
      Daniel Mentz 提交于
      dma-debug uses struct dma_debug_entry to keep track of dma coherent
      memory allocation requests. The virtual address is converted into a pfn
      and an offset. Previously, the offset was calculated using an incorrect
      bit mask.  As a result, we saw incorrect error messages from dma-debug
      like the following:
      
      "DMA-API: exceeded 7 overlapping mappings of cacheline 0x03e00000"
      
      Cacheline 0x03e00000 does not exist on our platform.
      
      Cc: <stable@vger.kernel.org>
      Fixes: 0abdd7a8 ("dma-debug: introduce debug_dma_assert_idle()")
      Signed-off-by: NDaniel Mentz <danielmentz@google.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      0354aec1
  2. 07 11月, 2015 1 次提交
  3. 04 10月, 2015 1 次提交
  4. 18 7月, 2015 1 次提交
    • H
      dma-debug: skip debug_dma_assert_idle() when disabled · c9d120b0
      Haggai Eran 提交于
      If dma-debug is disabled due to a memory error, DMA unmaps do not affect
      the dma_active_cacheline radix tree anymore, and debug_dma_assert_idle()
      can print false warnings.
      
      Disable debug_dma_assert_idle() when dma_debug_disabled() is true.
      Signed-off-by: NHaggai Eran <haggaie@mellanox.com>
      Fixes: 0abdd7a8 ("dma-debug: introduce debug_dma_assert_idle()")
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Joerg Roedel <joro@8bytes.org>
      Cc: Vinod Koul <vinod.koul@intel.com>
      Cc: Russell King <rmk+kernel@arm.linux.org.uk>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: Florian Fainelli <f.fainelli@gmail.com>
      Cc: Sebastian Ott <sebott@linux.vnet.ibm.com>
      Cc: Jiri Kosina <jkosina@suse.cz>
      Cc: Horia Geanta <horia.geanta@freescale.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      c9d120b0
  5. 17 4月, 2015 1 次提交
    • S
      lib/dma-debug: fix bucket_find_contain() · a7a2c02a
      Sebastian Ott 提交于
      bucket_find_contain() will search the bucket list for a dma_debug_entry.
      When the entry isn't found it needs to search other buckets too, since
      only the start address of a dma range is hashed (which might be in a
      different bucket).
      
      A copy of the dma_debug_entry is used to get the previous hash bucket
      but when its list is searched the original dma_debug_entry is to be used
      not its modified copy.
      
      This fixes false "device driver tries to sync DMA memory it has not allocated"
      warnings.
      Signed-off-by: NSebastian Ott <sebott@linux.vnet.ibm.com>
      Cc: Florian Fainelli <f.fainelli@gmail.com>
      Cc: Horia Geanta <horia.geanta@freescale.com>
      Cc: Jiri Kosina <jkosina@suse.cz>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      a7a2c02a
  6. 11 12月, 2014 2 次提交
    • F
      dma-debug: prevent early callers from crashing · 2ce8e7ed
      Florian Fainelli 提交于
      dma_debug_init() is called by architecture specific code at different
      levels, but typically as a fs_initcall due to the debugfs initialization.
      Some platforms may have early callers of the DMA-API, running prior to the
      fs_initcall() level, which is not much of an issue unless
      CONFIG_DMA_API_DEBUG is set.  When the DMA-API debugging facilities are
      turned on a caller will go through:
      
      debug_dma_map_{single,page}
        -> dma_mapping_error (inline function usually)
          -> debug_dma_mapping_error
            -> get_hash_bucket
      
      Calling get_hash_bucket() returns a valid hash value since we hash on high
      bits of the dma_addr cookie, but we will grab an unitialized spinlock,
      which typically won't crash but produce a warning, the real crash will
      however happen during the bucket list traversal because the list has not
      been initialized yet.
      
      An obvious solution is of course to move some of the offenders to run
      after the fs_initcall level, but since this might not always be an option,
      we add a flag "dma_debug_initialized" which is set to false by default,
      and set to true once dma_debug_init() has had a chance to run.
      
      The dma_debug_disabled() helper function previously introduced just needs
      to check for dma_debug_initialized to allow the caller to proceed or not.
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Jiri Kosina <jkosina@suse.cz>
      Cc: Horia Geanta <horia.geanta@freescale.com>
      Cc: Brian Norris <computersforpeace@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      2ce8e7ed
    • F
      dma-debug: introduce dma_debug_disabled · 01ce18b3
      Florian Fainelli 提交于
      Add a helper function which returns whether the DMA debugging API is
      disabled, right now we only check for global_disable, but in order to
      accommodate early callers of the DMA-API, we will check for more
      initialization flags in the next patch.
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Jiri Kosina <jkosina@suse.cz>
      Cc: Horia Geanta <horia.geanta@freescale.com>
      Cc: Brian Norris <computersforpeace@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      01ce18b3
  7. 02 9月, 2014 1 次提交
  8. 04 3月, 2014 1 次提交
  9. 30 1月, 2014 1 次提交
  10. 22 1月, 2014 1 次提交
    • D
      dma-debug: introduce debug_dma_assert_idle() · 0abdd7a8
      Dan Williams 提交于
      Record actively mapped pages and provide an api for asserting a given
      page is dma inactive before execution proceeds.  Placing
      debug_dma_assert_idle() in cow_user_page() flagged the violation of the
      dma-api in the NET_DMA implementation (see commit 77873803 "net_dma:
      mark broken").
      
      The implementation includes the capability to count, in a limited way,
      repeat mappings of the same page that occur without an intervening
      unmap.  This 'overlap' counter is limited to the few bits of tag space
      in a radix tree.  This mechanism is added to mitigate false negative
      cases where, for example, a page is dma mapped twice and
      debug_dma_assert_idle() is called after the page is un-mapped once.
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      Cc: Joerg Roedel <joro@8bytes.org>
      Cc: Vinod Koul <vinod.koul@intel.com>
      Cc: Russell King <rmk+kernel@arm.linux.org.uk>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      0abdd7a8
  11. 23 3月, 2013 2 次提交
    • A
      dma-debug: update DMA debug API to better handle multiple mappings of a buffer · 96e7d7a1
      Alexander Duyck 提交于
      There were reports of the igb driver unmapping buffers without calling
      dma_mapping_error.  On closer inspection issues were found in the DMA
      debug API and how it handled multiple mappings of the same buffer.
      
      The issue I found is the fact that the debug_dma_mapping_error would
      only set the map_err_type to MAP_ERR_CHECKED in the case that the was
      only one match for device and device address.  However in the case of
      non-IOMMU, multiple addresses existed and as a result it was not setting
      this field once a second mapping was instantiated.  I have resolved this
      by changing the search so that it instead will now set MAP_ERR_CHECKED
      on the first buffer that matches the device and DMA address that is
      currently in the state MAP_ERR_NOT_CHECKED.
      
      A secondary side effect of this patch is that in the case of multiple
      buffers using the same address only the last mapping will have a valid
      map_err_type.  The previous mappings will all end up with map_err_type
      set to MAP_ERR_CHECKED because of the dma_mapping_error call in
      debug_dma_map_page.  However this behavior may be preferable as it means
      you will likely only see one real error per multi-mapped buffer, versus
      the current behavior of multiple false errors mer multi-mapped buffer.
      Signed-off-by: NAlexander Duyck <alexander.h.duyck@intel.com>
      Cc: Joerg Roedel <joro@8bytes.org>
      Reviewed-by: NShuah Khan <shuah.khan@hp.com>
      Tested-by: NShuah Khan <shuah.khan@hp.com>
      Cc: Jakub Kicinski <kubakici@wp.pl>
      Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      96e7d7a1
    • A
      dma-debug: fix locking bug in check_unmap() · 8d640a51
      Alexander Duyck 提交于
      In check_unmap() it is possible to get into a dead-locked state if
      dma_mapping_error is called.  The problem is that the bucket is locked in
      check_unmap, and locked again by debug_dma_mapping_error which is called
      by dma_mapping_error.  To resolve that we must release the lock on the
      bucket before making the call to dma_mapping_error.
      
      [akpm@linux-foundation.org: restore 80-col trickery to be consistent with the rest of the file]
      Signed-off-by: NAlexander Duyck <alexander.h.duyck@intel.com>
      Cc: Joerg Roedel <joro@8bytes.org>
      Reviewed-by: NShuah Khan <shuah.khan@hp.com>
      Tested-by: NShuah Khan <shuah.khan@hp.com>
      Cc: Jakub Kicinski <kubakici@wp.pl>
      Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      8d640a51
  12. 17 11月, 2012 1 次提交
  13. 24 10月, 2012 1 次提交
    • S
      dma-debug: New interfaces to debug dma mapping errors · 6c9c6d63
      Shuah Khan 提交于
      Add dma-debug interface debug_dma_mapping_error() to debug
      drivers that fail to check dma mapping errors on addresses
      returned by dma_map_single() and dma_map_page() interfaces.
      This interface clears a flag set by debug_dma_map_page() to
      indicate that dma_mapping_error() has been called by the
      driver. When driver does unmap, debug_dma_unmap() checks the
      flag and if this flag is still set, prints warning message
      that includes call trace that leads up to the unmap. This
      interface can be called from dma_mapping_error() routines to
      enable dma mapping error check debugging.
      
      Tested: Intel iommu and swiotlb (iommu=soft) on x86-64 with
              CONFIG_DMA_API_DEBUG enabled and disabled.
      Signed-off-by: NShuah Khan <shuah.khan@hp.com>
      Reviewed-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: NJoerg Roedel <joerg.roedel@amd.com>
      6c9c6d63
  14. 20 10月, 2012 1 次提交
  15. 02 10月, 2012 1 次提交
  16. 02 7月, 2012 1 次提交
  17. 12 4月, 2012 1 次提交
  18. 25 1月, 2012 1 次提交
    • A
      Remove useless get_driver()/put_driver() calls · f3ff9247
      Alan Stern 提交于
      As part of the removal of get_driver()/put_driver(), this patch
      (as1512) gets rid of various useless and unnecessary calls in several
      drivers.  In some cases it may be desirable to pin the driver by
      calling try_module_get(), but that can be done later.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: "David S. Miller" <davem@davemloft.net>
      CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      CC: Michael Buesch <m@bues.ch>
      CC: Joerg Roedel <joerg.roedel@amd.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      f3ff9247
  19. 21 11月, 2011 1 次提交
  20. 01 11月, 2011 1 次提交
  21. 23 8月, 2011 1 次提交
    • N
      dma-debug: hash_bucket_find needs to allow for offsets within an entry · c6a21d0b
      Neil Horman 提交于
      Summary:
      Users of the pci_dma_sync_single_* api allow users to sync address ranges within
      the range of a mapped entry (i.e. you can dma map address X to dma_addr_t A and
      then pci_dma_sync_single on dma_addr_t A+1.  The dma-debug library however
      assume dma syncs will always occur using the base address of a mapped region,
      and uses that assumption to find entries in its hash table.  Since thats often
      (but not always the case), the dma debug library can give us false errors about
      missing entries, which are reported as syncing of memory not allocated by the
      driver.  This was noted in the cxgb3 driver as this error:
      
      WARNING: at lib/dma-debug.c:902 check_sync+0xdd/0x48c()
      Hardware name: To be filled by O.E.M.
      cxgb3 0000:01:00.0: DMA-API: device driver tries to sync DMA memory it has not
      allocated [device address=0x00000000fff97800] [size=1984 bytes]
      Modules linked in: autofs4 sunrpc cpufreq_ondemand acpi_cpufreq freq_table
      mperf ip6t_REJECT nf_conntrack_ipv6 ip6table_filter ip6_tables ipv6 uinput
      snd_hda_codec_intelhdmi snd_hda_codec_realtek snd_hda_intel snd_hda_codec
      snd_hwdep snd_seq snd_seq_device snd_pcm snd_timer e1000e snd soundcore r8169
      cxgb3 iTCO_wdt snd_page_alloc mii shpchp i2c_i801 iTCO_vendor_support mdio
      microcode firewire_ohci firewire_core crc_itu_t ata_generic pata_acpi i915
      drm_kms_helper drm i2c_algo_bit i2c_core video output [last unloaded:
      scsi_wait_scan]
      Pid: 1818, comm: ifconfig Not tainted 2.6.35-0.23.rc3.git6.fc14.x86_64 #1
      Call Trace:
      [<ffffffff81050f71>] warn_slowpath_common+0x85/0x9d
      [<ffffffff8105102c>] warn_slowpath_fmt+0x46/0x48
      [<ffffffff8124658e>] ? check_sync+0x39/0x48c
      [<ffffffff8107c470>] ? trace_hardirqs_on+0xd/0xf
      [<ffffffff81246632>] check_sync+0xdd/0x48c
      [<ffffffff81246ca6>] debug_dma_sync_single_for_device+0x3f/0x41
      [<ffffffffa011615c>] ? pci_map_page+0x84/0x97 [cxgb3]
      [<ffffffffa0117bc3>] pci_dma_sync_single_for_device.clone.0+0x65/0x6e [cxgb3]
      [<ffffffffa0117ed1>] refill_fl+0x305/0x30a [cxgb3]
      [<ffffffffa011857d>] t3_sge_alloc_qset+0x6a7/0x821 [cxgb3]
      [<ffffffffa010a07b>] cxgb_up+0x4d0/0xe62 [cxgb3]
      [<ffffffff81086037>] ? __module_text_address+0x12/0x58
      [<ffffffffa010aa4c>] cxgb_open+0x3f/0x309 [cxgb3]
      [<ffffffff813e9f6c>] __dev_open+0x8e/0xbc
      [<ffffffff813e7ca5>] __dev_change_flags+0xbe/0x142
      [<ffffffff813e9ea8>] dev_change_flags+0x21/0x57
      [<ffffffff81445937>] devinet_ioctl+0x29a/0x54b
      [<ffffffff811f9a87>] ? inode_has_perm+0xaa/0xce
      [<ffffffff81446ed2>] inet_ioctl+0x8f/0xa7
      [<ffffffff813d683a>] sock_do_ioctl+0x29/0x48
      [<ffffffff813d6c83>] sock_ioctl+0x213/0x222
      [<ffffffff81137f78>] vfs_ioctl+0x32/0xa6
      [<ffffffff811384e2>] do_vfs_ioctl+0x47a/0x4b3
      [<ffffffff81138571>] sys_ioctl+0x56/0x79
      [<ffffffff81009c32>] system_call_fastpath+0x16/0x1b
      ---[ end trace 69a4d4cc77b58004 ]---
      
      (some edits by Joerg Roedel)
      Signed-off-by: NNeil Horman <nhorman@tuxdriver.com>
      Reported-by: NJay Fenalson <fenlason@redhat.com>
      CC: Divy LeRay <divy@chelsio.com>
      CC: Stanislaw Gruszka <sgruszka@redhat.com>
      CC: Joerg Roedel <joerg.roedel@amd.com>
      CC: Arnd Bergmann <arnd@arndb.de>
      Signed-off-by: NJoerg Roedel <joerg.roedel@amd.com>
      c6a21d0b
  22. 07 4月, 2011 1 次提交
  23. 15 10月, 2010 1 次提交
    • A
      llseek: automatically add .llseek fop · 6038f373
      Arnd Bergmann 提交于
      All file_operations should get a .llseek operation so we can make
      nonseekable_open the default for future file operations without a
      .llseek pointer.
      
      The three cases that we can automatically detect are no_llseek, seq_lseek
      and default_llseek. For cases where we can we can automatically prove that
      the file offset is always ignored, we use noop_llseek, which maintains
      the current behavior of not returning an error from a seek.
      
      New drivers should normally not use noop_llseek but instead use no_llseek
      and call nonseekable_open at open time.  Existing drivers can be converted
      to do the same when the maintainer knows for certain that no user code
      relies on calling seek on the device file.
      
      The generated code is often incorrectly indented and right now contains
      comments that clarify for each added line why a specific variant was
      chosen. In the version that gets submitted upstream, the comments will
      be gone and I will manually fix the indentation, because there does not
      seem to be a way to do that using coccinelle.
      
      Some amount of new code is currently sitting in linux-next that should get
      the same modifications, which I will do at the end of the merge window.
      
      Many thanks to Julia Lawall for helping me learn to write a semantic
      patch that does all this.
      
      ===== begin semantic patch =====
      // This adds an llseek= method to all file operations,
      // as a preparation for making no_llseek the default.
      //
      // The rules are
      // - use no_llseek explicitly if we do nonseekable_open
      // - use seq_lseek for sequential files
      // - use default_llseek if we know we access f_pos
      // - use noop_llseek if we know we don't access f_pos,
      //   but we still want to allow users to call lseek
      //
      @ open1 exists @
      identifier nested_open;
      @@
      nested_open(...)
      {
      <+...
      nonseekable_open(...)
      ...+>
      }
      
      @ open exists@
      identifier open_f;
      identifier i, f;
      identifier open1.nested_open;
      @@
      int open_f(struct inode *i, struct file *f)
      {
      <+...
      (
      nonseekable_open(...)
      |
      nested_open(...)
      )
      ...+>
      }
      
      @ read disable optional_qualifier exists @
      identifier read_f;
      identifier f, p, s, off;
      type ssize_t, size_t, loff_t;
      expression E;
      identifier func;
      @@
      ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off)
      {
      <+...
      (
         *off = E
      |
         *off += E
      |
         func(..., off, ...)
      |
         E = *off
      )
      ...+>
      }
      
      @ read_no_fpos disable optional_qualifier exists @
      identifier read_f;
      identifier f, p, s, off;
      type ssize_t, size_t, loff_t;
      @@
      ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off)
      {
      ... when != off
      }
      
      @ write @
      identifier write_f;
      identifier f, p, s, off;
      type ssize_t, size_t, loff_t;
      expression E;
      identifier func;
      @@
      ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off)
      {
      <+...
      (
        *off = E
      |
        *off += E
      |
        func(..., off, ...)
      |
        E = *off
      )
      ...+>
      }
      
      @ write_no_fpos @
      identifier write_f;
      identifier f, p, s, off;
      type ssize_t, size_t, loff_t;
      @@
      ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off)
      {
      ... when != off
      }
      
      @ fops0 @
      identifier fops;
      @@
      struct file_operations fops = {
       ...
      };
      
      @ has_llseek depends on fops0 @
      identifier fops0.fops;
      identifier llseek_f;
      @@
      struct file_operations fops = {
      ...
       .llseek = llseek_f,
      ...
      };
      
      @ has_read depends on fops0 @
      identifier fops0.fops;
      identifier read_f;
      @@
      struct file_operations fops = {
      ...
       .read = read_f,
      ...
      };
      
      @ has_write depends on fops0 @
      identifier fops0.fops;
      identifier write_f;
      @@
      struct file_operations fops = {
      ...
       .write = write_f,
      ...
      };
      
      @ has_open depends on fops0 @
      identifier fops0.fops;
      identifier open_f;
      @@
      struct file_operations fops = {
      ...
       .open = open_f,
      ...
      };
      
      // use no_llseek if we call nonseekable_open
      ////////////////////////////////////////////
      @ nonseekable1 depends on !has_llseek && has_open @
      identifier fops0.fops;
      identifier nso ~= "nonseekable_open";
      @@
      struct file_operations fops = {
      ...  .open = nso, ...
      +.llseek = no_llseek, /* nonseekable */
      };
      
      @ nonseekable2 depends on !has_llseek @
      identifier fops0.fops;
      identifier open.open_f;
      @@
      struct file_operations fops = {
      ...  .open = open_f, ...
      +.llseek = no_llseek, /* open uses nonseekable */
      };
      
      // use seq_lseek for sequential files
      /////////////////////////////////////
      @ seq depends on !has_llseek @
      identifier fops0.fops;
      identifier sr ~= "seq_read";
      @@
      struct file_operations fops = {
      ...  .read = sr, ...
      +.llseek = seq_lseek, /* we have seq_read */
      };
      
      // use default_llseek if there is a readdir
      ///////////////////////////////////////////
      @ fops1 depends on !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
      identifier fops0.fops;
      identifier readdir_e;
      @@
      // any other fop is used that changes pos
      struct file_operations fops = {
      ... .readdir = readdir_e, ...
      +.llseek = default_llseek, /* readdir is present */
      };
      
      // use default_llseek if at least one of read/write touches f_pos
      /////////////////////////////////////////////////////////////////
      @ fops2 depends on !fops1 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
      identifier fops0.fops;
      identifier read.read_f;
      @@
      // read fops use offset
      struct file_operations fops = {
      ... .read = read_f, ...
      +.llseek = default_llseek, /* read accesses f_pos */
      };
      
      @ fops3 depends on !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
      identifier fops0.fops;
      identifier write.write_f;
      @@
      // write fops use offset
      struct file_operations fops = {
      ... .write = write_f, ...
      +	.llseek = default_llseek, /* write accesses f_pos */
      };
      
      // Use noop_llseek if neither read nor write accesses f_pos
      ///////////////////////////////////////////////////////////
      
      @ fops4 depends on !fops1 && !fops2 && !fops3 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
      identifier fops0.fops;
      identifier read_no_fpos.read_f;
      identifier write_no_fpos.write_f;
      @@
      // write fops use offset
      struct file_operations fops = {
      ...
       .write = write_f,
       .read = read_f,
      ...
      +.llseek = noop_llseek, /* read and write both use no f_pos */
      };
      
      @ depends on has_write && !has_read && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
      identifier fops0.fops;
      identifier write_no_fpos.write_f;
      @@
      struct file_operations fops = {
      ... .write = write_f, ...
      +.llseek = noop_llseek, /* write uses no f_pos */
      };
      
      @ depends on has_read && !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
      identifier fops0.fops;
      identifier read_no_fpos.read_f;
      @@
      struct file_operations fops = {
      ... .read = read_f, ...
      +.llseek = noop_llseek, /* read uses no f_pos */
      };
      
      @ depends on !has_read && !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
      identifier fops0.fops;
      @@
      struct file_operations fops = {
      ...
      +.llseek = noop_llseek, /* no read or write fn */
      };
      ===== End semantic patch =====
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Cc: Julia Lawall <julia@diku.dk>
      Cc: Christoph Hellwig <hch@infradead.org>
      6038f373
  24. 07 4月, 2010 1 次提交
  25. 23 1月, 2010 1 次提交
  26. 12 1月, 2010 1 次提交
  27. 31 12月, 2009 1 次提交
    • I
      dma-debug: Fix bug causing build warning · a8fe9ea2
      Ingo Molnar 提交于
      Stephen Rothwell reported the following build warning:
      
       lib/dma-debug.c: In function 'dma_debug_device_change':
       lib/dma-debug.c:680: warning: 'return' with no value, in function returning non-void
      
      Introduced by commit f797d988
      ("dma-debug: Do not add notifier when dma debugging is disabled").
      
      Return 0 [notify-done] when disabled. (this is standard bus notifier behavior.)
      Signed-off-by: NShaun Ruffell <sruffell@digium.com>
      Signed-off-by: NJoerg Roedel <joerg.roedel@amd.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: <stable@kernel.org>
      LKML-Reference: <20091231125624.GA14666@liondog.tnic>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      a8fe9ea2
  28. 21 12月, 2009 1 次提交
    • S
      dma-debug: Do not add notifier when dma debugging is disabled. · f797d988
      Shaun Ruffell 提交于
      If CONFIG_HAVE_DMA_API_DEBUG is defined and "dma_debug=off" is
      specified on the kernel command line, when you detach a driver from a
      device you can cause the following NULL pointer dereference:
      
      BUG: unable to handle kernel NULL pointer dereference at (null)
      IP: [<c0580d35>] dma_debug_device_change+0x5d/0x117
      
      The problem is that the dma_debug_device_change notifier function is
      added to the bus notifier chain even though the dma_entry_hash array
      was never initialized.  If dma debugging is disabled, this patch both
      prevents dma_debug_device_change notifiers from being added to the
      chain, and additionally ensures that the dma_debug_device_change
      notifier function is a no-op.
      
      Cc: stable@kernel.org
      Signed-off-by: NShaun Ruffell <sruffell@digium.com>
      Signed-off-by: NJoerg Roedel <joerg.roedel@amd.com>
      f797d988
  29. 04 12月, 2009 1 次提交
  30. 29 10月, 2009 1 次提交
  31. 21 8月, 2009 1 次提交
    • K
      dma-debug: Fix check_unmap null pointer dereference · ec9c96ef
      Kyle McMartin 提交于
      While it's debatable whether or not a NULL device argument to
      the DMA API functions is valid... since it certainly isn't
      valid on devices with an IOMMU... dma-debug really shouldn't be
      dereferencing null pointers either.
      
      Guard against that in err_printk and the driver_filter
      functions. A Fedora rawhide user was seeing this in one of the
      dvb drivers resulting in an oops on boot.
      
      [ A patch has been sent for testing to the driver, but I feel
        the dma debugging support should be fixed as well. (There's
        still a pile of legacy garbage in the kernel passing null
        pointers to dma_{alloc,free}_*. :( ]
      Signed-off-by: NKyle McMartin <kyle@redhat.com>
      Cc: mchehab@infradead.org
      Cc: Joerg Roedel <joerg.roedel@amd.com>
      LKML-Reference: <20090820011708.GP25206@bombadil.infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      ec9c96ef
  32. 11 7月, 2009 1 次提交
    • I
      dma-debug: Fix the overlap() function to be correct and readable · f39d1b97
      Ingo Molnar 提交于
      Linus noticed how unclean and buggy the overlap() function is:
      
       - It uses convoluted (and bug-causing) positive checks for
         range overlap - instead of using a more natural negative
         check.
      
       - Even the positive checks are buggy: a positive intersection
         check has four natural cases while we checked only for three,
         missing the (addr < start && addr2 == end) case for example.
      
       - The variables are mis-named, making it non-obvious how the
         check was done.
      
       - It needlessly uses u64 instead of unsigned long. Since these
         are kernel memory pointers and we explicitly exclude highmem
         ranges anyway we cannot ever overflow 32 bits, even if we
         could. (and on 64-bit it doesnt matter anyway)
      
      All in one, this function needs a total revamp. I used Linus's
      suggestions minus the paranoid checks (we cannot overflow really
      because if we get totally bad DMA ranges passed far more things
      break in the systems than just DMA debugging). I also fixed a
      few other small details i noticed.
      Reported-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Cc: Joerg Roedel <joerg.roedel@amd.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      f39d1b97
  33. 17 6月, 2009 1 次提交
  34. 16 6月, 2009 1 次提交
  35. 15 6月, 2009 2 次提交
  36. 08 6月, 2009 2 次提交