1. 10 1月, 2017 1 次提交
  2. 23 11月, 2016 1 次提交
  3. 28 10月, 2016 3 次提交
    • J
      genetlink: mark families as __ro_after_init · 56989f6d
      Johannes Berg 提交于
      Now genl_register_family() is the only thing (other than the
      users themselves, perhaps, but I didn't find any doing that)
      writing to the family struct.
      
      In all families that I found, genl_register_family() is only
      called from __init functions (some indirectly, in which case
      I've add __init annotations to clarifly things), so all can
      actually be marked __ro_after_init.
      
      This protects the data structure from accidental corruption.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      56989f6d
    • J
      genetlink: statically initialize families · 489111e5
      Johannes Berg 提交于
      Instead of providing macros/inline functions to initialize
      the families, make all users initialize them statically and
      get rid of the macros.
      
      This reduces the kernel code size by about 1.6k on x86-64
      (with allyesconfig).
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      489111e5
    • J
      genetlink: no longer support using static family IDs · a07ea4d9
      Johannes Berg 提交于
      Static family IDs have never really been used, the only
      use case was the workaround I introduced for those users
      that assumed their family ID was also their multicast
      group ID.
      
      Additionally, because static family IDs would never be
      reserved by the generic netlink code, using a relatively
      low ID would only work for built-in families that can be
      registered immediately after generic netlink is started,
      which is basically only the control family (apart from
      the workaround code, which I also had to add code for so
      it would reserve those IDs)
      
      Thus, anything other than GENL_ID_GENERATE is flawed and
      luckily not used except in the cases I mentioned. Move
      those workarounds into a few lines of code, and then get
      rid of GENL_ID_GENERATE entirely, making it more robust.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a07ea4d9
  4. 04 9月, 2016 1 次提交
    • B
      scsi: pmcraid: mark symbols static where possible · 61b96d5b
      Baoyou Xie 提交于
      We get 4 warnings about global functions without a declaration
      in the scsi pmcraid driver when building with W=1:
      drivers/scsi/pmcraid.c:309:6: warning: no previous prototype for 'pmcraid_init_cmdblk' [-Wmissing-prototypes]
      drivers/scsi/pmcraid.c:404:6: warning: no previous prototype for 'pmcraid_return_cmd' [-Wmissing-prototypes]
      drivers/scsi/pmcraid.c:1713:6: warning: no previous prototype for 'pmcraid_ioasc_logger' [-Wmissing-prototypes]
      drivers/scsi/pmcraid.c:3141:1: warning: no previous prototype for 'pmcraid_init_ioadls' [-Wmissing-prototypes]
      
      In fact, these functions are only used in the file in which it is
      declared and don't need a declaration, but can be made static.  so this
      patch marks it 'static'.
      Signed-off-by: NBaoyou Xie <baoyou.xie@linaro.org>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      61b96d5b
  5. 12 11月, 2015 1 次提交
    • A
      scsi: pmcraid: replace struct timeval with ktime_get_real_seconds() · 9c9bd593
      Alison Schofield 提交于
      Replace the use of struct timeval and do_gettimeofday() with
      64 bit ktime_get_real_seconds. Prevents 32-bit type overflow
      in year 2038 on 32-bit systems.
      
      Driver was using the seconds portion of struct timeval (.tv_secs)
      to pass a millseconds timestamp to the firmware. This change maintains
      that same behavior using ktime_get_real_seconds.
      
      The structure used to pass the timestamp to firmware is 48 bits and
      works fine as long as the top 16 bits are zero and they will be zero
      for a long time..ie. thousands of years.
      
      Alternative Change:  Add sub second granularity to timestamp
      
      As noted above, the driver only used the seconds portion of timeval,
      ignores the microseconds portion, and by multiplying by 1000 effectively
      does a <<10 and always writes zero into timestamp[0].
      
      The alternative change would pass all the bits to the firmware:
      
              struct timespec64 ts;
      
              ktime_get_real_ts64(&ts);
              timestamp = ts.tv_sec * MSEC_PER_SEC + ts.tv_nsec / NSEC_PER_MSEC;
      Signed-off-by: NAlison Schofield <amsfield22@gmail.com>
      Reviewed-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      9c9bd593
  6. 10 11月, 2015 1 次提交
  7. 20 1月, 2015 1 次提交
  8. 18 1月, 2015 1 次提交
    • J
      netlink: make nlmsg_end() and genlmsg_end() void · 053c095a
      Johannes Berg 提交于
      Contrary to common expectations for an "int" return, these functions
      return only a positive value -- if used correctly they cannot even
      return 0 because the message header will necessarily be in the skb.
      
      This makes the very common pattern of
      
        if (genlmsg_end(...) < 0) { ... }
      
      be a whole bunch of dead code. Many places also simply do
      
        return nlmsg_end(...);
      
      and the caller is expected to deal with it.
      
      This also commonly (at least for me) causes errors, because it is very
      common to write
      
        if (my_function(...))
          /* error condition */
      
      and if my_function() does "return nlmsg_end()" this is of course wrong.
      
      Additionally, there's not a single place in the kernel that actually
      needs the message length returned, and if anyone needs it later then
      it'll be very easy to just use skb->len there.
      
      Remove this, and make the functions void. This removes a bunch of dead
      code as described above. The patch adds lines because I did
      
      -	return nlmsg_end(...);
      +	nlmsg_end(...);
      +	return 0;
      
      I could have preserved all the function's return values by returning
      skb->len, but instead I've audited all the places calling the affected
      functions and found that none cared. A few places actually compared
      the return value with <= 0 in dump functionality, but that could just
      be changed to < 0 with no change in behaviour, so I opted for the more
      efficient version.
      
      One instance of the error I've made numerous times now is also present
      in net/phonet/pn_netlink.c in the route_dumpit() function - it didn't
      check for <0 or <=0 and thus broke out of the loop every single time.
      I've preserved this since it will (I think) have caused the messages to
      userspace to be formatted differently with just a single message for
      every SKB returned to userspace. It's possible that this isn't needed
      for the tools that actually use this, but I don't even know what they
      are so couldn't test that changing this behaviour would be acceptable.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      053c095a
  9. 04 12月, 2014 1 次提交
  10. 24 11月, 2014 1 次提交
  11. 12 11月, 2014 4 次提交
  12. 17 9月, 2014 2 次提交
  13. 09 8月, 2014 1 次提交
  14. 18 7月, 2014 1 次提交
  15. 29 11月, 2013 2 次提交
    • M
      [SCSI] Disable WRITE SAME for RAID and virtual host adapter drivers · 54b2b50c
      Martin K. Petersen 提交于
      Some host adapters do not pass commands through to the target disk
      directly. Instead they provide an emulated target which may or may not
      accurately report its capabilities. In some cases the physical device
      characteristics are reported even when the host adapter is processing
      commands on the device's behalf. This can lead to adapter firmware hangs
      or excessive I/O errors.
      
      This patch disables WRITE SAME for devices connected to host adapters
      that provide an emulated target. Driver writers can disable WRITE SAME
      by setting the no_write_same flag in the host adapter template.
      
      [jejb: fix up rejections due to eh_deadline patch]
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      Cc: stable@kernel.org
      Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
      54b2b50c
    • J
      genetlink/pmcraid: use proper genetlink multicast API · 5e53e689
      Johannes Berg 提交于
      The pmcraid driver is abusing the genetlink API and is using its
      family ID as the multicast group ID, which is invalid and may
      belong to somebody else (and likely will.)
      
      Make it use the correct API, but since this may already be used
      as-is by userspace, reserve a family ID for this code and also
      reserve that group ID to not break userspace assumptions.
      
      My previous patch broke event delivery in the driver as I missed
      that it wasn't using the right API and forgot to update it later
      in my series.
      
      While changing this, I noticed that the genetlink code could use
      the static group ID instead of a strcmp(), so also do that for
      the VFS_DQUOT family.
      
      Cc: Anil Ravindranath <anil_ravindranath@pmc-sierra.com>
      Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5e53e689
  16. 20 11月, 2013 1 次提交
  17. 14 10月, 2013 1 次提交
  18. 18 6月, 2013 1 次提交
  19. 30 4月, 2013 1 次提交
  20. 04 1月, 2013 1 次提交
    • G
      Drivers: scsi: remove __dev* attributes. · 6f039790
      Greg Kroah-Hartman 提交于
      CONFIG_HOTPLUG is going away as an option.  As a result, the __dev*
      markings need to be removed.
      
      This change removes the use of __devinit, __devexit_p, __devinitdata,
      __devinitconst, and __devexit from these drivers.
      
      Based on patches originally written by Bill Pemberton, but redone by me
      in order to handle some of the coding style issues better, by hand.
      
      Cc: Bill Pemberton <wfp5p@virginia.edu>
      Cc: Adam Radford <linuxraid@lsi.com>
      Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6f039790
  21. 21 8月, 2012 1 次提交
    • T
      workqueue: deprecate flush[_delayed]_work_sync() · 43829731
      Tejun Heo 提交于
      flush[_delayed]_work_sync() are now spurious.  Mark them deprecated
      and convert all users to flush[_delayed]_work().
      
      If you're cc'd and wondering what's going on: Now all workqueues are
      non-reentrant and the regular flushes guarantee that the work item is
      not pending or running on any CPU on return, so there's no reason to
      use the sync flushes at all and they're going away.
      
      This patch doesn't make any functional difference.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Paul Mundt <lethal@linux-sh.org>
      Cc: Ian Campbell <ian.campbell@citrix.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Mattia Dongili <malattia@linux.it>
      Cc: Kent Yoder <key@linux.vnet.ibm.com>
      Cc: David Airlie <airlied@linux.ie>
      Cc: Jiri Kosina <jkosina@suse.cz>
      Cc: Karsten Keil <isdn@linux-pingi.de>
      Cc: Bryan Wu <bryan.wu@canonical.com>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Alasdair Kergon <agk@redhat.com>
      Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
      Cc: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
      Cc: David Woodhouse <dwmw2@infradead.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: linux-wireless@vger.kernel.org
      Cc: Anton Vorontsov <cbou@mail.ru>
      Cc: Sangbeom Kim <sbkim73@samsung.com>
      Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Eric Van Hensbergen <ericvh@gmail.com>
      Cc: Takashi Iwai <tiwai@suse.de>
      Cc: Steven Whitehouse <swhiteho@redhat.com>
      Cc: Petr Vandrovec <petr@vandrovec.name>
      Cc: Mark Fasheh <mfasheh@suse.com>
      Cc: Christoph Hellwig <hch@infradead.org>
      Cc: Avi Kivity <avi@redhat.com> 
      43829731
  22. 15 12月, 2011 1 次提交
  23. 30 10月, 2011 1 次提交
  24. 15 9月, 2011 1 次提交
  25. 27 7月, 2011 1 次提交
    • D
      [SCSI] pmcraid: reject negative request size · b5b51544
      Dan Rosenberg 提交于
      There's a code path in pmcraid that can be reached via device ioctl that
      causes all sorts of ugliness, including heap corruption or triggering the
      OOM killer due to consecutive allocation of large numbers of pages.
      
      First, the user can call pmcraid_chr_ioctl(), with a type
      PMCRAID_PASSTHROUGH_IOCTL.  This calls through to
      pmcraid_ioctl_passthrough().  Next, a pmcraid_passthrough_ioctl_buffer
      is copied in, and the request_size variable is set to
      buffer->ioarcb.data_transfer_length, which is an arbitrary 32-bit
      signed value provided by the user.  If a negative value is provided
      here, bad things can happen.  For example,
      pmcraid_build_passthrough_ioadls() is called with this request_size,
      which immediately calls pmcraid_alloc_sglist() with a negative size.
      The resulting math on allocating a scatter list can result in an
      overflow in the kzalloc() call (if num_elem is 0, the sglist will be
      smaller than expected), or if num_elem is unexpectedly large the
      subsequent loop will call alloc_pages() repeatedly, a high number of
      pages will be allocated and the OOM killer might be invoked.
      
      It looks like preventing this value from being negative in
      pmcraid_ioctl_passthrough() would be sufficient.
      Signed-off-by: NDan Rosenberg <drosenberg@vsecurity.com>
      Cc: <stable@kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
      b5b51544
  26. 25 4月, 2011 1 次提交
    • D
      [SCSI] pmcraid: reject negative request size · 5f6279da
      Dan Rosenberg 提交于
      There's a code path in pmcraid that can be reached via device ioctl that
      causes all sorts of ugliness, including heap corruption or triggering
      the OOM killer due to consecutive allocation of large numbers of pages.
      Not especially relevant from a security perspective, since users must
      have CAP_SYS_ADMIN to open the character device.
      
      First, the user can call pmcraid_chr_ioctl() with a type
      PMCRAID_PASSTHROUGH_IOCTL.  A pmcraid_passthrough_ioctl_buffer
      is copied in, and the request_size variable is set to
      buffer->ioarcb.data_transfer_length, which is an arbitrary 32-bit signed
      value provided by the user.
      
      If a negative value is provided here, bad things can happen.  For
      example, pmcraid_build_passthrough_ioadls() is called with this
      request_size, which immediately calls pmcraid_alloc_sglist() with a
      negative size.  The resulting math on allocating a scatter list can
      result in an overflow in the kzalloc() call (if num_elem is 0, the
      sglist will be smaller than expected), or if num_elem is unexpectedly
      large the subsequent loop will call alloc_pages() repeatedly, a high
      number of pages will be allocated and the OOM killer might be invoked.
      
      Prevent this value from being negative in pmcraid_ioctl_passthrough().
      Signed-off-by: NDan Rosenberg <drosenberg@vsecurity.com>
      Cc: stable@kernel.org
      Cc: Anil Ravindranath <anil_ravindranath@pmc-sierra.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      5f6279da
  27. 19 4月, 2011 1 次提交
    • M
      pmcraid: Drop __DATE__ usage · a1b66665
      Michal Marek 提交于
      The kernel already prints its build timestamp during boot, no need to
      repeat it in random drivers and produce different object files each
      time.
      
      Cc: Anil Ravindranath <anil_ravindranath@pmc-sierra.com>
      Cc: linux-scsi@vger.kernel.org
      Signed-off-by: NMichal Marek <mmarek@suse.cz>
      a1b66665
  28. 31 3月, 2011 1 次提交
  29. 13 2月, 2011 1 次提交
    • T
      [SCSI] remove flush_scheduled_work() usages · a684b8da
      Tejun Heo 提交于
      Simple conversions to drop flush_scheduled_work() usages in
      drivers/scsi.  More involved ones will be done in separate patches.
      
      * NCR5380, megaraid_sas: cancel_delayed_work() +
        flush_scheduled_work() -> cancel_delayed_work_sync().
      
      * mpt2sas_scsih: drop unnecessary flush_scheduled_work().
      
      * arcmsr_hba, ipr, pmcraid: flush the used work explicitly instead of
        using flush_scheduled_work().
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      a684b8da
  30. 24 12月, 2010 1 次提交
  31. 09 12月, 2010 1 次提交
  32. 17 11月, 2010 1 次提交
    • J
      SCSI host lock push-down · f281233d
      Jeff Garzik 提交于
      Move the mid-layer's ->queuecommand() invocation from being locked
      with the host lock to being unlocked to facilitate speeding up the
      critical path for drivers who don't need this lock taken anyway.
      
      The patch below presents a simple SCSI host lock push-down as an
      equivalent transformation.  No locking or other behavior should change
      with this patch.  All existing bugs and locking orders are preserved.
      
      Additionally, add one parameter to queuecommand,
      	struct Scsi_Host *
      and remove one parameter from queuecommand,
      	void (*done)(struct scsi_cmnd *)
      
      Scsi_Host* is a convenient pointer that most host drivers need anyway,
      and 'done' is redundant to struct scsi_cmnd->scsi_done.
      
      Minimal code disturbance was attempted with this change.  Most drivers
      needed only two one-line modifications for their host lock push-down.
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      Acked-by: NJames Bottomley <James.Bottomley@suse.de>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      f281233d
  33. 30 10月, 2010 1 次提交