<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux.git/block, branch v3.10.65</title>
<subtitle>Clone of https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git</subtitle>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/'/>
<entry>
<title>genhd: check for int overflow in disk_expand_part_tbl()</title>
<updated>2015-01-16T14:59:02+00:00</updated>
<author>
<name>Jens Axboe</name>
<email>axboe@fb.com</email>
</author>
<published>2014-11-19T20:06:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=dd4fb6fc5dd2e85e65222f0e5e1e321dec9fc2b7'/>
<id>dd4fb6fc5dd2e85e65222f0e5e1e321dec9fc2b7</id>
<content type='text'>
commit 5fabcb4c33fe11c7e3afdf805fde26c1a54d0953 upstream.

We can get here from blkdev_ioctl() -&gt; blkpg_ioctl() -&gt; add_partition()
with a user passed in partno value. If we pass in 0x7fffffff, the
new target in disk_expand_part_tbl() overflows the 'int' and we
access beyond the end of ptbl-&gt;part[] and even write to it when we
do the rcu_assign_pointer() to assign the new partition.

Reported-by: David Ramos &lt;daramos@stanford.edu&gt;
Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 5fabcb4c33fe11c7e3afdf805fde26c1a54d0953 upstream.

We can get here from blkdev_ioctl() -&gt; blkpg_ioctl() -&gt; add_partition()
with a user passed in partno value. If we pass in 0x7fffffff, the
new target in disk_expand_part_tbl() overflows the 'int' and we
access beyond the end of ptbl-&gt;part[] and even write to it when we
do the rcu_assign_pointer() to assign the new partition.

Reported-by: David Ramos &lt;daramos@stanford.edu&gt;
Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>scsi: Fix error handling in SCSI_IOCTL_SEND_COMMAND</title>
<updated>2014-11-14T16:47:59+00:00</updated>
<author>
<name>Jan Kara</name>
<email>jack@suse.cz</email>
</author>
<published>2014-10-23T02:13:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=7d3a9bd9615685af8858e208aecccbf285022b99'/>
<id>7d3a9bd9615685af8858e208aecccbf285022b99</id>
<content type='text'>
commit 84ce0f0e94ac97217398b3b69c21c7a62ebeed05 upstream.

When sg_scsi_ioctl() fails to prepare request to submit in
blk_rq_map_kern() we jump to a label where we just end up copying
(luckily zeroed-out) kernel buffer to userspace instead of reporting
error. Fix the problem by jumping to the right label.

CC: Jens Axboe &lt;axboe@kernel.dk&gt;
CC: linux-scsi@vger.kernel.org
Coverity-id: 1226871
Signed-off-by: Jan Kara &lt;jack@suse.cz&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

Fixed up the, now unused, out label.

Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 84ce0f0e94ac97217398b3b69c21c7a62ebeed05 upstream.

When sg_scsi_ioctl() fails to prepare request to submit in
blk_rq_map_kern() we jump to a label where we just end up copying
(luckily zeroed-out) kernel buffer to userspace instead of reporting
error. Fix the problem by jumping to the right label.

CC: Jens Axboe &lt;axboe@kernel.dk&gt;
CC: linux-scsi@vger.kernel.org
Coverity-id: 1226871
Signed-off-by: Jan Kara &lt;jack@suse.cz&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

Fixed up the, now unused, out label.

Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>block: fix alignment_offset math that assumes io_min is a power-of-2</title>
<updated>2014-11-14T16:47:55+00:00</updated>
<author>
<name>Mike Snitzer</name>
<email>snitzer@redhat.com</email>
</author>
<published>2014-10-08T22:26:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=a63bea06c1617175c68677da4810dfd120da2bd5'/>
<id>a63bea06c1617175c68677da4810dfd120da2bd5</id>
<content type='text'>
commit b8839b8c55f3fdd60dc36abcda7e0266aff7985c upstream.

The math in both blk_stack_limits() and queue_limit_alignment_offset()
assume that a block device's io_min (aka minimum_io_size) is always a
power-of-2.  Fix the math such that it works for non-power-of-2 io_min.

This issue (of alignment_offset != 0) became apparent when testing
dm-thinp with a thinp blocksize that matches a RAID6 stripesize of
1280K.  Commit fdfb4c8c1 ("dm thin: set minimum_io_size to pool's data
block size") unlocked the potential for alignment_offset != 0 due to
the dm-thin-pool's io_min possibly being a non-power-of-2.

Signed-off-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Acked-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit b8839b8c55f3fdd60dc36abcda7e0266aff7985c upstream.

The math in both blk_stack_limits() and queue_limit_alignment_offset()
assume that a block device's io_min (aka minimum_io_size) is always a
power-of-2.  Fix the math such that it works for non-power-of-2 io_min.

This issue (of alignment_offset != 0) became apparent when testing
dm-thinp with a thinp blocksize that matches a RAID6 stripesize of
1280K.  Commit fdfb4c8c1 ("dm thin: set minimum_io_size to pool's data
block size") unlocked the potential for alignment_offset != 0 due to
the dm-thin-pool's io_min possibly being a non-power-of-2.

Signed-off-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Acked-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>genhd: fix leftover might_sleep() in blk_free_devt()</title>
<updated>2014-10-05T21:54:13+00:00</updated>
<author>
<name>Jens Axboe</name>
<email>axboe@fb.com</email>
</author>
<published>2014-09-16T19:38:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=459bd57b368c583f53faf84cf8e483837584f9ae'/>
<id>459bd57b368c583f53faf84cf8e483837584f9ae</id>
<content type='text'>
commit 46f341ffcfb5d8530f7d1e60f3be06cce6661b62 upstream.

Commit 2da78092 changed the locking from a mutex to a spinlock,
so we now longer sleep in this context. But there was a leftover
might_sleep() in there, which now triggers since we do the final
free from an RCU callback. Get rid of it.

Reported-by: Pontus Fuchs &lt;pontus.fuchs@gmail.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 46f341ffcfb5d8530f7d1e60f3be06cce6661b62 upstream.

Commit 2da78092 changed the locking from a mutex to a spinlock,
so we now longer sleep in this context. But there was a leftover
might_sleep() in there, which now triggers since we do the final
free from an RCU callback. Get rid of it.

Reported-by: Pontus Fuchs &lt;pontus.fuchs@gmail.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>block: Fix dev_t minor allocation lifetime</title>
<updated>2014-10-05T21:54:12+00:00</updated>
<author>
<name>Keith Busch</name>
<email>keith.busch@intel.com</email>
</author>
<published>2014-08-26T15:05:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=3710e26e8c32de6f68ec8810191b3b6c3217dad8'/>
<id>3710e26e8c32de6f68ec8810191b3b6c3217dad8</id>
<content type='text'>
commit 2da78092dda13f1efd26edbbf99a567776913750 upstream.

Releases the dev_t minor when all references are closed to prevent
another device from acquiring the same major/minor.

Since the partition's release may be invoked from call_rcu's soft-irq
context, the ext_dev_idr's mutex had to be replaced with a spinlock so
as not so sleep.

Signed-off-by: Keith Busch &lt;keith.busch@intel.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 2da78092dda13f1efd26edbbf99a567776913750 upstream.

Releases the dev_t minor when all references are closed to prevent
another device from acquiring the same major/minor.

Since the partition's release may be invoked from call_rcu's soft-irq
context, the ext_dev_idr's mutex had to be replaced with a spinlock so
as not so sleep.

Signed-off-by: Keith Busch &lt;keith.busch@intel.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>cfq-iosched: Fix wrong children_weight calculation</title>
<updated>2014-10-05T21:54:08+00:00</updated>
<author>
<name>Toshiaki Makita</name>
<email>makita.toshiaki@lab.ntt.co.jp</email>
</author>
<published>2014-08-26T11:56:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=fe63ce5175e58b55d9fa5805d24faffcad214760'/>
<id>fe63ce5175e58b55d9fa5805d24faffcad214760</id>
<content type='text'>
commit e15693ef18e13e3e6bffe891fe140f18b8ff6d07 upstream.

cfq_group_service_tree_add() is applying new_weight at the beginning of
the function via cfq_update_group_weight().
This actually allows weight to change between adding it to and subtracting
it from children_weight, and triggers WARN_ON_ONCE() in
cfq_group_service_tree_del(), or even causes oops by divide error during
vfr calculation in cfq_group_service_tree_add().

The detailed scenario is as follows:
1. Create blkio cgroups X and Y as a child of X.
   Set X's weight to 500 and perform some I/O to apply new_weight.
   This X's I/O completes before starting Y's I/O.
2. Y starts I/O and cfq_group_service_tree_add() is called with Y.
3. cfq_group_service_tree_add() walks up the tree during children_weight
   calculation and adds parent X's weight (500) to children_weight of root.
   children_weight becomes 500.
4. Set X's weight to 1000.
5. X starts I/O and cfq_group_service_tree_add() is called with X.
6. cfq_group_service_tree_add() applies its new_weight (1000).
7. I/O of Y completes and cfq_group_service_tree_del() is called with Y.
8. I/O of X completes and cfq_group_service_tree_del() is called with X.
9. cfq_group_service_tree_del() subtracts X's weight (1000) from
   children_weight of root. children_weight becomes -500.
   This triggers WARN_ON_ONCE().
10. Set X's weight to 500.
11. X starts I/O and cfq_group_service_tree_add() is called with X.
12. cfq_group_service_tree_add() applies its new_weight (500) and adds it
    to children_weight of root. children_weight becomes 0. Calcularion of
    vfr triggers oops by divide error.

weight should be updated right before adding it to children_weight.

Reported-by: Ruki Sekiya &lt;sekiya.ruki@lab.ntt.co.jp&gt;
Signed-off-by: Toshiaki Makita &lt;makita.toshiaki@lab.ntt.co.jp&gt;
Acked-by: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit e15693ef18e13e3e6bffe891fe140f18b8ff6d07 upstream.

cfq_group_service_tree_add() is applying new_weight at the beginning of
the function via cfq_update_group_weight().
This actually allows weight to change between adding it to and subtracting
it from children_weight, and triggers WARN_ON_ONCE() in
cfq_group_service_tree_del(), or even causes oops by divide error during
vfr calculation in cfq_group_service_tree_add().

The detailed scenario is as follows:
1. Create blkio cgroups X and Y as a child of X.
   Set X's weight to 500 and perform some I/O to apply new_weight.
   This X's I/O completes before starting Y's I/O.
2. Y starts I/O and cfq_group_service_tree_add() is called with Y.
3. cfq_group_service_tree_add() walks up the tree during children_weight
   calculation and adds parent X's weight (500) to children_weight of root.
   children_weight becomes 500.
4. Set X's weight to 1000.
5. X starts I/O and cfq_group_service_tree_add() is called with X.
6. cfq_group_service_tree_add() applies its new_weight (1000).
7. I/O of Y completes and cfq_group_service_tree_del() is called with Y.
8. I/O of X completes and cfq_group_service_tree_del() is called with X.
9. cfq_group_service_tree_del() subtracts X's weight (1000) from
   children_weight of root. children_weight becomes -500.
   This triggers WARN_ON_ONCE().
10. Set X's weight to 500.
11. X starts I/O and cfq_group_service_tree_add() is called with X.
12. cfq_group_service_tree_add() applies its new_weight (500) and adds it
    to children_weight of root. children_weight becomes 0. Calcularion of
    vfr triggers oops by divide error.

weight should be updated right before adding it to children_weight.

Reported-by: Ruki Sekiya &lt;sekiya.ruki@lab.ntt.co.jp&gt;
Signed-off-by: Toshiaki Makita &lt;makita.toshiaki@lab.ntt.co.jp&gt;
Acked-by: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>blkcg: don't call into policy draining if root_blkg is already gone</title>
<updated>2014-09-17T16:04:02+00:00</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2014-07-05T22:43:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=f5b48b7a3d0d1ab761ba939b6cbb4a07d37a750b'/>
<id>f5b48b7a3d0d1ab761ba939b6cbb4a07d37a750b</id>
<content type='text'>
commit 2a1b4cf2331d92bc009bf94fa02a24604cdaf24c upstream.

While a queue is being destroyed, all the blkgs are destroyed and its
-&gt;root_blkg pointer is set to NULL.  If someone else starts to drain
while the queue is in this state, the following oops happens.

  NULL pointer dereference at 0000000000000028
  IP: [&lt;ffffffff8144e944&gt;] blk_throtl_drain+0x84/0x230
  PGD e4a1067 PUD b773067 PMD 0
  Oops: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC
  Modules linked in: cfq_iosched(-) [last unloaded: cfq_iosched]
  CPU: 1 PID: 537 Comm: bash Not tainted 3.16.0-rc3-work+ #2
  Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
  task: ffff88000e222250 ti: ffff88000efd4000 task.ti: ffff88000efd4000
  RIP: 0010:[&lt;ffffffff8144e944&gt;]  [&lt;ffffffff8144e944&gt;] blk_throtl_drain+0x84/0x230
  RSP: 0018:ffff88000efd7bf0  EFLAGS: 00010046
  RAX: 0000000000000000 RBX: ffff880015091450 RCX: 0000000000000001
  RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
  RBP: ffff88000efd7c10 R08: 0000000000000000 R09: 0000000000000001
  R10: ffff88000e222250 R11: 0000000000000000 R12: ffff880015091450
  R13: ffff880015092e00 R14: ffff880015091d70 R15: ffff88001508fc28
  FS:  00007f1332650740(0000) GS:ffff88001fa80000(0000) knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
  CR2: 0000000000000028 CR3: 0000000009446000 CR4: 00000000000006e0
  Stack:
   ffffffff8144e8f6 ffff880015091450 0000000000000000 ffff880015091d80
   ffff88000efd7c28 ffffffff8144ae2f ffff880015091450 ffff88000efd7c58
   ffffffff81427641 ffff880015091450 ffffffff82401f00 ffff880015091450
  Call Trace:
   [&lt;ffffffff8144ae2f&gt;] blkcg_drain_queue+0x1f/0x60
   [&lt;ffffffff81427641&gt;] __blk_drain_queue+0x71/0x180
   [&lt;ffffffff81429b3e&gt;] blk_queue_bypass_start+0x6e/0xb0
   [&lt;ffffffff814498b8&gt;] blkcg_deactivate_policy+0x38/0x120
   [&lt;ffffffff8144ec44&gt;] blk_throtl_exit+0x34/0x50
   [&lt;ffffffff8144aea5&gt;] blkcg_exit_queue+0x35/0x40
   [&lt;ffffffff8142d476&gt;] blk_release_queue+0x26/0xd0
   [&lt;ffffffff81454968&gt;] kobject_cleanup+0x38/0x70
   [&lt;ffffffff81454848&gt;] kobject_put+0x28/0x60
   [&lt;ffffffff81427505&gt;] blk_put_queue+0x15/0x20
   [&lt;ffffffff817d07bb&gt;] scsi_device_dev_release_usercontext+0x16b/0x1c0
   [&lt;ffffffff810bc339&gt;] execute_in_process_context+0x89/0xa0
   [&lt;ffffffff817d064c&gt;] scsi_device_dev_release+0x1c/0x20
   [&lt;ffffffff817930e2&gt;] device_release+0x32/0xa0
   [&lt;ffffffff81454968&gt;] kobject_cleanup+0x38/0x70
   [&lt;ffffffff81454848&gt;] kobject_put+0x28/0x60
   [&lt;ffffffff817934d7&gt;] put_device+0x17/0x20
   [&lt;ffffffff817d11b9&gt;] __scsi_remove_device+0xa9/0xe0
   [&lt;ffffffff817d121b&gt;] scsi_remove_device+0x2b/0x40
   [&lt;ffffffff817d1257&gt;] sdev_store_delete+0x27/0x30
   [&lt;ffffffff81792ca8&gt;] dev_attr_store+0x18/0x30
   [&lt;ffffffff8126f75e&gt;] sysfs_kf_write+0x3e/0x50
   [&lt;ffffffff8126ea87&gt;] kernfs_fop_write+0xe7/0x170
   [&lt;ffffffff811f5e9f&gt;] vfs_write+0xaf/0x1d0
   [&lt;ffffffff811f69bd&gt;] SyS_write+0x4d/0xc0
   [&lt;ffffffff81d24692&gt;] system_call_fastpath+0x16/0x1b

776687bce42b ("block, blk-mq: draining can't be skipped even if
bypass_depth was non-zero") made it easier to trigger this bug by
making blk_queue_bypass_start() drain even when it loses the first
bypass test to blk_cleanup_queue(); however, the bug has always been
there even before the commit as blk_queue_bypass_start() could race
against queue destruction, win the initial bypass test but perform the
actual draining after blk_cleanup_queue() already destroyed all blkgs.

Fix it by skippping calling into policy draining if all the blkgs are
already gone.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Reported-by: Shirish Pargaonkar &lt;spargaonkar@suse.com&gt;
Reported-by: Sasha Levin &lt;sasha.levin@oracle.com&gt;
Reported-by: Jet Chen &lt;jet.chen@intel.com&gt;
Tested-by: Shirish Pargaonkar &lt;spargaonkar@suse.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 2a1b4cf2331d92bc009bf94fa02a24604cdaf24c upstream.

While a queue is being destroyed, all the blkgs are destroyed and its
-&gt;root_blkg pointer is set to NULL.  If someone else starts to drain
while the queue is in this state, the following oops happens.

  NULL pointer dereference at 0000000000000028
  IP: [&lt;ffffffff8144e944&gt;] blk_throtl_drain+0x84/0x230
  PGD e4a1067 PUD b773067 PMD 0
  Oops: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC
  Modules linked in: cfq_iosched(-) [last unloaded: cfq_iosched]
  CPU: 1 PID: 537 Comm: bash Not tainted 3.16.0-rc3-work+ #2
  Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
  task: ffff88000e222250 ti: ffff88000efd4000 task.ti: ffff88000efd4000
  RIP: 0010:[&lt;ffffffff8144e944&gt;]  [&lt;ffffffff8144e944&gt;] blk_throtl_drain+0x84/0x230
  RSP: 0018:ffff88000efd7bf0  EFLAGS: 00010046
  RAX: 0000000000000000 RBX: ffff880015091450 RCX: 0000000000000001
  RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
  RBP: ffff88000efd7c10 R08: 0000000000000000 R09: 0000000000000001
  R10: ffff88000e222250 R11: 0000000000000000 R12: ffff880015091450
  R13: ffff880015092e00 R14: ffff880015091d70 R15: ffff88001508fc28
  FS:  00007f1332650740(0000) GS:ffff88001fa80000(0000) knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
  CR2: 0000000000000028 CR3: 0000000009446000 CR4: 00000000000006e0
  Stack:
   ffffffff8144e8f6 ffff880015091450 0000000000000000 ffff880015091d80
   ffff88000efd7c28 ffffffff8144ae2f ffff880015091450 ffff88000efd7c58
   ffffffff81427641 ffff880015091450 ffffffff82401f00 ffff880015091450
  Call Trace:
   [&lt;ffffffff8144ae2f&gt;] blkcg_drain_queue+0x1f/0x60
   [&lt;ffffffff81427641&gt;] __blk_drain_queue+0x71/0x180
   [&lt;ffffffff81429b3e&gt;] blk_queue_bypass_start+0x6e/0xb0
   [&lt;ffffffff814498b8&gt;] blkcg_deactivate_policy+0x38/0x120
   [&lt;ffffffff8144ec44&gt;] blk_throtl_exit+0x34/0x50
   [&lt;ffffffff8144aea5&gt;] blkcg_exit_queue+0x35/0x40
   [&lt;ffffffff8142d476&gt;] blk_release_queue+0x26/0xd0
   [&lt;ffffffff81454968&gt;] kobject_cleanup+0x38/0x70
   [&lt;ffffffff81454848&gt;] kobject_put+0x28/0x60
   [&lt;ffffffff81427505&gt;] blk_put_queue+0x15/0x20
   [&lt;ffffffff817d07bb&gt;] scsi_device_dev_release_usercontext+0x16b/0x1c0
   [&lt;ffffffff810bc339&gt;] execute_in_process_context+0x89/0xa0
   [&lt;ffffffff817d064c&gt;] scsi_device_dev_release+0x1c/0x20
   [&lt;ffffffff817930e2&gt;] device_release+0x32/0xa0
   [&lt;ffffffff81454968&gt;] kobject_cleanup+0x38/0x70
   [&lt;ffffffff81454848&gt;] kobject_put+0x28/0x60
   [&lt;ffffffff817934d7&gt;] put_device+0x17/0x20
   [&lt;ffffffff817d11b9&gt;] __scsi_remove_device+0xa9/0xe0
   [&lt;ffffffff817d121b&gt;] scsi_remove_device+0x2b/0x40
   [&lt;ffffffff817d1257&gt;] sdev_store_delete+0x27/0x30
   [&lt;ffffffff81792ca8&gt;] dev_attr_store+0x18/0x30
   [&lt;ffffffff8126f75e&gt;] sysfs_kf_write+0x3e/0x50
   [&lt;ffffffff8126ea87&gt;] kernfs_fop_write+0xe7/0x170
   [&lt;ffffffff811f5e9f&gt;] vfs_write+0xaf/0x1d0
   [&lt;ffffffff811f69bd&gt;] SyS_write+0x4d/0xc0
   [&lt;ffffffff81d24692&gt;] system_call_fastpath+0x16/0x1b

776687bce42b ("block, blk-mq: draining can't be skipped even if
bypass_depth was non-zero") made it easier to trigger this bug by
making blk_queue_bypass_start() drain even when it loses the first
bypass test to blk_cleanup_queue(); however, the bug has always been
there even before the commit as blk_queue_bypass_start() could race
against queue destruction, win the initial bypass test but perform the
actual draining after blk_cleanup_queue() already destroyed all blkgs.

Fix it by skippping calling into policy draining if all the blkgs are
already gone.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Reported-by: Shirish Pargaonkar &lt;spargaonkar@suse.com&gt;
Reported-by: Sasha Levin &lt;sasha.levin@oracle.com&gt;
Reported-by: Jet Chen &lt;jet.chen@intel.com&gt;
Tested-by: Shirish Pargaonkar &lt;spargaonkar@suse.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>blkcg: don't call into policy draining if root_blkg is already gone</title>
<updated>2014-07-31T19:53:49+00:00</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2014-07-05T22:43:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=cebdb6fa24dfd48af3bba1af6ba485b45430fb1c'/>
<id>cebdb6fa24dfd48af3bba1af6ba485b45430fb1c</id>
<content type='text'>
commit 0b462c89e31f7eb6789713437eb551833ee16ff3 upstream.

While a queue is being destroyed, all the blkgs are destroyed and its
-&gt;root_blkg pointer is set to NULL.  If someone else starts to drain
while the queue is in this state, the following oops happens.

  NULL pointer dereference at 0000000000000028
  IP: [&lt;ffffffff8144e944&gt;] blk_throtl_drain+0x84/0x230
  PGD e4a1067 PUD b773067 PMD 0
  Oops: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC
  Modules linked in: cfq_iosched(-) [last unloaded: cfq_iosched]
  CPU: 1 PID: 537 Comm: bash Not tainted 3.16.0-rc3-work+ #2
  Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
  task: ffff88000e222250 ti: ffff88000efd4000 task.ti: ffff88000efd4000
  RIP: 0010:[&lt;ffffffff8144e944&gt;]  [&lt;ffffffff8144e944&gt;] blk_throtl_drain+0x84/0x230
  RSP: 0018:ffff88000efd7bf0  EFLAGS: 00010046
  RAX: 0000000000000000 RBX: ffff880015091450 RCX: 0000000000000001
  RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
  RBP: ffff88000efd7c10 R08: 0000000000000000 R09: 0000000000000001
  R10: ffff88000e222250 R11: 0000000000000000 R12: ffff880015091450
  R13: ffff880015092e00 R14: ffff880015091d70 R15: ffff88001508fc28
  FS:  00007f1332650740(0000) GS:ffff88001fa80000(0000) knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
  CR2: 0000000000000028 CR3: 0000000009446000 CR4: 00000000000006e0
  Stack:
   ffffffff8144e8f6 ffff880015091450 0000000000000000 ffff880015091d80
   ffff88000efd7c28 ffffffff8144ae2f ffff880015091450 ffff88000efd7c58
   ffffffff81427641 ffff880015091450 ffffffff82401f00 ffff880015091450
  Call Trace:
   [&lt;ffffffff8144ae2f&gt;] blkcg_drain_queue+0x1f/0x60
   [&lt;ffffffff81427641&gt;] __blk_drain_queue+0x71/0x180
   [&lt;ffffffff81429b3e&gt;] blk_queue_bypass_start+0x6e/0xb0
   [&lt;ffffffff814498b8&gt;] blkcg_deactivate_policy+0x38/0x120
   [&lt;ffffffff8144ec44&gt;] blk_throtl_exit+0x34/0x50
   [&lt;ffffffff8144aea5&gt;] blkcg_exit_queue+0x35/0x40
   [&lt;ffffffff8142d476&gt;] blk_release_queue+0x26/0xd0
   [&lt;ffffffff81454968&gt;] kobject_cleanup+0x38/0x70
   [&lt;ffffffff81454848&gt;] kobject_put+0x28/0x60
   [&lt;ffffffff81427505&gt;] blk_put_queue+0x15/0x20
   [&lt;ffffffff817d07bb&gt;] scsi_device_dev_release_usercontext+0x16b/0x1c0
   [&lt;ffffffff810bc339&gt;] execute_in_process_context+0x89/0xa0
   [&lt;ffffffff817d064c&gt;] scsi_device_dev_release+0x1c/0x20
   [&lt;ffffffff817930e2&gt;] device_release+0x32/0xa0
   [&lt;ffffffff81454968&gt;] kobject_cleanup+0x38/0x70
   [&lt;ffffffff81454848&gt;] kobject_put+0x28/0x60
   [&lt;ffffffff817934d7&gt;] put_device+0x17/0x20
   [&lt;ffffffff817d11b9&gt;] __scsi_remove_device+0xa9/0xe0
   [&lt;ffffffff817d121b&gt;] scsi_remove_device+0x2b/0x40
   [&lt;ffffffff817d1257&gt;] sdev_store_delete+0x27/0x30
   [&lt;ffffffff81792ca8&gt;] dev_attr_store+0x18/0x30
   [&lt;ffffffff8126f75e&gt;] sysfs_kf_write+0x3e/0x50
   [&lt;ffffffff8126ea87&gt;] kernfs_fop_write+0xe7/0x170
   [&lt;ffffffff811f5e9f&gt;] vfs_write+0xaf/0x1d0
   [&lt;ffffffff811f69bd&gt;] SyS_write+0x4d/0xc0
   [&lt;ffffffff81d24692&gt;] system_call_fastpath+0x16/0x1b

776687bce42b ("block, blk-mq: draining can't be skipped even if
bypass_depth was non-zero") made it easier to trigger this bug by
making blk_queue_bypass_start() drain even when it loses the first
bypass test to blk_cleanup_queue(); however, the bug has always been
there even before the commit as blk_queue_bypass_start() could race
against queue destruction, win the initial bypass test but perform the
actual draining after blk_cleanup_queue() already destroyed all blkgs.

Fix it by skippping calling into policy draining if all the blkgs are
already gone.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Reported-by: Shirish Pargaonkar &lt;spargaonkar@suse.com&gt;
Reported-by: Sasha Levin &lt;sasha.levin@oracle.com&gt;
Reported-by: Jet Chen &lt;jet.chen@intel.com&gt;
Tested-by: Shirish Pargaonkar &lt;spargaonkar@suse.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 0b462c89e31f7eb6789713437eb551833ee16ff3 upstream.

While a queue is being destroyed, all the blkgs are destroyed and its
-&gt;root_blkg pointer is set to NULL.  If someone else starts to drain
while the queue is in this state, the following oops happens.

  NULL pointer dereference at 0000000000000028
  IP: [&lt;ffffffff8144e944&gt;] blk_throtl_drain+0x84/0x230
  PGD e4a1067 PUD b773067 PMD 0
  Oops: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC
  Modules linked in: cfq_iosched(-) [last unloaded: cfq_iosched]
  CPU: 1 PID: 537 Comm: bash Not tainted 3.16.0-rc3-work+ #2
  Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
  task: ffff88000e222250 ti: ffff88000efd4000 task.ti: ffff88000efd4000
  RIP: 0010:[&lt;ffffffff8144e944&gt;]  [&lt;ffffffff8144e944&gt;] blk_throtl_drain+0x84/0x230
  RSP: 0018:ffff88000efd7bf0  EFLAGS: 00010046
  RAX: 0000000000000000 RBX: ffff880015091450 RCX: 0000000000000001
  RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
  RBP: ffff88000efd7c10 R08: 0000000000000000 R09: 0000000000000001
  R10: ffff88000e222250 R11: 0000000000000000 R12: ffff880015091450
  R13: ffff880015092e00 R14: ffff880015091d70 R15: ffff88001508fc28
  FS:  00007f1332650740(0000) GS:ffff88001fa80000(0000) knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
  CR2: 0000000000000028 CR3: 0000000009446000 CR4: 00000000000006e0
  Stack:
   ffffffff8144e8f6 ffff880015091450 0000000000000000 ffff880015091d80
   ffff88000efd7c28 ffffffff8144ae2f ffff880015091450 ffff88000efd7c58
   ffffffff81427641 ffff880015091450 ffffffff82401f00 ffff880015091450
  Call Trace:
   [&lt;ffffffff8144ae2f&gt;] blkcg_drain_queue+0x1f/0x60
   [&lt;ffffffff81427641&gt;] __blk_drain_queue+0x71/0x180
   [&lt;ffffffff81429b3e&gt;] blk_queue_bypass_start+0x6e/0xb0
   [&lt;ffffffff814498b8&gt;] blkcg_deactivate_policy+0x38/0x120
   [&lt;ffffffff8144ec44&gt;] blk_throtl_exit+0x34/0x50
   [&lt;ffffffff8144aea5&gt;] blkcg_exit_queue+0x35/0x40
   [&lt;ffffffff8142d476&gt;] blk_release_queue+0x26/0xd0
   [&lt;ffffffff81454968&gt;] kobject_cleanup+0x38/0x70
   [&lt;ffffffff81454848&gt;] kobject_put+0x28/0x60
   [&lt;ffffffff81427505&gt;] blk_put_queue+0x15/0x20
   [&lt;ffffffff817d07bb&gt;] scsi_device_dev_release_usercontext+0x16b/0x1c0
   [&lt;ffffffff810bc339&gt;] execute_in_process_context+0x89/0xa0
   [&lt;ffffffff817d064c&gt;] scsi_device_dev_release+0x1c/0x20
   [&lt;ffffffff817930e2&gt;] device_release+0x32/0xa0
   [&lt;ffffffff81454968&gt;] kobject_cleanup+0x38/0x70
   [&lt;ffffffff81454848&gt;] kobject_put+0x28/0x60
   [&lt;ffffffff817934d7&gt;] put_device+0x17/0x20
   [&lt;ffffffff817d11b9&gt;] __scsi_remove_device+0xa9/0xe0
   [&lt;ffffffff817d121b&gt;] scsi_remove_device+0x2b/0x40
   [&lt;ffffffff817d1257&gt;] sdev_store_delete+0x27/0x30
   [&lt;ffffffff81792ca8&gt;] dev_attr_store+0x18/0x30
   [&lt;ffffffff8126f75e&gt;] sysfs_kf_write+0x3e/0x50
   [&lt;ffffffff8126ea87&gt;] kernfs_fop_write+0xe7/0x170
   [&lt;ffffffff811f5e9f&gt;] vfs_write+0xaf/0x1d0
   [&lt;ffffffff811f69bd&gt;] SyS_write+0x4d/0xc0
   [&lt;ffffffff81d24692&gt;] system_call_fastpath+0x16/0x1b

776687bce42b ("block, blk-mq: draining can't be skipped even if
bypass_depth was non-zero") made it easier to trigger this bug by
making blk_queue_bypass_start() drain even when it loses the first
bypass test to blk_cleanup_queue(); however, the bug has always been
there even before the commit as blk_queue_bypass_start() could race
against queue destruction, win the initial bypass test but perform the
actual draining after blk_cleanup_queue() already destroyed all blkgs.

Fix it by skippping calling into policy draining if all the blkgs are
already gone.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Reported-by: Shirish Pargaonkar &lt;spargaonkar@suse.com&gt;
Reported-by: Sasha Levin &lt;sasha.levin@oracle.com&gt;
Reported-by: Jet Chen &lt;jet.chen@intel.com&gt;
Tested-by: Shirish Pargaonkar &lt;spargaonkar@suse.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>block: don't assume last put of shared tags is for the host</title>
<updated>2014-07-31T19:53:48+00:00</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2014-07-08T10:25:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=cb454b6d31756674d2e0ceaa336ec87019728d9b'/>
<id>cb454b6d31756674d2e0ceaa336ec87019728d9b</id>
<content type='text'>
commit d45b3279a5a2252cafcd665bbf2db8c9b31ef783 upstream.

There is no inherent reason why the last put of a tag structure must be
the one for the Scsi_Host, as device model objects can be held for
arbitrary periods.  Merge blk_free_tags and __blk_free_tags into a single
funtion that just release a references and get rid of the BUG() when the
host reference wasn't the last.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit d45b3279a5a2252cafcd665bbf2db8c9b31ef783 upstream.

There is no inherent reason why the last put of a tag structure must be
the one for the Scsi_Host, as device model objects can be held for
arbitrary periods.  Merge blk_free_tags and __blk_free_tags into a single
funtion that just release a references and get rid of the BUG() when the
host reference wasn't the last.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>block: provide compat ioctl for BLKZEROOUT</title>
<updated>2014-07-31T19:53:48+00:00</updated>
<author>
<name>Mikulas Patocka</name>
<email>mpatocka@redhat.com</email>
</author>
<published>2014-07-02T16:46:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=668b7a05f2fa59c60ca9820269e3d8dfaa218693'/>
<id>668b7a05f2fa59c60ca9820269e3d8dfaa218693</id>
<content type='text'>
commit 3b3a1814d1703027f9867d0f5cbbfaf6c7482474 upstream.

This patch provides the compat BLKZEROOUT ioctl. The argument is a pointer
to two uint64_t values, so there is no need to translate it.

Signed-off-by: Mikulas Patocka &lt;mpatocka@redhat.com&gt;
Acked-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 3b3a1814d1703027f9867d0f5cbbfaf6c7482474 upstream.

This patch provides the compat BLKZEROOUT ioctl. The argument is a pointer
to two uint64_t values, so there is no need to translate it.

Signed-off-by: Mikulas Patocka &lt;mpatocka@redhat.com&gt;
Acked-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
</feed>
