20 Jan, 2021

1 commit

  • commit 86b53fbf08f48d353a86a06aef537e78e82ba721 upstream.

    A return value of 0 means success. This is documented in lib/kstrtox.c.

    This was found by trying to mount an NFS share from a link-local IPv6
    address with the interface specified by its index:

    mount("[fe80::1%1]:/srv/nfs", "/mnt", "nfs", 0, "nolock,addr=fe80::1%1")

    Before this commit this failed with EINVAL and also caused the following
    message in dmesg:

    [...] NFS: bad IP address specified: addr=fe80::1%1

    The syscall using the same address based on the interface name instead
    of its index succeeds.

    Credits for this patch go to my colleague Christian Speich, who traced
    the origin of this bug to this line of code.

    Signed-off-by: Johannes Nixdorf
    Fixes: 00cfaa943ec3 ("replace strict_strto calls")
    Signed-off-by: Trond Myklebust
    Signed-off-by: Greg Kroah-Hartman

    j.nixdorf@avm.de
     

30 Dec, 2020

5 commits

  • commit 15261b9126cd5bb2ad8521da49d8f5c042d904c7 upstream.

    Olga K. observed that rpcrdma_marsh_req() allocates sparse pages
    only when it has determined that a Reply chunk is necessary. There
    are plenty of cases where no Reply chunk is needed, but the
    XDRBUF_SPARSE_PAGES flag is set. The result would be a crash in
    rpcrdma_inline_fixup() when it tries to copy parts of the received
    Reply into a missing page.

    To avoid crashing, handle sparse page allocation up front.

    Until XATTR support was added, this issue did not appear often
    because the only SPARSE_PAGES consumer always expected a reply large
    enough to always require a Reply chunk.

    Reported-by: Olga Kornievskaia
    Signed-off-by: Chuck Lever
    Cc:
    Signed-off-by: Trond Myklebust
    Signed-off-by: Greg Kroah-Hartman

    Chuck Lever
     
  • [ Upstream commit ac9645c87380e39a8fa87a1b51721efcdea89dbf ]

    When receiving pages data, return value 'ret' when positive includes
    `buf->page_base`, so we should subtract that before it is used for
    changing `offset` and comparing against `want`.

    This was discovered on the very rare cases where the server returned a
    chunk of bytes that when added to the already received amount of bytes
    for the pages happened to match the current `recv.len`, for example
    on this case:

    buf->page_base : 258356
    actually received from socket: 1740
    ret : 260096
    want : 260096

    In this case neither of the two 'if ... goto out' trigger, and we
    continue to tail parsing.

    Worth to mention that the ensuing EMSGSIZE from the continued execution of
    `xs_read_xdr_buf` may be observed by an application due to 4 superfluous
    bytes being added to the pages data.

    Fixes: 277e4ab7d530 ("SUNRPC: Simplify TCP receive code by switching to using iterators")
    Signed-off-by: Dan Aloni
    Signed-off-by: Trond Myklebust
    Signed-off-by: Sasha Levin

    Dan Aloni
     
  • [ Upstream commit 35a6d396721e28ba161595b0fc9e8896c00399bb ]

    'snprintf' returns the number of characters which would have been written
    if enough space had been available, excluding the terminating null byte.
    Thus, the return value of 'sizeof(buf)' means that the last character
    has been dropped.

    Signed-off-by: Fedor Tokarev
    Fixes: 2f34b8bfae19 ("SUNRPC: add links for all client xprts to debugfs")
    Signed-off-by: Trond Myklebust
    Signed-off-by: Sasha Levin

    Fedor Tokarev
     
  • [ Upstream commit d5aa6b22e2258f05317313ecc02efbb988ed6d38 ]

    According to RFC5666, the correct netid for an IPv6 addressed RDMA
    transport is "rdma6", which we've supported as a mount option since
    Linux-4.7. The problem is when we try to load the module "xprtrdma6",
    that will fail, since there is no modulealias of that name.

    Fixes: 181342c5ebe8 ("xprtrdma: Add rdma6 option to support NFS/RDMA IPv6")
    Signed-off-by: Trond Myklebust
    Signed-off-by: Sasha Levin

    Trond Myklebust
     
  • [ Upstream commit e4c72201b6ec3173dfe13fa2e2335a3ad78d4921 ]

    Currently, we wake up the tasks by priority queue ordering, which means
    that we ignore the batching that is supposed to help with QoS issues.

    Fixes: c049f8ea9a0d ("SUNRPC: Remove the bh-safe lock requirement on the rpc_wait_queue->lock")
    Signed-off-by: Trond Myklebust
    Signed-off-by: Sasha Levin

    Trond Myklebust
     

09 Nov, 2020

1 commit


07 Nov, 2020

1 commit

  • You can't write to this file because the permissions are 0444. But
    it sort of looked like you could do a write and it would result in
    a read. Then it looked like proc_sys_call_handler() just ignored
    it. Which is confusing. It's more clear if the "write" just
    returns zero.

    Also, the "lenp" pointer is never NULL so that check can be removed.

    Signed-off-by: Dan Carpenter
    Signed-off-by: J. Bruce Fields

    Dan Carpenter
     

23 Oct, 2020

1 commit

  • Pull nfsd updates from Bruce Fields:
    "The one new feature this time, from Anna Schumaker, is READ_PLUS,
    which has the same arguments as READ but allows the server to return
    an array of data and hole extents.

    Otherwise it's a lot of cleanup and bugfixes"

    * tag 'nfsd-5.10' of git://linux-nfs.org/~bfields/linux: (43 commits)
    NFSv4.2: Fix NFS4ERR_STALE error when doing inter server copy
    SUNRPC: fix copying of multiple pages in gss_read_proxy_verf()
    sunrpc: raise kernel RPC channel buffer size
    svcrdma: fix bounce buffers for unaligned offsets and multiple pages
    nfsd: remove unneeded break
    net/sunrpc: Fix return value for sysctl sunrpc.transports
    NFSD: Encode a full READ_PLUS reply
    NFSD: Return both a hole and a data segment
    NFSD: Add READ_PLUS hole segment encoding
    NFSD: Add READ_PLUS data support
    NFSD: Hoist status code encoding into XDR encoder functions
    NFSD: Map nfserr_wrongsec outside of nfsd_dispatch
    NFSD: Remove the RETURN_STATUS() macro
    NFSD: Call NFSv2 encoders on error returns
    NFSD: Fix .pc_release method for NFSv2
    NFSD: Remove vestigial typedefs
    NFSD: Refactor nfsd_dispatch() error paths
    NFSD: Clean up nfsd_dispatch() variables
    NFSD: Clean up stale comments in nfsd_dispatch()
    NFSD: Clean up switch statement in nfsd_dispatch()
    ...

    Linus Torvalds
     

21 Oct, 2020

3 commits

  • Pull NFS client updates from Anna Schumaker:
    "Stable Fixes:
    - Wait for stateid updates after CLOSE/OPEN_DOWNGRADE # v5.4+
    - Fix nfs_path in case of a rename retry
    - Support EXCHID4_FLAG_SUPP_FENCE_OPS v4.2 EXCHANGE_ID flag

    New features and improvements:
    - Replace dprintk() calls with tracepoints
    - Make cache consistency bitmap dynamic
    - Added support for the NFS v4.2 READ_PLUS operation
    - Improvements to net namespace uniquifier

    Other bugfixes and cleanups:
    - Remove redundant clnt pointer
    - Don't update timeout values on connection resets
    - Remove redundant tracepoints
    - Various cleanups to comments
    - Fix oops when trying to use copy_file_range with v4.0 source server
    - Improvements to flexfiles mirrors
    - Add missing 'local_lock=posix' mount option"

    * tag 'nfs-for-5.10-1' of git://git.linux-nfs.org/projects/anna/linux-nfs: (55 commits)
    NFSv4.2: support EXCHGID4_FLAG_SUPP_FENCE_OPS 4.2 EXCHANGE_ID flag
    NFSv4: Fix up RCU annotations for struct nfs_netns_client
    NFS: Only reference user namespace from nfs4idmap struct instead of cred
    nfs: add missing "posix" local_lock constant table definition
    NFSv4: Use the net namespace uniquifier if it is set
    NFSv4: Clean up initialisation of uniquified client id strings
    NFS: Decode a full READ_PLUS reply
    SUNRPC: Add an xdr_align_data() function
    NFS: Add READ_PLUS hole segment decoding
    SUNRPC: Add the ability to expand holes in data pages
    SUNRPC: Split out _shift_data_right_tail()
    SUNRPC: Split out xdr_realign_pages() from xdr_align_pages()
    NFS: Add READ_PLUS data segment support
    NFS: Use xdr_page_pos() in NFSv4 decode_getacl()
    SUNRPC: Implement a xdr_page_pos() function
    SUNRPC: Split out a function for setting current page
    NFS: fix nfs_path in case of a rename retry
    fs: nfs: return per memcg count for xattr shrinkers
    NFSv4: Wait for stateid updates after CLOSE/OPEN_DOWNGRADE
    nfs: remove incorrect fallthrough label
    ...

    Linus Torvalds
     
  • When the passed token is longer than 4032 bytes, the remaining part
    of the token must be copied from the rqstp->rq_arg.pages. But the
    copy must make sure it happens in a consecutive way.

    With the existing code, the first memcpy copies 'length' bytes from
    argv->iobase, but since the header is in front, this never fills the
    whole first page of in_token->pages.

    The mecpy in the loop copies the following bytes, but starts writing at
    the next page of in_token->pages. This leaves the last bytes of page 0
    unwritten.

    Symptoms were that users with many groups were not able to access NFS
    exports, when using Active Directory as the KDC.

    Signed-off-by: Martijn de Gouw
    Fixes: 5866efa8cbfb "SUNRPC: Fix svcauth_gss_proxy_init()"
    Signed-off-by: J. Bruce Fields

    Martijn de Gouw
     
  • Its possible that using AUTH_SYS and mountd manage-gids option a
    user may hit the 8k RPC channel buffer limit. This have been observed
    on field, causing unanswered RPCs on clients after mountd fails to
    write on channel :

    rpc.mountd[11231]: auth_unix_gid: error writing reply

    Userland nfs-utils uses a buffer size of 32k (RPC_CHAN_BUF_SIZE), so
    lets match those two.

    Signed-off-by: Roberto Bergantinos Corpas
    Signed-off-by: J. Bruce Fields

    Roberto Bergantinos Corpas
     

17 Oct, 2020

2 commits


16 Oct, 2020

1 commit

  • Pull networking updates from Jakub Kicinski:

    - Add redirect_neigh() BPF packet redirect helper, allowing to limit
    stack traversal in common container configs and improving TCP
    back-pressure.

    Daniel reports ~10Gbps => ~15Gbps single stream TCP performance gain.

    - Expand netlink policy support and improve policy export to user
    space. (Ge)netlink core performs request validation according to
    declared policies. Expand the expressiveness of those policies
    (min/max length and bitmasks). Allow dumping policies for particular
    commands. This is used for feature discovery by user space (instead
    of kernel version parsing or trial and error).

    - Support IGMPv3/MLDv2 multicast listener discovery protocols in
    bridge.

    - Allow more than 255 IPv4 multicast interfaces.

    - Add support for Type of Service (ToS) reflection in SYN/SYN-ACK
    packets of TCPv6.

    - In Multi-patch TCP (MPTCP) support concurrent transmission of data on
    multiple subflows in a load balancing scenario. Enhance advertising
    addresses via the RM_ADDR/ADD_ADDR options.

    - Support SMC-Dv2 version of SMC, which enables multi-subnet
    deployments.

    - Allow more calls to same peer in RxRPC.

    - Support two new Controller Area Network (CAN) protocols - CAN-FD and
    ISO 15765-2:2016.

    - Add xfrm/IPsec compat layer, solving the 32bit user space on 64bit
    kernel problem.

    - Add TC actions for implementing MPLS L2 VPNs.

    - Improve nexthop code - e.g. handle various corner cases when nexthop
    objects are removed from groups better, skip unnecessary
    notifications and make it easier to offload nexthops into HW by
    converting to a blocking notifier.

    - Support adding and consuming TCP header options by BPF programs,
    opening the doors for easy experimental and deployment-specific TCP
    option use.

    - Reorganize TCP congestion control (CC) initialization to simplify
    life of TCP CC implemented in BPF.

    - Add support for shipping BPF programs with the kernel and loading
    them early on boot via the User Mode Driver mechanism, hence reusing
    all the user space infra we have.

    - Support sleepable BPF programs, initially targeting LSM and tracing.

    - Add bpf_d_path() helper for returning full path for given 'struct
    path'.

    - Make bpf_tail_call compatible with bpf-to-bpf calls.

    - Allow BPF programs to call map_update_elem on sockmaps.

    - Add BPF Type Format (BTF) support for type and enum discovery, as
    well as support for using BTF within the kernel itself (current use
    is for pretty printing structures).

    - Support listing and getting information about bpf_links via the bpf
    syscall.

    - Enhance kernel interfaces around NIC firmware update. Allow
    specifying overwrite mask to control if settings etc. are reset
    during update; report expected max time operation may take to users;
    support firmware activation without machine reboot incl. limits of
    how much impact reset may have (e.g. dropping link or not).

    - Extend ethtool configuration interface to report IEEE-standard
    counters, to limit the need for per-vendor logic in user space.

    - Adopt or extend devlink use for debug, monitoring, fw update in many
    drivers (dsa loop, ice, ionic, sja1105, qed, mlxsw, mv88e6xxx,
    dpaa2-eth).

    - In mlxsw expose critical and emergency SFP module temperature alarms.
    Refactor port buffer handling to make the defaults more suitable and
    support setting these values explicitly via the DCBNL interface.

    - Add XDP support for Intel's igb driver.

    - Support offloading TC flower classification and filtering rules to
    mscc_ocelot switches.

    - Add PTP support for Marvell Octeontx2 and PP2.2 hardware, as well as
    fixed interval period pulse generator and one-step timestamping in
    dpaa-eth.

    - Add support for various auth offloads in WiFi APs, e.g. SAE (WPA3)
    offload.

    - Add Lynx PHY/PCS MDIO module, and convert various drivers which have
    this HW to use it. Convert mvpp2 to split PCS.

    - Support Marvell Prestera 98DX3255 24-port switch ASICs, as well as
    7-port Mediatek MT7531 IP.

    - Add initial support for QCA6390 and IPQ6018 in ath11k WiFi driver,
    and wcn3680 support in wcn36xx.

    - Improve performance for packets which don't require much offloads on
    recent Mellanox NICs by 20% by making multiple packets share a
    descriptor entry.

    - Move chelsio inline crypto drivers (for TLS and IPsec) from the
    crypto subtree to drivers/net. Move MDIO drivers out of the phy
    directory.

    - Clean up a lot of W=1 warnings, reportedly the actively developed
    subsections of networking drivers should now build W=1 warning free.

    - Make sure drivers don't use in_interrupt() to dynamically adapt their
    code. Convert tasklets to use new tasklet_setup API (sadly this
    conversion is not yet complete).

    * tag 'net-next-5.10' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next: (2583 commits)
    Revert "bpfilter: Fix build error with CONFIG_BPFILTER_UMH"
    net, sockmap: Don't call bpf_prog_put() on NULL pointer
    bpf, selftest: Fix flaky tcp_hdr_options test when adding addr to lo
    bpf, sockmap: Add locking annotations to iterator
    netfilter: nftables: allow re-computing sctp CRC-32C in 'payload' statements
    net: fix pos incrementment in ipv6_route_seq_next
    net/smc: fix invalid return code in smcd_new_buf_create()
    net/smc: fix valid DMBE buffer sizes
    net/smc: fix use-after-free of delayed events
    bpfilter: Fix build error with CONFIG_BPFILTER_UMH
    cxgb4/ch_ipsec: Replace the module name to ch_ipsec from chcr
    net: sched: Fix suspicious RCU usage while accessing tcf_tunnel_info
    bpf: Fix register equivalence tracking.
    rxrpc: Fix loss of final ack on shutdown
    rxrpc: Fix bundle counting for exclusive connections
    netfilter: restore NF_INET_NUMHOOKS
    ibmveth: Identify ingress large send packets.
    ibmveth: Switch order of ibmveth_helper calls.
    cxgb4: handle 4-tuple PEDIT to NAT mode translation
    selftests: Add VRF route leaking tests
    ...

    Linus Torvalds
     

13 Oct, 2020

2 commits

  • Pull crypto updates from Herbert Xu:
    "API:
    - Allow DRBG testing through user-space af_alg
    - Add tcrypt speed testing support for keyed hashes
    - Add type-safe init/exit hooks for ahash

    Algorithms:
    - Mark arc4 as obsolete and pending for future removal
    - Mark anubis, khazad, sead and tea as obsolete
    - Improve boot-time xor benchmark
    - Add OSCCA SM2 asymmetric cipher algorithm and use it for integrity

    Drivers:
    - Fixes and enhancement for XTS in caam
    - Add support for XIP8001B hwrng in xiphera-trng
    - Add RNG and hash support in sun8i-ce/sun8i-ss
    - Allow imx-rngc to be used by kernel entropy pool
    - Use crypto engine in omap-sham
    - Add support for Ingenic X1830 with ingenic"

    * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (205 commits)
    X.509: Fix modular build of public_key_sm2
    crypto: xor - Remove unused variable count in do_xor_speed
    X.509: fix error return value on the failed path
    crypto: bcm - Verify GCM/CCM key length in setkey
    crypto: qat - drop input parameter from adf_enable_aer()
    crypto: qat - fix function parameters descriptions
    crypto: atmel-tdes - use semicolons rather than commas to separate statements
    crypto: drivers - use semicolons rather than commas to separate statements
    hwrng: mxc-rnga - use semicolons rather than commas to separate statements
    hwrng: iproc-rng200 - use semicolons rather than commas to separate statements
    hwrng: stm32 - use semicolons rather than commas to separate statements
    crypto: xor - use ktime for template benchmarking
    crypto: xor - defer load time benchmark to a later time
    crypto: hisilicon/zip - fix the uninitalized 'curr_qm_qp_num'
    crypto: hisilicon/zip - fix the return value when device is busy
    crypto: hisilicon/zip - fix zero length input in GZIP decompress
    crypto: hisilicon/zip - fix the uncleared debug registers
    lib/mpi: Fix unused variable warnings
    crypto: x86/poly1305 - Remove assignments with no effect
    hwrng: npcm - modify readl to readb
    ...

    Linus Torvalds
     
  • Pull copy_and_csum cleanups from Al Viro:
    "Saner calling conventions for csum_and_copy_..._user() and friends"

    [ Removing 800+ lines of code and cleaning stuff up is good - Linus ]

    * 'work.csum_and_copy' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    ppc: propagate the calling conventions change down to csum_partial_copy_generic()
    amd64: switch csum_partial_copy_generic() to new calling conventions
    sparc64: propagate the calling convention changes down to __csum_partial_copy_...()
    xtensa: propagate the calling conventions change down into csum_partial_copy_generic()
    mips: propagate the calling convention change down into __csum_partial_copy_..._user()
    mips: __csum_partial_copy_kernel() has no users left
    mips: csum_and_copy_{to,from}_user() are never called under KERNEL_DS
    sparc32: propagate the calling conventions change down to __csum_partial_copy_sparc_generic()
    i386: propagate the calling conventions change down to csum_partial_copy_generic()
    sh: propage the calling conventions change down to csum_partial_copy_generic()
    m68k: get rid of zeroing destination on error in csum_and_copy_from_user()
    arm: propagate the calling convention changes down to csum_partial_copy_from_user()
    alpha: propagate the calling convention changes down to csum_partial_copy.c helpers
    saner calling conventions for csum_and_copy_..._user()
    csum_and_copy_..._user(): pass 0xffffffff instead of 0 as initial sum
    csum_partial_copy_nocheck(): drop the last argument
    unify generic instances of csum_partial_copy_nocheck()
    icmp_push_reply(): reorder adding the checksum up
    skb_copy_and_csum_bits(): don't bother with the last argument

    Linus Torvalds
     

08 Oct, 2020

6 commits


06 Oct, 2020

1 commit


26 Sep, 2020

4 commits

  • Is it just me, or is the logic written in a slightly convoluted way?

    I find it a little easier to read this way.

    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     
  • seq_puts is a lot cheaper than seq_printf, so use that to print
    literal strings.

    Signed-off-by: Xu Wang
    Signed-off-by: J. Bruce Fields

    Xu Wang
     
  • Reserving space for a large READ payload requires special handling when
    reserving space in the xdr buffer pages. One problem we can have is use
    of the scratch buffer, which is used to get a pointer to a contiguous
    region of data up to PAGE_SIZE. When using the scratch buffer, calls to
    xdr_commit_encode() shift the data to it's proper alignment in the xdr
    buffer. If we've reserved several pages in a vector, then this could
    potentially invalidate earlier pointers and result in incorrect READ
    data being sent to the client.

    I get around this by looking at the amount of space left in the current
    page, and never reserve more than that for each entry in the read
    vector. This lets us place data directly where it needs to go in the
    buffer pages.

    Signed-off-by: Anna Schumaker
    Signed-off-by: J. Bruce Fields

    Anna Schumaker
     
  • Drop duplicate words in net/sunrpc/.
    Also fix "Anyone" to be "Any one".

    Signed-off-by: Randy Dunlap
    Cc: "J. Bruce Fields"
    Cc: Chuck Lever
    Cc: linux-nfs@vger.kernel.org
    Signed-off-by: J. Bruce Fields

    Randy Dunlap
     

23 Sep, 2020

1 commit

  • Two minor conflicts:

    1) net/ipv4/route.c, adding a new local variable while
    moving another local variable and removing it's
    initial assignment.

    2) drivers/net/dsa/microchip/ksz9477.c, overlapping changes.
    One pretty prints the port mode differently, whilst another
    changes the driver to try and obtain the port mode from
    the port node rather than the switch node.

    Signed-off-by: David S. Miller

    David S. Miller
     

22 Sep, 2020

1 commit

  • sg_init_table zeroes its first argument, so the allocation of that argument
    doesn't have to.

    the semantic patch that makes this change is as follows:
    (http://coccinelle.lip6.fr/)

    //
    @@
    expression x,n,flags;
    @@

    x =
    - kcalloc
    + kmalloc_array
    (n,sizeof(*x),flags)
    ...
    sg_init_table(x,n)
    //

    Signed-off-by: Julia Lawall
    Acked-by: Chuck Lever
    Signed-off-by: Anna Schumaker

    Julia Lawall
     

21 Sep, 2020

10 commits