<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/scsi/qedf, branch linux-5.4.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.4.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.4.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2025-06-27T10:02:58Z</updated>
<entry>
<title>scsi: qedf: Use designated initializer for struct qed_fcoe_cb_ops</title>
<updated>2025-06-27T10:02:58Z</updated>
<author>
<name>Kees Cook</name>
</author>
<published>2025-05-02T22:41:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5d848699954b0fed2884f3f5aa97ee1cbfcf094c'/>
<id>urn:sha1:5d848699954b0fed2884f3f5aa97ee1cbfcf094c</id>
<content type='text'>
commit d8720235d5b5cad86c1f07f65117ef2a96f8bec7 upstream.

Recent fixes to the randstruct GCC plugin allowed it to notice
that this structure is entirely function pointers and is therefore
subject to randomization, but doing so requires that it always use
designated initializers. Explicitly specify the "common" member as being
initialized. Silences:

drivers/scsi/qedf/qedf_main.c:702:9: error: positional initialization of field in 'struct' declared with 'designated_init' attribute [-Werror=designated-init]
  702 |         {
      |         ^

Fixes: 035f7f87b729 ("randstruct: Enable Clang support")
Link: https://lore.kernel.org/r/20250502224156.work.617-kees@kernel.org
Signed-off-by: Kees Cook &lt;kees@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>scsi: qedf: Fix a possible memory leak in qedf_alloc_and_init_sb()</title>
<updated>2024-12-14T18:44:30Z</updated>
<author>
<name>Zhen Lei</name>
</author>
<published>2024-10-26T12:57:10Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=97384449ddfc07f12ca75f510eb070020d7abb34'/>
<id>urn:sha1:97384449ddfc07f12ca75f510eb070020d7abb34</id>
<content type='text'>
[ Upstream commit c62c30429db3eb4ced35c7fcf6f04a61ce3a01bb ]

Hook "qed_ops-&gt;common-&gt;sb_init = qed_sb_init" does not release the DMA
memory sb_virt when it fails. Add dma_free_coherent() to free it. This
is the same way as qedr_alloc_mem_sb() and qede_alloc_mem_sb().

Fixes: 61d8658b4a43 ("scsi: qedf: Add QLogic FastLinQ offload FCoE driver framework.")
Signed-off-by: Zhen Lei &lt;thunder.leizhen@huawei.com&gt;
Link: https://lore.kernel.org/r/20241026125711.484-2-thunder.leizhen@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: qedf: Set qed_slowpath_params to zero before use</title>
<updated>2024-07-27T08:38:28Z</updated>
<author>
<name>Saurav Kashyap</name>
</author>
<published>2024-05-15T09:11:01Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=49fba721aeaa970db257dc24558f8283775d3592'/>
<id>urn:sha1:49fba721aeaa970db257dc24558f8283775d3592</id>
<content type='text'>
[ Upstream commit 6c3bb589debd763dc4b94803ddf3c13b4fcca776 ]

Zero qed_slowpath_params before use.

Signed-off-by: Saurav Kashyap &lt;skashyap@marvell.com&gt;
Signed-off-by: Nilesh Javali &lt;njavali@marvell.com&gt;
Link: https://lore.kernel.org/r/20240515091101.18754-4-skashyap@marvell.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: qedf: Make qedf_execute_tmf() non-preemptible</title>
<updated>2024-07-18T09:40:47Z</updated>
<author>
<name>John Meneghini</name>
</author>
<published>2024-04-03T15:01:55Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4f314aadeed8cdf42c8cf30769425b5e44702748'/>
<id>urn:sha1:4f314aadeed8cdf42c8cf30769425b5e44702748</id>
<content type='text'>
[ Upstream commit 0d8b637c9c5eeaa1a4e3dfb336f3ff918eb64fec ]

Stop calling smp_processor_id() from preemptible code in
qedf_execute_tmf90.  This results in BUG_ON() when running an RT kernel.

[ 659.343280] BUG: using smp_processor_id() in preemptible [00000000] code: sg_reset/3646
[ 659.343282] caller is qedf_execute_tmf+0x8b/0x360 [qedf]

Tested-by: Guangwu Zhang &lt;guazhang@redhat.com&gt;
Cc: Saurav Kashyap &lt;skashyap@marvell.com&gt;
Cc: Nilesh Javali &lt;njavali@marvell.com&gt;
Signed-off-by: John Meneghini &lt;jmeneghi@redhat.com&gt;
Link: https://lore.kernel.org/r/20240403150155.412954-1-jmeneghi@redhat.com
Acked-by: Saurav Kashyap &lt;skashyap@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: qedf: Ensure the copied buf is NUL terminated</title>
<updated>2024-06-16T11:28:36Z</updated>
<author>
<name>Bui Quang Minh</name>
</author>
<published>2024-04-24T14:44:21Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a75001678e1d38aa607d5b898ec7ff8ed0700d59'/>
<id>urn:sha1:a75001678e1d38aa607d5b898ec7ff8ed0700d59</id>
<content type='text'>
[ Upstream commit d0184a375ee797eb657d74861ba0935b6e405c62 ]

Currently, we allocate a count-sized kernel buffer and copy count from
userspace to that buffer. Later, we use kstrtouint on this buffer but we
don't ensure that the string is terminated inside the buffer, this can
lead to OOB read when using kstrtouint. Fix this issue by using
memdup_user_nul instead of memdup_user.

Fixes: 61d8658b4a43 ("scsi: qedf: Add QLogic FastLinQ offload FCoE driver framework.")
Signed-off-by: Bui Quang Minh &lt;minhquangbui99@gmail.com&gt;
Link: https://lore.kernel.org/r/20240424-fix-oob-read-v2-4-f1f1b53a10f4@gmail.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: qedf: Do not touch __user pointer in qedf_dbg_fp_int_cmd_read() directly</title>
<updated>2023-09-23T08:59:50Z</updated>
<author>
<name>Oleksandr Natalenko</name>
</author>
<published>2023-07-31T08:40:34Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=463934ca5d9810028fa341fc36a53bd4cddad4e0'/>
<id>urn:sha1:463934ca5d9810028fa341fc36a53bd4cddad4e0</id>
<content type='text'>
[ Upstream commit 25dbc20deab5165f847b4eb42f376f725a986ee8 ]

The qedf_dbg_fp_int_cmd_read() function invokes sprintf() directly on a
__user pointer, which may crash the kernel.

Avoid doing that by vmalloc()'ating a buffer for scnprintf() and then
calling simple_read_from_buffer() which does a proper copy_to_user() call.

Fixes: 61d8658b4a43 ("scsi: qedf: Add QLogic FastLinQ offload FCoE driver framework.")
Link: https://lore.kernel.org/lkml/20230724120241.40495-1-oleksandr@redhat.com/
Link: https://lore.kernel.org/linux-scsi/20230726101236.11922-1-skashyap@marvell.com/
Cc: Saurav Kashyap &lt;skashyap@marvell.com&gt;
Cc: Rob Evers &lt;revers@redhat.com&gt;
Cc: Johannes Thumshirn &lt;Johannes.Thumshirn@wdc.com&gt;
Cc: David Laight &lt;David.Laight@ACULAB.COM&gt;
Cc: Jozef Bacik &lt;jobacik@redhat.com&gt;
Cc: Laurence Oberman &lt;loberman@redhat.com&gt;
Cc: "James E.J. Bottomley" &lt;jejb@linux.ibm.com&gt;
Cc: "Martin K. Petersen" &lt;martin.petersen@oracle.com&gt;
Cc: GR-QLogic-Storage-Upstream@marvell.com
Cc: linux-scsi@vger.kernel.org
Reviewed-by: Laurence Oberman &lt;loberman@redhat.com&gt;
Reviewed-by: Johannes Thumshirn &lt;johannes.thumshirn@wdc.com&gt;
Tested-by: Laurence Oberman &lt;loberman@redhat.com&gt;
Acked-by: Saurav Kashyap &lt;skashyap@marvell.com&gt;
Signed-off-by: Oleksandr Natalenko &lt;oleksandr@redhat.com&gt;
Link: https://lore.kernel.org/r/20230731084034.37021-4-oleksandr@redhat.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: qedf: Do not touch __user pointer in qedf_dbg_debug_cmd_read() directly</title>
<updated>2023-09-23T08:59:50Z</updated>
<author>
<name>Oleksandr Natalenko</name>
</author>
<published>2023-07-31T08:40:33Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=668ce8d508a32551e1e140c03ce5695065088008'/>
<id>urn:sha1:668ce8d508a32551e1e140c03ce5695065088008</id>
<content type='text'>
[ Upstream commit 31b5991a9a91ba97237ac9da509d78eec453ff72 ]

The qedf_dbg_debug_cmd_read() function invokes sprintf() directly on a
__user pointer, which may crash the kernel.

Avoid doing that by using a small on-stack buffer for scnprintf() and then
calling simple_read_from_buffer() which does a proper copy_to_user() call.

Fixes: 61d8658b4a43 ("scsi: qedf: Add QLogic FastLinQ offload FCoE driver framework.")
Link: https://lore.kernel.org/lkml/20230724120241.40495-1-oleksandr@redhat.com/
Link: https://lore.kernel.org/linux-scsi/20230726101236.11922-1-skashyap@marvell.com/
Cc: Saurav Kashyap &lt;skashyap@marvell.com&gt;
Cc: Rob Evers &lt;revers@redhat.com&gt;
Cc: Johannes Thumshirn &lt;Johannes.Thumshirn@wdc.com&gt;
Cc: David Laight &lt;David.Laight@ACULAB.COM&gt;
Cc: Jozef Bacik &lt;jobacik@redhat.com&gt;
Cc: Laurence Oberman &lt;loberman@redhat.com&gt;
Cc: "James E.J. Bottomley" &lt;jejb@linux.ibm.com&gt;
Cc: "Martin K. Petersen" &lt;martin.petersen@oracle.com&gt;
Cc: GR-QLogic-Storage-Upstream@marvell.com
Cc: linux-scsi@vger.kernel.org
Reviewed-by: Laurence Oberman &lt;loberman@redhat.com&gt;
Reviewed-by: Johannes Thumshirn &lt;johannes.thumshirn@wdc.com&gt;
Tested-by: Laurence Oberman &lt;loberman@redhat.com&gt;
Acked-by: Saurav Kashyap &lt;skashyap@marvell.com&gt;
Signed-off-by: Oleksandr Natalenko &lt;oleksandr@redhat.com&gt;
Link: https://lore.kernel.org/r/20230731084034.37021-3-oleksandr@redhat.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: qedf: Do not touch __user pointer in qedf_dbg_stop_io_on_error_cmd_read() directly</title>
<updated>2023-09-23T08:59:50Z</updated>
<author>
<name>Oleksandr Natalenko</name>
</author>
<published>2023-07-31T08:40:32Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=06a2dde58f405da7ca7a55504094c1254f89bc7e'/>
<id>urn:sha1:06a2dde58f405da7ca7a55504094c1254f89bc7e</id>
<content type='text'>
[ Upstream commit 7d3d20dee4f648ec44e9717d5f647d594d184433 ]

The qedf_dbg_stop_io_on_error_cmd_read() function invokes sprintf()
directly on a __user pointer, which may crash the kernel.

Avoid doing that by using a small on-stack buffer for scnprintf() and then
calling simple_read_from_buffer() which does a proper copy_to_user() call.

Fixes: 61d8658b4a43 ("scsi: qedf: Add QLogic FastLinQ offload FCoE driver framework.")
Link: https://lore.kernel.org/lkml/20230724120241.40495-1-oleksandr@redhat.com/
Link: https://lore.kernel.org/linux-scsi/20230726101236.11922-1-skashyap@marvell.com/
Cc: Saurav Kashyap &lt;skashyap@marvell.com&gt;
Cc: Rob Evers &lt;revers@redhat.com&gt;
Cc: Johannes Thumshirn &lt;Johannes.Thumshirn@wdc.com&gt;
Cc: David Laight &lt;David.Laight@ACULAB.COM&gt;
Cc: Jozef Bacik &lt;jobacik@redhat.com&gt;
Cc: Laurence Oberman &lt;loberman@redhat.com&gt;
Cc: "James E.J. Bottomley" &lt;jejb@linux.ibm.com&gt;
Cc: "Martin K. Petersen" &lt;martin.petersen@oracle.com&gt;
Cc: GR-QLogic-Storage-Upstream@marvell.com
Cc: linux-scsi@vger.kernel.org
Reviewed-by: Laurence Oberman &lt;loberman@redhat.com&gt;
Reviewed-by: Johannes Thumshirn &lt;johannes.thumshirn@wdc.com&gt;
Tested-by: Laurence Oberman &lt;loberman@redhat.com&gt;
Acked-by: Saurav Kashyap &lt;skashyap@marvell.com&gt;
Signed-off-by: Oleksandr Natalenko &lt;oleksandr@redhat.com&gt;
Link: https://lore.kernel.org/r/20230731084034.37021-2-oleksandr@redhat.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: qedf: Fix NULL dereference in error handling</title>
<updated>2023-07-27T06:37:16Z</updated>
<author>
<name>Jinhong Zhu</name>
</author>
<published>2023-05-02T14:00:21Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=961c8370c5f7e80a267680476e1bcff34bffe71a'/>
<id>urn:sha1:961c8370c5f7e80a267680476e1bcff34bffe71a</id>
<content type='text'>
[ Upstream commit f025312b089474a54e4859f3453771314d9e3d4f ]

Smatch reported:

drivers/scsi/qedf/qedf_main.c:3056 qedf_alloc_global_queues()
warn: missing unwind goto?

At this point in the function, nothing has been allocated so we can return
directly. In particular the "qedf-&gt;global_queues" have not been allocated
so calling qedf_free_global_queues() will lead to a NULL dereference when
we check if (!gl[i]) and "gl" is NULL.

Fixes: 61d8658b4a43 ("scsi: qedf: Add QLogic FastLinQ offload FCoE driver framework.")
Signed-off-by: Jinhong Zhu &lt;jinhongzhu@hust.edu.cn&gt;
Link: https://lore.kernel.org/r/20230502140022.2852-1-jinhongzhu@hust.edu.cn
Reviewed-by: Dan Carpenter &lt;error27@gmail.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: qedf: Fix a UAF bug in __qedf_probe()</title>
<updated>2022-10-15T05:54:37Z</updated>
<author>
<name>Letu Ren</name>
</author>
<published>2021-11-12T12:06:41Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=61be8898d70463d24eac08d5a8cbf694b191be4d'/>
<id>urn:sha1:61be8898d70463d24eac08d5a8cbf694b191be4d</id>
<content type='text'>
[ Upstream commit fbfe96869b782364caebae0445763969ddb6ea67 ]

In __qedf_probe(), if qedf-&gt;cdev is NULL which means
qed_ops-&gt;common-&gt;probe() failed, then the program will goto label err1, and
scsi_host_put() will free lport-&gt;host pointer. Because the memory qedf
points to is allocated by libfc_host_alloc(), it will be freed by
scsi_host_put(). However, the if statement below label err0 only checks
whether qedf is NULL but doesn't check whether the memory has been freed.
So a UAF bug can occur.

There are two ways to reach the statements below err0. The first one is
described as before, "qedf" should be set to NULL. The second one is goto
"err0" directly. In the latter scenario qedf hasn't been changed and it has
the initial value NULL. As a result the if statement is not reachable in
any situation.

The KASAN logs are as follows:

[    2.312969] BUG: KASAN: use-after-free in __qedf_probe+0x5dcf/0x6bc0
[    2.312969]
[    2.312969] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.12.0-59-gc9ba5276e321-prebuilt.qemu.org 04/01/2014
[    2.312969] Call Trace:
[    2.312969]  dump_stack_lvl+0x59/0x7b
[    2.312969]  print_address_description+0x7c/0x3b0
[    2.312969]  ? __qedf_probe+0x5dcf/0x6bc0
[    2.312969]  __kasan_report+0x160/0x1c0
[    2.312969]  ? __qedf_probe+0x5dcf/0x6bc0
[    2.312969]  kasan_report+0x4b/0x70
[    2.312969]  ? kobject_put+0x25d/0x290
[    2.312969]  kasan_check_range+0x2ca/0x310
[    2.312969]  __qedf_probe+0x5dcf/0x6bc0
[    2.312969]  ? selinux_kernfs_init_security+0xdc/0x5f0
[    2.312969]  ? trace_rpm_return_int_rcuidle+0x18/0x120
[    2.312969]  ? rpm_resume+0xa5c/0x16e0
[    2.312969]  ? qedf_get_generic_tlv_data+0x160/0x160
[    2.312969]  local_pci_probe+0x13c/0x1f0
[    2.312969]  pci_device_probe+0x37e/0x6c0

Link: https://lore.kernel.org/r/20211112120641.16073-1-fantasquex@gmail.com
Reported-by: Zheyu Ma &lt;zheyuma97@gmail.com&gt;
Acked-by: Saurav Kashyap &lt;skashyap@marvell.com&gt;
Co-developed-by: Wende Tan &lt;twd2.me@gmail.com&gt;
Signed-off-by: Wende Tan &lt;twd2.me@gmail.com&gt;
Signed-off-by: Letu Ren &lt;fantasquex@gmail.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>
</feed>
