2002-07-11 21:32:43

by Dawson Engler

[permalink] [raw]
Subject: [CHECKER] 56 potential lock/unlock bugs in 2.5.8

Hi All,

enclosed is an error log for a checker that warns when a lock/disable
was not paired with an unlock/enable. These errors could be tricky,
and they only got a quick inspection, so treat the reports as potential
rather than guaranteed bugs.

Run over 2.5.8 it found 56 potential errors.

Dawson

(Note the path names in the summary are a bit mangled):

# BUGs | File Name
7 | /wan/lmc_main.c
3 | /usb/pwc-if.c
3 | /drivers/i2c-core.c
3 | /usb/ov511.c
2 | /mtd/cfi_cmdset_0001.c
2 | /fs/vfs.c
2 | /net/irlap.c
2 | /sound/es1371.c
2 | /net/irlmp.c
2 | /usb/dabusb.c
1 | /message/i2o_core.c
1 | /net/sch_teql.c
1 | /media/cpia_pp.c
1 | /usb/devices.c
1 | /fs/file.c
1 | /irda/ircomm_core.c
1 | /drivers/dv1394.c
1 | /char/riointr.c
1 | /fs/dir.c
1 | /usb/printer.c
1 | /isa/gus_pcm.c
1 | /irda/ircomm_tty.c
1 | /fs/jfs_imap.c
1 | /sound/es1968.c
1 | /synth/emux_synth.c
1 | /sound/pcm_lib.c
1 | /net/tcp_ipv6.c
1 | /drivers/pcilynx.c
1 | /pci/ali5451.c
1 | /drivers/acpi_processor.c
1 | /net/smctr.c
1 | /drivers/cdu31a.c
1 | /2.5.8/shmem.c
1 | /usb/usbvideo.c
1 | /net/ali-ircc.c
1 | /fs/namei.c
1 | /pci/rme9652.c
1 | /fs/svclock.c

############################################################
# 2.5.8 specific errors

#
---------------------------------------------------------
[BUG] it seems like one.
/u2/engler/mc/oses/linux/2.5.8/mm/shmem.c:554:shmem_getpage_locked: ERROR:A_B:506:554:Did not reverse 'spin_lock' [COUNTER=spin_lock:506] [fit=3] [fit_fn=2] [fn_ex=5] [fn_counter=1] [ex=5619] [counter=272] [z = 1.34804760770983] [fn-z = -1.31122013621437]

entry = shmem_alloc_entry (info, idx);
if (IS_ERR(entry))
return (void *)entry;

Start --->
spin_lock (&info->lock);

... DELETED 42 lines ...

goto wait_retry;

error = move_from_swap_cache(page, idx, mapping);
if (error < 0) {
UnlockPage(page);
Error --->
return ERR_PTR(error);
}

swap_free(*entry);
---------------------------------------------------------
[BUG]
/u2/engler/mc/oses/linux/2.5.8/drivers/mtd/chips/cfi_cmdset_0001.c:782:do_write_buffer: ERROR:A_B:700:782:Did not reverse 'spin_lock' [COUNTER=spin_lock:700] [fit=3] [fit_fn=1] [fn_ex=5] [fn_counter=1] [ex=5619] [counter=272] [z = 1.34804760770983] [fn-z = -1.31122013621437]
/* Let's determine this according to the interleave only once */
status_OK = CMD(0x80);

timeo = jiffies + HZ;
retry:
Start --->
spin_lock_bh(chip->mutex);

... DELETED 76 lines ...

map->write16 (map, *((__u16*)buf)++, adr+z);
} else if (cfi_buswidth_is_4()) {
map->write32 (map, *((__u32*)buf)++, adr+z);
} else {
DISABLE_VPP(map);
Error --->
return -EINVAL;
}
}
/* GO GO GO */
---------------------------------------------------------
[BUG] this seems like a security hole as well.
/u2/engler/mc/oses/linux/2.5.8/drivers/usb/class/printer.c:649:usblp_write: ERROR:A_B:614:649:Did not reverse 'down' [COUNTER=down:614] [fit=6] [fit_fn=1] [fn_ex=5] [fn_counter=1] [ex=1231] [counter=170] [z = -12.2522803630056] [fn-z = -1.31122013621437]
}
}
remove_wait_queue(&usblp->wait, &wait);
}

Start --->
down (&usblp->sem);

... DELETED 29 lines ...


usblp->writeurb->transfer_buffer_length = (count - writecount) < USBLP_BUF_SIZE ?
(count - writecount) : USBLP_BUF_SIZE;

if (copy_from_user(usblp->writeurb->transfer_buffer, buffer + writecount,
Error --->
usblp->writeurb->transfer_buffer_length)) return -EFAULT;

usblp->writeurb->dev = usblp->dev;
usblp->wcomplete = 0;
---------------------------------------------------------
[BUG] i think it's a bug, line 1880 has:
if (frames == 0 && runtime->status->state == SNDRV_PCM_STATE_PAUSED) {
err = -EPIPE;
goto _end;
}
which will skip the unlock.
/u2/engler/mc/oses/linux/2.5.8/sound/core/pcm_lib.c:1926:snd_pcm_lib_write1: ERROR:A_B:1892:1926:Did not reverse 'spin_lock' [COUNTER=spin_lock:1892] [fit=3] [fit_fn=4] [fn_ex=4] [fn_counter=1] [ex=5619] [counter=272] [z = 1.34804760770983] [fn-z = -1.53896752812773]
appl_ptr = runtime->control->appl_ptr;
appl_ofs = appl_ptr % runtime->buffer_size;
spin_unlock_irq(&runtime->lock);
if ((err = transfer(substream, appl_ofs, (void *)data, offset, frames)) < 0)
goto _end;
Start --->
spin_lock_irq(&runtime->lock);

... DELETED 28 lines ...

snd_pcm_tick_prepare(substream);
}
_end_unlock:
spin_unlock_irq(&runtime->lock);
_end:
Error --->
return xfer > 0 ? xfer : err;
}

snd_pcm_sframes_t snd_pcm_lib_write(snd_pcm_substream_t *substream, const void *buf, snd_pcm_uframes_t size)
---------------------------------------------------------
[BUG] all other case arms call __sti(); however, it may be that safe_halt
does something weird.
/u2/engler/mc/oses/linux/2.5.8/drivers/acpi/acpi_processor.c:566:acpi_processor_idle: ERROR:A_B:400:566: did not reverse '__cli' [COUNTER=__cli:400] [fit=5] [fit_fn=1] [fn_ex=4] [fn_counter=1] [ex=78] [counter=17] [z = -5.76670162618366] [fn-z = -1.53896752812773]

/*
* Interrupts must be disabled during bus mastering calculations and
* for C2/C3 transitions.
*/
Start --->
__cli();

... DELETED 160 lines ...

* from the previous and prepare to use the new.
*/
if (next_state != pr->power.state)
acpi_processor_power_activate(pr, next_state);

Error --->
return;
}


---------------------------------------------------------
[BUG] i think the missing AG_UNLOCK is a bug --- all the other returns do it.
/u2/engler/mc/oses/linux/2.5.8/fs/jfs/jfs_imap.c:1453:diAlloc: ERROR:A_B:1444:1453:Did not reverse 'down' [COUNTER=down:1444] [fit=6] [fit_fn=2] [fn_ex=4] [fn_counter=1] [ex=1231] [counter=170] [z = -12.2522803630056] [fn-z = -1.53896752812773]

/* get the ag number of this iag */
agno = JFS_IP(pip)->agno;

/* lock the AG inode map information */
Start --->
AG_LOCK(imap, agno);

/* Get read lock on imap inode */
IREAD_LOCK(ipimap);

/* get the iag number and read the iag */
iagno = INOTOIAG(inum);
if ((rc = diIAGRead(imap, iagno, &mp))) {
IREAD_UNLOCK(ipimap);
Error --->
return (rc);
}
iagp = (iag_t *) mp->data;

---------------------------------------------------------
[BUG] seems like it --- the other denied_nolocks does do an up.
/u2/engler/mc/oses/linux/2.5.8/fs/lockd/svclock.c:361:nlmsvc_lock: ERROR:A_B:318:361:Did not reverse 'down' [COUNTER=down:318] [fit=6] [fit_fn=4] [fn_ex=4] [fn_counter=1] [ex=1231] [counter=170] [z = -12.2522803630056] [fn-z = -1.53896752812773]
(long long)lock->fl.fl_start,
(long long)lock->fl.fl_end,
wait);

/* Lock file against concurrent access */
Start --->
down(&file->f_sema);

... DELETED 37 lines ...

/* If we don't have a block, create and initialize it. Then
* retry because we may have slept in kmalloc. */
if (block == NULL) {
dprintk("lockd: blocking on this lock (allocating).\n");
if (!(block = nlmsvc_create_block(rqstp, file, lock, cookie)))
Error --->
return nlm_lck_denied_nolocks;
goto again;
}

---------------------------------------------------------
[BUG]
/u2/engler/mc/oses/linux/2.5.8/drivers/mtd/chips/cfi_cmdset_0001.c:782:do_write_buffer: ERROR:A_B:756:782:Did not reverse 'spin_lock' [COUNTER=spin_lock:756] [fit=3] [fit_fn=6] [fn_ex=3] [fn_counter=1] [ex=5619] [counter=272] [z = 1.34804760770983] [fn-z = -1.83532587096449]
if ((status & status_OK) == status_OK)
break;

spin_unlock_bh(chip->mutex);
cfi_udelay(1);
Start --->
spin_lock_bh(chip->mutex);

... DELETED 20 lines ...

map->write16 (map, *((__u16*)buf)++, adr+z);
} else if (cfi_buswidth_is_4()) {
map->write32 (map, *((__u32*)buf)++, adr+z);
} else {
DISABLE_VPP(map);
Error --->
return -EINVAL;
}
}
/* GO GO GO */
---------------------------------------------------------
[BUG] INIT_REQUEST returns if queue is empty.
/u2/engler/mc/oses/linux/2.5.8/drivers/cdrom/cdu31a.c:1609:do_cdu31a_request: ERROR:A_B:1561:1609: did not reverse 'cli' [COUNTER=cli:1561] [fit=1] [fit_fn=2] [fn_ex=2] [fn_counter=1] [ex=1454] [counter=37] [z = 4.46194604933914] [fn-z = -2.25170500701057]
/*
* Make sure no one else is using the driver; wait for them
* to finish if it is so.
*/
save_flags(flags);
Start --->
cli();

... DELETED 42 lines ...


if (!sony_spun_up) {
scd_spinup();
}

Error --->
INIT_REQUEST;

block = CURRENT->sector;
nblock = CURRENT->nr_sectors;
---------------------------------------------------------
[BUG] if the if-statement doesn't trigger, sti() is not called. plus,
the loop seems really busted, since err is never updated.
/u2/engler/mc/oses/linux/2.5.8/drivers/net/tokenring/smctr.c:4585:smctr_rx_frame: ERROR:A_B:4527:4585: did not reverse 'cli' [COUNTER=cli:4527] [fit=1] [fit_fn=1] [fn_ex=2] [fn_counter=1] [ex=1454] [counter=37] [z = 4.46194604933914] [fn-z = -2.25170500701057]
__u8 *pbuff;

if(smctr_debug > 10)
printk("%s: smctr_rx_frame\n", dev->name);

Start --->
cli();

... DELETED 52 lines ...


if(err != SUCCESS)
break;
}

Error --->
return (err);
}

static int smctr_send_dat(struct net_device *dev)
---------------------------------------------------------
[BUG] i think this is a security hole.
/u2/engler/mc/oses/linux/2.5.8/fs/hpfs/dir.c:194:hpfs_lookup: ERROR:A_B:192:194: did not reverse 'lock_kernel' [COUNTER=lock_kernel:192] [fit=2] [fit_fn=1] [fn_ex=2] [fn_counter=1] [ex=780] [counter=24] [z = 2.62144158993226] [fn-z = -2.25170500701057]
ino_t ino;
int err;
struct inode *result = NULL;
struct hpfs_inode_info *hpfs_result;

Start --->
lock_kernel();
if ((err = hpfs_chk_name((char *)name, &len))) {
Error --->
if (err == -ENAMETOOLONG) return ERR_PTR(-ENAMETOOLONG);
goto end_add;
}

---------------------------------------------------------
[BUG] unlocked elsewhere, and return value of this function is not checked.
/u2/engler/mc/oses/linux/2.5.8/sound/pci/rme9652/rme9652.c:522:rme9652_set_rate: ERROR:A_B:493:522:Did not reverse 'spin_lock' [COUNTER=spin_lock:493] [fit=3] [fit_fn=10] [fn_ex=2] [fn_counter=1] [ex=5619] [counter=272] [z = 1.34804760770983] [fn-z = -2.25170500701057]
Note that a similar but essentially insoluble problem
exists for externally-driven rate changes. All we can do
is to flag rate changes in the read/write routines.
*/

Start --->
spin_lock_irq(&rme9652->lock);

... DELETED 23 lines ...

reject_if_open = 1;
}
rate = RME9652_DS | RME9652_freq;
break;
default:
Error --->
return -EINVAL;
}

if (reject_if_open &&
---------------------------------------------------------
[BUG] recheck: seems unlikely, though it does seem that the path is valid.
/u2/engler/mc/oses/linux/2.5.8/net/ipv6/tcp_ipv6.c:206:tcp_v6_get_port: ERROR:A_B:112:206:Did not reverse 'spin_lock' [COUNTER=spin_lock:112] [fit=3] [fit_fn=11] [fn_ex=2] [fn_counter=1] [ex=5619] [counter=272] [z = 1.34804760770983] [fn-z = -2.25170500701057]
rover = tcp_port_rover;
do { rover++;
if ((rover < low) || (rover > high))
rover = low;
head = &tcp_bhash[tcp_bhashfn(rover)];
Start --->
spin_lock(&head->lock);

... DELETED 88 lines ...


fail_unlock:
spin_unlock(&head->lock);
fail:
local_bh_enable();
Error --->
return ret;
}

static __inline__ void __tcp_v6_hash(struct sock *sk)
---------------------------------------------------------
[BUG] doesn't seem to initialize for retry, so if nothing else will deadlock?
/u2/engler/mc/oses/linux/2.5.8/drivers/usb/media/dabusb.c:608:dabusb_open: ERROR:A_B:604:608:Did not reverse 'down' [COUNTER=down:604] [fit=6] [fit_fn=16] [fn_ex=2] [fn_counter=1] [ex=1231] [counter=170] [z = -12.2522803630056] [fn-z = -2.25170500701057]
schedule_timeout (HZ / 2);

if (signal_pending (current)) {
return -EAGAIN;
}
Start --->
down (&s->mutex);
}
if (usb_set_interface (s->usbdev, _DABUSB_IF, 1) < 0) {
err("set_interface failed");
Error --->
return -EINVAL;
}
s->opened = 1;
up (&s->mutex);
---------------------------------------------------------
[BUG]
/u2/engler/mc/oses/linux/2.5.8/drivers/message/i2o/i2o_core.c:729:i2o_claim_device: ERROR:A_B:716:729:Did not reverse 'down' [COUNTER=down:716] [fit=6] [fit_fn=15] [fn_ex=2] [fn_counter=1] [ex=1231] [counter=170] [z = -12.2522803630056] [fn-z = -2.25170500701057]
* is returned. On success zero is returned.
*/

int i2o_claim_device(struct i2o_device *d, struct i2o_handler *h)
{
Start --->
down(&i2o_configuration_lock);
if (d->owner) {
printk(KERN_INFO "Device claim called, but dev already owned by %s!",
h->name);
up(&i2o_configuration_lock);
return -EBUSY;
}
d->owner=h;

if(i2o_issue_claim(I2O_CMD_UTIL_CLAIM ,d->controller,d->lct_data.tid,
I2O_CLAIM_PRIMARY))
{
d->owner = NULL;
Error --->
return -EBUSY;
}
up(&i2o_configuration_lock);
return 0;
---------------------------------------------------------
[BUG] ouch --- more evidence that we should tag & rank error paths
/u2/engler/mc/oses/linux/2.5.8/sound/pci/es1968.c:1450:snd_es1968_new_memory: ERROR:A_B:1437:1450:Did not reverse 'down' [COUNTER=down:1437] [fit=6] [fit_fn=7] [fn_ex=2] [fn_counter=1] [ex=1231] [counter=170] [z = -12.2522803630056] [fn-z = -2.25170500701057]
static esm_memory_t *snd_es1968_new_memory(es1968_t *chip, int size)
{
esm_memory_t *buf;
struct list_head *p;

Start --->
down(&chip->memory_mutex);
list_for_each(p, &chip->buf_list) {
buf = list_entry(p, esm_memory_t, list);
if (buf->empty && buf->size >= size)
goto __found;
}
up(&chip->memory_mutex);
return NULL;

__found:
if (buf->size > size) {
esm_memory_t *chunk = kmalloc(sizeof(*chunk), GFP_KERNEL);
if (chunk == NULL)
Error --->
return NULL;
chunk->size = buf->size - size;
chunk->buf = buf->buf + size;
chunk->addr = buf->addr + size;
---------------------------------------------------------
[BUG] doesn't seem to initialize for retry, so if nothing else will deadlock?
/u2/engler/mc/oses/linux/2.5.8/drivers/usb/media/dabusb.c:608:dabusb_open: ERROR:A_B:591:608:Did not reverse 'down' [COUNTER=down:591] [fit=6] [fit_fn=6] [fn_ex=2] [fn_counter=1] [ex=1231] [counter=170] [z = -12.2522803630056] [fn-z = -2.25170500701057]
return -EIO;

s = &dabusb[devnum - DABUSB_MINOR];

dbg("dabusb_open");
Start --->
down (&s->mutex);

... DELETED 11 lines ...

}
down (&s->mutex);
}
if (usb_set_interface (s->usbdev, _DABUSB_IF, 1) < 0) {
err("set_interface failed");
Error --->
return -EINVAL;
}
s->opened = 1;
up (&s->mutex);
---------------------------------------------------------
[BUG] i'm pretty sure they want to goto out instead of out2.
/u2/engler/mc/oses/linux/2.5.8/sound/oss/es1371.c:1406:es1371_read: ERROR:A_B:1346:1406:Did not reverse 'down' [COUNTER=down:1346] [fit=6] [fit_fn=9] [fn_ex=2] [fn_counter=1] [ex=1231] [counter=170] [z = -12.2522803630056] [fn-z = -2.25170500701057]
return -ESPIPE;
if (s->dma_adc.mapped)
return -ENXIO;
if (!access_ok(VERIFY_WRITE, buffer, count))
return -EFAULT;
Start --->
down(&s->sem);

... DELETED 54 lines ...

out:
up(&s->sem);
out2:
remove_wait_queue(&s->dma_adc.wait, &wait);
set_current_state(TASK_RUNNING);
Error --->
return ret;
}

static ssize_t es1371_write(struct file *file, const char *buffer, size_t count, loff_t *ppos)
---------------------------------------------------------
[BUG] does not release the global adap_lock.
/u2/engler/mc/oses/linux/2.5.8/drivers/i2c/i2c-core.c:277:i2c_del_adapter: ERROR:A_B:211:277:Did not reverse 'down' [COUNTER=down:211] [fit=6] [fit_fn=5] [fn_ex=2] [fn_counter=1] [ex=1231] [counter=170] [z = -12.2522803630056] [fn-z = -2.25170500701057]

int i2c_del_adapter(struct i2c_adapter *adap)
{
int i,j,res;

Start --->
ADAP_LOCK();

... DELETED 60 lines ...

ERROR0:
ADAP_UNLOCK();
return res;
ERROR1:
DRV_UNLOCK();
Error --->
return res;
}


---------------------------------------------------------
[BUG] the code seems pretty sure that it's not supposed to up, but i don't see
the logic.
/u2/engler/mc/oses/linux/2.5.8/sound/oss/es1371.c:1491:es1371_write: ERROR:A_B:1425:1491:Did not reverse 'down' [COUNTER=down:1425] [fit=6] [fit_fn=12] [fn_ex=2] [fn_counter=1] [ex=1231] [counter=170] [z = -12.2522803630056] [fn-z = -2.25170500701057]
return -ESPIPE;
if (s->dma_dac2.mapped)
return -ENXIO;
if (!access_ok(VERIFY_READ, buffer, count))
return -EFAULT;
Start --->
down(&s->sem);

... DELETED 60 lines ...

up(&s->sem);
out2:
remove_wait_queue(&s->dma_dac2.wait, &wait);
out3:
set_current_state(TASK_RUNNING);
Error --->
return ret;
}

/* No kernel lock - we have our own spinlock */
---------------------------------------------------------
[BUG] is an assert, but doesn't enable.
/u2/engler/mc/oses/linux/2.5.8/net/irda/ircomm/ircomm_core.c:501:ircomm_proc_read: ERROR:A_B:495:501: did not reverse 'cli' [COUNTER=cli:495] [fit=1] [fit_fn=7] [fn_ex=1] [fn_counter=1] [ex=1454] [counter=37] [z = 4.46194604933914] [fn-z = -2.91998558035372]
{
struct ircomm_cb *self;
unsigned long flags;

save_flags(flags);
Start --->
cli();

len = 0;

self = (struct ircomm_cb *) hashbin_get_first(ircomm);
while (self != NULL) {
Error --->
ASSERT(self->magic == IRCOMM_MAGIC, return len;);

if(self->line < 0x10)
len += sprintf(buf+len, "ircomm%d", self->line);
---------------------------------------------------------
[BUG]
/u2/engler/mc/oses/linux/2.5.8/fs/affs/namei.c:349:affs_rmdir: ERROR:A_B:345:349: did not reverse 'lock_kernel' [COUNTER=lock_kernel:345] [fit=2] [fit_fn=2] [fn_ex=1] [fn_counter=1] [ex=780] [counter=24] [z = 2.62144158993226] [fn-z = -2.91998558035372]
{
int res;
pr_debug("AFFS: rmdir(dir=%u, \"%.*s\")\n", (u32)dir->i_ino,
(int)dentry->d_name.len, dentry->d_name.name);

Start --->
lock_kernel();

/* WTF??? */
if (!dentry->d_inode)
Error --->
return -ENOENT;

res = affs_remove_header(dentry);
unlock_kernel();
---------------------------------------------------------
[BUG] not a good idea.
/u2/engler/mc/oses/linux/2.5.8/fs/intermezzo/file.c:303:presto_apply_write_policy: ERROR:A_B:299:303: did not reverse 'lock_kernel' [COUNTER=lock_kernel:299] [fit=2] [fit_fn=5] [fn_ex=1] [fn_counter=1] [ex=780] [counter=24] [z = 2.62144158993226] [fn-z = -2.91998558035372]
/* This is really heavy weight and should be fixed
ASAP. At most we should be recording the number
of bytes written and not locking the kernel,
wait for permits, etc, on the write path. SHP
*/
Start --->
lock_kernel();
if ( presto_get_permit(file->f_dentry->d_inode) < 0 ) {
EXIT;
/* we must be disconnected, not to worry */
Error --->
return;
}
error = presto_journal_close
(&rec, fset, file, file->f_dentry, &new_file_ver);
---------------------------------------------------------
[BUG] --- there should be a lot more examples computed from this function though maybe broken mc?
/u2/engler/mc/oses/linux/2.5.8/fs/intermezzo/vfs.c:1951:lento_iopen: ERROR:A_B:1946:1951: did not reverse 'lock_kernel' [COUNTER=lock_kernel:1946] [fit=2] [fit_fn=4] [fn_ex=1] [fn_counter=1] [ex=780] [counter=24] [z = 2.62144158993226] [fn-z = -2.91998558035372]
if (IS_ERR(tmp)) {
EXIT;
return PTR_ERR(tmp);
}

Start --->
lock_kernel();
again: /* look the named file or a parent directory so we can get the cache */
error = presto_walk(tmp, &nd);
if ( error && error != -ENOENT ) {
EXIT;
Error --->
return error;
}
if (error == -ENOENT)
dentry = NULL;
---------------------------------------------------------
[BUG] all other exits release kernel lock.
/u2/engler/mc/oses/linux/2.5.8/fs/intermezzo/vfs.c:2052:lento_close: ERROR:A_B:2035:2052: did not reverse 'lock_kernel' [COUNTER=lock_kernel:2035] [fit=2] [fit_fn=3] [fn_ex=1] [fn_counter=1] [ex=780] [counter=24] [z = 2.62144158993226] [fn-z = -2.91998558035372]
struct file * filp;
struct dentry *dentry;
int do_kml, do_expect;

ENTRY;
Start --->
lock_kernel();

... DELETED 11 lines ...

put_unused_fd(fd);
FD_CLR(fd, files->close_on_exec);
error = filp_close(filp, files);
} else {
EXIT;
Error --->
return error;
}

if (error) {
---------------------------------------------------------
[BUG] returns with lock held.
/u2/engler/mc/oses/linux/2.5.8/sound/isa/gus/gus_pcm.c:790:snd_gf1_pcm_volume_put: ERROR:A_B:785:790:Did not reverse 'spin_lock' [COUNTER=spin_lock:785] [fit=3] [fit_fn=65] [fn_ex=1] [fn_counter=1] [ex=5619] [counter=272] [z = 1.34804760770983] [fn-z = -2.91998558035372]
gus->gf1.pcm_volume_level_right1 = val2;
gus->gf1.pcm_volume_level_left = snd_gf1_lvol_to_gvol_raw(val1 << 9) << 4;
gus->gf1.pcm_volume_level_right = snd_gf1_lvol_to_gvol_raw(val2 << 9) << 4;
spin_unlock_irqrestore(&gus->pcm_volume_level_lock, flags);
/* are we active? */
Start --->
spin_lock_irqsave(&gus->voice_alloc, flags);
for (idx = 0; idx < 32; idx++) {
pvoice = &gus->gf1.voices[idx];
if (!pvoice->pcm)
continue;
Error --->
pcmp = snd_magic_cast(gus_pcm_private_t, pvoice->private_data, return -ENXIO);
if (!(pcmp->flags & SNDRV_GF1_PCM_PFLG_ACTIVE))
continue;
/* load real volume - better precision */
---------------------------------------------------------
[BUG] sure seems like a bug.
/u2/engler/mc/oses/linux/2.5.8/drivers/ieee1394/dv1394.c:2635:dv1394_devfs_find: ERROR:A_B:2625:2635:Did not reverse 'spin_lock' [COUNTER=spin_lock:2625] [fit=3] [fit_fn=48] [fn_ex=1] [fn_counter=1] [ex=5619] [counter=272] [z = 1.34804760770983] [fn-z = -2.91998558035372]
dv1394_devfs_find( char *name)
{
struct list_head *lh;
struct dv1394_devfs_entry *p;

Start --->
spin_lock( &dv1394_devfs_lock);
if(!list_empty(&dv1394_devfs)) {
list_for_each(lh, &dv1394_devfs) {
p = list_entry(lh, struct dv1394_devfs_entry, list);
if(!strncmp(p->name, name, sizeof(p->name))) {
spin_unlock( &dv1394_devfs_lock);
return p;
}
}
}
Error --->
return NULL;
}

static int dv1394_devfs_add_entry(struct video_card *video)
---------------------------------------------------------
[BUG]
/u2/engler/mc/oses/linux/2.5.8/sound/synth/emux/emux_synth.c:102:snd_emux_note_on: ERROR:A_B:90:102:Did not reverse 'spin_lock' [COUNTER=spin_lock:90] [fit=3] [fit_fn=47] [fn_ex=1] [fn_counter=1] [ex=5619] [counter=272] [z = 1.34804760770983] [fn-z = -2.91998558035372]
#if 0 // seems not necessary
/* Turn off the same note on the same channel. */
terminate_note1(emu, key, chan, 0);
#endif

Start --->
spin_lock_irqsave(&emu->voice_lock, flags);
for (i = 0; i < nvoices; i++) {

/* set up each voice parameter */
/* at this stage, we don't trigger the voice yet. */

if (table[i] == NULL)
continue;

vp = emu->ops.get_voice(emu, port);
if (vp == NULL || vp->ch < 0)
continue;
Error --->
snd_assert(vp->emu != NULL && vp->hw != NULL, return);
if (STATE_IS_PLAYING(vp->state))
emu->ops.terminate(vp);

---------------------------------------------------------
[BUG]
/u2/engler/mc/oses/linux/2.5.8/sound/pci/ali5451/ali5451.c:1444:snd_ali_capture_prepare: ERROR:A_B:1430:1444:Did not reverse 'spin_lock' [COUNTER=spin_lock:1430] [fit=3] [fit_fn=78] [fn_ex=1] [fn_counter=1] [ex=5619] [counter=272] [z = 1.34804760770983] [fn-z = -2.91998558035372]
unsigned int PAN;
unsigned int VOL;
unsigned int EC;
u8 bValue;

Start --->
spin_lock_irqsave(&codec->reg_lock, flags);

snd_ali_printk("capture_prepare...\n");

snd_ali_enable_special_channel(codec,pvoice->number);

Delta = snd_ali_convert_rate(runtime->rate, 1);

// Prepare capture intr channel
if (pvoice->number == ALI_SPDIF_IN_CHANNEL) {

unsigned int rate;

if (codec->revision != ALI_5451_V02)
Error --->
return -1;
rate = snd_ali_get_spdif_in_rate(codec);
if (rate == 0) {
snd_printk("ali_capture_preapre: spdif rate detect err!\n");
---------------------------------------------------------
[BUG] if port is not on the list, will exit with lock held.
/u2/engler/mc/oses/linux/2.5.8/drivers/media/video/cpia_pp.c:618:cpia_pp_detach: ERROR:A_B:599:618:Did not reverse 'spin_lock' [COUNTER=spin_lock:599] [fit=3] [fit_fn=57] [fn_ex=1] [fn_counter=1] [ex=5619] [counter=272] [z = 1.34804760770983] [fn-z = -2.91998558035372]

static void cpia_pp_detach (struct parport *port)
{
struct cam_data *cpia;

Start --->
spin_lock( &cam_list_lock_pp );

... DELETED 13 lines ...

kfree(cam);
cpia->lowlevel_data = NULL;
break;
}
}
Error --->
}

static void cpia_pp_attach (struct parport *port)
{
---------------------------------------------------------
[BUG]
/u2/engler/mc/oses/linux/2.5.8/net/sched/sch_teql.c:473:teql_init: ERROR:A_B:468:473: did not reverse 'rtnl_lock' [COUNTER=rtnl_lock:468] [fit=4] [fit_fn=1] [fn_ex=1] [fn_counter=1] [ex=58] [counter=4] [z = -0.524444892073259] [fn-z = -2.91998558035372]
int __init teql_init(void)
#endif
{
int err;

Start --->
rtnl_lock();

the_master.dev.priv = (void*)&the_master;
err = dev_alloc_name(&the_master.dev, "teql%d");
if (err < 0)
Error --->
return err;
memcpy(the_master.qops.id, the_master.dev.name, IFNAMSIZ);
the_master.dev.init = teql_master_init;

---------------------------------------------------------
[BUG] nasty: sets uvd to null, then scribles on &uvd->lock.
/u2/engler/mc/oses/linux/2.5.8/drivers/usb/media/usbvideo.c:1060:usbvideo_AllocateDevice: ERROR:A_B:1054:1060:Did not reverse 'down' [COUNTER=down:1054] [fit=6] [fit_fn=22] [fn_ex=1] [fn_counter=1] [ex=1231] [counter=170] [z = -12.2522803630056] [fn-z = -2.91998558035372]
dbg("Device entry #%d. at $%p", devnum, uvd);

/* Not relying upon caller we increase module counter ourselves */
usbvideo_ClientIncModCount(uvd);

Start --->
down(&uvd->lock);
for (i=0; i < USBVIDEO_NUMSBUF; i++) {
uvd->sbuf[i].urb = usb_alloc_urb(FRAMES_PER_DESC, GFP_KERNEL);
if (uvd->sbuf[i].urb == NULL) {
err("usb_alloc_urb(%d.) failed.", FRAMES_PER_DESC);
uvd->uvd_used = 0;
Error --->
uvd = NULL;
goto allocate_done;
}
}
---------------------------------------------------------
[BUG] does return with lock held..
/u2/engler/mc/oses/linux/2.5.8/drivers/usb/core/devices.c:578:usb_device_read: ERROR:A_B:571:578:Did not reverse 'down' [COUNTER=down:571] [fit=6] [fit_fn=32] [fn_ex=1] [fn_counter=1] [ex=1231] [counter=170] [z = -12.2522803630056] [fn-z = -2.91998558035372]
return 0;
if (!access_ok(VERIFY_WRITE, buf, nbytes))
return -EFAULT;

/* enumerate busses */
Start --->
down (&usb_bus_list_lock);
for (buslist = usb_bus_list.next; buslist != &usb_bus_list; buslist = buslist->next) {
/* print devices for this bus */
bus = list_entry(buslist, struct usb_bus, bus_list);
/* recurse through all children of the root hub */
ret = usb_device_dump(&buf, &nbytes, &skip_bytes, ppos, bus->root_hub, bus, 0, 0, 0);
if (ret < 0)
Error --->
return ret;
total_written += ret;
}
up (&usb_bus_list_lock);
---------------------------------------------------------
[BUG] seems like it.
/u2/engler/mc/oses/linux/2.5.8/drivers/ieee1394/pcilynx.c:868:mem_read: ERROR:A_B:843:868:Did not reverse 'down' [COUNTER=down:843] [fit=6] [fit_fn=27] [fn_ex=1] [fn_counter=1] [ex=1231] [counter=170] [z = -12.2522803630056] [fn-z = -2.91998558035372]
default:
panic("pcilynx%d: unsupported md->type %d in %s",
md->lynx->id, md->type, __FUNCTION__);
}

Start --->
down(&md->lynx->mem_dma_mutex);

... DELETED 19 lines ...

}

while (bcount >= 4) {
retval = mem_dmaread(md, md->lynx->mem_dma_buffer_dma
+ count - bcount, bcount, off);
Error --->
if (retval < 0) return retval;

bcount -= retval;
off += retval;
---------------------------------------------------------
[BUG]
/u2/engler/mc/oses/linux/2.5.8/net/irda/ircomm/ircomm_tty.c:526:ircomm_tty_close: ERROR:A_B:516:526: did not reverse 'cli' [COUNTER=cli:516] [fit=1] [fit_fn=10] [fn_ex=3] [fn_counter=2] [ex=1454] [counter=37] [z = 4.46194604933914] [fn-z = -3.59092423229804]

if (!tty)
return;

save_flags(flags);
Start --->
cli();

if (tty_hung_up_p(filp)) {
MOD_DEC_USE_COUNT;
restore_flags(flags);

IRDA_DEBUG(0, __FUNCTION__ "(), returning 1\n");
return;
}

Error --->
ASSERT(self != NULL, return;);
ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);

if ((tty->count == 1) && (self->open_count != 1)) {
---------------------------------------------------------
[BUG] seems to be a missing DRV_LOCK
/u2/engler/mc/oses/linux/2.5.8/drivers/i2c/i2c-core.c:368:i2c_del_driver: ERROR:A_B:328:368:Did not reverse 'down' [COUNTER=down:328] [fit=6] [fit_fn=36] [fn_ex=2] [fn_counter=2] [ex=1231] [counter=170] [z = -12.2522803630056] [fn-z = -4.12948320967011]

int i2c_del_driver(struct i2c_driver *driver)
{
int i,j,k,res;

Start --->
DRV_LOCK();

... DELETED 34 lines ...

"dummy driver %s, adapter %s could "
"not be detached properly; driver "
"not unloaded!",driver->name,
adap->name);
ADAP_UNLOCK();
Error --->
return res;
}
} else {
for (j=0;j<I2C_CLIENT_MAX;j++) {
---------------------------------------------------------
[BUG] does not seem to release DRV_LOCK in caller...
/u2/engler/mc/oses/linux/2.5.8/drivers/i2c/i2c-core.c:392:i2c_del_driver: ERROR:A_B:328:392:Did not reverse 'down' [COUNTER=down:328] [fit=6] [fit_fn=36] [fn_ex=2] [fn_counter=2] [ex=1231] [counter=170] [z = -12.2522803630056] [fn-z = -4.12948320967011]

int i2c_del_driver(struct i2c_driver *driver)
{
int i,j,k,res;

Start --->
DRV_LOCK();

... DELETED 58 lines ...

not unloaded!",
driver->name,
client->addr,
adap->name);
ADAP_UNLOCK();
Error --->
return res;
}
}
}
---------------------------------------------------------
[BUG]
/u2/engler/mc/oses/linux/2.5.8/net/irda/irlap.c:1104:irlap_proc_read: ERROR:A_B:1098:1104: did not reverse 'cli' [COUNTER=cli:1098] [fit=1] [fit_fn=22] [fn_ex=1] [fn_counter=2] [ex=1454] [counter=37] [z = 4.46194604933914] [fn-z = -4.90076972114066]
struct irlap_cb *self;
unsigned long flags;
int i = 0;

save_flags(flags);
Start --->
cli();

len = 0;

self = (struct irlap_cb *) hashbin_get_first(irlap);
while (self != NULL) {
Error --->
ASSERT(self != NULL, return -ENODEV;);
ASSERT(self->magic == LAP_MAGIC, return -EBADR;);

len += sprintf(buf+len, "irlap%d ", i++);
---------------------------------------------------------
[BUG]
/u2/engler/mc/oses/linux/2.5.8/net/irda/irlap.c:1105:irlap_proc_read: ERROR:A_B:1098:1105: did not reverse 'cli' [COUNTER=cli:1098] [fit=1] [fit_fn=22] [fn_ex=1] [fn_counter=2] [ex=1454] [counter=37] [z = 4.46194604933914] [fn-z = -4.90076972114066]
struct irlap_cb *self;
unsigned long flags;
int i = 0;

save_flags(flags);
Start --->
cli();

len = 0;

self = (struct irlap_cb *) hashbin_get_first(irlap);
while (self != NULL) {
ASSERT(self != NULL, return -ENODEV;);
Error --->
ASSERT(self->magic == LAP_MAGIC, return -EBADR;);

len += sprintf(buf+len, "irlap%d ", i++);
len += sprintf(buf+len, "state: %s\n",
---------------------------------------------------------
[BUG]
/u2/engler/mc/oses/linux/2.5.8/net/irda/irlmp.c:1680:irlmp_proc_read: ERROR:A_B:1673:1680: did not reverse 'cli' [COUNTER=cli:1673] [fit=1] [fit_fn=21] [fn_ex=1] [fn_counter=2] [ex=1454] [counter=37] [z = 4.46194604933914] [fn-z = -4.90076972114066]
unsigned long flags;

ASSERT(irlmp != NULL, return 0;);

save_flags( flags);
Start --->
cli();

len = 0;

len += sprintf( buf+len, "Unconnected LSAPs:\n");
self = (struct lsap_cb *) hashbin_get_first( irlmp->unconnected_lsaps);
while (self != NULL) {
Error --->
ASSERT(self->magic == LMP_LSAP_MAGIC, return 0;);
len += sprintf(buf+len, "lsap state: %s, ",
irlsap_state[ self->lsap_state]);
len += sprintf(buf+len,
---------------------------------------------------------
[BUG]
/u2/engler/mc/oses/linux/2.5.8/drivers/net/irda/ali-ircc.c:2052:ali_ircc_net_ioctl: ERROR:A_B:2041:2052: did not reverse 'cli' [COUNTER=cli:2041] [fit=1] [fit_fn=25] [fn_ex=1] [fn_counter=2] [ex=1454] [counter=37] [z = 4.46194604933914] [fn-z = -4.90076972114066]

IRDA_DEBUG(2, __FUNCTION__ "(), %s, (cmd=0x%X)\n", dev->name, cmd);

/* Disable interrupts & save flags */
save_flags(flags);
Start --->
cli();

switch (cmd) {
case SIOCSBANDWIDTH: /* Set bandwidth */
IRDA_DEBUG(1, __FUNCTION__ "(), SIOCSBANDWIDTH\n");
/*
* This function will also be used by IrLAP to change the
* speed, so we still must allow for speed change within
* interrupt context.
*/
if (!in_interrupt() && !capable(CAP_NET_ADMIN))
Error --->
return -EPERM;

ali_ircc_change_speed(self, irq->ifr_baudrate);
break;
---------------------------------------------------------
[BUG]
/u2/engler/mc/oses/linux/2.5.8/net/irda/irlmp.c:1709:irlmp_proc_read: ERROR:A_B:1673:1709: did not reverse 'cli' [COUNTER=cli:1673] [fit=1] [fit_fn=21] [fn_ex=1] [fn_counter=2] [ex=1454] [counter=37] [z = 4.46194604933914] [fn-z = -4.90076972114066]
unsigned long flags;

ASSERT(irlmp != NULL, return 0;);

save_flags( flags);
Start --->
cli();

... DELETED 30 lines ...

len += sprintf(buf+len, "\n");

len += sprintf(buf+len, "\n Connected LSAPs:\n");
self = (struct lsap_cb *) hashbin_get_first(lap->lsaps);
while (self != NULL) {
Error --->
ASSERT(self->magic == LMP_LSAP_MAGIC, return 0;);
len += sprintf(buf+len, " lsap state: %s, ",
irlsap_state[ self->lsap_state]);
len += sprintf(buf+len,
---------------------------------------------------------
[BUG] double lock
/u2/engler/mc/oses/linux/2.5.8/drivers/char/rio/riointr.c:130:riopoll: ERROR:A_B:132:130:Did not reverse 'spin_lock' [COUNTER=spin_lock:132] [fit=3] [fit_fn=195] [fn_ex=1] [fn_counter=2] [ex=5619] [counter=272] [z = 1.34804760770983] [fn-z = -4.90076972114066]
/*
** okay, we've got a cpu that hasn't had a go recently
** - lets check to see what needs doing.
*/
for ( host=0; host<p->RIONumHosts; host++ ) {
Error --->
struct Host *HostP = &p->RIOHosts[host];

Start --->
rio_spin_lock( &HostP->HostLock );

if ( ( (HostP->Flags & RUN_STATE) != RC_RUNNING ) ||
HostP->InIntr ) {
---------------------------------------------------------
[BUG]
/u2/engler/mc/oses/linux/2.5.8/drivers/usb/media/pwc-if.c:1756:usb_pwc_disconnect: ERROR:A_B:1750:1756: did not reverse 'lock_kernel' [COUNTER=lock_kernel:1750] [fit=2] [fit_fn=21] [fn_ex=1] [fn_counter=3] [ex=780] [counter=24] [z = 2.62144158993226] [fn-z = -6.42364054837573]
{
struct pwc_device *pdev;
int hint;
DECLARE_WAITQUEUE(wait, current);

Start --->
lock_kernel();
free_mem_leak();

pdev = (struct pwc_device *)ptr;
if (pdev == NULL) {
Err("pwc_disconnect() Called without private pointer.\n");
Error --->
return;
}
if (pdev->udev == NULL) {
Err("pwc_disconnect() already called for %p\n", pdev);
---------------------------------------------------------
[BUG]
/u2/engler/mc/oses/linux/2.5.8/drivers/usb/media/pwc-if.c:1760:usb_pwc_disconnect: ERROR:A_B:1750:1760: did not reverse 'lock_kernel' [COUNTER=lock_kernel:1750] [fit=2] [fit_fn=21] [fn_ex=1] [fn_counter=3] [ex=780] [counter=24] [z = 2.62144158993226] [fn-z = -6.42364054837573]
{
struct pwc_device *pdev;
int hint;
DECLARE_WAITQUEUE(wait, current);

Start --->
lock_kernel();
free_mem_leak();

pdev = (struct pwc_device *)ptr;
if (pdev == NULL) {
Err("pwc_disconnect() Called without private pointer.\n");
return;
}
if (pdev->udev == NULL) {
Err("pwc_disconnect() already called for %p\n", pdev);
Error --->
return;
}
if (pdev->udev != udev) {
Err("pwc_disconnect() Woops: pointer mismatch udev/pdev.\n");
---------------------------------------------------------
[BUG]
/u2/engler/mc/oses/linux/2.5.8/drivers/usb/media/pwc-if.c:1764:usb_pwc_disconnect: ERROR:A_B:1750:1764: did not reverse 'lock_kernel' [COUNTER=lock_kernel:1750] [fit=2] [fit_fn=21] [fn_ex=1] [fn_counter=3] [ex=780] [counter=24] [z = 2.62144158993226] [fn-z = -6.42364054837573]
{
struct pwc_device *pdev;
int hint;
DECLARE_WAITQUEUE(wait, current);

Start --->
lock_kernel();
free_mem_leak();

pdev = (struct pwc_device *)ptr;
if (pdev == NULL) {
Err("pwc_disconnect() Called without private pointer.\n");
return;
}
if (pdev->udev == NULL) {
Err("pwc_disconnect() already called for %p\n", pdev);
return;
}
if (pdev->udev != udev) {
Err("pwc_disconnect() Woops: pointer mismatch udev/pdev.\n");
Error --->
return;
}
#ifdef PWC_MAGIC
if (pdev->magic != PWC_MAGIC) {
---------------------------------------------------------
[BUG] really seems like each of these paths is an error.
/u2/engler/mc/oses/linux/2.5.8/drivers/usb/media/ov511.c:1232:ov51x_set_slave_ids: ERROR:A_B:1229:1232:Did not reverse 'down' [COUNTER=down:1229] [fit=6] [fit_fn=137] [fn_ex=1] [fn_counter=3] [ex=1231] [counter=170] [z = -12.2522803630056] [fn-z = -6.42364054837573]

/* Sets I2C read and write slave IDs. Returns <0 for error */
static int
ov51x_set_slave_ids(struct usb_ov511 *ov, unsigned char sid)
{
Start --->
down(&ov->i2c_lock);

if (reg_w(ov, R51x_I2C_W_SID, sid) < 0)
Error --->
return -EIO;

if (reg_w(ov, R51x_I2C_R_SID, sid + 1) < 0)
return -EIO;
---------------------------------------------------------
[BUG]
/u2/engler/mc/oses/linux/2.5.8/drivers/usb/media/ov511.c:1235:ov51x_set_slave_ids: ERROR:A_B:1229:1235:Did not reverse 'down' [COUNTER=down:1229] [fit=6] [fit_fn=137] [fn_ex=1] [fn_counter=3] [ex=1231] [counter=170] [z = -12.2522803630056] [fn-z = -6.42364054837573]

/* Sets I2C read and write slave IDs. Returns <0 for error */
static int
ov51x_set_slave_ids(struct usb_ov511 *ov, unsigned char sid)
{
Start --->
down(&ov->i2c_lock);

if (reg_w(ov, R51x_I2C_W_SID, sid) < 0)
return -EIO;

if (reg_w(ov, R51x_I2C_R_SID, sid + 1) < 0)
Error --->
return -EIO;

if (ov51x_reset(ov, OV511_RESET_NOREGS) < 0)
return -EIO;
---------------------------------------------------------
[BUG]
/u2/engler/mc/oses/linux/2.5.8/drivers/usb/media/ov511.c:1238:ov51x_set_slave_ids: ERROR:A_B:1229:1238:Did not reverse 'down' [COUNTER=down:1229] [fit=6] [fit_fn=137] [fn_ex=1] [fn_counter=3] [ex=1231] [counter=170] [z = -12.2522803630056] [fn-z = -6.42364054837573]

/* Sets I2C read and write slave IDs. Returns <0 for error */
static int
ov51x_set_slave_ids(struct usb_ov511 *ov, unsigned char sid)
{
Start --->
down(&ov->i2c_lock);

if (reg_w(ov, R51x_I2C_W_SID, sid) < 0)
return -EIO;

if (reg_w(ov, R51x_I2C_R_SID, sid + 1) < 0)
return -EIO;

if (ov51x_reset(ov, OV511_RESET_NOREGS) < 0)
Error --->
return -EIO;

up(&ov->i2c_lock);

---------------------------------------------------------
[BUG]
/u2/engler/mc/oses/linux/2.5.8/drivers/net/wan/lmc/lmc_main.c:172:lmc_ioctl: ERROR:A_B:164:172:Did not reverse 'spin_lock' [COUNTER=spin_lock:164] [fit=3] [fit_fn=213] [fn_ex=1] [fn_counter=7] [ex=5619] [counter=272] [z = 1.34804760770983] [fn-z = -10.7066137946303]

/*
* Most functions mess with the structure
* Disable interrupts while we do the polling
*/
Start --->
spin_lock_irqsave(&sc->lmc_lock, flags);

switch (cmd) {
/*
* Return current driver state. Since we keep this up
* To date internally, just copy this out to the user.
*/
case LMCIOCGINFO: /*fold01*/
Error --->
LMC_COPY_TO_USER(ifr->ifr_data, &sc->ictl, sizeof (lmc_ctl_t));
ret = 0;
break;

---------------------------------------------------------
[BUG]
/u2/engler/mc/oses/linux/2.5.8/drivers/net/wan/lmc/lmc_main.c:188:lmc_ioctl: ERROR:A_B:164:188:Did not reverse 'spin_lock' [COUNTER=spin_lock:164] [fit=3] [fit_fn=213] [fn_ex=1] [fn_counter=7] [ex=5619] [counter=272] [z = 1.34804760770983] [fn-z = -10.7066137946303]

/*
* Most functions mess with the structure
* Disable interrupts while we do the polling
*/
Start --->
spin_lock_irqsave(&sc->lmc_lock, flags);

... DELETED 18 lines ...

if(dev->flags & IFF_UP){
ret = -EBUSY;
break;
}

Error --->
LMC_COPY_FROM_USER(&ctl, ifr->ifr_data, sizeof (lmc_ctl_t));

sc->lmc_media->set_status (sc, &ctl);

---------------------------------------------------------
[BUG]
/u2/engler/mc/oses/linux/2.5.8/drivers/net/wan/lmc/lmc_main.c:218:lmc_ioctl: ERROR:A_B:164:218:Did not reverse 'spin_lock' [COUNTER=spin_lock:164] [fit=3] [fit_fn=213] [fn_ex=1] [fn_counter=7] [ex=5619] [counter=272] [z = 1.34804760770983] [fn-z = -10.7066137946303]

/*
* Most functions mess with the structure
* Disable interrupts while we do the polling
*/
Start --->
spin_lock_irqsave(&sc->lmc_lock, flags);

... DELETED 48 lines ...

if (!capable(CAP_NET_ADMIN)) {
ret = -EPERM;
break;
}

Error --->
LMC_COPY_FROM_USER(&new_type, ifr->ifr_data, sizeof(u_int16_t));


if (new_type == old_type)
---------------------------------------------------------
[BUG]
/u2/engler/mc/oses/linux/2.5.8/drivers/net/wan/lmc/lmc_main.c:255:lmc_ioctl: ERROR:A_B:164:255:Did not reverse 'spin_lock' [COUNTER=spin_lock:164] [fit=3] [fit_fn=213] [fn_ex=1] [fn_counter=7] [ex=5619] [counter=272] [z = 1.34804760770983] [fn-z = -10.7066137946303]

/*
* Most functions mess with the structure
* Disable interrupts while we do the polling
*/
Start --->
spin_lock_irqsave(&sc->lmc_lock, flags);

... DELETED 85 lines ...

sc->lmc_xinfo.link_status = sc->lmc_media->get_link_status (sc);
sc->lmc_xinfo.mii_reg16 = lmc_mii_readreg (sc, 0, 16);

sc->lmc_xinfo.Magic1 = 0xDEADBEEF;

Error --->
LMC_COPY_TO_USER(ifr->ifr_data, &sc->lmc_xinfo,
sizeof (struct lmc_xinfo));
ret = 0;

---------------------------------------------------------
[BUG]
/u2/engler/mc/oses/linux/2.5.8/drivers/net/wan/lmc/lmc_main.c:286:lmc_ioctl: ERROR:A_B:164:286:Did not reverse 'spin_lock' [COUNTER=spin_lock:164] [fit=3] [fit_fn=213] [fn_ex=1] [fn_counter=7] [ex=5619] [counter=272] [z = 1.34804760770983] [fn-z = -10.7066137946303]

/*
* Most functions mess with the structure
* Disable interrupts while we do the polling
*/
Start --->
spin_lock_irqsave(&sc->lmc_lock, flags);

... DELETED 116 lines ...

(regVal & T1FRAMER_COFA_MASK) >> 2;
sc->stats.severelyErroredFrameCount +=
regVal & T1FRAMER_SEF_MASK;
}

Error --->
LMC_COPY_TO_USER(ifr->ifr_data, &sc->stats,
sizeof (struct lmc_statistics));

ret = 0;
---------------------------------------------------------
[BUG]
/u2/engler/mc/oses/linux/2.5.8/drivers/net/wan/lmc/lmc_main.c:317:lmc_ioctl: ERROR:A_B:164:317:Did not reverse 'spin_lock' [COUNTER=spin_lock:164] [fit=3] [fit_fn=213] [fn_ex=1] [fn_counter=7] [ex=5619] [counter=272] [z = 1.34804760770983] [fn-z = -10.7066137946303]

/*
* Most functions mess with the structure
* Disable interrupts while we do the polling
*/
Start --->
spin_lock_irqsave(&sc->lmc_lock, flags);

... DELETED 147 lines ...

if(dev->flags & IFF_UP){
ret = -EBUSY;
break;
}

Error --->
LMC_COPY_FROM_USER(&ctl, ifr->ifr_data, sizeof (lmc_ctl_t));
sc->lmc_media->set_circuit_type(sc, ctl.circuit_type);
sc->ictl.circuit_type = ctl.circuit_type;
ret = 0;
---------------------------------------------------------
[BUG]
/u2/engler/mc/oses/linux/2.5.8/drivers/net/wan/lmc/lmc_main.c:368:lmc_ioctl: ERROR:A_B:164:368:Did not reverse 'spin_lock' [COUNTER=spin_lock:164] [fit=3] [fit_fn=213] [fn_ex=1] [fn_counter=7] [ex=5619] [counter=272] [z = 1.34804760770983] [fn-z = -10.7066137946303]

/*
* Most functions mess with the structure
* Disable interrupts while we do the polling
*/
Start --->
spin_lock_irqsave(&sc->lmc_lock, flags);

... DELETED 198 lines ...

/*
* Stop the xwitter whlie we restart the hardware
*/
LMC_XMITTER_BUSY(dev);

Error --->
LMC_COPY_FROM_USER(&xc, ifr->ifr_data, sizeof (struct lmc_xilinx_control));
switch(xc.command){
case lmc_xilinx_reset: /*fold02*/
{


2002-07-11 21:51:25

by Thunder from the hill

[permalink] [raw]
Subject: Re: [CHECKER] 56 potential lock/unlock bugs in 2.5.8

Hi,

On Thu, 11 Jul 2002, Dawson Engler wrote:
> ############################################################
> # 2.5.8 specific errors
>
> #
> ---------------------------------------------------------
> [BUG] it seems like one.
> /u2/engler/mc/oses/linux/2.5.8/mm/shmem.c:554:shmem_getpage_locked: ERROR:A_B:506:554:Did not reverse 'spin_lock' [COUNTER=spin_lock:506] [fit=3] [fit_fn=2] [fn_ex=5] [fn_counter=1] [ex=5619] [counter=272] [z = 1.34804760770983] [fn-z = -1.31122013621437]
>
> entry = shmem_alloc_entry (info, idx);
> if (IS_ERR(entry))
> return (void *)entry;
>
> Start --->
> spin_lock (&info->lock);
>
> ... DELETED 42 lines ...
>
> goto wait_retry;
>
> error = move_from_swap_cache(page, idx, mapping);
> if (error < 0) {
> UnlockPage(page);
> Error --->
> return ERR_PTR(error);
> }
>
> swap_free(*entry);

This one is easy:

Index: mm/shmem.c
===================================================================
RCS file: /var/cvs/thunder-2.5/mm/shmem.c,v
retrieving revision 1.3
diff -p -u -r1.3 shmem.c
--- mm/shmem.c 6 Jul 2002 18:17:44 -0000 1.3
+++ mm/shmem.c 11 Jul 2002 21:47:22 -0000
@@ -607,6 +607,7 @@ repeat:
if (error < 0) {
unlock_page(page);
page_cache_release(page);
+ spin_unlock (&info->lock);
return ERR_PTR(error);
}



> ---------------------------------------------------------
> [BUG]
> /u2/engler/mc/oses/linux/2.5.8/drivers/mtd/chips/cfi_cmdset_0001.c:782:do_write_buffer: ERROR:A_B:700:782:Did not reverse 'spin_lock' [COUNTER=spin_lock:700] [fit=3] [fit_fn=1] [fn_ex=5] [fn_counter=1] [ex=5619] [counter=272] [z = 1.34804760770983] [fn-z = -1.31122013621437]
> /* Let's determine this according to the interleave only once */
> status_OK = CMD(0x80);
>
> timeo = jiffies + HZ;
> retry:
> Start --->
> spin_lock_bh(chip->mutex);
>
> ... DELETED 76 lines ...
>
> map->write16 (map, *((__u16*)buf)++, adr+z);
> } else if (cfi_buswidth_is_4()) {
> map->write32 (map, *((__u32*)buf)++, adr+z);
> } else {
> DISABLE_VPP(map);
> Error --->
> return -EINVAL;
> }
> }
> /* GO GO GO */

This one, too:

Index: drivers/mtd/chips/cfi_cmdset_0001.c
===================================================================
RCS file: /var/cvs/thunder-2.5/drivers/mtd/chips/cfi_cmdset_0001.c,v
retrieving revision 1.1.1.1
diff -p -u -r1.1.1.1 cfi_cmdset_0001.c
--- drivers/mtd/chips/cfi_cmdset_0001.c 21 Jun 2002 22:17:29 -0000
1.1.1.1
+++ drivers/mtd/chips/cfi_cmdset_0001.c 11 Jul 2002 21:52:35 -0000
@@ -779,6 +779,7 @@ static inline int do_write_buffer(struct
map->write32 (map, *((__u32*)buf)++, adr+z);
} else {
DISABLE_VPP(map);
+ spin_unlock_bh(chip->mutex);
return -EINVAL;
}
}


I'm on the rest.

Regards,
Thunder
--
(Use http://www.ebb.org/ungeek if you can't decode)
------BEGIN GEEK CODE BLOCK------
Version: 3.12
GCS/E/G/S/AT d- s++:-- a? C++$ ULAVHI++++$ P++$ L++++(+++++)$ E W-$
N--- o? K? w-- O- M V$ PS+ PE- Y- PGP+ t+ 5+ X+ R- !tv b++ DI? !D G
e++++ h* r--- y-
------END GEEK CODE BLOCK------

2002-07-11 22:16:34

by Oliver Neukum

[permalink] [raw]
Subject: Re: [CHECKER] 56 potential lock/unlock bugs in 2.5.8

Am Donnerstag, 11. Juli 2002 23:35 schrieb Dawson Engler:
> Hi All,
>
> enclosed is an error log for a checker that warns when a lock/disable
> was not paired with an unlock/enable. These errors could be tricky,
> and they only got a quick inspection, so treat the reports as potential
> rather than guaranteed bugs.
>
> Run over 2.5.8 it found 56 potential errors.
>
> Dawson

Hi,

I checked the USB ones. Two current bugs were found. In one other case
has been heavily updated. In one case the cker was wrong, it seems to have
trouble with goto and the other cases had already been fixed.

Regards
Oliver

2002-07-11 22:29:44

by Andrew Grover

[permalink] [raw]
Subject: RE: [CHECKER] 56 potential lock/unlock bugs in 2.5.8

Hi,

> From: Dawson Engler [mailto:[email protected]]
> ---------------------------------------------------------
> [BUG] all other case arms call __sti(); however, it may be
> that safe_halt
> does something weird.
> /u2/engler/mc/oses/linux/2.5.8/drivers/acpi/acpi_processor.c:5

#define safe_halt() __asm__ __volatile__("sti; hlt": : :"memory")

I think we're OK for now. I doubt safe_halt will change, but if it does I'll
fix this issue.

Regards -- Andy

2002-07-11 22:31:22

by Andi Kleen

[permalink] [raw]
Subject: Re: [CHECKER] 56 potential lock/unlock bugs in 2.5.8

Dawson Engler <[email protected]> writes:

> [BUG] recheck: seems unlikely, though it does seem that the path is valid.
> /u2/engler/mc/oses/linux/2.5.8/net/ipv6/tcp_ipv6.c:206:tcp_v6_get_port: ERROR:A_B:112:206:Did not reverse 'spin_lock' [COUNTER=spin_lock:112] [fit=3] [fit_fn=11] [fn_ex=2] [fn_counter=1] [ex=5619] [counter=272] [z = 1.34804760770983] [fn-z = -2.25170500701057]
> rover = tcp_port_rover;
> do { rover++;
> if ((rover < low) || (rover > high))
> rover = low;
> head = &tcp_bhash[tcp_bhashfn(rover)];
> Start --->
> spin_lock(&head->lock);
>

} while (--remaining > 0);
tcp_port_rover = rover;
spin_unlock(&tcp_portalloc_lock);

/* Exhausted local port range during search? */
ret = 1;
if (remaining <= 0)
goto fail;


the goto can only hit when the lock hasn't been taken, so not unlocking it
is correct. It just rechecks the loop end condition, but your tool probably
doesn't know that. The wonders of structured programming :-)


-Andi

2002-07-11 23:11:45

by Thunder from the hill

[permalink] [raw]
Subject: Re: [CHECKER] 56 potential lock/unlock bugs in 2.5.8

Hi,

Here is the whole set.

A copy can be found at
<URL:http://luckynet.dynu.com/~thunder/patches/checker.patch>
The ones I didn't handle can be found at
<URL:http://luckynet.dynu.com/~thunder/patches/checker.text>

Index: mm/shmem.c
===================================================================
RCS file: /var/cvs/thunder-2.5/mm/shmem.c,v
retrieving revision 1.3
diff -p -u -r1.3 shmem.c
--- mm/shmem.c 6 Jul 2002 18:17:44 -0000 1.3
+++ mm/shmem.c 11 Jul 2002 21:47:22 -0000
@@ -607,6 +607,7 @@ repeat:
if (error < 0) {
unlock_page(page);
page_cache_release(page);
+ spin_unlock (&info->lock);
return ERR_PTR(error);
}
Index: drivers/mtd/chips/cfi_cmdset_0001.c
===================================================================
RCS file: /var/cvs/thunder-2.5/drivers/mtd/chips/cfi_cmdset_0001.c,v
retrieving revision 1.1.1.1
diff -p -u -r1.1.1.1 cfi_cmdset_0001.c
--- drivers/mtd/chips/cfi_cmdset_0001.c 21 Jun 2002 22:17:29 -0000
1.1.1.1
+++ drivers/mtd/chips/cfi_cmdset_0001.c 11 Jul 2002 21:52:35 -0000
@@ -779,6 +779,7 @@ static inline int do_write_buffer(struct
map->write32 (map, *((__u32*)buf)++, adr+z);
} else {
DISABLE_VPP(map);
+ spin_unlock_bh(chip->mutex);
return -EINVAL;
}
}
Index: drivers/usb/class/printer.c
===================================================================
RCS file: /var/cvs/thunder-2.5/drivers/usb/class/printer.c,v
retrieving revision 1.2
diff -p -u -r1.2 printer.c
--- drivers/usb/class/printer.c 6 Jul 2002 18:17:14 -0000 1.2
+++ drivers/usb/class/printer.c 11 Jul 2002 21:56:49 -0000
@@ -654,8 +654,12 @@ static ssize_t usblp_write(struct file *
usblp->writeurb->transfer_buffer_length = (count - writecount) < USBLP_BUF_SIZE ?
(count - writecount) : USBLP_BUF_SIZE;

- if (copy_from_user(usblp->writeurb->transfer_buffer, buffer + writecount,
- usblp->writeurb->transfer_buffer_length)) return -EFAULT;
+ if (copy_from_user(usblp->writeurb->transfer_buffer,
+ buffer + writecount,
+ usblp->writeurb->transfer_buffer_length)) {
+ up (&usblp->sem);
+ return -EFAULT;
+ }

usblp->writeurb->dev = usblp->dev;
usblp->wcomplete = 0;
Index: sound/core/pcm_lib.c
===================================================================
RCS file: /var/cvs/thunder-2.5/sound/core/pcm_lib.c,v
retrieving revision 1.1.1.1
diff -p -u -r1.1.1.1 pcm_lib.c
--- sound/core/pcm_lib.c 20 Jun 2002 22:53:51 -0000 1.1.1.1
+++ sound/core/pcm_lib.c 11 Jul 2002 22:00:26 -0000
@@ -1883,7 +1883,7 @@ static snd_pcm_sframes_t snd_pcm_lib_wri
frames = cont;
if (frames == 0 && runtime->status->state == SNDRV_PCM_STATE_PAUSED) {
err = -EPIPE;
- goto _end;
+ goto _end_unlock;
}
snd_assert(frames != 0,
spin_unlock_irq(&runtime->lock);
Index: fs/jfs/jfs_imap.c
===================================================================
RCS file: /var/cvs/thunder-2.5/fs/jfs/jfs_imap.c,v
retrieving revision 1.1.1.1
diff -p -u -r1.1.1.1 jfs_imap.c
--- fs/jfs/jfs_imap.c 20 Jun 2002 22:53:46 -0000 1.1.1.1
+++ fs/jfs/jfs_imap.c 11 Jul 2002 22:03:17 -0000
@@ -1453,6 +1453,7 @@ int diAlloc(struct inode *pip, boolean_t
iagno = INOTOIAG(inum);
if ((rc = diIAGRead(imap, iagno, &mp))) {
IREAD_UNLOCK(ipimap);
+ AG_UNLOCK(imap, agno);
return (rc);
}
iagp = (iag_t *) mp->data;
Index: drivers/net/tokenring/smctr.c
===================================================================
RCS file: /var/cvs/thunder-2.5/drivers/net/tokenring/smctr.c,v
retrieving revision 1.1.1.1
diff -p -u -r1.1.1.1 smctr.c
--- drivers/net/tokenring/smctr.c 19 Jun 2002 02:11:55 -0000 1.1.1.1
+++ drivers/net/tokenring/smctr.c 11 Jul 2002 22:11:01 -0000
@@ -4582,6 +4582,7 @@ static int smctr_rx_frame(struct net_dev
break;
}

+ sti();
return (err);
}

Index: fs/hpfs/dir.c
===================================================================
RCS file: /var/cvs/thunder-2.5/fs/hpfs/dir.c,v
retrieving revision 1.1.1.1
diff -p -u -r1.1.1.1 dir.c
--- fs/hpfs/dir.c 19 Jun 2002 02:11:50 -0000 1.1.1.1
+++ fs/hpfs/dir.c 11 Jul 2002 22:12:53 -0000
@@ -211,7 +211,9 @@ struct dentry *hpfs_lookup(struct inode

lock_kernel();
if ((err = hpfs_chk_name((char *)name, &len))) {
- if (err == -ENAMETOOLONG) return ERR_PTR(-ENAMETOOLONG);
+ if (err == -ENAMETOOLONG) {
+ return ERR_PTR(-ENAMETOOLONG);
+ }
goto end_add;
}

Index: sound/pci/rme9652/rme9652.c
===================================================================
RCS file: /var/cvs/thunder-2.5/sound/pci/rme9652/rme9652.c,v
retrieving revision 1.1.1.1
diff -p -u -r1.1.1.1 rme9652.c
--- sound/pci/rme9652/rme9652.c 20 Jun 2002 22:53:51 -0000 1.1.1.1
+++ sound/pci/rme9652/rme9652.c 11 Jul 2002 22:15:24 -0000
@@ -523,6 +523,7 @@ static int rme9652_set_rate(rme9652_t *r
rate = RME9652_DS | RME9652_freq;
break;
default:
+ spin_unlock_irq(&rme9652->lock);
return -EINVAL;
}

Index: drivers/message/i2o/i2o_core.c
===================================================================
RCS file: /var/cvs/thunder-2.5/drivers/message/i2o/i2o_core.c,v
retrieving revision 1.1.1.1
diff -p -u -r1.1.1.1 i2o_core.c
--- drivers/message/i2o/i2o_core.c 19 Jun 2002 02:11:56 -0000 1.1.1.1
+++ drivers/message/i2o/i2o_core.c 11 Jul 2002 22:22:10 -0000
@@ -726,6 +726,7 @@ int i2o_claim_device(struct i2o_device *
I2O_CLAIM_PRIMARY))
{
d->owner = NULL;
+ up(&i2o_configuration_lock);
return -EBUSY;
}
up(&i2o_configuration_lock);
Index: sound/pci/es1968.c
===================================================================
RCS file: /var/cvs/thunder-2.5/sound/pci/es1968.c,v
retrieving revision 1.1.1.1
diff -p -u -r1.1.1.1 es1968.c
--- sound/pci/es1968.c 20 Jun 2002 22:53:55 -0000 1.1.1.1
+++ sound/pci/es1968.c 11 Jul 2002 22:24:04 -0000
@@ -1446,8 +1446,10 @@ static esm_memory_t *snd_es1968_new_memo
__found:
if (buf->size > size) {
esm_memory_t *chunk = kmalloc(sizeof(*chunk), GFP_KERNEL);
- if (chunk == NULL)
+ if (chunk == NULL) {
+ up(&chip->memory_mutex);
return NULL;
+ }
chunk->size = buf->size - size;
chunk->buf = buf->buf + size;
chunk->addr = buf->addr + size;
Index: sound/oss/es1371.c
===================================================================
RCS file: /var/cvs/thunder-2.5/sound/oss/es1371.c,v
retrieving revision 1.1.1.1
diff -p -u -r1.1.1.1 es1371.c
--- sound/oss/es1371.c 19 Jun 2002 02:11:49 -0000 1.1.1.1
+++ sound/oss/es1371.c 11 Jul 2002 22:32:23 -0000
@@ -1345,7 +1345,7 @@ static ssize_t es1371_read(struct file *
return -EFAULT;
down(&s->sem);
if (!s->dma_adc.ready && (ret = prog_dmabuf_adc(s)))
- goto out2;
+ goto out;

add_wait_queue(&s->dma_adc.wait, &wait);
while (count > 0) {
@@ -1423,8 +1423,10 @@ static ssize_t es1371_write(struct file
if (!access_ok(VERIFY_READ, buffer, count))
return -EFAULT;
down(&s->sem);
- if (!s->dma_dac2.ready && (ret = prog_dmabuf_dac2(s)))
+ if (!s->dma_dac2.ready && (ret = prog_dmabuf_dac2(s))) {
+ up(&s->sem);
goto out3;
+ }
ret = 0;
add_wait_queue(&s->dma_dac2.wait, &wait);
while (count > 0) {
Index: net/irda/ircomm/ircomm_core.c
===================================================================
RCS file: /var/cvs/thunder-2.5/net/irda/ircomm/ircomm_core.c,v
retrieving revision 1.1.1.1
diff -p -u -r1.1.1.1 ircomm_core.c
--- net/irda/ircomm/ircomm_core.c 20 Jun 2002 22:53:41 -0000 1.1.1.1
+++ net/irda/ircomm/ircomm_core.c 11 Jul 2002 22:34:37 -0000
@@ -536,6 +536,7 @@ int ircomm_proc_read(char *buf, char **s
self = (struct ircomm_cb *) hashbin_get_next(ircomm);
}
restore_flags(flags);
+ sti();

return len;
}
Index: fs/affs/namei.c
===================================================================
RCS file: /var/cvs/thunder-2.5/fs/affs/namei.c,v
retrieving revision 1.1.1.1
diff -p -u -r1.1.1.1 namei.c
--- fs/affs/namei.c 19 Jun 2002 02:11:51 -0000 1.1.1.1
+++ fs/affs/namei.c 11 Jul 2002 22:36:41 -0000
@@ -345,10 +345,14 @@ affs_rmdir(struct inode *dir, struct den
lock_kernel();

/* WTF??? */
+ res = -ENOENT;
+
if (!dentry->d_inode)
- return -ENOENT;
+ goto out_unlock;

res = affs_remove_header(dentry);
+
+ out_unlock:
unlock_kernel();
return res;
}
Index: fs/intermezzo/file.c
===================================================================
RCS file: /var/cvs/thunder-2.5/fs/intermezzo/file.c,v
retrieving revision 1.2
diff -p -u -r1.2 file.c
--- fs/intermezzo/file.c 23 Jun 2002 01:17:59 -0000 1.2
+++ fs/intermezzo/file.c 11 Jul 2002 22:38:24 -0000
@@ -299,12 +299,13 @@ static void presto_apply_write_policy(st
if ( presto_get_permit(file->f_dentry->d_inode) < 0 ) {
EXIT;
/* we must be disconnected, not to worry */
- return;
+ unlock_kernel();
+ return;
}
error = presto_journal_close
(&rec, fset, file, file->f_dentry, &new_file_ver);
presto_put_permit(file->f_dentry->d_inode);
- unlock_kernel();
+ unlock_kernel();
if ( error ) {
printk("presto_close: cannot journal close\n");
/* XXX these errors are really bad */
Index: fs/intermezzo/vfs.c
===================================================================
RCS file: /var/cvs/thunder-2.5/fs/intermezzo/vfs.c,v
retrieving revision 1.2
diff -p -u -r1.2 vfs.c
--- fs/intermezzo/vfs.c 23 Jun 2002 01:18:00 -0000 1.2
+++ fs/intermezzo/vfs.c 11 Jul 2002 22:41:42 -0000
@@ -1948,6 +1948,7 @@ again: /* look the named file or a pare
error = presto_walk(tmp, &nd);
if ( error && error != -ENOENT ) {
EXIT;
+ unlock_kernel();
return error;
}
if (error == -ENOENT)
@@ -2049,6 +2050,7 @@ int lento_close(unsigned int fd, struct
error = filp_close(filp, files);
} else {
EXIT;
+ unlock_kernel();
return error;
}

Index: drivers/ieee1394/dv1394.c
===================================================================
RCS file: /var/cvs/thunder-2.5/drivers/ieee1394/dv1394.c,v
retrieving revision 1.2
diff -p -u -r1.2 dv1394.c
--- drivers/ieee1394/dv1394.c 22 Jun 2002 01:13:34 -0000 1.2
+++ drivers/ieee1394/dv1394.c 11 Jul 2002 22:46:09 -0000
@@ -2627,6 +2627,7 @@ dv1394_devfs_find( char *name)
}
}
}
+ spin_unlock(&dv1394_devfs_lock);
return NULL;
}

Index: sound/pci/ali5451/ali5451.c
===================================================================
RCS file: /var/cvs/thunder-2.5/sound/pci/ali5451/ali5451.c,v
retrieving revision 1.1.1.1
diff -p -u -r1.1.1.1 ali5451.c
--- sound/pci/ali5451/ali5451.c 19 Jun 2002 02:11:58 -0000 1.1.1.1
+++ sound/pci/ali5451/ali5451.c 11 Jul 2002 22:49:43 -0000
@@ -1440,8 +1440,10 @@ static int snd_ali_capture_prepare(snd_p

unsigned int rate;

- if (codec->revision != ALI_5451_V02)
+ if (codec->revision != ALI_5451_V02) {
+ spin_lock_irqsave(&codec->reg_lock, flags);
return -1;
+ }
rate = snd_ali_get_spdif_in_rate(codec);
if (rate == 0) {
snd_printk("ali_capture_preapre: spdif rate detect err!\n");
Index: drivers/media/video/cpia_pp.c
===================================================================
RCS file: /var/cvs/thunder-2.5/drivers/media/video/cpia_pp.c,v
retrieving revision 1.1.1.1
diff -p -u -r1.1.1.1 cpia_pp.c
--- drivers/media/video/cpia_pp.c 21 Jun 2002 02:28:37 -0000 1.1.1.1
+++ drivers/media/video/cpia_pp.c 11 Jul 2002 22:51:26 -0000
@@ -616,6 +616,7 @@ static void cpia_pp_detach (struct parpo
break;
}
}
+ spin_unlock( &cam_list_lock_pp );
}

static void cpia_pp_attach (struct parport *port)
Index: drivers/usb/media/usbvideo.c
===================================================================
RCS file: /var/cvs/thunder-2.5/drivers/usb/media/usbvideo.c,v
retrieving revision 1.1.1.1
diff -p -u -r1.1.1.1 usbvideo.c
--- drivers/usb/media/usbvideo.c 19 Jun 2002 02:11:55 -0000 1.1.1.1
+++ drivers/usb/media/usbvideo.c 11 Jul 2002 22:54:54 -0000
@@ -1096,6 +1096,7 @@ uvd_t *usbvideo_AllocateDevice(usbvideo_
if (uvd->sbuf[i].urb == NULL) {
err("usb_alloc_urb(%d.) failed.", FRAMES_PER_DESC);
uvd->uvd_used = 0;
+ up(&uvd->lock);
uvd = NULL;
goto allocate_done;
}
@@ -1112,8 +1113,8 @@ uvd_t *usbvideo_AllocateDevice(usbvideo_
* The client is free to overwrite those because we
* return control to the client's probe function right now.
*/
-allocate_done:
up (&uvd->lock);
+ allocate_done:
usbvideo_ClientDecModCount(uvd);
return uvd;
}
Index: drivers/i2c/i2c-core.c
===================================================================
RCS file: /var/cvs/thunder-2.5/drivers/i2c/i2c-core.c,v
retrieving revision 1.1.1.1
diff -p -u -r1.1.1.1 i2c-core.c
--- drivers/i2c/i2c-core.c 21 Jun 2002 22:17:01 -0000 1.1.1.1
+++ drivers/i2c/i2c-core.c 11 Jul 2002 23:01:13 -0000
@@ -231,6 +231,7 @@ int i2c_del_adapter(struct i2c_adapter *
printk(KERN_WARNING "i2c-core.o: can't detach adapter %s "
"while detaching driver %s: driver not "
"detached!",adap->name,drivers[j]->name);
+ ADAP_UNLOCK();
goto ERROR1;
}
DRV_UNLOCK();
@@ -364,6 +365,7 @@ int i2c_del_driver(struct i2c_driver *dr
"not unloaded!",driver->name,
adap->name);
ADAP_UNLOCK();
+ DRV_UNLOCK();
return res;
}
} else {
@@ -388,6 +390,7 @@ int i2c_del_driver(struct i2c_driver *dr
client->addr,
adap->name);
ADAP_UNLOCK();
+ DRV_UNLOCK();
return res;
}
}
Index: drivers/net/irda/ali-ircc.c
===================================================================
RCS file: /var/cvs/thunder-2.5/drivers/net/irda/ali-ircc.c,v
retrieving revision 1.1.1.1
diff -p -u -r1.1.1.1 ali-ircc.c
--- drivers/net/irda/ali-ircc.c 20 Jun 2002 22:53:50 -0000 1.1.1.1
+++ drivers/net/irda/ali-ircc.c 11 Jul 2002 23:03:07 -0000
@@ -2027,11 +2027,11 @@ static int ali_ircc_net_ioctl(struct net
ASSERT(self != NULL, return -1;);

IRDA_DEBUG(2, __FUNCTION__ "(), %s, (cmd=0x%X)\n", dev->name, cmd);
-
+
/* Disable interrupts & save flags */
save_flags(flags);
- cli();
-
+ cli();
+
switch (cmd) {
case SIOCSBANDWIDTH: /* Set bandwidth */
IRDA_DEBUG(1, __FUNCTION__ "(), SIOCSBANDWIDTH\n");
@@ -2040,8 +2040,10 @@ static int ali_ircc_net_ioctl(struct net
* speed, so we still must allow for speed change within
* interrupt context.
*/
- if (!in_interrupt() && !capable(CAP_NET_ADMIN))
+ if (!in_interrupt() && !capable(CAP_NET_ADMIN)) {
+ sti();
return -EPERM;
+ }

ali_ircc_change_speed(self, irq->ifr_baudrate);
break;
Index: drivers/char/rio/riointr.c
===================================================================
RCS file: /var/cvs/thunder-2.5/drivers/char/rio/riointr.c,v
retrieving revision 1.1.1.1
diff -p -u -r1.1.1.1 riointr.c
--- drivers/char/rio/riointr.c 19 Jun 2002 02:11:44 -0000 1.1.1.1
+++ drivers/char/rio/riointr.c 11 Jul 2002 23:04:53 -0000
@@ -155,8 +155,8 @@ struct rio_info * p;
RIOServiceHost(p, HostP, 'p' );
rio_spin_lock( &HostP->HostLock);
HostP->InIntr = 0;
- rio_spin_unlock (&HostP->HostLock);
}
+ rio_spin_unlock (&HostP->HostLock);
}
rio_spin_unlock (&p->RIOIntrSem);
}
Index: drivers/usb/media/pwc-if.c
===================================================================
RCS file: /var/cvs/thunder-2.5/drivers/usb/media/pwc-if.c,v
retrieving revision 1.1.1.1
diff -p -u -r1.1.1.1 pwc-if.c
--- drivers/usb/media/pwc-if.c 19 Jun 2002 02:11:57 -0000 1.1.1.1
+++ drivers/usb/media/pwc-if.c 11 Jul 2002 23:07:01 -0000
@@ -1756,19 +1756,23 @@ static void usb_pwc_disconnect(struct us
pdev = (struct pwc_device *)ptr;
if (pdev == NULL) {
Err("pwc_disconnect() Called without private pointer.\n");
+ unlock_kernel();
return;
}
if (pdev->udev == NULL) {
Err("pwc_disconnect() already called for %p\n", pdev);
+ unlock_kernel();
return;
}
if (pdev->udev != udev) {
Err("pwc_disconnect() Woops: pointer mismatch udev/pdev.\n");
+ unlock_kernel();
return;
}
#ifdef PWC_MAGIC
if (pdev->magic != PWC_MAGIC) {
Err("pwc_disconnect() Magic number failed. Consult your scrolls and try again.\n");
+ unlock_kernel();
return;
}
#endif
Regards,
Thunder
--
(Use http://www.ebb.org/ungeek if you can't decode)
------BEGIN GEEK CODE BLOCK------
Version: 3.12
GCS/E/G/S/AT d- s++:-- a? C++$ ULAVHI++++$ P++$ L++++(+++++)$ E W-$
N--- o? K? w-- O- M V$ PS+ PE- Y- PGP+ t+ 5+ X+ R- !tv b++ DI? !D G
e++++ h* r--- y-
------END GEEK CODE BLOCK------

2002-07-11 23:23:23

by Dawson Engler

[permalink] [raw]
Subject: Re: [CHECKER] 56 potential lock/unlock bugs in 2.5.8

> > From: Dawson Engler [mailto:[email protected]]
> > ---------------------------------------------------------
> > [BUG] all other case arms call __sti(); however, it may be
> > that safe_halt
> > does something weird.
> > /u2/engler/mc/oses/linux/2.5.8/drivers/acpi/acpi_processor.c:5
>
> #define safe_halt() __asm__ __volatile__("sti; hlt": : :"memory")
>
> I think we're OK for now. I doubt safe_halt will change, but if it does I'll
> fix this issue.

ah. missed the sti. thanks!

2002-07-11 23:32:10

by Andreas Dilger

[permalink] [raw]
Subject: Re: [CHECKER] 56 potential lock/unlock bugs in 2.5.8

On Jul 11, 2002 17:14 -0600, Thunder from the hill wrote:
> --- fs/hpfs/dir.c 19 Jun 2002 02:11:50 -0000 1.1.1.1
> +++ fs/hpfs/dir.c 11 Jul 2002 22:12:53 -0000
> @@ -211,7 +211,9 @@ struct dentry *hpfs_lookup(struct inode
>
> lock_kernel();
> if ((err = hpfs_chk_name((char *)name, &len))) {
> - if (err == -ENAMETOOLONG) return ERR_PTR(-ENAMETOOLONG);
> + if (err == -ENAMETOOLONG) {
> + return ERR_PTR(-ENAMETOOLONG);
> + }
> goto end_add;
> }

So, how does adding braces and a linefeed fix the locking problem here?
;-)

Cheers, Andreas
--
Andreas Dilger
http://www-mddsp.enel.ucalgary.ca/People/adilger/
http://sourceforge.net/projects/ext2resize/

2002-07-11 23:39:39

by Chris Wright

[permalink] [raw]
Subject: Re: [CHECKER] 56 potential lock/unlock bugs in 2.5.8

* Thunder from the hill ([email protected]) wrote:
>
> Index: fs/hpfs/dir.c
> ===================================================================
> RCS file: /var/cvs/thunder-2.5/fs/hpfs/dir.c,v
> retrieving revision 1.1.1.1
> diff -p -u -r1.1.1.1 dir.c
> --- fs/hpfs/dir.c 19 Jun 2002 02:11:50 -0000 1.1.1.1
> +++ fs/hpfs/dir.c 11 Jul 2002 22:12:53 -0000
> @@ -211,7 +211,9 @@ struct dentry *hpfs_lookup(struct inode
>
> lock_kernel();
> if ((err = hpfs_chk_name((char *)name, &len))) {
> - if (err == -ENAMETOOLONG) return ERR_PTR(-ENAMETOOLONG);
> + if (err == -ENAMETOOLONG) {
> + return ERR_PTR(-ENAMETOOLONG);
> + }
> goto end_add;
> }

This does not fix the problem.
-chris
--
Linux Security Modules http://lsm.immunix.org http://lsm.bkbits.net

2002-07-11 23:43:05

by Thunder from the hill

[permalink] [raw]
Subject: Re: [CHECKER] 56 potential lock/unlock bugs in 2.5.8

Hi,

On Thu, 11 Jul 2002, Andreas Dilger wrote:
> So, how does adding braces and a linefeed fix the locking problem here?
> ;-)

I did add the contents, they were just not added physically. I have them
somewhere in my mind...

Index: fs/hpfs/dir.c
===================================================================
RCS file: /var/cvs/thunder-2.5/fs/hpfs/dir.c,v
retrieving revision 1.1
diff -p -u -r1.1 dir.c
--- fs/hpfs/dir.c 19 Jun 2002 02:11:50 -0000 1.1
+++ fs/hpfs/dir.c 11 Jul 2002 23:44:58 -0000 mind
@@ -211,7 +211,10 @@ struct dentry *hpfs_lookup(struct inode

lock_kernel();
if ((err = hpfs_chk_name((char *)name, &len))) {
- if (err == -ENAMETOOLONG) return ERR_PTR(-ENAMETOOLONG);
+ if (err == -ENAMETOOLONG) {
+ unlock_kernel();
+ return ERR_PTR(-ENAMETOOLONG);
+ }
goto end_add;
}

Regards,
Thunder
--
(Use http://www.ebb.org/ungeek if you can't decode)
------BEGIN GEEK CODE BLOCK------
Version: 3.12
GCS/E/G/S/AT d- s++:-- a? C++$ ULAVHI++++$ P++$ L++++(+++++)$ E W-$
N--- o? K? w-- O- M V$ PS+ PE- Y- PGP+ t+ 5+ X+ R- !tv b++ DI? !D G
e++++ h* r--- y-
------END GEEK CODE BLOCK------


2002-07-12 00:21:10

by Andrew Morton

[permalink] [raw]
Subject: Re: [CHECKER] 56 potential lock/unlock bugs in 2.5.8

Thunder from the hill wrote:
>
> Hi,
>
> Here is the whole set.
>

It's fair enough for a fix I guess. But careful readers will
have observed that a goodly portion of these bugs are directly
due to the poor programming practice of putting more than one
return statement in a C function.

-

2002-07-12 01:41:59

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: Re: [CHECKER] 56 potential lock/unlock bugs in 2.5.8

Em Thu, Jul 11, 2002 at 05:21:50PM -0700, Andrew Morton escreveu:
> Thunder from the hill wrote:
> > Here is the whole set.

> It's fair enough for a fix I guess. But careful readers will
> have observed that a goodly portion of these bugs are directly
> due to the poor programming practice of putting more than one
> return statement in a C function.

woohooo!

"gotos considered !harmful"

8)

<asbestos suit>
- Arnaldo (that will continue putting more gotos in the kernel (hopefully)
where they make sense, _clarifying_ the code and making it
more maintainable 8) )
</asbestos suit>

2002-07-12 13:15:15

by David Woodhouse

[permalink] [raw]
Subject: Re: [CHECKER] 56 potential lock/unlock bugs in 2.5.8


[email protected] said:
> /u2/engler/mc/oses/linux/2.5.8/drivers/mtd/chips/cfi_cmdset_0001.c:782:
> do_write_buffer: ERROR:A_B:700:782:Did not reverse 'spin_lock'
> [COUNTER=spin_lock:700] [fit=3] [fit_fn=1] [fn_ex=5] [fn_counter=1]
> [ex=5619] [counter=272] [z = 1.34804760770983] [fn-z =
> -1.31122013621437]

That one can't ever actually happen -- it's effectively a default case in a
switch statement which can't ever be reached because we'd never get that far
unless one of the real cases is going to be taken. I think I'll replace the
return statement with panic("The world is broken");


--
dwmw2


2002-07-12 13:24:18

by Thunder from the hill

[permalink] [raw]
Subject: Re: [CHECKER] 56 potential lock/unlock bugs in 2.5.8

Hi,

On Fri, 12 Jul 2002, David Woodhouse wrote:
> That one can't ever actually happen -- it's effectively a default case in a
> switch statement which can't ever be reached because we'd never get that far
> unless one of the real cases is going to be taken. I think I'll replace the
> return statement with panic("The world is broken");

But don't forget to unlock_kernel() before ;-)

Regards,
Thunder
--
(Use http://www.ebb.org/ungeek if you can't decode)
------BEGIN GEEK CODE BLOCK------
Version: 3.12
GCS/E/G/S/AT d- s++:-- a? C++$ ULAVHI++++$ P++$ L++++(+++++)$ E W-$
N--- o? K? w-- O- M V$ PS+ PE- Y- PGP+ t+ 5+ X+ R- !tv b++ DI? !D G
e++++ h* r--- y-
------END GEEK CODE BLOCK------

2002-07-12 17:38:02

by Roman Zippel

[permalink] [raw]
Subject: Re: [CHECKER] 56 potential lock/unlock bugs in 2.5.8

Hi,

On Thu, 11 Jul 2002, Thunder from the hill wrote:

> --- fs/affs/namei.c 19 Jun 2002 02:11:51 -0000 1.1.1.1
> +++ fs/affs/namei.c 11 Jul 2002 22:36:41 -0000
> @@ -345,10 +345,14 @@ affs_rmdir(struct inode *dir, struct den
> lock_kernel();
>
> /* WTF??? */
> + res = -ENOENT;
> +
> if (!dentry->d_inode)
> - return -ENOENT;
> + goto out_unlock;
>
> res = affs_remove_header(dentry);
> +
> + out_unlock:
> unlock_kernel();
> return res;
> }

Please drop this patch, it's impossible to hit this problem and I have a
better patch for this.

bye, Roman

2002-07-12 17:51:59

by Thunder from the hill

[permalink] [raw]
Subject: Re: [CHECKER] 56 potential lock/unlock bugs in 2.5.8

Hi,

On Fri, 12 Jul 2002, Roman Zippel wrote:
> Please drop this patch, it's impossible to hit this problem and I have a
> better patch for this.

You mean

static inline int affs_rmdir(struct inode *dir, struct dentry *dentry)
{
int res;
lock_kernel();
res = affs_remove_header(dentry);
unlock_kernel();
return res;
}

Regards,
Thunder
--
(Use http://www.ebb.org/ungeek if you can't decode)
------BEGIN GEEK CODE BLOCK------
Version: 3.12
GCS/E/G/S/AT d- s++:-- a? C++$ ULAVHI++++$ P++$ L++++(+++++)$ E W-$
N--- o? K? w-- O- M V$ PS+ PE- Y- PGP+ t+ 5+ X+ R- !tv b++ DI? !D G
e++++ h* r--- y-
------END GEEK CODE BLOCK------

2002-07-12 18:02:20

by Dave Jones

[permalink] [raw]
Subject: Re: [CHECKER] 56 potential lock/unlock bugs in 2.5.8

On Fri, Jul 12, 2002 at 07:40:35PM +0200, Roman Zippel wrote:

> Please drop this patch, it's impossible to hit this problem and I have a
> better patch for this.

(whilst on the subject of affs, and whilst I remember..)
btw, affs has been failing fsx runs again for the last few kernels.
truncating to largest ever: 0x13e76
domapwrite: mmap: Invalid argument
LOG DUMP (4 total operations):
1(1 mod 256): TRUNCATE UP from 0x0 to 0x13e76
2(2 mod 256): WRITE 0x17098 thru 0x26857 (0xf7c0 bytes) HOLE
3(3 mod 256): READ 0xc73e thru 0x1b801 (0xf0c4 bytes)
4(4 mod 256): MAPWRITE 0x32e00 thru 0x331fc (0x3fd bytes)
fsx: save_buffer: short write, 0x30ba8 bytes instead of 0x331fd

This is on an affs image mounted over loopback.
Before/After copies of the image available on request..

Dave

--
| Dave Jones. http://www.codemonkey.org.uk
| SuSE Labs

2002-07-12 18:29:41

by Roman Zippel

[permalink] [raw]
Subject: Re: [CHECKER] 56 potential lock/unlock bugs in 2.5.8

Hi,

On Fri, 12 Jul 2002, Dave Jones wrote:

> (whilst on the subject of affs, and whilst I remember..)
> btw, affs has been failing fsx runs again for the last few kernels.
> truncating to largest ever: 0x13e76
> domapwrite: mmap: Invalid argument
> LOG DUMP (4 total operations):
> 1(1 mod 256): TRUNCATE UP from 0x0 to 0x13e76
> 2(2 mod 256): WRITE 0x17098 thru 0x26857 (0xf7c0 bytes) HOLE
> 3(3 mod 256): READ 0xc73e thru 0x1b801 (0xf0c4 bytes)
> 4(4 mod 256): MAPWRITE 0x32e00 thru 0x331fc (0x3fd bytes)
> fsx: save_buffer: short write, 0x30ba8 bytes instead of 0x331fd

Which last few kernels? Was it a ffs or an ofs image? For ofs images you
have to call fsx with "-W -R" to disable mmap operations.

bye, Roman

2002-07-12 18:34:52

by Dave Jones

[permalink] [raw]
Subject: Re: [CHECKER] 56 potential lock/unlock bugs in 2.5.8

On Fri, Jul 12, 2002 at 08:32:20PM +0200, Roman Zippel wrote:
> Which last few kernels? Was it a ffs or an ofs image? For ofs images you
> have to call fsx with "-W -R" to disable mmap operations.

OFS afaik. Has this always been the case ? I'm sure I ran fsx without
disabling mmap before on this image, and it used to pass.

Second bad news, with the -W -R options, it goes splat in an
even more dramatic way.

Dave.


Unable to handle kernel NULL pointer dereference at virtual address 00000008
c01f91a7
*pde = 00000000
Oops: 0000
CPU: 0
EIP: 0010:[<c01f91a7>] Not tainted
Using defaults from ksymoops -t elf32-i386 -a i386
EFLAGS: 00010296
eax: c01f9198 ebx: 000006a0 ecx: cff6bea8 edx: 00000000
esi: c133acc0 edi: cd352524 ebp: cefb6c00 esp: cd0efe9c
ds: 0018 es: 0018 ss: 0018
Process fsx (pid: 908, stackpage=cd0ef000)
Stack: 000006a0 c133acc0 cd352524 cefb6c00 cd352524 c01f9a26 00000000 c133acc0 000006a0 000006a0 000186a0 00000000 cd352474 00000000 00000000 cd352474 00000000 000000cc c0123f01 00000002 c0123f60 cd352474 00000048 cd0eff74 Call Trace: [<c01f9a26>] [<c0123f01>] [<c0123f60>] [<c0144eab>] [<c01f7bdf>]
[<c0144fe0>] [<c0131669>] [<c0131907>] [<c0106b73>]
Code: 8b 42 08 31 d2 8b 48 08 8b 74 24 1c 8b 46 18 a9 08 00 00 00


>>EIP; c01f91a7 <affs_prepare_write_ofs+f/fc> <=====

>>eax; c01f9198 <affs_prepare_write_ofs+0/fc>
>>ebx; 000006a0 Before first symbol
>>ecx; cff6bea8 <END_OF_CODE+fabb96c/????>
>>esi; c133acc0 <END_OF_CODE+e8a784/????>
>>edi; cd352524 <END_OF_CODE+cea1fe8/????>
>>ebp; cefb6c00 <END_OF_CODE+eb066c4/????>
>>esp; cd0efe9c <END_OF_CODE+cc3f960/????>

Trace; c01f9a26 <affs_truncate+a6/375>
Trace; c0123f01 <vmtruncate+9d/124>
Trace; c0123f60 <vmtruncate+fc/124>
Trace; c0144eab <inode_setattr+23/b0>
Trace; c01f7bdf <affs_notify_change+77/94>
Trace; c0144fe0 <notify_change+5c/dc>
Trace; c0131669 <do_truncate+4d/64>
Trace; c0131907 <sys_ftruncate+107/11c>
Trace; c0106b73 <system_call+33/40>

Code; c01f91a7 <affs_prepare_write_ofs+f/fc>
00000000 <_EIP>:
Code; c01f91a7 <affs_prepare_write_ofs+f/fc> <=====
0: 8b 42 08 mov 0x8(%edx),%eax <=====
Code; c01f91aa <affs_prepare_write_ofs+12/fc>
3: 31 d2 xor %edx,%edx
Code; c01f91ac <affs_prepare_write_ofs+14/fc>
5: 8b 48 08 mov 0x8(%eax),%ecx
Code; c01f91af <affs_prepare_write_ofs+17/fc>
8: 8b 74 24 1c mov 0x1c(%esp,1),%esi
Code; c01f91b3 <affs_prepare_write_ofs+1b/fc>
c: 8b 46 18 mov 0x18(%esi),%eax
Code; c01f91b6 <affs_prepare_write_ofs+1e/fc>
f: a9 08 00 00 00 test $0x8,%eax



--
| Dave Jones. http://www.codemonkey.org.uk
| SuSE Labs

2002-07-12 18:34:41

by Roman Zippel

[permalink] [raw]
Subject: Re: [CHECKER] 56 potential lock/unlock bugs in 2.5.8

Hi,

On Fri, 12 Jul 2002, Thunder from the hill wrote:

> You mean
>
> static inline int affs_rmdir(struct inode *dir, struct dentry *dentry)
> {
> int res;
> lock_kernel();
> res = affs_remove_header(dentry);
> unlock_kernel();
> return res;
> }

lock_kernel isn't required here. Yesterday I went through affs and removed
the BKL completely.

bye, Roman

2002-07-12 20:31:44

by Roman Zippel

[permalink] [raw]
Subject: Re: [CHECKER] 56 potential lock/unlock bugs in 2.5.8

Hi,

On Fri, 12 Jul 2002, Dave Jones wrote:

> > Which last few kernels? Was it a ffs or an ofs image? For ofs images you
> > have to call fsx with "-W -R" to disable mmap operations.
>
> OFS afaik. Has this always been the case ? I'm sure I ran fsx without
> disabling mmap before on this image, and it used to pass.

ofs never supported mmap.

> Second bad news, with the -W -R options, it goes splat in an
> even more dramatic way.

Which kernel version? It looks like a bug which already has been fixed
quite some time ago.

bye, Roman

2002-07-12 20:45:34

by Dave Jones

[permalink] [raw]
Subject: Re: [CHECKER] 56 potential lock/unlock bugs in 2.5.8

On Fri, Jul 12, 2002 at 10:34:29PM +0200, Roman Zippel wrote:

> > OFS afaik. Has this always been the case ? I'm sure I ran fsx without
> > disabling mmap before on this image, and it used to pass.
> ofs never supported mmap.

Interesting. My old testing must have been with an ffs image I guess.

> > Second bad news, with the -W -R options, it goes splat in an
> > even more dramatic way.
> Which kernel version? It looks like a bug which already has been fixed
> quite some time ago.

2.5.25-dj1. I expect the same problem to exist in mainline if its
AFFS specific, as I currently have no patches in that area.

Unfortunatly I've not time right now to test mainline, as I've
more important things to do before I catch a flight. If it's
still happening when I get back in a week or so, I'll try again.

Dave

--
| Dave Jones. http://www.codemonkey.org.uk
| SuSE Labs

2002-07-12 21:27:21

by Roman Zippel

[permalink] [raw]
Subject: Re: [CHECKER] 56 potential lock/unlock bugs in 2.5.8

Hi,

On Fri, 12 Jul 2002, Dave Jones wrote:

> > Which kernel version? It looks like a bug which already has been fixed
> > quite some time ago.
>
> 2.5.25-dj1. I expect the same problem to exist in mainline if its
> AFFS specific, as I currently have no patches in that area.

I'm just testing it with 2.4.18 under uml and it runs happily. The 2.4 and
2.5 are basically identical, so it's really strange. What I can see from
the disassembly it must be an old affs version.

bye, Roman

2002-07-12 21:36:01

by Dave Jones

[permalink] [raw]
Subject: Re: [CHECKER] 56 potential lock/unlock bugs in 2.5.8

On Fri, Jul 12, 2002 at 11:30:06PM +0200, Roman Zippel wrote:

> I'm just testing it with 2.4.18 under uml and it runs happily. The 2.4 and
> 2.5 are basically identical, so it's really strange. What I can see from
> the disassembly it must be an old affs version.

You mean the disk image is an old version ?
There's a gzip'd copy at http://www.codemonkey.org.uk/cruft/EMPTY-AFFS.ADF.gz
if you're curious..

if 2.4/2.5 AFFS is in sync as you say (which iirc it is), then
I fail to see how you think the 2.5.25 disassembly is an old version.

Dave.

--
| Dave Jones. http://www.codemonkey.org.uk
| SuSE Labs

2002-07-12 21:53:22

by Roman Zippel

[permalink] [raw]
Subject: Re: [CHECKER] 56 potential lock/unlock bugs in 2.5.8

Hi,

On Fri, 12 Jul 2002, Dave Jones wrote:

> if 2.4/2.5 AFFS is in sync as you say (which iirc it is), then
> I fail to see how you think the 2.5.25 disassembly is an old version.

The last disassembled instruction is the PageUptodate() test, which was
moved in later versions and can't be that early in the function for a
recent version, but the disassembly is exactly what I would expect from
an old affs version.

bye, Roman

2002-07-12 22:12:11

by Dave Jones

[permalink] [raw]
Subject: Re: [CHECKER] 56 potential lock/unlock bugs in 2.5.8

On Fri, Jul 12, 2002 at 11:56:07PM +0200, Roman Zippel wrote:

> > if 2.4/2.5 AFFS is in sync as you say (which iirc it is), then
> > I fail to see how you think the 2.5.25 disassembly is an old version.
> The last disassembled instruction is the PageUptodate() test, which was
> moved in later versions and can't be that early in the function for a
> recent version, but the disassembly is exactly what I would expect from
> an old affs version.

Hmm, interesting. Time to test the possibility of a ccache bug I think.
How old exactly out of curiosity ?

Dave

--
| Dave Jones. http://www.codemonkey.org.uk
| SuSE Labs

2002-07-12 22:31:55

by Roman Zippel

[permalink] [raw]
Subject: Re: [CHECKER] 56 potential lock/unlock bugs in 2.5.8

Hi,

On Sat, 13 Jul 2002, Dave Jones wrote:

> Hmm, interesting. Time to test the possibility of a ccache bug I think.
> How old exactly out of curiosity ?

Since 2.5.15 (about two months ago).

bye, Roman

2002-07-12 22:39:01

by Dave Jones

[permalink] [raw]
Subject: Re: [CHECKER] 56 potential lock/unlock bugs in 2.5.8

On Sat, Jul 13, 2002 at 12:34:40AM +0200, Roman Zippel wrote:
> > How old exactly out of curiosity ?
> Since 2.5.15 (about two months ago).

Ha, the testbox rebooted at some point back to 2.4.18 without
me noticing.. Don't I feel a dork..

2.5.25 with fsx -W -R seems to survive. Apologies for the
the false alarm.

Dave.

--
| Dave Jones. http://www.codemonkey.org.uk
| SuSE Labs