08 Jun, 2007

18 commits

  • Currently we check for permission before deleting entries from SAD and
    SPD, (see security_xfrm_policy_delete() security_xfrm_state_delete())
    However we are not checking for authorization when flushing the SPD and
    the SAD completely. It was perhaps missed in the original security hooks
    patch.

    This patch adds a security check when flushing entries from the SAD and
    SPD. It runs the entire database and checks each entry for a denial.
    If the process attempting the flush is unable to remove all of the
    entries a denial is logged the the flush function returns an error
    without removing anything.

    This is particularly useful when a process may need to create or delete
    its own xfrm entries used for things like labeled networking but that
    same process should not be able to delete other entries or flush the
    entire database.

    Signed-off-by: Joy Latten
    Signed-off-by: Eric Paris
    Signed-off-by: James Morris

    Joy Latten
     
  • cbq and atm destroy their filters twice when destroying inner classes
    during qdisc destruction.

    Reported-and-tested-by: Strobl Anton

    Signed-off-by: Patrick McHardy
    Signed-off-by: David S. Miller

    Patrick McHardy
     
  • When changing the link state from userspace not affecting any other
    flags. Two duplicate notification are being sent, once as action
    in the NETDEV_UP/NETDEV_DOWN notification chain and a second time
    when comparing old and new device flags after the change has been
    completed. Although harmless, the duplicates should be avoided.

    Signed-off-by: Thomas Graf
    Signed-off-by: David S. Miller

    Thomas Graf
     
  • This reverts changesets:

    6aaf47fa48d3c44280810b1b470261d340e4ed87
    b7b5f487ab39bc10ed0694af35651a03d9cb97ff
    de34ed91c4ffa4727964a832c46e624dd1495cf5
    fc038410b4b1643766f8033f4940bcdb1dace633

    There are still some correctness issues recently
    discovered which do not have a known fix that doesn't
    involve doing a full hash table scan on port bind.

    So revert for now.

    Signed-off-by: David S. Miller

    David S. Miller
     
  • A recv() on an AF_UNIX, SOCK_STREAM socket can race with a
    send()+close() on the peer, causing recv() to return zero, even though
    the sent data should be received.

    This happens if the send() and the close() is performed between
    skb_dequeue() and checking sk->sk_shutdown in unix_stream_recvmsg():

    process A skb_dequeue() returns NULL, there's no data in the socket queue
    process B new data is inserted onto the queue by unix_stream_sendmsg()
    process B sk->sk_shutdown is set to SHUTDOWN_MASK by unix_release_sock()
    process A sk->sk_shutdown is checked, unix_release_sock() returns zero

    I'm surprised nobody noticed this, it's not hard to trigger. Maybe
    it's just (un)luck with the timing.

    It's possible to work around this bug in userspace, by retrying the
    recv() once in case of a zero return value.

    Signed-off-by: Miklos Szeredi
    Signed-off-by: David S. Miller

    Miklos Szeredi
     
  • The return value from textsearch_prepare() needs to be checked
    by IS_ERR(). Because it returns error code as a pointer.

    Cc: "Brian J. Murrell"
    Signed-off-by: Akinobu Mita
    Signed-off-by: Patrick McHardy
    Signed-off-by: David S. Miller

    Akinobu Mita
     
  • check_compat_entry_size_and_hooks iterates over the matches and calls
    compat_check_calc_match, which loads the match and calculates the
    compat offsets, but unlike the non-compat version, doesn't call
    ->checkentry yet. On error however it calls cleanup_matches, which in
    turn calls ->destroy, which can result in crashes if the destroy
    function (validly) expects to only get called after the checkentry
    function.

    Add a compat_release_match function that only drops the module reference
    on error and rename compat_check_calc_match to compat_find_calc_match to
    reflect the fact that it doesn't call the checkentry function.

    Reported by Jan Engelhardt

    Signed-off-by: Dmitry Mishin
    Signed-off-by: Patrick McHardy
    Signed-off-by: David S. Miller

    Dmitry Mishin
     
  • When a helper module is unloaded all conntracks refering to it have their
    helper pointer NULLed out, leading to lots of races. In most places this
    can be fixed by proper use of RCU (they do already check for != NULL,
    but in a racy way), additionally nf_conntrack_expect_related needs to
    bail out when no helper is present.

    Also remove two paranoid BUG_ONs in nf_conntrack_proto_gre that are racy
    and not worth fixing.

    Signed-off-by: Patrick McHarrdy
    Signed-off-by: David S. Miller

    Patrick McHarrdy
     
  • ifindex == 0 does not exist and implies we should do a lookup by name if
    one was given.

    Signed-off-by: Patrick McHardy
    Signed-off-by: David S. Miller

    Patrick McHardy
     
  • Signed-off-by: Patrick McHardy
    Signed-off-by: David S. Miller

    Patrick McHardy
     
  • GCC doesn't like the way Stephen initially did it:

    net/ipv4/tcp_probe.c:83: warning: empty declaration

    Signed-off-by: David S. Miller

    David S. Miller
     
  • LIMIT_NETDEBUG allows the admin to disable some warning messages (echo 0
    >/proc/sys/net/core/warnings).

    The "TCP: Treason uncloaked!" message can use this facility.

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

    Eric Dumazet
     
  • Signed-off-by: Denis Cheng
    Signed-off-by: David S. Miller

    Denis Cheng
     
  • Previously inet devices were only constructed when addresses are added
    (or rarely in ipmr). Therefore the default config values they get are
    the ones at the time of these operations.

    Now that we're creating inet devices earlier, this changes the
    behaviour of default config values in an incompatible way (see bug
    #8519).

    This patch creates a compromise by setting the default values at the
    same point as before but only for those that have not been explicitly
    set by the user since the inet device's creation.

    Signed-off-by: Herbert Xu
    Signed-off-by: David S. Miller

    Herbert Xu
     
  • Previously once inetdev_init has been called on a device any changes
    made to ipv4_devconf_dflt would have no effect on that device's
    configuration.

    This creates a problem since we have moved the point where
    inetdev_init is called from when an address is added to where the
    device is registered.

    This patch is the first half of a set that tries to mimic the old
    behaviour while still calling inetdev_init.

    It propagates any changes to ipv4_devconf_dflt to those devices that
    have not had the corresponding attribute set.

    The next patch will forcibly set all values at the point where
    inetdev_init was previously called.

    Signed-off-by: Herbert Xu
    Signed-off-by: David S. Miller

    Herbert Xu
     
  • This patch converts the ipv4_devconf config members (everything except
    sysctl) to an array. This allows easier manipulation which will be
    needed later on to provide better management of default config values.

    Signed-off-by: Herbert Xu
    Signed-off-by: David S. Miller

    Herbert Xu
     
  • When I made the inetdev_init call work on all devices I incorrectly
    left in the panic call as well. It is obviously undesirable to
    panic on an allocation failure for a normal network device. This
    patch moves the panic call under the loopback if clause.

    Signed-off-by: Herbert Xu
    Signed-off-by: David S. Miller

    Herbert Xu
     
  • A time_wait socket inherits sk_bound_dev_if from the original socket,
    but it is not used when sending ACK packets using ip_send_reply.

    Fix by passing the oif to ip_send_reply in struct ip_reply_arg and
    use it for output routing.

    Signed-off-by: Patrick McHardy
    Signed-off-by: David S. Miller

    Patrick McHardy
     

04 Jun, 2007

9 commits

  • Currently when icmp_errors_use_inbound_ifaddr is set and an ICMP error is
    sent after the packet passed through ip_output(), an address from the
    outgoing interface is chosen as ICMP source address since skb->dev doesn't
    point to the incoming interface anymore.

    Fix this by doing an interface lookup on rt->dst.iif and using that device.

    Signed-off-by: Patrick McHardy
    Signed-off-by: David S. Miller

    Patrick McHardy
     
  • Signed-off-by: Wei Dong
    Signed-off-by: David S. Miller

    Wei Dong
     
  • This isn't a bug just yet as only TCP uses sk_setup_caps for GSO.
    However, if and when UDP or something else starts using it this is
    likely to cause a problem if we forget to add software emulation
    for it at the same time.

    The problem is that right now we translate GSO emulation to the
    bitmask NETIF_F_GSO_MASK, which includes every protocol, even
    ones that we cannot emulate.

    This patch makes it provide only the ones that we can emulate.

    Signed-off-by: Herbert Xu
    Signed-off-by: David S. Miller

    Herbert Xu
     
  • The code used to ignore GSO completely, passing either way too
    small or zero pkts_acked when GSO skb or part of it got ACKed.
    In addition, there is no need to calculate the value in the loop
    but simple arithmetics after the loop is sufficient. There is
    no need to handle SYN case specially because congestion control
    modules are not yet initialized when FLAG_SYN_ACKED is set.

    Signed-off-by: Ilpo Järvinen
    Signed-off-by: David S. Miller

    Ilpo Järvinen
     
  • Recent gcc versions emit warnings when unsigned variables are
    compared < 0 or >= 0.

    Signed-off-by: Bill Nottingham
    Signed-off-by: David S. Miller

    Bill Nottingham
     
  • round_jiffies for net dev watchdog timer.

    Signed-off-by: Venkatesh Pallipadi
    Signed-off-by: David S. Miller

    Venkatesh Pallipadi
     
  • This diff changes the default port range used for outgoing connections,
    from "use 32768-61000 in most cases, but use N-4999 on small boxes
    (where N is a multiple of 1024, depending on just *how* small the box
    is)" to just "use 32768-61000 in all cases".

    I don't believe there are any drawbacks to this change, and it keeps
    outgoing connection ports farther away from the mess of
    IANA-registered ports.

    Signed-off-by: Mark Glines
    Signed-off-by: David S. Miller

    Mark Glines
     
  • Based upon an excellent bug report and initial patch by
    Frederik Deweerdt.

    The UNIX datagram connect code blindly dereferences other->sk_socket
    via the call down to the security_unix_may_send() function.

    Without locking 'other' that pointer can go NULL via unix_release_sock()
    which does sock_orphan() which also marks the socket SOCK_DEAD.

    So we have to lock both 'sk' and 'other' yet avoid all kinds of
    potential deadlocks (connect to self is OK for datagram sockets and it
    is possible for two datagram sockets to perform a simultaneous connect
    to each other). So what we do is have a "double lock" function similar
    to how we handle this situation in other areas of the kernel. We take
    the lock of the socket pointer with the smallest address first in
    order to avoid ABBA style deadlocks.

    Once we have them both locked, we check to see if SOCK_DEAD is set
    for 'other' and if so, drop everything and retry the lookup.

    Signed-off-by: David S. Miller

    David S. Miller
     
  • The unix_state_*() locking macros imply that there is some
    rwlock kind of thing going on, but the implementation is
    actually a spinlock which makes the code more confusing than
    it needs to be.

    So use plain unix_state_lock and unix_state_unlock.

    Signed-off-by: David S. Miller

    David S. Miller
     

03 Jun, 2007

1 commit

  • The interface for network device VLAN extension was confusing.
    The kill_vid function is only really useful for devices that do
    hardware filtering. Devices that only do VLAN receiption without
    filtering were being forced to provide the hook, and there were
    bugs in those devices.

    Many drivers had kill_vid routine that called vlan_group_set_device, with
    NULL, but that is done already.

    Signed-off-by: Stephen Hemminger
    Signed-off-by: Jeff Garzik

    Stephen Hemminger
     

31 May, 2007

12 commits