29 Jun, 2014

1 commit

  • Pull SCSI target fixes from Nicholas Bellinger:
    "Mostly minor fixes this time around. The highlights include:

    - iscsi-target CHAP authentication fixes to enforce explicit key
    values (Tejas Vaykole + rahul.rane)
    - fix a long-standing OOPs in target-core when a alua configfs
    attribute is accessed after port symlink has been removed.
    (Sebastian Herbszt)
    - fix a v3.10.y iscsi-target regression causing the login reject
    status class/detail to be ignored (Christoph Vu-Brugier)
    - fix a v3.10.y iscsi-target regression to avoid rejecting an
    existing ITT during Data-Out when data-direction is wrong (Santosh
    Kulkarni + Arshad Hussain)
    - fix a iscsi-target related shutdown deadlock on UP kernels (Mikulas
    Patocka)
    - fix a v3.16-rc1 build issue with vhost-scsi + !CONFIG_NET (MST)"

    * git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending:
    iscsi-target: fix iscsit_del_np deadlock on unload
    iovec: move memcpy_from/toiovecend to lib/iovec.c
    iscsi-target: Avoid rejecting incorrect ITT for Data-Out
    tcm_loop: Fix memory leak in tcm_loop_submission_work error path
    iscsi-target: Explicily clear login response PDU in exception path
    target: Fix left-over se_lun->lun_sep pointer OOPs
    iscsi-target; Enforce 1024 byte maximum for CHAP_C key value
    iscsi-target: Convert chap_server_compute_md5 to use kstrtoul

    Linus Torvalds
     

28 Jun, 2014

1 commit

  • ERROR: "memcpy_fromiovecend" [drivers/vhost/vhost_scsi.ko] undefined!

    commit 9f977ef7b671f6169eca78bf40f230fe84b7c7e5
    vhost-scsi: Include prot_bytes into expected data transfer length
    in target-pending makes drivers/vhost/scsi.c call memcpy_fromiovecend().
    This function is not available when CONFIG_NET is not enabled.

    socket.h already includes uio.h, so no callers need updating.

    Reported-by: Randy Dunlap
    Cc: Stephen Rothwell
    Cc: "David S. Miller"
    Signed-off-by: David S. Miller
    Signed-off-by: Michael S. Tsirkin
    Signed-off-by: Nicholas Bellinger

    Michael S. Tsirkin
     

26 Jun, 2014

6 commits

  • Pull networking fixes from David Miller:

    1) Fix crash in ipvs tot_stats estimator, from Julian Anastasov.

    2) Fix OOPS in nf_nat on netns removal, from Florian Westphal.

    3) Really really really fix locking issues in slip and slcan tty write
    wakeups, from Tyler Hall.

    4) Fix checksum offloading in fec driver, from Fugang Duan.

    5) Off by one in BPF instruction limit test, from Kees Cook.

    6) Need to clear all TSO capability flags when doing software TSO in
    tg3 driver, from Prashant Sreedharan.

    7) Fix memory leak in vlan_reorder_header() error path, from Li
    RongQing.

    8) Fix various bugs in xen-netfront and xen-netback multiqueue support,
    from David Vrabel and Wei Liu.

    9) Fix deadlock in cxgb4 driver, from Li RongQing.

    10) Prevent double free of no-cache DST entries, from Eric Dumazet.

    11) Bad csum_start handling in skb_segment() leads to crashes when
    forwarding, from Tom Herbert.

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (76 commits)
    net: fix setting csum_start in skb_segment()
    ipv4: fix dst race in sk_dst_get()
    net: filter: Use kcalloc/kmalloc_array to allocate arrays
    trivial: net: filter: Change kerneldoc parameter order
    trivial: net: filter: Fix typo in comment
    net: allwinner: emac: Add missing free_irq
    cxgb4: use dev_port to identify ports
    xen-netback: bookkeep number of active queues in our own module
    tg3: Change nvram command timeout value to 50ms
    cxgb4: Not need to hold the adap_rcu_lock lock when read adap_rcu_list
    be2net: fix qnq mode detection on VFs
    of: mdio: fixup of_phy_register_fixed_link parsing of new bindings
    at86rf230: fix irq setup
    net: phy: at803x: fix coccinelle warnings
    net/mlx4_core: Fix the error flow when probing with invalid VF configuration
    tulip: Poll link status more frequently for Comet chips
    net: huawei_cdc_ncm: increase command buffer size
    drivers: net: cpsw: fix dual EMAC stall when connected to same switch
    xen-netfront: recreate queues correctly when reconnecting
    xen-netfront: fix oops when disconnected from backend
    ...

    Linus Torvalds
     
  • Dave Jones reported that a crash is occurring in

    csum_partial
    tcp_gso_segment
    inet_gso_segment
    ? update_dl_migration
    skb_mac_gso_segment
    __skb_gso_segment
    dev_hard_start_xmit
    sch_direct_xmit
    __dev_queue_xmit
    ? dev_hard_start_xmit
    dev_queue_xmit
    ip_finish_output
    ? ip_output
    ip_output
    ip_forward_finish
    ip_forward
    ip_rcv_finish
    ip_rcv
    __netif_receive_skb_core
    ? __netif_receive_skb_core
    ? trace_hardirqs_on
    __netif_receive_skb
    netif_receive_skb_internal
    napi_gro_complete
    ? napi_gro_complete
    dev_gro_receive
    ? dev_gro_receive
    napi_gro_receive

    It looks like a likely culprit is that SKB_GSO_CB()->csum_start is
    not set correctly when doing non-scatter gather. We are using
    offset as opposed to doffset.

    Reported-by: Dave Jones
    Tested-by: Dave Jones
    Signed-off-by: Tom Herbert
    Signed-off-by: Eric Dumazet
    Fixes: 7e2b10c1e52ca ("net: Support for multiple checksums with gso")
    Acked-by: Tom Herbert
    Signed-off-by: David S. Miller

    Tom Herbert
     
  • When IP route cache had been removed in linux-3.6, we broke assumption
    that dst entries were all freed after rcu grace period. DST_NOCACHE
    dst were supposed to be freed from dst_release(). But it appears
    we want to keep such dst around, either in UDP sockets or tunnels.

    In sk_dst_get() we need to make sure dst refcount is not 0
    before incrementing it, or else we might end up freeing a dst
    twice.

    DST_NOCACHE set on a dst does not mean this dst can not be attached
    to a socket or a tunnel.

    Then, before actual freeing, we need to observe a rcu grace period
    to make sure all other cpus can catch the fact the dst is no longer
    usable.

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

    Eric Dumazet
     
  • Use kcalloc/kmalloc_array to make it clear we're allocating arrays. No
    integer overflow can actually happen here, since len/flen is guaranteed
    to be less than BPF_MAXINSNS (4096). However, this changed makes sure
    we're not going to get one if BPF_MAXINSNS were ever increased.

    Signed-off-by: Tobias Klauser
    Acked-by: Daniel Borkmann
    Acked-by: Alexei Starovoitov
    Signed-off-by: David S. Miller

    Tobias Klauser
     
  • Change the order of the parameters to sk_unattached_filter_create() in
    the kerneldoc to reflect the order they appear in the actual function.

    This fix is only cosmetic, in the generated doc they still appear in the
    correct order without the fix.

    Signed-off-by: Tobias Klauser
    Acked-by: Daniel Borkmann
    Acked-by: Alexei Starovoitov
    Signed-off-by: David S. Miller

    Tobias Klauser
     
  • Signed-off-by: Tobias Klauser
    Acked-by: Daniel Borkmann
    Acked-by: Alexei Starovoitov
    Signed-off-by: David S. Miller

    Tobias Klauser
     

25 Jun, 2014

1 commit

  • Fix nfs4_negotiate_security to create an rpc_clnt used to test each SECINFO
    returned pseudoflavor. Check credential creation (and gss_context creation)
    which is important for RPC_AUTH_GSS pseudoflavors which can fail for multiple
    reasons including mis-configuration.

    Don't call nfs4_negotiate in nfs4_submount as it was just called by
    nfs4_proc_lookup_mountpoint (nfs4_proc_lookup_common)

    Signed-off-by: Andy Adamson
    [Trond: fix corrupt return value from nfs_find_best_sec()]
    Signed-off-by: Trond Myklebust

    Andy Adamson
     

22 Jun, 2014

1 commit

  • skb_cow called in vlan_reorder_header does not free the skb when it failed,
    and vlan_reorder_header returns NULL to reset original skb when it is called
    in vlan_untag, lead to a memory leak.

    Signed-off-by: Li RongQing
    Acked-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Li RongQing
     

20 Jun, 2014

4 commits

  • John W. Linville says:

    ====================
    pull request: wireless 2014-06-18

    Please pull this batch of fixes intended for the 3.16 stream!

    For the Bluetooth bits, Gustavo says:

    "This is our first batch of fixes for 3.16. Be aware that two patches here
    are not exactly bugfixes:

    * 71f28af57066 Bluetooth: Add clarifying comment for conn->auth_type
    This commit just add some important security comments to the code, we found
    it important enough to include it here for 3.16 since it is security related.

    * 9f7ec8871132 Bluetooth: Refactor discovery stopping into its own function
    This commit is just a refactor in a preparation for a fix in the next
    commit (f8680f128b).

    All the other patches are fixes for deadlocks and for the Bluetooth protocols,
    most of them related to authentication and encryption."

    On top of that...

    Chin-Ran Lo fixes a problems with overlapping DMA areas in mwifiex.

    Michael Braun corrects a couple of issues in order to enable a new
    device in rt2800usb.

    Rafał Miłecki reverts a b43 patch that caused a regression, fixes a
    Kconfig typo, and corrects a frequency reporting error with the G-PHY.

    Stanislaw Grsuzka fixes an rfkill regression for rt2500pci, and avoids
    a rt2x00 scheduling while atomic BUG.

    Please let me know if there are problems!
    ====================

    Signed-off-by: David S. Miller

    David S. Miller
     
  • When writing to the sysctl field net.sctp.auth_enable, it can well
    be that the user buffer we handed over to proc_dointvec() via
    proc_sctp_do_auth() handler contains something other than integers.

    In that case, we would set an uninitialized 4-byte value from the
    stack to net->sctp.auth_enable that can be leaked back when reading
    the sysctl variable, and it can unintentionally turn auth_enable
    on/off based on the stack content since auth_enable is interpreted
    as a boolean.

    Fix it up by making sure proc_dointvec() returned sucessfully.

    Fixes: b14878ccb7fa ("net: sctp: cache auth_enable per endpoint")
    Reported-by: Florian Westphal
    Signed-off-by: Daniel Borkmann
    Acked-by: Neil Horman
    Acked-by: Vlad Yasevich
    Signed-off-by: David S. Miller

    Daniel Borkmann
     
  • If there is an MSS change (or misbehaving receiver) that causes a SACK
    to arrive that covers the end of an skb but is less than one MSS, then
    tcp_match_skb_to_sack() was rounding up pkt_len to the full length of
    the skb ("Round if necessary..."), then chopping all bytes off the skb
    and creating a zero-byte skb in the write queue.

    This was visible now because the recently simplified TLP logic in
    bef1909ee3ed1c ("tcp: fixing TLP's FIN recovery") could find that 0-byte
    skb at the end of the write queue, and now that we do not check that
    skb's length we could send it as a TLP probe.

    Consider the following example scenario:

    mss: 1000
    skb: seq: 0 end_seq: 4000 len: 4000
    SACK: start_seq: 3999 end_seq: 4000

    The tcp_match_skb_to_sack() code will compute:

    in_sack = false
    pkt_len = start_seq - TCP_SKB_CB(skb)->seq = 3999 - 0 = 3999
    new_len = (pkt_len / mss) * mss = (3999/1000)*1000 = 3000
    new_len += mss = 4000

    Previously we would find the new_len > skb->len check failing, so we
    would fall through and set pkt_len = new_len = 4000 and chop off
    pkt_len of 4000 from the 4000-byte skb, leaving a 0-byte segment
    afterward in the write queue.

    With this new commit, we notice that the new new_len >= skb->len check
    succeeds, so that we return without trying to fragment.

    Fixes: adb92db857ee ("tcp: Make SACK code to split only at mss boundaries")
    Reported-by: Eric Dumazet
    Signed-off-by: Neal Cardwell
    Cc: Eric Dumazet
    Cc: Yuchung Cheng
    Cc: Ilpo Jarvinen
    Acked-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Neal Cardwell
     
  • This reverts commit d36a4f4b472334562b8e7252e35d3d770db83815.

    Signed-off-by: David S. Miller

    David S. Miller
     

19 Jun, 2014

5 commits

  • The original checks (via sk_chk_filter) for instruction count uses ">",
    not ">=", so changing this in sk_convert_filter has the potential to break
    existing seccomp filters that used exactly BPF_MAXINSNS many instructions.

    Fixes: bd4cf0ed331a ("net: filter: rework/optimize internal BPF interpreter's instruction set")
    Signed-off-by: Kees Cook
    Cc: stable@vger.kernel.org # v3.15+
    Acked-by: Daniel Borkmann
    Acked-by: Alexei Starovoitov
    Signed-off-by: David S. Miller

    Kees Cook
     
  • sysctl handler proc_sctp_do_hmac_alg(), proc_sctp_do_rto_min() and
    proc_sctp_do_rto_max() do not properly reflect some error cases
    when writing values via sysctl from internal proc functions such
    as proc_dointvec() and proc_dostring().

    In all these cases we pass the test for write != 0 and partially
    do additional work just to notice that additional sanity checks
    fail and we return with hard-coded -EINVAL while proc_do*
    functions might also return different errors. So fix this up by
    simply testing a successful return of proc_do* right after
    calling it.

    This also allows to propagate its return value onwards to the user.
    While touching this, also fix up some minor style issues.

    Fixes: 4f3fdf3bc59c ("sctp: add check rto_min and rto_max in sysctl")
    Fixes: 3c68198e7511 ("sctp: Make hmac algorithm selection for cookie generation dynamic")
    Signed-off-by: Daniel Borkmann
    Signed-off-by: David S. Miller

    Daniel Borkmann
     
  • Return the actual error code if call kset_create_and_add() failed

    Cc: David S. Miller
    Signed-off-by: Jie Liu
    Signed-off-by: David S. Miller

    Jie Liu
     
  • Pablo Neira Ayuso says:

    ====================
    netfilter fixes for net

    The following patchset contains netfilter updates for your net tree,
    they are:

    1) Fix refcount leak when dumping the dying/unconfirmed conntrack lists,
    from Florian Westphal.

    2) Fix crash in NAT when removing a netnamespace, also from Florian.

    3) Fix a crash in IPVS when trying to remove an estimator out of the
    sysctl scope, from Julian Anastasov.

    4) Add zone attribute to the routing to calculate the message size in
    ctnetlink events, from Ken-ichirou MATSUZAWA.

    5) Another fix for the dying/unconfirmed list which was preventing to
    dump more than one memory page of entries (~17 entries in x86_64).

    6) Fix missing RCU-safe list insertion in the rule replacement code
    in nf_tables.

    7) Since the new transaction infrastructure is in place, we have to
    upgrade the chain use counter from u16 to u32 to avoid overflow
    after more than 2^16 rules are added.

    8) Fix refcount leak when replacing rule in nf_tables. This problem
    was also introduced in new transaction.

    9) Call the ->destroy() callback when releasing nft-xt rules to fix
    module refcount leaks.

    10) Set the family in the netlink messages that contain set elements
    in nf_tables to make it consistent with other object types.

    11) Don't dump NAT port information if it is unset in nft_nat.

    12) Update the MAINTAINERS file, I have merged the ebtables entry
    into netfilter. While at it, also removed the netfilter users
    mailing list, the development list should be enough.
    ====================

    Signed-off-by: David S. Miller

    David S. Miller
     
  • …wireless into for-davem

    John W. Linville
     

18 Jun, 2014

1 commit


17 Jun, 2014

1 commit


16 Jun, 2014

13 commits


15 Jun, 2014

2 commits

  • Commit 3fd091e73b81 ("[SCTP]: Remove multiple levels of msecs
    to jiffies conversions.") has silently changed permissions for
    rto_alpha and rto_beta knobs from 0644 to 0444. The purpose of
    this was to discourage users from tweaking rto_alpha and
    rto_beta knobs in production environments since they are key
    to correctly compute rtt/srtt.

    RFC4960 under section 6.3.1. RTO Calculation says regarding
    rto_alpha and rto_beta under rule C3 and C4:

    [...]
    C3) When a new RTT measurement R' is made, set

    RTTVAR
    Cc: Vlad Yasevich
    Signed-off-by: David S. Miller

    Daniel Borkmann
     
  • Geert reported issues regarding checksum complete and UDP.
    The logic introduced in commit 7e3cead5172927732f51fde
    ("net: Save software checksum complete") is not correct.

    This patch:
    1) Restores code in __skb_checksum_complete_header except for setting
    CHECKSUM_UNNECESSARY. This function may be calculating checksum on
    something less than skb->len.
    2) Adds saving checksum to __skb_checksum_complete. The full packet
    checksum 0..skb->len is calculated without adding in pseudo header.
    This value is saved in skb->csum and then the pseudo header is added
    to that to derive the checksum for validation.
    3) In both __skb_checksum_complete_header and __skb_checksum_complete,
    set skb->csum_valid to whether checksum of zero was computed. This
    allows skb_csum_unnecessary to return true without changing to
    CHECKSUM_UNNECESSARY which was done previously.
    4) Copy new csum related bits in __copy_skb_header.

    Reported-by: Geert Uytterhoeven
    Signed-off-by: Tom Herbert
    Signed-off-by: David S. Miller

    Tom Herbert
     

14 Jun, 2014

1 commit

  • Its too easy to add thousand of UDP sockets on a particular bucket,
    and slow down an innocent multicast receiver.

    Early demux is supposed to be an optimization, we should avoid spending
    too much time in it.

    It is interesting to note __udp4_lib_demux_lookup() only tries to
    match first socket in the chain.

    10 is the threshold we already have in __udp4_lib_lookup() to switch
    to secondary hash.

    Fixes: 421b3885bf6d5 ("udp: ipv4: Add udp early demux")
    Signed-off-by: Eric Dumazet
    Reported-by: David Held
    Cc: Shawn Bohrer
    Signed-off-by: David S. Miller

    Eric Dumazet
     

13 Jun, 2014

3 commits

  • Kernel supports SMP Security Request so don't block increasing security
    when we are slave.

    Signed-off-by: Marcin Kraglak
    Acked-by: Johan Hedberg
    Signed-off-by: Marcel Holtmann
    Cc: stable@vger.kernel.org

    Marcin Kraglak
     
  • The SMP code expects hdev to be unlocked since e.g. crypto functions
    will try to (re)lock it. Therefore, we need to release the lock before
    calling into smp.c from mgmt.c. Without this we risk a deadlock whenever
    the smp_user_confirm_reply() function is called.

    Signed-off-by: Johan Hedberg
    Tested-by: Lukasz Rymanowski
    Signed-off-by: Marcel Holtmann
    Cc: stable@vger.kernel.org

    Johan Hedberg
     
  • A deadlock occurs when PDU containing invalid SMP opcode is received on
    Security Manager Channel over LE link and conn->pending_rx_work worker
    has not run yet.

    When LE link is created l2cap_conn_ready() is called and before
    returning it schedules conn->pending_rx_work worker to hdev->workqueue.
    Incoming data to SMP fixed channel is handled by l2cap_recv_frame()
    which calls smp_sig_channel() to handle the SMP PDU. If
    smp_sig_channel() indicates failure l2cap_conn_del() is called to delete
    the connection. When deleting the connection, l2cap_conn_del() purges
    the pending_rx queue and calls flush_work() to wait for the
    pending_rx_work worker to complete.

    Since incoming data is handled by a worker running from the same
    workqueue as the pending_rx_work is being scheduled on, we will deadlock
    on waiting for pending_rx_work to complete.

    This patch fixes the deadlock by calling cancel_work_sync() instead of
    flush_work().

    Signed-off-by: Jukka Taimisto
    Signed-off-by: Marcel Holtmann
    Cc: stable@vger.kernel.org

    Jukka Taimisto