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]
Date:	Fri, 23 Jul 2010 17:00:09 +0200
From:	Geert Uytterhoeven <geert@...ux-m68k.org>
To:	Marcin Slusarz <marcin.slusarz@...il.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	LKML <linux-kernel@...r.kernel.org>, linux-fbdev@...r.kernel.org,
	nouveau@...ts.freedesktop.org
Subject: Re: [PATCH v2] vga16fb: refuse to load in face of other driver 
	controlling primary card

On Fri, Jul 23, 2010 at 15:10, Marcin Slusarz <marcin.slusarz@...il.com> wrote:
> diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
> index 731fce6..cb19cae 100644
> --- a/drivers/video/fbmem.c
> +++ b/drivers/video/fbmem.c
> @@ -1504,6 +1504,7 @@ static bool fb_do_apertures_overlap(struct apertures_struct *gena,
>  }
>
>  #define VGA_FB_PHYS 0xA0000
> +#define VGA_FB_PHYS_LEN 65536

Does this really belong here?

>  void remove_conflicting_framebuffers(struct apertures_struct *a,
>                                     const char *name, bool primary)
>  {
> @@ -1532,6 +1533,17 @@ void remove_conflicting_framebuffers(struct apertures_struct *a,
>  }
>  EXPORT_SYMBOL(remove_conflicting_framebuffers);
>
> +struct resource *request_vga_mem_region(const char *name)
> +{
> +       struct resource *res = request_mem_region(VGA_FB_PHYS,
> +                                               VGA_FB_PHYS_LEN, name);
> +       if (res == NULL)
> +               printk(KERN_INFO "%s: other driver owns the primary card, refusing to load\n",
> +                                 name);
> +       return res;
> +}
> +EXPORT_SYMBOL(request_vga_mem_region);
> +
>  /**
>  *     register_framebuffer - registers a frame buffer device
>  *     @fb_info: frame buffer info structure
> @@ -1548,6 +1560,8 @@ register_framebuffer(struct fb_info *fb_info)
>        int i;
>        struct fb_event event;
>        struct fb_videomode mode;
> +       bool primary;
> +       struct resource *res = fb_info->resource;
>
>        if (num_registered_fb == FB_MAX)
>                return -ENXIO;
> @@ -1555,8 +1569,19 @@ register_framebuffer(struct fb_info *fb_info)
>        if (fb_check_foreignness(fb_info))
>                return -ENOSYS;
>
> +       primary = fb_is_primary_device(fb_info);
>        remove_conflicting_framebuffers(fb_info->apertures, fb_info->fix.id,
> -                                        fb_is_primary_device(fb_info));
> +                                       primary);
> +
> +       /*
> +        * if the card is primary and the resource was not already allocated
> +        * by framebuffer driver then lock vga memory region
> +        */
> +       if (primary && res == NULL) {
> +               res = request_vga_mem_region(fb_info->fix.id);
> +               if (res == NULL)
> +                       return -EBUSY;
> +       }

More VGA-specific stuff in drivers/video/fbmem.c.
Not all platforms have VGA memory.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ