<feed xmlns='http://www.w3.org/2005/Atom'>
<title>lwn.git/drivers/scsi/libfc/fc_exch.c, branch doc/4.9</title>
<subtitle>Linux kernel documentation tree maintained by Jonathan Corbet</subtitle>
<id>http://mirrors.hust.edu.cn/git/lwn.git/atom?h=doc%2F4.9</id>
<link rel='self' href='http://mirrors.hust.edu.cn/git/lwn.git/atom?h=doc%2F4.9'/>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/'/>
<updated>2016-07-14T01:49:57+00:00</updated>
<entry>
<title>libfc: sanity check cpu number extracted from xid</title>
<updated>2016-07-14T01:49:57+00:00</updated>
<author>
<name>Chris Leech</name>
<email>cleech@redhat.com</email>
</author>
<published>2016-06-30T15:32:36+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=fa06883281afaa158b2b350f16c377c448df6b61'/>
<id>urn:sha1:fa06883281afaa158b2b350f16c377c448df6b61</id>
<content type='text'>
In the receive path libfc extracts a cpu number from the ox_id in the
fiber channel header and uses that to do a per_cpu_ptr conversion.  If,
for some reason, a frame is received with an invalid ox_id, per_cpu_ptr
will return an invalid pointer and the libfc receive path will panic the
system trying to use it.

I'm currently looking at such a case, and I don't yet know why a cpu
number &gt; nr_cpu_ids is appearing in an exchange id.  But adding a sanity
check in libfc prevents a system panic, and seems like good idea when
dealing with frames coming in from the network.

Signed-off-by: Chris Leech &lt;cleech@redhat.com&gt;
Acked-by: Johannes Thumshirn &lt;jth@kernel.org&gt;
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
</content>
</entry>
<entry>
<title>libfc: Fix fc_exch_recv_req() error path</title>
<updated>2015-08-12T18:23:30+00:00</updated>
<author>
<name>Bart Van Assche</name>
<email>bart.vanassche@sandisk.com</email>
</author>
<published>2015-06-05T21:20:46+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.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:22+00:00</updated>
<author>
<name>Bart Van Assche</name>
<email>bvanassche@acm.org</email>
</author>
<published>2013-08-17T20:34:43+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.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:53+00:00</updated>
<author>
<name>Bart Van Assche</name>
<email>bvanassche@acm.org</email>
</author>
<published>2013-08-14T15:38:24+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.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:43+00:00</updated>
<author>
<name>Bart Van Assche</name>
<email>bvanassche@acm.org</email>
</author>
<published>2013-08-14T15:37:52+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.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:38+00:00</updated>
<author>
<name>Bart Van Assche</name>
<email>bvanassche@acm.org</email>
</author>
<published>2013-08-14T15:37:08+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.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:25+00:00</updated>
<author>
<name>Bart Van Assche</name>
<email>bvanassche@acm.org</email>
</author>
<published>2013-08-14T15:35:29+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.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:15+00:00</updated>
<author>
<name>Bart Van Assche</name>
<email>bvanassche@acm.org</email>
</author>
<published>2013-08-17T20:20:07+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.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:09+00:00</updated>
<author>
<name>Bart Van Assche</name>
<email>bvanassche@acm.org</email>
</author>
<published>2013-08-14T15:33:35+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.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>
<entry>
<title>libfc: Debug code fixes</title>
<updated>2013-09-04T19:55:02+00:00</updated>
<author>
<name>Bart Van Assche</name>
<email>bvanassche@acm.org</email>
</author>
<published>2013-08-14T15:32:51+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=b20d9bfda77306c2f66a90eb94ef9db58fb1e682'/>
<id>urn:sha1:b20d9bfda77306c2f66a90eb94ef9db58fb1e682</id>
<content type='text'>
The second argument of fc_lport_error() may be a valid frame pointer.
Hence only print it as an error code if it really is an error code.

Debug statements must end in a newline. Add one where it is missing.

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>
