BLASTing Linux Code

Jan Tobias Mühlberg and Gerald Lüttgen
Department of Computer Science, University of York, York YO10 5DD, U.K.


main page | next example


Commit Overview | Files | Comments

Checking Locking Properties: Example 6


Commit Overview

Commit Key f7cfcc72b365dc62cd01e1920f3f0b4e053f7735
Subject [PATCH] Fix deadlock in br_stp_disable_bridge
Description Looks like somebody forgot to use the _bh spin_lock variant. We ran into a deadlock where br->hello_timer expired while br_stp_disable_br() walked br->port_list.
Requires Linux 2.6.15 kernel source as from git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/linux-2.6.15.y.git

--- a/net/bridge/br_stp_if.c
+++ b/net/bridge/br_stp_if.c
@@ -67,7 +67,7 @@ void br_stp_disable_bridge(struct net_br
{
struct net_bridge_port *p;
- spin_lock(&br->lock);
+ spin_lock_bh(&br->lock);
list_for_each_entry(p, &br->port_list, list) {
if (p->state != BR_STATE_DISABLED)
br_stp_disable_port(p);
@@ -76,7 +76,7 @@ void br_stp_disable_bridge(struct net_br
br->topology_change = 0;
br->topology_change_detected = 0;
- spin_unlock(&br->lock);
+ spin_unlock_bh(&br->lock);
del_timer_sync(&br->hello_timer);
del_timer_sync(&br->topology_change_timer);

(purple: line numbers and function names; red: line removed; green: line added)

Files

Unmodified sources

Comments

This API usage rule violation is rather obvious and the error was easily detected using BLAST.

Source: http://www.kernel.org



Jan Tobias Mühlberg, $Date$