1. 11 12月, 2009 8 次提交
    • A
      usbdevfs: move compat_ioctl handling to devio.c · 637e8a60
      Arnd Bergmann 提交于
      Half the compat_ioctl handling is in devio.c, the other
      half is in fs/compat_ioctl.c. This moves everything into
      one place for consistency.
      
      As a positive side-effect, push down the BKL into the
      ioctl methods.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Acked-by: NGreg Kroah-Hartman <gregkh@suse.de>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Oliver Neukum <oliver@neukum.org>
      Cc: Alon Bar-Lev <alon.barlev@gmail.com>
      Cc: David Vrabel <david.vrabel@csr.com>
      Cc: linux-usb@vger.kernel.org
      637e8a60
    • A
      lp: move compat_ioctl handling into lp.c · 3695669c
      Arnd Bergmann 提交于
      Handling for LPSETTIMEOUT can easily be done in lp_ioctl, which
      is the only user. As a positive side-effect, push the BKL
      into the ioctl methods.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Acked-by: NGreg Kroah-Hartman <gregkh@suse.de>
      3695669c
    • A
      compat_ioctl: pass compat pointer directly to handlers · 43c6e7b9
      Arnd Bergmann 提交于
      Instead of having each handler call compat_ptr, we can now
      convert the pointer once and pass that to each handler.
      This saves a little bit of both source and object code size.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      43c6e7b9
    • A
      compat_ioctl: simplify lookup table · 661f627d
      Arnd Bergmann 提交于
      The compat_ioctl table now only contains entries for
      COMPATIBLE_IOCTL, so we only need to know if a number
      is listed in it or now.
      
      As an optimization, we hash the table entries with a
      reversible transformation to get a more uniform distribution
      over it, sort the table at startup and then guess the
      position in the table when an ioctl number gets called
      to do a linear search from there.
      
      With the current set of ioctl numbers and the chosen
      transformation function, we need an average of four
      steps to find if a number is in the set, all of the
      accesses within one or two cache lines.
      
      This at least as good as the previous hash table
      approach but saves 8.5 kb of kernel memory.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      661f627d
    • A
      compat_ioctl: simplify calling of handlers · 789f0f89
      Arnd Bergmann 提交于
      The compat_ioctl array now contains only entries for ioctl numbers
      that do not require a separate handler. By special-casing the
      ULONG_IOCTL case in the do_ioctl_trans function, we can kill the
      final use of a function pointer in the array.
      
         text    data     bss     dec     hex filename
         7539   13352    2080   22971    59bb before/fs/compat_ioctl.o
         7910    8552    2080   18542    486e after/fs/compat_ioctl.o
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      789f0f89
    • A
      compat_ioctl: inline all conversion handlers · 5a07ea0b
      Arnd Bergmann 提交于
      This makes all ioctl conversion handlers called from
      a single switch statement, leaving only COMPATIBLE_IOCTL
      and ULONG_IOCTL statements in the table. This is somewhat
      more space efficient and also lets us simplify the
      handling of the lookup table significantly.
      
      before:
         text    data     bss     dec     hex filename
         7619   14024    2080   23723    5cab obj/fs/compat_ioctl.o
      after:
         7567   13352    2080   22999    59d7 obj/fs/compat_ioctl.o
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      5a07ea0b
    • A
      compat_ioctl: Remove BKL · 348c4b90
      Arnd Bergmann 提交于
      We have always called ioctl conversion handlers under the big kernel lock,
      although that is generally not necessary.  In particular it is not needed
      for conversion of data structures and for calling sys_ioctl or
      do_vfs_ioctl, which will get the BKL again if needed.
      
      Handlers doing more than those two have been moved out, so we can kill off
      the BKL from compat_sys_ioctl.  This may significantly improve latencies
      with 32 bit applications, and it avoids a common scenario where a thread
      acquires the BKL twice.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Cc: Greg Kroah-Hartman <gregkh@suse.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      348c4b90
    • A
      compat_ioctl: remove all VT ioctl handling · fb07a5f8
      Arnd Bergmann 提交于
      The VT driver now handles all of these ioctls directly, so we can remove
      the handlers from common code.
      
      These are the only handlers that require the BKL because they directly
      perform the ioctl action rather than just converting the data structures.
      Once they are gone, we can remove the BKL from the remaining ioctl
      conversion handlers.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Acked-by: NGreg Kroah-Hartman <gregkh@suse.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      fb07a5f8
  2. 05 12月, 2009 1 次提交
  3. 12 11月, 2009 1 次提交
  4. 07 11月, 2009 4 次提交
    • A
      compat: move sockios handling to net/socket.c · 6b96018b
      Arnd Bergmann 提交于
      This removes the original socket compat_ioctl code
      from fs/compat_ioctl.c and converts the code from the copy
      in net/socket.c into a single function. We add a few cycles
      of runtime to compat_sock_ioctl() with the long switch()
      statement, but gain some cycles in return by simplifying
      the call chain to get there.
      
      Due to better inlining, save 1.5kb of object size in the
      process, and enable further savings:
      
      before:
         text    data     bss     dec     hex filename
        13540   18008    2080   33628    835c obj/fs/compat_ioctl.o
        14565     636      40   15241    3b89 obj/net/socket.o
      
      after:
         text    data     bss     dec     hex filename
         8916   15176    2080   26172    663c obj/fs/compat_ioctl.o
        20725     636      40   21401    5399 obj/net/socket.o
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6b96018b
    • A
      appletalk: handle SIOCATALKDIFADDR compat ioctl · 20660221
      Arnd Bergmann 提交于
      We must not have a compat ioctl handler for SIOCATALKDIFADDR
      in common code, because the same number is used in other protocols
      with different data structures.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      20660221
    • A
      net, compat_ioctl: handle socket ioctl abuses in tty drivers · 9646e7ce
      Arnd Bergmann 提交于
      Slip and a few other drivers use the same ioctl numbers on
      tty devices that are normally meant for sockets. This causes
      problems with our compat_ioctl handling that tries to convert
      the data structures in a different format.
      
      Fortunately, these five drivers all use 32 bit compatible
      data structures in the ioctl numbers, so we can just add
      a trivial compat_ioctl conversion function to each of them.
      
      SIOCSIFENCAP and SIOCGIFENCAP do not need to live in
      fs/compat_ioctl.c after this any more, and they are not
      used on any sockets.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      9646e7ce
    • A
      net/tun: handle compat_ioctl directly · 50857e2a
      Arnd Bergmann 提交于
      The tun driver is the only code in the kernel that operates
      on a character device with struct ifreq. Change the driver
      to handle the conversion itself so we can contain the
      remaining ifreq handling in the socket layer.
      
      This also fixes a bug in the handling of invalid ioctl
      numbers on an unbound tun device. The driver treats this
      as a TUNSETIFF in native mode, but there is no way for
      the generic compat_ioctl() function to emulate this
      behaviour. Possibly the driver was only doing this
      accidentally anyway, but if any code relies on this
      misfeature, it now also works in compat mode.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      50857e2a
  5. 08 8月, 2009 1 次提交
  6. 13 7月, 2009 1 次提交
  7. 24 6月, 2009 1 次提交
  8. 15 6月, 2009 1 次提交
  9. 13 6月, 2009 1 次提交
  10. 29 5月, 2009 4 次提交
  11. 21 4月, 2009 1 次提交
  12. 31 3月, 2009 1 次提交
  13. 28 2月, 2009 1 次提交
  14. 19 2月, 2009 1 次提交
  15. 16 2月, 2009 1 次提交
  16. 06 2月, 2009 2 次提交
    • H
      tun: Limit amount of queued packets per device · 33dccbb0
      Herbert Xu 提交于
      Unlike a normal socket path, the tuntap device send path does
      not have any accounting.  This means that the user-space sender
      may be able to pin down arbitrary amounts of kernel memory by
      continuing to send data to an end-point that is congested.
      
      Even when this isn't an issue because of limited queueing at
      most end points, this can also be a problem because its only
      response to congestion is packet loss.  That is, when those
      local queues at the end-point fills up, the tuntap device will
      start wasting system time because it will continue to send
      data there which simply gets dropped straight away.
      
      Of course one could argue that everybody should do congestion
      control end-to-end, unfortunately there are people in this world
      still hooked on UDP, and they don't appear to be going away
      anywhere fast.  In fact, we've always helped them by performing
      accounting in our UDP code, the sole purpose of which is to
      provide congestion feedback other than through packet loss.
      
      This patch attempts to apply the same bandaid to the tuntap device.
      It creates a pseudo-socket object which is used to account our
      packets just as a normal socket does for UDP.  Of course things
      are a little complex because we're actually reinjecting traffic
      back into the stack rather than out of the stack.
      
      The stack complexities however should have been resolved by preceding
      patches.  So this one can simply start using skb_set_owner_w.
      
      For now the accounting is essentially disabled by default for
      backwards compatibility.  In particular, we set the cap to INT_MAX.
      This is so that existing applications don't get confused by the
      sudden arrival EAGAIN errors.
      
      In future we may wish (or be forced to) do this by default.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      33dccbb0
    • A
      braino in sg_ioctl_trans() · 767b5828
      Al Viro 提交于
      ... and yes, gcc is insane enough to eat that without complaint.
      We probably want sparse to scream on those...
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      767b5828
  17. 30 1月, 2009 1 次提交
  18. 26 7月, 2008 1 次提交
  19. 25 7月, 2008 1 次提交
  20. 17 7月, 2008 1 次提交
    • R
      Fix compile issues in fs/compat_ioctl.c when CONFIG_BLOCK is disabled · 3c3622dc
      Randy Dunlap 提交于
      Fix fs/compat_ioctl.c to handle CONFIG_BLOCK=n, CONFIG_SCSI=n to avoid
      build errors:
      
      In file included from include/scsi/scsi.h:12,
                       from fs/compat_ioctl.c:71:
      include/scsi/scsi_cmnd.h:27:25: warning: "BLK_MAX_CDB" is not defined
      include/scsi/scsi_cmnd.h:28:3: error: #error MAX_COMMAND_SIZE can not be bigger than BLK_MAX_CDB
      In file included from include/scsi/scsi.h:12,
                       from fs/compat_ioctl.c:71:
      include/scsi/scsi_cmnd.h: In function 'scsi_bidi_cmnd':
      include/scsi/scsi_cmnd.h:182: error: implicit declaration of function 'blk_bidi_rq'
      include/scsi/scsi_cmnd.h:183: error: dereferencing pointer to incomplete type
      include/scsi/scsi_cmnd.h: In function 'scsi_in':
      include/scsi/scsi_cmnd.h:189: error: dereferencing pointer to incomplete type
      Signed-off-by: NRandy Dunlap <randy.dunlap@oracle.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      3c3622dc
  21. 15 7月, 2008 1 次提交
    • M
      [Bluetooth] Export details about authentication requirements · 40be492f
      Marcel Holtmann 提交于
      With the Simple Pairing support, the authentication requirements are
      an explicit setting during the bonding process. Track and enforce the
      requirements and allow higher layers like L2CAP and RFCOMM to increase
      them if needed.
      
      This patch introduces a new IOCTL that allows to query the current
      authentication requirements. It is also possible to detect Simple
      Pairing support in the kernel this way.
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      40be492f
  22. 17 6月, 2008 2 次提交
  23. 30 4月, 2008 2 次提交
    • A
      tty: The big operations rework · f34d7a5b
      Alan Cox 提交于
      - Operations are now a shared const function block as with most other Linux
        objects
      
      - Introduce wrappers for some optional functions to get consistent behaviour
      
      - Wrap put_char which used to be patched by the tty layer
      
      - Document which functions are needed/optional
      
      - Make put_char report success/fail
      
      - Cache the driver->ops pointer in the tty as tty->ops
      
      - Remove various surplus lock calls we no longer need
      
      - Remove proc_write method as noted by Alexey Dobriyan
      
      - Introduce some missing sanity checks where certain driver/ldisc
        combinations would oops as they didn't check needed methods were present
      
      [akpm@linux-foundation.org: fix fs/compat_ioctl.c build]
      [akpm@linux-foundation.org: fix isicom]
      [akpm@linux-foundation.org: fix arch/ia64/hp/sim/simserial.c build]
      [akpm@linux-foundation.org: fix kgdb]
      Signed-off-by: NAlan Cox <alan@redhat.com>
      Acked-by: NGreg Kroah-Hartman <gregkh@suse.de>
      Cc: Jason Wessel <jason.wessel@windriver.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      f34d7a5b
    • A
      tty: BKL pushdown · 04f378b1
      Alan Cox 提交于
      - Push the BKL down into the line disciplines
      - Switch the tty layer to unlocked_ioctl
      - Introduce a new ctrl_lock spin lock for the control bits
      - Eliminate much of the lock_kernel use in n_tty
      - Prepare to (but don't yet) call the drivers with the lock dropped
        on the paths that historically held the lock
      
      BKL now primarily protects open/close/ldisc change in the tty layer
      
      [jirislaby@gmail.com: a couple of fixes]
      Signed-off-by: NAlan Cox <alan@redhat.com>
      Signed-off-by: NJiri Slaby <jirislaby@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      04f378b1
  24. 15 2月, 2008 1 次提交