<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/scsi/st.c, branch linux-4.5.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.5.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.5.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2015-12-03T17:32:33Z</updated>
<entry>
<title>Merge branch 'mkp-fixes' into fixes</title>
<updated>2015-12-03T17:32:33Z</updated>
<author>
<name>James Bottomley</name>
</author>
<published>2015-12-03T17:32:33Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=be9e2f775f5a3147205c552534c3abf0f9374a13'/>
<id>urn:sha1:be9e2f775f5a3147205c552534c3abf0f9374a13</id>
<content type='text'>
</content>
</entry>
<entry>
<title>st: fix potential null pointer dereference.</title>
<updated>2015-11-19T17:12:42Z</updated>
<author>
<name>Maurizio Lombardi</name>
</author>
<published>2015-11-18T14:32:44Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ab08ee14393724ab52b92be643d588d41a1a05be'/>
<id>urn:sha1:ab08ee14393724ab52b92be643d588d41a1a05be</id>
<content type='text'>
If cdev_add() returns an error, the code calls
cdev_del() passing the STm-&gt;cdevs[rew] pointer as parameter;
the problem is that the pointer has not been initialized yet.

This patch fixes the problem by moving the STm-&gt;cdevs[rew] pointer
initialization before the call to cdev_add().
It also sets STm-&gt;devs[rew] and STm-&gt;cdevs[rew] to NULL in
case of failure.

Signed-off-by: Maurizio Lombardi &lt;mlombard@redhat.com&gt;
Reviewed-by: Johannes Thumshirn &lt;jthumshirn@suse.de&gt;
Reviewed-by: Tomas Henzl &lt;thenzl@redhat.com&gt;
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
</content>
</entry>
<entry>
<title>st: allow debug output to be enabled or disabled via sysfs</title>
<updated>2015-11-10T01:17:27Z</updated>
<author>
<name>Seymour, Shane M</name>
</author>
<published>2015-10-12T04:31:17Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d9b43a10f0d04564c6e05de3728c3cbba64c644d'/>
<id>urn:sha1:d9b43a10f0d04564c6e05de3728c3cbba64c644d</id>
<content type='text'>
Change st driver to allow enabling or disabling debug output
via sysfs file /sys/bus/scsi/drivers/st/debug_flag.

Previously the only way to enable debug output was:

1. loading the driver with the module parameter debug_flag=1
2. an ioctl call (this method was also the only way to dynamically
disable debug output).

To use the ioctl you need a second tape drive (if you are
actively testing the first tape drive) since a second process
cannot open the first tape drive if it is in use.

The this change is only functional if the value of the macro
DEBUG in st.c is a non-zero value (which it is by default).

Signed-off-by: Shane Seymour &lt;shane.seymour@hpe.com&gt;
Reviewed-by: Laurence Oberman &lt;oberman.l@gmail.com&gt;
Acked-by: Kai Mäkisara &lt;kai.makisara@kolumbus.fi&gt;
Signed-off-by: James Bottomley &lt;JBottomley@Odin.com&gt;
</content>
</entry>
<entry>
<title>st: Destroy st_index_idr on module exit</title>
<updated>2015-08-26T14:45:25Z</updated>
<author>
<name>Johannes Thumshirn</name>
</author>
<published>2015-07-08T15:24:01Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2d3a5d215e24d9bfb822ae82c6c2c5d333be076d'/>
<id>urn:sha1:2d3a5d215e24d9bfb822ae82c6c2c5d333be076d</id>
<content type='text'>
Destroy st_index_idr on module exit, reclaiming the allocated memory.

This was detected by the following semantic patch (written by Luis Rodriguez
&lt;mcgrof@suse.com&gt;)
&lt;SmPL&gt;
@ defines_module_init @
declarer name module_init, module_exit;
declarer name DEFINE_IDR;
identifier init;
@@

module_init(init);

@ defines_module_exit @
identifier exit;
@@

module_exit(exit);

@ declares_idr depends on defines_module_init &amp;&amp; defines_module_exit @
identifier idr;
@@

DEFINE_IDR(idr);

@ on_exit_calls_destroy depends on declares_idr &amp;&amp; defines_module_exit @
identifier declares_idr.idr, defines_module_exit.exit;
@@

exit(void)
{
 ...
 idr_destroy(&amp;idr);
 ...
}

@ missing_module_idr_destroy depends on declares_idr &amp;&amp; defines_module_exit &amp;&amp; !on_exit_calls_destroy @
identifier declares_idr.idr, defines_module_exit.exit;
@@

exit(void)
{
 ...
 +idr_destroy(&amp;idr);
}
&lt;/SmPL&gt;

Signed-off-by: Johannes Thumshirn &lt;jthumshirn@suse.de&gt;
Reviewed-by: Hannes Reinecke &lt;hare@suse.de&gt;
Acked-by: Kai Mäkisara &lt;kai.makisara@kolumbus.fi&gt;
Signed-off-by: James Bottomley &lt;JBottomley@Odin.com&gt;
</content>
</entry>
<entry>
<title>st: convert DRIVER_ATTR macros to DRIVER_ATTR_RO</title>
<updated>2015-08-12T22:54:24Z</updated>
<author>
<name>Seymour, Shane M</name>
</author>
<published>2015-06-24T06:54:35Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=10978e48ccc1718dce5c2d275b761ab99c593a81'/>
<id>urn:sha1:10978e48ccc1718dce5c2d275b761ab99c593a81</id>
<content type='text'>
Convert DRIVER_ATTR macros to DRIVER_ATTR_RO requested by
Greg KH. Also switched to using scnprintf instead of snprintf
per Documentation/filesystems/sysfs.txt.

Suggested-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Shane Seymour &lt;shane.seymour@hp.com&gt;
Reviewed-by: Hannes Reinecke &lt;hare@suse.de&gt;
Reviewed-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Acked-by: Kai Mäkisara &lt;kai.makisara@kolumbus.fi&gt;
Signed-off-by: James Bottomley &lt;JBottomley@Odin.com&gt;
</content>
</entry>
<entry>
<title>st: convert to using driver attr groups for sysfs</title>
<updated>2015-08-12T18:52:05Z</updated>
<author>
<name>Seymour, Shane M</name>
</author>
<published>2015-06-23T08:11:00Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=442d75628a3040bbfeb4a1f743b70a8afec0adbc'/>
<id>urn:sha1:442d75628a3040bbfeb4a1f743b70a8afec0adbc</id>
<content type='text'>
This patch changes the st driver to use attribute groups so
driver sysfs files are created automatically. See the
following for reference:

http://kroah.com/log/blog/2013/06/26/how-to-create-a-sysfs-file-correctly/

Signed-off-by: Shane Seymour &lt;shane.seymour@hp.com&gt;
Reviewed-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Acked-by: Kai Mäkisara &lt;kai.makisara@kolumbus.fi&gt;
Signed-off-by: James Bottomley &lt;JBottomley@Odin.com&gt;
</content>
</entry>
<entry>
<title>st: null pointer dereference panic caused by use after kref_put by st_open</title>
<updated>2015-07-16T12:32:32Z</updated>
<author>
<name>Seymour, Shane M</name>
</author>
<published>2015-07-02T12:01:10Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e7ac6c6666bec0a354758a1298d3231e4a635362'/>
<id>urn:sha1:e7ac6c6666bec0a354758a1298d3231e4a635362</id>
<content type='text'>
Two SLES11 SP3 servers encountered similar crashes simultaneously
following some kind of SAN/tape target issue:

...
qla2xxx [0000:81:00.0]-801c:3: Abort command issued nexus=3:0:2 --  1 2002.
qla2xxx [0000:81:00.0]-801c:3: Abort command issued nexus=3:0:2 --  1 2002.
qla2xxx [0000:81:00.0]-8009:3: DEVICE RESET ISSUED nexus=3:0:2 cmd=ffff882f89c2c7c0.
qla2xxx [0000:81:00.0]-800c:3: do_reset failed for cmd=ffff882f89c2c7c0.
qla2xxx [0000:81:00.0]-800f:3: DEVICE RESET FAILED: Task management failed nexus=3:0:2 cmd=ffff882f89c2c7c0.
qla2xxx [0000:81:00.0]-8009:3: TARGET RESET ISSUED nexus=3:0:2 cmd=ffff882f89c2c7c0.
qla2xxx [0000:81:00.0]-800c:3: do_reset failed for cmd=ffff882f89c2c7c0.
qla2xxx [0000:81:00.0]-800f:3: TARGET RESET FAILED: Task management failed nexus=3:0:2 cmd=ffff882f89c2c7c0.
qla2xxx [0000:81:00.0]-8012:3: BUS RESET ISSUED nexus=3:0:2.
qla2xxx [0000:81:00.0]-802b:3: BUS RESET SUCCEEDED nexus=3:0:2.
qla2xxx [0000:81:00.0]-505f:3: Link is operational (8 Gbps).
qla2xxx [0000:81:00.0]-8018:3: ADAPTER RESET ISSUED nexus=3:0:2.
qla2xxx [0000:81:00.0]-00af:3: Performing ISP error recovery - ha=ffff88bf04d18000.
 rport-3:0-0: blocked FC remote port time out: removing target and saving binding
qla2xxx [0000:81:00.0]-505f:3: Link is operational (8 Gbps).
qla2xxx [0000:81:00.0]-8017:3: ADAPTER RESET SUCCEEDED nexus=3:0:2.
 rport-2:0-0: blocked FC remote port time out: removing target and saving binding
sg_rq_end_io: device detached
BUG: unable to handle kernel NULL pointer dereference at 00000000000002a8
IP: [&lt;ffffffff8133b268&gt;] __pm_runtime_idle+0x28/0x90
PGD 7e6586f067 PUD 7e5af06067 PMD 0 [1739975.390354] Oops: 0002 [#1] SMP
CPU 0
...
Supported: No, Proprietary modules are loaded [1739975.390463]
Pid: 27965, comm: ABCD Tainted: PF           X 3.0.101-0.29-default #1 HP ProLiant DL580 Gen8
RIP: 0010:[&lt;ffffffff8133b268&gt;]  [&lt;ffffffff8133b268&gt;] __pm_runtime_idle+0x28/0x90
RSP: 0018:ffff8839dc1e7c68  EFLAGS: 00010202
RAX: 0000000000000000 RBX: ffff883f0592fc00 RCX: 0000000000000090
RDX: 0000000000000000 RSI: 0000000000000004 RDI: 0000000000000138
RBP: 0000000000000138 R08: 0000000000000010 R09: ffffffff81bd39d0
R10: 00000000000009c0 R11: ffffffff81025790 R12: 0000000000000001
R13: ffff883022212b80 R14: 0000000000000004 R15: ffff883022212b80
FS:  00007f8e54560720(0000) GS:ffff88407f800000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 00000000000002a8 CR3: 0000007e6ced6000 CR4: 00000000001407f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Process ABCD (pid: 27965, threadinfo ffff8839dc1e6000, task ffff883592e0c640)
Stack:
 ffff883f0592fc00 00000000fffffffa 0000000000000001 ffff883022212b80
 ffff883eff772400 ffffffffa03fa309 0000000000000000 0000000000000000
 ffffffffa04003a0 ffff883f063196c0 ffff887f0379a930 ffffffff8115ea1e
Call Trace:
 [&lt;ffffffffa03fa309&gt;] st_open+0x129/0x240 [st]
 [&lt;ffffffff8115ea1e&gt;] chrdev_open+0x13e/0x200
 [&lt;ffffffff811588a8&gt;] __dentry_open+0x198/0x310
 [&lt;ffffffff81167d74&gt;] do_last+0x1f4/0x800
 [&lt;ffffffff81168fe9&gt;] path_openat+0xd9/0x420
 [&lt;ffffffff8116946c&gt;] do_filp_open+0x4c/0xc0
 [&lt;ffffffff8115a00f&gt;] do_sys_open+0x17f/0x250
 [&lt;ffffffff81468d92&gt;] system_call_fastpath+0x16/0x1b
 [&lt;00007f8e4f617fd0&gt;] 0x7f8e4f617fcf
Code: eb d3 90 48 83 ec 28 40 f6 c6 04 48 89 6c 24 08 4c 89 74 24 20 48 89 fd 48 89 1c 24 4c 89 64 24 10 41 89 f6 4c 89 6c 24 18 74 11 &lt;f0&gt; ff 8f 70 01 00 00 0f 94 c0 45 31 ed 84 c0 74 2b 4c 8d a5 a0
RIP  [&lt;ffffffff8133b268&gt;] __pm_runtime_idle+0x28/0x90
 RSP &lt;ffff8839dc1e7c68&gt;
CR2: 00000000000002a8

Analysis reveals the cause of the crash to be due to STp-&gt;device
being NULL. The pointer was NULLed via scsi_tape_put(STp) when it
calls scsi_tape_release(). In st_open() we jump to err_out after
scsi_block_when_processing_errors() completes and returns the
device as offline (sdev_state was SDEV_DEL):

1180 /* Open the device. Needs to take the BKL only because of incrementing the SCSI host
1181    module count. */
1182 static int st_open(struct inode *inode, struct file *filp)
1183 {
1184         int i, retval = (-EIO);
1185         int resumed = 0;
1186         struct scsi_tape *STp;
1187         struct st_partstat *STps;
1188         int dev = TAPE_NR(inode);
1189         char *name;
...
1217         if (scsi_autopm_get_device(STp-&gt;device) &lt; 0) {
1218                 retval = -EIO;
1219                 goto err_out;
1220         }
1221         resumed = 1;
1222         if (!scsi_block_when_processing_errors(STp-&gt;device)) {
1223                 retval = (-ENXIO);
1224                 goto err_out;
1225         }
...
1264  err_out:
1265         normalize_buffer(STp-&gt;buffer);
1266         spin_lock(&amp;st_use_lock);
1267         STp-&gt;in_use = 0;
1268         spin_unlock(&amp;st_use_lock);
1269         scsi_tape_put(STp); &lt;-- STp-&gt;device = 0 after this
1270         if (resumed)
1271                 scsi_autopm_put_device(STp-&gt;device);
1272         return retval;

The ref count for the struct scsi_tape had already been reduced
to 1 when the .remove method of the st module had been called.
The kref_put() in scsi_tape_put() caused scsi_tape_release()
to be called:

0266 static void scsi_tape_put(struct scsi_tape *STp)
0267 {
0268         struct scsi_device *sdev = STp-&gt;device;
0269
0270         mutex_lock(&amp;st_ref_mutex);
0271         kref_put(&amp;STp-&gt;kref, scsi_tape_release); &lt;-- calls this
0272         scsi_device_put(sdev);
0273         mutex_unlock(&amp;st_ref_mutex);
0274 }

In scsi_tape_release() the struct scsi_device in the struct
scsi_tape gets set to NULL:

4273 static void scsi_tape_release(struct kref *kref)
4274 {
4275         struct scsi_tape *tpnt = to_scsi_tape(kref);
4276         struct gendisk *disk = tpnt-&gt;disk;
4277
4278         tpnt-&gt;device = NULL; &lt;&lt;&lt;---- where the dev is nulled
4279
4280         if (tpnt-&gt;buffer) {
4281                 normalize_buffer(tpnt-&gt;buffer);
4282                 kfree(tpnt-&gt;buffer-&gt;reserved_pages);
4283                 kfree(tpnt-&gt;buffer);
4284         }
4285
4286         disk-&gt;private_data = NULL;
4287         put_disk(disk);
4288         kfree(tpnt);
4289         return;
4290 }

Although the problem was reported on SLES11.3 the problem appears
in linux-next as well.

The crash is fixed by reordering the code so we no longer access
the struct scsi_tape after the kref_put() is done on it in st_open().

Signed-off-by: Shane Seymour &lt;shane.seymour@hp.com&gt;
Signed-off-by: Darren Lavender &lt;darren.lavender@hp.com&gt;
Reviewed-by: Johannes Thumshirn &lt;jthumshirn@suse.com&gt;
Acked-by: Kai Mäkisara &lt;kai.makisara@kolumbus.fi&gt;
Cc: stable@vger.kernel.org
Signed-off-by: James Bottomley &lt;JBottomley@Odin.com&gt;
</content>
</entry>
<entry>
<title>st: implement tape statistics</title>
<updated>2015-06-02T15:03:25Z</updated>
<author>
<name>Seymour, Shane M</name>
</author>
<published>2015-05-06T01:37:20Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=05545c92db9637318a98d3d59d400beb819decc7'/>
<id>urn:sha1:05545c92db9637318a98d3d59d400beb819decc7</id>
<content type='text'>
This patch implements tape statistics in the st module via
sysfs. Current no statistics are available for tape I/O and there
is no easy way to reuse the block layer statistics for tape
as tape is a character device and does not have perform I/O in
sector sized chunks (the size of the data written to tape
can change). For tapes we also need extra stats related to
things like tape movement (via other I/O).

There have been multiple end users requesting statistics
including AT&amp;T (and some HP customers who have not given
permission to be named). It is impossible for them
to investigate any issues related to tape performance
in a non-invasive way.

[jejb: eliminate PRId64]
Signed-off-by: Shane Seymour &lt;shane.seymour@hp.com&gt;
Tested-by: Shane Seymour &lt;shane.seymour@hp.com&gt;
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: James Bottomley &lt;JBottomley@Odin.com&gt;
</content>
</entry>
<entry>
<title>mm: gup: use get_user_pages_unlocked</title>
<updated>2015-02-12T01:06:05Z</updated>
<author>
<name>Andrea Arcangeli</name>
</author>
<published>2015-02-11T23:27:26Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7e339128496284cc21977fba5416166ee81f5172'/>
<id>urn:sha1:7e339128496284cc21977fba5416166ee81f5172</id>
<content type='text'>
This allows those get_user_pages calls to pass FAULT_FLAG_ALLOW_RETRY to
the page fault in order to release the mmap_sem during the I/O.

Signed-off-by: Andrea Arcangeli &lt;aarcange@redhat.com&gt;
Reviewed-by: Kirill A. Shutemov &lt;kirill.shutemov@linux.intel.com&gt;
Cc: Andres Lagar-Cavilla &lt;andreslc@google.com&gt;
Cc: Peter Feiner &lt;pfeiner@google.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>scsi: remove scsi_driver owner field</title>
<updated>2014-11-24T19:01:28Z</updated>
<author>
<name>Christoph Hellwig</name>
</author>
<published>2014-11-12T17:34:51Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3af6b35261182ff185db1f0fd271254147e2663e'/>
<id>urn:sha1:3af6b35261182ff185db1f0fd271254147e2663e</id>
<content type='text'>
The driver core driver structure has grown an owner field and now
requires it to be set for all modular drivers.  Set it up for
all scsi_driver instances and get rid of the now superflous
scsi_driver owner field.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reported-by: Shane M Seymour &lt;shane.seymour@hp.com&gt;
Reviewed-by: Ewan D. Milne &lt;emilne@redhat.com
Reviewed-by: Hannes Reinecke &lt;hare@suse.de&gt;
</content>
</entry>
</feed>
