<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/drivers/scsi/aacraid/aachba.c, branch linux-6.9.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.</subtitle>
<id>https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-6.9.y</id>
<link rel='self' href='https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-6.9.y'/>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/'/>
<updated>2024-01-30T01:34:52Z</updated>
<entry>
<title>scsi: aacraid: aachba: Replace snprintf() with the safer scnprintf() variant</title>
<updated>2024-01-30T01:34:52Z</updated>
<author>
<name>Lee Jones</name>
<email>lee@kernel.org</email>
</author>
<published>2024-01-11T13:17:26Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=bc978cc18d46dd54160f6c29aaf9475772686dfc'/>
<id>urn:sha1:bc978cc18d46dd54160f6c29aaf9475772686dfc</id>
<content type='text'>
There is a general misunderstanding amongst engineers that {v}snprintf()
returns the length of the data *actually* encoded into the destination
array.  However, as per the C99 standard {v}snprintf() really returns
the length of the data that *would have been* written if there were
enough space for it.  This misunderstanding has led to buffer-overruns
in the past.  It's generally considered safer to use the {v}scnprintf()
variants in their place (or even sprintf() in simple cases).  So let's
do that.

Link: https://lwn.net/Articles/69419/
Link: https://github.com/KSPP/linux/issues/105
Cc: Adaptec OEM Raid Solutions &lt;aacraid@microsemi.com&gt;
Cc: PMC-Sierra, Inc &lt;aacraid@pmc-sierra.com&gt;
Signed-off-by: Lee Jones &lt;lee@kernel.org&gt;
Link: https://lore.kernel.org/r/20240111131732.1815560-6-lee@kernel.org
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
</content>
</entry>
<entry>
<title>scsi: aacraid: Replace all non-returning strlcpy with strscpy</title>
<updated>2023-05-26T20:52:19Z</updated>
<author>
<name>Azeem Shaikh</name>
<email>azeemshaikh38@gmail.com</email>
</author>
<published>2023-05-17T14:30:49Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=038d40edc4c1038ce88c95a2d4f7cb46b9533bdd'/>
<id>urn:sha1:038d40edc4c1038ce88c95a2d4f7cb46b9533bdd</id>
<content type='text'>
strlcpy() reads the entire source buffer first.
This read may exceed the destination size limit.
This is both inefficient and can lead to linear read
overflows if a source string is not NUL-terminated [1].
In an effort to remove strlcpy() completely [2], replace
strlcpy() here with strscpy().
No return values were used, so direct replacement is safe.

[1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strlcpy
[2] https://github.com/KSPP/linux/issues/89

Signed-off-by: Azeem Shaikh &lt;azeemshaikh38@gmail.com&gt;
Reviewed-by: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Link: https://lore.kernel.org/r/20230517143049.1519806-1-azeemshaikh38@gmail.com
</content>
</entry>
<entry>
<title>scsi: aacraid: Allocate cmd_priv with scsicmd</title>
<updated>2023-02-08T23:49:48Z</updated>
<author>
<name>Kees Cook</name>
<email>keescook@chromium.org</email>
</author>
<published>2023-01-28T00:04:13Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=7ab734fc759828707dae22fe48b1eb4dcf70beea'/>
<id>urn:sha1:7ab734fc759828707dae22fe48b1eb4dcf70beea</id>
<content type='text'>
The aac_priv() helper assumes that the private cmd area immediately follows
struct scsi_cmnd. Allocate this space as part of scsicmd, else there is a
risk of heap overflow. Seen with GCC 13:

../drivers/scsi/aacraid/aachba.c: In function 'aac_probe_container':
../drivers/scsi/aacraid/aachba.c:841:26: warning: array subscript 16 is outside array bounds of 'void[392]' [-Warray-bounds=]
  841 |         status = cmd_priv-&gt;status;
      |                          ^~
In file included from ../include/linux/resource_ext.h:11,
                 from ../include/linux/pci.h:40,
                 from ../drivers/scsi/aacraid/aachba.c:22:
In function 'kmalloc',
    inlined from 'kzalloc' at ../include/linux/slab.h:720:9,
    inlined from 'aac_probe_container' at ../drivers/scsi/aacraid/aachba.c:821:30:
../include/linux/slab.h:580:24: note: at offset 392 into object of size 392 allocated by 'kmalloc_trace'
  580 |                 return kmalloc_trace(
      |                        ^~~~~~~~~~~~~~
  581 |                                 kmalloc_caches[kmalloc_type(flags)][index],
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  582 |                                 flags, size);
      |                                 ~~~~~~~~~~~~

Fixes: 76a3451b64c6 ("scsi: aacraid: Move the SCSI pointer to private command data")
Link: https://lore.kernel.org/r/20230128000409.never.976-kees@kernel.org
Cc: Bart Van Assche &lt;bvanassche@acm.org&gt;
Cc: Hannes Reinecke &lt;hare@suse.de&gt;
Cc: Himanshu Madhani &lt;himanshu.madhani@oracle.com&gt;
Cc: Adaptec OEM Raid Solutions &lt;aacraid@microsemi.com&gt;
Cc: "James E.J. Bottomley" &lt;jejb@linux.ibm.com&gt;
Cc: "Martin K. Petersen" &lt;martin.petersen@oracle.com&gt;
Cc: linux-scsi@vger.kernel.org
Cc: stable@vger.kernel.org
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Reviewed-by: Vegard Nossum &lt;vegard.nossum@oracle.com&gt;
Reviewed-by: Hannes Reinecke &lt;hare@suse.de&gt;
Reviewed-by: Bart Van Assche &lt;bvanassche@acm.org&gt;
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
</content>
</entry>
<entry>
<title>scsi: aacraid: Remove redundant "the"</title>
<updated>2022-06-22T01:39:55Z</updated>
<author>
<name>Jiang Jian</name>
<email>jiangjian@cdjrlc.com</email>
</author>
<published>2022-06-21T14:23:46Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=ebd676ff3b3f9a2db8d23a91eb3216fef8ce4568'/>
<id>urn:sha1:ebd676ff3b3f9a2db8d23a91eb3216fef8ce4568</id>
<content type='text'>
Remove redundant "the" in comment.

Link: https://lore.kernel.org/r/20220621142346.6429-1-jiangjian@cdjrlc.com
Signed-off-by: Jiang Jian &lt;jiangjian@cdjrlc.com&gt;
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
</content>
</entry>
<entry>
<title>scsi: aacraid: Move the SCSI pointer to private command data</title>
<updated>2022-02-23T02:11:03Z</updated>
<author>
<name>Bart Van Assche</name>
<email>bvanassche@acm.org</email>
</author>
<published>2022-02-18T19:50:40Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=76a3451b64c6d1718a651697670bd5dc557ed148'/>
<id>urn:sha1:76a3451b64c6d1718a651697670bd5dc557ed148</id>
<content type='text'>
Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-13-bvanassche@acm.org
Reviewed-by: Hannes Reinecke &lt;hare@suse.de&gt;
Reviewed-by: Himanshu Madhani &lt;himanshu.madhani@oracle.com&gt;
Signed-off-by: Bart Van Assche &lt;bvanassche@acm.org&gt;
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
</content>
</entry>
<entry>
<title>scsi: aacraid: Fix spelling of "its"</title>
<updated>2022-01-05T05:23:47Z</updated>
<author>
<name>Randy Dunlap</name>
<email>rdunlap@infradead.org</email>
</author>
<published>2021-12-23T06:11:19Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=4d516e495235a8e95b482a1e9441c4043c7a8235'/>
<id>urn:sha1:4d516e495235a8e95b482a1e9441c4043c7a8235</id>
<content type='text'>
Use the possessive "its" instead of the contraction "it's" in user
messages.

Link: https://lore.kernel.org/r/20211223061119.18304-1-rdunlap@infradead.org
Cc: Adaptec OEM Raid Solutions &lt;aacraid@microsemi.com&gt;
Cc: "James E.J. Bottomley" &lt;jejb@linux.ibm.com&gt;
Cc: "Martin K. Petersen" &lt;martin.petersen@oracle.com&gt;
Signed-off-by: Randy Dunlap &lt;rdunlap@infradead.org&gt;
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
</content>
</entry>
<entry>
<title>scsi: aacraid: Call scsi_done() directly</title>
<updated>2021-10-17T01:28:45Z</updated>
<author>
<name>Bart Van Assche</name>
<email>bvanassche@acm.org</email>
</author>
<published>2021-10-07T20:28:11Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=7afdb8637997497c8cfd0369f2b7bece477f47c0'/>
<id>urn:sha1:7afdb8637997497c8cfd0369f2b7bece477f47c0</id>
<content type='text'>
The aacraid driver invokes scmd-&gt;scsi_done(scmd) for two types of SCSI
commands:

 - SCSI commands initialized by the SCSI mid-layer.

 - SCSI commands initialized by aac_probe_container().

The processing sequence for SCSI commands allocated by
aac_probe_container() is as follows:

aac_probe_container()
-&gt; _aac_probe_container(scmd, aac_probe_container_callback1)
  -&gt; scmd-&gt;SCp.ptr = aac_probe_container_callback1
  -&gt; aac_fib_send(..., _aac_probe_container1, scmd)
    -&gt; fibptr-&gt;callback = _aac_probe_container1
    -&gt; fibptr-&gt;callback_data = scmd

fibptr-&gt;callback(scmd)
-&gt; _aac_probe_container1(scmd, fibptr)
   [ ... ]
   -&gt; _aac_probe_container2(scmd, fibptr)
     -&gt; Call scmd-&gt;SCp.ptr == aac_probe_container_callback1
       -&gt; scmd-&gt;device = NULL;

The processing sequence for SCSI commands allocated by the SCSI mid-layer
if _aac_probe_container() is called is as follows:

aac_queuecommand()
-&gt; aac_scsi_cmd()
  -&gt; _aac_probe_container(scmd, aac_probe_container_callback2)
    -&gt; scmd-&gt;SCp.ptr = aac_probe_container_callback2
    -&gt; aac_fib_send(..., _aac_probe_container1, scmd)

fibptr-&gt;callback(scmd)
-&gt; _aac_probe_container1(scmd, fibptr)
   [ ... ]
   -&gt; _aac_probe_container2(scmd, fibptr)
     -&gt; Call scmd-&gt;SCp.ptr == aac_probe_container_callback2

Preserve the existing call sequences by calling scsi_done() for commands
submitted by the mid-layer or aac_probe_container_scsi_done() for commands
submitted by aac_probe_container().

Link: https://lore.kernel.org/r/20211007202923.2174984-17-bvanassche@acm.org
Signed-off-by: Bart Van Assche &lt;bvanassche@acm.org&gt;
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
</content>
</entry>
<entry>
<title>scsi: aacraid: Introduce aac_scsi_done()</title>
<updated>2021-10-17T01:28:44Z</updated>
<author>
<name>Bart Van Assche</name>
<email>bvanassche@acm.org</email>
</author>
<published>2021-10-07T20:28:10Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=1dec65e32fb512dde098c1aa06ed35f0eed5d90f'/>
<id>urn:sha1:1dec65e32fb512dde098c1aa06ed35f0eed5d90f</id>
<content type='text'>
This patch does not change any functionality but makes the next patch in
this series easier to read.

Link: https://lore.kernel.org/r/20211007202923.2174984-16-bvanassche@acm.org
Signed-off-by: Bart Van Assche &lt;bvanassche@acm.org&gt;
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
</content>
</entry>
<entry>
<title>scsi: aacraid: Use scsi_cmd_to_rq() instead of scsi_cmnd.request</title>
<updated>2021-08-12T02:25:38Z</updated>
<author>
<name>Bart Van Assche</name>
<email>bvanassche@acm.org</email>
</author>
<published>2021-08-09T23:03:16Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=8779b4bdbc12c3fd3a6567a8ec2a8d375b874ad2'/>
<id>urn:sha1:8779b4bdbc12c3fd3a6567a8ec2a8d375b874ad2</id>
<content type='text'>
Prepare for removal of the request pointer by using scsi_cmd_to_rq()
instead. This patch does not change any functionality.

Link: https://lore.kernel.org/r/20210809230355.8186-14-bvanassche@acm.org
Reviewed-by: 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;
</content>
</entry>
<entry>
<title>scsi: aacraid: Remove an unused include</title>
<updated>2021-07-19T01:46:53Z</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2021-07-12T06:09:27Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=904b5bfaa8fe2be032ea81ee95fa28efe21fbef0'/>
<id>urn:sha1:904b5bfaa8fe2be032ea81ee95fa28efe21fbef0</id>
<content type='text'>
flush_kernel_dcache_page() is not used by aacraid, and this header already
comes in through the scatterlist/block headers anyway.

Link: https://lore.kernel.org/r/20210712060928.4161649-6-hch@lst.de
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
</content>
</entry>
</feed>
