28 Jun, 2017

1 commit

  • It looks like bnep_session has same pattern as the issue reported in
    old rfcomm:

    while (1) {
    set_current_state(TASK_INTERRUPTIBLE);
    if (condition)
    break;
    // may call might_sleep here
    schedule();
    }
    __set_current_state(TASK_RUNNING);

    Which fixed at:
    dfb2fae Bluetooth: Fix nested sleeps

    So let's fix it at the same way, also follow the suggestion of:
    https://lwn.net/Articles/628628/

    Signed-off-by: Jeffy Chen
    Reviewed-by: Brian Norris
    Reviewed-by: AL Yu-Chen Cho
    Signed-off-by: Marcel Holtmann

    Jeffy Chen
     

21 Jun, 2017

1 commit

  • follow Johannes Berg, semantic patch file as below,
    @@
    identifier p, p2;
    expression len;
    expression skb;
    type t, t2;
    @@
    (
    -p = __skb_put(skb, len);
    +p = __skb_put_zero(skb, len);
    |
    -p = (t)__skb_put(skb, len);
    +p = __skb_put_zero(skb, len);
    )
    ... when != p
    (
    p2 = (t2)p;
    -memset(p2, 0, len);
    |
    -memset(p, 0, len);
    )

    @@
    identifier p;
    expression len;
    expression skb;
    type t;
    @@
    (
    -t p = __skb_put(skb, len);
    +t p = __skb_put_zero(skb, len);
    )
    ... when != p
    (
    -memset(p, 0, len);
    )

    @@
    type t, t2;
    identifier p, p2;
    expression skb;
    @@
    t *p;
    ...
    (
    -p = __skb_put(skb, sizeof(t));
    +p = __skb_put_zero(skb, sizeof(t));
    |
    -p = (t *)__skb_put(skb, sizeof(t));
    +p = __skb_put_zero(skb, sizeof(t));
    )
    ... when != p
    (
    p2 = (t2)p;
    -memset(p2, 0, sizeof(*p));
    |
    -memset(p, 0, sizeof(*p));
    )

    @@
    expression skb, len;
    @@
    -memset(__skb_put(skb, len), 0, len);
    +__skb_put_zero(skb, len);

    @@
    expression skb, len, data;
    @@
    -memcpy(__skb_put(skb, len), data, len);
    +__skb_put_data(skb, data, len);

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

    Signed-off-by: yuan linyu
    Signed-off-by: David S. Miller

    yuan linyu
     

22 Oct, 2016

1 commit

  • These few drivers call ether_setup(), but have no ndo_change_mtu, and thus
    were overlooked for changes to MTU range checking behavior. They
    previously had no range checks, so for feature-parity, set their min_mtu
    to 0 and max_mtu to ETH_MAX_MTU (65535), instead of the 68 and 1500
    inherited from the ether_setup() changes. Fine-tuning can come after we get
    back to full feature-parity here.

    CC: netdev@vger.kernel.org
    Reported-by: Asbjoern Sloth Toennesen
    CC: Asbjoern Sloth Toennesen
    CC: R Parameswaran
    Signed-off-by: Jarod Wilson
    Signed-off-by: David S. Miller

    Jarod Wilson
     

13 Oct, 2016

1 commit

  • With centralized MTU checking, there's nothing productive done by
    eth_change_mtu that isn't already done in dev_set_mtu, so mark it as
    deprecated and remove all usage of it in the kernel. All callers have been
    audited for calls to alloc_etherdev* or ether_setup directly, which means
    they all have a valid dev->min_mtu and dev->max_mtu. Now eth_change_mtu
    prints out a netdev_warn about being deprecated, for the benefit of
    out-of-tree drivers that might be utilizing it.

    Of note, dvb_net.c actually had dev->mtu = 4096, while using
    eth_change_mtu, meaning that if you ever tried changing it's mtu, you
    couldn't set it above 1500 anymore. It's now getting dev->max_mtu also set
    to 4096 to remedy that.

    v2: fix up lantiq_etop, missed breakage due to drive not compiling on x86

    CC: netdev@vger.kernel.org
    Signed-off-by: Jarod Wilson
    Signed-off-by: David S. Miller

    Jarod Wilson
     

05 May, 2016

1 commit

  • Replace all trans_start updates with netif_trans_update helper.
    change was done via spatch:

    struct net_device *d;
    @@
    - d->trans_start = jiffies
    + netif_trans_update(d)

    Compile tested only.

    Cc: user-mode-linux-devel@lists.sourceforge.net
    Cc: linux-xtensa@linux-xtensa.org
    Cc: linux1394-devel@lists.sourceforge.net
    Cc: linux-rdma@vger.kernel.org
    Cc: netdev@vger.kernel.org
    Cc: MPT-FusionLinux.pdl@broadcom.com
    Cc: linux-scsi@vger.kernel.org
    Cc: linux-can@vger.kernel.org
    Cc: linux-parisc@vger.kernel.org
    Cc: linux-omap@vger.kernel.org
    Cc: linux-hams@vger.kernel.org
    Cc: linux-usb@vger.kernel.org
    Cc: linux-wireless@vger.kernel.org
    Cc: linux-s390@vger.kernel.org
    Cc: devel@driverdev.osuosl.org
    Cc: b.a.t.m.a.n@lists.open-mesh.org
    Cc: linux-bluetooth@vger.kernel.org
    Signed-off-by: Florian Westphal
    Acked-by: Felipe Balbi
    Acked-by: Mugunthan V N
    Acked-by: Antonio Quartulli
    Signed-off-by: David S. Miller

    Florian Westphal
     

11 Dec, 2015

1 commit

  • A Linux PC is connected with another device over Bluetooth PAN using a
    BNEP interface.

    Whenever a packet is tried to be sent over the BNEP interface, the
    function "bnep_net_xmit()" in "net/bluetooth/bnep/netdev.c" is called.
    This function calls "bnep_net_mc_filter()", which checks (if the
    destination address is multicast) if the address is set in a certain
    multicast filter (&s->mc_filter). If it is not, then it is not sent out.

    This filter is only changed in two other functions, found in
    net/bluetooth/bnep/core.c": in "bnep_ctrl_set_mc_filter()", which is
    only called if a message of type "BNEP_FILTER_MULTI_ADDR_SET" is
    received. Otherwise, it is set in "bnep_add_connection()", where it is
    set to a default value which only adds the broadcast address to the
    filter:

    set_bit(bnep_mc_hash(dev->broadcast), (ulong *) &s->mc_filter);

    To sum up, if the BNEP interface does not receive any message of type
    "BNEP_FILTER_MULTI_ADDR_SET", it will not send out any messages with
    multicast destination addresses except for broadcast.

    However, in the BNEP specification (page 27 in
    http://grouper.ieee.org/groups/802/15/Bluetooth/BNEP.pdf), it is said
    that per default, all multicast addresses should not be filtered, i.e.
    the BNEP interface should be able to send packets with any multicast
    destination address.

    It seems that the default case is wrong: the multicast filter should not
    block almost all multicast addresses, but should not filter out any.

    This leads to the problem that e.g. Neighbor Solicitation messages sent
    with Bluetooth PAN over the BNEP interface to a multicast destination
    address other than broadcast are blocked and not sent out.

    Therefore, in the default case, we set the mc_filter to ~0LL to not
    filter out any multicast addresses.

    Signed-off-by: Danny Schweizer
    Signed-off-by: Marcel Holtmann

    Danny Schweizer
     

11 May, 2015

1 commit


04 Apr, 2015

4 commits

  • With this patch kernel will be able to handle setup request. This is
    needed if we would like to handle control mesages with extension
    headers. User space will be only resposible for reading setup data and
    checking if scenario is conformance to specification (dst and src device
    bnep role). In case of new user space, setup data must be leaved(peek
    msg) on queue. New bnep session will be responsible for handling this
    data.

    Signed-off-by: Grzegorz Kolodziejczyk
    Signed-off-by: Marcel Holtmann

    Grzegorz Kolodziejczyk
     
  • Handling extended headers of control frames is required BNEP
    functionality. This patch refractor bnep rx frame handling function.
    Extended header for control frames shouldn't be omitted as it was
    previously done. Every control frame should be checked if it contains
    extended header and then every extension should be parsed separately.

    Signed-off-by: Grzegorz Kolodziejczyk
    Signed-off-by: Marcel Holtmann

    Grzegorz Kolodziejczyk
     
  • This is needed if user space wants to know supported bnep features
    by kernel, e.g. if kernel supports sending response to bnep setup
    control message. By now there is no possibility to know supported
    features by kernel in case of bnep. Ioctls allows only to add connection,
    delete connection, get connection list, get connection info. Adding
    connection if it's possible (establishing network device connection) is
    equivalent to starting bnep session. Bnep session handles data queue of
    transmit, receive messages over bnep channel. It means that if we add
    connection the received/transmitted data will be parsed immediately. In
    case of get bnep features we want to know before session start, if we
    should leave setup data on socket queue and let kernel to handle with it,
    or in case of no setup handling support, if we should pull this message
    and handle setup response within user space.

    Signed-off-by: Grzegorz Kolodziejczyk
    Signed-off-by: Marcel Holtmann

    Grzegorz Kolodziejczyk
     
  • Send command not understood response should be verified if it was
    successfully sent, like all send responses.

    Signed-off-by: Grzegorz Kolodziejczyk
    Signed-off-by: Marcel Holtmann

    Grzegorz Kolodziejczyk
     

02 Apr, 2015

1 commit


04 Mar, 2015

1 commit


03 Feb, 2015

1 commit

  • The bnep_get_device function may be triggered by an ioctl just after a
    connection has gone down. In such a case the respective L2CAP chan->conn
    pointer will get set to NULL (by l2cap_chan_del). This patch adds a
    missing NULL check for this case in the bnep_get_device() function.

    Reported-by: Patrik Flykt
    Signed-off-by: Johan Hedberg
    Signed-off-by: Marcel Holtmann

    Johan Hedberg
     

19 Dec, 2014

1 commit


02 Nov, 2014

1 commit

  • The current kernel options do not make it clear which modules are for
    Bluetooth Classic (BR/EDR) and which are for Bluetooth Low Energy (LE).

    To make it really clear, introduce BT_BREDR and BT_LE options with
    proper dependencies into the different modules. Both new options
    default to y to not create a regression with previous kernel config
    files.

    Signed-off-by: Marcel Holtmann
    Signed-off-by: Johan Hedberg

    Marcel Holtmann
     

16 Jul, 2014

1 commit

  • Extend alloc_netdev{,_mq{,s}}() to take name_assign_type as argument, and convert
    all users to pass NET_NAME_UNKNOWN.

    Coccinelle patch:

    @@
    expression sizeof_priv, name, setup, txqs, rxqs, count;
    @@

    (
    -alloc_netdev_mqs(sizeof_priv, name, setup, txqs, rxqs)
    +alloc_netdev_mqs(sizeof_priv, name, NET_NAME_UNKNOWN, setup, txqs, rxqs)
    |
    -alloc_netdev_mq(sizeof_priv, name, setup, count)
    +alloc_netdev_mq(sizeof_priv, name, NET_NAME_UNKNOWN, setup, count)
    |
    -alloc_netdev(sizeof_priv, name, setup)
    +alloc_netdev(sizeof_priv, name, NET_NAME_UNKNOWN, setup)
    )

    v9: move comments here from the wrong commit

    Signed-off-by: Tom Gundersen
    Reviewed-by: David Herrmann
    Signed-off-by: David S. Miller

    Tom Gundersen
     

07 Dec, 2013

1 commit

  • Several files refer to an old address for the Free Software Foundation
    in the file header comment. Resolve by replacing the address with
    the URL so that we do not have to keep
    updating the header comments anytime the address changes.

    CC: John Fastabend
    CC: Alex Duyck
    CC: Marcel Holtmann
    CC: Gustavo Padovan
    CC: Johan Hedberg
    CC: Jamal Hadi Salim
    Signed-off-by: Jeff Kirsher
    Signed-off-by: David S. Miller

    Jeff Kirsher
     

14 Oct, 2013

1 commit


02 May, 2013

1 commit

  • Pull VFS updates from Al Viro,

    Misc cleanups all over the place, mainly wrt /proc interfaces (switch
    create_proc_entry to proc_create(), get rid of the deprecated
    create_proc_read_entry() in favor of using proc_create_data() and
    seq_file etc).

    7kloc removed.

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (204 commits)
    don't bother with deferred freeing of fdtables
    proc: Move non-public stuff from linux/proc_fs.h to fs/proc/internal.h
    proc: Make the PROC_I() and PDE() macros internal to procfs
    proc: Supply a function to remove a proc entry by PDE
    take cgroup_open() and cpuset_open() to fs/proc/base.c
    ppc: Clean up scanlog
    ppc: Clean up rtas_flash driver somewhat
    hostap: proc: Use remove_proc_subtree()
    drm: proc: Use remove_proc_subtree()
    drm: proc: Use minor->index to label things, not PDE->name
    drm: Constify drm_proc_list[]
    zoran: Don't print proc_dir_entry data in debug
    reiserfs: Don't access the proc_dir_entry in r_open(), r_start() r_show()
    proc: Supply an accessor for getting the data from a PDE's parent
    airo: Use remove_proc_subtree()
    rtl8192u: Don't need to save device proc dir PDE
    rtl8187se: Use a dir under /proc/net/r8180/
    proc: Add proc_mkdir_data()
    proc: Move some bits from linux/proc_fs.h to linux/{of.h,signal.h,tty.h}
    proc: Move PDE_NET() to fs/proc/proc_net.c
    ...

    Linus Torvalds
     

10 Apr, 2013

2 commits


28 Mar, 2013

1 commit

  • Add a new constant ETH_P_802_3_MIN, the minimum ethernet type for
    an 802.3 frame. Frames with a lower value in the ethernet type field
    are Ethernet II.

    Also update all the users of this value that David Miller and
    I could find to use the new constant.

    Also correct a bug in util.c. The comparison with ETH_P_802_3_MIN
    should be >= not >.

    As suggested by Jesse Gross.

    Compile tested only.

    Cc: David Miller
    Cc: Jesse Gross
    Cc: Karsten Keil
    Cc: John W. Linville
    Cc: Johannes Berg
    Cc: Bart De Schuymer
    Cc: Stephen Hemminger
    Cc: Patrick McHardy
    Cc: Marcel Holtmann
    Cc: Gustavo Padovan
    Cc: Johan Hedberg
    Cc: linux-bluetooth@vger.kernel.org
    Cc: netfilter-devel@vger.kernel.org
    Cc: bridge@lists.linux-foundation.org
    Cc: linux-wireless@vger.kernel.org
    Cc: linux1394-devel@lists.sourceforge.net
    Cc: linux-media@vger.kernel.org
    Cc: netdev@vger.kernel.org
    Cc: dev@openvswitch.org
    Acked-by: Mauro Carvalho Chehab
    Acked-by: Stefan Richter
    Signed-off-by: Simon Horman
    Signed-off-by: David S. Miller

    Simon Horman
     

08 Mar, 2013

1 commit

  • After we successfully registered a socket via bt_sock_register() there is
    no reason to ever check the return code of bt_sock_unregister(). If
    bt_sock_unregister() fails, it means the socket _is_ already unregistered
    so we have what we want, don't we?

    Also, to get bt_sock_unregister() to fail, another part of the kernel has
    to unregister _our_ socket. This is sooo _wrong_ that it will break way
    earlier than when we unregister our socket.

    Signed-off-by: David Herrmann
    Signed-off-by: Gustavo Padovan

    David Herrmann
     

10 Jan, 2013

1 commit


02 Nov, 2012

1 commit


20 Oct, 2012

1 commit


29 Sep, 2012

1 commit

  • Conflicts:
    drivers/net/team/team.c
    drivers/net/usb/qmi_wwan.c
    net/batman-adv/bat_iv_ogm.c
    net/ipv4/fib_frontend.c
    net/ipv4/route.c
    net/l2tp/l2tp_netlink.c

    The team, fib_frontend, route, and l2tp_netlink conflicts were simply
    overlapping changes.

    qmi_wwan and bat_iv_ogm were of the "use HEAD" variety.

    With help from Antonio Quartulli.

    Signed-off-by: David S. Miller

    David S. Miller
     

28 Sep, 2012

1 commit


22 Sep, 2012

1 commit


07 Aug, 2012

1 commit


05 Jun, 2012

2 commits


23 May, 2012

1 commit


10 May, 2012

1 commit

  • Use the new bool function ether_addr_equal to add
    some clarity and reduce the likelihood for misuse
    of compare_ether_addr for sorting.

    Done via cocci script:

    $ cat compare_ether_addr.cocci
    @@
    expression a,b;
    @@
    - !compare_ether_addr(a, b)
    + ether_addr_equal(a, b)

    @@
    expression a,b;
    @@
    - compare_ether_addr(a, b)
    + !ether_addr_equal(a, b)

    @@
    expression a,b;
    @@
    - !ether_addr_equal(a, b) == 0
    + ether_addr_equal(a, b)

    @@
    expression a,b;
    @@
    - !ether_addr_equal(a, b) != 0
    + !ether_addr_equal(a, b)

    @@
    expression a,b;
    @@
    - ether_addr_equal(a, b) == 0
    + !ether_addr_equal(a, b)

    @@
    expression a,b;
    @@
    - ether_addr_equal(a, b) != 0
    + ether_addr_equal(a, b)

    @@
    expression a,b;
    @@
    - !!ether_addr_equal(a, b)
    + ether_addr_equal(a, b)

    Signed-off-by: Joe Perches
    Signed-off-by: David S. Miller

    Joe Perches
     

09 May, 2012

1 commit


29 Mar, 2012

1 commit


27 Feb, 2012

1 commit


04 Jan, 2012

1 commit


21 Dec, 2011

1 commit