lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <42c270ca.4dcb6.185255cb762.Coremail.duoming@zju.edu.cn>
Date:   Sun, 18 Dec 2022 21:11:51 +0800 (GMT+08:00)
From:   duoming@....edu.cn
To:     "Greg KH" <gregkh@...uxfoundation.org>
Cc:     linux-kernel@...r.kernel.org, laforge@...monks.org, arnd@...db.de,
        linux@...inikbrodowski.net, baijiaju1990@...il.com
Subject: Re: [PATCH] Revert "char: pcmcia: cm4000_cs: Replace mdelay with
 usleep_range in set_protocol"

Hello,

On Sun, 18 Dec 2022 12:43:27 +0100 Greg KH wrote:

> On Mon, Nov 28, 2022 at 01:39:15PM +0800, Duoming Zhou wrote:
> > This reverts commit be826ada52f1fcabed5b5217c94609ebf5967211.
> > 
> > The function monitor_card() is a timer handler that runs in an
> > atomic context, but it calls usleep_range() that can sleep.
> > As a result, the sleep-in-atomic-context bugs will happen.
> > The process is shown below:
> > 
> >     (atomic context)
> > monitor_card()
> >   set_protocol()
> >     usleep_range() //sleep
> > 
> > The origin commit c1986ee9bea3 ("[PATCH] New Omnikey Cardman
> > 4000 driver") works fine.
> > 
> > Fixes: be826ada52f1 ("char: pcmcia: cm4000_cs: Replace mdelay with usleep_range in set_protocol")
> > Signed-off-by: Duoming Zhou <duoming@....edu.cn>
> > ---
> >  drivers/char/pcmcia/cm4000_cs.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c
> > index adaec8fd4b1..7125f89531f 100644
> > --- a/drivers/char/pcmcia/cm4000_cs.c
> > +++ b/drivers/char/pcmcia/cm4000_cs.c
> > @@ -529,7 +529,7 @@ static int set_protocol(struct cm4000_dev *dev, struct ptsreq *ptsreq)
> >  			DEBUGP(5, dev, "NumRecBytes is valid\n");
> >  			break;
> >  		}
> > -		usleep_range(10000, 11000);
> > +		mdelay(10);
> >  	}
> >  	if (i == 100) {
> >  		DEBUGP(5, dev, "Timeout waiting for NumRecBytes getting "
> > @@ -549,7 +549,7 @@ static int set_protocol(struct cm4000_dev *dev, struct ptsreq *ptsreq)
> >  			}
> >  			break;
> >  		}
> > -		usleep_range(10000, 11000);
> > +		mdelay(10);
> 
> Can you add a comment that says "can not sleep as this is atomic
> context" for these calls so that this doesn't get changed again in the
> future?

Thank you for your reply and suggestions! I will add the comment and re-send this patch.

Best regards,
Duoming Zhou

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ