pull-request: can 2021-06-24

5 messages, 2 authors, 2021-06-24 · open the first message on its own page

pull-request: can 2021-06-24

From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: 2021-06-24 06:42:09

Hello Jakub, hello David,

this is a pull request of 2 patches for net/master.

The first patch is by Norbert Slusarek and prevent allocation of
filter for optlen == 0 in the j1939 CAN protocol.

The last patch is by Stephane Grosjean and fixes a potential
starvation in the TX path of the peak_pciefd driver.

regards,
Marc

---

The following changes since commit c2f5c57d99debf471a1b263cdf227e55f1364e95:

  Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf (2021-06-23 14:12:14 -0700)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can.git tags/linux-can-fixes-for-5.13-20210624

for you to fetch changes up to b17233d385d0b6b43ecf81d43008cb1bbb008166:

  can: peak_pciefd: pucan_handle_status(): fix a potential starvation issue in TX path (2021-06-24 08:40:10 +0200)

----------------------------------------------------------------
linux-can-fixes-for-5.13-20210624

----------------------------------------------------------------
Norbert Slusarek (1):
      can: j1939: j1939_sk_setsockopt(): prevent allocation of j1939 filter for optlen == 0

Stephane Grosjean (1):
      can: peak_pciefd: pucan_handle_status(): fix a potential starvation issue in TX path

 drivers/net/can/peak_canfd/peak_canfd.c | 4 ++--
 net/can/j1939/socket.c                  | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

[net 2/2] can: peak_pciefd: pucan_handle_status(): fix a potential starvation issue in TX path

From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: 2021-06-24 06:42:11

From: Stephane Grosjean <redacted>

Rather than just indicating that transmission can start, this patch
requires the explicit flushing of the network TX queue when the driver
is informed by the device that it can transmit, next to its
configuration.

In this way, if frames have already been written by the application,
they will actually be transmitted.

Fixes: ffd137f7043c ("can: peak/pcie_fd: remove useless code when interface starts")
Link: https://lore.kernel.org/r/20210623142600.149904-1-s.grosjean@peak-system.com
Cc: linux-stable <redacted>
Signed-off-by: Stephane Grosjean <redacted>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/peak_canfd/peak_canfd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/can/peak_canfd/peak_canfd.c b/drivers/net/can/peak_canfd/peak_canfd.c
index 00847cbaf7b6..d08718e98e11 100644
--- a/drivers/net/can/peak_canfd/peak_canfd.c
+++ b/drivers/net/can/peak_canfd/peak_canfd.c
@@ -351,8 +351,8 @@ static int pucan_handle_status(struct peak_canfd_priv *priv,
 				return err;
 		}
 
-		/* start network queue (echo_skb array is empty) */
-		netif_start_queue(ndev);
+		/* wake network queue up (echo_skb array is empty) */
+		netif_wake_queue(ndev);
 
 		return 0;
 	}
-- 
2.30.2

[net 1/2] can: j1939: j1939_sk_setsockopt(): prevent allocation of j1939 filter for optlen == 0

From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: 2021-06-24 06:42:11

From: Norbert Slusarek <redacted>

If optval != NULL and optlen == 0 are specified for SO_J1939_FILTER in
j1939_sk_setsockopt(), memdup_sockptr() will return ZERO_PTR for 0
size allocation. The new filter will be mistakenly assigned ZERO_PTR.
This patch checks for optlen != 0 and filter will be assigned NULL in
case of optlen == 0.

Fixes: 9d71dd0c7009 ("can: add support of SAE J1939 protocol")
Link: https://lore.kernel.org/r/20210620123842.117975-1-nslusarek@gmx.net
Signed-off-by: Norbert Slusarek <redacted>
Acked-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 net/can/j1939/socket.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/can/j1939/socket.c b/net/can/j1939/socket.c
index fce8bc8afeb7..e1a399821238 100644
--- a/net/can/j1939/socket.c
+++ b/net/can/j1939/socket.c
@@ -676,7 +676,7 @@ static int j1939_sk_setsockopt(struct socket *sock, int level, int optname,
 
 	switch (optname) {
 	case SO_J1939_FILTER:
-		if (!sockptr_is_null(optval)) {
+		if (!sockptr_is_null(optval) && optlen != 0) {
 			struct j1939_filter *f;
 			int c;
 
base-commit: c2f5c57d99debf471a1b263cdf227e55f1364e95
-- 
2.30.2

Re: pull-request: can 2021-06-24

From: patchwork-bot+netdevbpf@kernel.org
Date: 2021-06-24 18:30:13

Hello:

This pull request was applied to netdev/net.git (refs/heads/master):

On Thu, 24 Jun 2021 08:41:58 +0200 you wrote:
Hello Jakub, hello David,

this is a pull request of 2 patches for net/master.

The first patch is by Norbert Slusarek and prevent allocation of
filter for optlen == 0 in the j1939 CAN protocol.

[...]
Here is the summary with links:
  - pull-request: can 2021-06-24
    https://git.kernel.org/netdev/net/c/abe90454f075

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html

Re: [net 1/2] can: j1939: j1939_sk_setsockopt(): prevent allocation of j1939 filter for optlen == 0

From: patchwork-bot+netdevbpf@kernel.org
Date: 2021-06-24 18:30:13

Hello:

This series was applied to netdev/net.git (refs/heads/master):

On Thu, 24 Jun 2021 08:41:59 +0200 you wrote:
From: Norbert Slusarek <redacted>

If optval != NULL and optlen == 0 are specified for SO_J1939_FILTER in
j1939_sk_setsockopt(), memdup_sockptr() will return ZERO_PTR for 0
size allocation. The new filter will be mistakenly assigned ZERO_PTR.
This patch checks for optlen != 0 and filter will be assigned NULL in
case of optlen == 0.

[...]
Here is the summary with links:
  - [net,1/2] can: j1939: j1939_sk_setsockopt(): prevent allocation of j1939 filter for optlen == 0
    https://git.kernel.org/netdev/net/c/aaf473d0100f
  - [net,2/2] can: peak_pciefd: pucan_handle_status(): fix a potential starvation issue in TX path
    https://git.kernel.org/netdev/net/c/b17233d385d0

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help