<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/drivers/scsi/ch.c, branch v2.6.27.12</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>[SCSI] ch: fix ch_remove oops</title>
<updated>2008-07-26T19:17:47+00:00</updated>
<author>
<name>FUJITA Tomonori</name>
<email>fujita.tomonori@lab.ntt.co.jp</email>
</author>
<published>2008-07-26T14:25:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=3d164fb09bb5cb8a223eddf634fc0d355714fcfe'/>
<id>3d164fb09bb5cb8a223eddf634fc0d355714fcfe</id>
<content type='text'>
The following commit causes ch_remove oops:

commit 24b42566c3fcbb5a9011d1446783d0f5844ccd45
Author: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
Date:   Fri May 16 17:55:12 2008 -0700

    SCSI: fix race in device_create

    There is a race from when a device is created with device_create() and
    then the drvdata is set with a call to dev_set_drvdata() in which a
    sysfs file could be open, yet the drvdata will be NULL, causing all
    sorts of bad things to happen.

    This patch fixes the problem by using the new function,
    device_create_drvdata().  It fixes the problem in all of the scsi
    drivers that need it.

    Cc: Kay Sievers &lt;kay.sievers@vrfy.org&gt;
    Cc: Doug Gilbert &lt;dgilbert@interlog.com&gt;
    Cc: James E.J. Bottomley &lt;James.Bottomley@HansenPartnership.com&gt;
    Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

The problem is ch_probe stores ch's private data at a wrong place.

We need to store it at scsi_device-&gt;sdev_gendev but the above patch
stores it at device struct that device_create_drvdata returns. So we
hit an oops when ch_remove accesses
scsi_device-&gt;sdev_gendev-&gt;driver_data, which is NULL.

Actually, there wasn't a race because ch doesn't create sysfs files
with device struct that device_create returns. This patch puts back
dev_set_drvdata() to set ch's private data properly.

Signed-off-by: FUJITA Tomonori &lt;fujita.tomonori@lab.ntt.co.jp&gt;
Signed-off-by: James Bottomley &lt;James.Bottomley@HansenPartnership.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The following commit causes ch_remove oops:

commit 24b42566c3fcbb5a9011d1446783d0f5844ccd45
Author: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
Date:   Fri May 16 17:55:12 2008 -0700

    SCSI: fix race in device_create

    There is a race from when a device is created with device_create() and
    then the drvdata is set with a call to dev_set_drvdata() in which a
    sysfs file could be open, yet the drvdata will be NULL, causing all
    sorts of bad things to happen.

    This patch fixes the problem by using the new function,
    device_create_drvdata().  It fixes the problem in all of the scsi
    drivers that need it.

    Cc: Kay Sievers &lt;kay.sievers@vrfy.org&gt;
    Cc: Doug Gilbert &lt;dgilbert@interlog.com&gt;
    Cc: James E.J. Bottomley &lt;James.Bottomley@HansenPartnership.com&gt;
    Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

The problem is ch_probe stores ch's private data at a wrong place.

We need to store it at scsi_device-&gt;sdev_gendev but the above patch
stores it at device struct that device_create_drvdata returns. So we
hit an oops when ch_remove accesses
scsi_device-&gt;sdev_gendev-&gt;driver_data, which is NULL.

Actually, there wasn't a race because ch doesn't create sysfs files
with device struct that device_create returns. This patch puts back
dev_set_drvdata() to set ch's private data properly.

Signed-off-by: FUJITA Tomonori &lt;fujita.tomonori@lab.ntt.co.jp&gt;
Signed-off-by: James Bottomley &lt;James.Bottomley@HansenPartnership.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge commit 'v2.6.26' into bkl-removal</title>
<updated>2008-07-14T21:29:34+00:00</updated>
<author>
<name>Jonathan Corbet</name>
<email>corbet@lwn.net</email>
</author>
<published>2008-07-14T21:29:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=2fceef397f9880b212a74c418290ce69e7ac00eb'/>
<id>2fceef397f9880b212a74c418290ce69e7ac00eb</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>changer: BKL pushdown</title>
<updated>2008-06-20T20:05:52+00:00</updated>
<author>
<name>Jonathan Corbet</name>
<email>corbet@lwn.net</email>
</author>
<published>2008-05-16T20:12:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=b0061a0ec4d10a69309d0371a01e8b99387009ef'/>
<id>b0061a0ec4d10a69309d0371a01e8b99387009ef</id>
<content type='text'>
Add lock_kernel() calls to ch_open(), though the existing locking looks
adequate.

Signed-off-by: Jonathan Corbet &lt;corbet@lwn.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add lock_kernel() calls to ch_open(), though the existing locking looks
adequate.

Signed-off-by: Jonathan Corbet &lt;corbet@lwn.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>SCSI: fix race in device_create</title>
<updated>2008-05-20T20:31:56+00:00</updated>
<author>
<name>Greg Kroah-Hartman</name>
<email>gregkh@suse.de</email>
</author>
<published>2008-05-17T00:55:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=24b42566c3fcbb5a9011d1446783d0f5844ccd45'/>
<id>24b42566c3fcbb5a9011d1446783d0f5844ccd45</id>
<content type='text'>
There is a race from when a device is created with device_create() and
then the drvdata is set with a call to dev_set_drvdata() in which a
sysfs file could be open, yet the drvdata will be NULL, causing all
sorts of bad things to happen.

This patch fixes the problem by using the new function,
device_create_drvdata().  It fixes the problem in all of the scsi
drivers that need it.

Cc: Kay Sievers &lt;kay.sievers@vrfy.org&gt;
Cc: Doug Gilbert &lt;dgilbert@interlog.com&gt;
Cc: James E.J. Bottomley &lt;James.Bottomley@HansenPartnership.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
There is a race from when a device is created with device_create() and
then the drvdata is set with a call to dev_set_drvdata() in which a
sysfs file could be open, yet the drvdata will be NULL, causing all
sorts of bad things to happen.

This patch fixes the problem by using the new function,
device_create_drvdata().  It fixes the problem in all of the scsi
drivers that need it.

Cc: Kay Sievers &lt;kay.sievers@vrfy.org&gt;
Cc: Doug Gilbert &lt;dgilbert@interlog.com&gt;
Cc: James E.J. Bottomley &lt;James.Bottomley@HansenPartnership.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>SCSI: convert struct class_device to struct device</title>
<updated>2008-04-20T02:10:33+00:00</updated>
<author>
<name>Tony Jones</name>
<email>tonyj@suse.de</email>
</author>
<published>2008-02-21T23:13:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=ee959b00c335d7780136c5abda37809191fe52c3'/>
<id>ee959b00c335d7780136c5abda37809191fe52c3</id>
<content type='text'>
It's big, but there doesn't seem to be a way to split it up smaller...

Signed-off-by: Tony Jones &lt;tonyj@suse.de&gt;
Signed-off-by: Kay Sievers &lt;kay.sievers@vrfy.org&gt;
Cc: Roland Dreier &lt;rolandd@cisco.com&gt;
Cc: Sean Hefty &lt;sean.hefty@intel.com&gt;
Cc: Hal Rosenstock &lt;hal.rosenstock@gmail.com&gt;
Cc: James Bottomley &lt;James.Bottomley@HansenPartnership.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It's big, but there doesn't seem to be a way to split it up smaller...

Signed-off-by: Tony Jones &lt;tonyj@suse.de&gt;
Signed-off-by: Kay Sievers &lt;kay.sievers@vrfy.org&gt;
Cc: Roland Dreier &lt;rolandd@cisco.com&gt;
Cc: Sean Hefty &lt;sean.hefty@intel.com&gt;
Cc: Hal Rosenstock &lt;hal.rosenstock@gmail.com&gt;
Cc: James Bottomley &lt;James.Bottomley@HansenPartnership.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>[SCSI] ch: fix sparse shadowed variable warnings</title>
<updated>2008-04-07T17:19:08+00:00</updated>
<author>
<name>Harvey Harrison</name>
<email>harvey.harrison@gmail.com</email>
</author>
<published>2008-04-01T05:05:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=d70d4667e9eead06aa38be947274fda22dcf923b'/>
<id>d70d4667e9eead06aa38be947274fda22dcf923b</id>
<content type='text'>
Replace the global err array with ch_err.
drivers/scsi/ch.c:271:6: warning: symbol 'err' shadows an earlier one
drivers/scsi/ch.c:116:3: originally declared here

Replace the temporary cmd buffer with ch_err to avoid shadowing the cmd
function parameter.
drivers/scsi/ch.c:724:11: warning: symbol 'cmd' shadows an earlier one
drivers/scsi/ch.c:596:20: originally declared here

Signed-off-by: Harvey Harrison &lt;harvey.harrison@gmail.com&gt;
Signed-off-by: James Bottomley &lt;James.Bottomley@HansenPartnership.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Replace the global err array with ch_err.
drivers/scsi/ch.c:271:6: warning: symbol 'err' shadows an earlier one
drivers/scsi/ch.c:116:3: originally declared here

Replace the temporary cmd buffer with ch_err to avoid shadowing the cmd
function parameter.
drivers/scsi/ch.c:724:11: warning: symbol 'cmd' shadows an earlier one
drivers/scsi/ch.c:596:20: originally declared here

Signed-off-by: Harvey Harrison &lt;harvey.harrison@gmail.com&gt;
Signed-off-by: James Bottomley &lt;James.Bottomley@HansenPartnership.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[SCSI] ch: remove forward declarations</title>
<updated>2008-01-25T15:22:12+00:00</updated>
<author>
<name>FUJITA Tomonori</name>
<email>fujita.tomonori@lab.ntt.co.jp</email>
</author>
<published>2008-01-24T08:24:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=5aa22af3d089123df954693d1f911323307d41f7'/>
<id>5aa22af3d089123df954693d1f911323307d41f7</id>
<content type='text'>
This moves ch_template and changer_fops structs to the end of file and
removes forward declarations.

This also removes some trailing whitespace.

Signed-off-by: FUJITA Tomonori &lt;fujita.tomonori@lab.ntt.co.jp&gt;
Signed-off-by: James Bottomley &lt;James.Bottomley@HansenPartnership.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This moves ch_template and changer_fops structs to the end of file and
removes forward declarations.

This also removes some trailing whitespace.

Signed-off-by: FUJITA Tomonori &lt;fujita.tomonori@lab.ntt.co.jp&gt;
Signed-off-by: James Bottomley &lt;James.Bottomley@HansenPartnership.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[SCSI] ch: fix device minor number management bug</title>
<updated>2008-01-25T15:21:55+00:00</updated>
<author>
<name>FUJITA Tomonori</name>
<email>fujita.tomonori@lab.ntt.co.jp</email>
</author>
<published>2008-01-24T08:24:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=da707c54c3424b4b50d4352c2103867284ba6724'/>
<id>da707c54c3424b4b50d4352c2103867284ba6724</id>
<content type='text'>
ch_probe uses the total number of ch devices as minor.

ch_probe:
	ch-&gt;minor = ch_devcount;
...
	ch_devcount++;

Then ch_remove decreases ch_devcount:

ch_remove:
	ch_devcount--;

If you have two ch devices, sch0 and sch1, and remove sch0,
ch_devcount is 1. Then if you add another ch device, ch_probe tries to
create sch1. So you get a warning and fail to create sch1:

Jan 24 16:01:05 nice kernel: sysfs: duplicate filename 'sch1' can not be created
Jan 24 16:01:05 nice kernel: WARNING: at fs/sysfs/dir.c:424 sysfs_add_one()
Jan 24 16:01:05 nice kernel: Pid: 2571, comm: iscsid Not tainted 2.6.24-rc7-ga3d2c2e8-dirty #1
Jan 24 16:01:05 nice kernel:
Jan 24 16:01:05 nice kernel: Call Trace:
Jan 24 16:01:05 nice kernel:  [&lt;ffffffff802a22b8&gt;] sysfs_add_one+0x54/0xbd
Jan 24 16:01:05 nice kernel:  [&lt;ffffffff802a283c&gt;] create_dir+0x4f/0x87
Jan 24 16:01:05 nice kernel:  [&lt;ffffffff802a28a9&gt;] sysfs_create_dir+0x35/0x4a
Jan 24 16:01:05 nice kernel:  [&lt;ffffffff803069a1&gt;] kobject_get+0x12/0x17
Jan 24 16:01:05 nice kernel:  [&lt;ffffffff80306ece&gt;] kobject_add+0xf3/0x1a6
Jan 24 16:01:05 nice kernel:  [&lt;ffffffff8034252b&gt;] class_device_add+0xaa/0x39d
Jan 24 16:01:05 nice kernel:  [&lt;ffffffff803428fb&gt;] class_device_create+0xcb/0xfa
Jan 24 16:01:05 nice kernel:  [&lt;ffffffff80229e09&gt;] printk+0x4e/0x56
Jan 24 16:01:05 nice kernel:  [&lt;ffffffff802a2054&gt;] sysfs_ilookup_test+0x0/0xf
Jan 24 16:01:05 nice kernel:  [&lt;ffffffff88022580&gt;] :ch:ch_probe+0xbe/0x61a

(snip)

This patch converts ch to use a standard minor number management way,
idr like sg and bsg.

Signed-off-by: FUJITA Tomonori &lt;fujita.tomonori@lab.ntt.co.jp&gt;
Signed-off-by: James Bottomley &lt;James.Bottomley@HansenPartnership.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
ch_probe uses the total number of ch devices as minor.

ch_probe:
	ch-&gt;minor = ch_devcount;
...
	ch_devcount++;

Then ch_remove decreases ch_devcount:

ch_remove:
	ch_devcount--;

If you have two ch devices, sch0 and sch1, and remove sch0,
ch_devcount is 1. Then if you add another ch device, ch_probe tries to
create sch1. So you get a warning and fail to create sch1:

Jan 24 16:01:05 nice kernel: sysfs: duplicate filename 'sch1' can not be created
Jan 24 16:01:05 nice kernel: WARNING: at fs/sysfs/dir.c:424 sysfs_add_one()
Jan 24 16:01:05 nice kernel: Pid: 2571, comm: iscsid Not tainted 2.6.24-rc7-ga3d2c2e8-dirty #1
Jan 24 16:01:05 nice kernel:
Jan 24 16:01:05 nice kernel: Call Trace:
Jan 24 16:01:05 nice kernel:  [&lt;ffffffff802a22b8&gt;] sysfs_add_one+0x54/0xbd
Jan 24 16:01:05 nice kernel:  [&lt;ffffffff802a283c&gt;] create_dir+0x4f/0x87
Jan 24 16:01:05 nice kernel:  [&lt;ffffffff802a28a9&gt;] sysfs_create_dir+0x35/0x4a
Jan 24 16:01:05 nice kernel:  [&lt;ffffffff803069a1&gt;] kobject_get+0x12/0x17
Jan 24 16:01:05 nice kernel:  [&lt;ffffffff80306ece&gt;] kobject_add+0xf3/0x1a6
Jan 24 16:01:05 nice kernel:  [&lt;ffffffff8034252b&gt;] class_device_add+0xaa/0x39d
Jan 24 16:01:05 nice kernel:  [&lt;ffffffff803428fb&gt;] class_device_create+0xcb/0xfa
Jan 24 16:01:05 nice kernel:  [&lt;ffffffff80229e09&gt;] printk+0x4e/0x56
Jan 24 16:01:05 nice kernel:  [&lt;ffffffff802a2054&gt;] sysfs_ilookup_test+0x0/0xf
Jan 24 16:01:05 nice kernel:  [&lt;ffffffff88022580&gt;] :ch:ch_probe+0xbe/0x61a

(snip)

This patch converts ch to use a standard minor number management way,
idr like sg and bsg.

Signed-off-by: FUJITA Tomonori &lt;fujita.tomonori@lab.ntt.co.jp&gt;
Signed-off-by: James Bottomley &lt;James.Bottomley@HansenPartnership.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[SCSI] ch: handle class_device_create failure properly</title>
<updated>2008-01-23T19:44:47+00:00</updated>
<author>
<name>FUJITA Tomonori</name>
<email>tomof@acm.org</email>
</author>
<published>2008-01-23T14:34:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=a3d2c2e8f5e01e185013d8f944c0a26fdc558ad8'/>
<id>a3d2c2e8f5e01e185013d8f944c0a26fdc558ad8</id>
<content type='text'>
When class_device_create fails, ch_probe needs to fail too.

Signed-off-by: FUJITA Tomonori &lt;fujita.tomonori@lab.ntt.co.jp&gt;
Signed-off-by: James Bottomley &lt;James.Bottomley@HansenPartnership.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When class_device_create fails, ch_probe needs to fail too.

Signed-off-by: FUJITA Tomonori &lt;fujita.tomonori@lab.ntt.co.jp&gt;
Signed-off-by: James Bottomley &lt;James.Bottomley@HansenPartnership.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[SCSI] ch: Convert to use unlocked_ioctl</title>
<updated>2008-01-23T17:29:28+00:00</updated>
<author>
<name>Mathieu Segaud</name>
<email>mathieu.segaud@regala.cx</email>
</author>
<published>2008-01-14T14:43:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=f7fea185d2998dc4c902ec47834ab6db28fe0029'/>
<id>f7fea185d2998dc4c902ec47834ab6db28fe0029</id>
<content type='text'>
As of now, compat_ioctl already runs without the BKL, whereas ioctl runs
with the BKL. This patch first converts changer_fops to use a .unlocked_ioctl
member. It applies the same locking rationale than ch_ioctl_compat() uses
to ch_ioctl().

Signed-off-by: Mathieu Segaud &lt;mathieu.segaud@regala.cx&gt;
Reviewed-by: Matthew Wilcox &lt;willy@linux.intel.com&gt;
Signed-off-by: James Bottomley &lt;James.Bottomley@HansenPartnership.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
As of now, compat_ioctl already runs without the BKL, whereas ioctl runs
with the BKL. This patch first converts changer_fops to use a .unlocked_ioctl
member. It applies the same locking rationale than ch_ioctl_compat() uses
to ch_ioctl().

Signed-off-by: Mathieu Segaud &lt;mathieu.segaud@regala.cx&gt;
Reviewed-by: Matthew Wilcox &lt;willy@linux.intel.com&gt;
Signed-off-by: James Bottomley &lt;James.Bottomley@HansenPartnership.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
