From: Simon Horman <horms@kernel.org>
To: Joshua Hay <joshua.a.hay@intel.com>
Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org
Subject: Re: [Intel-wired-lan] [PATCH iwl-next v9 01/10] idpf: introduce local idpf structure to store virtchnl queue chunks
Date: Sat, 8 Nov 2025 17:20:15 +0000 [thread overview]
Message-ID: <aQ97z8ZZToGIxb3X@horms.kernel.org> (raw)
In-Reply-To: <20251021233056.1320108-2-joshua.a.hay@intel.com>
On Tue, Oct 21, 2025 at 04:30:47PM -0700, Joshua Hay wrote:
...
> diff --git a/drivers/net/ethernet/intel/idpf/idpf_lib.c b/drivers/net/ethernet/intel/idpf/idpf_lib.c
...
> @@ -1237,6 +1242,8 @@ static struct idpf_vport *idpf_vport_alloc(struct idpf_adapter *adapter,
>
> return vport;
>
> +free_qreg_chunks:
> + kfree(adapter->vport_config[idx]->qid_reg_info.queue_chunks);
I think that the following is also needed here, to avoid a subsequent
double-free.
adapter->vport_config[idx]->qid_reg_info.queue_chunks = NULL;
> free_vector_idxs:
> kfree(vport->q_vector_idxs);
> free_vport:
...
> @@ -3658,6 +3668,11 @@ void idpf_vport_init(struct idpf_vport *vport, struct idpf_vport_max_q *max_q)
> rss_data = &vport_config->user_config.rss_data;
> vport_msg = adapter->vport_params_recvd[idx];
>
> + err = idpf_vport_init_queue_reg_chunks(vport_config,
> + &vport_msg->chunks);
> + if (err)
> + return err;
> +
> vport_config->max_q.max_txq = max_q->max_txq;
> vport_config->max_q.max_rxq = max_q->max_rxq;
> vport_config->max_q.max_complq = max_q->max_complq;
> @@ -3690,15 +3705,17 @@ void idpf_vport_init(struct idpf_vport *vport, struct idpf_vport_max_q *max_q)
>
> if (!(vport_msg->vport_flags &
> cpu_to_le16(VIRTCHNL2_VPORT_UPLINK_PORT)))
> - return;
> + return 0;
>
> err = idpf_ptp_get_vport_tstamps_caps(vport);
> if (err) {
> pci_dbg(vport->adapter->pdev, "Tx timestamping not supported\n");
> - return;
> + return err == -EOPNOTSUPP ? 0 : err;
If a non-zero value is returned here, then
the allocation (of adapter->vport_config[idx]->qid_reg_info.queue_chunks)
made in idpf_vport_init_queue_reg_chunks() will be leaked.
I think it should be both freed and set to NULL in this error path.
Which I think suggests a helper to do so here and elsewhere.
Flagged by Claude Code with https://github.com/masoncl/review-prompts/
> }
>
> INIT_WORK(&vport->tstamp_task, idpf_tstamp_task);
> +
> + return 0;
> }
...
WARNING: multiple messages have this Message-ID (diff)
From: Simon Horman <horms@kernel.org>
To: Joshua Hay <joshua.a.hay@intel.com>
Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org
Subject: Re: [Intel-wired-lan][PATCH iwl-next v9 01/10] idpf: introduce local idpf structure to store virtchnl queue chunks
Date: Sat, 8 Nov 2025 17:20:15 +0000 [thread overview]
Message-ID: <aQ97z8ZZToGIxb3X@horms.kernel.org> (raw)
In-Reply-To: <20251021233056.1320108-2-joshua.a.hay@intel.com>
On Tue, Oct 21, 2025 at 04:30:47PM -0700, Joshua Hay wrote:
...
> diff --git a/drivers/net/ethernet/intel/idpf/idpf_lib.c b/drivers/net/ethernet/intel/idpf/idpf_lib.c
...
> @@ -1237,6 +1242,8 @@ static struct idpf_vport *idpf_vport_alloc(struct idpf_adapter *adapter,
>
> return vport;
>
> +free_qreg_chunks:
> + kfree(adapter->vport_config[idx]->qid_reg_info.queue_chunks);
I think that the following is also needed here, to avoid a subsequent
double-free.
adapter->vport_config[idx]->qid_reg_info.queue_chunks = NULL;
> free_vector_idxs:
> kfree(vport->q_vector_idxs);
> free_vport:
...
> @@ -3658,6 +3668,11 @@ void idpf_vport_init(struct idpf_vport *vport, struct idpf_vport_max_q *max_q)
> rss_data = &vport_config->user_config.rss_data;
> vport_msg = adapter->vport_params_recvd[idx];
>
> + err = idpf_vport_init_queue_reg_chunks(vport_config,
> + &vport_msg->chunks);
> + if (err)
> + return err;
> +
> vport_config->max_q.max_txq = max_q->max_txq;
> vport_config->max_q.max_rxq = max_q->max_rxq;
> vport_config->max_q.max_complq = max_q->max_complq;
> @@ -3690,15 +3705,17 @@ void idpf_vport_init(struct idpf_vport *vport, struct idpf_vport_max_q *max_q)
>
> if (!(vport_msg->vport_flags &
> cpu_to_le16(VIRTCHNL2_VPORT_UPLINK_PORT)))
> - return;
> + return 0;
>
> err = idpf_ptp_get_vport_tstamps_caps(vport);
> if (err) {
> pci_dbg(vport->adapter->pdev, "Tx timestamping not supported\n");
> - return;
> + return err == -EOPNOTSUPP ? 0 : err;
If a non-zero value is returned here, then
the allocation (of adapter->vport_config[idx]->qid_reg_info.queue_chunks)
made in idpf_vport_init_queue_reg_chunks() will be leaked.
I think it should be both freed and set to NULL in this error path.
Which I think suggests a helper to do so here and elsewhere.
Flagged by Claude Code with https://github.com/masoncl/review-prompts/
> }
>
> INIT_WORK(&vport->tstamp_task, idpf_tstamp_task);
> +
> + return 0;
> }
...
next prev parent reply other threads:[~2025-11-08 17:20 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-21 23:30 [Intel-wired-lan] [PATCH iwl-next v9 00/10] refactor IDPF resource Joshua Hay
2025-10-21 23:30 ` [Intel-wired-lan][PATCH " Joshua Hay
2025-10-21 23:30 ` [Intel-wired-lan] [PATCH iwl-next v9 01/10] idpf: introduce local idpf structure to store virtchnl queue chunks Joshua Hay
2025-10-21 23:30 ` [Intel-wired-lan][PATCH " Joshua Hay
2025-11-03 15:27 ` [Intel-wired-lan] [PATCH " Salin, Samuel
2025-11-03 15:27 ` Salin, Samuel
2025-11-08 17:20 ` Simon Horman [this message]
2025-11-08 17:20 ` [Intel-wired-lan][PATCH " Simon Horman
2025-11-12 18:49 ` [Intel-wired-lan] [PATCH " Hay, Joshua A
2025-11-12 18:49 ` [Intel-wired-lan][PATCH " Hay, Joshua A
2025-10-21 23:30 ` [Intel-wired-lan] [PATCH iwl-next v9 02/10] idpf: introduce idpf_q_vec_rsrc struct and move vector resources to it Joshua Hay
2025-10-21 23:30 ` [Intel-wired-lan][PATCH " Joshua Hay
2025-11-03 15:27 ` [Intel-wired-lan] [PATCH " Salin, Samuel
2025-11-03 15:27 ` Salin, Samuel
2025-10-21 23:30 ` [Intel-wired-lan] [PATCH iwl-next v9 03/10] idpf: move queue resources to idpf_q_vec_rsrc structure Joshua Hay
2025-10-21 23:30 ` [Intel-wired-lan][PATCH " Joshua Hay
2025-11-03 15:27 ` [Intel-wired-lan] [PATCH " Salin, Samuel
2025-11-03 15:27 ` Salin, Samuel
2025-10-21 23:30 ` [Intel-wired-lan] [PATCH iwl-next v9 04/10] idpf: move some iterator declarations inside for loops Joshua Hay
2025-10-21 23:30 ` [Intel-wired-lan][PATCH " Joshua Hay
2025-10-22 6:42 ` [Intel-wired-lan] [PATCH " Loktionov, Aleksandr
2025-10-22 6:42 ` Loktionov, Aleksandr
2025-11-03 15:27 ` Salin, Samuel
2025-11-03 15:27 ` Salin, Samuel
2025-10-21 23:30 ` [Intel-wired-lan] [PATCH iwl-next v9 05/10] idpf: reshuffle idpf_vport struct members to avoid holes Joshua Hay
2025-10-21 23:30 ` [Intel-wired-lan][PATCH " Joshua Hay
2025-11-03 15:28 ` [Intel-wired-lan] [PATCH " Salin, Samuel
2025-11-03 15:28 ` Salin, Samuel
2025-10-21 23:30 ` [Intel-wired-lan] [PATCH iwl-next v9 06/10] idpf: add rss_data field to RSS function parameters Joshua Hay
2025-10-21 23:30 ` [Intel-wired-lan][PATCH " Joshua Hay
2025-10-22 6:43 ` [Intel-wired-lan] [PATCH " Loktionov, Aleksandr
2025-10-22 6:43 ` Loktionov, Aleksandr
2025-11-03 15:28 ` Salin, Samuel
2025-11-03 15:28 ` Salin, Samuel
2025-10-21 23:30 ` [Intel-wired-lan] [PATCH iwl-next v9 07/10] idpf: remove vport pointer from queue sets Joshua Hay
2025-10-21 23:30 ` [Intel-wired-lan][PATCH " Joshua Hay
2025-11-03 15:28 ` [Intel-wired-lan] [PATCH " Salin, Samuel
2025-11-03 15:28 ` Salin, Samuel
2025-10-21 23:30 ` [Intel-wired-lan] [PATCH iwl-next v9 08/10] idpf: generalize send virtchnl message API Joshua Hay
2025-10-21 23:30 ` [Intel-wired-lan][PATCH " Joshua Hay
2025-11-03 15:28 ` [Intel-wired-lan] [PATCH " Salin, Samuel
2025-11-03 15:28 ` Salin, Samuel
2025-10-21 23:30 ` [Intel-wired-lan] [PATCH iwl-next v9 09/10] idpf: avoid calling get_rx_ptypes for each vport Joshua Hay
2025-10-21 23:30 ` [Intel-wired-lan][PATCH " Joshua Hay
2025-11-03 15:28 ` [Intel-wired-lan] [PATCH " Salin, Samuel
2025-11-03 15:28 ` Salin, Samuel
2025-10-21 23:30 ` [Intel-wired-lan] [PATCH iwl-next v9 10/10] idpf: generalize mailbox API Joshua Hay
2025-10-21 23:30 ` [Intel-wired-lan][PATCH " Joshua Hay
2025-10-22 6:43 ` [Intel-wired-lan] [PATCH " Loktionov, Aleksandr
2025-10-22 6:43 ` Loktionov, Aleksandr
2025-11-03 15:28 ` Salin, Samuel
2025-11-03 15:28 ` Salin, Samuel
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=aQ97z8ZZToGIxb3X@horms.kernel.org \
--to=horms@kernel.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=joshua.a.hay@intel.com \
--cc=netdev@vger.kernel.org \
/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 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.