1. 13 2月, 2008 4 次提交
    • J
      [AX25] ax25_ds_timer: use mod_timer instead of add_timer · e848b583
      Jarek Poplawski 提交于
      This patch changes current use of: init_timer(), add_timer()
      and del_timer() to setup_timer() with mod_timer(), which
      should be safer anyway.
      Reported-by: NJann Traschewski <jann@gmx.de>
      Signed-off-by: NJarek Poplawski <jarkao2@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      e848b583
    • J
      [AX25] ax25_timer: use mod_timer instead of add_timer · 21fab4a8
      Jarek Poplawski 提交于
      According to one of Jann's OOPS reports it looks like
      BUG_ON(timer_pending(timer)) triggers during add_timer()
      in ax25_start_t1timer(). This patch changes current use
      of: init_timer(), add_timer() and del_timer() to
      setup_timer() with mod_timer(), which should be safer
      anyway.
      Reported-by: NJann Traschewski <jann@gmx.de>
      Signed-off-by: NJarek Poplawski <jarkao2@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      21fab4a8
    • J
      [AX25] ax25_route: make ax25_route_lock BH safe · 4de211f1
      Jarek Poplawski 提交于
      > =================================
      > [ INFO: inconsistent lock state ]
      > 2.6.24-dg8ngn-p02 #1
      > ---------------------------------
      > inconsistent {softirq-on-W} -> {in-softirq-R} usage.
      > linuxnet/3046 [HC0[0]:SC1[2]:HE1:SE0] takes:
      >  (ax25_route_lock){--.+}, at: [<f8a0cfb7>] ax25_get_route+0x18/0xb7 [ax25]
      > {softirq-on-W} state was registered at:
      ...
      
      This lockdep report shows that ax25_route_lock is taken for reading in
      softirq context, and for writing in process context with BHs enabled.
      So, to make this safe, all write_locks in ax25_route.c are changed to
      _bh versions.
      
      Reported-by: Jann Traschewski <jann@gmx.de>,
      Signed-off-by: NJarek Poplawski <jarkao2@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4de211f1
    • J
      [AX25] af_ax25: remove sock lock in ax25_info_show() · 1105b5d1
      Jarek Poplawski 提交于
      This lockdep warning:
      
      > =======================================================
      > [ INFO: possible circular locking dependency detected ]
      > 2.6.24 #3
      > -------------------------------------------------------
      > swapper/0 is trying to acquire lock:
      >  (ax25_list_lock){-+..}, at: [<f91dd3b1>] ax25_destroy_socket+0x171/0x1f0 [ax25]
      >
      > but task is already holding lock:
      >  (slock-AF_AX25){-+..}, at: [<f91dbabc>] ax25_std_heartbeat_expiry+0x1c/0xe0 [ax25]
      >
      > which lock already depends on the new lock.
      ...
      
      shows that ax25_list_lock and slock-AF_AX25 are taken in different
      order: ax25_info_show() takes slock (bh_lock_sock(ax25->sk)) while
      ax25_list_lock is held, so reversely to other functions. To fix this
      the sock lock should be moved to ax25_info_start(), and there would
      be still problem with breaking ax25_list_lock (it seems this "proper"
      order isn't optimal yet). But, since it's only for reading proc info
      it seems this is not necessary (e.g.  ax25_send_to_raw() does similar
      reading without this lock too).
      
      So, this patch removes sock lock to avoid deadlock possibility; there
      is also used sock_i_ino() function, which reads sk_socket under proper
      read lock. Additionally printf format of this i_ino is changed to %lu.
      Reported-by: NBernard Pidoux F6BVP <f6bvp@free.fr>
      Signed-off-by: NJarek Poplawski <jarkao2@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1105b5d1
  2. 01 2月, 2008 1 次提交
  3. 29 1月, 2008 3 次提交
    • E
      [AX25]: sparse cleanups · f16f3026
      Eric Dumazet 提交于
      net/ax25/ax25_route.c:251:13: warning: context imbalance in
      'ax25_rt_seq_start' - wrong count at exit
      net/ax25/ax25_route.c:276:13: warning: context imbalance in 'ax25_rt_seq_stop'
      - unexpected unlock
      net/ax25/ax25_std_timer.c:65:25: warning: expensive signed divide
      net/ax25/ax25_uid.c:46:1: warning: symbol 'ax25_uid_list' was not declared.
      Should it be static?
      net/ax25/ax25_uid.c:146:13: warning: context imbalance in 'ax25_uid_seq_start'
      - wrong count at exit
      net/ax25/ax25_uid.c:169:13: warning: context imbalance in 'ax25_uid_seq_stop'
      - unexpected unlock
      net/ax25/af_ax25.c:573:28: warning: expensive signed divide
      net/ax25/af_ax25.c:1865:13: warning: context imbalance in 'ax25_info_start' -
      wrong count at exit
      net/ax25/af_ax25.c:1888:13: warning: context imbalance in 'ax25_info_stop' -
      unexpected unlock
      net/ax25/ax25_ds_timer.c:133:25: warning: expensive signed divide
      Signed-off-by: NEric Dumazet <dada1@cosmosbay.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f16f3026
    • P
      [AX25]: Switch to using ctl_paths. · c6995bdf
      Pavel Emelyanov 提交于
      This one is almost the same as the hunks in the
      first patch, but ax25 tables are created dynamically.
      
      So this patch differs a bit to handle this case.
      Signed-off-by: NPavel Emelyanov <xemul@openvz.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c6995bdf
    • P
      [NET]: Convert init_timer into setup_timer · b24b8a24
      Pavel Emelyanov 提交于
      Many-many code in the kernel initialized the timer->function
      and  timer->data together with calling init_timer(timer). There
      is already a helper for this. Use it for networking code.
      
      The patch is HUGE, but makes the code 130 lines shorter
      (98 insertions(+), 228 deletions(-)).
      Signed-off-by: NPavel Emelyanov <xemul@openvz.org>
      Acked-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b24b8a24
  4. 11 1月, 2008 1 次提交
    • J
      [AX25] af_ax25: Possible circular locking. · ecd2ebde
      Jarek Poplawski 提交于
      Bernard Pidoux F6BVP reported:
      > When I killall kissattach I can see the following message.
      >
      > This happens on kernel 2.6.24-rc5 already patched with the 6 previously
      > patches I sent recently.
      >
      >
      > =======================================================
      > [ INFO: possible circular locking dependency detected ]
      > 2.6.23.9 #1
      > -------------------------------------------------------
      > kissattach/2906 is trying to acquire lock:
      >  (linkfail_lock){-+..}, at: [<d8bd4603>] ax25_link_failed+0x11/0x39 [ax25]
      >
      > but task is already holding lock:
      >  (ax25_list_lock){-+..}, at: [<d8bd7c7c>] ax25_device_event+0x38/0x84
      > [ax25]
      >
      > which lock already depends on the new lock.
      >
      >
      > the existing dependency chain (in reverse order) is:
      ...
      
      lockdep is worried about the different order here:
      
      #1 (rose_neigh_list_lock){-+..}:
      #3 (ax25_list_lock){-+..}:
      
      #0 (linkfail_lock){-+..}:
      #1 (rose_neigh_list_lock){-+..}:
      
      #3 (ax25_list_lock){-+..}:
      #0 (linkfail_lock){-+..}:
      
      So, ax25_list_lock could be taken before and after linkfail_lock. 
      I don't know if this three-thread clutch is very probable (or
      possible at all), but it seems another bug reported by Bernard
      ("[...] system impossible to reboot with linux-2.6.24-rc5")
      could have similar source - namely ax25_list_lock held by
      ax25_kill_by_device() during ax25_disconnect(). It looks like the
      only place which calls ax25_disconnect() this way, so I guess, it
      isn't necessary.
      
      This patch is breaking the lock for ax25_disconnect().
      Reported-and-tested-by: NBernard Pidoux <f6bvp@free.fr>
      Signed-off-by: NJarek Poplawski <jarkao2@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ecd2ebde
  5. 10 1月, 2008 1 次提交
  6. 20 12月, 2007 1 次提交
  7. 17 12月, 2007 1 次提交
    • J
      [AX25]: Locking dependencies fix in ax25_disconnect(). · 215f7b08
      Jarek Poplawski 提交于
      Bernard Pidoux reported these lockdep warnings:
      
      [ INFO: possible irq lock inversion dependency detected ]
      2.6.23.1 #1
      ---------------------------------------------------------
      fpac/4933 just changed the state of lock:
       (slock-AF_AX25){--..}, at: [<d8be3312>] ax25_disconnect+0x46/0xaf
       [ax25]
       but this lock was taken by another, soft-irq-safe lock in the past:
        (ax25_list_lock){-+..}
      
        and interrupts could create inverse lock ordering between them.
        [...]
      
      [ INFO: inconsistent lock state ]
      2.6.23.1 #1
      ---------------------------------
      inconsistent {in-softirq-W} -> {softirq-on-W} usage.
      ax25_call/4005 [HC0[0]:SC0[0]:HE1:SE1] takes:
       (slock-AF_AX25){-+..}, at: [<d8b79312>] ax25_disconnect+0x46/0xaf [ax25]
       [...]
      
      This means slock-AF_AX25 could be taken both from softirq and process
      context with softirqs enabled, so it's endangered itself, but also makes
      ax25_list_lock vulnerable. It was not 100% verified if the real lockup
      can happen, but this fix isn't very costly and looks safe anyway.
      (It was tested by Bernard with 2.6.23.9 and 2.6.24-rc5 kernels.)
      
      
      Reported_by: Bernard Pidoux <pidoux@ccr.jussieu.fr>
      Tested_by: Bernard Pidoux <pidoux@ccr.jussieu.fr>
      Signed-off-by: NJarek Poplawski <jarkao2@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      215f7b08
  8. 01 11月, 2007 1 次提交
  9. 20 10月, 2007 1 次提交
  10. 11 10月, 2007 6 次提交
    • S
      [NET]: Move hardware header operations out of netdevice. · 3b04ddde
      Stephen Hemminger 提交于
      Since hardware header operations are part of the protocol class
      not the device instance, make them into a separate object and
      save memory.
      Signed-off-by: NStephen Hemminger <shemminger@linux-foundation.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      3b04ddde
    • E
      [NET]: Make the device list and device lookups per namespace. · 881d966b
      Eric W. Biederman 提交于
      This patch makes most of the generic device layer network
      namespace safe.  This patch makes dev_base_head a
      network namespace variable, and then it picks up
      a few associated variables.  The functions:
      dev_getbyhwaddr
      dev_getfirsthwbytype
      dev_get_by_flags
      dev_get_by_name
      __dev_get_by_name
      dev_get_by_index
      __dev_get_by_index
      dev_ioctl
      dev_ethtool
      dev_load
      wireless_process_ioctl
      
      were modified to take a network namespace argument, and
      deal with it.
      
      vlan_ioctl_set and brioctl_set were modified so their
      hooks will receive a network namespace argument.
      
      So basically anthing in the core of the network stack that was
      affected to by the change of dev_base was modified to handle
      multiple network namespaces.  The rest of the network stack was
      simply modified to explicitly use &init_net the initial network
      namespace.  This can be fixed when those components of the network
      stack are modified to handle multiple network namespaces.
      
      For now the ifindex generator is left global.
      
      Fundametally ifindex numbers are per namespace, or else
      we will have corner case problems with migration when
      we get that far.
      
      At the same time there are assumptions in the network stack
      that the ifindex of a network device won't change.  Making
      the ifindex number global seems a good compromise until
      the network stack can cope with ifindex changes when
      you change namespaces, and the like.
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      881d966b
    • E
      [NET]: Make device event notification network namespace safe · e9dc8653
      Eric W. Biederman 提交于
      Every user of the network device notifiers is either a protocol
      stack or a pseudo device.  If a protocol stack that does not have
      support for multiple network namespaces receives an event for a
      device that is not in the initial network namespace it quite possibly
      can get confused and do the wrong thing.
      
      To avoid problems until all of the protocol stacks are converted
      this patch modifies all netdev event handlers to ignore events on
      devices that are not in the initial network namespace.
      
      As the rest of the code is made network namespace aware these
      checks can be removed.
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      e9dc8653
    • E
      [NET]: Make packet reception network namespace safe · e730c155
      Eric W. Biederman 提交于
      This patch modifies every packet receive function
      registered with dev_add_pack() to drop packets if they
      are not from the initial network namespace.
      
      This should ensure that the various network stacks do
      not receive packets in a anything but the initial network
      namespace until the code has been converted and is ready
      for them.
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      e730c155
    • E
      [NET]: Make socket creation namespace safe. · 1b8d7ae4
      Eric W. Biederman 提交于
      This patch passes in the namespace a new socket should be created in
      and has the socket code do the appropriate reference counting.  By
      virtue of this all socket create methods are touched.  In addition
      the socket create methods are modified so that they will fail if
      you attempt to create a socket in a non-default network namespace.
      
      Failing if we attempt to create a socket outside of the default
      network namespace ensures that as we incrementally make the network stack
      network namespace aware we will not export functionality that someone
      has not audited and made certain is network namespace safe.
      Allowing us to partially enable network namespaces before all of the
      exotic protocols are supported.
      
      Any protocol layers I have missed will fail to compile because I now
      pass an extra parameter into the socket creation code.
      
      [ Integrated AF_IUCV build fixes from Andrew Morton... -DaveM ]
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1b8d7ae4
    • E
      [NET]: Make /proc/net per network namespace · 457c4cbc
      Eric W. Biederman 提交于
      This patch makes /proc/net per network namespace.  It modifies the global
      variables proc_net and proc_net_stat to be per network namespace.
      The proc_net file helpers are modified to take a network namespace argument,
      and all of their callers are fixed to pass &init_net for that argument.
      This ensures that all of the /proc/net files are only visible and
      usable in the initial network namespace until the code behind them
      has been updated to be handle multiple network namespaces.
      
      Making /proc/net per namespace is necessary as at least some files
      in /proc/net depend upon the set of network devices which is per
      network namespace, and even more files in /proc/net have contents
      that are relevant to a single network namespace.
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      457c4cbc
  11. 15 8月, 2007 1 次提交
    • A
      [AX25]: don't free pointers to statically allocated data · 9ac0be9d
      Alexey Dobriyan 提交于
      commit 8d5cf596 started to add statically
      allocated ax25_protocol's to list. However kfree() was still in place waiting
      for unsuspecting ones on module removal.
      
      Steps to reproduce:
      
      	modprobe netrom
      	rmmod netrom
      
      P.S.: code would benefit greatly from list_add/list_del usage
      
      kernel BUG at mm/slab.c:592!
      invalid opcode: 0000 [1] PREEMPT SMP 
      CPU 0 
      Modules linked in: netrom ax25 af_packet usbcore rtc_cmos rtc_core rtc_lib
      Pid: 4477, comm: rmmod Not tainted 2.6.23-rc3-bloat #2
      RIP: 0010:[<ffffffff802ac646>]  [<ffffffff802ac646>] kfree+0x1c6/0x260
      RSP: 0000:ffff810079a05e48  EFLAGS: 00010046
      RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffff81000000c000
      RDX: ffff81007e552458 RSI: 0000000000000000 RDI: 000000000000805d
      RBP: ffff810079a05e88 R08: 0000000000000001 R09: 0000000000000000
      R10: 0000000000000001 R11: 0000000000000000 R12: ffffffff8805d080
      R13: ffffffff8805d080 R14: 0000000000000000 R15: 0000000000000282
      FS:  00002b73fc98aae0(0000) GS:ffffffff805dc000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
      CR2: 000000000053f3b8 CR3: 0000000079ff2000 CR4: 00000000000006e0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
      Process rmmod (pid: 4477, threadinfo ffff810079a04000, task ffff8100775aa480)
      Stack:  ffff810079a05e68 0000000000000246 ffffffff8804eca0 0000000000000000
       ffffffff8805d080 00000000000000cf 0000000000000000 0000000000000880
       ffff810079a05eb8 ffffffff8803ec90 ffff810079a05eb8 0000000000000000
      Call Trace:
       [<ffffffff8803ec90>] :ax25:ax25_protocol_release+0xa0/0xb0
       [<ffffffff88056ecb>] :netrom:nr_exit+0x6b/0xf0
       [<ffffffff80268bf0>] sys_delete_module+0x170/0x1f0
       [<ffffffff8025da35>] trace_hardirqs_on+0xd5/0x170
       [<ffffffff804835aa>] trace_hardirqs_on_thunk+0x35/0x37
       [<ffffffff8020c13e>] system_call+0x7e/0x83
      
      
      Code: 0f 0b eb fe 66 66 90 66 66 90 48 8b 52 10 48 8b 02 25 00 40 
      RIP  [<ffffffff802ac646>] kfree+0x1c6/0x260
       RSP <ffff810079a05e48>
      Kernel panic - not syncing: Fatal exception
      Signed-off-by: NAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      9ac0be9d
  12. 19 7月, 2007 1 次提交
  13. 11 7月, 2007 1 次提交
  14. 10 5月, 2007 1 次提交
  15. 09 5月, 2007 1 次提交
  16. 26 4月, 2007 13 次提交
  17. 26 3月, 2007 1 次提交
    • R
      [NET] AX.25 Kconfig and docs updates and fixes · 954b2e7f
      Ralf Baechle 提交于
       o The AX.25 Howto is unmaintained since several years.  I've replaced it
         with a wiki at http://www.linux-ax25.org which provides more uptodate
         information.
       o Change default for AX25_DAMA_SLAVE to Y.  AX25_DAMA_SLAVE only compiles
         in support for DAMA but doesn't activate it.  I hope this gets Linux
         distributions to ship their AX.25 kernels with AX25_DAMA_SLAVE enabled.
         The price for this would be very small.
       o Delete historic changelog from comments, that's what SCM systems are
         meant to do.
       o ---help--- in Kconfig looks so yellingly eye insulting.  Use just help.
       o Rewrite the commented out piece of old Linux 2.4 configuration language
         to Kconfig for consistency.
       o Fixup dependencies.
      Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      954b2e7f
  18. 15 2月, 2007 1 次提交
    • E
      [PATCH] sysctl: remove insert_at_head from register_sysctl · 0b4d4147
      Eric W. Biederman 提交于
      The semantic effect of insert_at_head is that it would allow new registered
      sysctl entries to override existing sysctl entries of the same name.  Which is
      pain for caching and the proc interface never implemented.
      
      I have done an audit and discovered that none of the current users of
      register_sysctl care as (excpet for directories) they do not register
      duplicate sysctl entries.
      
      So this patch simply removes the support for overriding existing entries in
      the sys_sysctl interface since no one uses it or cares and it makes future
      enhancments harder.
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      Acked-by: NRalf Baechle <ralf@linux-mips.org>
      Acked-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Russell King <rmk@arm.linux.org.uk>
      Cc: David Howells <dhowells@redhat.com>
      Cc: "Luck, Tony" <tony.luck@intel.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Andi Kleen <ak@muc.de>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Corey Minyard <minyard@acm.org>
      Cc: Neil Brown <neilb@suse.de>
      Cc: "John W. Linville" <linville@tuxdriver.com>
      Cc: James Bottomley <James.Bottomley@steeleye.com>
      Cc: Jan Kara <jack@ucw.cz>
      Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
      Cc: Mark Fasheh <mark.fasheh@oracle.com>
      Cc: David Chinner <dgc@sgi.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Patrick McHardy <kaber@trash.net>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      0b4d4147