1. 30 7月, 2014 1 次提交
  2. 25 7月, 2014 1 次提交
  3. 17 7月, 2014 1 次提交
    • C
      net: ppp: fix creating PPP pass and active filters · cc25eaae
      Christoph Schulz 提交于
      Commit 568f194e ("net: ppp: use
      sk_unattached_filter api") inadvertently changed the logic when setting
      PPP pass and active filters. This applies to both the generic PPP subsystem
      implemented by drivers/net/ppp/ppp_generic.c and the ISDN PPP subsystem
      implemented by drivers/isdn/i4l/isdn_ppp.c. The original code in ppp_ioctl()
      (or isdn_ppp_ioctl(), resp.) handling PPPIOCSPASS and PPPIOCSACTIVE allowed to
      remove a pass/active filter previously set by using a filter of length zero.
      However, with the new code this is not possible anymore as this case is not
      explicitly checked for, which leads to passing NULL as a filter to
      sk_unattached_filter_create(). This results in returning EINVAL to the caller.
      
      Additionally, the variables ppp->pass_filter and ppp->active_filter (or
      is->pass_filter and is->active_filter, resp.) are not reset to NULL, although
      the filters they point to may have been destroyed by
      sk_unattached_filter_destroy(), so in this EINVAL case dangling pointers are
      left behind (provided the pointers were previously non-NULL).
      
      This patch corrects both problems by checking whether the filter passed is
      empty or non-empty, and prevents sk_unattached_filter_create() from being
      called in the first case. Moreover, the pointers are always reset to NULL
      as soon as sk_unattached_filter_destroy() returns.
      Signed-off-by: NChristoph Schulz <develop@kristov.de>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      cc25eaae
  4. 16 7月, 2014 1 次提交
    • T
      net: set name_assign_type in alloc_netdev() · c835a677
      Tom Gundersen 提交于
      Extend alloc_netdev{,_mq{,s}}() to take name_assign_type as argument, and convert
      all users to pass NET_NAME_UNKNOWN.
      
      Coccinelle patch:
      
      @@
      expression sizeof_priv, name, setup, txqs, rxqs, count;
      @@
      
      (
      -alloc_netdev_mqs(sizeof_priv, name, setup, txqs, rxqs)
      +alloc_netdev_mqs(sizeof_priv, name, NET_NAME_UNKNOWN, setup, txqs, rxqs)
      |
      -alloc_netdev_mq(sizeof_priv, name, setup, count)
      +alloc_netdev_mq(sizeof_priv, name, NET_NAME_UNKNOWN, setup, count)
      |
      -alloc_netdev(sizeof_priv, name, setup)
      +alloc_netdev(sizeof_priv, name, NET_NAME_UNKNOWN, setup)
      )
      
      v9: move comments here from the wrong commit
      Signed-off-by: NTom Gundersen <teg@jklm.no>
      Reviewed-by: NDavid Herrmann <dh.herrmann@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c835a677
  5. 15 7月, 2014 1 次提交
    • C
      net: ppp: don't call sk_chk_filter twice · 3916a319
      Christoph Schulz 提交于
      Commit 568f194e ("net: ppp: use
      sk_unattached_filter api") causes sk_chk_filter() to be called twice when
      setting a PPP pass or active filter. This applies to both the generic PPP
      subsystem implemented by drivers/net/ppp/ppp_generic.c and the ISDN PPP
      subsystem implemented by drivers/isdn/i4l/isdn_ppp.c. The first call is from
      within get_filter(). The second one is through the call chain
      
        ppp_ioctl() or isdn_ppp_ioctl()
        --> sk_unattached_filter_create()
            --> __sk_prepare_filter()
                --> sk_chk_filter()
      
      The first call from within get_filter() should be deleted as get_filter() is
      called just before calling sk_unattached_filter_create() later on, which
      eventually calls sk_chk_filter() anyway.
      
      For 3.15.x, this proposed change is a bugfix rather than a pure optimization as
      in that branch, sk_chk_filter() may replace filter codes by other codes which
      are not recognized when executing sk_chk_filter() a second time. So with
      3.15.x, if sk_chk_filter() is called twice, the second invocation may yield
      EINVAL (this depends on the filter codes found in the filter to be set, but
      because the replacement is done for frequently used codes, this is almost
      always the case). The net effect is that setting pass and/or active PPP filters
      does not work anymore, since sk_unattached_filter_create() always returns
      EINVAL due to the second call to sk_chk_filter(), regardless whether the filter
      was originally sane or not.
      Signed-off-by: NChristoph Schulz <develop@kristov.de>
      Acked-by: NDaniel Borkmann <dborkman@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      3916a319
  6. 09 7月, 2014 1 次提交
  7. 17 6月, 2014 2 次提交
  8. 05 6月, 2014 3 次提交
    • P
      isdn/capi: fix (middleware) device nodes · d1cadce1
      Paul Bolle 提交于
      Since v2.4 the capi driver used the following device nodes if
      "middleware" support was enabled:
          /dev/capi20
          /dev/capi/0
          /dev/capi/1
          [...]
      
      /dev/capi20 is a character device node. /dev/capi/0 (and up) are tty
      device nodes (with a different major).
      
      This device node (naming) scheme is not documented anywhere, as far as I
      know. It was originally provided by the capifs pseudo filesystem (before
      udev became available). It is required for example by the pppd
      capiplugin. It was supported until a few years ago. But a number of
      developments broke it:
      - v2.6.6 (May 2004) renamed /dev/capi20 to /dev/capi and removed the
        "/" from the name of capi's tty driver. The explanation of the patch
        that did this included two examples of udev rules "to restore the old
        namespace";
      - either udev 154 (May 2010) or udev 179 (January 2012) stopped
        allowing to rename device nodes, and thus the ability to have
        /dev/capi20 appear instead of /dev/capi and /dev/capi/0 (and up)
        instead of /dev/capi0 (and up);
      - v3.0 (July 2011) also removed capifs. That disabled another method to
        create the /dev/capi/0 (and up) device nodes.
      
      So now users need to manually tweak their setup (eg, create /dev/capi/
      and fill that with symlinks) to get things working. This is all rather
      hacky and only discoverable by searching the web. Fix all this by
      renaming /dev/capi back to /dev/capi20, and by setting the name of the
      "capi_nc" tty driver to "capi!" so the tty device nodes appear as
      /dev/capi/0 (and up).
      Signed-off-by: NPaul Bolle <pebolle@tiscali.nl>
      Signed-off-by: NTilman Schmidt <tilman@imap.cc>
      Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d1cadce1
    • P
      isdn/capi: Make verbose reporting depend on capidrv · a79f5d26
      Paul Bolle 提交于
      The Kconfig symbol ISDN_DRV_AVMB1_VERBOSE_REASON is only used for
      capi_info2str(). That function is only used in capidrv.c. So setting it
      without setting ISDN_CAPI_CAPIDRV is pointless. Make it depend on
      ISDN_CAPI_CAPIDRV, rename it to ISDN_CAPI_CAPIDRV_VERBOSE and put its
      entry after ISDN_CAPI_CAPIDRV's entry.
      
      Since this symbol seems to be primarily used for debugging, keep it off
      by default. By now the last users of capidrv hopefully know all they
      need to know about the reasons for disconnecting.
      Signed-off-by: NPaul Bolle <pebolle@tiscali.nl>
      Signed-off-by: NTilman Schmidt <tilman@imap.cc>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a79f5d26
    • P
      isdn/capi: move capi_info2str to capidrv.c · ca05e3a7
      Paul Bolle 提交于
      capi_info2str() is apparently meant to be of general utility. It is
      actually only used in capidrv.c. So move it from capiutil.c to
      capidrv.c and (obviously) stop exporting it.
      
      And, since we're touching this, merge the two versions of this
      function.
      Signed-off-by: NPaul Bolle <pebolle@tiscali.nl>
      Signed-off-by: NTilman Schmidt <tilman@imap.cc>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ca05e3a7
  9. 24 5月, 2014 1 次提交
    • D
      net: filter: let unattached filters use sock_fprog_kern · b1fcd35c
      Daniel Borkmann 提交于
      The sk_unattached_filter_create() API is used by BPF filters that
      are not directly attached or related to sockets, and are used in
      team, ptp, xt_bpf, cls_bpf, etc. As such all users do their own
      internal managment of obtaining filter blocks and thus already
      have them in kernel memory and set up before calling into
      sk_unattached_filter_create(). As a result, due to __user annotation
      in sock_fprog, sparse triggers false positives (incorrect type in
      assignment [different address space]) when filters are set up before
      passing them to sk_unattached_filter_create(). Therefore, let
      sk_unattached_filter_create() API use sock_fprog_kern to overcome
      this issue.
      Signed-off-by: NDaniel Borkmann <dborkman@redhat.com>
      Acked-by: NAlexei Starovoitov <ast@plumgrid.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b1fcd35c
  10. 23 5月, 2014 2 次提交
  11. 08 5月, 2014 1 次提交
  12. 23 4月, 2014 1 次提交
  13. 17 4月, 2014 1 次提交
    • D
      isdn: icn: buffer overflow in icn_command() · b7a31405
      Dan Carpenter 提交于
      This buffer over was detected using static analysis:
      
      	drivers/isdn/icn/icn.c:1325 icn_command()
      	error: format string overflow. buf_size: 60 length: 98
      
      The calculation for the length of the string is off because it assumes
      that the dial[] buffer holds a 50 character string, but actually it is
      at most 31 characters and NUL.  I have removed the dial[] buffer because
      it isn't needed.
      
      The maximum length of the string is actually 79 characters and a NUL.  I
      have made the cbuf[] array large enough to hold it and changed the
      sprintf() to an snprintf() as a further safety enhancement.
      Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b7a31405
  14. 09 4月, 2014 1 次提交
    • D
      isdnloop: several buffer overflows · 7563487c
      Dan Carpenter 提交于
      There are three buffer overflows addressed in this patch.
      
      1) In isdnloop_fake_err() we add an 'E' to a 60 character string and
      then copy it into a 60 character buffer.  I have made the destination
      buffer 64 characters and I'm changed the sprintf() to a snprintf().
      
      2) In isdnloop_parse_cmd(), p points to a 6 characters into a 60
      character buffer so we have 54 characters.  The ->eazlist[] is 11
      characters long.  I have modified the code to return if the source
      buffer is too long.
      
      3) In isdnloop_command() the cbuf[] array was 60 characters long but the
      max length of the string then can be up to 79 characters.  I made the
      cbuf array 80 characters long and changed the sprintf() to snprintf().
      I also removed the temporary "dial" buffer and changed it to use "p"
      directly.
      
      Unfortunately, we pass the "cbuf" string from isdnloop_command() to
      isdnloop_writecmd() which truncates anything over 60 characters to make
      it fit in card->omsg[].  (It can accept values up to 255 characters so
      long as there is a '\n' character every 60 characters).  For now I have
      just fixed the memory corruption bug and left the other problems in this
      driver alone.
      Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      7563487c
  15. 03 4月, 2014 1 次提交
  16. 31 3月, 2014 1 次提交
  17. 28 3月, 2014 1 次提交
  18. 19 3月, 2014 1 次提交
  19. 27 2月, 2014 4 次提交
    • A
      isdn: fix multiple sleep_on races · 94fcf696
      Arnd Bergmann 提交于
      The isdn core code uses a couple of wait queues with
      interruptible_sleep_on, which is racy and about to get
      removed from the kernel. Fortunately, we know for each case
      what we are waiting for, so they can all be converted to
      the better wait_event_interruptible interface.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Cc: Karsten Keil <isdn@linux-pingi.de>
      Cc: netdev@vger.kernel.org
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      94fcf696
    • A
      isdn: divert, hysdn: fix interruptible_sleep_on race · c11da83b
      Arnd Bergmann 提交于
      These two drivers use identical code for their procfs status
      file handling, which contains a small race against status
      data becoming available while reading the file.
      
      This uses wait_event_interruptible instead to fix this
      particular race and eventually get rid of all sleep_on
      instances. There seems to be another race involving
      multiple concurrent readers of the same procfs file, which
      I don't try to fix here.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Cc: Karsten Keil <isdn@linux-pingi.de>
      Cc: netdev@vger.kernel.org
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c11da83b
    • A
      isdn: hisax/elsa: fix sleep_on race in elsa FSM · c728cc88
      Arnd Bergmann 提交于
      The state machine code in the elsa driver uses interruptible_sleep_on
      to wait for state changes, which is racy. A closer look at the possible
      states reveals that it is always used to wait for getting back into
      ARCOFI_NOP, so we can use wait_event_interruptible instead.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Cc: Karsten Keil <isdn@linux-pingi.de>
      Cc: netdev@vger.kernel.org
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c728cc88
    • A
      isdn: pcbit: fix interruptible_sleep_on race · e5b3fa15
      Arnd Bergmann 提交于
      interruptible_sleep_on is racy and going away. In case of pcbit,
      the driver would run into a timeout if the card is initialized
      before we start waiting for it. This uses wait_event to fix the
      race. In order to do this, the state machine handling for the
      timeout case has to get trivially reorganized so we actually know
      whether the timeout has occorred or not.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Cc: Karsten Keil <isdn@linux-pingi.de>
      Cc: netdev@vger.kernel.org
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      e5b3fa15
  20. 07 2月, 2014 1 次提交
  21. 19 1月, 2014 1 次提交
  22. 07 1月, 2014 1 次提交
  23. 27 12月, 2013 1 次提交
  24. 19 12月, 2013 2 次提交
  25. 02 12月, 2013 1 次提交
  26. 21 11月, 2013 1 次提交
    • H
      net: rework recvmsg handler msg_name and msg_namelen logic · f3d33426
      Hannes Frederic Sowa 提交于
      This patch now always passes msg->msg_namelen as 0. recvmsg handlers must
      set msg_namelen to the proper size <= sizeof(struct sockaddr_storage)
      to return msg_name to the user.
      
      This prevents numerous uninitialized memory leaks we had in the
      recvmsg handlers and makes it harder for new code to accidentally leak
      uninitialized memory.
      
      Optimize for the case recvfrom is called with NULL as address. We don't
      need to copy the address at all, so set it to NULL before invoking the
      recvmsg handler. We can do so, because all the recvmsg handlers must
      cope with the case a plain read() is called on them. read() also sets
      msg_name to NULL.
      
      Also document these changes in include/linux/net.h as suggested by David
      Miller.
      
      Changes since RFC:
      
      Set msg->msg_name = NULL if user specified a NULL in msg_name but had a
      non-null msg_namelen in verify_iovec/verify_compat_iovec. This doesn't
      affect sendto as it would bail out earlier while trying to copy-in the
      address. It also more naturally reflects the logic by the callers of
      verify_iovec.
      
      With this change in place I could remove "
      if (!uaddr || msg_sys->msg_namelen == 0)
      	msg->msg_name = NULL
      ".
      
      This change does not alter the user visible error logic as we ignore
      msg_namelen as long as msg_name is NULL.
      
      Also remove two unnecessary curly brackets in ___sys_recvmsg and change
      comments to netdev style.
      
      Cc: David Miller <davem@davemloft.net>
      Suggested-by: NEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: NHannes Frederic Sowa <hannes@stressinduktion.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f3d33426
  27. 15 11月, 2013 1 次提交
  28. 08 11月, 2013 1 次提交
  29. 18 10月, 2013 1 次提交
  30. 03 10月, 2013 1 次提交
  31. 16 9月, 2013 1 次提交
  32. 14 9月, 2013 1 次提交