There is a NULL reference OOPS in target_fabric_port_link. Reproducible: Always Steps to Reproduce: 1. Install sys-kernel/gentoo-sources-3.7.4 and sys-block/lio-utils 2. Run kernel 3.7.4 with the iscsi target either compiled in or as a module 3. Start /etc/init.d/target Actual Results: Oops in target_fabric_port_link Expected Results: iSCSI target starts without errors The 3.7.4 release on kernel.org seems to have brought in commit 0ff8754 (target: Add link_magic for fabric allow_link destination target_items) without bringing in commit 0fd97cc (target: kill struct se_subsystem_dev), which commit 0ff8754 is based upon.
Created attachment 336878 [details] Oops from target_fabric_port_link
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=0ff8754981261a80f4b77db2536dfea92c2d4539 http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=0fd97ccf45be26fb01b3a412f1f6c6b5044b2f16 Feels like commit 0fd97ccf45be26fb01b3a412f1f6c6b5044b2f16 was taken instead of 3d70f8c617a436c7146ecb81df2265b4626dfe89 (Linux 3.7-rc4) to produce the 3.7.4 patchset.
The gentoo-sources maintainer appears to have taken the right commit - commit 8a69ca20f06d1878aa0ee8000a60d8226ab6b6a1 (Linux 3.7.4). However, the linux-stable 3.7.y kernel series maintainter appears to have merged commit 0ff8754981261a80f4b77db2536dfea92c2d4539 (target: Add link_magic for fabric allow_link destination target_items) as merge commit fdf9d862969f1be18814273b03fb9497ec2dbdae without merging commit 0fd97ccf45be26fb01b3a412f1f6c6b5044b2f16. http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=commit;h=fdf9d862969f1be18814273b03fb9497ec2dbdae
Will adding 0fd97ccf45be26fb01b3a412f1f6c6b5044b2f16 to 3.7 solve the issue?
(In reply to comment #3) > The gentoo-sources maintainer appears to have taken the right commit - commit 8a69ca20f06d1878aa0ee8000a60d8226ab6b6a1 (Linux 3.7.4). > > However, the linux-stable 3.7.y kernel series maintainter appears to have > merged commit 0ff8754981261a80f4b77db2536dfea92c2d4539 (target: Add > link_magic for fabric allow_link destination target_items) as merge commit > fdf9d862969f1be18814273b03fb9497ec2dbdae without merging commit > 0fd97ccf45be26fb01b3a412f1f6c6b5044b2f16. Ah, I wasn't using the stable kernel in my case and got confused about how stable releases work, I've read up on it and now see they port over commits to a separate stable tree. A search for that missing commit in the log of Linux 3.7.4 on there indeed yields no result. http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Fstable%2Flinux-stable.git&a=search&h=8a69ca20f06d1878aa0ee8000a60d8226ab6b6a1&st=commit&s=0fd97ccf45be26fb01b3a412f1f6c6b5044b2f16 As mpagano asked, can you confirm that adding this missing commit fixes this? http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=commitdiff_plain;h=0fd97ccf45be26fb01b3a412f1f6c6b5044b2f16 You can download that and run `patch -p1 < file_name_here` in the kernel dir.
The 0fd97ccf45be26fb01b3a412f1f6c6b5044b2f16 looks too invasive to merge as is. I believe that it is only one place where commit 0ff8754981261a80f4b77db2536dfea92c2d4539 causes an OOPS, and it can be resolved by moving the dev->dev_link_magic check to after de_device *dev is initialized in target_fabric_port_link. Either that or simply revert fdf9d862969f1be18814273b03fb9497ec2dbdae.
Created attachment 337748 [details, diff] target: Move dev->dev_link_magic check to after dev initialization Commit fdf9d862969f1be18814273b03fb9497ec2dbdae (target: Add link_magic for fabric allow_link destination target_items) applied without commit 0fd97ccf45be26fb01b3a412f1f6c6b5044b2f16 (Simplify the code a lot by killing the superflous struct se_subsystem_dev) put the dev->dev_link_magic check before dev was initialized in target_fabric_port_link. This patch moves the dev->dev_link_magic check to after dev is initialized.
I have submitted patches upstream for linux-3.4.y and linux-3.7.y, both of which are affected by this regression. https://patchwork.kernel.org/patch/2086021/ https://patchwork.kernel.org/patch/2086011/
Should have looked at the stable queue first - an equivalent of my patch is already in the stable queue for linux-3.4.y and linux-3.7.y
Patches in stable queue: http://git.kernel.org/?p=linux/kernel/git/stable/stable-queue.git;a=blob_plain;f=queue-3.4/target-fix-regression-with-dev_link_magic-in-target_fabric_port_link.patch;h=856a6901e052912b809ceb106dcf9aad76c20070;hb=d4e18cc31d5e6ea6b461a55b58ade47d4f12c06e http://git.kernel.org/?p=linux/kernel/git/stable/stable-queue.git;a=blob_plain;f=queue-3.7/target-fix-regression-with-dev_link_magic-in-target_fabric_port_link.patch;h=4560e28525d29cb0f675705581e891b601c6c241;hb=d4e18cc31d5e6ea6b461a55b58ade47d4f12c06e
This is fixed in 3.7.6 and 3.4.29