mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mukesh Savaliya <mukesh.savaliya@oss.qualcomm.com>
To: Thomas Fourier <fourier.thomas@gmail.com>
Cc: "Viken Dadhaniya" <viken.dadhaniya@oss.qualcomm.com>,
	"Andi Shyti" <andi.shyti@kernel.org>,
	"Sumit Semwal" <sumit.semwal@linaro.org>,
	"Christian König" <christian.koenig@amd.com>,
	"Philipp Stanner" <phasta@kernel.org>,
	"Akash Asthana" <akashast@codeaurora.org>,
	"Roja Rani Yarubandi" <rojay@codeaurora.org>,
	"Wolfram Sang" <wsa@kernel.org>,
	"open list:QUALCOMM I2C QCOM GENI DRIVER"
	<linux-i2c@vger.kernel.org>,
	"open list:QUALCOMM I2C QCOM GENI DRIVER"
	<linux-arm-msm@vger.kernel.org>,
	"open list" <linux-kernel@vger.kernel.org>,
	"open list:DMA BUFFER SHARING
	FRAMEWORK:Keyword:bdma_(?:buf|fence|resv)b"
	<linux-media@vger.kernel.org>,
	"open list:DMA BUFFER SHARING
	FRAMEWORK:Keyword:bdma_(?:buf|fence|resv)b"
	<dri-devel@lists.freedesktop.org>,
	"moderated list:DMA BUFFER SHARING
	FRAMEWORK:Keyword:bdma_(?:buf|fence|resv)b"
	<linaro-mm-sig@lists.linaro.org>
Subject: Re: [PATCH] i2c: qcom-geni: fix double free of the DMA bounce buffer
Date: Thu, 29 Oct 2026 11:06:17 +0530	[thread overview]
Message-ID: <84e53a4b-5ea1-430c-90ce-09d98948c8de@oss.qualcomm.com> (raw)
In-Reply-To: <20261028153353.69651-2-fourier.thomas@gmail.com>



On 10/28/2026 9:03 PM, Thomas Fourier wrote:
> geni_i2c_{rx,tx}_msg_cleanup() release gi2c->dma_buf through
> i2c_put_dma_safe_msg_buf(), which kfree()s the bounce buffer when the
> message buffer is not DMA safe, but leave the pointer set. gi2c->dma_buf
> is only updated when the DMA setup in geni_i2c_{rx,tx}_one_msg()
> succeeds. If the setup fails for a later message, the function clears
> only its local copy, so the cleanup helper sees the stale pointer from
> the previous transfer, unmaps it again and frees it a second time.
> 
> Clear gi2c->dma_buf once it has been released.
> 
> This bug was found statically and compile-tested only.
> 
> Fixes: 357ee8841d0b ("i2c: qcom-geni: Store DMA mapping data in geni_i2c_dev struct")
> Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
> ---
Reviewed-by: Mukesh Kumar Savaliya <mukesh.savaliya@oss.qualcomm.com>

      reply	other threads:[~2026-10-29  5:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-28 15:33 Thomas Fourier
2026-10-29  5:36 ` Mukesh Savaliya [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=84e53a4b-5ea1-430c-90ce-09d98948c8de@oss.qualcomm.com \
    --to=mukesh.savaliya@oss.qualcomm.com \
    --cc=akashast@codeaurora.org \
    --cc=andi.shyti@kernel.org \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=fourier.thomas@gmail.com \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=phasta@kernel.org \
    --cc=rojay@codeaurora.org \
    --cc=sumit.semwal@linaro.org \
    --cc=viken.dadhaniya@oss.qualcomm.com \
    --cc=wsa@kernel.org \
    /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

all inboxes | Powered by JetHome®