mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 20:22:09 +00:00
linux-can-fixes-for-5.14-20210724
-----BEGIN PGP SIGNATURE----- iQFHBAABCgAxFiEEK3kIWJt9yTYMP3ehqclaivrt76kFAmD8R64THG1rbEBwZW5n dXRyb25peC5kZQAKCRCpyVqK+u3vqe1AB/98IN2SRTPZNaCAapbnvo9gwkVC1u6d c8xPRdiBycqn1ATdlvbg8SUCXMm3MkC8Wgz7PcVM8rHtaXsYuO7hDQo7Q8NaF9Zu DU09/i68SG4hKD/USWpfRSvlEyj5Md5FsVB2jO3gWZXlk6rx2hXv/h8xQyrdnSV7 UmwjofOsieViG17NbHAPhKwCBmLlTZWOK1WupLWOKK2A056vgVaQ6BndIwG+qPSl 4gsQprC2+mPdHgIs5t7mQOwIyNaUxCcFTSxEoCG0vIPMBB/hogLN77biYlkBJ+t1 3/vBuBeIpoxx++9vL1BNQnrXp98DGuxkQOe0SpSKLH7h3dNVa+NKUCN4 =3C9h -----END PGP SIGNATURE----- Merge tag 'linux-can-fixes-for-5.14-20210724' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can linux-can-fixes-for-5.14-20210724 Marc Kleine-Budde says: ==================== pull-request: can 2021-07-24 this is a pull request of 6 patches for net/master. The first patch is by Joakim Zhang targets the imx8mp device tree. It removes the imx6 fallback from the flexcan binding, as the imx6 is not compatible with the imx8mp. Ziyang Xuan contributes a patch to fix a use-after-free in the CAN raw's raw_setsockopt(). The next two patches target the CAN J1939 protocol. The first one is by Oleksij Rempel and clarifies the lifetime of session object in j1939_session_deactivate(). Zhang Changzhong's patch fixes the timeout value between consecutive TP.DT. Stephane Grosjean contributes a patch for the peak_usb driver to fix reading of the rxerr/txerr values. The last patch is by me for the mcp251xfd driver. It stops the timestamp worker in case of a fatal error in the IRQ handler. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
e394f1e3b1
@ -579,7 +579,7 @@
|
||||
};
|
||||
|
||||
flexcan1: can@308c0000 {
|
||||
compatible = "fsl,imx8mp-flexcan", "fsl,imx6q-flexcan";
|
||||
compatible = "fsl,imx8mp-flexcan";
|
||||
reg = <0x308c0000 0x10000>;
|
||||
interrupts = <GIC_SPI 142 IRQ_TYPE_LEVEL_HIGH>;
|
||||
clocks = <&clk IMX8MP_CLK_IPG_ROOT>,
|
||||
@ -594,7 +594,7 @@
|
||||
};
|
||||
|
||||
flexcan2: can@308d0000 {
|
||||
compatible = "fsl,imx8mp-flexcan", "fsl,imx6q-flexcan";
|
||||
compatible = "fsl,imx8mp-flexcan";
|
||||
reg = <0x308d0000 0x10000>;
|
||||
interrupts = <GIC_SPI 144 IRQ_TYPE_LEVEL_HIGH>;
|
||||
clocks = <&clk IMX8MP_CLK_IPG_ROOT>,
|
||||
|
@ -2300,6 +2300,7 @@ static irqreturn_t mcp251xfd_irq(int irq, void *dev_id)
|
||||
err, priv->regs_status.intf);
|
||||
mcp251xfd_dump(priv);
|
||||
mcp251xfd_chip_interrupts_disable(priv);
|
||||
mcp251xfd_timestamp_stop(priv);
|
||||
|
||||
return handled;
|
||||
}
|
||||
|
@ -117,7 +117,8 @@
|
||||
#define PCAN_USB_BERR_MASK (PCAN_USB_ERR_RXERR | PCAN_USB_ERR_TXERR)
|
||||
|
||||
/* identify bus event packets with rx/tx error counters */
|
||||
#define PCAN_USB_ERR_CNT 0x80
|
||||
#define PCAN_USB_ERR_CNT_DEC 0x00 /* counters are decreasing */
|
||||
#define PCAN_USB_ERR_CNT_INC 0x80 /* counters are increasing */
|
||||
|
||||
/* private to PCAN-USB adapter */
|
||||
struct pcan_usb {
|
||||
@ -608,11 +609,12 @@ static int pcan_usb_handle_bus_evt(struct pcan_usb_msg_context *mc, u8 ir)
|
||||
|
||||
/* acccording to the content of the packet */
|
||||
switch (ir) {
|
||||
case PCAN_USB_ERR_CNT:
|
||||
case PCAN_USB_ERR_CNT_DEC:
|
||||
case PCAN_USB_ERR_CNT_INC:
|
||||
|
||||
/* save rx/tx error counters from in the device context */
|
||||
pdev->bec.rxerr = mc->ptr[0];
|
||||
pdev->bec.txerr = mc->ptr[1];
|
||||
pdev->bec.rxerr = mc->ptr[1];
|
||||
pdev->bec.txerr = mc->ptr[2];
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1075,11 +1075,16 @@ static bool j1939_session_deactivate_locked(struct j1939_session *session)
|
||||
|
||||
static bool j1939_session_deactivate(struct j1939_session *session)
|
||||
{
|
||||
struct j1939_priv *priv = session->priv;
|
||||
bool active;
|
||||
|
||||
j1939_session_list_lock(session->priv);
|
||||
j1939_session_list_lock(priv);
|
||||
/* This function should be called with a session ref-count of at
|
||||
* least 2.
|
||||
*/
|
||||
WARN_ON_ONCE(kref_read(&session->kref) < 2);
|
||||
active = j1939_session_deactivate_locked(session);
|
||||
j1939_session_list_unlock(session->priv);
|
||||
j1939_session_list_unlock(priv);
|
||||
|
||||
return active;
|
||||
}
|
||||
@ -1869,7 +1874,7 @@ static void j1939_xtp_rx_dat_one(struct j1939_session *session,
|
||||
if (!session->transmission)
|
||||
j1939_tp_schedule_txtimer(session, 0);
|
||||
} else {
|
||||
j1939_tp_set_rxtimeout(session, 250);
|
||||
j1939_tp_set_rxtimeout(session, 750);
|
||||
}
|
||||
session->last_cmd = 0xff;
|
||||
consume_skb(se_skb);
|
||||
|
@ -546,10 +546,18 @@ static int raw_setsockopt(struct socket *sock, int level, int optname,
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
rtnl_lock();
|
||||
lock_sock(sk);
|
||||
|
||||
if (ro->bound && ro->ifindex)
|
||||
if (ro->bound && ro->ifindex) {
|
||||
dev = dev_get_by_index(sock_net(sk), ro->ifindex);
|
||||
if (!dev) {
|
||||
if (count > 1)
|
||||
kfree(filter);
|
||||
err = -ENODEV;
|
||||
goto out_fil;
|
||||
}
|
||||
}
|
||||
|
||||
if (ro->bound) {
|
||||
/* (try to) register the new filters */
|
||||
@ -588,6 +596,7 @@ static int raw_setsockopt(struct socket *sock, int level, int optname,
|
||||
dev_put(dev);
|
||||
|
||||
release_sock(sk);
|
||||
rtnl_unlock();
|
||||
|
||||
break;
|
||||
|
||||
@ -600,10 +609,16 @@ static int raw_setsockopt(struct socket *sock, int level, int optname,
|
||||
|
||||
err_mask &= CAN_ERR_MASK;
|
||||
|
||||
rtnl_lock();
|
||||
lock_sock(sk);
|
||||
|
||||
if (ro->bound && ro->ifindex)
|
||||
if (ro->bound && ro->ifindex) {
|
||||
dev = dev_get_by_index(sock_net(sk), ro->ifindex);
|
||||
if (!dev) {
|
||||
err = -ENODEV;
|
||||
goto out_err;
|
||||
}
|
||||
}
|
||||
|
||||
/* remove current error mask */
|
||||
if (ro->bound) {
|
||||
@ -627,6 +642,7 @@ static int raw_setsockopt(struct socket *sock, int level, int optname,
|
||||
dev_put(dev);
|
||||
|
||||
release_sock(sk);
|
||||
rtnl_unlock();
|
||||
|
||||
break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user