<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/media/tuners, branch linux-6.10.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.10.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.10.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2024-10-04T14:33:26Z</updated>
<entry>
<title>Revert "media: tuners: fix error return code of hybrid_tuner_request_state()"</title>
<updated>2024-10-04T14:33:26Z</updated>
<author>
<name>Roman Smirnov</name>
</author>
<published>2024-07-16T09:10:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=eab78824687cb1a134984c4e8b272809ea127a9b'/>
<id>urn:sha1:eab78824687cb1a134984c4e8b272809ea127a9b</id>
<content type='text'>
commit e25cc4be4616fcf5689622b3226d648aab253cdb upstream.

This reverts commit b9302fa7ed979e84b454e4ca92192cf485a4ed41.

As Fedor Pchelkin pointed out, this commit violates the
convention of using the macro return value, which causes errors.
For example, in functions tda18271_attach(), xc5000_attach(),
simple_tuner_attach().

Link: https://lore.kernel.org/linux-media/20240424202031.syigrtrtipbq5f2l@fpc/
Suggested-by: Fedor Pchelkin &lt;pchelkin@ispras.ru&gt;
Signed-off-by: Roman Smirnov &lt;r.smirnov@omp.ru&gt;
Signed-off-by: Hans Verkuil &lt;hverkuil-cisco@xs4all.nl&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>media: xc2028: avoid use-after-free in load_firmware_cb()</title>
<updated>2024-08-14T13:34:16Z</updated>
<author>
<name>Chi Zhiling</name>
</author>
<published>2024-06-14T15:22:25Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=208deb6d8c3cb8c3acb1f41eb31cf68ea08726d5'/>
<id>urn:sha1:208deb6d8c3cb8c3acb1f41eb31cf68ea08726d5</id>
<content type='text'>
[ Upstream commit 68594cec291ff9523b9feb3f43fd853dcddd1f60 ]

syzkaller reported use-after-free in load_firmware_cb() [1].
The reason is because the module allocated a struct tuner in tuner_probe(),
and then the module initialization failed, the struct tuner was released.
A worker which created during module initialization accesses this struct
tuner later, it caused use-after-free.

The process is as follows:

task-6504           worker_thread
tuner_probe                             &lt;= alloc dvb_frontend [2]
...
request_firmware_nowait                 &lt;= create a worker
...
tuner_remove                            &lt;= free dvb_frontend
...
                    request_firmware_work_func  &lt;= the firmware is ready
                    load_firmware_cb    &lt;= but now the dvb_frontend has been freed

To fix the issue, check the dvd_frontend in load_firmware_cb(), if it is
null, report a warning and just return.

[1]:
    ==================================================================
     BUG: KASAN: use-after-free in load_firmware_cb+0x1310/0x17a0
     Read of size 8 at addr ffff8000d7ca2308 by task kworker/2:3/6504

     Call trace:
      load_firmware_cb+0x1310/0x17a0
      request_firmware_work_func+0x128/0x220
      process_one_work+0x770/0x1824
      worker_thread+0x488/0xea0
      kthread+0x300/0x430
      ret_from_fork+0x10/0x20

     Allocated by task 6504:
      kzalloc
      tuner_probe+0xb0/0x1430
      i2c_device_probe+0x92c/0xaf0
      really_probe+0x678/0xcd0
      driver_probe_device+0x280/0x370
      __device_attach_driver+0x220/0x330
      bus_for_each_drv+0x134/0x1c0
      __device_attach+0x1f4/0x410
      device_initial_probe+0x20/0x30
      bus_probe_device+0x184/0x200
      device_add+0x924/0x12c0
      device_register+0x24/0x30
      i2c_new_device+0x4e0/0xc44
      v4l2_i2c_new_subdev_board+0xbc/0x290
      v4l2_i2c_new_subdev+0xc8/0x104
      em28xx_v4l2_init+0x1dd0/0x3770

     Freed by task 6504:
      kfree+0x238/0x4e4
      tuner_remove+0x144/0x1c0
      i2c_device_remove+0xc8/0x290
      __device_release_driver+0x314/0x5fc
      device_release_driver+0x30/0x44
      bus_remove_device+0x244/0x490
      device_del+0x350/0x900
      device_unregister+0x28/0xd0
      i2c_unregister_device+0x174/0x1d0
      v4l2_device_unregister+0x224/0x380
      em28xx_v4l2_init+0x1d90/0x3770

     The buggy address belongs to the object at ffff8000d7ca2000
      which belongs to the cache kmalloc-2k of size 2048
     The buggy address is located 776 bytes inside of
      2048-byte region [ffff8000d7ca2000, ffff8000d7ca2800)
     The buggy address belongs to the page:
     page:ffff7fe00035f280 count:1 mapcount:0 mapping:ffff8000c001f000 index:0x0
     flags: 0x7ff800000000100(slab)
     raw: 07ff800000000100 ffff7fe00049d880 0000000300000003 ffff8000c001f000
     raw: 0000000000000000 0000000080100010 00000001ffffffff 0000000000000000
     page dumped because: kasan: bad access detected

     Memory state around the buggy address:
      ffff8000d7ca2200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
      ffff8000d7ca2280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
     &gt;ffff8000d7ca2300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                           ^
      ffff8000d7ca2380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
      ffff8000d7ca2400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
     ==================================================================

[2]
    Actually, it is allocated for struct tuner, and dvb_frontend is inside.

Signed-off-by: Chi Zhiling &lt;chizhiling@kylinos.cn&gt;
Signed-off-by: Hans Verkuil &lt;hverkuil-cisco@xs4all.nl&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>media: tunner: xc5000: Refactor firmware load</title>
<updated>2024-04-15T11:42:38Z</updated>
<author>
<name>Ricardo Ribalda</name>
</author>
<published>2024-04-11T21:17:54Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8e1f5da59dd4a1966f859639860b803a7e8b8bfb'/>
<id>urn:sha1:8e1f5da59dd4a1966f859639860b803a7e8b8bfb</id>
<content type='text'>
Make sure the firmware is released when we leave
xc_load_fw_and_init_tuner()

This change makes smatch happy:
drivers/media/tuners/xc5000.c:1213 xc_load_fw_and_init_tuner() warn: 'fw' from request_firmware() not released on lines: 1213.

Cc: Shuah Khan &lt;shuah.kh@samsung.com&gt;
Signed-off-by: Ricardo Ribalda &lt;ribalda@chromium.org&gt;
Signed-off-by: Hans Verkuil &lt;hverkuil-cisco@xs4all.nl&gt;
</content>
</entry>
<entry>
<title>media: tda18271: remove redundant assignment to variable bcal</title>
<updated>2024-02-16T10:46:32Z</updated>
<author>
<name>Colin Ian King</name>
</author>
<published>2024-02-05T21:49:25Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=83b1a46d6e3adde75571fbe201facf591cb5084e'/>
<id>urn:sha1:83b1a46d6e3adde75571fbe201facf591cb5084e</id>
<content type='text'>
The variable bcal is being initialized with a value that is never
read, it is being re-assigned in both paths of an if statement near
the end of the function. The initialization is redundant and can
be removed.

Cleans up clang scan build warning:
drivers/media/tuners/tda18271-fe.c:473:2: warning: Value stored
to 'bcal' is never read [deadcode.DeadStores]

Signed-off-by: Colin Ian King &lt;colin.i.king@gmail.com&gt;
Signed-off-by: Hans Verkuil &lt;hverkuil-cisco@xs4all.nl&gt;
</content>
</entry>
<entry>
<title>media: xc4000: Fix atomicity violation in xc4000_get_frequency</title>
<updated>2024-02-05T11:57:44Z</updated>
<author>
<name>Gui-Dong Han</name>
</author>
<published>2023-12-22T05:50:30Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=36d503ad547d1c75758a6fcdbec2806f1b6aeb41'/>
<id>urn:sha1:36d503ad547d1c75758a6fcdbec2806f1b6aeb41</id>
<content type='text'>
In xc4000_get_frequency():
	*freq = priv-&gt;freq_hz + priv-&gt;freq_offset;
The code accesses priv-&gt;freq_hz and priv-&gt;freq_offset without holding any
lock.

In xc4000_set_params():
	// Code that updates priv-&gt;freq_hz and priv-&gt;freq_offset
	...

xc4000_get_frequency() and xc4000_set_params() may execute concurrently,
risking inconsistent reads of priv-&gt;freq_hz and priv-&gt;freq_offset. Since
these related data may update during reading, it can result in incorrect
frequency calculation, leading to atomicity violations.

This possible bug is found by an experimental static analysis tool
developed by our team, BassCheck[1]. This tool analyzes the locking APIs
to extract function pairs that can be concurrently executed, and then
analyzes the instructions in the paired functions to identify possible
concurrency bugs including data races and atomicity violations. The above
possible bug is reported when our tool analyzes the source code of
Linux 6.2.

To address this issue, it is proposed to add a mutex lock pair in
xc4000_get_frequency() to ensure atomicity. With this patch applied, our
tool no longer reports the possible bug, with the kernel configuration
allyesconfig for x86_64. Due to the lack of associated hardware, we cannot
test the patch in runtime testing, and just verify it according to the
code logic.

[1] https://sites.google.com/view/basscheck/

Fixes: 4c07e32884ab ("[media] xc4000: Fix get_frequency()")
Cc: stable@vger.kernel.org
Reported-by: BassCheck &lt;bass@buaa.edu.cn&gt;
Signed-off-by: Gui-Dong Han &lt;2045gemini@gmail.com&gt;
Signed-off-by: Hans Verkuil &lt;hverkuil-cisco@xs4all.nl&gt;
</content>
</entry>
<entry>
<title>media: dvb: symbol fixup for dvb_attach()</title>
<updated>2023-09-09T07:15:11Z</updated>
<author>
<name>Greg Kroah-Hartman</name>
</author>
<published>2023-09-08T09:20:36Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=86495af1171e1feec79faa9b64c05c89f46e41d1'/>
<id>urn:sha1:86495af1171e1feec79faa9b64c05c89f46e41d1</id>
<content type='text'>
In commit 9011e49d54dc ("modules: only allow symbol_get of
EXPORT_SYMBOL_GPL modules") the use of symbol_get is properly restricted
to GPL-only marked symbols.  This interacts oddly with the DVB logic
which only uses dvb_attach() to load the dvb driver which then uses
symbol_get().

Fix this up by properly marking all of the dvb_attach attach symbols as
EXPORT_SYMBOL_GPL().

Fixes: 9011e49d54dc ("modules: only allow symbol_get of EXPORT_SYMBOL_GPL modules")
Cc: stable &lt;stable@kernel.org&gt;
Reported-by: Stefan Lippers-Hollmann &lt;s.l-h@gmx.de&gt;
Cc: Mauro Carvalho Chehab &lt;mchehab@kernel.org&gt;
Cc: Christoph Hellwig &lt;hch@lst.de&gt;
Cc: linux-media@vger.kernel.org
Cc: linux-modules@vger.kernel.org
Acked-by: Luis Chamberlain &lt;mcgrof@kernel.org&gt;
Acked-by: Hans Verkuil &lt;hverkuil-cisco@xs4all.nl&gt;
Link: https://lore.kernel.org/r/20230908092035.3815268-2-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>media: tuners: qt1010: replace BUG_ON with a regular error</title>
<updated>2023-07-25T07:24:30Z</updated>
<author>
<name>Hans Verkuil</name>
</author>
<published>2023-07-20T06:20:51Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ee630b29ea44d1851bb6c903f400956604834463'/>
<id>urn:sha1:ee630b29ea44d1851bb6c903f400956604834463</id>
<content type='text'>
BUG_ON is unnecessary here, and in addition it confuses smatch.
Replacing this with an error return help resolve this smatch
warning:

drivers/media/tuners/qt1010.c:350 qt1010_init() error: buffer overflow 'i2c_data' 34 &lt;= 34

Signed-off-by: Hans Verkuil &lt;hverkuil-cisco@xs4all.nl&gt;
</content>
</entry>
<entry>
<title>media: Switch i2c drivers back to use .probe()</title>
<updated>2023-05-25T14:21:21Z</updated>
<author>
<name>Uwe Kleine-König</name>
</author>
<published>2023-05-14T12:04:07Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=aaeb31c00e61f6bdc2e4a3c2c491c5455ed3f7b5'/>
<id>urn:sha1:aaeb31c00e61f6bdc2e4a3c2c491c5455ed3f7b5</id>
<content type='text'>
After commit b8a1a4cd5a98 ("i2c: Provide a temporary .probe_new()
call-back type"), all drivers being converted to .probe_new() and then
commit 03c835f498b5 ("i2c: Switch .probe() to not take an id parameter")
convert back to (the new) .probe() to be able to eventually drop
.probe_new() from struct i2c_driver.

Signed-off-by: Uwe Kleine-König &lt;u.kleine-koenig@pengutronix.de&gt;
Signed-off-by: Hans Verkuil &lt;hverkuil-cisco@xs4all.nl&gt;
</content>
</entry>
<entry>
<title>media: it913x: Convert to platform remove callback returning void</title>
<updated>2023-04-11T14:59:21Z</updated>
<author>
<name>Uwe Kleine-König</name>
</author>
<published>2023-03-26T14:32:24Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=24e79e3d1508cb2bed650b0dff45109362c19812'/>
<id>urn:sha1:24e79e3d1508cb2bed650b0dff45109362c19812</id>
<content type='text'>
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König &lt;u.kleine-koenig@pengutronix.de&gt;
Signed-off-by: Hans Verkuil &lt;hverkuil-cisco@xs4all.nl&gt;
</content>
</entry>
<entry>
<title>media: mxl5005s: Bounds check size used for max array index</title>
<updated>2023-03-19T21:50:49Z</updated>
<author>
<name>Kees Cook</name>
</author>
<published>2023-02-04T18:36:17Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d5872e93fab99e371de97537d7f352cecdf7f92e'/>
<id>urn:sha1:d5872e93fab99e371de97537d7f352cecdf7f92e</id>
<content type='text'>
The use of state-&gt;CH_Ctrl[i].size in a shift operation implies that its
value can be as much as 32, but the state-&gt;CH_Ctrl[i].val array is only
25 in size. Bounds check the size before shifting and looping. Fixes
warnings seen with GCC 13:

../drivers/media/tuners/mxl5005s.c: In function 'MXL_ControlWrite_Group.isra':
../drivers/media/tuners/mxl5005s.c:3450:70: warning: array subscript 32 is above array bounds of 'u16[25]' {aka 'short unsigned int[25]'} [-Warray-bounds=]
 3450 | state-&gt;CH_Ctrl[i].val[j] = (u8)((value &gt;&gt; j) &amp; 0x01);
      |  ~~~~~~~~~~~~~~~~~~~~~^~~
../drivers/media/tuners/mxl5005s.c:238:13: note: while referencing 'val'
  238 |         u16 val[25];    /* Binary representation of Value */
      |             ^~~

Cc: Colin Ian King &lt;colin.i.king@gmail.com&gt;
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: Hans Verkuil &lt;hverkuil-cisco@xs4all.nl&gt;
Signed-off-by: Mauro Carvalho Chehab &lt;mchehab@kernel.org&gt;
</content>
</entry>
</feed>
