The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Bean Huo <huobean@gmail.com>
To: Arthur Simchaev <arthur.simchaev@sandisk.com>,
	martin.petersen@oracle.com
Cc: avri.altman@sandisk.com, Avi.Shchislowski@sandisk.com,
	beanhuo@micron.com,  linux-scsi@vger.kernel.org,
	linux-kernel@vger.kernel.org, bvanassche@acm.org
Subject: Re: [PATCH] scsi: ufs: core: Fix memory crash in case arpmb command failed
Date: Mon, 17 Feb 2025 19:39:30 +0100	[thread overview]
Message-ID: <1fdfb9221f1cab04881d91e1e2d56ba97054a580.camel@gmail.com> (raw)
In-Reply-To: <20250217164330.245612-1-arthur.simchaev@sandisk.com>

On Mon, 2025-02-17 at 18:43 +0200, Arthur Simchaev wrote:
> In case the device doesn't support arpmb, the kernel get memory crash
> due to copy user data in bsg_transport_sg_io_fn level. So in case
> ufshcd_send_bsg_uic_cmd returned error, do not change the job's
> reply_len.
> 
> Memory crash backtrace:
> 3,1290,531166405,-;ufshcd 0000:00:12.5: ARPMB OP failed: error code -
> 22


It is Advanced RPMB access and not related to the UIC command, 

If the deivce didn't support advanced rpmb, got return -EINVAL(-22). 

In this case, in bsg_transport_sg_io_fn, 

if (job->result < 0) {
	job->reply_len = sizeof(u32); 

then:

 int len = min(hdr->max_response_len, job->reply_len); 
	if (copy_to_user(uptr64(hdr->response), job->reply, len))


It looks like you didn't initialize the correct response buffer from
user space.

Could you rephrase your commit message, add a Fixes tag, and resubmit?


Kind regards,
Bean

  parent reply	other threads:[~2025-02-17 18:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-17 16:43 [PATCH] scsi: ufs: core: Fix memory crash in case arpmb command failed Arthur Simchaev
2025-02-17 17:57 ` Bean Huo
2025-02-17 18:39 ` Bean Huo [this message]
2025-02-18  9:29   ` Arthur Simchaev

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=1fdfb9221f1cab04881d91e1e2d56ba97054a580.camel@gmail.com \
    --to=huobean@gmail.com \
    --cc=Avi.Shchislowski@sandisk.com \
    --cc=arthur.simchaev@sandisk.com \
    --cc=avri.altman@sandisk.com \
    --cc=beanhuo@micron.com \
    --cc=bvanassche@acm.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.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