From: Jacob Keller <jacob.e.keller@intel.com>
To: "Alexey V. Vissarionov" <gremlin@altlinux.org>,
Andrew Lunn <andrew+netdev@lunn.ch>
Cc: "David S. Miller" <davem@davemloft.net>,
Derek Chickles <derek.chickles@cavium.com>,
"Dr. David Alan Gilbert" <linux@treblig.org>,
Eric Dumazet <edumazet@google.com>,
Felix Manlunas <felix.manlunas@cavium.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
<netdev@vger.kernel.org>, <lvc-project@linuxtesting.org>
Subject: Re: [PATCH net] liquidio: check other_oct before dereferencing
Date: Wed, 30 Apr 2025 13:46:54 -0700 [thread overview]
Message-ID: <9bd2332c-72fc-4d75-b498-87f4662824d4@intel.com> (raw)
In-Reply-To: <20250429210000.GB1820@altlinux.org>
On 4/29/2025 2:00 PM, Alexey V. Vissarionov wrote:
> get_other_octeon_device() may return NULL; avoid dereferencing the
> other_oct pointer in that case.
>
> Found by ALT Linux Team (altlinux.org) and Linux Verification Center
> (linuxtesting.org).
>
> Fixes: bb54be589c7a ("liquidio: fix Octeon core watchdog timeout false alarm")
> Signed-off-by: Alexey V. Vissarionov <gremlin@altlinux.org>
> ---
> drivers/net/ethernet/cavium/liquidio/lio_main.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/ethernet/cavium/liquidio/lio_main.c b/drivers/net/ethernet/cavium/liquidio/lio_main.c
> index 1d79f6eaa41f6cbf..7b255126289b9fcd 100644
> --- a/drivers/net/ethernet/cavium/liquidio/lio_main.c
> +++ b/drivers/net/ethernet/cavium/liquidio/lio_main.c
> @@ -796,10 +796,11 @@ static int liquidio_watchdog(void *param)
>
> #ifdef CONFIG_MODULE_UNLOAD
> vfs_mask1 = READ_ONCE(oct->sriov_info.vf_drv_loaded_mask);
> - vfs_mask2 = READ_ONCE(other_oct->sriov_info.vf_drv_loaded_mask);
> -
> - vfs_referencing_pf = hweight64(vfs_mask1);
> - vfs_referencing_pf += hweight64(vfs_mask2);
> + vfs_referencing_pf = hweight64(vfs_mask1);
> + if (other_oct) {
> + vfs_mask2 = READ_ONCE(other_oct->sriov_info.vf_drv_loaded_mask);
> + vfs_referencing_pf += hweight64(vfs_mask2);
> + }
Obviously crashing when other_oct is NULL is bad..
But is it ok to proceed when it is NULL? Is leaving out the counts ok? I
guess I don't really understand what other_oct actually represents here.
next prev parent reply other threads:[~2025-04-30 20:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-29 21:00 [PATCH net] liquidio: check other_oct before dereferencing Alexey V. Vissarionov
2025-04-30 20:46 ` Jacob Keller [this message]
2025-05-05 3:00 ` Alexey V. Vissarionov
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=9bd2332c-72fc-4d75-b498-87f4662824d4@intel.com \
--to=jacob.e.keller@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=derek.chickles@cavium.com \
--cc=edumazet@google.com \
--cc=felix.manlunas@cavium.com \
--cc=gremlin@altlinux.org \
--cc=kuba@kernel.org \
--cc=linux@treblig.org \
--cc=lvc-project@linuxtesting.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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;
as well as URLs for NNTP newsgroup(s).