Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "TAKANO Mitsuhiro" <takano32@gmail.com>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH] scsi: be2iscsi: fix NULL pointer dereference in beiscsi_alloc_mem() error path
Date: Sat, 28 Nov 2026 23:11:32 +0000	[thread overview]
Message-ID: <sashiko-outbox-239139@kernel.org> (raw)
In-Reply-To: <20261128-b4-scsi-be2iscsi-null-mem-array-v1-1-82c66b29ab81@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] scsi: be2iscsi: missing Fixes trailer for beiscsi_alloc_mem()
  error path fix
--

commit f497efcc4ca2b2970e263b27d42a6e4480250ecf
Author: TAKANO Mitsuhiro <takano32@gmail.com>

> scsi: be2iscsi: fix NULL pointer dereference in beiscsi_alloc_mem() error path
>
> In beiscsi_alloc_mem(), both jumps to free_mem occur while the current
> mem_descr->mem_array is still NULL and the j DMA fragments allocated for
> the current descriptor are stored in mem_arr_orig[0..j-1]. The error path
> dereferences mem_descr->mem_array[j - 1] directly, causing a NULL pointer
> dereference whenever j > 0, and also skips freeing init_mem[0].mem_array
> when unwinding earlier descriptors.
>
> Free the j fragments from mem_arr_orig first, then unwind and free all
> previously completed descriptors from i - 1 down to 0.
>
> Signed-off-by: TAKANO Mitsuhiro <takano32@gmail.com>

[Severity: Low]
This fixes a NULL pointer dereference and memory leak in
beiscsi_alloc_mem() that have been present since the driver was added.
Should this include:

  Fixes: 6733b39a1301 ("[SCSI] be2iscsi: add 10Gbps iSCSI - BladeEngine 2 driver")

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261128-b4-scsi-be2iscsi-null-mem-array-v1-1-82c66b29ab81@gmail.com?part=1

      reply	other threads:[~2026-11-28 23:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-28 23:05 [PATCH] scsi: be2iscsi: fix NULL pointer dereference in beiscsi_alloc_mem() error path TAKANO Mitsuhiro via B4 Relay
2026-11-28 23:11 ` sashiko-bot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-239139@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=takano32@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox