30 Dec, 2020

1 commit

  • [ Upstream commit a4485baefa1efa596702ebffd5a9c760d42b14b5 ]

    add the code to release the nfc firmware when the firmware image size is
    wrong.

    Fixes: c04c674fadeb ("nfc: s3fwrn5: Add driver for Samsung S3FWRN5 NFC Chip")
    Signed-off-by: Bongsu Jeon
    Reviewed-by: Krzysztof Kozlowski
    Link: https://lore.kernel.org/r/20201213095850.28169-1-bongsu.jeon@samsung.com
    Signed-off-by: Jakub Kicinski
    Signed-off-by: Sasha Levin

    Bongsu Jeon
     

25 Nov, 2020

1 commit

  • GPIOs - as returned by of_get_named_gpio() and used by the gpiolib - are
    signed integers, where negative number indicates error. The return
    value of of_get_named_gpio() should not be assigned to an unsigned int
    because in case of !CONFIG_GPIOLIB such number would be a valid GPIO.

    Fixes: c04c674fadeb ("nfc: s3fwrn5: Add driver for Samsung S3FWRN5 NFC Chip")
    Signed-off-by: Krzysztof Kozlowski
    Link: https://lore.kernel.org/r/20201123162351.209100-1-krzk@kernel.org
    Signed-off-by: Jakub Kicinski

    Krzysztof Kozlowski
     

21 Oct, 2020

1 commit

  • A break is not needed if it is preceded by a return

    Signed-off-by: Tom Rix
    Link: https://lore.kernel.org/r/20201019191500.9264-1-trix@redhat.com
    Signed-off-by: Jakub Kicinski

    Tom Rix
     

11 Sep, 2020

4 commits


09 Sep, 2020

1 commit


05 Sep, 2020

1 commit

  • We got slightly different patches removing a double word
    in a comment in net/ipv4/raw.c - picked the version from net.

    Simple conflict in drivers/net/ethernet/ibm/ibmvnic.c. Use cached
    values instead of VNIC login response buffer (following what
    commit 507ebe6444a4 ("ibmvnic: Fix use-after-free of VNIC login
    response buffer") did).

    Signed-off-by: Jakub Kicinski

    Jakub Kicinski
     

04 Sep, 2020

1 commit

  • Pull networking fixes from David Miller:

    1) Use netif_rx_ni() when necessary in batman-adv stack, from Jussi
    Kivilinna.

    2) Fix loss of RTT samples in rxrpc, from David Howells.

    3) Memory leak in hns_nic_dev_probe(), from Dignhao Liu.

    4) ravb module cannot be unloaded, fix from Yuusuke Ashizuka.

    5) We disable BH for too lokng in sctp_get_port_local(), add a
    cond_resched() here as well, from Xin Long.

    6) Fix memory leak in st95hf_in_send_cmd, from Dinghao Liu.

    7) Out of bound access in bpf_raw_tp_link_fill_link_info(), from
    Yonghong Song.

    8) Missing of_node_put() in mt7530 DSA driver, from Sumera
    Priyadarsini.

    9) Fix crash in bnxt_fw_reset_task(), from Michael Chan.

    10) Fix geneve tunnel checksumming bug in hns3, from Yi Li.

    11) Memory leak in rxkad_verify_response, from Dinghao Liu.

    12) In tipc, don't use smp_processor_id() in preemptible context. From
    Tuong Lien.

    13) Fix signedness issue in mlx4 memory allocation, from Shung-Hsi Yu.

    14) Missing clk_disable_prepare() in gemini driver, from Dan Carpenter.

    15) Fix ABI mismatch between driver and firmware in nfp, from Louis
    Peens.

    * git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (110 commits)
    net/smc: fix sock refcounting in case of termination
    net/smc: reset sndbuf_desc if freed
    net/smc: set rx_off for SMCR explicitly
    net/smc: fix toleration of fake add_link messages
    tg3: Fix soft lockup when tg3_reset_task() fails.
    doc: net: dsa: Fix typo in config code sample
    net: dp83867: Fix WoL SecureOn password
    nfp: flower: fix ABI mismatch between driver and firmware
    tipc: fix shutdown() of connectionless socket
    ipv6: Fix sysctl max for fib_multipath_hash_policy
    drivers/net/wan/hdlc: Change the default of hard_header_len to 0
    net: gemini: Fix another missing clk_disable_unprepare() in probe
    net: bcmgenet: fix mask check in bcmgenet_validate_flow()
    amd-xgbe: Add support for new port mode
    net: usb: dm9601: Add USB ID of Keenetic Plus DSL
    vhost: fix typo in error message
    net: ethernet: mlx4: Fix memory allocation in mlx4_buddy_init()
    pktgen: fix error message with wrong function name
    net: ethernet: ti: am65-cpsw: fix rmii 100Mbit link mode
    cxgb4: fix thermal zone device registration
    ...

    Linus Torvalds
     

25 Aug, 2020

1 commit


24 Aug, 2020

1 commit

  • Replace the existing /* fall through */ comments and its variants with
    the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
    fall-through markings when it is the case.

    [1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

    Signed-off-by: Gustavo A. R. Silva

    Gustavo A. R. Silva
     

21 Aug, 2020

2 commits


21 Jul, 2020

1 commit


14 Jun, 2020

1 commit

  • Since commit 84af7a6194e4 ("checkpatch: kconfig: prefer 'help' over
    '---help---'"), the number of '---help---' has been gradually
    decreasing, but there are still more than 2400 instances.

    This commit finishes the conversion. While I touched the lines,
    I also fixed the indentation.

    There are a variety of indentation styles found.

    a) 4 spaces + '---help---'
    b) 7 spaces + '---help---'
    c) 8 spaces + '---help---'
    d) 1 space + 1 tab + '---help---'
    e) 1 tab + '---help---' (correct indentation)
    f) 1 tab + 1 space + '---help---'
    g) 1 tab + 2 spaces + '---help---'

    In order to convert all of them to 1 tab + 'help', I ran the
    following commend:

    $ find . -name 'Kconfig*' | xargs sed -i 's/^[[:space:]]*---help---/\thelp/'

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

02 Jun, 2020

1 commit

  • Pull crypto updates from Herbert Xu:
    "API:
    - Introduce crypto_shash_tfm_digest() and use it wherever possible.
    - Fix use-after-free and race in crypto_spawn_alg.
    - Add support for parallel and batch requests to crypto_engine.

    Algorithms:
    - Update jitter RNG for SP800-90B compliance.
    - Always use jitter RNG as seed in drbg.

    Drivers:
    - Add Arm CryptoCell driver cctrng.
    - Add support for SEV-ES to the PSP driver in ccp"

    * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (114 commits)
    crypto: hisilicon - fix driver compatibility issue with different versions of devices
    crypto: engine - do not requeue in case of fatal error
    crypto: cavium/nitrox - Fix a typo in a comment
    crypto: hisilicon/qm - change debugfs file name from qm_regs to regs
    crypto: hisilicon/qm - add DebugFS for xQC and xQE dump
    crypto: hisilicon/zip - add debugfs for Hisilicon ZIP
    crypto: hisilicon/hpre - add debugfs for Hisilicon HPRE
    crypto: hisilicon/sec2 - add debugfs for Hisilicon SEC
    crypto: hisilicon/qm - add debugfs to the QM state machine
    crypto: hisilicon/qm - add debugfs for QM
    crypto: stm32/crc32 - protect from concurrent accesses
    crypto: stm32/crc32 - don't sleep in runtime pm
    crypto: stm32/crc32 - fix multi-instance
    crypto: stm32/crc32 - fix run-time self test issue.
    crypto: stm32/crc32 - fix ext4 chksum BUG_ON()
    crypto: hisilicon/zip - Use temporary sqe when doing work
    crypto: hisilicon - add device error report through abnormal irq
    crypto: hisilicon - remove codes of directly report device errors through MSI
    crypto: hisilicon - QM memory management optimization
    crypto: hisilicon - unify initial value assignment into QM
    ...

    Linus Torvalds
     

30 May, 2020

1 commit


08 May, 2020

1 commit

  • Instead of manually allocating a 'struct shash_desc' on the stack and
    calling crypto_shash_digest(), switch to using the new helper function
    crypto_shash_tfm_digest() which does this for us.

    Cc: Robert Baldyga
    Cc: Krzysztof Opasiak
    Signed-off-by: Eric Biggers
    Signed-off-by: Herbert Xu

    Eric Biggers
     

26 Mar, 2020

1 commit


24 Mar, 2020

1 commit

  • The nci_conn_max_data_pkt_payload_size() function sometimes returns
    -EPROTO so "max_size" needs to be signed for the error handling to
    work. We can make "payload_size" an int as well.

    Fixes: a06347c04c13 ("NFC: Add Intel Fields Peak NFC solution driver")
    Signed-off-by: Dan Carpenter
    Signed-off-by: David S. Miller

    Dan Carpenter
     

28 Feb, 2020

1 commit

  • The current codebase makes use of the zero-length array language
    extension to the C90 standard, but the preferred mechanism to declare
    variable-length types such as these ones is a flexible array member[1][2],
    introduced in C99:

    struct foo {
    int stuff;
    struct boo array[];
    };

    By making use of the mechanism above, we will get a compiler warning
    in case the flexible array does not occur last in the structure, which
    will help us prevent some kind of undefined behavior bugs from being
    inadvertently introduced[3] to the codebase from now on.

    Also, notice that, dynamic memory allocations won't be affected by
    this change:

    "Flexible array members have incomplete type, and so the sizeof operator
    may not be applied. As a quirk of the original implementation of
    zero-length arrays, sizeof evaluates to zero."[1]

    This issue was found with the help of Coccinelle.

    [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
    [2] https://github.com/KSPP/linux/issues/21
    [3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour")

    Signed-off-by: Gustavo A. R. Silva
    Signed-off-by: David S. Miller

    Gustavo A. R. Silva
     

20 Feb, 2020

1 commit

  • The PN544 driver checks the "enable" polarity during of driver's probe and
    it's doing that by turning ON and OFF NFC with different polarities until
    enabling succeeds. It takes some time for the hardware to power-down, and
    thus, to deassert the IRQ that is raised by turning ON the hardware.
    Since the delay after last power-down of the polarity-checking process is
    missed in the code, the interrupt may trigger immediately after installing
    the IRQ handler (right after the checking is done), which results in IRQ
    handler trying to touch the disabled HW and ends with marking NFC as
    'DEAD' during of the driver's probe:

    pn544_hci_i2c 1-002a: NFC: nfc_en polarity : active high
    pn544_hci_i2c 1-002a: NFC: invalid len byte
    shdlc: llc_shdlc_recv_frame: NULL Frame -> link is dead

    This patch fixes the occasional NFC initialization failure on Nexus 7
    device.

    Signed-off-by: Dmitry Osipenko
    Signed-off-by: David S. Miller

    Dmitry Osipenko
     

17 Feb, 2020

1 commit


20 Jan, 2020

1 commit


15 Jan, 2020

1 commit


14 Jan, 2020

1 commit

  • The driver was doing a synchronous uninterruptible bulk-transfer without
    using a timeout. This could lead to the driver hanging on probe due to a
    malfunctioning (or malicious) device until the device is physically
    disconnected. While sleeping in probe the driver prevents other devices
    connected to the same hub from being added to (or removed from) the bus.

    An arbitrary limit of five seconds should be more than enough.

    Fixes: dbafc28955fa ("NFC: pn533: don't send USB data off of the stack")
    Signed-off-by: Johan Hovold
    Reviewed-by: Greg Kroah-Hartman
    Signed-off-by: Jakub Kicinski

    Johan Hovold
     

23 Dec, 2019

1 commit


20 Dec, 2019

2 commits

  • Clang warns

    ../drivers/nfc/pn544/pn544.c:696:4: warning: misleading indentation;
    statement is not part of the previous 'if' [-Wmisleading-indentation]
    return nfc_hci_send_cmd(hdev, NFC_HCI_RF_READER_A_GATE,
    ^
    ../drivers/nfc/pn544/pn544.c:692:3: note: previous statement is here
    if (target->nfcid1_len != 4 && target->nfcid1_len != 7 &&
    ^
    1 warning generated.

    This warning occurs because there is a space after the tab on this line.
    Remove it so that the indentation is consistent with the Linux kernel
    coding style and clang no longer warns.

    Fixes: da052850b911 ("NFC: Add pn544 presence check for different targets")
    Link: https://github.com/ClangBuiltLinux/linux/issues/814
    Signed-off-by: Nathan Chancellor
    Signed-off-by: David S. Miller

    Nathan Chancellor
     
  • In s3fwrn5_fw_recv_frame, if fw_info->rsp is not empty, the
    current code causes a crash via BUG_ON. However, s3fwrn5_fw_send_msg
    does not crash in such a scenario. The patch replaces the BUG_ON
    by returning the error to the callers and frees up skb.

    Signed-off-by: Aditya Pakki
    Signed-off-by: David S. Miller

    Aditya Pakki
     

10 Dec, 2019

2 commits

  • devm_acpi_dev_add_driver_gpios() returns -ENXIO if CONFIG_ACPI
    is disabled (e.g. on device tree platforms).
    In this case, nxp-nci will silently fail to probe.

    The other NFC drivers only log a debug message if
    devm_acpi_dev_add_driver_gpios() fails.
    Do the same in nxp-nci to fix this problem.

    Fixes: ad0acfd69add ("NFC: nxp-nci: Get rid of code duplication in ->probe()")
    Cc: Andy Shevchenko
    Signed-off-by: Stephan Gerhold
    Acked-by: Andy Shevchenko
    Signed-off-by: David S. Miller

    Stephan Gerhold
     
  • Convert cpu_to_le16(le16_to_cpu(frame->datalen) + len) to
    use le16_add_cpu(), which is more concise and does the same thing.

    Reported-by: Hulk Robot
    Signed-off-by: Mao Wenan
    Signed-off-by: David S. Miller

    Mao Wenan
     

23 Nov, 2019

1 commit


22 Nov, 2019

1 commit

  • If starting the transfer of a command suceeds but the transfer for the reply
    fails, it is not enough to initiate killing the transfer for the
    command may still be running. You need to wait for the killing to finish
    before you can reuse URB and buffer.

    Reported-and-tested-by: syzbot+711468aa5c3a1eabf863@syzkaller.appspotmail.com
    Signed-off-by: Oliver Neukum
    Signed-off-by: David S. Miller

    Oliver Neukum
     

21 Nov, 2019

1 commit


17 Nov, 2019

1 commit


14 Nov, 2019

1 commit

  • Change dev_up and dev_down functions of struct pn533_phy_ops to return
    int. This way the pn533 core can report errors in the phy layer to upper
    layers.
    The only user of this is currently uart.c and it is changed to report
    the error of a possibly failing call to serdev_device_open.

    Reported-by: coverity-bot
    Addresses-Coverity-ID: 1487395 ("Error handling issues")
    Fixes: c656aa4c27b1 ("nfc: pn533: add UART phy driver")
    Signed-off-by: Lars Poeschel
    Signed-off-by: David S. Miller

    Lars Poeschel
     

12 Nov, 2019

1 commit

  • I2C communication errors (-EREMOTEIO) during the IRQ handler of nxp-nci
    result in a NULL pointer dereference at the moment:

    BUG: kernel NULL pointer dereference, address: 0000000000000000
    Oops: 0002 [#1] PREEMPT SMP NOPTI
    CPU: 1 PID: 355 Comm: irq/137-nxp-nci Not tainted 5.4.0-rc6 #1
    RIP: 0010:skb_queue_tail+0x25/0x50
    Call Trace:
    nci_recv_frame+0x36/0x90 [nci]
    nxp_nci_i2c_irq_thread_fn+0xd1/0x285 [nxp_nci_i2c]
    ? preempt_count_add+0x68/0xa0
    ? irq_forced_thread_fn+0x80/0x80
    irq_thread_fn+0x20/0x60
    irq_thread+0xee/0x180
    ? wake_threads_waitq+0x30/0x30
    kthread+0xfb/0x130
    ? irq_thread_check_affinity+0xd0/0xd0
    ? kthread_park+0x90/0x90
    ret_from_fork+0x1f/0x40

    Afterward the kernel must be rebooted to work properly again.

    This happens because it attempts to call nci_recv_frame() with skb == NULL.
    However, unlike nxp_nci_fw_recv_frame(), nci_recv_frame() does not have any
    NULL checks for skb, causing the NULL pointer dereference.

    Change the code to call only nxp_nci_fw_recv_frame() in case of an error.
    Make sure to log it so it is obvious that a communication error occurred.
    The error above then becomes:

    nxp-nci_i2c i2c-NXP1001:00: NFC: Read failed with error -121
    nci: __nci_request: wait_for_completion_interruptible_timeout failed 0
    nxp-nci_i2c i2c-NXP1001:00: NFC: Read failed with error -121

    Fixes: 6be88670fc59 ("NFC: nxp-nci_i2c: Add I2C support to NXP NCI driver")
    Signed-off-by: Stephan Gerhold
    Reviewed-by: Andy Shevchenko
    Signed-off-by: David S. Miller

    Stephan Gerhold
     

10 Nov, 2019

1 commit


07 Nov, 2019

1 commit

  • The variable nfcid_skb is not changed in the callee nfc_hci_get_param()
    if error occurs. Consequently, the freed variable nfcid_skb will be
    freed again, resulting in a double free bug. Set nfcid_skb to NULL after
    releasing it to fix the bug.

    Signed-off-by: Pan Bian
    Signed-off-by: David S. Miller

    Pan Bian