alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Vaishali Thakkar <vaishali.thakkar@oracle.com>
To: Clemens Ladisch <clemens@ladisch.de>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	Takashi Sakamoto <o-takashi@sakamocchi.jp>,
	alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
	Julia Lawall <julia.lawall@lip6.fr>
Subject: Use of copy_to_user in fireworks_hwdep.c while holding a spin_lock
Date: Fri, 19 Aug 2016 11:54:31 +0530	[thread overview]
Message-ID: <57B6A61F.7080700@oracle.com> (raw)


Hello,

I was wondering about the call to copy_to_user in function hwdep_read_locked and
hwdep_read_resp_buf for driver sound/firewire/fireworks/fireworks_hwdep.c. 
The function hwdep_read calls both of these functions while holding a spinlock[1],
which is not normally allowed due to the possibility of a deadlock.

This seems to be coming from the commit 555e8a8f7f149544eb7d4aa3a6420bc4c3055638
while adding a command/response functionality into hwdep interface. Is there some
reason that I am overlooking, why it is OK in this case? Is there some code in the
same file which ensures that page fault will not occur when we are calling these
functions while holding a spin_lock_irq?

The same issue is there with the driver sound/firewire/tascam/tascam-hwdep.c for
obvious reasons.

Coccinelle script is used to detect this issue.

Thank you.

[1] http://lxr.free-electrons.com/source/sound/firewire/fireworks/fireworks_hwdep.c#L114

-- 
Vaishali

             reply	other threads:[~2016-08-19  6:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-19  6:24 Vaishali Thakkar [this message]
2016-08-19 13:24 ` Use of copy_to_user in fireworks_hwdep.c while holding a spin_lock Takashi Sakamoto
  -- strict thread matches above, loose matches on Subject: below --
2016-08-19  6:06 Vaishali Thakkar

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=57B6A61F.7080700@oracle.com \
    --to=vaishali.thakkar@oracle.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=clemens@ladisch.de \
    --cc=julia.lawall@lip6.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=o-takashi@sakamocchi.jp \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.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;
as well as URLs for NNTP newsgroup(s).