<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/scsi/libfc, branch v4.14.263</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v4.14.263</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v4.14.263'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2021-07-28T09:12:15+00:00</updated>
<entry>
<title>scsi: libfc: Fix array index out of bound exception</title>
<updated>2021-07-28T09:12:15+00:00</updated>
<author>
<name>Javed Hasan</name>
<email>jhasan@marvell.com</email>
</author>
<published>2021-06-15T16:59:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=44651522941c623e20882b3b443f23f77de1ea8b'/>
<id>urn:sha1:44651522941c623e20882b3b443f23f77de1ea8b</id>
<content type='text'>
[ Upstream commit b27c4577557045f1ab3cdfeabfc7f3cd24aca1fe ]

Fix array index out of bound exception in fc_rport_prli_resp().

Link: https://lore.kernel.org/r/20210615165939.24327-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 a format specifier</title>
<updated>2021-05-22T08:57:20+00:00</updated>
<author>
<name>Bart Van Assche</name>
<email>bvanassche@acm.org</email>
</author>
<published>2021-04-15T22:08:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=464f18b007dd081215d5b449dfc5dc52fed85ed7'/>
<id>urn:sha1:464f18b007dd081215d5b449dfc5dc52fed85ed7</id>
<content type='text'>
[ Upstream commit 90d6697810f06aceea9de71ad836a8c7669789cd ]

Since the 'mfs' member has been declared as 'u32' in include/scsi/libfc.h,
use the %u format specifier instead of %hu. This patch fixes the following
clang compiler warning:

warning: format specifies type
      'unsigned short' but the argument has type 'u32' (aka 'unsigned int')
      [-Wformat]
                             "lport-&gt;mfs:%hu\n", mfs, lport-&gt;mfs);
                                         ~~~          ^~~~~~~~~~
                                         %u

Link: https://lore.kernel.org/r/20210415220826.29438-8-bvanassche@acm.org
Cc: Hannes Reinecke &lt;hare@suse.de&gt;
Signed-off-by: Bart Van Assche &lt;bvanassche@acm.org&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: Avoid invoking response handler twice if ep is already completed</title>
<updated>2021-02-07T13:47:40+00:00</updated>
<author>
<name>Javed Hasan</name>
<email>jhasan@marvell.com</email>
</author>
<published>2020-12-15T19:47:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d2ab7ca11035a7024398e7d4439691fb9a58a11c'/>
<id>urn:sha1:d2ab7ca11035a7024398e7d4439691fb9a58a11c</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: Skip additional kref updating work event</title>
<updated>2020-10-01T11:12:48+00:00</updated>
<author>
<name>Javed Hasan</name>
<email>jhasan@marvell.com</email>
</author>
<published>2020-06-26T09:49:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=117413cd30aa64fca2b14261f9eaff4573204933'/>
<id>urn:sha1:117413cd30aa64fca2b14261f9eaff4573204933</id>
<content type='text'>
[ Upstream commit 823a65409c8990f64c5693af98ce0e7819975cba ]

When an rport event (RPORT_EV_READY) is updated without work being queued,
avoid taking an additional reference.

This issue was leading to memory leak. Trace from KMEMLEAK tool:

  unreferenced object 0xffff8888259e8780 (size 512):
  comm "kworker/2:1", jiffies 4433237386 (age 113021.971s)
    hex dump (first 32 bytes):
	58 0a ec cf 83 88 ff ff 00 00 00 00 00 00 00 00
	01 00 00 00 08 00 00 00 13 7d f0 1e 0e 00 00 10
  backtrace:
  [&lt;000000006b25760f&gt;] fc_rport_recv_req+0x3c6/0x18f0 [libfc]
  [&lt;00000000f208d994&gt;] fc_lport_recv_els_req+0x120/0x8a0 [libfc]
  [&lt;00000000a9c437b8&gt;] fc_lport_recv+0xb9/0x130 [libfc]
  [&lt;00000000a9c437b8&gt;] fc_lport_recv+0xb9/0x130 [libfc]
  [&lt;00000000ad5be37b&gt;] qedf_ll2_process_skb+0x73d/0xad0 [qedf]
  [&lt;00000000e0eb6893&gt;] process_one_work+0x382/0x6c0
  [&lt;000000002dfd9e21&gt;] worker_thread+0x57/0x5c0
  [&lt;00000000b648204f&gt;] kthread+0x1a0/0x1c0
  [&lt;0000000072f5ab20&gt;] ret_from_fork+0x35/0x40
  [&lt;000000001d5c05d8&gt;] 0xffffffffffffffff

Below is the log sequence which leads to memory leak.  Here we get the
RPORT_EV_READY and RPORT_EV_STOP back to back, which lead to overwrite the
event RPORT_EV_READY by event RPORT_EV_STOP.  Because of this, kref_count
gets incremented by 1.

  kernel: host0: rport fffce5: Received PLOGI request
  kernel: host0: rport fffce5: Received PLOGI in INIT state
  kernel: host0: rport fffce5: Port is Ready
  kernel: host0: rport fffce5: Received PRLI request while in state Ready
  kernel: host0: rport fffce5: PRLI rspp type 8 active 1 passive 0
  kernel: host0: rport fffce5: Received LOGO request while in state Ready
  kernel: host0: rport fffce5: Delete port
  kernel: host0: rport fffce5: Received PLOGI request
  kernel: host0: rport fffce5: Received PLOGI in state Delete - send busy
  kernel: host0: rport fffce5: work event 3
  kernel: host0: rport fffce5: lld callback ev 3
  kernel: host0: rport fffce5: work delete

Link: https://lore.kernel.org/r/20200626094959.32151-1-jhasan@marvell.com
Reviewed-by: Girish Basrur &lt;gbasrur@marvell.com&gt;
Reviewed-by: Saurav Kashyap &lt;skashyap@marvell.com&gt;
Reviewed-by: Shyam Sundar &lt;ssundar@marvell.com&gt;
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: Handling of extra kref</title>
<updated>2020-10-01T11:12:47+00:00</updated>
<author>
<name>Javed Hasan</name>
<email>jhasan@marvell.com</email>
</author>
<published>2020-06-22T10:12:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=cd6084652261ccd56a0a53d1c230daae4fa021d9'/>
<id>urn:sha1:cd6084652261ccd56a0a53d1c230daae4fa021d9</id>
<content type='text'>
[ Upstream commit 71f2bf85e90d938d4a9ef9dd9bfa8d9b0b6a03f7 ]

Handling of extra kref which is done by lookup table in case rdata is
already present in list.

This issue was leading to memory leak. Trace from KMEMLEAK tool:

  unreferenced object 0xffff8888259e8780 (size 512):
    comm "kworker/2:1", pid 182614, jiffies 4433237386 (age 113021.971s)
    hex dump (first 32 bytes):
    58 0a ec cf 83 88 ff ff 00 00 00 00 00 00 00 00
    01 00 00 00 08 00 00 00 13 7d f0 1e 0e 00 00 10
  backtrace:
	[&lt;000000006b25760f&gt;] fc_rport_recv_req+0x3c6/0x18f0 [libfc]
	[&lt;00000000f208d994&gt;] fc_lport_recv_els_req+0x120/0x8a0 [libfc]
	[&lt;00000000a9c437b8&gt;] fc_lport_recv+0xb9/0x130 [libfc]
	[&lt;00000000ad5be37b&gt;] qedf_ll2_process_skb+0x73d/0xad0 [qedf]
	[&lt;00000000e0eb6893&gt;] process_one_work+0x382/0x6c0
	[&lt;000000002dfd9e21&gt;] worker_thread+0x57/0x5c0
	[&lt;00000000b648204f&gt;] kthread+0x1a0/0x1c0
	[&lt;0000000072f5ab20&gt;] ret_from_fork+0x35/0x40
	[&lt;000000001d5c05d8&gt;] 0xffffffffffffffff

Below is the log sequence which leads to memory leak. Here we get the
nested "Received PLOGI request" for same port and this request leads to
call the fc_rport_create() twice for the same rport.

	kernel: host1: rport fffce5: Received PLOGI request
	kernel: host1: rport fffce5: Received PLOGI in INIT state
	kernel: host1: rport fffce5: Port is Ready
	kernel: host1: rport fffce5: Received PRLI request while in state Ready
	kernel: host1: rport fffce5: PRLI rspp type 8 active 1 passive 0
	kernel: host1: rport fffce5: Received LOGO request while in state Ready
	kernel: host1: rport fffce5: Delete port
	kernel: host1: rport fffce5: Received PLOGI request
	kernel: host1: rport fffce5: Received PLOGI in state Delete - send busy

Link: https://lore.kernel.org/r/20200622101212.3922-2-jhasan@marvell.com
Reviewed-by: Girish Basrur &lt;gbasrur@marvell.com&gt;
Reviewed-by: Saurav Kashyap &lt;skashyap@marvell.com&gt;
Reviewed-by: Shyam Sundar &lt;ssundar@marvell.com&gt;
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 for double free()</title>
<updated>2020-09-23T08:46:33+00:00</updated>
<author>
<name>Javed Hasan</name>
<email>jhasan@marvell.com</email>
</author>
<published>2020-08-25T09:39:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d0d5cc0f110032ff2e7169e63b2be431834f7db3'/>
<id>urn:sha1:d0d5cc0f110032ff2e7169e63b2be431834f7db3</id>
<content type='text'>
[ Upstream commit 5a5b80f98534416b3b253859897e2ba1dc241e70 ]

Fix for '&amp;fp-&gt;skb' double free.

Link:
https://lore.kernel.org/r/20200825093940.19612-1-jhasan@marvell.com
Reported-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
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: Free skb in fc_disc_gpn_id_resp() for valid cases</title>
<updated>2020-08-26T08:29:56+00:00</updated>
<author>
<name>Javed Hasan</name>
<email>jhasan@marvell.com</email>
</author>
<published>2020-07-29T08:18:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=9b5681afc9e69f7cacd769c7274f1d2a102257f7'/>
<id>urn:sha1:9b5681afc9e69f7cacd769c7274f1d2a102257f7</id>
<content type='text'>
[ Upstream commit ec007ef40abb6a164d148b0dc19789a7a2de2cc8 ]

In fc_disc_gpn_id_resp(), skb is supposed to get freed in all cases except
for PTR_ERR. However, in some cases it didn't.

This fix is to call fc_frame_free(fp) before function returns.

Link: https://lore.kernel.org/r/20200729081824.30996-2-jhasan@marvell.com
Reviewed-by: Girish Basrur &lt;gbasrur@marvell.com&gt;
Reviewed-by: Santosh Vernekar &lt;svernekar@marvell.com&gt;
Reviewed-by: Saurav Kashyap &lt;skashyap@marvell.com&gt;
Reviewed-by: Shyam Sundar &lt;ssundar@marvell.com&gt;
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: free response frame from GPN_ID</title>
<updated>2020-03-20T09:54:24+00:00</updated>
<author>
<name>Igor Druzhinin</name>
<email>igor.druzhinin@citrix.com</email>
</author>
<published>2020-01-14T14:43:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=358e3a57a2558069863404249d8af3bdca7e1563'/>
<id>urn:sha1:358e3a57a2558069863404249d8af3bdca7e1563</id>
<content type='text'>
[ Upstream commit ff6993bb79b9f99bdac0b5378169052931b65432 ]

fc_disc_gpn_id_resp() should be the last function using it so free it here
to avoid memory leak.

Link: https://lore.kernel.org/r/1579013000-14570-2-git-send-email-igor.druzhinin@citrix.com
Reviewed-by: Hannes Reinecke &lt;hare@suse.de&gt;
Signed-off-by: Igor Druzhinin &lt;igor.druzhinin@citrix.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-27T13:46:40+00:00</updated>
<author>
<name>Colin Ian King</name>
<email>colin.king@canonical.com</email>
</author>
<published>2019-07-02T09:18:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=4077713e39ed3b1672fa833375453800c431b6c2'/>
<id>urn:sha1:4077713e39ed3b1672fa833375453800c431b6c2</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>scsi: fcoe: Embed fc_rport_priv in fcoe_rport structure</title>
<updated>2019-08-09T15:53:31+00:00</updated>
<author>
<name>Hannes Reinecke</name>
<email>hare@suse.de</email>
</author>
<published>2019-07-24T09:00:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=157a1f2fc415734a693792403cba0dce23d044c1'/>
<id>urn:sha1:157a1f2fc415734a693792403cba0dce23d044c1</id>
<content type='text'>
commit 023358b136d490ca91735ac6490db3741af5a8bd upstream.

Gcc-9 complains for a memset across pointer boundaries, which happens as
the code tries to allocate a flexible array on the stack.  Turns out we
cannot do this without relying on gcc-isms, so with this patch we'll embed
the fc_rport_priv structure into fcoe_rport, can use the normal
'container_of' outcast, and will only have to do a memset over one
structure.

Signed-off-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>
</feed>
