[<prev] [next>] [day] [month] [year] [list]
Message-ID: <110bee96-0c4b-21dd-9298-932970657801@linuxfoundation.org>
Date: Fri, 2 Oct 2020 15:01:33 -0600
From: Shuah Khan <skhan@...uxfoundation.org>
To: sudipm.mukherjee@...il.com
Cc: Arnd Bergmann <arnd@...db.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-kernel@...r.kernel.org,
Shuah Khan <skhan@...uxfoundation.org>
Subject: drivers/char/ppdev -
Hi Sudip,
While looking at atomic_t usages and noticed a few potential
problem the way struct pp_struct: atomic_t irqc field
- There is inconsistencies the lock hold in this driver.
pp_do_mutex is help before pp_do_ioctl() is called.
static int pp_do_ioctl()
....
pp_do_mutex
case PPCLRIRQ:
ret = atomic_read(&pp->irqc);
if (copy_to_user(argp, &ret, sizeof(ret)))
return -EFAULT;
atomic_sub(ret, &pp->irqc);
return 0;
This path seems safe as far as atomic_t overflow is concerned.
However, pp_poll(), pp_irq(), and pp_open() etc. don't hold
lock while pp_do_ioctl() path does.
Something to look into to see if this is safe. I see this
comment for pp_poll() /* No kernel lock held - fine */
Anyway, please take a look and see if this is indeed a problem.
thanks,
-- Shuah
Powered by blists - more mailing lists