14 Apr, 2009

1 commit

  • fb_notifier_call_chain() is called with info->lock held, i.e. in
    do_fb_ioctl() => FBIOPUT_VSCREENINFO => fb_set_var() and the some
    notifier callbacks, like fbcon_event_notify(), try to re-acquire
    info->lock again.

    Remove the lock/unlock_fb_info() in all the framebuffer notifier
    callbacks' and be sure to always call fb_notifier_call_chain() with
    info->lock held.

    Reported-by: Pavel Roskin
    Reported-by: Eric Miao
    Signed-off-by: Andrea Righi
    Cc: Stefan Richter
    Cc: Krzysztof Helt
    Cc: Geert Uytterhoeven
    Cc: "Rafael J. Wysocki"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrea Righi
     

01 Apr, 2009

2 commits

  • Before:

    text data bss dec hex filename
    3648 2910 32 6590 19be drivers/video/backlight/backlight.o
    3226 2812 32 6070 17b6 drivers/video/backlight/lcd.o
    30990 16688 8480 56158 db5e drivers/video/console/fbcon.o
    15488 8400 24 23912 5d68 drivers/video/fbmem.o

    After:

    text data bss dec hex filename
    3537 2870 32 6439 1927 drivers/video/backlight/backlight.o
    3131 2772 32 5935 172f drivers/video/backlight/lcd.o
    30876 16648 8480 56004 dac4 drivers/video/console/fbcon.o
    15506 8400 24 23930 5d7a drivers/video/fbmem.o

    Cc: Andrea Righi
    Cc: Geert Uytterhoeven
    Cc: Krzysztof Helt
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrew Morton
     
  • Fix a circular locking dependency in the frame buffer console driver
    pushing down the mutex fb_info->lock.

    Circular locking dependecies occur calling the blocking
    fb_notifier_call_chain() with fb_info->lock held. Notifier callbacks can
    try to acquire mm->mmap_sem, while fb_mmap() acquires the locks in the
    reverse order mm->mmap_sem => fb_info->lock.

    Tested-by: Andrey Borzenkov
    Signed-off-by: Andrea Righi
    Cc: Geert Uytterhoeven
    Cc: Krzysztof Helt
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrea Righi
     

06 Feb, 2009

1 commit

  • Avoid calling copy_from/to_user() with fb_info->lock mutex held in fbmem
    ioctl().

    fb_mmap() is called under mm->mmap_sem (A) held, that also acquires
    fb_info->lock (B); fb_ioctl() takes fb_info->lock (B) and does
    copy_from/to_user() that might acquire mm->mmap_sem (A), causing a
    deadlock.

    NOTE: it doesn't push down the fb_info->lock in each own driver's
    fb_ioctl(), so there are still potential deadlocks elsewhere.

    Signed-off-by: Andrea Righi
    Cc: Dave Jones
    Cc: "Rafael J. Wysocki"
    Cc: Johannes Weiner
    Cc: Krzysztof Helt
    Cc: Harvey Harrison
    Cc: Stefan Richter
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrea Righi
     

07 Jan, 2009

1 commit

  • The code to draw penguin logos always uses some properties of the main logo.
    This is incorrect if additional logos (CONFIG_FB_LOGO_EXTRA=y) have different
    types than the main logo, which causes corrupted logo images.

    http://bugzilla.kernel.org/show_bug.cgi?id=12181

    Hence skip additional logos that are not compatible with the main logo.

    Technically, it's possible to draw multiple logos of different types on
    truecolor displays, but this would complicate the (already quite
    complicated) logo drawing code even more.

    This patch fixes a problem with Debian's linux-image-2.6.26-1-powerpc64
    http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=508173

    Signed-off-by: Geert Uytterhoeven
    Cc: Krzysztof Helt
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Geert Uytterhoeven
     

20 Nov, 2008

1 commit

  • When booting in a direct color mode, the penguin has dirty feet, i.e.,
    some pixels have the wrong color. This is caused by
    fb_set_logo_directpalette() which does not initialize the last 32 palette
    entries.

    Signed-off-by: Clemens Ladisch
    Acked-by: Geert Uytterhoeven
    Cc: Krzysztof Helt
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Clemens Ladisch
     

07 Nov, 2008

1 commit

  • commit 3e680aae4e53ab54cdbb0c29257dae0cbb158e1c ("fb: convert
    lock/unlock_kernel() into local fb mutex") introduced several deadlocks
    in the fb_compat_ioctl() path, as mutex_lock() doesn't allow recursion,
    unlike lock_kernel(). This broke frame buffer applications on 64-bit
    systems with a 32-bit userland.

    commit 120a37470c2831fea49fdebaceb5a7039f700ce6 ("framebuffer compat_ioctl
    deadlock") fixed one of the deadlocks.

    This patch fixes the remaining deadlocks:
    - Revert commit 120a37470c2831fea49fdebaceb5a7039f700ce6,
    - Extract the core logic of fb_ioctl() into a new function do_fb_ioctl(),
    - Change all callsites of fb_ioctl() where info->lock is already held to
    call do_fb_ioctl() instead,
    - Add sparse annotations to all routines that take info->lock.

    Signed-off-by: Geert Uytterhoeven
    Cc: Mikulas Patocka
    Cc: Krzysztof Helt
    Cc: Alan Cox
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Geert Uytterhoeven
     

31 Oct, 2008

1 commit

  • Fix deadlock in fb_compat_ioctl. fb_compat_ioctl acquires a mutex and
    calls fb_ioctl that tries to acquire that mutex too. A regression added
    during BKL removal.

    Signed-off-by: Mikulas Patocka
    Cc: Alan Cox
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mikulas Patocka
     

20 Oct, 2008

2 commits

  • Change lock_kernel()/unlock_kernel() to local fb mutex. Each frame buffer
    instance has its own mutex.

    The one line try_to_load() function is unrolled to request_module() in two
    places for readability.

    [righi.andrea@gmail.com: fb: fix NULL pointer BUG dereference in fb_open()]
    Signed-off-by: Krzysztof Helt
    Signed-off-by: Andrea Righi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Krzysztof Helt
     
  • Framebuffer is heavily BKL dependant at the moment so just wrap the ioctl
    handler in the driver as we push down.

    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: Alan Cox
    Cc: Krzysztof Helt
    Cc: "Antonino A. Daplas"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alan Cox
     

17 Oct, 2008

2 commits

  • * git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6: (46 commits)
    UIO: Fix mapping of logical and virtual memory
    UIO: add automata sercos3 pci card support
    UIO: Change driver name of uio_pdrv
    UIO: Add alignment warnings for uio-mem
    Driver core: add bus_sort_breadthfirst() function
    NET: convert the phy_device file to use bus_find_device_by_name
    kobject: Cleanup kobject_rename and !CONFIG_SYSFS
    kobject: Fix kobject_rename and !CONFIG_SYSFS
    sysfs: Make dir and name args to sysfs_notify() const
    platform: add new device registration helper
    sysfs: use ilookup5() instead of ilookup5_nowait()
    PNP: create device attributes via default device attributes
    Driver core: make bus_find_device_by_name() more robust
    usb: turn dev_warn+WARN_ON combos into dev_WARN
    debug: use dev_WARN() rather than WARN_ON() in device_pm_add()
    debug: Introduce a dev_WARN() function
    sysfs: fix deadlock
    device model: Do a quickcheck for driver binding before doing an expensive check
    Driver core: Fix cleanup in device_create_vargs().
    Driver core: Clarify device cleanup.
    ...

    Linus Torvalds
     
  • Now that device_create() has been audited, rename things back to the
    original call to be sane.

    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

16 Oct, 2008

1 commit

  • Straight forward conversions to CONFIG_MODULE; many drivers
    include conditionally and then don't have any
    other conditional code so remove it from those.

    Signed-off-by: Johannes Berg
    Cc: video4linux-list@redhat.com
    Cc: David Woodhouse
    Cc: linux-ppp@vger.kernel.org
    Cc: dm-devel@redhat.com
    Signed-off-by: Rusty Russell

    Johannes Berg
     

24 Sep, 2008

1 commit


21 Aug, 2008

1 commit

  • Fixes kernel BUG at lib/radix-tree.c:473.

    Previously the handler was incidentally provided by tmpfs but this was
    removed with:

    commit 14fcc23fdc78e9d32372553ccf21758a9bd56fa1
    Author: Hugh Dickins
    Date: Mon Jul 28 15:46:19 2008 -0700

    tmpfs: fix kernel BUG in shmem_delete_inode

    relying on this behaviour was incorrect in any case and the BUG also
    appeared when the device node was on an ext3 filesystem.

    v2: override a_ops at open() time rather than mmap() time to minimise
    races per AKPM's concerns.

    Signed-off-by: Ian Campbell
    Cc: Jaya Kumar
    Cc: Nick Piggin
    Cc: Peter Zijlstra
    Cc: Hugh Dickins
    Cc: Johannes Weiner
    Cc: Jeremy Fitzhardinge
    Cc: Kel Modderman
    Cc: Markus Armbruster
    Cc: Krzysztof Helt
    Cc: [14fcc23fd is in 2.6.25.14 and 2.6.26.1]
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ian Campbell
     

27 Jul, 2008

1 commit


25 Jul, 2008

2 commits

  • Currently, linux/major.h defines a GRAPHDEV_MAJOR (29) that nobody uses,
    and linux/fb.h defines the real FB_MAJOR (also 29), that only fbmem.c
    needs. Drop GRAPHDEV_MAJOR from major.h, move FB_MAJOR definition from
    fb.h to major.h, and fix fbmem.c to use major.h's definition.

    Signed-off-by: Philippe De Muyter
    Cc: Krzysztof Helt
    Cc: "Antonino A. Daplas"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Philippe De Muyter
     
  • The xoffset, yoffset and yres members of fb_var_screeninfo are __u32.
    Make them unsigned in the code as well.

    Signed-off-by: Ville Syrjala
    Cc: "Antonino A. Daplas"
    Cc: Krzysztof Helt
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ville Syrjala
     

22 Jul, 2008

1 commit


21 Jun, 2008

1 commit


28 Apr, 2008

3 commits

  • Note: looks like accesses to "registered_fb" are done without any exclusion
    so there're none in new proc code, too. This should be fixed in separate
    patch.

    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: Alexey Dobriyan
    Cc: "Antonino A. Daplas"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     
  • Fix limit check in FBIOPUT_CON2FBMAP ioctl.

    Signed-off-by: Peter Samuelson
    Cc: Geert Uytterhoeven
    Cc: "Antonino A. Daplas"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Peter Samuelson
     
  • Add support for the framebuffers with non-native endianness. This is done via
    FBINFO_FOREIGN_ENDIAN flag that will be used by the drivers. Depending on the
    host endianness this flag will be overwritten by FBINFO_BE_MATH internal flag,
    or cleared.

    Tested to work on MPC8360E-RDK (BE) + Fujitsu MINT framebuffer (LE).

    Signed-off-by: Anton Vorontsov
    Cc: "Antonino A. Daplas"
    Cc: Benjamin Herrenschmidt
    Cc: Paul Mackerras
    Cc:
    Cc: Clemens Koller
    Cc: Krzysztof Helt
    Cc: Geert Uytterhoeven
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Anton Vorontsov
     

16 Apr, 2008

1 commit

  • /proc/fb is not removed during rmmod.

    Steps to reproduce:

    modprobe fb
    rmmod fb
    ls /proc

    BUG: unable to handle kernel paging request at ffffffffa0094370
    IP: [] proc_get_inode+0x101/0x130
    PGD 203067 PUD 207063 PMD 17e758067 PTE 0
    Oops: 0000 [1] SMP
    last sysfs file: /sys/devices/pci0000:00/0000:00:1e.0/0000:05:02.0/resource
    CPU 1
    Modules linked in: nf_conntrack_irc xt_state iptable_filter ipt_MASQUERADE iptable_nat nf_nat nf_conntrack_ipv4 nf_conntrack ip_tables x_tables vfat fat usbhid ehci_hcd uhci_hcd usbcore sr_mod cdrom [last unloaded: fb]
    Pid: 21205, comm: ls Not tainted 2.6.25-rc8-mm2 #14
    RIP: 0010:[] [] proc_get_inode+0x101/0x130
    RSP: 0018:ffff81017c4bfc78 EFLAGS: 00010246
    RAX: 0000000000008000 RBX: ffff8101787f5470 RCX: 0000000048011ccc
    RDX: ffffffffa0094320 RSI: ffff810006ad43b0 RDI: ffff81017fc2cc00
    RBP: ffff81017e450300 R08: 0000000000000002 R09: ffff81017c5d1000
    R10: 0000000000000000 R11: 0000000000000246 R12: ffff81016b903a28
    R13: ffff81017f822020 R14: ffff81017c4bfd58 R15: ffff81017f822020
    FS: 00007f08e71696f0(0000) GS:ffff81017fc06480(0000) knlGS:0000000000000000
    CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
    CR2: ffffffffa0094370 CR3: 000000017e54a000 CR4: 00000000000006e0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
    Process ls (pid: 21205, threadinfo ffff81017c4be000, task ffff81017de48770)
    Stack: ffff81017c5d1000 00000000ffffffea ffff81017e450300 ffffffff802bdd1e
    ffff81017f802258 ffff81017c4bfe48 ffff81016b903a28 ffff81017f822020
    ffff81017c4bfd48 ffffffff802b9ba0 ffff81016b903a28 ffff81017f802258
    Call Trace:
    [] ? proc_lookup_de+0x8e/0x100
    [] ? proc_root_lookup+0x20/0x60
    [] ? do_lookup+0x1b7/0x210
    [] ? __link_path_walk+0x53d/0x7f0
    [] ? mntput_no_expire+0x28/0x130
    [] ? path_walk+0x5a/0xc0
    [] ? do_path_lookup+0x83/0x1c0
    [] ? getname+0xe5/0x210
    [] ? __user_walk_fd+0x4b/0x80
    [] ? vfs_lstat_fd+0x2c/0x70
    [] ? filldir+0xae/0xf0
    [] ? de_put+0x9/0x50
    [] ? mnt_want_write+0x2d/0x80
    [] ? touch_atime+0x1f/0x170
    [] ? proc_root_readdir+0x7d/0xa0
    [] ? sys_newlstat+0x27/0x50
    [] ? vfs_readdir+0x9b/0xd0
    [] ? sys_getdents+0xce/0xe0
    [] ? system_call_after_swapgs+0x7b/0x80

    Code: b7 83 b2 00 00 00 25 00 f0 00 00 3d 00 80 00 00 74 19 48 89 93 f0 00 00 00 48 89 df e8 39 9a fd ff 48 89 d8 48 83 c4 08 5b 5d c3 83 7a 50 00 48 c7 c0 60 16 45 80 48 c7 c2 40 17 45 80 48 0f
    RIP [] proc_get_inode+0x101/0x130
    RSP
    CR2: ffffffffa0094370
    ---[ end trace c71hiarjan8ab739 ]---

    Signed-off-by: Alexey Dobriyan
    "Antonino A. Daplas"
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     

17 Oct, 2007

2 commits


01 Aug, 2007

1 commit


18 Jul, 2007

4 commits

  • Add fb_append_extra_logo(), to append extra lines of logos below the standard
    Linux logo.

    Signed-off-by: Geert Uytterhoeven
    Signed-off-by: Geoff Levand
    Acked-By: James Simmons
    Cc: "Antonino A. Daplas"
    Cc: Benjamin Herrenschmidt
    Cc: Paul Mackerras
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Geert Uytterhoeven
     
  • The Cell Broadband Engine contains a 64-bit PowerPC core with 2 hardware
    threads (called PPEs) and 8 Synergistic Processing Engines (called SPEs).
    When booting Linux, 2 penguins logos are shown on the graphical console by
    the standard frame buffer console logo code.

    To emphasize the existence of the SPEs (which can be used under Linux), we
    added a second row of (smaller) helper penguin logos, one for each SPE.

    A sample screenshot can be found at
    http://www.kernel.org/pub/linux/kernel/people/geoff/cell/debian-penguin-shot.png
    (or on the ps3linux T-shirts we wore at OLS :-)

    This patch:

    Extract the code to draw one line of logos into fb_show_logo_line()

    Signed-off-by: Geert Uytterhoeven
    Signed-off-by: Geoff Levand
    Acked-By: James Simmons
    Cc: "Antonino A. Daplas"
    Cc: Benjamin Herrenschmidt
    Cc: Paul Mackerras
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Geert Uytterhoeven
     
  • This allows for proper console unregistration via the VT layer, and updates
    the FB layer to use it. This makes debugging new console drivers much easier,
    since you can properly clean them up before unloading.

    [adaplas]
    unregister_framebuffer() is typically called as part of the driver's
    module_exit(). Doing so otherwise will freeze the machine as the VT layer is
    holding reference counts on fbcon, and fbcon on the driver. With this change,
    it allows unregister_framebuffer() to be called safely anywhere as needed.

    Additions from the original: If multiple drivers are used by fbcon, and if
    one of them unregisters, a driver will take over the consoles vacated by the
    outgoing one (via set_con2fb_map). Once only the outgoing driver remains,
    then fbcon will unbind from the VT layer (if CONFIG_HW_CONSOLE_UNBINDING is
    set to y).

    It is important that these drivers implement fb_open() and fb_release()
    just to ensure that no other process is using the driver. Likewise, these
    drivers _must_ check the return value of unregister_framebuffer().

    [akpm@linux-foundation.org: make fbcon_unbind() stub inline]
    Signed-off-by: Jesse Barnes
    Signed-off-by: Antonino Daplas
    Cc: Geert Uytterhoeven
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jesse Barnes
     
  • Move arch-specific bits of fb_mmap() to their respective subdirectories

    [bob.picco@hp.com: efi_range_is_wc is referenced but not declared]
    [bunk@stusta.de: fix include/asm-m68k/fb.h]
    Signed-off-by: Antonino Daplas
    Acked-by: David S. Miller
    Signed-off-by: Adrian Bunk
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Antonino A. Daplas
     

10 May, 2007

1 commit


09 May, 2007

8 commits

  • Clean up exit patch of fb_set_var():

    - consolidate all return values into a single local variable
    - ensure that return values are valid error codes
    - fix fb_set_var() returning success when fb_check_caps() failed

    Signed-off-by: Antonino Daplas
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Antonino A. Daplas
     
  • Check if the mode can properly display the screen. This will be needed by
    drivers where the capability is not constant with each mode. The function
    fb_set_var() will query fbcon the requirement, then it will query the driver
    (via a new hook fb_get_caps()) its capability. If the driver's capability
    cannot handle fbcon's requirement, then fb_set_var() will fail.

    For example, if a particular driver supports 2 modes where:

    mode1 = can only display 8x16 bitmaps
    mode2 = can display any bitmap

    then if current mode = mode2 and current font = 12x22

    fbset /* mode1 cannot handle 12x22 */
    fbset will fail

    Signed-off-by: Antonino Daplas
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Antonino A. Daplas
     
  • Some drivers may reset the var->activate field on fb_check_var(). This can
    lead to undefined behavior. For example, doing fbset -a with vga16fb
    will only modify the active console instead of modifying all.

    Signed-off-by: Antonino Daplas
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Antonino A. Daplas
     
  • A few drivers are not capable of blitting rectangles of any dimension.
    vga16fb can only blit 8-pixel wide rectangles, while s3fb (in tileblitting
    mode) can only blit 8x16 rectangles. For example, loading a 12x22 font in
    vga16fb will result in a corrupt display.

    Advertise this limitation/capability in info->pixmap.blit_x and blit_y. These
    fields are 32-bit arrays (font max is 32x32 only), ie, if bit 7 is set, then
    width/height of 7+1 is supported.

    Signed-off-by: Antonino Daplas
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Antonino A. Daplas
     
  • It is unnecessary to pass struct file to fb_read() and fb_write() in struct
    fb_ops. For consistency with the other methods, pass struct fb_info instead.

    Signed-off-by: Antonino Daplas
    Acked-by: Paul Mundt
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Antonino A. Daplas
     
  • It was always intended for the logo to be drawn only if both fbcon and the
    driver that is mapped to it are both compiled statically. Currently, if fbcon
    is loaded prior to the driver, the logo is not shown. Reverse the order, and
    the code may attempt to draw the logo which is __initdata. By accident, this
    bug is rarely seen because this method of loading the modules is not common
    and secondly, a code in fb_prepare_logo() that checks the height of the logo
    (now a random value) rarely succeeds.

    Fix by drawing the logo only if both fbcon and the driver are statically
    compiled.

    Signed-off-by: Antonino Daplas
    Cc: Jean Delvare
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Antonino A. Daplas
     
  • Correct the image offsets when rotating the logo. Before image->dx and
    image->dy were always zero, so nobody ever noticed.

    Signed-off-by: Geert Uytterhoeven
    Acked-By: James Simmons
    Cc: "Antonino A. Daplas"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Geert Uytterhoeven
     
  • fb_do_show_logo() updates:
    - Use width and height of the passed image instead of the global variable
    fb_logo
    - Explicitly pass the number of logos to draw

    Signed-off-by: Geert Uytterhoeven
    Signed-off-by: Geoff Levand
    Acked-By: James Simmons
    Cc: "Antonino A. Daplas"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Geert Uytterhoeven