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] [thread-next>] [day] [month] [year] [list]
Message-ID: <555C594E.1010607@ti.com>
Date:	Wed, 20 May 2015 12:52:14 +0300
From:	Tomi Valkeinen <tomi.valkeinen@...com>
To:	"Luis R. Rodriguez" <mcgrof@...not-panic.com>,
	<plagnioj@...osoft.com>, <hpa@...or.com>
CC:	<linux-fbdev@...r.kernel.org>, <luto@...capital.net>,
	<cocci@...teme.lip6.fr>, "Luis R. Rodriguez" <mcgrof@...e.com>,
	Toshi Kani <toshi.kani@...com>,
	Suresh Siddha <sbsiddha@...il.com>,
	Ingo Molnar <mingo@...e.hu>,
	Thomas Gleixner <tglx@...utronix.de>,
	Juergen Gross <jgross@...e.com>,
	Daniel Vetter <daniel.vetter@...ll.ch>,
	Dave Airlie <airlied@...hat.com>,
	Antonino Daplas <adaplas@...il.com>,
	Rob Clark <robdclark@...il.com>,
	Jingoo Han <jg1.han@...sung.com>,
	Wolfram Sang <wsa@...-dreams.de>,
	<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3 2/3] video: fbdev: vesafb: add missing mtrr_del() for
 added MTRR

Hi Luis,

On 21/04/15 23:40, Luis R. Rodriguez wrote:
> From: "Luis R. Rodriguez" <mcgrof@...e.com>
> 
> The MTRR added was never being deleted.
> 
> Cc: Toshi Kani <toshi.kani@...com>
> Cc: Suresh Siddha <sbsiddha@...il.com>
> Cc: Ingo Molnar <mingo@...e.hu>
> Cc: Thomas Gleixner <tglx@...utronix.de>
> Cc: Juergen Gross <jgross@...e.com>
> Cc: Daniel Vetter <daniel.vetter@...ll.ch>
> Cc: Andy Lutomirski <luto@...capital.net>
> Cc: Dave Airlie <airlied@...hat.com>
> Cc: Antonino Daplas <adaplas@...il.com>
> Cc: Rob Clark <robdclark@...il.com>
> Cc: Jingoo Han <jg1.han@...sung.com>
> Cc: Wolfram Sang <wsa@...-dreams.de>
> Cc: Jean-Christophe Plagniol-Villard <plagnioj@...osoft.com>
> Cc: Tomi Valkeinen <tomi.valkeinen@...com>
> Cc: linux-fbdev@...r.kernel.org
> Cc: linux-kernel@...r.kernel.org
> Signed-off-by: Luis R. Rodriguez <mcgrof@...e.com>
> ---
>  drivers/video/fbdev/vesafb.c | 30 ++++++++++++++++++++++++------
>  1 file changed, 24 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/video/fbdev/vesafb.c b/drivers/video/fbdev/vesafb.c
> index 191156b..a2261d0 100644
> --- a/drivers/video/fbdev/vesafb.c
> +++ b/drivers/video/fbdev/vesafb.c
> @@ -29,6 +29,10 @@
>  
>  /* --------------------------------------------------------------------- */
>  
> +struct vesafb_par {
> +	int wc_cookie;
> +};
> +
>  static struct fb_var_screeninfo vesafb_defined = {
>  	.activate	= FB_ACTIVATE_NOW,
>  	.height		= -1,
> @@ -175,7 +179,16 @@ static int vesafb_setcolreg(unsigned regno, unsigned red, unsigned green,
>  
>  static void vesafb_destroy(struct fb_info *info)
>  {
> +#ifdef CONFIG_MTRR
> +	struct vesafb_par *par = info->par;
> +#endif
> +
>  	fb_dealloc_cmap(&info->cmap);
> +
> +#ifdef CONFIG_MTRR
> +	if (par->wc_cookie >= 0)
> +		mtrr_del(par->wc_cookie, 0, 0);
> +#endif
>  	if (info->screen_base)
>  		iounmap(info->screen_base);
>  	release_mem_region(info->apertures->ranges[0].base, info->apertures->ranges[0].size);
> @@ -228,6 +241,7 @@ static int vesafb_setup(char *options)
>  static int vesafb_probe(struct platform_device *dev)
>  {
>  	struct fb_info *info;
> +	struct vesafb_par *par;
>  	int i, err;
>  	unsigned int size_vmode;
>  	unsigned int size_remap;
> @@ -297,8 +311,8 @@ static int vesafb_probe(struct platform_device *dev)
>  		return -ENOMEM;
>  	}
>  	platform_set_drvdata(dev, info);
> -	info->pseudo_palette = info->par;
> -	info->par = NULL;
> +	info->pseudo_palette = NULL;
> +	par = info->par;
>  
>  	/* set vesafb aperture size for generic probing */
>  	info->apertures = alloc_apertures(1);
> @@ -407,17 +421,17 @@ static int vesafb_probe(struct platform_device *dev)
>  	if (mtrr == 3) {
>  #ifdef CONFIG_MTRR
>  		unsigned int temp_size = size_total;
> -		int rc;
>  
>  		/* Find the largest power-of-two */
>  		temp_size = roundup_pow_of_two(temp_size);
>  
>  		/* Try and find a power of two to add */
>  		do {
> -			rc = mtrr_add(vesafb_fix.smem_start, temp_size,
> -				      MTRR_TYPE_WRCOMB, 1);
> +			par->wc_cookie = mtrr_add(vesafb_fix.smem_start,
> +						  temp_size,
> +						  MTRR_TYPE_WRCOMB, 1);
>  			temp_size >>= 1;
> -		} while (temp_size >= PAGE_SIZE && rc == -EINVAL);
> +		} while (temp_size >= PAGE_SIZE && par->wc_cookie == -EINVAL);
>  #endif
>  		info->screen_base = ioremap_wc(vesafb_fix.smem_start, vesafb_fix.smem_len);
>  	} else {
> @@ -462,6 +476,10 @@ static int vesafb_probe(struct platform_device *dev)
>  	fb_info(info, "%s frame buffer device\n", info->fix.id);
>  	return 0;
>  err:
> +#ifdef CONFIG_MTRR
> +	if (par->wc_cookie >= 0)
> +		mtrr_del(par->wc_cookie, 0, 0);
> +#endif
>  	if (info->screen_base)
>  		iounmap(info->screen_base);
>  	framebuffer_release(info);

Hmm, this looks a bit odd... You're removing the pseudo_palette, and
using its memory for mtrr cookie?

 Tomi


Download attachment "signature.asc" of type "application/pgp-signature" (820 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ