mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shuah Khan <skhan@linuxfoundation.org>
To: sudipm.mukherjee@gmail.com
Cc: Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org,
	Shuah Khan <skhan@linuxfoundation.org>
Subject: drivers/char/ppdev -
Date: Fri, 2 Oct 2020 15:01:33 -0600	[thread overview]
Message-ID: <110bee96-0c4b-21dd-9298-932970657801@linuxfoundation.org> (raw)

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

                 reply	other threads:[~2020-10-02 21:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=110bee96-0c4b-21dd-9298-932970657801@linuxfoundation.org \
    --to=skhan@linuxfoundation.org \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sudipm.mukherjee@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®