diff options
author | Michael Buesch <mb@bu3sch.de> | 2009-07-19 15:40:39 -0400 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2009-09-12 08:48:40 -0400 |
commit | 64549e9357e5222a73e41aa87372b37abb047720 (patch) | |
tree | 0262ec2f55cd27294601e71fa0da14f90df9c8c2 /drivers/ieee1394 | |
parent | 74fca6a42863ffacaf7ba6f1936a9f228950f657 (diff) |
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: Michael 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: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/ieee1394')
-rw-r--r-- | drivers/ieee1394/raw1394.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/ieee1394/raw1394.c b/drivers/ieee1394/raw1394.c index da5f8829b503..0bc3d78ce7b1 100644 --- a/drivers/ieee1394/raw1394.c +++ b/drivers/ieee1394/raw1394.c | |||
@@ -2272,8 +2272,10 @@ static ssize_t raw1394_write(struct file *file, const char __user * buffer, | |||
2272 | return -EFAULT; | 2272 | return -EFAULT; |
2273 | } | 2273 | } |
2274 | 2274 | ||
2275 | if (!mutex_trylock(&fi->state_mutex)) | 2275 | if (!mutex_trylock(&fi->state_mutex)) { |
2276 | free_pending_request(req); | ||
2276 | return -EAGAIN; | 2277 | return -EAGAIN; |
2278 | } | ||
2277 | 2279 | ||
2278 | switch (fi->state) { | 2280 | switch (fi->state) { |
2279 | case opened: | 2281 | case opened: |