From: Francois Romieu <romieu@fr.zoreil.com>
To: netdev@vger.kernel.org
Cc: edumazet@google.com, davem@davemloft.net, kuba@kernel.org,
pabeni@redhat.com, f6bvp@free.fr, thomas@osterried.de,
thomas@x-berg.in-berlin.de, linux-hams@vger.kernel.org
Subject: [PATCH v1 net 1/1] net: avoid overflow when rose /proc displays timer information.
Date: Tue, 2 Aug 2022 17:07:42 +0200 [thread overview]
Message-ID: <Yuk9vq7t7VhmnOXu@electric-eye.fr.zoreil.com> (raw)
rose /proc code does not serialize timer accesses.
Initial report by Bernard F6BVP Pidoux exhibits overflow amounting
to 116 ticks on its HZ=250 system.
Full timer access serialization would imho be overkill as rose /proc
does not enforce consistency between displayed ROSE_STATE_XYZ and
timer values during changes of state.
The patch may also fix similar behavior in ax25 /proc, ax25 ioctl
and netrom /proc as they all exhibit the same timer serialization
policy. This point has not been reported though.
The sole remaining use of ax25_display_timer - ax25 rtt valuation -
may also perform marginally better but I have not analyzed it too
deeply.
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Cc: Thomas DL9SAU Osterried <thomas@osterried.de>
Link: https://lore.kernel.org/all/d5e93cc7-a91f-13d3-49a1-b50c11f0f811@free.fr/
---
net/ax25/ax25_timer.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
Bernard, can you formally test and add your "Tested-by:" on this one ?
diff --git a/net/ax25/ax25_timer.c b/net/ax25/ax25_timer.c
index 85865ebfdfa2..9f7cb0a7c73f 100644
--- a/net/ax25/ax25_timer.c
+++ b/net/ax25/ax25_timer.c
@@ -108,10 +108,12 @@ int ax25_t1timer_running(ax25_cb *ax25)
unsigned long ax25_display_timer(struct timer_list *timer)
{
+ long delta = timer->expires - jiffies;
+
if (!timer_pending(timer))
return 0;
- return timer->expires - jiffies;
+ return max(0L, delta);
}
EXPORT_SYMBOL(ax25_display_timer);
--
2.37.1
next reply other threads:[~2022-08-02 15:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-02 15:07 Francois Romieu [this message]
2022-08-02 16:57 ` [PATCH v1 net 1/1] net: avoid overflow when rose /proc displays timer information Bernard f6bvp
2022-08-06 2:10 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Yuk9vq7t7VhmnOXu@electric-eye.fr.zoreil.com \
--to=romieu@fr.zoreil.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=f6bvp@free.fr \
--cc=kuba@kernel.org \
--cc=linux-hams@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=thomas@osterried.de \
--cc=thomas@x-berg.in-berlin.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).