All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: kensanya@163.com
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH] scsi: target: iblock: Fix wrong PR ops NULL check for PREEMPT/RELEASE
Date: Fri, 24 Jul 2026 08:12:34 +0000	[thread overview]
Message-ID: <20260724081235.26D3D1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260724075850.280699-1-kensanya@163.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Un-ratelimited error logging can be abused by an initiator to flood the kernel log.
--

--- Patch [1]: [PATCH] scsi: target: iblock: Fix wrong PR ops NULL check for PREEMPT/RELEASE ---
commit 562d965ef4dd6b2eb1b1b38dac4b060b92e2df13
Author: TanZheng <tanzheng@kylinos.cn>

scsi: target: iblock: Fix wrong PR ops NULL check for PREEMPT/RELEASE
    
This commit corrects a bug in the iblock_execute_pr_out function where the
pr_clear callback was being checked instead of the corresponding pr_preempt
and pr_release callbacks. This fixes a potential NULL pointer dereference
if those specific PR ops are unimplemented.

> --- a/drivers/target/target_core_iblock.c
> +++ b/drivers/target/target_core_iblock.c
> @@ -906,7 +906,7 @@ static sense_reason_t iblock_execute_pr_out(struct se_cmd *cmd, u8 sa, u64 key,
>  		break;
>  	case PRO_PREEMPT:
>  	case PRO_PREEMPT_AND_ABORT:
> -		if (!ops->pr_clear) {
> +		if (!ops->pr_preempt) {
>  			pr_err("block_device does not support pr_preempt.\n");

[Severity: High]
This is a pre-existing issue, but could this un-ratelimited error logging be
abused by a remote initiator to flood the kernel log?

If a malicious or misbehaving SCSI initiator repeatedly sends PR OUT commands
with unsupported operations, it will hit this pr_err() at a high frequency.
This could flood the dmesg buffer, hide other critical messages, and
potentially cause resource exhaustion.

This same pattern exists throughout iblock_execute_pr_out, including the
default switch case for unknown Service Actions:

    default:
        pr_err("Unknown PERSISTENT_RESERVE_OUT SA: 0x%02x\n", sa);
        return TCM_UNSUPPORTED_SCSI_OPCODE;

Would it be safer to use pr_err_ratelimited() for these initiator-triggerable
errors?

>  			return TCM_UNSUPPORTED_SCSI_OPCODE;
>  		}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260724075850.280699-1-kensanya@163.com?part=1

      reply	other threads:[~2026-07-24  8:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-24  7:58 [PATCH] scsi: target: iblock: Fix wrong PR ops NULL check for PREEMPT/RELEASE kensanya
2026-07-24  8:12 ` 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=20260724081235.26D3D1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=kensanya@163.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.