<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/block, branch v3.2.2</title>
<subtitle>Linux kernel source tree</subtitle>
<id>https://git.amat.us/linux/atom/block?h=v3.2.2</id>
<link rel='self' href='https://git.amat.us/linux/atom/block?h=v3.2.2'/>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/'/>
<updated>2012-01-26T00:13:42Z</updated>
<entry>
<title>block: fail SCSI passthrough ioctls on partition devices</title>
<updated>2012-01-26T00:13:42Z</updated>
<author>
<name>Paolo Bonzini</name>
<email>pbonzini@redhat.com</email>
</author>
<published>2012-01-12T15:01:28Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=d33310de0d7914f2e27ed4fef67a1979f10037e1'/>
<id>urn:sha1:d33310de0d7914f2e27ed4fef67a1979f10037e1</id>
<content type='text'>
commit 0bfc96cb77224736dfa35c3c555d37b3646ef35e upstream.

[ Changes with respect to 3.3: return -ENOTTY from scsi_verify_blk_ioctl
  and -ENOIOCTLCMD from sd_compat_ioctl. ]

Linux allows executing the SG_IO ioctl on a partition or LVM volume, and
will pass the command to the underlying block device.  This is
well-known, but it is also a large security problem when (via Unix
permissions, ACLs, SELinux or a combination thereof) a program or user
needs to be granted access only to part of the disk.

This patch lets partitions forward a small set of harmless ioctls;
others are logged with printk so that we can see which ioctls are
actually sent.  In my tests only CDROM_GET_CAPABILITY actually occurred.
Of course it was being sent to a (partition on a) hard disk, so it would
have failed with ENOTTY and the patch isn't changing anything in
practice.  Still, I'm treating it specially to avoid spamming the logs.

In principle, this restriction should include programs running with
CAP_SYS_RAWIO.  If for example I let a program access /dev/sda2 and
/dev/sdb, it still should not be able to read/write outside the
boundaries of /dev/sda2 independent of the capabilities.  However, for
now programs with CAP_SYS_RAWIO will still be allowed to send the
ioctls.  Their actions will still be logged.

This patch does not affect the non-libata IDE driver.  That driver
however already tests for bd != bd-&gt;bd_contains before issuing some
ioctl; it could be restricted further to forbid these ioctls even for
programs running with CAP_SYS_ADMIN/CAP_SYS_RAWIO.

Cc: linux-scsi@vger.kernel.org
Cc: Jens Axboe &lt;axboe@kernel.dk&gt;
Cc: James Bottomley &lt;JBottomley@parallels.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
[ Make it also print the command name when warning - Linus ]
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>block: add and use scsi_blk_cmd_ioctl</title>
<updated>2012-01-26T00:13:42Z</updated>
<author>
<name>Paolo Bonzini</name>
<email>pbonzini@redhat.com</email>
</author>
<published>2012-01-12T15:01:27Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=36a7ce632fb11cce578b7fdf4b4bbc8fbb99987a'/>
<id>urn:sha1:36a7ce632fb11cce578b7fdf4b4bbc8fbb99987a</id>
<content type='text'>
commit 577ebb374c78314ac4617242f509e2f5e7156649 upstream.

Introduce a wrapper around scsi_cmd_ioctl that takes a block device.

The function will then be enhanced to detect partition block devices
and, in that case, subject the ioctls to whitelisting.

Cc: linux-scsi@vger.kernel.org
Cc: Jens Axboe &lt;axboe@kernel.dk&gt;
Cc: James Bottomley &lt;JBottomley@parallels.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>block: fix blk_queue_end_tag()</title>
<updated>2011-12-29T08:16:28Z</updated>
<author>
<name>Dan Williams</name>
<email>dan.j.williams@intel.com</email>
</author>
<published>2011-12-29T08:16:28Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=f2b20d436534f22ccc3f5ad172499fcb013bb315'/>
<id>urn:sha1:f2b20d436534f22ccc3f5ad172499fcb013bb315</id>
<content type='text'>
Commit 5e081591 "block: warn if tag is greater than real_max_depth"
cleaned up blk_queue_end_tag() to warn when the tag is truly invalid
(greater than real_max_depth).  However, it changed behavior in the tag &lt;
max_depth case to not end the request.  Leading to triggering of
BUG_ON(blk_queued_rq(rq)) in the request completion path:

  http://marc.info/?l=linux-kernel&amp;m=132204370518629&amp;w=2

In order to allow blk_queue_resize_tags() to shrink the tag space
blk_queue_end_tag() must always complete tags with a value less than
real_max_depth regardless of the current max_depth.  The comment about
"handling the shrink case" seems to be what prompted changes in this
space, so remove it and BUG on all invalid tags (made even simpler by
Matthew's suggestion to use an unsigned compare).

Signed-off-by: Dan Williams &lt;dan.j.williams@intel.com&gt;
Cc: Tao Ma &lt;boyu.mt@taobao.com&gt;
Cc: Matthew Wilcox &lt;matthew@wil.cx&gt;
Reported-by: Meelis Roos &lt;mroos@ut.ee&gt;
Reported-by: Ed Nadolski &lt;edmund.nadolski@intel.com&gt;
Cc: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block: re-use existing 'reading' variable instead of checking direction again</title>
<updated>2011-12-21T14:27:24Z</updated>
<author>
<name>majianpeng</name>
<email>majianpeng@gmail.com</email>
</author>
<published>2011-12-21T14:27:24Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=609f6ea1c9cdfe0c43a927e13205a57d0c266d5a'/>
<id>urn:sha1:609f6ea1c9cdfe0c43a927e13205a57d0c266d5a</id>
<content type='text'>
Signed-off-by: majianpeng &lt;majianpeng@gmail.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block, cfq: fix empty queue crash caused by request merge</title>
<updated>2011-12-16T13:04:23Z</updated>
<author>
<name>Shaohua Li</name>
<email>shaohua.li@intel.com</email>
</author>
<published>2011-12-16T13:04:23Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=6ae0516b8a50ece5d766be608a305707e0450060'/>
<id>urn:sha1:6ae0516b8a50ece5d766be608a305707e0450060</id>
<content type='text'>
All requests of a queue could be merged to other requests of other queue.
Such queue will not have request in it, but it's in service tree. This
will cause kernel oops.
I encounter a BUG_ON() in cfq_dispatch_request() with next patch, but the
issue should exist without the patch.

Signed-off-by: Shaohua Li &lt;shaohua.li@intel.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block: don't kick empty queue in blk_drain_queue()</title>
<updated>2011-12-15T19:03:04Z</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2011-12-15T19:03:04Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=4eabc941259f9d8c8fb71746d3f30c87e1d9e49b'/>
<id>urn:sha1:4eabc941259f9d8c8fb71746d3f30c87e1d9e49b</id>
<content type='text'>
While probing, fd sets up queue, probes hardware and tears down the
queue if probing fails.  In the process, blk_drain_queue() kicks the
queue which failed to finish initialization and fd is unhappy about
that.

  floppy0: no floppy controllers found
  ------------[ cut here ]------------
  WARNING: at drivers/block/floppy.c:2929 do_fd_request+0xbf/0xd0()
  Hardware name: To Be Filled By O.E.M.
  VFS: do_fd_request called on non-open device
  Modules linked in:
  Pid: 1, comm: swapper Not tainted 3.2.0-rc4-00077-g5983fe2 #2
  Call Trace:
   [&lt;ffffffff81039a6a&gt;] warn_slowpath_common+0x7a/0xb0
   [&lt;ffffffff81039b41&gt;] warn_slowpath_fmt+0x41/0x50
   [&lt;ffffffff813d657f&gt;] do_fd_request+0xbf/0xd0
   [&lt;ffffffff81322b95&gt;] blk_drain_queue+0x65/0x80
   [&lt;ffffffff81322c93&gt;] blk_cleanup_queue+0xe3/0x1a0
   [&lt;ffffffff818a809d&gt;] floppy_init+0xdeb/0xe28
   [&lt;ffffffff818a72b2&gt;] ? daring+0x6b/0x6b
   [&lt;ffffffff810002af&gt;] do_one_initcall+0x3f/0x170
   [&lt;ffffffff81884b34&gt;] kernel_init+0x9d/0x11e
   [&lt;ffffffff810317c2&gt;] ? schedule_tail+0x22/0xa0
   [&lt;ffffffff815dbb14&gt;] kernel_thread_helper+0x4/0x10
   [&lt;ffffffff81884a97&gt;] ? start_kernel+0x2be/0x2be
   [&lt;ffffffff815dbb10&gt;] ? gs_change+0xb/0xb

Avoid it by making blk_drain_queue() kick queue iff dispatch queue has
something on it.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Reported-by: Ralf Hildebrandt &lt;Ralf.Hildebrandt@charite.de&gt;
Reported-by: Wu Fengguang &lt;fengguang.wu@intel.com&gt;
Tested-by: Sergei Trofimovich &lt;slyich@gmail.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>cfq-iosched: fix cfq_cic_link() race confition</title>
<updated>2011-12-02T09:07:07Z</updated>
<author>
<name>Yasuaki Ishimatsu</name>
<email>isimatu.yasuaki@jp.fujitsu.com</email>
</author>
<published>2011-12-02T09:07:07Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=5eb46851de3904cd1be9192fdacb8d34deadc1fc'/>
<id>urn:sha1:5eb46851de3904cd1be9192fdacb8d34deadc1fc</id>
<content type='text'>
cfq_cic_link() has race condition. When some processes which shared ioc
issue I/O to same block device simultaneously, cfq_cic_link() returns -EEXIST
sometimes. The race condition might stop I/O by following steps:

step  1: Process A: Issue an I/O to /dev/sda
step  2: Process A: Get an ioc (iocA here) in get_io_context() which does not
		    linked with a cic for the device
step  3: Process A: Get a new cic for the device (cicA here) in
		    cfq_alloc_io_context()

step  4: Process B: Issue an I/O to /dev/sda
step  5: Process B: Get iocA in get_io_context() since process A and B share the
		    same ioc
step  6: Process B: Get a new cic for the device (cicB here) in
		    cfq_alloc_io_context() since iocA has not been linked with a
		    cic for the device yet

step  7: Process A: Link cicA to iocA in cfq_cic_link()
step  8: Process A: Dispatch I/O to driver and finish it

step  9: Process B: Try to link cicB to iocA in cfq_cic_link()
		    But it fails with showing "cfq: cic link failed!" kernel
		    message, since iocA has already linked with cicA at step 7.
step 10: Process B: Wait for finishig I/O in get_request_wait()
		    The function does not wake up, when there is no I/O to the
		    device.

When cfq_cic_link() returns -EEXIST, it means ioc has already linked with cic.
So when cfq_cic_link() return -EEXIST, retry cfq_cic_lookup().

Signed-off-by: Yasuaki Ishimatsu &lt;isimatu.yasuaki@jp.fujitsu.com&gt;
Cc: stable@kernel.org
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>cfq-iosched: free cic_index if blkio_alloc_blkg_stats fails</title>
<updated>2011-11-30T14:47:48Z</updated>
<author>
<name>majianpeng</name>
<email>majianpeng@gmail.com</email>
</author>
<published>2011-11-30T14:47:48Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=2984ff38ccf6cbc02a7a996a36c7d6f69f3c6146'/>
<id>urn:sha1:2984ff38ccf6cbc02a7a996a36c7d6f69f3c6146</id>
<content type='text'>
If we fail allocating the blkpg stats, we free cfqd and cfgq.
But we need to free the IDA cfqd-&gt;cic_index as well.

Signed-off-by: majianpeng &lt;majianpeng@gmail.com&gt;
Cc: stable@kernel.org
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block: initialize request_queue's numa node during</title>
<updated>2011-11-23T09:59:13Z</updated>
<author>
<name>Mike Snitzer</name>
<email>snitzer@redhat.com</email>
</author>
<published>2011-11-23T09:59:13Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=5151412dd4338b273afdb107c3772528e9e67d92'/>
<id>urn:sha1:5151412dd4338b273afdb107c3772528e9e67d92</id>
<content type='text'>
struct request_queue is allocated with __GFP_ZERO so its "node" field is
zero before initialization.  This causes an oops if node 0 is offline in
the page allocator because its zonelists are not initialized.  From Dave
Young's dmesg:

	SRAT: Node 1 PXM 2 0-d0000000
	SRAT: Node 1 PXM 2 100000000-330000000
	SRAT: Node 0 PXM 1 330000000-630000000
	Initmem setup node 1 0000000000000000-000000000affb000
	...
	Built 1 zonelists in Node order, mobility grouping on.
	...
	BUG: unable to handle kernel paging request at 0000000000001c08
	IP: [&lt;ffffffff8111c355&gt;] __alloc_pages_nodemask+0xb5/0x870

and __alloc_pages_nodemask+0xb5 translates to a NULL pointer on
zonelist-&gt;_zonerefs.

The fix is to initialize q-&gt;node at the time of allocation so the correct
node is passed to the slab allocator later.

Since blk_init_allocated_queue_node() is no longer needed, merge it with
blk_init_allocated_queue().

[rientjes@google.com: changelog, initializing q-&gt;node]
Cc: stable@vger.kernel.org [2.6.37+]
Reported-by: Dave Young &lt;dyoung@redhat.com&gt;
Signed-off-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Signed-off-by: David Rientjes &lt;rientjes@google.com&gt;
Tested-by: Dave Young &lt;dyoung@redhat.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block: add missed trace_block_plug</title>
<updated>2011-11-16T08:21:50Z</updated>
<author>
<name>Shaohua Li</name>
<email>shaohua.li@intel.com</email>
</author>
<published>2011-11-16T08:21:50Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=019ceb7d5d252ce71001a157cf29f4ac28501b72'/>
<id>urn:sha1:019ceb7d5d252ce71001a157cf29f4ac28501b72</id>
<content type='text'>
After flush plug list, the list has no request, so we need to add a
trace_block_plug().

Signed-off-by: Shaohua Li &lt;shaohua.li@intel.com&gt;
Reviewed-by: Namhyung Kim &lt;namhyung@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
</feed>
