From: Vinod Koul <vinod.koul@intel.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org, b_lkasam@codeaurora.org,
lkasam@qti.qualcomm.com, mangeshk@qti.qualcomm.com
Subject: Re: ALSA: Soc_compress open file node allows more than once
Date: Mon, 27 Nov 2017 11:20:20 +0530 [thread overview]
Message-ID: <20171127055019.GP3187@localhost> (raw)
In-Reply-To: <s5hmv3d3yfn.wl-tiwai@suse.de>
On Thu, Nov 23, 2017 at 02:41:00PM +0100, Takashi Iwai wrote:
> On Thu, 23 Nov 2017 14:18:30 +0100,
> b_lkasam@codeaurora.org wrote:
> >
> > Hi ALSA team,
> > This is regarding compress offload framework file operations wrt open
> > system call.
> >
> > For open call to this driver currently allows for same node more than
> > once.
> >
> > This may result in memleak issues or data corruption if same node in
> > use by multiple instances.
>
> This only depends on the driver side implementation. There is no
> restriction in the core side, as the multiple open is possible
> depending on the hardware design and the driver implementation.
sounds right to me, also is the leak on core side or your driver?
>
> > can we have restriction to avoid open of same node using some refcount?
> >
> > we can either have refcount under compr->private_data and cross check
> > in below function before proceeding.
> > static int snd_compr_open(struct inode *inode, struct file *f)
> >
> > Please suggest accordingly.
>
> I'd suggest just to add an exclusive open check in the driver side.
> The open/close callbacks are protected via a mutex, so it can be a
> simple bool flag check.
>
> If the exclusive access is regarded as a common pattern, we can add
> some flag to snd_compr later and check it in the core, instead, too.
--
~Vinod
next prev parent reply other threads:[~2017-11-27 5:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-23 13:18 ALSA: Soc_compress open file node allows more than once b_lkasam
2017-11-23 13:41 ` Takashi Iwai
2017-11-27 5:50 ` Vinod Koul [this message]
2017-12-28 6:35 ` b_lkasam
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=20171127055019.GP3187@localhost \
--to=vinod.koul@intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=b_lkasam@codeaurora.org \
--cc=lkasam@qti.qualcomm.com \
--cc=mangeshk@qti.qualcomm.com \
--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;
as well as URLs for NNTP newsgroup(s).