<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/video/fbdev/udlfb.c, branch linux-4.19.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.19.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.19.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2022-04-15T12:14:55Z</updated>
<entry>
<title>video: fbdev: udlfb: replace snprintf in show functions with sysfs_emit</title>
<updated>2022-04-15T12:14:55Z</updated>
<author>
<name>Jing Yao</name>
</author>
<published>2021-11-04T11:52:29Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=23303e088b6af9212e10f240f0f6056139c9b655'/>
<id>urn:sha1:23303e088b6af9212e10f240f0f6056139c9b655</id>
<content type='text'>
[ Upstream commit 81a998288956d09d7a7a2303d47e4d60ad55c401 ]

Use sysfs_emit instead of scnprintf, snprintf or sprintf.

Reported-by: Zeal Robot &lt;zealci@zte.com.cn&gt;
Signed-off-by: Jing Yao &lt;yao.jing2@zte.com.cn&gt;
Signed-off-by: Helge Deller &lt;deller@gmx.de&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>udlfb: Fix memory leak in dlfb_usb_probe</title>
<updated>2021-03-07T11:18:55Z</updated>
<author>
<name>Zqiang</name>
</author>
<published>2020-12-15T06:30:22Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=26c080b9bfdf81d68e8b513a2228b322c667e545'/>
<id>urn:sha1:26c080b9bfdf81d68e8b513a2228b322c667e545</id>
<content type='text'>
commit 5c0e4110f751934e748a66887c61f8e73805f0f9 upstream.

The dlfb_alloc_urb_list function is called in dlfb_usb_probe function,
after that if an error occurs, the dlfb_free_urb_list function need to
be called.

BUG: memory leak
unreferenced object 0xffff88810adde100 (size 32):
  comm "kworker/1:0", pid 17, jiffies 4294947788 (age 19.520s)
  hex dump (first 32 bytes):
    10 30 c3 0d 81 88 ff ff c0 fa 63 12 81 88 ff ff  .0........c.....
    00 30 c3 0d 81 88 ff ff 80 d1 3a 08 81 88 ff ff  .0........:.....
  backtrace:
    [&lt;0000000019512953&gt;] kmalloc include/linux/slab.h:552 [inline]
    [&lt;0000000019512953&gt;] kzalloc include/linux/slab.h:664 [inline]
    [&lt;0000000019512953&gt;] dlfb_alloc_urb_list drivers/video/fbdev/udlfb.c:1892 [inline]
    [&lt;0000000019512953&gt;] dlfb_usb_probe.cold+0x289/0x988 drivers/video/fbdev/udlfb.c:1704
    [&lt;0000000072160152&gt;] usb_probe_interface+0x177/0x370 drivers/usb/core/driver.c:396
    [&lt;00000000a8d6726f&gt;] really_probe+0x159/0x480 drivers/base/dd.c:554
    [&lt;00000000c3ce4b0e&gt;] driver_probe_device+0x84/0x100 drivers/base/dd.c:738
    [&lt;00000000e942e01c&gt;] __device_attach_driver+0xee/0x110 drivers/base/dd.c:844
    [&lt;00000000de0a5a5c&gt;] bus_for_each_drv+0xb7/0x100 drivers/base/bus.c:431
    [&lt;00000000463fbcb4&gt;] __device_attach+0x122/0x250 drivers/base/dd.c:912
    [&lt;00000000b881a711&gt;] bus_probe_device+0xc6/0xe0 drivers/base/bus.c:491
    [&lt;00000000364bbda5&gt;] device_add+0x5ac/0xc30 drivers/base/core.c:2936
    [&lt;00000000eecca418&gt;] usb_set_configuration+0x9de/0xb90 drivers/usb/core/message.c:2159
    [&lt;00000000edfeca2d&gt;] usb_generic_driver_probe+0x8c/0xc0 drivers/usb/core/generic.c:238
    [&lt;000000001830872b&gt;] usb_probe_device+0x5c/0x140 drivers/usb/core/driver.c:293
    [&lt;00000000a8d6726f&gt;] really_probe+0x159/0x480 drivers/base/dd.c:554
    [&lt;00000000c3ce4b0e&gt;] driver_probe_device+0x84/0x100 drivers/base/dd.c:738
    [&lt;00000000e942e01c&gt;] __device_attach_driver+0xee/0x110 drivers/base/dd.c:844
    [&lt;00000000de0a5a5c&gt;] bus_for_each_drv+0xb7/0x100 drivers/base/bus.c:431

Reported-by: syzbot+c9e365d7f450e8aa615d@syzkaller.appspotmail.com
Signed-off-by: Zqiang &lt;qiang.zhang@windriver.com&gt;
Signed-off-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20201215063022.16746-1-qiang.zhang@windriver.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>udlfb: fix some inconsistent NULL checking</title>
<updated>2019-05-31T13:46:02Z</updated>
<author>
<name>Dan Carpenter</name>
</author>
<published>2018-12-20T18:13:07Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b8304d918c02594ff931e93965807349939f8c18'/>
<id>urn:sha1:b8304d918c02594ff931e93965807349939f8c18</id>
<content type='text'>
commit c143a559b073aeea688b9bb7c5b46f3cf322d569 upstream.

In the current kernel, then kzalloc() can't fail for small allocations,
but if it did fail then we would have a NULL dereference in the error
handling.  Also in dlfb_usb_disconnect() if "info" were NULL then it
would cause an Oops inside the unregister_framebuffer() function but it
can't be NULL so let's remove that check.

Fixes: 68a958a915ca ("udlfb: handle unplug properly")
Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Cc: Bernie Thompson &lt;bernie@plugable.com&gt;
Cc: Mikulas Patocka &lt;mpatocka@redhat.com&gt;
Cc: Alexey Khoroshilov &lt;khoroshilov@ispras.ru&gt;
Cc: Colin Ian King &lt;colin.king@canonical.com&gt;
Cc: Wen Yang &lt;wen.yang99@zte.com.cn&gt;
[b.zolnierkie: added "Fixes:" tag]
Signed-off-by: Bartlomiej Zolnierkiewicz &lt;b.zolnierkie@samsung.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>udlfb: introduce a rendering mutex</title>
<updated>2019-05-25T16:23:30Z</updated>
<author>
<name>Mikulas Patocka</name>
</author>
<published>2019-04-01T15:46:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=42f59b83f0cf547a2236b0e1e4d0c785db9af6e8'/>
<id>urn:sha1:42f59b83f0cf547a2236b0e1e4d0c785db9af6e8</id>
<content type='text'>
commit babc250e278eac7b0e671bdaedf833759b43bb78 upstream.

Rendering calls may be done simultaneously from the workqueue,
dlfb_ops_write, dlfb_ops_ioctl, dlfb_ops_set_par and dlfb_dpy_deferred_io.
The code is robust enough so that it won't crash on concurrent rendering.

However, concurrent rendering may cause display corruption if the same
pixel is simultaneously being rendered. In order to avoid this corruption,
this patch adds a mutex around the rendering calls.

Signed-off-by: Mikulas Patocka &lt;mpatocka@redhat.com&gt;
Cc: Bernie Thompson &lt;bernie@plugable.com&gt;
Cc: Ladislav Michl &lt;ladis@linux-mips.org&gt;
Cc: &lt;stable@vger.kernel.org&gt;
[b.zolnierkie: replace "dlfb:" with "uldfb:" in the patch summary]
Signed-off-by: Bartlomiej Zolnierkiewicz &lt;b.zolnierkie@samsung.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>udlfb: fix sleeping inside spinlock</title>
<updated>2019-05-25T16:23:29Z</updated>
<author>
<name>Mikulas Patocka</name>
</author>
<published>2019-04-01T15:46:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=fb36a97654a7950b617f3ba261b4939fe281c6b9'/>
<id>urn:sha1:fb36a97654a7950b617f3ba261b4939fe281c6b9</id>
<content type='text'>
commit 6b11f9d8433b471fdd3ebed232b43a4b723be6ff upstream.

If a framebuffer device is used as a console, the rendering calls
(copyarea, fillrect, imageblit) may be done with the console spinlock
held. On udlfb, these function call dlfb_handle_damage that takes a
blocking semaphore before acquiring an URB.

In order to fix the bug, this patch changes the calls copyarea, fillrect
and imageblit to offload USB work to a workqueue.

A side effect of this patch is 3x improvement in console scrolling speed
because the device doesn't have to be updated after each copyarea call.

Signed-off-by: Mikulas Patocka &lt;mpatocka@redhat.com&gt;
Cc: Bernie Thompson &lt;bernie@plugable.com&gt;
Cc: Ladislav Michl &lt;ladis@linux-mips.org&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Bartlomiej Zolnierkiewicz &lt;b.zolnierkie@samsung.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>udlfb: delete the unused parameter for dlfb_handle_damage</title>
<updated>2019-05-25T16:23:29Z</updated>
<author>
<name>Mikulas Patocka</name>
</author>
<published>2019-04-01T15:46:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1b8c955691d48fc19bcbffc1d09efbc2ea78d049'/>
<id>urn:sha1:1b8c955691d48fc19bcbffc1d09efbc2ea78d049</id>
<content type='text'>
commit bd86b6c5c60711dbd4fa21bdb497a188ecb6cf63 upstream.

Remove the unused parameter "data" and unused variable "ret".

Signed-off-by: Mikulas Patocka &lt;mpatocka@redhat.com&gt;
Cc: Bernie Thompson &lt;bernie@plugable.com&gt;
Cc: Ladislav Michl &lt;ladis@linux-mips.org&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Bartlomiej Zolnierkiewicz &lt;b.zolnierkie@samsung.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>udlfb: handle unplug properly</title>
<updated>2019-02-27T09:09:03Z</updated>
<author>
<name>Mikulas Patocka</name>
</author>
<published>2018-10-08T10:57:34Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c014cae8e19603fa8b98feac0fa5d1da650e8834'/>
<id>urn:sha1:c014cae8e19603fa8b98feac0fa5d1da650e8834</id>
<content type='text'>
commit 68a958a915ca912b8ce71b9eea7445996f6e681e upstream.

The udlfb driver maintained an open count and cleaned up itself when the
count reached zero. But the console is also counted in the reference count
- so, if the user unplugged the device, the open count would not drop to
zero and the driver stayed loaded with console attached. If the user
re-plugged the adapter, it would create a device /dev/fb1, show green
screen and the access to the console would be lost.

The framebuffer subsystem has reference counting on its own - in order to
fix the unplug bug, we rely the framebuffer reference counting. When the
user unplugs the adapter, we call unregister_framebuffer unconditionally.
unregister_framebuffer will unbind the console, wait until all users stop
using the framebuffer and then call the fb_destroy method. The fb_destroy
cleans up the USB driver.

This patch makes the following changes:
* Drop dlfb-&gt;kref and rely on implicit framebuffer reference counting
  instead.
* dlfb_usb_disconnect calls unregister_framebuffer, the rest of driver
  cleanup is done in the function dlfb_ops_destroy. dlfb_ops_destroy will
  be called by the framebuffer subsystem when no processes have the
  framebuffer open or mapped.
* We don't use workqueue during initialization, but initialize directly
  from dlfb_usb_probe. The workqueue could race with dlfb_usb_disconnect
  and this racing would produce various kinds of memory corruption.
* We use usb_get_dev and usb_put_dev to make sure that the USB subsystem
  doesn't free the device under us.

Signed-off-by: Mikulas Patocka &lt;mpatocka@redhat.com&gt;
cc: Dave Airlie &lt;airlied@redhat.com&gt;
Cc: Bernie Thompson &lt;bernie@plugable.com&gt;,
Cc: Ladislav Michl &lt;ladis@linux-mips.org&gt;
Signed-off-by: Bartlomiej Zolnierkiewicz &lt;b.zolnierkie@samsung.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>udlfb: use spin_lock_irq instead of spin_lock_irqsave</title>
<updated>2018-07-25T13:41:57Z</updated>
<author>
<name>Mikulas Patocka</name>
</author>
<published>2018-07-25T13:41:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=cb782a3fa952478177341e67275885ae52340f99'/>
<id>urn:sha1:cb782a3fa952478177341e67275885ae52340f99</id>
<content type='text'>
spin_lock_irqsave and spin_unlock_irqrestore is inteded to be called from
a context where it is unknown if interrupts are enabled or disabled (such
as interrupt handlers). From a process context, we should call
spin_lock_irq and spin_unlock_irq, that avoids the costly pushf and popf
instructions.

Signed-off-by: Mikulas Patocka &lt;mpatocka@redhat.com&gt;
Signed-off-by: Bartlomiej Zolnierkiewicz &lt;b.zolnierkie@samsung.com&gt;
</content>
</entry>
<entry>
<title>udlfb: avoid prefetch</title>
<updated>2018-07-25T13:41:57Z</updated>
<author>
<name>Mikulas Patocka</name>
</author>
<published>2018-07-25T13:41:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=037dde4113b5d1f886cb621d538438e7af7b6967'/>
<id>urn:sha1:037dde4113b5d1f886cb621d538438e7af7b6967</id>
<content type='text'>
Modern processors can detect linear memory accesses and prefetch data
automatically, so there's no need to use prefetch.

Signed-off-by: Mikulas Patocka &lt;mpatocka@redhat.com&gt;
Signed-off-by: Bartlomiej Zolnierkiewicz &lt;b.zolnierkie@samsung.com&gt;
</content>
</entry>
<entry>
<title>udlfb: optimization - test the backing buffer</title>
<updated>2018-07-25T13:41:56Z</updated>
<author>
<name>Mikulas Patocka</name>
</author>
<published>2018-07-25T13:41:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8f3c39b8565df2504d727be2ed6d2643bae2b317'/>
<id>urn:sha1:8f3c39b8565df2504d727be2ed6d2643bae2b317</id>
<content type='text'>
Currently, the udlfb driver only tests for identical bytes at the
beginning or at the end of a page and renders anything between the first
and last mismatching pixel. But pages are not the same as lines, so this
is quite suboptimal - if there is something modified at the beginning of a
page and at the end of a page, the whole page is rendered, even if most of
the page is not modified.

This patch makes it test for identical pixels at the beginning and end of
each rendering command. This patch improves identical byte detection by
41% when playing video in a window.

This patch also fixes a possible screen corruption if the user is writing
to the framebuffer while dlfb_render_hline is in progress - the pixel data
that is copied to the backbuffer with memcpy may be different from the
pixel data that is actually rendered to the hardware (because the content
of the framebuffer may change between memcpy and the rendering command).
We must make sure that we copy exactly the same pixel as the pixel that is
being rendered.

Signed-off-by: Mikulas Patocka &lt;mpatocka@redhat.com&gt;
[b.zolnierkie: fix code indent]
Signed-off-by: Bartlomiej Zolnierkiewicz &lt;b.zolnierkie@samsung.com&gt;
</content>
</entry>
</feed>
