mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexander Lobakin <aleksander.lobakin@intel.com>
To: Wentao Liang <vulab@iscas.ac.cn>
Cc: <Steen.Hegelund@microchip.com>, <daniel.machon@microchip.com>,
	<UNGLinuxDriver@microchip.com>, <andrew+netdev@lunn.ch>,
	<davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
	<pabeni@redhat.com>, <linux-arm-kernel@lists.infradead.org>,
	<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<stable@vger.kernel.org>
Subject: Re: [PATCH v2] net: microchip: sparx5: Fix potential NULL pointer dereference
Date: Wed, 12 Feb 2025 17:21:13 +0100	[thread overview]
Message-ID: <9b9f3b87-60a3-4ba6-aced-6a24ddfd0741@intel.com> (raw)
In-Reply-To: <20250212141829.1214-1-vulab@iscas.ac.cn>

From: Wentao Liang <vulab@iscas.ac.cn>
Date: Wed, 12 Feb 2025 22:18:28 +0800

> Check the return value of vcap_keyfields() in
> vcap_debugfs_show_rule_keyset(). If vcap_keyfields()
> returns NULL, skip the keyfield to prevent a NULL pointer
> dereference when calling vcap_debugfs_show_rule_keyfield().

Do you have a repro for this? Is this possible to trigger a real nullptr
deref here or it's just "let it be"?

> 
> Fixes: 610c32b2ce66 ("net: microchip: vcap: Add vcap_get_rule")
> Cc: stable@vger.kernel.org # 6.2+
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
>  drivers/net/ethernet/microchip/vcap/vcap_api_debugfs.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/net/ethernet/microchip/vcap/vcap_api_debugfs.c b/drivers/net/ethernet/microchip/vcap/vcap_api_debugfs.c
> index 59bfbda29bb3..e9e2f7af9be3 100644
> --- a/drivers/net/ethernet/microchip/vcap/vcap_api_debugfs.c
> +++ b/drivers/net/ethernet/microchip/vcap/vcap_api_debugfs.c
> @@ -202,6 +202,8 @@ static int vcap_debugfs_show_rule_keyset(struct vcap_rule_internal *ri,
>  
>  	list_for_each_entry(ckf, &ri->data.keyfields, ctrl.list) {
>  		keyfield = vcap_keyfields(vctrl, admin->vtype, ri->data.keyset);
> +		if (!keyfield)
> +			continue;
>  		vcap_debugfs_show_rule_keyfield(vctrl, out, ckf->ctrl.key,
>  						keyfield, &ckf->data);
>  	}

Thanks,
Olek

      reply	other threads:[~2025-02-12 16:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-12 14:18 Wentao Liang
2025-02-12 16:21 ` Alexander Lobakin [this message]

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=9b9f3b87-60a3-4ba6-aced-6a24ddfd0741@intel.com \
    --to=aleksander.lobakin@intel.com \
    --cc=Steen.Hegelund@microchip.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=daniel.machon@microchip.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=stable@vger.kernel.org \
    --cc=vulab@iscas.ac.cn \
    /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®