2000-10-31 18:49:55

by George Anzinger

[permalink] [raw]
Subject: Locking question, is this cool?

At line 1073 of ../drivers/char/i2lib.c (2.4.0-test9) we find:

WRITE_LOCK_IRQSAVE(...

this is followed by:

COPY_FROM_USER(...

It seems to me that this could result in a page fault with interrupts
off. Is this ok?

George


2000-10-31 19:01:09

by Alan

[permalink] [raw]
Subject: Re: Locking question, is this cool?

> At line 1073 of ../drivers/char/i2lib.c (2.4.0-test9) we find:
>
> WRITE_LOCK_IRQSAVE(...
>
> this is followed by:
>
> COPY_FROM_USER(...
>
> It seems to me that this could result in a page fault with interrupts
> off. Is this ok?

It wont do what you want - it'll re-enable irqs and may then deadlock. It might
need to copy the buffer to a temporary space then take the lock >

2000-10-31 19:41:27

by George Anzinger

[permalink] [raw]
Subject: Re: Locking question, is this cool?

Alan Cox wrote:
>
> > At line 1073 of ../drivers/char/i2lib.c (2.4.0-test9) we find:
> >
> > WRITE_LOCK_IRQSAVE(...
> >
> > this is followed by:
> >
> > COPY_FROM_USER(...
> >
> > It seems to me that this could result in a page fault with interrupts
> > off. Is this ok?
>
> It wont do what you want - it'll re-enable irqs and may then deadlock. It might
> need to copy the buffer to a temporary space then take the lock >
> -
I suspected as much. I see the same error (bug?) at line 978 of
../drivers/char/riotty.c

Seems like a common problem.

george