<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/scsi/fcoe, branch v6.1.168</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.1.168</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.1.168'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2024-02-23T08:12:37+00:00</updated>
<entry>
<title>scsi: Revert "scsi: fcoe: Fix potential deadlock on &amp;fip-&gt;ctlr_lock"</title>
<updated>2024-02-23T08:12:37+00:00</updated>
<author>
<name>Lee Duncan</name>
<email>lduncan@suse.com</email>
</author>
<published>2024-02-09T18:07:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=6bb22ac1d11d7d20f91e7fd2e657a9e5f6db65e0'/>
<id>urn:sha1:6bb22ac1d11d7d20f91e7fd2e657a9e5f6db65e0</id>
<content type='text'>
commit 977fe773dcc7098d8eaf4ee6382cb51e13e784cb upstream.

This reverts commit 1a1975551943f681772720f639ff42fbaa746212.

This commit causes interrupts to be lost for FCoE devices, since it changed
sping locks from "bh" to "irqsave".

Instead, a work queue should be used, and will be addressed in a separate
commit.

Fixes: 1a1975551943 ("scsi: fcoe: Fix potential deadlock on &amp;fip-&gt;ctlr_lock")
Signed-off-by: Lee Duncan &lt;lduncan@suse.com&gt;
Link: https://lore.kernel.org/r/c578cdcd46b60470535c4c4a953e6a1feca0dffd.1707500786.git.lduncan@suse.com
Reviewed-by: Hannes Reinecke &lt;hare@suse.de&gt;
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>scsi: fcoe: Fix potential deadlock on &amp;fip-&gt;ctlr_lock</title>
<updated>2023-09-13T07:42:56+00:00</updated>
<author>
<name>Chengfeng Ye</name>
<email>dg573847474@gmail.com</email>
</author>
<published>2023-08-17T07:47:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=5a5fb3b1754fa2b4db95f0151b4af0fb6f8918ec'/>
<id>urn:sha1:5a5fb3b1754fa2b4db95f0151b4af0fb6f8918ec</id>
<content type='text'>
[ Upstream commit 1a1975551943f681772720f639ff42fbaa746212 ]

There is a long call chain that &amp;fip-&gt;ctlr_lock is acquired by isr
fnic_isr_msix_wq_copy() under hard IRQ context. Thus other process context
code acquiring the lock should disable IRQ, otherwise deadlock could happen
if the IRQ preempts the execution while the lock is held in process context
on the same CPU.

[ISR]
fnic_isr_msix_wq_copy()
 -&gt; fnic_wq_copy_cmpl_handler()
 -&gt; fnic_fcpio_cmpl_handler()
 -&gt; fnic_fcpio_flogi_reg_cmpl_handler()
 -&gt; fnic_flush_tx()
 -&gt; fnic_send_frame()
 -&gt; fcoe_ctlr_els_send()
 -&gt; spin_lock_bh(&amp;fip-&gt;ctlr_lock)

[Process Context]
1. fcoe_ctlr_timer_work()
 -&gt; fcoe_ctlr_flogi_send()
 -&gt; spin_lock_bh(&amp;fip-&gt;ctlr_lock)

2. fcoe_ctlr_recv_work()
 -&gt; fcoe_ctlr_recv_handler()
 -&gt; fcoe_ctlr_recv_els()
 -&gt; fcoe_ctlr_announce()
 -&gt; spin_lock_bh(&amp;fip-&gt;ctlr_lock)

3. fcoe_ctlr_recv_work()
 -&gt; fcoe_ctlr_recv_handler()
 -&gt; fcoe_ctlr_recv_els()
 -&gt; fcoe_ctlr_flogi_retry()
 -&gt; spin_lock_bh(&amp;fip-&gt;ctlr_lock)

4. -&gt; fcoe_xmit()
 -&gt; fcoe_ctlr_els_send()
 -&gt; spin_lock_bh(&amp;fip-&gt;ctlr_lock)

spin_lock_bh() is not enough since fnic_isr_msix_wq_copy() is a
hardirq.

These flaws were found by an experimental static analysis tool I am
developing for irq-related deadlock.

The patch fix the potential deadlocks by spin_lock_irqsave() to disable
hard irq.

Fixes: 794d98e77f59 ("[SCSI] libfcoe: retry rejected FLOGI to another FCF if possible")
Signed-off-by: Chengfeng Ye &lt;dg573847474@gmail.com&gt;
Link: https://lore.kernel.org/r/20230817074708.7509-1-dg573847474@gmail.com
Reviewed-by: Davidlohr Bueso &lt;dave@stgolabs.net&gt;
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>scsi: fcoe: Fix transport not deattached when fcoe_if_init() fails</title>
<updated>2022-12-31T12:32:35+00:00</updated>
<author>
<name>Chen Zhongjin</name>
<email>chenzhongjin@huawei.com</email>
</author>
<published>2022-11-15T09:24:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=aef82d16be5a353d913163f26fc4385e296be2b8'/>
<id>urn:sha1:aef82d16be5a353d913163f26fc4385e296be2b8</id>
<content type='text'>
[ Upstream commit 4155658cee394b22b24c6d64e49247bf26d95b92 ]

fcoe_init() calls fcoe_transport_attach(&amp;fcoe_sw_transport), but when
fcoe_if_init() fails, &amp;fcoe_sw_transport is not detached and leaves freed
&amp;fcoe_sw_transport on fcoe_transports list. This causes panic when
reinserting module.

 BUG: unable to handle page fault for address: fffffbfff82e2213
 RIP: 0010:fcoe_transport_attach+0xe1/0x230 [libfcoe]
 Call Trace:
  &lt;TASK&gt;
  do_one_initcall+0xd0/0x4e0
  load_module+0x5eee/0x7210
  ...

Fixes: 78a582463c1e ("[SCSI] fcoe: convert fcoe.ko to become an fcoe transport provider driver")
Signed-off-by: Chen Zhongjin &lt;chenzhongjin@huawei.com&gt;
Link: https://lore.kernel.org/r/20221115092442.133088-1-chenzhongjin@huawei.com
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>scsi: fcoe: Fix possible name leak when device_register() fails</title>
<updated>2022-12-31T12:32:35+00:00</updated>
<author>
<name>Yang Yingliang</name>
<email>yangyingliang@huawei.com</email>
</author>
<published>2022-11-12T09:43:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=cfa2f8098a6e2455fac1569fabb770068b7c9c5f'/>
<id>urn:sha1:cfa2f8098a6e2455fac1569fabb770068b7c9c5f</id>
<content type='text'>
[ Upstream commit 47b6a122c7b69a876c7ee2fc064a26b09627de9d ]

If device_register() returns an error, the name allocated by dev_set_name()
needs to be freed. As the comment of device_register() says, one should use
put_device() to give up the reference in the error path. Fix this by
calling put_device(), then the name can be freed in kobject_cleanup().

The 'fcf' is freed in fcoe_fcf_device_release(), so the kfree() in the
error path can be removed.

The 'ctlr' is freed in fcoe_ctlr_device_release(), so don't use the error
label, just return NULL after calling put_device().

Fixes: 9a74e884ee71 ("[SCSI] libfcoe: Add fcoe_sysfs")
Signed-off-by: Yang Yingliang &lt;yangyingliang@huawei.com&gt;
Link: https://lore.kernel.org/r/20221112094310.3633291-1-yangyingliang@huawei.com
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>treewide: use prandom_u32_max() when possible, part 1</title>
<updated>2022-10-11T23:42:55+00:00</updated>
<author>
<name>Jason A. Donenfeld</name>
<email>Jason@zx2c4.com</email>
</author>
<published>2022-10-05T14:43:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=81895a65ec63ee1daec3255dc1a06675d2fbe915'/>
<id>urn:sha1:81895a65ec63ee1daec3255dc1a06675d2fbe915</id>
<content type='text'>
Rather than incurring a division or requesting too many random bytes for
the given range, use the prandom_u32_max() function, which only takes
the minimum required bytes from the RNG and avoids divisions. This was
done mechanically with this coccinelle script:

@basic@
expression E;
type T;
identifier get_random_u32 =~ "get_random_int|prandom_u32|get_random_u32";
typedef u64;
@@
(
- ((T)get_random_u32() % (E))
+ prandom_u32_max(E)
|
- ((T)get_random_u32() &amp; ((E) - 1))
+ prandom_u32_max(E * XXX_MAKE_SURE_E_IS_POW2)
|
- ((u64)(E) * get_random_u32() &gt;&gt; 32)
+ prandom_u32_max(E)
|
- ((T)get_random_u32() &amp; ~PAGE_MASK)
+ prandom_u32_max(PAGE_SIZE)
)

@multi_line@
identifier get_random_u32 =~ "get_random_int|prandom_u32|get_random_u32";
identifier RAND;
expression E;
@@

-       RAND = get_random_u32();
        ... when != RAND
-       RAND %= (E);
+       RAND = prandom_u32_max(E);

// Find a potential literal
@literal_mask@
expression LITERAL;
type T;
identifier get_random_u32 =~ "get_random_int|prandom_u32|get_random_u32";
position p;
@@

        ((T)get_random_u32()@p &amp; (LITERAL))

// Add one to the literal.
@script:python add_one@
literal &lt;&lt; literal_mask.LITERAL;
RESULT;
@@

value = None
if literal.startswith('0x'):
        value = int(literal, 16)
elif literal[0] in '123456789':
        value = int(literal, 10)
if value is None:
        print("I don't know how to handle %s" % (literal))
        cocci.include_match(False)
elif value == 2**32 - 1 or value == 2**31 - 1 or value == 2**24 - 1 or value == 2**16 - 1 or value == 2**8 - 1:
        print("Skipping 0x%x for cleanup elsewhere" % (value))
        cocci.include_match(False)
elif value &amp; (value + 1) != 0:
        print("Skipping 0x%x because it's not a power of two minus one" % (value))
        cocci.include_match(False)
elif literal.startswith('0x'):
        coccinelle.RESULT = cocci.make_expr("0x%x" % (value + 1))
else:
        coccinelle.RESULT = cocci.make_expr("%d" % (value + 1))

// Replace the literal mask with the calculated result.
@plus_one@
expression literal_mask.LITERAL;
position literal_mask.p;
expression add_one.RESULT;
identifier FUNC;
@@

-       (FUNC()@p &amp; (LITERAL))
+       prandom_u32_max(RESULT)

@collapse_ret@
type T;
identifier VAR;
expression E;
@@

 {
-       T VAR;
-       VAR = (E);
-       return VAR;
+       return E;
 }

@drop_var@
type T;
identifier VAR;
@@

 {
-       T VAR;
        ... when != VAR
 }

Reviewed-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Reviewed-by: Kees Cook &lt;keescook@chromium.org&gt;
Reviewed-by: Yury Norov &lt;yury.norov@gmail.com&gt;
Reviewed-by: KP Singh &lt;kpsingh@kernel.org&gt;
Reviewed-by: Jan Kara &lt;jack@suse.cz&gt; # for ext4 and sbitmap
Reviewed-by: Christoph Böhmwalder &lt;christoph.boehmwalder@linbit.com&gt; # for drbd
Acked-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
Acked-by: Heiko Carstens &lt;hca@linux.ibm.com&gt; # for s390
Acked-by: Ulf Hansson &lt;ulf.hansson@linaro.org&gt; # for mmc
Acked-by: Darrick J. Wong &lt;djwong@kernel.org&gt; # for xfs
Signed-off-by: Jason A. Donenfeld &lt;Jason@zx2c4.com&gt;
</content>
</entry>
<entry>
<title>scsi: fcoe: Remove redundant assignment to variable 'wlen'</title>
<updated>2022-06-28T02:45:25+00:00</updated>
<author>
<name>Colin Ian King</name>
<email>colin.i.king@gmail.com</email>
</author>
<published>2022-06-23T16:47:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=07f0c8aff55156e0ef671fdc87bb44207cfc4f56'/>
<id>urn:sha1:07f0c8aff55156e0ef671fdc87bb44207cfc4f56</id>
<content type='text'>
Variable wlen is being assigned a value that is never read, it is being
re-assigned with a different value later on. The assignment is redundant
and can be removed.

Cleans up clang scan build warning:
drivers/scsi/fcoe/fcoe.c:1491:2: warning: Value stored to 'wlen'
is never read [deadcode.DeadStores]

Link: https://lore.kernel.org/r/20220623164710.76831-1-colin.i.king@gmail.com
Signed-off-by: Colin Ian King &lt;colin.i.king@gmail.com&gt;
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
</content>
</entry>
<entry>
<title>Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi</title>
<updated>2022-05-26T02:09:48+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2022-05-26T02:09:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=fbe86daca0ba878b04fa241b85e26e54d17d4229'/>
<id>urn:sha1:fbe86daca0ba878b04fa241b85e26e54d17d4229</id>
<content type='text'>
Pull SCSI updates from James Bottomley:
 "This consists of a small set of driver updates (lpfc, ufs, mpt3sas
  mpi3mr, iscsi target). Apart from that this is mostly small fixes with
  very few core changes (the biggest one being VPD caching)"

* tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (177 commits)
  scsi: target: tcmu: Avoid holding XArray lock when calling lock_page
  scsi: elx: efct: Remove NULL check after calling container_of()
  scsi: dpt_i2o: Drop redundant spinlock initialization
  scsi: qedf: Remove redundant variable op
  scsi: hisi_sas: Fix memory ordering in hisi_sas_task_deliver()
  scsi: fnic: Replace DMA mask of 64 bits with 47 bits
  scsi: mpi3mr: Add target device related sysfs attributes
  scsi: mpi3mr: Add shost related sysfs attributes
  scsi: elx: efct: Remove redundant memset() statement
  scsi: megaraid_sas: Remove redundant memset() statement
  scsi: mpi3mr: Return error if dma_alloc_coherent() fails
  scsi: hisi_sas: Fix rescan after deleting a disk
  scsi: hisi_sas: Use sas_ata_wait_after_reset() in IT nexus reset
  scsi: libsas: Refactor sas_ata_hard_reset()
  scsi: mpt3sas: Update driver version to 42.100.00.00
  scsi: mpt3sas: Fix junk chars displayed while printing ChipName
  scsi: ipr: Use kobj_to_dev()
  scsi: mpi3mr: Fix a NULL vs IS_ERR() bug in mpi3mr_bsg_init()
  scsi: bnx2fc: Avoid using get_cpu() in bnx2fc_cmd_alloc()
  scsi: libfc: Remove get_cpu() semantics in fc_exch_em_alloc()
  ...
</content>
</entry>
<entry>
<title>Merge tag 'Wstringop-overflow-fixes-5.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux</title>
<updated>2022-05-25T20:52:24+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2022-05-25T20:52:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=a3a8b54b4f1a261656eb6c9a517e68e1204cef39'/>
<id>urn:sha1:a3a8b54b4f1a261656eb6c9a517e68e1204cef39</id>
<content type='text'>
Pull Wstringop-overflow fixes from Gustavo Silva:
 "Fix some -Wstringop-overflow warnings when building with GCC-11. All
  the patches have been in linux-next during the last development cycle.

  This is part of the ongoing efforts to globally enable
  -Wstringop-overflow"

* tag 'Wstringop-overflow-fixes-5.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux:
  drm/i915: Fix -Wstringop-overflow warning in call to intel_read_wm_latency()
  drm/amd/display: Fix Wstringop-overflow warnings in dc_link_dp.c
  scsi: fcoe: Fix Wstringop-overflow warnings in fcoe_wwn_from_mac()
</content>
</entry>
<entry>
<title>scsi: fcoe: Use per-CPU API to update per-CPU statistics</title>
<updated>2022-05-17T01:26:50+00:00</updated>
<author>
<name>Sebastian Andrzej Siewior</name>
<email>bigeasy@linutronix.de</email>
</author>
<published>2022-05-06T10:57:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=a912460efafea8ba763717b083347d5b33495bfa'/>
<id>urn:sha1:a912460efafea8ba763717b083347d5b33495bfa</id>
<content type='text'>
The per-CPU statistics (struct fc_stats) is updated by getting a stable
per-CPU pointer via get_cpu() + per_cpu_ptr() and then performing the
increment. This can be optimized by using this_cpu_*() which will do
whatever is needed on the architecture to perform the update safe and
efficient.  The read out of the individual value (fc_get_host_stats())
should be done by using READ_ONCE() instead of a plain-C access. The
difference is that READ_ONCE() will always perform a single access while
the plain-C access can be split by the compiler into two loads if it
appears beneficial.  The usage of u64 has the side-effect that it is also
64bit wide on 32bit architectures and the read is always split into two
loads. The can lead to strange values if the read happens during an update
which alters both 32bit parts of the 64bit value. This can be circumvented
by either using a 32bit variables on 32bit architecures or extending the
statistics with a sequence counter.

Use this_cpu_*() API to update the statistics and READ_ONCE() to read it.

Link: https://lore.kernel.org/r/20220506105758.283887-3-bigeasy@linutronix.de
Reviewed-by: Davidlohr Bueso &lt;dave@stgolabs.net&gt;
Signed-off-by: Sebastian Andrzej Siewior &lt;bigeasy@linutronix.de&gt;
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
</content>
</entry>
<entry>
<title>scsi: fcoe: Add a local_lock to fcoe_percpu</title>
<updated>2022-05-17T01:26:50+00:00</updated>
<author>
<name>Davidlohr Bueso</name>
<email>dave@stgolabs.net</email>
</author>
<published>2022-05-06T10:57:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=848b89778ed53e6c9f9e3ed01c90109ee970b3d1'/>
<id>urn:sha1:848b89778ed53e6c9f9e3ed01c90109ee970b3d1</id>
<content type='text'>
fcoe_get_paged_crc_eof() relies on the caller having preemption disabled to
ensure the per-CPU fcoe_percpu context remains valid throughout the
call. This is done by either holding spinlocks (such as bnx2fc_global_lock
or qedf_global_lock) or the get_cpu() from fcoe_alloc_paged_crc_eof(). This
last one breaks PREEMPT_RT semantics as there can be memory allocation and
end up sleeping in atomic contexts.

Introduce a local_lock_t to struct fcoe_percpu that will keep the non-RT
case the same, mapping to preempt_disable/enable, while RT will use a
per-CPU spinlock allowing the region to be preemptible but still maintain
CPU locality. The other users of fcoe_percpu are already safe in this
regard and do not require local_lock()ing.

Link: https://lore.kernel.org/r/20211117025956.79616-3-dave@stgolabs.net
Link: https://lore.kernel.org/r/20220506105758.283887-2-bigeasy@linutronix.de
Acked-by: Sebastian Andrzej Siewior &lt;bigeasy@linutronix.de&gt;
Signed-off-by: Davidlohr Bueso &lt;dave@stgolabs.net&gt;
Signed-off-by: Sebastian Andrzej Siewior &lt;bigeasy@linutronix.de&gt;
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
</content>
</entry>
</feed>
