Commit 64549e93 authored by Michael Buesch's avatar Michael Buesch Committed by Stefan Richter

ieee1394: raw1394: Do not leak memory on failed trylock.

Do not leak the allocated memory in case the mutex_trylock() failed
to acquire the lock.
Signed-off-by: default avatarMichael Buesch <mb@bu3sch.de>

This bug does not happen in practice:  All raw1394 clients use
libraw1394, and accesses to a libraw1394 handle need to be serialized
by the client.  This is documented in libraw1394's API reference.
Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
parent 74fca6a4
...@@ -2272,8 +2272,10 @@ static ssize_t raw1394_write(struct file *file, const char __user * buffer, ...@@ -2272,8 +2272,10 @@ static ssize_t raw1394_write(struct file *file, const char __user * buffer,
return -EFAULT; return -EFAULT;
} }
if (!mutex_trylock(&fi->state_mutex)) if (!mutex_trylock(&fi->state_mutex)) {
free_pending_request(req);
return -EAGAIN; return -EAGAIN;
}
switch (fi->state) { switch (fi->state) {
case opened: case opened:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment