mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sreeraj S Kurup <sreekuttan2156239@gmail.com>
To: tiwai@suse.de
Cc: linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org,
	perex@perex.cz, sreekuttan2156239@gmail.com
Subject: Re: [PATCH v2] ALSA: compress: Fix task resource leak on copy_to_user() failure
Date: Tue, 17 Nov 2026 16:01:51 +0000	[thread overview]
Message-ID: <20261117160151.2624-1-sreekuttan2156239@gmail.com> (raw)
In-Reply-To: <87qzgjxzh7.wl-tiwai@suse.de>

Hi Takashi,

Thanks for reviewing.

Regarding dma_buf_put(), get_dma_buf() takes an extra reference 
for each DMA-BUF. This reference is intended to be transferred 
to the file descriptor through fd_install(). If copy_to_user() 
fails before fd_install(), these extra references must be 
released separately.

snd_compr_task_free_one() releases the task's original DMA-BUF 
references through snd_compr_task_free(). So both the explicit 
dma_buf_put() calls and snd_compr_task_free_one() are needed.

Regarding the file descriptor ordering, I moved fd_install() 
after copy_to_user() so that the file descriptors are installed 
only after the task information is successfully copied to userspace.

There is a small time gap between copying the descriptor numbers and 
installing the file descriptors. Userspace should use these descriptors 
only after the ioctl completes.

Please let me know if you have any further concerns.

Best regards,
Sreeraj

      reply	other threads:[~2026-11-17 16:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13 10:45 [PATCH] " Sreeraj S Kurup
2026-11-13 11:04 ` [PATCH v2] " Sreeraj S Kurup
2026-11-17  6:28   ` Sreeraj S Kurup
2026-11-17 15:13     ` Takashi Iwai
2026-11-17 16:01       ` Sreeraj S Kurup [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=20261117160151.2624-1-sreekuttan2156239@gmail.com \
    --to=sreekuttan2156239@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.de \
    /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®