Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: Laurence Oberman <loberman@redhat.com>
To: Matthew Whitehead <tedheadster@gmail.com>, linux-scsi@vger.kernel.org
Cc: mkp@kernel.org, James.Bottomley@hansenpartnership.com, emilne@redhat.com
Subject: Re: [PATCH] scsi: aha1542: Remove unneeded scsi_dma_unmap() call
Date: Wed, 07 Oct 2026 13:08:27 -0400	[thread overview]
Message-ID: <c9f5d7c62a0af6a5532ff5bcdff6cc3be0548c84.camel@redhat.com> (raw)
In-Reply-To: <20260929144528.7061-1-tedheadster@gmail.com>

On Tue, 2026-09-29 at 10:45 -0400, Matthew Whitehead wrote:
> aha1542 never DMA maps the command's scatterlist. Data is bounced
> through a per-command buffer allocated with dma_alloc_coherent() in
> aha1542_init_cmd_priv(), the adapter is programmed with
> acmd->data_buffer_handle, and the payload is copied to and from the
> request segments in aha1542_queuecommand() and aha1542_free_cmd().
> 
> The scsi_dma_unmap() call left in aha1542_free_cmd() therefore unmaps
> a scatterlist that was never mapped. With CONFIG_DMA_API_DEBUG
> enabled
> this results in:
> 
>   device driver tries to free DMA memory it has not allocated
>     [device address=0x0000000000000000] [size=0 bytes]
> 
> Remove the call.
> 
> Verified by testing on real hardware.
> 
> Fixes: 2f2fef022c3e ("aha1542: use a local bounce buffer")
> Suggested-by: Laurence Oberman <loberman@redhat.com>
> Assisted-by: LLM
> Signed-off-by: Matthew Whitehead <tedheadster@gmail.com>
> ---
>  drivers/scsi/aha1542.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/scsi/aha1542.c b/drivers/scsi/aha1542.c
> index fd766282d4a4..a197b3d0b26b 100644
> --- a/drivers/scsi/aha1542.c
> +++ b/drivers/scsi/aha1542.c
> @@ -271,8 +271,6 @@ static void aha1542_free_cmd(struct scsi_cmnd
> *cmd)
>  			buf += bv.bv_len;
>  		}
>  	}
> -
> -	scsi_dma_unmap(cmd);
>  }
>  
>  static irqreturn_t aha1542_interrupt(int irq, void *dev_id)

Looks correct to me, and was tested at Red Hat.

Reviewed-by: Laurence Oberman <loberman@redhat.com>


      reply	other threads:[~2026-10-07 17:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-29 14:45 [PATCH] scsi: aha1542: Remove unneeded scsi_dma_unmap() call Matthew Whitehead
2026-10-07 17:08 ` Laurence Oberman [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=c9f5d7c62a0af6a5532ff5bcdff6cc3be0548c84.camel@redhat.com \
    --to=loberman@redhat.com \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=emilne@redhat.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mkp@kernel.org \
    --cc=tedheadster@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