lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <56D98B1A.1070804@cogentembedded.com>
Date:	Fri, 4 Mar 2016 16:18:18 +0300
From:	Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
To:	Douglas Miller <dougmill@...ux.vnet.ibm.com>,
	netdev@...r.kernel.org
Cc:	sathya.perla@...adcom.com, ajit.khaparde@...adcom.com,
	padmanabh.ratnakar@...adcom.com,
	sriharsha.basavapatna@...adcom.com, somnath.kotur@...adcom.com
Subject: Re: [PATCH 1/1] be2net: Don't leak iomapped memory on removal.

Hello.

On 3/4/2016 1:35 AM, Douglas Miller wrote:

> The adapter->pcicfg resource is either mapped via pci_iomap() or
> derived from adapter->db. During be_remove() this resource was ignored
> and so could remain mapped after remove.
>
> Add a flag to track whether adapter->pcicfg was mapped or not, then
> use that flag in be_unmap_pci_bars() to unmap if required.
>
> Signed-off-by: Douglas Miller <dougmill@...ux.vnet.ibm.com>
> ---
>   drivers/net/ethernet/emulex/benet/be.h      |    1 +
>   drivers/net/ethernet/emulex/benet/be_main.c |    4 ++++
>   2 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h
> index cf83783..f975129 100644
> --- a/drivers/net/ethernet/emulex/benet/be.h
> +++ b/drivers/net/ethernet/emulex/benet/be.h
> @@ -531,6 +531,7 @@ struct be_adapter {
>
>   	struct delayed_work be_err_detection_work;
>   	u8 err_flags;
> +	bool pcicfg_mapped;	/* pcicfg obtained via pci_iomap() */
>   	u32 flags;
>   	u32 cmd_privileges;
>   	/* Ethtool knobs and info */
> diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
> index f99de36..a79b8a5 100644
> --- a/drivers/net/ethernet/emulex/benet/be_main.c
> +++ b/drivers/net/ethernet/emulex/benet/be_main.c
[...]
> @@ -5019,8 +5021,10 @@ static int be_map_pci_bars(struct be_adapter *adapter)
>   			if (!addr)
>   				goto pci_map_err;
>   			adapter->pcicfg = addr;
> +			adapter->pcicfg_mapped = 1;

    s/1/true/.

>   		} else {
>   			adapter->pcicfg = adapter->db + SRIOV_VF_PCICFG_OFFSET;
> +			adapter->pcicfg_mapped = 0;

    s/0/false/.

[...]

MBR, Sergei

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ