02 May, 2013

1 commit

  • Pull VFS updates from Al Viro,

    Misc cleanups all over the place, mainly wrt /proc interfaces (switch
    create_proc_entry to proc_create(), get rid of the deprecated
    create_proc_read_entry() in favor of using proc_create_data() and
    seq_file etc).

    7kloc removed.

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (204 commits)
    don't bother with deferred freeing of fdtables
    proc: Move non-public stuff from linux/proc_fs.h to fs/proc/internal.h
    proc: Make the PROC_I() and PDE() macros internal to procfs
    proc: Supply a function to remove a proc entry by PDE
    take cgroup_open() and cpuset_open() to fs/proc/base.c
    ppc: Clean up scanlog
    ppc: Clean up rtas_flash driver somewhat
    hostap: proc: Use remove_proc_subtree()
    drm: proc: Use remove_proc_subtree()
    drm: proc: Use minor->index to label things, not PDE->name
    drm: Constify drm_proc_list[]
    zoran: Don't print proc_dir_entry data in debug
    reiserfs: Don't access the proc_dir_entry in r_open(), r_start() r_show()
    proc: Supply an accessor for getting the data from a PDE's parent
    airo: Use remove_proc_subtree()
    rtl8192u: Don't need to save device proc dir PDE
    rtl8187se: Use a dir under /proc/net/r8180/
    proc: Add proc_mkdir_data()
    proc: Move some bits from linux/proc_fs.h to linux/{of.h,signal.h,tty.h}
    proc: Move PDE_NET() to fs/proc/proc_net.c
    ...

    Linus Torvalds
     

10 Apr, 2013

1 commit

  • The only part of proc_dir_entry the code outside of fs/proc
    really cares about is PDE(inode)->data. Provide a helper
    for that; static inline for now, eventually will be moved
    to fs/proc, along with the knowledge of struct proc_dir_entry
    layout.

    Signed-off-by: Al Viro

    Al Viro
     

08 Apr, 2013

2 commits

  • Conflicts:
    drivers/nfc/microread/mei.c
    net/netfilter/nfnetlink_queue_core.c

    Pull in 'net' to get Eric Biederman's AF_UNIX fix, upon which
    some cleanups are going to go on-top.

    Signed-off-by: David S. Miller

    David S. Miller
     
  • The current code does not fill the msg_name member in case it is set.
    It also does not set the msg_namelen member to 0 and therefore makes
    net/socket.c leak the local, uninitialized sockaddr_storage variable
    to userland -- 128 bytes of kernel stack memory.

    Fix that by simply setting msg_namelen to 0 as obviously nobody cared
    about vcc_recvmsg() not filling the msg_name in case it was set.

    Signed-off-by: Mathias Krause
    Signed-off-by: David S. Miller

    Mathias Krause
     

28 Mar, 2013

1 commit

  • Add a new constant ETH_P_802_3_MIN, the minimum ethernet type for
    an 802.3 frame. Frames with a lower value in the ethernet type field
    are Ethernet II.

    Also update all the users of this value that David Miller and
    I could find to use the new constant.

    Also correct a bug in util.c. The comparison with ETH_P_802_3_MIN
    should be >= not >.

    As suggested by Jesse Gross.

    Compile tested only.

    Cc: David Miller
    Cc: Jesse Gross
    Cc: Karsten Keil
    Cc: John W. Linville
    Cc: Johannes Berg
    Cc: Bart De Schuymer
    Cc: Stephen Hemminger
    Cc: Patrick McHardy
    Cc: Marcel Holtmann
    Cc: Gustavo Padovan
    Cc: Johan Hedberg
    Cc: linux-bluetooth@vger.kernel.org
    Cc: netfilter-devel@vger.kernel.org
    Cc: bridge@lists.linux-foundation.org
    Cc: linux-wireless@vger.kernel.org
    Cc: linux1394-devel@lists.sourceforge.net
    Cc: linux-media@vger.kernel.org
    Cc: netdev@vger.kernel.org
    Cc: dev@openvswitch.org
    Acked-by: Mauro Carvalho Chehab
    Acked-by: Stefan Richter
    Signed-off-by: Simon Horman
    Signed-off-by: David S. Miller

    Simon Horman
     

28 Feb, 2013

1 commit

  • I'm not sure why, but the hlist for each entry iterators were conceived

    list_for_each_entry(pos, head, member)

    The hlist ones were greedy and wanted an extra parameter:

    hlist_for_each_entry(tpos, pos, head, member)

    Why did they need an extra pos parameter? I'm not quite sure. Not only
    they don't really need it, it also prevents the iterator from looking
    exactly like the list iterator, which is unfortunate.

    Besides the semantic patch, there was some manual work required:

    - Fix up the actual hlist iterators in linux/list.h
    - Fix up the declaration of other iterators based on the hlist ones.
    - A very small amount of places were using the 'node' parameter, this
    was modified to use 'obj->member' instead.
    - Coccinelle didn't handle the hlist_for_each_entry_safe iterator
    properly, so those had to be fixed up manually.

    The semantic patch which is mostly the work of Peter Senna Tschudin is here:

    @@
    iterator name hlist_for_each_entry, hlist_for_each_entry_continue, hlist_for_each_entry_from, hlist_for_each_entry_rcu, hlist_for_each_entry_rcu_bh, hlist_for_each_entry_continue_rcu_bh, for_each_busy_worker, ax25_uid_for_each, ax25_for_each, inet_bind_bucket_for_each, sctp_for_each_hentry, sk_for_each, sk_for_each_rcu, sk_for_each_from, sk_for_each_safe, sk_for_each_bound, hlist_for_each_entry_safe, hlist_for_each_entry_continue_rcu, nr_neigh_for_each, nr_neigh_for_each_safe, nr_node_for_each, nr_node_for_each_safe, for_each_gfn_indirect_valid_sp, for_each_gfn_sp, for_each_host;

    type T;
    expression a,c,d,e;
    identifier b;
    statement S;
    @@

    -T b;

    [akpm@linux-foundation.org: drop bogus change from net/ipv4/raw.c]
    [akpm@linux-foundation.org: drop bogus hunk from net/ipv6/raw.c]
    [akpm@linux-foundation.org: checkpatch fixes]
    [akpm@linux-foundation.org: fix warnings]
    [akpm@linux-foudnation.org: redo intrusive kvm changes]
    Tested-by: Peter Senna Tschudin
    Acked-by: Paul E. McKenney
    Signed-off-by: Sasha Levin
    Cc: Wu Fengguang
    Cc: Marcelo Tosatti
    Cc: Gleb Natapov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Sasha Levin
     

27 Feb, 2013

1 commit

  • Pull vfs pile (part one) from Al Viro:
    "Assorted stuff - cleaning namei.c up a bit, fixing ->d_name/->d_parent
    locking violations, etc.

    The most visible changes here are death of FS_REVAL_DOT (replaced with
    "has ->d_weak_revalidate()") and a new helper getting from struct file
    to inode. Some bits of preparation to xattr method interface changes.

    Misc patches by various people sent this cycle *and* ocfs2 fixes from
    several cycles ago that should've been upstream right then.

    PS: the next vfs pile will be xattr stuff."

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (46 commits)
    saner proc_get_inode() calling conventions
    proc: avoid extra pde_put() in proc_fill_super()
    fs: change return values from -EACCES to -EPERM
    fs/exec.c: make bprm_mm_init() static
    ocfs2/dlm: use GFP_ATOMIC inside a spin_lock
    ocfs2: fix possible use-after-free with AIO
    ocfs2: Fix oops in ocfs2_fast_symlink_readpage() code path
    get_empty_filp()/alloc_file() leave both ->f_pos and ->f_version zero
    target: writev() on single-element vector is pointless
    export kernel_write(), convert open-coded instances
    fs: encode_fh: return FILEID_INVALID if invalid fid_type
    kill f_vfsmnt
    vfs: kill FS_REVAL_DOT by adding a d_weak_revalidate dentry op
    nfsd: handle vfs_getattr errors in acl protocol
    switch vfs_getattr() to struct path
    default SET_PERSONALITY() in linux/elf.h
    ceph: prepopulate inodes only when request is aborted
    d_hash_and_lookup(): export, switch open-coded instances
    9p: switch v9fs_set_create_acl() to inode+fid, do it before d_instantiate()
    9p: split dropping the acls from v9fs_set_create_acl()
    ...

    Linus Torvalds
     

23 Feb, 2013

1 commit


19 Feb, 2013

1 commit

  • proc_net_remove is only used to remove proc entries
    that under /proc/net,it's not a general function for
    removing proc entries of netns. if we want to remove
    some proc entries which under /proc/net/stat/, we still
    need to call remove_proc_entry.

    this patch use remove_proc_entry to replace proc_net_remove.
    we can remove proc_net_remove after this patch.

    Signed-off-by: Gao feng
    Signed-off-by: David S. Miller

    Gao feng
     

18 Dec, 2012

1 commit


02 Dec, 2012

6 commits

  • We don't need to schedule the wakeup tasklet on *every* unlock; only if we
    actually blocked the channel in the first place.

    Signed-off-by: David Woodhouse
    Acked-by: Krzysztof Mazur

    David Woodhouse
     
  • The br2684 does not check if used vcc is in connected state,
    causing potential Oops in pppoatm_send() when vcc->send() is called
    on not fully connected socket.

    Now br2684 can be assigned only on connected sockets; otherwise
    -EINVAL error is returned.

    Signed-off-by: Krzysztof Mazur
    Signed-off-by: David Woodhouse

    Krzysztof Mazur
     
  • The br2684 code used module_put() during unassignment from vcc with
    hope that we have BKL. This assumption is no longer true.

    Now owner field in atmvcc is used to move this module_put()
    to vcc_destroy_socket().

    Signed-off-by: David Woodhouse
    Acked-by: Krzysztof Mazur

    David Woodhouse
     
  • Now that we can return zero from pppoatm_send() for reasons *other* than
    the queue being full, that means we can't depend on a subsequent call to
    pppoatm_pop() waking the queue, and we might leave it stalled
    indefinitely.

    Use the ->release_cb() callback to wake the queue after the sock is
    unlocked.

    Signed-off-by: David Woodhouse
    Acked-by: Krzysztof Mazur

    David Woodhouse
     
  • Avoid submitting packets to a vcc which is being closed. Things go badly
    wrong when the ->pop method gets later called after everything's been
    torn down.

    Use the ATM socket lock for synchronisation with vcc_destroy_socket(),
    which clears the ATM_VF_READY bit under the same lock. Otherwise, we
    could end up submitting a packet to the device driver even after its
    ->ops->close method has been called. And it could call the vcc's ->pop
    method after the protocol has been shut down. Which leads to a panic.

    Signed-off-by: David Woodhouse
    Acked-by: Krzysztof Mazur

    David Woodhouse
     
  • The immediate use case for this is that it will allow us to ensure that a
    pppoatm queue is woken after it has to drop a packet due to the sock being
    locked.

    Note that 'release_cb' is called when the socket is *unlocked*. This is
    not to be confused with vcc_release() — which probably ought to be called
    vcc_close().

    Signed-off-by: David Woodhouse
    Acked-by: Krzysztof Mazur

    David Woodhouse
     

30 Nov, 2012

2 commits

  • The pppoatm_may_send() is quite heavy and it's called three times
    in pppoatm_send() and inlining costs more than 200 bytes of code
    (more than 10% of total pppoatm driver code size).

    add/remove: 1/0 grow/shrink: 0/1 up/down: 132/-367 (-235)
    function old new delta
    pppoatm_may_send - 132 +132
    pppoatm_send 900 533 -367

    Signed-off-by: Krzysztof Mazur
    Signed-off-by: David Woodhouse

    Krzysztof Mazur
     
  • The vcc_destroy_socket() closes vcc before the protocol is detached
    from vcc by calling vcc->push() with NULL skb. This leaves some time
    window, where the protocol may call vcc->send() on closed vcc
    and crash.

    Now pppoatm_send(), like vcc_sendmsg(), checks for vcc flags that
    indicate that vcc is not ready. If the vcc is not ready we just
    drop frame. Queueing frames is much more complicated because we
    don't have callbacks that inform us about vcc flags changes.

    Signed-off-by: Krzysztof Mazur
    Signed-off-by: David Woodhouse

    Krzysztof Mazur
     

28 Nov, 2012

4 commits

  • The pppoatm_send() does not take any lock that will prevent concurrent
    vcc_sendmsg(). This causes two problems:

    - there is no locking between checking the send queue size
    with atm_may_send() and incrementing sk_wmem_alloc,
    and the real queue size can be a little higher than sk_sndbuf

    - the vcc->sendmsg() can be called concurrently. I'm not sure
    if it's allowed. Some drivers (eni, nicstar, ...) seem
    to assume it will never happen.

    Now pppoatm_send() takes ATM socket lock, the same that is used
    in vcc_sendmsg() and other ATM socket functions. The pppoatm_send()
    is called with BH disabled, so bh_lock_sock() is used instead
    of lock_sock().

    Signed-off-by: Krzysztof Mazur
    Cc: Chas Williams - CONTRACTOR
    Signed-off-by: David Woodhouse

    Krzysztof Mazur
     
  • The pppoatm used module_put() during unassignment from vcc with
    hope that we have BKL. This assumption is no longer true.

    Now owner field in atmvcc is used to move this module_put()
    to vcc_destroy_socket().

    Signed-off-by: Krzysztof Mazur
    Signed-off-by: David Woodhouse

    Krzysztof Mazur
     
  • The pppoatm does not check if used vcc is in connected state,
    causing an Oops in pppoatm_send() when vcc->send() is called
    on not fully connected socket.

    Now pppoatm can be assigned only on connected sockets; otherwise
    -EINVAL error is returned.

    Signed-off-by: Krzysztof Mazur
    Cc: Chas Williams - CONTRACTOR
    Signed-off-by: David Woodhouse

    Krzysztof Mazur
     
  • The atm is using atmvcc->push(vcc, NULL) callback to notify protocol
    that vcc will be closed and protocol must detach from it. This callback
    is usually used by protocol to decrement module usage count by module_put(),
    but it leaves small window then module is still used after module_put().

    Now the owner of push() callback is kept in atmvcc and
    module_put(atmvcc->owner) is called after the protocol is detached from vcc.

    Signed-off-by: Krzysztof Mazur
    Signed-off-by: David Woodhouse
    Acked-by: Chas Williams

    Krzysztof Mazur
     

27 Nov, 2012

1 commit

  • There's really no excuse for an additional wmem_default of buffering
    between the netdev queue and the ATM device. Two packets (one in-flight,
    and one ready to send) ought to be fine. It's not as if it should take
    long to get another from the netdev queue when we need it.

    If necessary we can make the queue space configurable later, but I don't
    think it's likely to be necessary.

    cf. commit 9d02daf754238adac48fa075ee79e7edd3d79ed3 (pppoatm: Fix
    excessive queue bloat) which did something very similar for PPPoATM.

    Note that there is a tremendously unlikely race condition which may
    result in qspace temporarily going negative. If a CPU running the
    br2684_pop() function goes off into the weeds for a long period of time
    after incrementing qspace to 1, but before calling netdev_wake_queue()...
    and another CPU ends up calling br2684_start_xmit() and *stopping* the
    queue again before the first CPU comes back, the netdev queue could
    end up being woken when qspace has already reached zero.

    An alternative approach to coping with this race would be to check in
    br2684_start_xmit() for qspace==0 and return NETDEV_TX_BUSY, but just
    using '> 0' and '< 1' for comparison instead of '== 0' and '!= 0' is
    simpler. It just warranted a mention of *why* we do it that way...

    Move the call to atmvcc->send() to happen *after* the accounting and
    potentially stopping the netdev queue, in br2684_xmit_vcc(). This matters
    if the ->send() call suffers an immediate failure, because it'll call
    br2684_pop() with the offending skb before returning. We want that to
    happen *after* we've done the initial accounting for the packet in
    question. Also make it return an appropriate success/failure indication
    while we're at it.

    Tested by running 'ping -l 1000 bottomless.aaisp.net.uk' from within my
    network, with only a single PPPoE-over-BR2684 link running. And after
    setting txqueuelen on the nas0 interface to something low (5, in fact).
    Before the patch, we'd see about 15 packets being queued and a resulting
    latency of ~56ms being reached. After the patch, we see only about 8,
    which is fairly much what we expect. And a max latency of ~36ms. On this
    OpenWRT box, wmem_default is 163840.

    Signed-off-by: David Woodhouse
    Reviewed-by: Krzysztof Mazur
    Signed-off-by: David S. Miller

    David Woodhouse
     

01 Sep, 2012

1 commit


16 Aug, 2012

2 commits


04 Jun, 2012

2 commits

  • Adding casts of objects to the same type is unnecessary
    and confusing for a human reader.

    For example, this cast:

    int y;
    int *p = (int *)&y;

    I used the coccinelle script below to find and remove these
    unnecessary casts. I manually removed the conversions this
    script produces of casts with __force and __user.

    @@
    type T;
    T *p;
    @@

    - (T *)p
    + p

    Signed-off-by: Joe Perches
    Signed-off-by: David S. Miller

    Joe Perches
     
  • Remove some dropwatch/drop_monitor false positives.

    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     

23 May, 2012

1 commit

  • Pull trivial updates from Jiri Kosina:
    "As usual, it's mostly typo fixes, redundant code elimination and some
    documentation updates."

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (57 commits)
    edac, mips: don't change code that has been removed in edac/mips tree
    xtensa: Change mail addresses of Hannes Weiner and Oskar Schirmer
    lib: Change mail address of Oskar Schirmer
    net: Change mail address of Oskar Schirmer
    arm/m68k: Change mail address of Sebastian Hess
    i2c: Change mail address of Oskar Schirmer
    net: Fix tcp_build_and_update_options comment in struct tcp_sock
    atomic64_32.h: fix parameter naming mismatch
    Kconfig: replace "--- help ---" with "---help---"
    c2port: fix bogus Kconfig "default no"
    edac: Fix spelling errors.
    qla1280: Remove redundant NULL check before release_firmware() call
    remoteproc: remove redundant NULL check before release_firmware()
    qla2xxx: Remove redundant NULL check before release_firmware() call.
    aic94xx: Get rid of redundant NULL check before release_firmware() call
    tehuti: delete redundant NULL check before release_firmware()
    qlogic: get rid of a redundant test for NULL before call to release_firmware()
    bna: remove redundant NULL test before release_firmware()
    tg3: remove redundant NULL test before release_firmware() call
    typhoon: get rid of redundant conditional before all to release_firmware()
    ...

    Linus Torvalds
     

16 May, 2012

2 commits


10 May, 2012

1 commit

  • Use the new bool function ether_addr_equal to add
    some clarity and reduce the likelihood for misuse
    of compare_ether_addr for sorting.

    Done via cocci script:

    $ cat compare_ether_addr.cocci
    @@
    expression a,b;
    @@
    - !compare_ether_addr(a, b)
    + ether_addr_equal(a, b)

    @@
    expression a,b;
    @@
    - compare_ether_addr(a, b)
    + !ether_addr_equal(a, b)

    @@
    expression a,b;
    @@
    - !ether_addr_equal(a, b) == 0
    + ether_addr_equal(a, b)

    @@
    expression a,b;
    @@
    - !ether_addr_equal(a, b) != 0
    + !ether_addr_equal(a, b)

    @@
    expression a,b;
    @@
    - ether_addr_equal(a, b) == 0
    + !ether_addr_equal(a, b)

    @@
    expression a,b;
    @@
    - ether_addr_equal(a, b) != 0
    + ether_addr_equal(a, b)

    @@
    expression a,b;
    @@
    - !!ether_addr_equal(a, b)
    + ether_addr_equal(a, b)

    Signed-off-by: Joe Perches
    Signed-off-by: David S. Miller

    Joe Perches
     

16 Apr, 2012

1 commit


14 Apr, 2012

1 commit

  • We discovered that PPPoATM has an excessively deep transmit queue. A
    queue the size of the default socket send buffer (wmem_default) is
    maintained between the PPP generic core and the ATM device.

    Fix it to queue a maximum of *two* packets. The one the ATM device is
    currently working on, and one more for the ATM driver to process
    immediately in its TX done interrupt handler. The PPP core is designed
    to feed packets to the channel with minimal latency, so that really
    ought to be enough to keep the ATM device busy.

    While we're at it, fix the fact that we were triggering the wakeup
    tasklet on *every* pppoatm_pop() call. The comment saying "this is
    inefficient, but doing it right is too hard" turns out to be overly
    pessimistic... I think :)

    On machines like the Traverse Geos, with a slow Geode CPU and two
    high-speed ADSL2+ interfaces, there were reports of extremely high CPU
    usage which could partly be attributed to the extra wakeups.

    (The wakeup handling could actually be made a whole lot easier if we
    stop checking sk->sk_sndbuf altogether. Given that we now only queue
    *two* packets ever, one wonders what the point is. As it is, you could
    already deadlock the thing by setting the sk_sndbuf to a value lower
    than the MTU of the device, and it'd just block for ever.)

    Signed-off-by: David Woodhouse
    Signed-off-by: David S. Miller

    David Woodhouse
     

09 Apr, 2012

1 commit


06 Apr, 2012

1 commit


29 Mar, 2012

1 commit


05 Mar, 2012

1 commit

  • Since all that include/linux/if_ppp.h does is #include ,
    this replaces the occurrences of #include with
    #include .

    It also corrects an error in Documentation/networking/l2tp.txt, where
    it referenced include/linux/if_ppp.h as the source of some definitions
    that are actually now defined in include/linux/if_pppol2tp.h.

    Signed-off-by: Paul Mackerras
    Signed-off-by: David S. Miller

    Paul Mackerras
     

27 Feb, 2012

1 commit


22 Feb, 2012

1 commit

  • Commit 32092ecf0644 (atm: clip: Use device neigh support on top of
    "arp_tbl".) introduced a bug since clip_tbl is zeroed : Crash occurs in
    __neigh_for_each_release()

    idle_timer_check() must use instead arp_tbl and neigh_check_cb() should
    ignore non clip neighbours.

    Idea from David Miller.

    Reported-by: Meelis Roos
    Signed-off-by: Eric Dumazet
    Tested-by: Meelis Roos
    Signed-off-by: David S. Miller

    Eric Dumazet