* [PATCH v3] packet: fix second argument of sock_tx_timestamp()
@ 2016-07-19 5:40 Yoshihiro Shimoda
2016-07-19 12:34 ` Soheil Hassas Yeganeh
2016-07-20 4:01 ` David Miller
0 siblings, 2 replies; 4+ messages in thread
From: Yoshihiro Shimoda @ 2016-07-19 5:40 UTC (permalink / raw)
To: davem
Cc: daniel, willemb, ast, tklauser, fruggeri, netdev,
linux-renesas-soc, Yoshihiro Shimoda, stable
This patch fixes an issue that a syscall (e.g. sendto syscall) cannot
work correctly. Since the sendto syscall doesn't have msg_control buffer,
the sock_tx_timestamp() in packet_snd() cannot work correctly because
the socks.tsflags is set to 0.
So, this patch sets the socks.tsflags to sk->sk_tsflags as default.
Fixes: c14ac9451c34 ("sock: enable timestamping using control messages")
Cc: <stable@vger.kernel.org>
Reported-by: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
Reported-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
Changes from v2:
- Fix build error...
Changes from v1:
- Set socks.tsflags to sk->sk_tsflags as default instead of a condition.
- Fix other socks.tsflags values in the af_packet.c.
- Revise the commit log.
About v1 (as RFC):
- http://thread.gmane.org/gmane.linux.kernel.renesas-soc/5646
net/packet/af_packet.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 9f0983f..53e87ce 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -1927,7 +1927,7 @@ retry:
goto out_unlock;
}
- sockc.tsflags = 0;
+ sockc.tsflags = sk->sk_tsflags;
if (msg->msg_controllen) {
err = sock_cmsg_send(sk, msg, &sockc);
if (unlikely(err)) {
@@ -2678,7 +2678,7 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg)
dev = dev_get_by_index(sock_net(&po->sk), saddr->sll_ifindex);
}
- sockc.tsflags = 0;
+ sockc.tsflags = po->sk.sk_tsflags;
if (msg->msg_controllen) {
err = sock_cmsg_send(&po->sk, msg, &sockc);
if (unlikely(err))
@@ -2881,7 +2881,7 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len)
if (unlikely(!(dev->flags & IFF_UP)))
goto out_unlock;
- sockc.tsflags = 0;
+ sockc.tsflags = sk->sk_tsflags;
sockc.mark = sk->sk_mark;
if (msg->msg_controllen) {
err = sock_cmsg_send(sk, msg, &sockc);
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v3] packet: fix second argument of sock_tx_timestamp()
2016-07-19 5:40 [PATCH v3] packet: fix second argument of sock_tx_timestamp() Yoshihiro Shimoda
@ 2016-07-19 12:34 ` Soheil Hassas Yeganeh
2016-07-19 16:31 ` Willem de Bruijn
2016-07-20 4:01 ` David Miller
1 sibling, 1 reply; 4+ messages in thread
From: Soheil Hassas Yeganeh @ 2016-07-19 12:34 UTC (permalink / raw)
To: Yoshihiro Shimoda
Cc: David Miller, daniel, Willem de Bruijn, ast, tklauser, fruggeri,
netdev, linux-renesas-soc, stable
On Tue, Jul 19, 2016 at 1:40 AM, Yoshihiro Shimoda
<yoshihiro.shimoda.uh@renesas.com> wrote:
> This patch fixes an issue that a syscall (e.g. sendto syscall) cannot
> work correctly. Since the sendto syscall doesn't have msg_control buffer,
> the sock_tx_timestamp() in packet_snd() cannot work correctly because
> the socks.tsflags is set to 0.
> So, this patch sets the socks.tsflags to sk->sk_tsflags as default.
>
> Fixes: c14ac9451c34 ("sock: enable timestamping using control messages")
> Cc: <stable@vger.kernel.org>
> Reported-by: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
> Reported-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
> ---
> Changes from v2:
> - Fix build error...
>
> Changes from v1:
> - Set socks.tsflags to sk->sk_tsflags as default instead of a condition.
> - Fix other socks.tsflags values in the af_packet.c.
> - Revise the commit log.
>
> About v1 (as RFC):
> - http://thread.gmane.org/gmane.linux.kernel.renesas-soc/5646
>
> net/packet/af_packet.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
> index 9f0983f..53e87ce 100644
> --- a/net/packet/af_packet.c
> +++ b/net/packet/af_packet.c
> @@ -1927,7 +1927,7 @@ retry:
> goto out_unlock;
> }
>
> - sockc.tsflags = 0;
> + sockc.tsflags = sk->sk_tsflags;
> if (msg->msg_controllen) {
> err = sock_cmsg_send(sk, msg, &sockc);
> if (unlikely(err)) {
> @@ -2678,7 +2678,7 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg)
> dev = dev_get_by_index(sock_net(&po->sk), saddr->sll_ifindex);
> }
>
> - sockc.tsflags = 0;
> + sockc.tsflags = po->sk.sk_tsflags;
> if (msg->msg_controllen) {
> err = sock_cmsg_send(&po->sk, msg, &sockc);
> if (unlikely(err))
> @@ -2881,7 +2881,7 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len)
> if (unlikely(!(dev->flags & IFF_UP)))
> goto out_unlock;
>
> - sockc.tsflags = 0;
> + sockc.tsflags = sk->sk_tsflags;
> sockc.mark = sk->sk_mark;
> if (msg->msg_controllen) {
> err = sock_cmsg_send(sk, msg, &sockc);
> --
> 1.9.1
>
Thanks for the fix.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3] packet: fix second argument of sock_tx_timestamp()
2016-07-19 12:34 ` Soheil Hassas Yeganeh
@ 2016-07-19 16:31 ` Willem de Bruijn
0 siblings, 0 replies; 4+ messages in thread
From: Willem de Bruijn @ 2016-07-19 16:31 UTC (permalink / raw)
To: netdev; +Cc: Yoshihiro Shimoda, Soheil Hassas Yeganeh, David Miller
On Tue, Jul 19, 2016 at 8:34 AM, Soheil Hassas Yeganeh
<soheil@google.com> wrote:
> On Tue, Jul 19, 2016 at 1:40 AM, Yoshihiro Shimoda
> <yoshihiro.shimoda.uh@renesas.com> wrote:
>> This patch fixes an issue that a syscall (e.g. sendto syscall) cannot
>> work correctly. Since the sendto syscall doesn't have msg_control buffer,
>> the sock_tx_timestamp() in packet_snd() cannot work correctly because
>> the socks.tsflags is set to 0.
>> So, this patch sets the socks.tsflags to sk->sk_tsflags as default.
>>
>> Fixes: c14ac9451c34 ("sock: enable timestamping using control messages")
>> Cc: <stable@vger.kernel.org>
>> Reported-by: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
>> Reported-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
>> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
Acked-by: Willem de Bruijn <willemb@google.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3] packet: fix second argument of sock_tx_timestamp()
2016-07-19 5:40 [PATCH v3] packet: fix second argument of sock_tx_timestamp() Yoshihiro Shimoda
2016-07-19 12:34 ` Soheil Hassas Yeganeh
@ 2016-07-20 4:01 ` David Miller
1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2016-07-20 4:01 UTC (permalink / raw)
To: yoshihiro.shimoda.uh
Cc: daniel, willemb, ast, tklauser, fruggeri, netdev,
linux-renesas-soc, stable
From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Date: Tue, 19 Jul 2016 14:40:51 +0900
> This patch fixes an issue that a syscall (e.g. sendto syscall) cannot
> work correctly. Since the sendto syscall doesn't have msg_control buffer,
> the sock_tx_timestamp() in packet_snd() cannot work correctly because
> the socks.tsflags is set to 0.
> So, this patch sets the socks.tsflags to sk->sk_tsflags as default.
>
> Fixes: c14ac9451c34 ("sock: enable timestamping using control messages")
> Cc: <stable@vger.kernel.org>
> Reported-by: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
> Reported-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Applied.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-07-20 4:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-19 5:40 [PATCH v3] packet: fix second argument of sock_tx_timestamp() Yoshihiro Shimoda
2016-07-19 12:34 ` Soheil Hassas Yeganeh
2016-07-19 16:31 ` Willem de Bruijn
2016-07-20 4:01 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.