<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/cdrom, branch v5.1</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v5.1</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v5.1'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2019-02-08T13:46:59Z</updated>
<entry>
<title>cdrom: Fix race condition in cdrom_sysctl_register</title>
<updated>2019-02-08T13:46:59Z</updated>
<author>
<name>Guenter Roeck</name>
<email>linux@roeck-us.net</email>
</author>
<published>2019-02-07T05:13:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f25191bb322dec8fa2979ecb8235643aa42470e1'/>
<id>urn:sha1:f25191bb322dec8fa2979ecb8235643aa42470e1</id>
<content type='text'>
The following traceback is sometimes seen when booting an image in qemu:

[   54.608293] cdrom: Uniform CD-ROM driver Revision: 3.20
[   54.611085] Fusion MPT base driver 3.04.20
[   54.611877] Copyright (c) 1999-2008 LSI Corporation
[   54.616234] Fusion MPT SAS Host driver 3.04.20
[   54.635139] sysctl duplicate entry: /dev/cdrom//info
[   54.639578] CPU: 0 PID: 266 Comm: kworker/u4:5 Not tainted 5.0.0-rc5 #1
[   54.639578] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015
[   54.641273] Workqueue: events_unbound async_run_entry_fn
[   54.641273] Call Trace:
[   54.641273]  dump_stack+0x67/0x90
[   54.641273]  __register_sysctl_table+0x50b/0x570
[   54.641273]  ? rcu_read_lock_sched_held+0x6f/0x80
[   54.641273]  ? kmem_cache_alloc_trace+0x1c7/0x1f0
[   54.646814]  __register_sysctl_paths+0x1c8/0x1f0
[   54.646814]  cdrom_sysctl_register.part.7+0xc/0x5f
[   54.646814]  register_cdrom.cold.24+0x2a/0x33
[   54.646814]  sr_probe+0x4bd/0x580
[   54.646814]  ? __driver_attach+0xd0/0xd0
[   54.646814]  really_probe+0xd6/0x260
[   54.646814]  ? __driver_attach+0xd0/0xd0
[   54.646814]  driver_probe_device+0x4a/0xb0
[   54.646814]  ? __driver_attach+0xd0/0xd0
[   54.646814]  bus_for_each_drv+0x73/0xc0
[   54.646814]  __device_attach+0xd6/0x130
[   54.646814]  bus_probe_device+0x9a/0xb0
[   54.646814]  device_add+0x40c/0x670
[   54.646814]  ? __pm_runtime_resume+0x4f/0x80
[   54.646814]  scsi_sysfs_add_sdev+0x81/0x290
[   54.646814]  scsi_probe_and_add_lun+0x888/0xc00
[   54.646814]  ? scsi_autopm_get_host+0x21/0x40
[   54.646814]  __scsi_add_device+0x116/0x130
[   54.646814]  ata_scsi_scan_host+0x93/0x1c0
[   54.646814]  async_run_entry_fn+0x34/0x100
[   54.646814]  process_one_work+0x237/0x5e0
[   54.646814]  worker_thread+0x37/0x380
[   54.646814]  ? rescuer_thread+0x360/0x360
[   54.646814]  kthread+0x118/0x130
[   54.646814]  ? kthread_create_on_node+0x60/0x60
[   54.646814]  ret_from_fork+0x3a/0x50

The only sensible explanation is that cdrom_sysctl_register() is called
twice, once from the module init function and once from register_cdrom().
cdrom_sysctl_register() is not mutex protected and may happily execute
twice if the second call is made before the first call is complete.

Use a static atomic to ensure that the function is executed exactly once.

Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>gdrom: fix a memory leak bug</title>
<updated>2018-12-29T15:20:44Z</updated>
<author>
<name>Wenwen Wang</name>
<email>wang6495@umn.edu</email>
</author>
<published>2018-12-27T02:15:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=093c48213ee37c3c3ff1cf5ac1aa2a9d8bc66017'/>
<id>urn:sha1:093c48213ee37c3c3ff1cf5ac1aa2a9d8bc66017</id>
<content type='text'>
In probe_gdrom(), the buffer pointed by 'gd.cd_info' is allocated through
kzalloc() and is used to hold the information of the gdrom device. To
register and unregister the device, the pointer 'gd.cd_info' is passed to
the functions register_cdrom() and unregister_cdrom(), respectively.
However, this buffer is not freed after it is used, which can cause a
memory leak bug.

This patch simply frees the buffer 'gd.cd_info' in exit_gdrom() to fix the
above issue.

Signed-off-by: Wenwen Wang &lt;wang6495@umn.edu&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>gdrom: fix mistake in assignment of error</title>
<updated>2018-10-25T17:17:40Z</updated>
<author>
<name>Jens Axboe</name>
<email>axboe@kernel.dk</email>
</author>
<published>2018-10-25T14:15:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=0a40a93524736c2ce01d82effe2f2bc34d5cf159'/>
<id>urn:sha1:0a40a93524736c2ce01d82effe2f2bc34d5cf159</id>
<content type='text'>
Apparently the kbuild bots missed this one originally, but at least
it caught it now. Fix compilation error:

All errors (new ones prefixed by &gt;&gt;):

   drivers/cdrom/gdrom.c: In function 'probe_gdrom':
&gt;&gt; drivers/cdrom/gdrom.c:797:3: error: 'rc' undeclared (first use in this function)
      rc = PTR_ERR(gd.gdrom_rq);
      ^~
   drivers/cdrom/gdrom.c:797:3: note: each undeclared identifier is reported only once for each function it appears in

Fixes: ad5fc6bb7221 ("gdrom: convert to blk-mq")
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>cdrom: remove set but not used variable 'tocuse'</title>
<updated>2018-10-25T17:17:39Z</updated>
<author>
<name>zhong jiang</name>
<email>zhongjiang@huawei.com</email>
</author>
<published>2018-10-23T12:06:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=cdffab7a86b05b207907c391c093023daed5d4a4'/>
<id>urn:sha1:cdffab7a86b05b207907c391c093023daed5d4a4</id>
<content type='text'>
tocuse is not used after setting its value. It is safe to remove
the unused variable.

Signed-off-by: zhong jiang &lt;zhongjiang@huawei.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>gdrom: convert to blk-mq</title>
<updated>2018-10-16T15:50:39Z</updated>
<author>
<name>Jens Axboe</name>
<email>axboe@kernel.dk</email>
</author>
<published>2018-10-15T15:01:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ad5fc6bb72214615f300af1f4ed57f71bc3be510'/>
<id>urn:sha1:ad5fc6bb72214615f300af1f4ed57f71bc3be510</id>
<content type='text'>
Ditch the deffered list, lock, and workqueue handling. Just mark the
set as being blocking, so we are invoked from a workqueue already.

Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>cdrom: don't attempt to fiddle with cdo-&gt;capability</title>
<updated>2018-10-14T19:20:48Z</updated>
<author>
<name>Jens Axboe</name>
<email>axboe@kernel.dk</email>
</author>
<published>2018-10-14T19:20:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8f94004e2a51a3ea195cf3447eb5d5906f36d8b3'/>
<id>urn:sha1:8f94004e2a51a3ea195cf3447eb5d5906f36d8b3</id>
<content type='text'>
We can't modify cdo-&gt;capability as it is defined as a const.
Change the modification hack to just WARN_ON_ONCE() if we hit
any of the invalid combinations.

This fixes a regression for pcd, which doesn't work after the
constify patch.

Fixes: 853fe1bf7554 ("cdrom: Make device operations read-only")
Tested-by: Ondrej Zary &lt;linux@rainbow-software.org&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>cdrom: fix improper type cast, which can leat to information leak.</title>
<updated>2018-10-03T16:20:40Z</updated>
<author>
<name>Young_X</name>
<email>YangX92@hotmail.com</email>
</author>
<published>2018-10-03T12:54:29Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e4f3aa2e1e67bb48dfbaaf1cad59013d5a5bc276'/>
<id>urn:sha1:e4f3aa2e1e67bb48dfbaaf1cad59013d5a5bc276</id>
<content type='text'>
There is another cast from unsigned long to int which causes
a bounds check to fail with specially crafted input. The value is
then used as an index in the slot array in cdrom_slot_status().

This issue is similar to CVE-2018-16658 and CVE-2018-10940.

Signed-off-by: Young_X &lt;YangX92@hotmail.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>cdrom: Fix info leak/OOB read in cdrom_ioctl_drive_status</title>
<updated>2018-08-29T14:09:20Z</updated>
<author>
<name>Scott Bauer</name>
<email>scott.bauer@intel.com</email>
</author>
<published>2018-04-26T17:51:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8f3fafc9c2f0ece10832c25f7ffcb07c97a32ad4'/>
<id>urn:sha1:8f3fafc9c2f0ece10832c25f7ffcb07c97a32ad4</id>
<content type='text'>
Like d88b6d04: "cdrom: information leak in cdrom_ioctl_media_changed()"

There is another cast from unsigned long to int which causes
a bounds check to fail with specially crafted input. The value is
then used as an index in the slot array in cdrom_slot_status().

Signed-off-by: Scott Bauer &lt;scott.bauer@intel.com&gt;
Signed-off-by: Scott Bauer &lt;sbauer@plzdonthack.me&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>cdrom: Use struct scsi_sense_hdr internally</title>
<updated>2018-08-02T21:22:39Z</updated>
<author>
<name>Kees Cook</name>
<email>keescook@chromium.org</email>
</author>
<published>2018-07-31T19:51:52Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=4e178c17cac07d58df7d31ef6fe10036cfa3883d'/>
<id>urn:sha1:4e178c17cac07d58df7d31ef6fe10036cfa3883d</id>
<content type='text'>
This removes more casts of struct request_sense and uses the standard
struct scsi_sense_hdr instead. This also fixes any possible stale values
since the prior code did not check the sense length.

Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block: Switch struct packet_command to use struct scsi_sense_hdr</title>
<updated>2018-08-02T21:22:13Z</updated>
<author>
<name>Kees Cook</name>
<email>keescook@chromium.org</email>
</author>
<published>2018-08-02T21:22:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e7d0748dd71695b94f3a35c8bdc05226a7f3d919'/>
<id>urn:sha1:e7d0748dd71695b94f3a35c8bdc05226a7f3d919</id>
<content type='text'>
There is a lot of needless struct request_sense usage in the CDROM
code. These can all be struct scsi_sense_hdr instead, to avoid any
confusion over their respective structure sizes. This patch is a lot
of noise changing "sense" to "sshdr", but the final code is more
readable to distinguish between "sense" meaning "struct request_sense"
and "sshdr" meaning "struct scsi_sense_hdr".

Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
</feed>
