* ALSA: Soc_compress open file node allows more than once @ 2017-11-23 13:18 b_lkasam 2017-11-23 13:41 ` Takashi Iwai 0 siblings, 1 reply; 4+ messages in thread From: b_lkasam @ 2017-11-23 13:18 UTC (permalink / raw) To: alsa-devel; +Cc: lkasam, mangeshk 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. 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. Thanks Laxminath Kasam, Qualcomm. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: ALSA: Soc_compress open file node allows more than once 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 0 siblings, 1 reply; 4+ messages in thread From: Takashi Iwai @ 2017-11-23 13:41 UTC (permalink / raw) To: b_lkasam; +Cc: Vinod Koul, alsa-devel, lkasam, mangeshk 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. > 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. thanks, Takashi ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: ALSA: Soc_compress open file node allows more than once 2017-11-23 13:41 ` Takashi Iwai @ 2017-11-27 5:50 ` Vinod Koul 2017-12-28 6:35 ` b_lkasam 0 siblings, 1 reply; 4+ messages in thread From: Vinod Koul @ 2017-11-27 5:50 UTC (permalink / raw) To: Takashi Iwai; +Cc: alsa-devel, b_lkasam, lkasam, mangeshk 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 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: ALSA: Soc_compress open file node allows more than once 2017-11-27 5:50 ` Vinod Koul @ 2017-12-28 6:35 ` b_lkasam 0 siblings, 0 replies; 4+ messages in thread From: b_lkasam @ 2017-12-28 6:35 UTC (permalink / raw) To: Vinod Koul; +Cc: Takashi Iwai, alsa-devel, lkasam, mangeshk On 2017-11-27 11:20, Vinod Koul wrote: > 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? > Sorry for delay in getting back.. Yes, leak was in driver not on core side. Thanks everyone for inputs...We have fixed it in our 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. ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-12-28 6:35 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 2017-12-28 6:35 ` b_lkasam
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).