Skip to contentSkip to conversation

can: isotp: restore accidentally removed MSG_PEEK feature

PATCH In review Oliver Hartkopp 2 participants 4 messages Mar 28, 2022 – Mar 31, 2022

Subsystems (2)
lore
Share & tools
lore

Oliver Hartkopp

author maintainer
#0 lore raw

PATCH 1/1 can: isotp: restore accidentally removed MSG_PEEK feature

In commit 42bf50a1795a ("can: isotp: support MSG_TRUNC flag when reading from socket") a new check for recvmsg flags has been introduced that only checked for the flags that are handled in isotp_recvmsg() itself.

This accidentally removed the MSG_PEEK feature flag which is processed later in the call chain in __skb_try_recv_from_queue().

Add MSG_PEEK to the set of valid flags to restore the feature.

Fixes 42bf50a1795a ("can: isotp: support MSG_TRUNC flag when reading from socket")

From: Derek Will <[email protected]>

---
 net/can/isotp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/can/isotp.c +1 -1
index f6f8ba1f816d..bafb0fb5f0e0 100644
@@ -1048,11 +1048,11 @@ static int isotp_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,
 	struct sk_buff *skb;
 	struct isotp_sock *so = isotp_sk(sk);
 	int noblock = flags & MSG_DONTWAIT;
 	int ret = 0;
 
-	if (flags & ~(MSG_DONTWAIT | MSG_TRUNC))
+	if (flags & ~(MSG_DONTWAIT | MSG_TRUNC | MSG_PEEK))
 		return -EINVAL;
 
 	if (!so->bound)
 		return -EADDRNOTAVAIL;
 
Signature · 1 line
2.30.2
#1 lore raw
Quoted 4 lines · Oliver Hartkopp

In commit 42bf50a1795a ("can: isotp: support MSG_TRUNC flag when reading from socket") a new check for recvmsg flags has been introduced that only checked for the flags that are handled in isotp_recvmsg() itself.

Quoted 8 lines

This accidentally removed the MSG_PEEK feature flag which is processed later in the call chain in __skb_try_recv_from_queue().

Add MSG_PEEK to the set of valid flags to restore the feature.

Fixes 42bf50a1795a ("can: isotp: support MSG_TRUNC flag when reading from socket")

From: Derek Will <[email protected]>

If this patch is from Derek Will, we need Derek's Signed-off-by [1] and change to author information accordingly.

[1] https://elixir.bootlin.com/linux/v5.12/source/Documentation/process/submitting-patches.rst#L356

Quoted 2 lines

If Derek replies to this mail with his S-o-b line, I'll fix the author while applying the patch.

regards,
Marc

Signature · 4 lines
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |
author maintainer
#2 lore raw

Hi Marc,

Quoted 17 lines · Marc Kleine-Budde
Quoted 4 lines · Oliver Hartkopp

In commit 42bf50a1795a ("can: isotp: support MSG_TRUNC flag when reading from socket") a new check for recvmsg flags has been introduced that only checked for the flags that are handled in isotp_recvmsg() itself.

Quoted 8 lines

This accidentally removed the MSG_PEEK feature flag which is processed later in the call chain in __skb_try_recv_from_queue().

Add MSG_PEEK to the set of valid flags to restore the feature.

Fixes 42bf50a1795a ("can: isotp: support MSG_TRUNC flag when reading from socket")

From: Derek Will <[email protected]>

If this patch is from Derek Will, we need Derek's Signed-off-by [1] and change to author information accordingly.

Quoted 7 lines

[1] https://elixir.bootlin.com/linux/v5.12/source/Documentation/process/submitting-patches.rst#L356

Quoted 2 lines

If Derek replies to this mail with his S-o-b line, I'll fix the author while applying the patch.

Although I would have liked Derek to show up as author of the patch (because of he found the issue) he has not been reacting for some time now.

Therefore I would suggest to take the authorship (I wrote the commit message anyway) and tag Derek with Reported/Suggested?/Tested-by if you do not want to wait to push the other pending patches to Jakub.

Best regards,
Oliver

#3 lore raw
Quoted 15 lines · Oliver Hartkopp
Quoted 7 lines
Quoted 3 lines
Fixes 42bf50a1795a ("can: isotp: support MSG_TRUNC flag when reading from socket")

From: Derek Will <[email protected]>

If this patch is from Derek Will, we need Derek's Signed-off-by [1] and change to author information accordingly.

Quoted 7 lines

[1] https://elixir.bootlin.com/linux/v5.12/source/Documentation/process/submitting-patches.rst#L356

Quoted 2 lines

If Derek replies to this mail with his S-o-b line, I'll fix the author while applying the patch.

Quoted 7 lines

Although I would have liked Derek to show up as author of the patch (because of he found the issue) he has not been reacting for some time now.

Therefore I would suggest to take the authorship (I wrote the commit message anyway) and tag Derek with Reported/Suggested?/Tested-by if you do not want to wait to push the other pending patches to Jakub.

I've changed it to all 3: Reported/Suggested/Tested-by. :)

| commit e382fea8ae54f5bb62869c6b69b33993d43adeca
| Author: Oliver Hartkopp <[email protected]>
| Date:   Mon Mar 28 13:36:11 2022 +0200
| 
|     can: isotp: restore accidentally removed MSG_PEEK feature
|     
|     In commit 42bf50a1795a ("can: isotp: support MSG_TRUNC flag when
|     reading from socket") a new check for recvmsg flags has been
|     introduced that only checked for the flags that are handled in
|     isotp_recvmsg() itself.
|     
|     This accidentally removed the MSG_PEEK feature flag which is processed
|     later in the call chain in __skb_try_recv_from_queue().
|     
|     Add MSG_PEEK to the set of valid flags to restore the feature.
|     
|     Fixes: 42bf50a1795a ("can: isotp: support MSG_TRUNC flag when reading from socket")
|     Link: https://github.com/linux-can/can-utils/issues/347#issuecomment-1079554254
|     Link: https://lore.kernel.org/all/[email protected]
|     Reported-by: Derek Will <[email protected]>
|     Suggested-by: Derek Will <[email protected]>
|     Tested-by: Derek Will <[email protected]>
|     Signed-off-by: Oliver Hartkopp <[email protected]>
|     Signed-off-by: Marc Kleine-Budde <[email protected]>

Writing a pull request after this mail.

regards,
Marc

Signature · 4 lines
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |