aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/can/usb (follow)
AgeCommit message (Collapse)AuthorFilesLines
2021-08-26Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netJakub Kicinski1-2/+2
drivers/net/wwan/mhi_wwan_mbim.c - drop the extra arg. Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2021-08-26can: usb: esd_usb2: esd_usb2_rx_event(): fix the interchange of the CAN RX and TX error countersStefan Mätje1-2/+2
This patch fixes the interchanged fetch of the CAN RX and TX error counters from the ESD_EV_CAN_ERROR_EXT message. The RX error counter is really in struct rx_msg::data[2] and the TX error counter is in struct rx_msg::data[3]. Fixes: 96d8e90382dc ("can: Add driver for esd CAN-USB/2 device") Link: https://lore.kernel.org/r/20210825215227.4947-2-stefan.maetje@esd.eu Cc: stable@vger.kernel.org Signed-off-by: Stefan Mätje <stefan.maetje@esd.eu> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2021-08-19can: etas_es58x: clean-up documentation of struct es58x_fd_tx_conf_msgVincent Mailhol1-16/+7
The documentation of struct es58x_fd_tx_conf_msg explains in details the different TDC parameters. However, those description are redundant with the documentation of struct can_tdc. Remove most of the description. Also, fixes a typo in the reference to the datasheet (E701 -> E70). Link: https://lore.kernel.org/r/20210815033248.98111-8-mailhol.vincent@wanadoo.fr Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2021-07-31Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netJakub Kicinski5-8/+49
Conflicting commits, all resolutions pretty trivial: drivers/bus/mhi/pci_generic.c 5c2c85315948 ("bus: mhi: pci-generic: configurable network interface MRU") 56f6f4c4eb2a ("bus: mhi: pci_generic: Apply no-op for wake using sideband wake boolean") drivers/nfc/s3fwrn5/firmware.c a0302ff5906a ("nfc: s3fwrn5: remove unnecessary label") 46573e3ab08f ("nfc: s3fwrn5: fix undefined parameter values in dev_err()") 801e541c79bb ("nfc: s3fwrn5: fix undefined parameter values in dev_err()") MAINTAINERS 7d901a1e878a ("net: phy: add Maxlinear GPY115/21x/24x driver") 8a7b46fa7902 ("MAINTAINERS: add Yasushi SHOJI as reviewer for the Microchip CAN BUS Analyzer Tool driver") Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2021-07-30can: esd_usb2: fix memory leakPavel Skripkin1-1/+15
In esd_usb2_setup_rx_urbs() MAX_RX_URBS coherent buffers are allocated and there is nothing, that frees them: 1) In callback function the urb is resubmitted and that's all 2) In disconnect function urbs are simply killed, but URB_FREE_BUFFER is not set (see esd_usb2_setup_rx_urbs) and this flag cannot be used with coherent buffers. So, all allocated buffers should be freed with usb_free_coherent() explicitly. Side note: This code looks like a copy-paste of other can drivers. The same patch was applied to mcba_usb driver and it works nice with real hardware. There is no change in functionality, only clean-up code for coherent buffers. Fixes: 96d8e90382dc ("can: Add driver for esd CAN-USB/2 device") Link: https://lore.kernel.org/r/b31b096926dcb35998ad0271aac4b51770ca7cc8.1627404470.git.paskripkin@gmail.com Cc: linux-stable <stable@vger.kernel.org> Signed-off-by: Pavel Skripkin <paskripkin@gmail.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2021-07-30can: ems_usb: fix memory leakPavel Skripkin1-1/+13
In ems_usb_start() MAX_RX_URBS coherent buffers are allocated and there is nothing, that frees them: 1) In callback function the urb is resubmitted and that's all 2) In disconnect function urbs are simply killed, but URB_FREE_BUFFER is not set (see ems_usb_start) and this flag cannot be used with coherent buffers. So, all allocated buffers should be freed with usb_free_coherent() explicitly. Side note: This code looks like a copy-paste of other can drivers. The same patch was applied to mcba_usb driver and it works nice with real hardware. There is no change in functionality, only clean-up code for coherent buffers. Fixes: 702171adeed3 ("ems_usb: Added support for EMS CPC-USB/ARM7 CAN/USB interface") Link: https://lore.kernel.org/r/59aa9fbc9a8cbf9af2bbd2f61a659c480b415800.1627404470.git.paskripkin@gmail.com Cc: linux-stable <stable@vger.kernel.org> Signed-off-by: Pavel Skripkin <paskripkin@gmail.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2021-07-30can: usb_8dev: fix memory leakPavel Skripkin1-2/+13
In usb_8dev_start() MAX_RX_URBS coherent buffers are allocated and there is nothing, that frees them: 1) In callback function the urb is resubmitted and that's all 2) In disconnect function urbs are simply killed, but URB_FREE_BUFFER is not set (see usb_8dev_start) and this flag cannot be used with coherent buffers. So, all allocated buffers should be freed with usb_free_coherent() explicitly. Side note: This code looks like a copy-paste of other can drivers. The same patch was applied to mcba_usb driver and it works nice with real hardware. There is no change in functionality, only clean-up code for coherent buffers. Fixes: 0024d8ad1639 ("can: usb_8dev: Add support for USB2CAN interface from 8 devices") Link: https://lore.kernel.org/r/d39b458cd425a1cf7f512f340224e6e9563b07bd.1627404470.git.paskripkin@gmail.com Cc: linux-stable <stable@vger.kernel.org> Signed-off-by: Pavel Skripkin <paskripkin@gmail.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2021-07-30can: mcba_usb_start(): add missing urb->transfer_dma initializationPavel Skripkin1-0/+2
Yasushi reported, that his Microchip CAN Analyzer stopped working since commit 91c02557174b ("can: mcba_usb: fix memory leak in mcba_usb"). The problem was in missing urb->transfer_dma initialization. In my previous patch to this driver I refactored mcba_usb_start() code to avoid leaking usb coherent buffers. To archive it, I passed local stack variable to usb_alloc_coherent() and then saved it to private array to correctly free all coherent buffers on ->close() call. But I forgot to initialize urb->transfer_dma with variable passed to usb_alloc_coherent(). All of this was causing device to not work, since dma addr 0 is not valid and following log can be found on bug report page, which points exactly to problem described above. | DMAR: [DMA Write] Request device [00:14.0] PASID ffffffff fault addr 0 [fault reason 05] PTE Write access is not set Fixes: 91c02557174b ("can: mcba_usb: fix memory leak in mcba_usb") Link: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=990850 Link: https://lore.kernel.org/r/20210725103630.23864-1-paskripkin@gmail.com Cc: linux-stable <stable@vger.kernel.org> Reported-by: Yasushi SHOJI <yasushi.shoji@gmail.com> Signed-off-by: Pavel Skripkin <paskripkin@gmail.com> Tested-by: Yasushi SHOJI <yashi@spacecubics.com> [mkl: fixed typos in commit message - thanks Yasushi SHOJI] Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2021-07-25can: etas_es58x: rewrite the message cast in es58{1,_fd}_tx_can_msg to increase readabilityVincent Mailhol2-4/+2
The es581_tx_can_msg() does below cast: | tx_can_msg = (struct es581_4_tx_can_msg *) | &es581_4_urb_cmd->bulk_tx_can_msg.tx_can_msg_buf[msg_len - 1]; The -1 offset is to skip the first member of struct es581_4_tx_can_msg. However, es581_4_urb_cmd already has a raw_msg field which can be used instead without the use of an offset calculation. The function es58x_fd_tx_can_msg() is also modified to mirror es581_tx_can_msg(). Link: https://lore.kernel.org/r/20210628155420.1176217-7-mailhol.vincent@wanadoo.fr Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2021-07-25can: etas_es58x: use sizeof and sizeof_field macros instead of constant valuesVincent Mailhol2-2/+2
Replace two constant values by a call to sizeof{,_field} on the relevant field to make the logic easier to understand. Link: https://lore.kernel.org/r/20210628155420.1176217-6-mailhol.vincent@wanadoo.fr Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2021-07-25can: etas_es58x: add es58x_free_netdevs() to factorize codeVincent Mailhol1-22/+24
Both es58x_probe() and es58x_disconnect() use a similar code snippet to release the netdev resources. Factorize it in an helper function named es58x_free_netdevs(). Link: https://lore.kernel.org/r/20210628155420.1176217-5-mailhol.vincent@wanadoo.fr Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2021-07-25can: etas_es58x: use devm_kzalloc() to allocate device resourcesVincent Mailhol1-6/+3
Replace kzalloc() with devm_kzalloc(). By doing this, we do not need to care anymore about having to call kfree(). This result in a simpler and more easy to read code. Link: https://lore.kernel.org/r/20210628155420.1176217-4-mailhol.vincent@wanadoo.fr Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2021-07-25can: etas_es58x: use error pointer during device probingVincent Mailhol1-13/+10
Make es58x_init_es58x_dev return a pointer to the allocated structure instead of returning an integer. Errors are handled through the helper function ERR_PTR and IS_ERR. This slightly simplifies the code. Link: https://lore.kernel.org/r/20210628155420.1176217-3-mailhol.vincent@wanadoo.fr Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2021-07-25can: etas_es58x: fix three typos in author name and documentationVincent Mailhol3-10/+10
Change the author name from "lastname firstname" to "firstname lastname". Fix a typo in a variable name in the documentation of struct es58x_parameters::fifo_mask. Fix a typo in the title of the datasheet (E701 -> E70) and re-indent the comments. Link: https://lore.kernel.org/r/20210628155420.1176217-2-mailhol.vincent@wanadoo.fr Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2021-07-25can: peak_usb: pcan_usb_decode_error(): upgrade handling of bus state changesStephane Grosjean1-123/+43
This patch updates old code by using the can_change_state() function published since by the socket-can module. In particular, this new code better manages the change of bus state by also using the value of the error counters that the driver now systematically asks for when initializing the channel. Link: https://lore.kernel.org/r/20210715142842.35793-1-s.grosjean@peak-system.com Signed-off-by: Stephane Grosjean <s.grosjean@peak-system.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2021-07-25can: peak_usb: pcan_usb_encode_msg(): add informationStephane Grosjean1-2/+4
This patch adds information by replacing a hard-coded values with its symbol and a adding comment. Link: https://lore.kernel.org/r/20210625130931.27438-5-s.grosjean@peak-system.com Signed-off-by: Stephane Grosjean <s.grosjean@peak-system.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2021-07-25can: peak_usb: PCAN-USB: add support of loopback and one-shot modeStephane Grosjean1-4/+49
The CAN - USB PCAN-USB interface is able to generate one-shot frames as well as loopback frames that it transmits starting from version 4.1 of its firmware. This patch adds support for the one-shot and loopback functionality to the driver, that can be activated if the embedded firmware allows it. If the driver detects that the PCAN-USB device runs an old firmware (< 4.1) it prints a message suggesting to contact <support@peak-system.com> for a possible firmware update. Link: https://lore.kernel.org/r/20210625130931.27438-3-s.grosjean@peak-system.com Signed-off-by: Stephane Grosjean <s.grosjean@peak-system.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2021-07-25can: peak_usb: pcan_usb_get_device_id(): read value only in case of successStephane Grosjean1-1/+2
In case of error, reading value from response argument is useless. Link: https://lore.kernel.org/r/20210625130931.27438-2-s.grosjean@peak-system.com Signed-off-by: Stephane Grosjean <s.grosjean@peak-system.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2021-07-25can: esd_usb2: use DEVICE_ATTR_RO() helper macroZhen Lei1-6/+6
Use DEVICE_ATTR_RO() helper macro instead of plain DEVICE_ATTR(), which makes the code a bit shorter and easier to read. Link: https://lore.kernel.org/r/20210603110902.11930-1-thunder.leizhen@huawei.com Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2021-07-24can: peak_usb: pcan_usb_handle_bus_evt(): fix reading rxerr/txerr valuesStephane Grosjean1-4/+6
This patch fixes an incorrect way of reading error counters in messages received for this purpose from the PCAN-USB interface. These messages inform about the increase or decrease of the error counters, whose values are placed in bytes 1 and 2 of the message data (not 0 and 1). Fixes: ea8b33bde76c ("can: pcan_usb: add support of rxerr/txerr counters") Link: https://lore.kernel.org/r/20210625130931.27438-4-s.grosjean@peak-system.com Cc: linux-stable <stable@vger.kernel.org> Signed-off-by: Stephane Grosjean <s.grosjean@peak-system.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2021-06-29Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netJakub Kicinski1-1/+2
Trivial conflict in net/netfilter/nf_tables_api.c. Duplicate fix in tools/testing/selftests/net/devlink_port_split.py - take the net-next version. skmsg, and L4 bpf - keep the bpf code but remove the flags and err params. Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2021-06-19net: can: ems_usb: fix use-after-free in ems_usb_disconnect()Pavel Skripkin1-1/+2
In ems_usb_disconnect() dev pointer, which is netdev private data, is used after free_candev() call: | if (dev) { | unregister_netdev(dev->netdev); | free_candev(dev->netdev); | | unlink_all_urbs(dev); | | usb_free_urb(dev->intr_urb); | | kfree(dev->intr_in_buffer); | kfree(dev->tx_msg_buffer); | } Fix it by simply moving free_candev() at the end of the block. Fail log: | BUG: KASAN: use-after-free in ems_usb_disconnect | Read of size 8 at addr ffff88804e041008 by task kworker/1:2/2895 | | CPU: 1 PID: 2895 Comm: kworker/1:2 Not tainted 5.13.0-rc5+ #164 | Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a-rebuilt.opensuse.4 | Workqueue: usb_hub_wq hub_event | Call Trace: | dump_stack (lib/dump_stack.c:122) | print_address_description.constprop.0.cold (mm/kasan/report.c:234) | kasan_report.cold (mm/kasan/report.c:420 mm/kasan/report.c:436) | ems_usb_disconnect (drivers/net/can/usb/ems_usb.c:683 drivers/net/can/usb/ems_usb.c:1058) Fixes: 702171adeed3 ("ems_usb: Added support for EMS CPC-USB/ARM7 CAN/USB interface") Link: https://lore.kernel.org/r/20210617185130.5834-1-paskripkin@gmail.com Cc: linux-stable <stable@vger.kernel.org> Signed-off-by: Pavel Skripkin <paskripkin@gmail.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2021-06-18Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netJakub Kicinski1-2/+15
Trivial conflicts in net/can/isotp.c and tools/testing/selftests/net/mptcp/mptcp_connect.sh scaled_ppm_to_ppb() was moved from drivers/ptp/ptp_clock.c to include/linux/ptp_clock_kernel.h in -next so re-apply the fix there. Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2021-06-16can: mcba_usb: fix memory leak in mcba_usbPavel Skripkin1-2/+15
Syzbot reported memory leak in SocketCAN driver for Microchip CAN BUS Analyzer Tool. The problem was in unfreed usb_coherent. In mcba_usb_start() 20 coherent buffers are allocated and there is nothing, that frees them: 1) In callback function the urb is resubmitted and that's all 2) In disconnect function urbs are simply killed, but URB_FREE_BUFFER is not set (see mcba_usb_start) and this flag cannot be used with coherent buffers. Fail log: | [ 1354.053291][ T8413] mcba_usb 1-1:0.0 can0: device disconnected | [ 1367.059384][ T8420] kmemleak: 20 new suspected memory leaks (see /sys/kernel/debug/kmem) So, all allocated buffers should be freed with usb_free_coherent() explicitly NOTE: The same pattern for allocating and freeing coherent buffers is used in drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c Fixes: 51f3baad7de9 ("can: mcba_usb: Add support for Microchip CAN BUS Analyzer") Link: https://lore.kernel.org/r/20210609215833.30393-1-paskripkin@gmail.com Cc: linux-stable <stable@vger.kernel.org> Reported-and-tested-by: syzbot+57281c762a3922e14dfe@syzkaller.appspotmail.com Signed-off-by: Pavel Skripkin <paskripkin@gmail.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2021-05-27can: kvaser_usb: Add new Kvaser hydra devicesJimmy Assarsson2-1/+7
Add new Kvaser hydra devices. Link: https://lore.kernel.org/r/20210429093730.499263-2-extja@kvaser.com Signed-off-by: Jimmy Assarsson <extja@kvaser.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2021-05-27can: kvaser_usb: Rename define USB_HYBRID_{,PRO_}CANLIN_PRODUCT_IDJimmy Assarsson1-4/+4
Rename define USB_HYBRID_{,PRO_}CANLIN_PRODUCT_ID to USB_HYBRID_{,PRO_}2CANLIN_PRODUCT_ID, to reflect the channel count. Link: https://lore.kernel.org/r/20210429093730.499263-1-extja@kvaser.com Signed-off-by: Jimmy Assarsson <extja@kvaser.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2021-04-24can: etas_es58x: Fix a couple of spelling mistakesColin Ian King1-2/+2
There are spelling mistakes in netdev_dbg and netdev_dbg messages, fix these. Link: https://lore.kernel.org/r/20210415113050.1942333-1-colin.king@canonical.com Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2021-04-24can: etas_es58x: Fix missing null check on netdev pointerColin Ian King1-1/+1
There is an assignment to *netdev that is that can potentially be null but the null check is checking netdev and not *netdev as intended. Fix this by adding in the missing * operator. Fixes: 8537257874e9 ("can: etas_es58x: add core support for ETAS ES58X CAN USB interfaces") Link: https://lore.kernel.org/r/20210415084723.1807935-1-colin.king@canonical.com Addresses-Coverity: ("Dereference before null check") Signed-off-by: Colin Ian King <colin.king@canonical.com> Acked-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2021-04-14can: etas_es58x: fix null pointer dereference when handling error framesVincent Mailhol1-1/+1
During the handling of CAN bus errors, a CAN error SKB is allocated using alloc_can_err_skb(). Even if the allocation of the SKB fails, the function continues in order to do the stats handling. All access to the can_frame pointer (cf) should be guarded by an if statement: if (cf) However, the increment of the rx_bytes stats: netdev->stats.rx_bytes += cf->can_dlc; dereferences the cf pointer and was not guarded by an if condition leading to a NULL pointer dereference if the can_err_skb() function failed. Replacing the cf->can_dlc by the macro CAN_ERR_DLC (which is the length of any CAN error frames) solves this NULL pointer dereference. Fixes: 8537257874e9 ("can: etas_es58x: add core support for ETAS ES58X CAN USB interfaces") Link: https://lore.kernel.org/r/20210413114242.2760-1-mailhol.vincent@wanadoo.fr Reported-by: Arunachalam Santhanam <arunachalam.santhanam@in.bosch.com> Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2021-04-13can: peak_usb: pcan_usb: replace open coded endianness conversion of unaligned dataMarc Kleine-Budde1-26/+11
This patch replaces the open coded endianness conversion of unaligned data by the appropriate get/put_unaligned_leXX() variants. Link: https://lore.kernel.org/r/20210406111622.1874957-11-mkl@pengutronix.de Acked-by: Stephane Grosjean <s.grosjean@peak-system.com> Tested-by: Stephane Grosjean <s.grosjean@peak-system.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2021-04-13can: peak_usb: pcan_usb_get_serial(): unconditionally assign serial_numberMarc Kleine-Budde1-3/+1
The function serial_number is only called from one location with a valid serial_number pointer. Remove not needed NULL pointer check. Link: https://lore.kernel.org/r/20210406111622.1874957-10-mkl@pengutronix.de Acked-by: Stephane Grosjean <s.grosjean@peak-system.com> Tested-by: Stephane Grosjean <s.grosjean@peak-system.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2021-04-13can: peak_usb: pcan_usb_get_serial(): make use of le32_to_cpup()Marc Kleine-Budde1-6/+2
This patch replaces the memcpy() + le32_to_cpu() by le32_to_cpup(). Link: https://lore.kernel.org/r/20210406111622.1874957-9-mkl@pengutronix.de Acked-by: Stephane Grosjean <s.grosjean@peak-system.com> Tested-by: Stephane Grosjean <s.grosjean@peak-system.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2021-04-13can: peak_usb: pcan_usb_get_serial(): remove error message from error pathMarc Kleine-Budde1-4/+5
The caller of pcan_usb_get_serial() already prints an error message, so remove this one and return immediately. Link: https://lore.kernel.org/r/20210406111622.1874957-8-mkl@pengutronix.de Acked-by: Stephane Grosjean <s.grosjean@peak-system.com> Tested-by: Stephane Grosjean <s.grosjean@peak-system.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2021-04-13can: peak_usb: pcan_usb_{,pro}_get_device_id(): remove unneeded check for device_idMarc Kleine-Budde2-4/+3
The callback struct peak_usb_adapter::dev_get_device_id, which is implemented by the functions pcan_usb_{,pro}_get_device_id() is only ever called with a valid device_id pointer. This patch removes the unneeded check if the device_id pointer is valid. Link: https://lore.kernel.org/r/20210406111622.1874957-7-mkl@pengutronix.de Acked-by: Stephane Grosjean <s.grosjean@peak-system.com> Tested-by: Stephane Grosjean <s.grosjean@peak-system.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2021-04-13can: peak_usb: peak_usb_probe(): make use of driver_infoMarc Kleine-Budde1-33/+24
There's no need to iterate over all supported adapters to find the struct peak_usb_adapter that describes the currently probed devices's capabilities. The driver core gives us the information for free, if we assign it to the struct usb_device_id::driver_info. This patch assigns the usb_device_id::driver_info and converts peak_usb_probe() to make use of it. This reduces the driver size by 100 bytes on ARCH=arm. | add/remove: 0/1 grow/shrink: 0/1 up/down: 0/-124 (-124) | Function old new delta | peak_usb_adapters_list 24 - -24 | peak_usb_probe 236 136 -100 | Total: Before=25263, After=25139, chg -0.49% Link: https://lore.kernel.org/r/20210406111622.1874957-6-mkl@pengutronix.de Acked-by: Stephane Grosjean <s.grosjean@peak-system.com> Tested-by: Stephane Grosjean <s.grosjean@peak-system.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2021-04-13can: peak_usb: remove write only variable struct peak_usb_adapter::ts_periodMarc Kleine-Budde4-7/+0
The variable struct peak_usb_adapter::ts_period is only ever written to. This patch removes it from the driver. Link: https://lore.kernel.org/r/20210406111622.1874957-5-mkl@pengutronix.de Acked-by: Stephane Grosjean <s.grosjean@peak-system.com> Tested-by: Stephane Grosjean <s.grosjean@peak-system.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2021-04-13can: peak_usb: remove unused variables from struct peak_usb_deviceMarc Kleine-Budde1-4/+0
This patch removes the unused variables struct peak_usb_device::echo_skb and struct peak_usb_device::bus_load from the driver. Link: https://lore.kernel.org/r/20210406111622.1874957-4-mkl@pengutronix.de Acked-by: Stephane Grosjean <s.grosjean@peak-system.com> Tested-by: Stephane Grosjean <s.grosjean@peak-system.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2021-04-13can: peak_usb: pcan_usb_pro.h: remove double space in indentionMarc Kleine-Budde1-38/+38
This patch replaces the double space indention after the u8 with a single space in pcan_usb_pro.h. Link: https://lore.kernel.org/r/20210406111622.1874957-3-mkl@pengutronix.de Acked-by: Stephane Grosjean <s.grosjean@peak-system.com> Tested-by: Stephane Grosjean <s.grosjean@peak-system.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2021-04-13can: peak_usb: fix checkpatch warningsMarc Kleine-Budde4-4/+5
This patch cleans several checkpatch warnings in the peak_usb driver. Link: https://lore.kernel.org/r/20210406111622.1874957-2-mkl@pengutronix.de Acked-by: Stephane Grosjean <s.grosjean@peak-system.com> Tested-by: Stephane Grosjean <s.grosjean@peak-system.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2021-04-13can: etas_es58x: add support for the ETAS ES58X_FD CAN USB interfacesVincent Mailhol5-4/+828
This patch add support for the ES582.1 and ES584.1 interfaces from ETAS GmbH (https://www.etas.com/en/products/es58x.php). Link: https://lore.kernel.org/r/20210410095948.233305-4-mailhol.vincent@wanadoo.fr Co-developed-by: Arunachalam Santhanam <arunachalam.santhanam@in.bosch.com> Signed-off-by: Arunachalam Santhanam <arunachalam.santhanam@in.bosch.com> Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2021-04-13can: etas_es58x: add support for ETAS ES581.4 CAN USB interfaceVincent Mailhol5-4/+726
This patch adds support for the ES581.4 interface from ETAS GmbH (https://www.etas.com/en/products/es58x.php). Link: https://lore.kernel.org/r/20210410095948.233305-3-mailhol.vincent@wanadoo.fr Co-developed-by: Arunachalam Santhanam <arunachalam.santhanam@in.bosch.com> Signed-off-by: Arunachalam Santhanam <arunachalam.santhanam@in.bosch.com> Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2021-04-13can: etas_es58x: add core support for ETAS ES58X CAN USB interfacesVincent Mailhol5-0/+2988
This patch adds the core support for various USB CAN interfaces from ETAS GmbH (https://www.etas.com/en/products/es58x.php). The next patches add the glue code drivers for the individual interfaces. Link: https://lore.kernel.org/r/20210410095948.233305-2-mailhol.vincent@wanadoo.fr Co-developed-by: Arunachalam Santhanam <arunachalam.santhanam@in.bosch.com> Signed-off-by: Arunachalam Santhanam <arunachalam.santhanam@in.bosch.com> Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2021-04-09Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netJakub Kicinski1-1/+5
Conflicts: MAINTAINERS - keep Chandrasekar drivers/net/ethernet/mellanox/mlx5/core/en_main.c - simple fix + trust the code re-added to param.c in -next is fine include/linux/bpf.h - trivial include/linux/ethtool.h - trivial, fix kdoc while at it include/linux/skmsg.h - move to relevant place in tcp.c, comment re-wrapped net/core/skmsg.c - add the sk = sk // sk = NULL around calls net/tipc/crypto.c - trivial Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2021-04-01drivers: net: fix memory leak in peak_usb_create_devPavel Skripkin1-1/+5
syzbot reported memory leak in peak_usb. The problem was in case of failure after calling ->dev_init()[2] in peak_usb_create_dev()[1]. The data allocated int dev_init() wasn't freed, so simple ->dev_free() call fix this problem. backtrace: [<0000000079d6542a>] kmalloc include/linux/slab.h:552 [inline] [<0000000079d6542a>] kzalloc include/linux/slab.h:682 [inline] [<0000000079d6542a>] pcan_usb_fd_init+0x156/0x210 drivers/net/can/usb/peak_usb/pcan_usb_fd.c:868 [2] [<00000000c09f9057>] peak_usb_create_dev drivers/net/can/usb/peak_usb/pcan_usb_core.c:851 [inline] [1] [<00000000c09f9057>] peak_usb_probe+0x389/0x490 drivers/net/can/usb/peak_usb/pcan_usb_core.c:949 Reported-by: syzbot+91adee8d9ebb9193d22d@syzkaller.appspotmail.com Signed-off-by: Pavel Skripkin <paskripkin@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2021-03-30can: peak_usb: add support of ONE_SHOT modeStephane Grosjean2-5/+15
This patch adds "ONE-SHOT" mode support to the following CAN-USB PEAK-System GmbH interfaces: - PCAN-USB X6 - PCAN-USB FD - PCAN-USB Pro FD - PCAN-Chip USB - PCAN-USB Pro Signed-off-by: Stephane Grosjean <s.grosjean@peak-system.com> [mkl: split into two patches] Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2021-03-30can: peak_usb: add support of ethtool set_phys_id()Stephane Grosjean6-1/+126
This patch makes it possible to specifically flash the LED of a CAN port of the CAN-USB interfaces of PEAK-System. Link: https://lore.kernel.org/r/20210309122141.3276927-1-mkl@pengutronix.de Signed-off-by: Stephane Grosjean <s.grosjean@peak-system.com> [mkl: use common prefix PCAN_ for defines] Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2021-03-30can: peak_usb: pcan_usb_pro_encode_msg(): use macros for flags instead of plain integersStephane Grosjean1-2/+2
This patch replaces the plain integers used for flags in pcan_usb_pro_encode_msg() by macros which are already defined. Link: https://lore.kernel.org/r/20210309082128.23125-4-s.grosjean@peak-system.com Signed-off-by: Stephane Grosjean <s.grosjean@peak-system.com> [mkl: split into two patches] Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2021-03-30can: ucan: fix alignment constraintsArnd Bergmann1-1/+1
struct ucan_message_in contains member with 4-byte alignment but is itself marked as unaligned, which triggers a warning: drivers/net/can/usb/ucan.c:249:1: warning: alignment 1 of 'struct ucan_message_in' is less than 4 [-Wpacked-not-aligned] Mark the outer structure to have the same alignment as the inner one. Link: https://lore.kernel.org/r/20210204162625.3099392-1-arnd@kernel.org Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2021-03-30can: dev: can_free_echo_skb(): extend to return can frame lengthMarc Kleine-Budde8-11/+11
In order to implement byte queue limits (bql) in CAN drivers, the length of the CAN frame needs to be passed into the networking stack even if the transmission failed for some reason. To avoid to calculate this length twice, extend can_free_echo_skb() to return that value. Convert all users of this function, too. This patch is the natural extension of commit: | 9420e1d495e2 ("can: dev: can_get_echo_skb(): extend to return can | frame length") Link: https://lore.kernel.org/r/20210319142700.305648-3-mkl@pengutronix.de Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2021-03-24Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netLinus Torvalds2-1/+4
Pull networking fixes from David Miller: "Various fixes, all over: 1) Fix overflow in ptp_qoriq_adjfine(), from Yangbo Lu. 2) Always store the rx queue mapping in veth, from Maciej Fijalkowski. 3) Don't allow vmlinux btf in map_create, from Alexei Starovoitov. 4) Fix memory leak in octeontx2-af from Colin Ian King. 5) Use kvalloc in bpf x86 JIT for storing jit'd addresses, from Yonghong Song. 6) Fix tx ptp stats in mlx5, from Aya Levin. 7) Check correct ip version in tun decap, fropm Roi Dayan. 8) Fix rate calculation in mlx5 E-Switch code, from arav Pandit. 9) Work item memork leak in mlx5, from Shay Drory. 10) Fix ip6ip6 tunnel crash with bpf, from Daniel Borkmann. 11) Lack of preemptrion awareness in macvlan, from Eric Dumazet. 12) Fix data race in pxa168_eth, from Pavel Andrianov. 13) Range validate stab in red_check_params(), from Eric Dumazet. 14) Inherit vlan filtering setting properly in b53 driver, from Florian Fainelli. 15) Fix rtnl locking in igc driver, from Sasha Neftin. 16) Pause handling fixes in igc driver, from Muhammad Husaini Zulkifli. 17) Missing rtnl locking in e1000_reset_task, from Vitaly Lifshits. 18) Use after free in qlcnic, from Lv Yunlong. 19) fix crash in fritzpci mISDN, from Tong Zhang. 20) Premature rx buffer reuse in igb, from Li RongQing. 21) Missing termination of ip[a driver message handler arrays, from Alex Elder. 22) Fix race between "x25_close" and "x25_xmit"/"x25_rx" in hdlc_x25 driver, from Xie He. 23) Use after free in c_can_pci_remove(), from Tong Zhang. 24) Uninitialized variable use in nl80211, from Jarod Wilson. 25) Off by one size calc in bpf verifier, from Piotr Krysiuk. 26) Use delayed work instead of deferrable for flowtable GC, from Yinjun Zhang. 27) Fix infinite loop in NPC unmap of octeontx2 driver, from Hariprasad Kelam. 28) Fix being unable to change MTU of dwmac-sun8i devices due to lack of fifo sizes, from Corentin Labbe. 29) DMA use after free in r8169 with WoL, fom Heiner Kallweit. 30) Mismatched prototypes in isdn-capi, from Arnd Bergmann. 31) Fix psample UAPI breakage, from Ido Schimmel" * git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (171 commits) psample: Fix user API breakage math: Export mul_u64_u64_div_u64 ch_ktls: fix enum-conversion warning octeontx2-af: Fix memory leak of object buf ptp_qoriq: fix overflow in ptp_qoriq_adjfine() u64 calcalation net: bridge: don't notify switchdev for local FDB addresses net/sched: act_ct: clear post_ct if doing ct_clear net: dsa: don't assign an error value to tag_ops isdn: capi: fix mismatched prototypes net/mlx5: SF, do not use ecpu bit for vhca state processing net/mlx5e: Fix division by 0 in mlx5e_select_queue net/mlx5e: Fix error path for ethtool set-priv-flag net/mlx5e: Offload tuple rewrite for non-CT flows net/mlx5e: Allow to match on MPLS parameters only for MPLS over UDP net/mlx5: Add back multicast stats for uplink representor net: ipconfig: ic_dev can be NULL in ic_close_devs MAINTAINERS: Combine "QLOGIC QLGE 10Gb ETHERNET DRIVER" sections into one docs: networking: Fix a typo r8169: fix DMA being used after buffer free if WoL is enabled net: ipa: fix init header command validation ...