<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/scsi/libfc/fc_exch.c, branch linux-4.4.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.4.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.4.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2021-02-10T08:07:26Z</updated>
<entry>
<title>scsi: libfc: Avoid invoking response handler twice if ep is already completed</title>
<updated>2021-02-10T08:07:26Z</updated>
<author>
<name>Javed Hasan</name>
</author>
<published>2020-12-15T19:47:31Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=82035511b25be08c4cdb6e38df16e9d061f3251d'/>
<id>urn:sha1:82035511b25be08c4cdb6e38df16e9d061f3251d</id>
<content type='text'>
[ Upstream commit b2b0f16fa65e910a3ec8771206bb49ee87a54ac5 ]

A race condition exists between the response handler getting called because
of exchange_mgr_reset() (which clears out all the active XIDs) and the
response we get via an interrupt.

Sequence of events:

	 rport ba0200: Port timeout, state PLOGI
	 rport ba0200: Port entered PLOGI state from PLOGI state
	 xid 1052: Exchange timer armed : 20000 msecs      xid timer armed here
	 rport ba0200: Received LOGO request while in state PLOGI
	 rport ba0200: Delete port
	 rport ba0200: work event 3
	 rport ba0200: lld callback ev 3
	 bnx2fc: rport_event_hdlr: event = 3, port_id = 0xba0200
	 bnx2fc: ba0200 - rport not created Yet!!
	 /* Here we reset any outstanding exchanges before
	 freeing rport using the exch_mgr_reset() */
	 xid 1052: Exchange timer canceled
	 /* Here we got two responses for one xid */
	 xid 1052: invoking resp(), esb 20000000 state 3
	 xid 1052: invoking resp(), esb 20000000 state 3
	 xid 1052: fc_rport_plogi_resp() : ep-&gt;resp_active 2
	 xid 1052: fc_rport_plogi_resp() : ep-&gt;resp_active 2

Skip the response if the exchange is already completed.

Link: https://lore.kernel.org/r/20201215194731.2326-1-jhasan@marvell.com
Signed-off-by: Javed Hasan &lt;jhasan@marvell.com&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: libfc: fix null pointer dereference on a null lport</title>
<updated>2020-01-29T09:21:45Z</updated>
<author>
<name>Colin Ian King</name>
</author>
<published>2019-07-02T09:18:35Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8b87ccd33657a5c3a30b0abf348b0d19b9256627'/>
<id>urn:sha1:8b87ccd33657a5c3a30b0abf348b0d19b9256627</id>
<content type='text'>
[ Upstream commit 41a6bf6529edd10a6def42e3b2c34a7474bcc2f5 ]

Currently if lport is null then the null lport pointer is dereference when
printing out debug via the FC_LPORT_DB macro. Fix this by using the more
generic FC_LIBFC_DBG debug macro instead that does not use lport.

Addresses-Coverity: ("Dereference after null check")
Fixes: 7414705ea4ae ("libfc: Add runtime debugging with debug_logging module parameter")
Signed-off-by: Colin Ian King &lt;colin.king@canonical.com&gt;
Reviewed-by: Hannes Reinecke &lt;hare@suse.com&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>libfc: Fix fc_exch_recv_req() error path</title>
<updated>2015-08-12T18:23:30Z</updated>
<author>
<name>Bart Van Assche</name>
</author>
<published>2015-06-05T21:20:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f6979adeaab578f8ca14fdd32b06ddee0d9d3314'/>
<id>urn:sha1:f6979adeaab578f8ca14fdd32b06ddee0d9d3314</id>
<content type='text'>
Due to patch "libfc: Do not invoke the response handler after
fc_exch_done()" (commit ID 7030fd62) the lport_recv() call
in fc_exch_recv_req() is passed a dangling pointer. Avoid this
by moving the fc_frame_free() call from fc_invoke_resp() to its
callers. This patch fixes the following crash:

general protection fault: 0000 [#3] PREEMPT SMP
RIP: fc_lport_recv_req+0x72/0x280 [libfc]
Call Trace:
 fc_exch_recv+0x642/0xde0 [libfc]
 fcoe_percpu_receive_thread+0x46a/0x5ed [fcoe]
 kthread+0x10a/0x120
 ret_from_fork+0x42/0x70

Signed-off-by: Bart Van Assche &lt;bart.vanassche@sandisk.com&gt;
Cc: stable &lt;stable@vger.kernel.org&gt;
Signed-off-by: Vasu Dev &lt;vasu.dev@intel.com&gt;
Signed-off-by: James Bottomley &lt;JBottomley@Odin.com&gt;
</content>
</entry>
<entry>
<title>libfc: Do not invoke the response handler after fc_exch_done()</title>
<updated>2013-09-04T20:45:22Z</updated>
<author>
<name>Bart Van Assche</name>
</author>
<published>2013-08-17T20:34:43Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7030fd626129ec4d616784516a462d317c251d39'/>
<id>urn:sha1:7030fd626129ec4d616784516a462d317c251d39</id>
<content type='text'>
While the FCoE initiator driver invokes fc_exch_done() from inside
the libfc response handler, FCoE target drivers typically invoke
fc_exch_done() from outside the libfc response handler. The object
fc_exch.arg points at may disappear as soon as fc_exch_done() has
finished. So it's important not to invoke the response handler
function after fc_exch_done() has finished. Modify libfc such that
this guarantee is provided if fc_exch_done() is invoked from
outside a response handler. This patch fixes a sporadic crash in
FCoE target implementations after a command has been aborted.

Signed-off-by: Bart Van Assche &lt;bvanassche@acm.org&gt;
Cc: Neil Horman &lt;nhorman@tuxdriver.com&gt;
Signed-off-by: Robert Love &lt;robert.w.love@intel.com&gt;
</content>
</entry>
<entry>
<title>libfc: Reduce exchange lock contention in fc_exch_recv_abts()</title>
<updated>2013-09-04T20:37:53Z</updated>
<author>
<name>Bart Van Assche</name>
</author>
<published>2013-08-14T15:38:24Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f95b35cfcacadac16dbc5477fd22b0786256a3d1'/>
<id>urn:sha1:f95b35cfcacadac16dbc5477fd22b0786256a3d1</id>
<content type='text'>
Reduce the time during which the exchange lock is held by allocating
a frame before obtaining the exchange lock.

Signed-off-by: Bart Van Assche &lt;bvanassche@acm.org&gt;
Cc: Neil Horman &lt;nhorman@tuxdriver.com&gt;
Signed-off-by: Robert Love &lt;robert.w.love@intel.com&gt;
</content>
</entry>
<entry>
<title>libfc: Avoid that sending after an abort triggers a kernel warning</title>
<updated>2013-09-04T20:30:43Z</updated>
<author>
<name>Bart Van Assche</name>
</author>
<published>2013-08-14T15:37:52Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=cae7b6dd6c569f18f5c8e3f33cac60fbaeb58140'/>
<id>urn:sha1:cae7b6dd6c569f18f5c8e3f33cac60fbaeb58140</id>
<content type='text'>
Calling fc_seq_send() after an ABTS message has been received triggers
a kernel warning (WARN_ON(!(ep-&gt;esb_stat &amp; ESB_ST_SEQ_INIT))). Avoid
this by returning -ENXIO to the caller if fc_seq_send() is invoked after
an ABTS message has been received.

Signed-off-by: Bart Van Assche &lt;bvanassche@acm.org&gt;
Cc: Neil Horman &lt;nhorman@tuxdriver.com&gt;
Signed-off-by: Robert Love &lt;robert.w.love@intel.com&gt;
</content>
</entry>
<entry>
<title>libfc: Protect ep-&gt;esb_stat changes via ex_lock</title>
<updated>2013-09-04T20:23:38Z</updated>
<author>
<name>Bart Van Assche</name>
</author>
<published>2013-08-14T15:37:08Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5d73bea2d3a004698d16ba5face89f0bef383e76'/>
<id>urn:sha1:5d73bea2d3a004698d16ba5face89f0bef383e76</id>
<content type='text'>
This patch avoids that the WARN_ON(!(ep-&gt;esb_stat &amp; ESB_ST_SEQ_INIT))
statement in fc_seq_send_locked() gets triggered sporadically when
running FCoE target code due to concurrent ep-&gt;esb_stat modifications.

Signed-off-by: Bart Van Assche &lt;bvanassche@acm.org&gt;
Cc: Neil Horman &lt;nhorman@tuxdriver.com&gt;
Signed-off-by: Robert Love &lt;robert.w.love@intel.com&gt;
</content>
</entry>
<entry>
<title>libfc: Fix a race in fc_exch_timer_set_locked()</title>
<updated>2013-09-04T20:16:25Z</updated>
<author>
<name>Bart Van Assche</name>
</author>
<published>2013-08-14T15:35:29Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b86788658be425a5454246a954721d9122d2b3d6'/>
<id>urn:sha1:b86788658be425a5454246a954721d9122d2b3d6</id>
<content type='text'>
It is allowed to pass a zero timeout value to fc_seq_exch_abort().
Avoid that this can cause the timeout function to drop the exchange
reference before it has been increased by fc_exch_timer_set_locked().
This patch fixes a crash when running FCoE target code with poisoning
enabled in the memory allocator.

Signed-off-by: Bart Van Assche &lt;bvanassche@acm.org&gt;
Cc: Neil Horman &lt;nhorman@tuxdriver.com&gt;
Signed-off-by: Robert Love &lt;robert.w.love@intel.com&gt;
</content>
</entry>
<entry>
<title>libfc: Clarify fc_exch_find()</title>
<updated>2013-09-04T20:09:15Z</updated>
<author>
<name>Bart Van Assche</name>
</author>
<published>2013-08-17T20:20:07Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8d08023687e2515f2a48235aed80b6982025cd09'/>
<id>urn:sha1:8d08023687e2515f2a48235aed80b6982025cd09</id>
<content type='text'>
The condition ep != NULL &amp;&amp; ep-&gt;xid != xid can never be met. Make
this explicit.

Signed-off-by: Bart Van Assche &lt;bvanassche@acm.org&gt;
Cc: Neil Horman &lt;nhorman@tuxdriver.com&gt;
Signed-off-by: Robert Love &lt;robert.w.love@intel.com&gt;
</content>
</entry>
<entry>
<title>libfc: Micro-optimize fc_setup_exch_mgr()</title>
<updated>2013-09-04T20:02:09Z</updated>
<author>
<name>Bart Van Assche</name>
</author>
<published>2013-08-14T15:33:35Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a84ea8c7e839a73dab4bfc755f7f52e947690dab'/>
<id>urn:sha1:a84ea8c7e839a73dab4bfc755f7f52e947690dab</id>
<content type='text'>
Convert a loop into an ilog2() call. Although this code is not performance
sensitive this conversion makes this code easier to read.

Signed-off-by: Bart Van Assche &lt;bvanassche@acm.org&gt;
Cc: Neil Horman &lt;nhorman@tuxdriver.com&gt;
Signed-off-by: Robert Love &lt;robert.w.love@intel.com&gt;
</content>
</entry>
</feed>
