* [PATCH iwl-net 2/3] idpf: fix memleak in vport interrupt configuration [not found] <20240724134024.2182959-1-aleksander.lobakin@intel.com> @ 2024-07-24 13:40 ` Alexander Lobakin 2024-07-26 16:16 ` Simon Horman 0 siblings, 1 reply; 3+ messages in thread From: Alexander Lobakin @ 2024-07-24 13:40 UTC (permalink / raw) To: intel-wired-lan Cc: Alexander Lobakin, Tony Nguyen, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, nex.sw.ncis.osdt.itp.upstreaming, netdev, linux-kernel, Michal Kubiak, stable, Pavan Kumar Linga From: Michal Kubiak <michal.kubiak@intel.com> The initialization of vport interrupt consists of two functions: 1) idpf_vport_intr_init() where a generic configuration is done 2) idpf_vport_intr_req_irq() where the irq for each q_vector is requested. The first function used to create a base name for each interrupt using "kasprintf()" call. Unfortunately, although that call allocated memory for a text buffer, that memory was never released. Fix this by removing creating the interrupt base name in 1). Instead, always create a full interrupt name in the function 2), because there is no need to create a base name separately, considering that the function 2) is never called out of idpf_vport_intr_init() context. Fixes: d4d558718266 ("idpf: initialize interrupts and enable vport") Cc: stable@vger.kernel.org # 6.7 Signed-off-by: Michal Kubiak <michal.kubiak@intel.com> Reviewed-by: Pavan Kumar Linga <pavan.kumar.linga@intel.com> Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com> --- drivers/net/ethernet/intel/idpf/idpf_txrx.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/intel/idpf/idpf_txrx.c b/drivers/net/ethernet/intel/idpf/idpf_txrx.c index af2879f03b8d..a2f9f252694a 100644 --- a/drivers/net/ethernet/intel/idpf/idpf_txrx.c +++ b/drivers/net/ethernet/intel/idpf/idpf_txrx.c @@ -3780,13 +3780,15 @@ void idpf_vport_intr_update_itr_ena_irq(struct idpf_q_vector *q_vector) /** * idpf_vport_intr_req_irq - get MSI-X vectors from the OS for the vport * @vport: main vport structure - * @basename: name for the vector */ -static int idpf_vport_intr_req_irq(struct idpf_vport *vport, char *basename) +static int idpf_vport_intr_req_irq(struct idpf_vport *vport) { struct idpf_adapter *adapter = vport->adapter; + const char *drv_name, *if_name, *vec_name; int vector, err, irq_num, vidx; - const char *vec_name; + + drv_name = dev_driver_string(&adapter->pdev->dev); + if_name = netdev_name(vport->netdev); for (vector = 0; vector < vport->num_q_vectors; vector++) { struct idpf_q_vector *q_vector = &vport->q_vectors[vector]; @@ -3804,8 +3806,8 @@ static int idpf_vport_intr_req_irq(struct idpf_vport *vport, char *basename) else continue; - name = kasprintf(GFP_KERNEL, "%s-%s-%d", basename, vec_name, - vidx); + name = kasprintf(GFP_KERNEL, "%s-%s-%s-%d", drv_name, if_name, + vec_name, vidx); err = request_irq(irq_num, idpf_vport_intr_clean_queues, 0, name, q_vector); @@ -4326,7 +4328,6 @@ int idpf_vport_intr_alloc(struct idpf_vport *vport) */ int idpf_vport_intr_init(struct idpf_vport *vport) { - char *int_name; int err; err = idpf_vport_intr_init_vec_idx(vport); @@ -4340,11 +4341,7 @@ int idpf_vport_intr_init(struct idpf_vport *vport) if (err) goto unroll_vectors_alloc; - int_name = kasprintf(GFP_KERNEL, "%s-%s", - dev_driver_string(&vport->adapter->pdev->dev), - vport->netdev->name); - - err = idpf_vport_intr_req_irq(vport, int_name); + err = idpf_vport_intr_req_irq(vport); if (err) goto unroll_vectors_alloc; -- 2.45.2 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH iwl-net 2/3] idpf: fix memleak in vport interrupt configuration 2024-07-24 13:40 ` [PATCH iwl-net 2/3] idpf: fix memleak in vport interrupt configuration Alexander Lobakin @ 2024-07-26 16:16 ` Simon Horman 2024-08-02 0:22 ` [Intel-wired-lan] " Singh, Krishneil K 0 siblings, 1 reply; 3+ messages in thread From: Simon Horman @ 2024-07-26 16:16 UTC (permalink / raw) To: Alexander Lobakin Cc: intel-wired-lan, Tony Nguyen, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, nex.sw.ncis.osdt.itp.upstreaming, netdev, linux-kernel, Michal Kubiak, stable, Pavan Kumar Linga On Wed, Jul 24, 2024 at 03:40:23PM +0200, Alexander Lobakin wrote: > From: Michal Kubiak <michal.kubiak@intel.com> > > The initialization of vport interrupt consists of two functions: > 1) idpf_vport_intr_init() where a generic configuration is done > 2) idpf_vport_intr_req_irq() where the irq for each q_vector is > requested. > > The first function used to create a base name for each interrupt using > "kasprintf()" call. Unfortunately, although that call allocated memory > for a text buffer, that memory was never released. > > Fix this by removing creating the interrupt base name in 1). > Instead, always create a full interrupt name in the function 2), because > there is no need to create a base name separately, considering that the > function 2) is never called out of idpf_vport_intr_init() context. > > Fixes: d4d558718266 ("idpf: initialize interrupts and enable vport") > Cc: stable@vger.kernel.org # 6.7 > Signed-off-by: Michal Kubiak <michal.kubiak@intel.com> > Reviewed-by: Pavan Kumar Linga <pavan.kumar.linga@intel.com> > Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com> Reviewed-by: Simon Horman <horms@kernel.org> ^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [Intel-wired-lan] [PATCH iwl-net 2/3] idpf: fix memleak in vport interrupt configuration 2024-07-26 16:16 ` Simon Horman @ 2024-08-02 0:22 ` Singh, Krishneil K 0 siblings, 0 replies; 3+ messages in thread From: Singh, Krishneil K @ 2024-08-02 0:22 UTC (permalink / raw) To: Simon Horman, Lobakin, Aleksander Cc: Linga, Pavan Kumar, NEX SW NCIS OSDT ITP Upstreaming, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Eric Dumazet, Kubiak, Michal, Nguyen, Anthony L, Jakub Kicinski, intel-wired-lan@lists.osuosl.org, Paolo Abeni, David S. Miller > -----Original Message----- > From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of > Simon Horman > Sent: Friday, July 26, 2024 9:16 AM > To: Lobakin, Aleksander <aleksander.lobakin@intel.com> > Cc: Linga, Pavan Kumar <pavan.kumar.linga@intel.com>; NEX SW NCIS OSDT ITP > Upstreaming <nex.sw.ncis.osdt.itp.upstreaming@intel.com>; > netdev@vger.kernel.org; linux-kernel@vger.kernel.org; stable@vger.kernel.org; > Eric Dumazet <edumazet@google.com>; Kubiak, Michal > <michal.kubiak@intel.com>; Nguyen, Anthony L > <anthony.l.nguyen@intel.com>; Jakub Kicinski <kuba@kernel.org>; intel-wired- > lan@lists.osuosl.org; Paolo Abeni <pabeni@redhat.com>; David S. Miller > <davem@davemloft.net> > Subject: Re: [Intel-wired-lan] [PATCH iwl-net 2/3] idpf: fix memleak in vport > interrupt configuration > > On Wed, Jul 24, 2024 at 03:40:23PM +0200, Alexander Lobakin wrote: > > From: Michal Kubiak <michal.kubiak@intel.com> > > > > The initialization of vport interrupt consists of two functions: > > 1) idpf_vport_intr_init() where a generic configuration is done > > 2) idpf_vport_intr_req_irq() where the irq for each q_vector is > > requested. > > > > The first function used to create a base name for each interrupt using > > "kasprintf()" call. Unfortunately, although that call allocated memory > > for a text buffer, that memory was never released. > > > > Fix this by removing creating the interrupt base name in 1). > > Instead, always create a full interrupt name in the function 2), because > > there is no need to create a base name separately, considering that the > > function 2) is never called out of idpf_vport_intr_init() context. > > > > Fixes: d4d558718266 ("idpf: initialize interrupts and enable vport") > > Cc: stable@vger.kernel.org # 6.7 > > Signed-off-by: Michal Kubiak <michal.kubiak@intel.com> > > Reviewed-by: Pavan Kumar Linga <pavan.kumar.linga@intel.com> > > Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com> > > Reviewed-by: Simon Horman <horms@kernel.org> Tested-by: Krishneil Singh <krishneil.k.singh@intel.com> ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-08-02 0:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20240724134024.2182959-1-aleksander.lobakin@intel.com>
2024-07-24 13:40 ` [PATCH iwl-net 2/3] idpf: fix memleak in vport interrupt configuration Alexander Lobakin
2024-07-26 16:16 ` Simon Horman
2024-08-02 0:22 ` [Intel-wired-lan] " Singh, Krishneil K
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).