]> git.karo-electronics.de Git - karo-tx-linux.git/commit
Staging: comedi: fix mmap_count
authorFederico Vaga <federico.vaga@gmail.com>
Sat, 29 Oct 2011 07:45:39 +0000 (09:45 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 9 Dec 2011 16:52:40 +0000 (08:52 -0800)
commit261dbf437bce1d339c358e6566925905e49c13fe
tree0550c193a8ad97b70d58d6a87f953033fe3a7ab7
parent9649803f2de0d2e77bdd7c5e1cbd4a7b3833f1e8
Staging: comedi: fix mmap_count

commit df30b21cb0eed5ba8a8e0cdfeebc66ba8cde821d upstream.

In comedi_fops, mmap_count is decremented at comedi_vm_ops->close but
it is not incremented at comedi_vm_ops->open. This may result in a negative
counter.  The patch introduces the open method to keep the counter
consistent.

The bug was triggerd by this sample code:

        mmap(0, ...., comedi_fd);
        fork();
        exit(0);

Acked-by: Alessandro Rubini <rubini@gnudd.com>
Signed-off-by: Federico Vaga <federico.vaga@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/comedi/comedi_fops.c