10 Dec, 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
     

05 Jun, 2019

1 commit

  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms and conditions of the gnu general public license
    version 2 as published by the free software foundation this program
    is distributed in the hope it will be useful but without any
    warranty without even the implied warranty of merchantability or
    fitness for a particular purpose see the gnu general public license
    for more details

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 263 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Allison Randal
    Reviewed-by: Alexios Zavras
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190529141901.208660670@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

16 Jun, 2017

3 commits

  • Joe and Bjørn suggested that it'd be nicer to not have the
    cast in the fairly common case of doing
    *(u8 *)skb_put(skb, 1) = c;

    Add skb_put_u8() for this case, and use it across the code,
    using the following spatch:

    @@
    expression SKB, C, S;
    typedef u8;
    identifier fn = {skb_put};
    fresh identifier fn2 = fn ## "_u8";
    @@
    - *(u8 *)fn(SKB, S) = C;
    + fn2(SKB, C);

    Note that due to the "S", the spatch isn't perfect, it should
    have checked that S is 1, but there's also places that use a
    sizeof expression like sizeof(var) or sizeof(u8) etc. Turns
    out that nobody ever did something like
    *(u8 *)skb_put(skb, 2) = c;

    which would be wrong anyway since the second byte wouldn't be
    initialized.

    Suggested-by: Joe Perches
    Suggested-by: Bjørn Mork
    Signed-off-by: Johannes Berg
    Signed-off-by: David S. Miller

    Johannes Berg
     
  • It seems like a historic accident that these return unsigned char *,
    and in many places that means casts are required, more often than not.

    Make these functions (skb_put, __skb_put and pskb_put) return void *
    and remove all the casts across the tree, adding a (u8 *) cast only
    where the unsigned char pointer was used directly, all done with the
    following spatch:

    @@
    expression SKB, LEN;
    typedef u8;
    identifier fn = { skb_put, __skb_put };
    @@
    - *(fn(SKB, LEN))
    + *(u8 *)fn(SKB, LEN)

    @@
    expression E, SKB, LEN;
    identifier fn = { skb_put, __skb_put };
    type T;
    @@
    - E = ((T *)(fn(SKB, LEN)))
    + E = fn(SKB, LEN)

    which actually doesn't cover pskb_put since there are only three
    users overall.

    A handful of stragglers were converted manually, notably a macro in
    drivers/isdn/i4l/isdn_bsdcomp.c and, oddly enough, one of the many
    instances in net/bluetooth/hci_sock.c. In the former file, I also
    had to fix one whitespace problem spatch introduced.

    Signed-off-by: Johannes Berg
    Signed-off-by: David S. Miller

    Johannes Berg
     
  • A common pattern with skb_put() is to just want to memcpy()
    some data into the new space, introduce skb_put_data() for
    this.

    An spatch similar to the one for skb_put_zero() converts many
    of the places using it:

    @@
    identifier p, p2;
    expression len, skb, data;
    type t, t2;
    @@
    (
    -p = skb_put(skb, len);
    +p = skb_put_data(skb, data, len);
    |
    -p = (t)skb_put(skb, len);
    +p = skb_put_data(skb, data, len);
    )
    (
    p2 = (t2)p;
    -memcpy(p2, data, len);
    |
    -memcpy(p, data, len);
    )

    @@
    type t, t2;
    identifier p, p2;
    expression skb, data;
    @@
    t *p;
    ...
    (
    -p = skb_put(skb, sizeof(t));
    +p = skb_put_data(skb, data, sizeof(t));
    |
    -p = (t *)skb_put(skb, sizeof(t));
    +p = skb_put_data(skb, data, sizeof(t));
    )
    (
    p2 = (t2)p;
    -memcpy(p2, data, sizeof(*p));
    |
    -memcpy(p, data, sizeof(*p));
    )

    @@
    expression skb, len, data;
    @@
    -memcpy(skb_put(skb, len), data, len);
    +skb_put_data(skb, data, len);

    (again, manually post-processed to retain some comments)

    Reviewed-by: Stephen Hemminger
    Signed-off-by: Johannes Berg
    Signed-off-by: David S. Miller

    Johannes Berg
     

02 Apr, 2017

3 commits

  • If port100_send_ack() was called twice or more, it has race to hangup.

    port100_send_ack() port100_send_ack()
    init_completion()
    [...]
    dev->cmd_cancel = true
    /* this removes previous from completion */
    init_completion()
    [...]
    dev->cmd_cancel = true
    wait_for_completion()
    /* never be waked up */
    wait_for_completion()

    Like above race, this code is not assuming port100_send_ack() is
    called twice or more.

    To fix, this checks dev->cmd_cancel to know if prior cancel is
    in-flight or not. And never be remove prior task from completion by
    using reinit_completion(), so this guarantees to be waked up properly
    soon or later.

    Signed-off-by: OGAWA Hirofumi
    Signed-off-by: Samuel Ortiz

    OGAWA Hirofumi
     
  • If sent packet size is wMaxPacketSize boundary, this device doesn't
    answer. To fix this, we have to send zero-length packet in usb spec.

    Signed-off-by: OGAWA Hirofumi
    Signed-off-by: Samuel Ortiz

    OGAWA Hirofumi
     
  • Signed-off-by: OGAWA Hirofumi
    Signed-off-by: Samuel Ortiz

    OGAWA Hirofumi
     

06 Jul, 2016

4 commits


04 Jul, 2016

1 commit

  • When setting the driver framing as NFC_DIGITAL_FRAMING_NFCF_NFC_DEP it
    used to be already configured as NFC_DIGITAL_FRAMING_NFCF which is the
    same. So this entry was empty in the in_protocols table.
    Now that the digital stack can handle PLS requests, it can be changed
    on the fly from NFC_DIGITAL_FRAMING_NFCA_NFC_DEP.
    This patch explicitly defines the framing configuration values for
    NFC_DIGITAL_FRAMING_NFCF_NFC_DEP.

    Signed-off-by: Thierry Escande
    Signed-off-by: Samuel Ortiz

    Thierry Escande
     

07 Apr, 2015

1 commit

  • Add missing terminating newlines to nfc_info and nfc_err
    to avoid possible interleaving from other messages.

    Miscellanea:

    o typo fix of "unknonwn" in message
    o remove unnecessary OOM messages as there's a generic dump_stack()
    o realign arguments

    Signed-off-by: Joe Perches
    Signed-off-by: Samuel Ortiz

    Joe Perches
     

26 May, 2014

1 commit


24 Feb, 2014

1 commit


17 Feb, 2014

2 commits

  • This adds support for ISO-DEP protocol over NFC-A rf technology. The
    port100 already supports NFC-A and ATS request and response for type 4A
    tags are handled at digital level. This patch adds NFC_PROTO_ISO14443
    to the supported protocols and an entry for framing configuration which
    is the same as NFC-A standard frame with CRC handling.

    Signed-off-by: Thierry Escande
    Signed-off-by: Samuel Ortiz

    Thierry Escande
     
  • The arrays for protocols and rf techs must define a number of entries
    corresponding to their maximum possible index values.

    Reported-by: Dan Carpenter
    Signed-off-by: Thierry Escande
    Signed-off-by: Samuel Ortiz

    Thierry Escande
     

05 Jan, 2014

1 commit

  • port100_probe() calls usb_get_dev(), but there is no usb_put_dev()
    in port100_disconnect(). The patch adds one.

    Found by Linux Driver Verification project (linuxtesting.org).

    Signed-off-by: Alexey Khoroshilov
    Signed-off-by: Samuel Ortiz

    Alexey Khoroshilov
     

07 Oct, 2013

4 commits

  • This implements the target NFC digital operations tg_configure_hw(),
    tg_listen(), tg_listen_mdaa(), and tg_send_cmd().

    The target mode supports NFC-A technology at 106kbits/s and NFC-F
    technologies at 212 and 424kbits/s.

    Signed-off-by: Thierry Escande
    Cc: Stephen Tiedemann
    Tested-by: Cho, Yu-Chen
    Signed-off-by: Samuel Ortiz

    Thierry Escande
     
  • This patch implements the initiator NFC operations in_configure_hw()
    and in_send_cmd(). It also implements the switch_rf() operation.

    The initiator mode supports NFC-A technology at 106kbits/s and NFC-F
    technologies at 212 and 424kbits/s.

    Signed-off-by: Thierry Escande
    Cc: Stephen Tiedemann
    Tested-by: Cho, Yu-Chen
    Signed-off-by: Samuel Ortiz

    Thierry Escande
     
  • This patch implements the command handling mechanism. The digital stack
    serializes all commands sent to the driver. This means that the digital
    stack waits for the reply of the current command before sending a new
    one. So there is no command queue managed at driver level.

    All Port-100 commands are asynchronous. If the command has been sent
    successfully to the device, it replies with an ACK frame. Then the
    command response is received (or actually no-response in case of
    timeout or error) and a command complete work on the system workqueue
    is responsible for sending the response (or the error) back to the
    digital stack.

    The digital stack requires some commands to be synchronous, mainly
    hardware configuration ones. These commands use the asynchronous
    command path but are made synchronous by using a completion object.

    Signed-off-by: Thierry Escande
    Cc: Stephen Tiedemann
    Tested-by: Cho, Yu-Chen
    Signed-off-by: Samuel Ortiz

    Thierry Escande
     
  • This adds support for the Sony NFC USB dongle RC-S380, based on the
    Port-100 chip. This dongle is an analog frontend and does not implement
    the digital layer. This driver uses the nfc_digital module which is an
    implementation of the NFC Digital Protocol stack.

    This patch is a skeleton. It only registers the dongle against the NFC
    digital protocol stack. All NFC digital operation functions are stubbed
    out.

    Signed-off-by: Thierry Escande
    Cc: Stephen Tiedemann
    Tested-by: Cho, Yu-Chen
    Signed-off-by: Samuel Ortiz

    Thierry Escande