05 Oct, 2017

1 commit


18 Feb, 2017

1 commit

  • [ Upstream commit f1712c73714088a7252d276a57126d56c7d37e64 ]

    Zhang Yanmin reported crashes [1] and provided a patch adding a
    synchronize_rcu() call in can_rx_unregister()

    The main problem seems that the sockets themselves are not RCU
    protected.

    If CAN uses RCU for delivery, then sockets should be freed only after
    one RCU grace period.

    Recent kernels could use sock_set_flag(sk, SOCK_RCU_FREE), but let's
    ease stable backports with the following fix instead.

    [1]
    BUG: unable to handle kernel NULL pointer dereference at (null)
    IP: [] selinux_socket_sock_rcv_skb+0x65/0x2a0

    Call Trace:

    [] security_sock_rcv_skb+0x4c/0x60
    [] sk_filter+0x41/0x210
    [] sock_queue_rcv_skb+0x53/0x3a0
    [] raw_rcv+0x2a3/0x3c0
    [] can_rcv_filter+0x12b/0x370
    [] can_receive+0xd9/0x120
    [] can_rcv+0xab/0x100
    [] __netif_receive_skb_core+0xd8c/0x11f0
    [] __netif_receive_skb+0x24/0xb0
    [] process_backlog+0x127/0x280
    [] net_rx_action+0x33b/0x4f0
    [] __do_softirq+0x184/0x440
    [] do_softirq_own_stack+0x1c/0x30

    [] do_softirq.part.18+0x3b/0x40
    [] do_softirq+0x1d/0x20
    [] netif_rx_ni+0xe5/0x110
    [] slcan_receive_buf+0x507/0x520
    [] flush_to_ldisc+0x21c/0x230
    [] process_one_work+0x24f/0x670
    [] worker_thread+0x9d/0x6f0
    [] ? rescuer_thread+0x480/0x480
    [] kthread+0x12c/0x150
    [] ret_from_fork+0x3f/0x70

    Reported-by: Zhang Yanmin
    Signed-off-by: Eric Dumazet
    Acked-by: Oliver Hartkopp
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Eric Dumazet
     

22 Sep, 2016

1 commit

  • A timer was used to restart after the bus-off state, leading to a
    relatively large can_restart() executed in an interrupt context,
    which in turn sets up pinctrl. When this happens during system boot,
    there is a high probability of grabbing the pinctrl_list_mutex,
    which is locked already by the probe() of other device, making the
    kernel suspect a deadlock condition [1].

    To resolve this issue, the restart_timer is replaced by a delayed
    work.

    [1] https://github.com/victronenergy/venus/issues/24

    Signed-off-by: Sergei Miroshnichenko
    Cc: linux-stable
    Signed-off-by: Marc Kleine-Budde

    Sergei Miroshnichenko
     

09 May, 2016

1 commit

  • As described in 'can: m_can: tag current CAN FD controllers as non-ISO'
    (6cfda7fbebe) it is possible to define fixed configuration options by
    setting the according bit in 'ctrlmode' and clear it in 'ctrlmode_supported'.
    This leads to the incovenience that the fixed configuration bits can not be
    passed by netlink even when they have the correct values (e.g. non-ISO, FD).

    This patch fixes that issue and not only allows fixed set bit values to be set
    again but now requires(!) to provide these fixed values at configuration time.
    A valid CAN FD configuration consists of a nominal/arbitration bittiming, a
    data bittiming and a control mode with CAN_CTRLMODE_FD set - which is now
    enforced by a new can_validate() function. This fix additionally removed the
    inconsistency that was prohibiting the support of 'CANFD-only' controller
    drivers, like the RCar CAN FD.

    For this reason a new helper can_set_static_ctrlmode() has been introduced to
    provide a proper interface to handle static enabled CAN controller options.

    Reported-by: Ramesh Shanmugasundaram
    Signed-off-by: Oliver Hartkopp
    Reviewed-by: Ramesh Shanmugasundaram
    Cc: # >= 3.18
    Signed-off-by: Marc Kleine-Budde

    Oliver Hartkopp
     

09 Oct, 2015

1 commit


21 Sep, 2015

1 commit


13 Jul, 2015

1 commit

  • Commit 514ac99c64b "can: fix multiple delivery of a single CAN frame for
    overlapping CAN filters" requires the skb->tstamp to be set to check for
    identical CAN skbs.

    Without timestamping to be required by user space applications this timestamp
    was not generated which lead to commit 36c01245eb8 "can: fix loss of CAN frames
    in raw_rcv" - which forces the timestamp to be set in all CAN related skbuffs
    by introducing several __net_timestamp() calls.

    This forces e.g. out of tree drivers which are not using alloc_can{,fd}_skb()
    to add __net_timestamp() after skbuff creation to prevent the frame loss fixed
    in mainline Linux.

    This patch removes the timestamp dependency and uses an atomic counter to
    create an unique identifier together with the skbuff pointer.

    Btw: the new skbcnt element introduced in struct can_skb_priv has to be
    initialized with zero in out-of-tree drivers which are not using
    alloc_can{,fd}_skb() too.

    Signed-off-by: Oliver Hartkopp
    Cc: linux-stable
    Signed-off-by: Marc Kleine-Budde

    Oliver Hartkopp
     

23 Mar, 2015

2 commits


08 Dec, 2014

1 commit

  • The handling of can error states is different between platforms.
    This is an attempt to correct that problem.

    I've moved this handling into a generic function for changing the
    error state. This ensures that error state changes are handled
    the same way everywhere (where this function is used).

    This new mechanism also adds reverse state transitioning in error
    frames, i.e. the user will be notified through the socket interface
    when the state goes down.

    Signed-off-by: Andri Yngvason
    Acked-by: Wolfgang Grandegger
    Signed-off-by: Marc Kleine-Budde

    Andri Yngvason
     

18 Nov, 2014

1 commit


19 May, 2014

2 commits

  • Armin pointed me to the fact that the identifier which is used to ensure the
    unique include processing in lunux/include/uapi/linux/can.h is CAN_H.
    This clashed with his own source as includes from libraries and APIs should
    use an underscore '_' at the identifier start.

    This patch fixes the protection identifiers in all CAN relavant includes.

    Reported-by: Armin Burchardt
    Signed-off-by: Oliver Hartkopp
    Signed-off-by: Marc Kleine-Budde

    Oliver Hartkopp
     
  • Add support for the CAN controller found in Renesas R-Car SoCs.

    Signed-off-by: Sergei Shtylyov
    Signed-off-by: Marc Kleine-Budde

    Sergei Shtylyov
     

07 Mar, 2014

2 commits

  • The configuration for CAN FD depends on CAN_CTRLMODE_FD enabled in the driver
    specific ctrlmode_supported capabilities.

    The configuration can be done either with the 'fd { on | off }' option in the
    'ip' tool from iproute2 or by setting the CAN netdevice MTU to CAN_MTU (16) or
    to CANFD_MTU (72).

    Signed-off-by: Oliver Hartkopp
    Acked-by: Stephane Grosjean
    Signed-off-by: Marc Kleine-Budde

    Oliver Hartkopp
     
  • As CAN FD offers a second bitrate for the data section of the CAN frame the
    infrastructure for storing and configuring this second bitrate is introduced.
    Improved the readability of the if-statement by inserting some newlines.

    Signed-off-by: Oliver Hartkopp
    Acked-by: Stephane Grosjean
    Signed-off-by: Marc Kleine-Budde

    Oliver Hartkopp
     

14 Feb, 2014

1 commit

  • linux-can-next-for-3.15-20140212

    Marc Kleine-Budde says:

    ====================
    this is a pull request of eight patches for net-next/master.

    Florian Vaussard contributed a series that merged the sja1000 of_platform
    into the platform driver. The of_platform driver is finally removed.
    Stephane Grosjean supplied a patch to allocate CANFD skbs. In a patch
    by Uwe Kleine-König another missing copyright information was added to
    a userspace header. And a patch by Yoann DI RUZZA that adds listen only
    mode to the at91_can driver.
    ====================

    Signed-off-by: David S. Miller

    David S. Miller
     

04 Feb, 2014

1 commit


31 Jan, 2014

1 commit

  • Self generated skbuffs in net/can/bcm.c are setting a skb->sk reference but
    no explicit destructor which is enforced since Linux 3.11 with commit
    376c7311bdb6 (net: add a temporary sanity check in skb_orphan()).

    This patch adds some helper functions to make sure that a destructor is
    properly defined when a sock reference is assigned to a CAN related skb.
    To create an unshared skb owned by the original sock a common helper function
    has been introduced to replace open coded functions to create CAN echo skbs.

    Signed-off-by: Oliver Hartkopp
    Tested-by: Andre Naujoks
    Reviewed-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Oliver Hartkopp
     

21 Aug, 2013

2 commits


27 Jun, 2013

1 commit


29 Jan, 2013

1 commit


26 Jan, 2013

4 commits

  • The struct can_skb_priv is used to transport additional information along
    with the stored struct can(fd)_frame that can not be contained in existing
    struct sk_buff elements.

    can_skb_priv is located in the skb headroom, which does not touch the existing
    CAN sk_buff usage with skb->data and skb->len, so that even out-of-tree
    CAN drivers can be used without changes.

    Btw. out-of-tree CAN drivers without can_skb_priv in the sk_buff headroom
    would not support features based on can_skb_priv.

    The can_skb_priv->ifindex contains the first interface where the CAN frame
    appeared on the local host. Unfortunately skb->skb_iif can not be used as this
    value is overwritten in every netif_receive_skb() call.

    Signed-off-by: Oliver Hartkopp
    Signed-off-by: Marc Kleine-Budde

    Oliver Hartkopp
     
  • The LED trigger name for CAN devices is based on the initial
    CAN device name, but does never change. The LED trigger name
    is not guaranteed to be unique in case of hotplugging CAN devices.

    This patch tries to address this problem by modifying the
    LED trigger name according to the CAN device name when
    the latter changes.

    v1 - Kurt Van Dijck
    v2 - Fabio Baltieri
    - remove rename blocking if trigger is bound
    - use led-subsystem function for the actual rename (still WiP)
    - call init/exit functions from dev.c
    v3 - Kurt Van Dijck
    - safe operation for non-candev based devices (vcan, slcan)
    based on earlier patch
    v4 - Kurt Van Dijck
    - trivial patch mistakes fixed

    Signed-off-by: Kurt Van Dijck
    Signed-off-by: Fabio Baltieri
    Signed-off-by: Marc Kleine-Budde

    Kurt Van Dijck
     
  • In net_device notifier calls, it was impossible to determine
    if a CAN device is based on candev in a safe way.
    This patch adds such test in order to access candev storage
    from within those notifiers.

    Signed-off-by: Kurt Van Dijck
    Acked-by: Oliver Hartkopp
    Signed-off-by: Fabio Baltieri
    Signed-off-by: Marc Kleine-Budde

    Kurt Van Dijck
     
  • This patch implements the functions to add two LED triggers, named
    -tx and -rx, to a canbus device driver.

    Triggers are called from specific handlers by each CAN device driver and
    can be disabled altogether with a Kconfig option.

    The implementation keeps the LED on when the interface is UP and blinks
    the LED on network activity at a configurable rate.

    This only supports can-dev based drivers, as it uses some support field
    in the can_priv structure.

    Supported drivers should call devm_can_led_init() and can_led_event() as
    needed.

    Cleanup is handled automatically by devres, so no *_exit function is
    needed.

    Supported events are:
    - CAN_LED_EVENT_OPEN: turn on tx/rx LEDs
    - CAN_LED_EVENT_STOP: turn off tx/rx LEDs
    - CAN_LED_EVENT_TX: trigger tx LED blink
    - CAN_LED_EVENT_RX: trigger tx LED blink

    Cc: Wolfgang Grandegger
    Cc: Marc Kleine-Budde
    Signed-off-by: Fabio Baltieri
    Acked-by: Oliver Hartkopp
    Signed-off-by: Marc Kleine-Budde

    Fabio Baltieri
     

17 Oct, 2012

1 commit

  • Remove non-UAPI Kbuild files that have become empty as a result of UAPI
    disintegration. They used to have only header-y lines in them and those have
    now moved to the Kbuild files in the corresponding uapi/ directories.

    Possibly these should not be removed but rather have a comment inserted to say
    they are intentionally left blank. This would make it easier to add generated
    header lines in future without having to restore the infrastructure.

    Note that at this point not all the UAPI disintegration parts have been merged,
    so it is likely that more empty Kbuild files will turn up.

    It is probably necessary to make the files non-empty to prevent the patch
    program from automatically deleting them when it reduces them to nothing.

    Signed-off-by: David Howells

    David Howells
     

11 Oct, 2012

1 commit


20 Jul, 2012

1 commit


20 Jun, 2012

3 commits


24 May, 2012

1 commit

  • As Heinz-Juergen Oertel pointed out 'CAN error frames' are a already defined
    term for the CAN protocol violation indication on the wire.

    To avoid confusion with the error messages created by CAN drivers available
    via CAN RAW sockets update the documentation and change the naming from
    'error frames' to 'error messages' or 'error message frames'.

    Signed-off-by: Oliver Hartkopp
    Signed-off-by: Marc Kleine-Budde

    Oliver Hartkopp
     

03 Feb, 2012

1 commit


02 Dec, 2011

1 commit


18 Oct, 2011

1 commit


17 Sep, 2011

1 commit

  • This patch adds a CAN Gateway/Router to route (and modify) CAN frames.

    It is based on the PF_CAN core infrastructure for msg filtering and msg
    sending and can optionally modify routed CAN frames on the fly.
    CAN frames can *only* be routed between CAN network interfaces (one hop).
    They can be modified with AND/OR/XOR/SET operations as configured by the
    netlink configuration interface known e.g. from iptables. From the netlink
    view this can-gw implements RTM_{NEW|DEL|GET}ROUTE for PF_CAN.

    The CAN specific userspace tool to manage CAN routing entries can be found in
    the CAN utils http://svn.berlios.de/wsvn/socketcan/trunk/can-utils/cangw.c
    at the SocketCAN SVN on BerliOS.

    Signed-off-by: Oliver Hartkopp
    Signed-off-by: David S. Miller

    Oliver Hartkopp
     

27 Aug, 2011

1 commit


05 May, 2011

1 commit

  • commit 53914b67993c724cec585863755c9ebc8446e83b had the
    same message. That commit did put everything in place but
    did not make can_proto const itself.

    Signed-off-by: Kurt Van Dijck
    Acked-by: Oliver Hartkopp
    Signed-off-by: David S. Miller

    Kurt Van Dijck
     

11 Apr, 2011

1 commit

  • * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (34 commits)
    net: Add support for SMSC LAN9530, LAN9730 and LAN89530
    mlx4_en: Restoring RX buffer pointer in case of failure
    mlx4: Sensing link type at device initialization
    ipv4: Fix "Set rt->rt_iif more sanely on output routes."
    MAINTAINERS: add entry for Xen network backend
    be2net: Fix suspend/resume operation
    be2net: Rename some struct members for clarity
    pppoe: drop PPPOX_ZOMBIEs in pppoe_flush_dev
    dsa/mv88e6131: add support for mv88e6085 switch
    ipv6: Enable RFS sk_rxhash tracking for ipv6 sockets (v2)
    be2net: Fix a potential crash during shutdown.
    bna: Fix for handling firmware heartbeat failure
    can: mcp251x: Allow pass IRQ flags through platform data.
    smsc911x: fix mac_lock acquision before calling smsc911x_mac_read
    iwlwifi: accept EEPROM version 0x423 for iwl6000
    rt2x00: fix cancelling uninitialized work
    rtlwifi: Fix some warnings/bugs
    p54usb: IDs for two new devices
    wl12xx: fix potential buffer overflow in testmode nvs push
    zd1211rw: reset rx idle timer from tasklet
    ...

    Linus Torvalds