From: Jijie Shao <shaojijie@huawei.com>
To: Simon Horman <horms@kernel.org>
Cc: <shaojijie@huawei.com>, <davem@davemloft.net>,
<edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>,
<andrew+netdev@lunn.ch>, <shenjian15@huawei.com>,
<liuyonglong@huawei.com>, <chenhao418@huawei.com>,
<jonathan.cameron@huawei.com>,
<shameerali.kolothum.thodi@huawei.com>, <salil.mehta@huawei.com>,
<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net 2/3] net: hibmcge: fix the division by zero issue
Date: Fri, 1 Aug 2025 18:46:16 +0800 [thread overview]
Message-ID: <3bf4236a-2f68-4c09-a9bc-9534111854f2@huawei.com> (raw)
In-Reply-To: <20250801101154.GK8494@horms.kernel.org>
on 2025/8/1 18:11, Simon Horman wrote:
> On Thu, Jul 31, 2025 at 09:47:48PM +0800, Jijie Shao wrote:
>> When the network port is down, the queue is released, and ring->len is 0.
>> In debugfs, hbg_get_queue_used_num() will be called,
>> which may lead to a division by zero issue.
>>
>> This patch adds a check, if ring->len is 0,
>> hbg_get_queue_used_num() directly returns 0.
>>
>> Fixes: 40735e7543f9 ("net: hibmcge: Implement .ndo_start_xmit function")
>> Signed-off-by: Jijie Shao <shaojijie@huawei.com>
> Thanks,
>
> Thinking aloud:
>
> I see that hbg_get_queue_used_num() can be called for both RX and TX
> rings via the debugfs code hbg_dbg_ring(). And that hbg_net_stop()
> clears the RX and TX ring configuration using hbg_txrx_uninit().
Yes, yes.
> So I agree that when the port is down ring-len will be 0.
>
> Reviewed-by: Simon Horman <horms@kernel.org>
>
>
next prev parent reply other threads:[~2025-08-01 10:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-31 13:47 [PATCH net 0/3] There are some bugfix for hibmcge ethernet driver Jijie Shao
2025-07-31 13:47 ` [PATCH net 1/3] net: hibmcge: fix rtnl deadlock issue Jijie Shao
2025-08-01 10:05 ` Simon Horman
2025-08-01 10:44 ` Jijie Shao
2025-08-01 11:05 ` Simon Horman
2025-07-31 13:47 ` [PATCH net 2/3] net: hibmcge: fix the division by zero issue Jijie Shao
2025-08-01 10:11 ` Simon Horman
2025-08-01 10:46 ` Jijie Shao [this message]
2025-07-31 13:47 ` [PATCH net 3/3] net: hibmcge: fix the np_link_fai error reporting issue Jijie Shao
2025-08-01 10:20 ` Simon Horman
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=3bf4236a-2f68-4c09-a9bc-9534111854f2@huawei.com \
--to=shaojijie@huawei.com \
--cc=andrew+netdev@lunn.ch \
--cc=chenhao418@huawei.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=jonathan.cameron@huawei.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liuyonglong@huawei.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=salil.mehta@huawei.com \
--cc=shameerali.kolothum.thodi@huawei.com \
--cc=shenjian15@huawei.com \
/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
all inboxes | Powered by JetHome®