Skip to contentSkip to conversation

relay: fix lock imbalance in relay_late_setup_files

PATCH In review Jiri Slaby 3 participants 3 messages Jan 17, 2009 – Jan 19, 2009 Relay

lore
Share & tools
lore

Jiri Slaby

author
#0 lore raw

PATCH 1/1 relay: fix lock imbalance in relay_late_setup_files

One fail path in relay_late_setup_files() omits
mutex_unlock(&relay_channels_mutex);
Add it.

Cc Eduard - Gabriel Munteanu <[email protected]>
Cc Jens Axboe <[email protected]>
---
 kernel/relay.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
kernel/relay.c +3 -1
index 8ca1587..738bc85 100644
@@ -714,8 +714,10 @@ int relay_late_setup_files(struct rchan *chan,
 
 	mutex_lock(&relay_channels_mutex);
 	/* Is chan already set up? */
-	if (unlikely(chan->has_base_filename))
+	if (unlikely(chan->has_base_filename)) {
+		mutex_unlock(&relay_channels_mutex);
 		return -EEXIST;
+	}
 	chan->has_base_filename = 1;
 	chan->parent = parent;
 	curr_cpu = get_cpu();
Signature · 2 lines
1.6.1
caught by stanse
#2 lore raw
In reply to Jiri Slaby
Quoted 10 lines · Jiri Slaby

One fail path in relay_late_setup_files() omits
mutex_unlock(&relay_channels_mutex);
Add it.

Cc Eduard - Gabriel Munteanu <[email protected]>
Cc Jens Axboe <[email protected]>
---
 kernel/relay.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

Looks good, applied!

Quoted 25 lines
kernel/relay.c +3 -1
index 8ca1587..738bc85 100644
@@ -714,8 +714,10 @@ int relay_late_setup_files(struct rchan *chan,
 
 	mutex_lock(&relay_channels_mutex);
 	/* Is chan already set up? */
-	if (unlikely(chan->has_base_filename))
+	if (unlikely(chan->has_base_filename)) {
+		mutex_unlock(&relay_channels_mutex);
 		return -EEXIST;
+	}
 	chan->has_base_filename = 1;
 	chan->parent = parent;
 	curr_cpu = get_cpu();
Signature · 7 lines
1.6.1
caught by stanse
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Signature · 1 line
Jens Axboe