12 Feb, 2018
1 commit
-
This is the mindless scripted replacement of kernel use of POLL*
variables as described by Al, done by this script:for V in IN OUT PRI ERR RDNORM RDBAND WRNORM WRBAND HUP RDHUP NVAL MSG; do
L=`git grep -l -w POLL$V | grep -v '^t' | grep -v /um/ | grep -v '^sa' | grep -v '/poll.h$'|grep -v '^D'`
for f in $L; do sed -i "-es/^\([^\"]*\)\(\\)/\\1E\\2/" $f; done
donewith de-mangling cleanups yet to come.
NOTE! On almost all architectures, the EPOLL* constants have the same
values as the POLL* constants do. But they keyword here is "almost".
For various bad reasons they aren't the same, and epoll() doesn't
actually work quite correctly in some cases due to this on Sparc et al.The next patch from Al will sort out the final differences, and we
should be all done.Scripted-by: Al Viro
Signed-off-by: Linus Torvalds
29 Nov, 2017
1 commit
-
Signed-off-by: Al Viro
17 Jul, 2017
1 commit
-
This macro is not used after commit 3b9ab374a1e6
("ppdev: convert to y2038 safe"), so let's remove
it.Signed-off-by: Guoqing Jiang
Signed-off-by: Greg Kroah-Hartman
16 Mar, 2017
1 commit
-
Usually every parallel port will have a single pardev registered with
it. But ppdev driver is an exception. This userspace parallel port
driver allows to create multiple parrallel port devices for a single
parallel port. And as a result we were having a big warning like:
"sysfs: cannot create duplicate filename '/devices/parport0/ppdev0.0'".
And with that many parallel port printers stopped working.We have been using the minor number as the id field while registering
a parralel port device with a parralel port. But when there are
multiple parrallel port device for one single parallel port, they all
tried to register with the same name like 'pardev0.0' and everything
started failing.
Use an incremented index as the id instead of the minor number.Fixes: 8b7d3a9d903e ("ppdev: use new parport device model")
Cc: stable # v4.9+
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1414656
Bugzilla: https://bugs.archlinux.org/task/52322
Tested-by: James Feeney
Signed-off-by: Sudip Mukherjee
Signed-off-by: Greg Kroah-Hartman
02 Mar, 2017
1 commit
-
…hed.h> into <linux/sched/signal.h>
Fix up affected files that include this signal functionality via sched.h.
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
11 Jan, 2017
1 commit
-
A previous fix of a memory leak now prints the string 'name'
that was previously free'd. Fix this by free'ing the string
at the end of the function and adding an error exit path for
the error conditions.CoverityScan CID#1384523 ("Use after free")
Fixes: 2bd362d5f45c1 ("ppdev: fix memory leak")
Signed-off-by: Colin Ian King
Acked-by: Sudip Mukherjee
Signed-off-by: Greg Kroah-Hartman
30 Nov, 2016
3 commits
-
After parport starts using the device model, all pardevice drivers
should decide in their match_port callback function if they want to
attach with that particulatr port. ppdev has been converted to use the
new parport device-model code but pp_attach() tried to attach with all
the ports.
Create a new array of pointer and use that to remember the ports we
have attached. And use that information to skip attaching ports which
we have already attached.Tested-by: Joe Lawrence
Signed-off-by: Sudip Mukherjee
Signed-off-by: Greg Kroah-Hartman -
The coding style recommends not to use printk. Use pr_* macros.
Signed-off-by: Sudip Mukherjee
Signed-off-by: Greg Kroah-Hartman -
The variable name was only released if parport_register_dev_model()
fails. Now that we are using the device-model the parport driver
will duplicate the name and use it. So we can release the variable
after the device has been registered with the parport.Suggested-by: Arnd Bergmann
Signed-off-by: Sudip Mukherjee
Signed-off-by: Greg Kroah-Hartman
10 Nov, 2016
1 commit
-
free_pardevice() is called by parport_unregister_device() and already frees
pp->pdev->name, don't try to do it again.This bug causes kernel crashes.
I found and verified this with KASAN and some added pr_emerg()s:
[ 60.316568] pp_release: pp->pdev->name == ffff88039cb264c0
[ 60.316692] free_pardevice: freeing par_dev->name at ffff88039cb264c0
[ 60.316706] pp_release: kfree(ffff88039cb264c0)
[ 60.316714] ==========================================================
[ 60.316722] BUG: Double free or freeing an invalid pointer
[ 60.316731] Unexpected shadow byte: 0xFB
[ 60.316801] Object at ffff88039cb264c0, in cache kmalloc-32 size: 32
[ 60.316813] Allocated:
[ 60.316824] PID = 1695
[ 60.316869] Freed:
[ 60.316880] PID = 1695
[ 60.316935] ==========================================================Signed-off-by: Jann Horn
Acked-by: Sudip Mukherjee
Signed-off-by: Greg Kroah-Hartman
31 Aug, 2016
1 commit
-
Modify ppdev driver to use the new parallel port device model.
Initially submitted and committed as:
e7223f186033 ("ppdev: use new parport device model")But due to some regression it was reverted by:
1701f680407c ("Revert "ppdev: use new parport device model"")Now that the original source of regression is fixed by:
bbca503b2ee0 ("parport: use subsys_initcall") we can again modify ppdev
to use device model.Signed-off-by: Sudip Mukherjee
Signed-off-by: Greg Kroah-Hartman
26 Mar, 2016
1 commit
-
This reverts commit e7223f18603374d235d8bb0398532323e5f318b9.
It causes problems when a ppdev tries to register before the parport
driver has been registered with the device model. That will trigger theBUG_ON(!drv->bus->p);
at drivers/base/driver.c:153. The call chain is
kernel_init ->
kernel_init_freeable ->
do_one_initcall ->
ppdev_init ->
__parport_register_driver ->
driver_register *BOOM*Reported-by: kernel test robot
Reported-by: Ross Zwisler
Reported-by: Petr Mladek
Cc: Sudip Mukherjee
Cc: Greg Kroah-Hartman
Signed-off-by: Linus Torvalds
15 Feb, 2016
8 commits
-
It is more preffered to use the dev_* family of macros instead of using
the generic pr_*.Signed-off-by: Sudip Mukherjee
Signed-off-by: Greg Kroah-Hartman -
Modify ppdev driver to use the new parallel port device model.
Signed-off-by: Sudip Mukherjee
Signed-off-by: Greg Kroah-Hartman -
For alignment we should use tab in all possible places.
checkpatch was complaining for using space before tab.Signed-off-by: Sudip Mukherjee
Signed-off-by: Greg Kroah-Hartman -
checkpatch was complaining that the alignment was not matching with the
open parenthesis.Signed-off-by: Sudip Mukherjee
Signed-off-by: Greg Kroah-Hartman -
For single statement if and else blocks we do not need braces.
Signed-off-by: Sudip Mukherjee
Signed-off-by: Greg Kroah-Hartman -
kernel coding style recommends a blank line after varaiable declaration.
Signed-off-by: Sudip Mukherjee
Signed-off-by: Greg Kroah-Hartman -
checkpatch was complaining about space around the pointer.
Signed-off-by: Sudip Mukherjee
Signed-off-by: Greg Kroah-Hartman -
checkpatch was complaining about space between function name and open
parenthesis.Signed-off-by: Sudip Mukherjee
Signed-off-by: Greg Kroah-Hartman
09 Feb, 2016
2 commits
-
The arg of ioctl in ppdev is the pointer of integer except the
timeval in PPSETTIME, PPGETTIME. Different size of timeval
is already supported by the previous patches. So, it is safe
to add compat support.Signed-off-by: Bamvor Jian Zhang
Reviewed-by: Arnd Bergmann
Tested-by: Sudip Mukherjee
Signed-off-by: Greg Kroah-Hartman -
The y2038 issue for ppdev is changes of timeval in the ioctl
(PPSETTIME and PPGETTIME). The size of struct timeval changes from
8bytes to 16bytes due to the changes of time_t. It lead to the
changes of the command of ioctl, e.g. for PPGETTIME, We have:on 32-bit (old): 0x80087095
on 32-bit (new): 0x80107095
on 64-bit : 0x80107095This patch define these two ioctl commands to support the 32bit
and 64bit time_t application at the same time. And, introduce
pp_set_timeout to remove some duplicated code.Signed-off-by: Bamvor Jian Zhang
Reviewed-by: Arnd Bergmann
Tested-by: Sudip Mukherjee
Signed-off-by: Greg Kroah-Hartman
23 Feb, 2013
1 commit
-
Signed-off-by: Al Viro
29 Oct, 2012
1 commit
-
Sync up with Linus' tree to be able to apply Cesar's patch
against newer version of the code.Signed-off-by: Jiri Kosina
16 Oct, 2012
1 commit
-
We always update bytes_written before we check signal_pending so it
follows that we can't get a signal return for 0 bytes so we don't
need to check in the singal path. The cases a signal causes an earlier
abort are handled before this and will not hit this pathSigned-off-by: Alan Cox
Signed-off-by: Jiri Kosina
06 Sep, 2012
1 commit
-
Error handling of parport_register_driver() in ppdev_init()
is broken because it deallocates all resources but still
returns zero.Currently parport_register_driver() always succeeds.
Nevertheless it is worth to fix the issue.Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: Alexey Khoroshilov
Signed-off-by: Greg Kroah-Hartman
27 May, 2011
1 commit
-
parport_find_number() calls parport_get_port() on its result, so there
should be a corresponding call to parport_put_port() before dropping the
reference. Similar code is found in the function register_device() in the
same file.The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)//
@exists@
local idexpression struct parport * x;
expression ra,rr;
statement S1,S2;
@@x = parport_find_number(...)
... when != x = rr
when any
when != parport_put_port(x,...)
when != if (...) { ... parport_put_port(x,...) ...}
(
if() S1 else S2
|
if(...) { ... when != x = ra
when forall
when != parport_put_port(x,...)
*return...;
}
)
//Signed-off-by: Julia Lawall
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
28 Oct, 2010
1 commit
-
Structure par_timeout is copied to userland with some padding fields
unitialized. Field tv_usec has type __kernel_suseconds_t, it differs from
tv_sec's type on some architectures. It leads to leaking of stack memory.Signed-off-by: Vasiliy Kulikov
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
05 Oct, 2010
1 commit
-
All these files use the big kernel lock in a trivial
way to serialize their private file operations,
typically resulting from an earlier semi-automatic
pushdown from VFS.None of these drivers appears to want to lock against
other code, and they all use the BKL as the top-level
lock in their file operations, meaning that there
is no lock-order inversion problem.Consequently, we can remove the BKL completely,
replacing it with a per-file mutex in every case.
Using a scripted approach means we can avoid
typos.These drivers do not seem to be under active
maintainance from my brief investigation. Apologies
to those maintainers that I have missed.file=$1
name=$2
if grep -q lock_kernel ${file} ; then
if grep -q 'include.*linux.mutex.h' ${file} ; then
sed -i '/include.*/d' ${file}
else
sed -i 's/include.*.*$/include /g' ${file}
fi
sed -i ${file} \
-e "/^#include.*linux.mutex.h/,$ {
1,/^\(static\|int\|long\)/ {
/^\(static\|int\|long\)/istatic DEFINE_MUTEX(${name}_mutex);} }" \
-e "s/\(un\)*lock_kernel\>[ ]*()/mutex_\1lock(\&${name}_mutex)/g" \
-e '/[ ]*cycle_kernel_lock();/d'
else
sed -i -e '/include.*\/d' ${file} \
-e '/cycle_kernel_lock()/d'
fiSigned-off-by: Arnd Bergmann
28 May, 2010
1 commit
-
kasprintf combines kmalloc and sprintf, and takes care of the size
calculation itself.The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)//
@@
expression a,flag;
expression list args;
statement S;
@@a =
- \(kmalloc\|kzalloc\)(...,flag)
+ kasprintf(flag,args)
- sprintf(a,args);
//Signed-off-by: Julia Lawall
Cc: Michael Buesch
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
30 Mar, 2010
1 commit
-
…it slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.http://userweb.kernel.org/~tj/misc/slabh-sweep.py
The script does the followings.
* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.The conversion was done in the following steps.
1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.6. percpu.h was updated not to include slab.h.
7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
19 Jun, 2009
1 commit
-
One of my programs frequently grabs the parport, does something with it
and then drops it again. This results in spamming of the kernel log with"... registered pardevice"
"... unregistered pardevice"These messages are completely useless, except for debugging ppdev,
probably. So put them under DEBUG (or dynamic debug).Signed-off-by: Michael Buesch
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
17 Oct, 2008
1 commit
-
Now that device_create() has been audited, rename things back to the
original call to be sane.Signed-off-by: Greg Kroah-Hartman
26 Jul, 2008
1 commit
-
Signed-off-by: Alan Cox
Cc: Jiri Slaby
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
22 Jul, 2008
1 commit
-
device_create() is race-prone, so use the race-free
device_create_drvdata() instead as device_create() is going away.Signed-off-by: Greg Kroah-Hartman
21 Jun, 2008
2 commits
-
All of the open() functions which don't need the BKL on their face may
still depend on its acquisition to serialize opens against driver
initialization. So make those functions acquire then release the BKL to be
on the safe side.Signed-off-by: Jonathan Corbet
-
This documents the fact that somebody looked at the relevant open()
functions and concluded that, due to their trivial nature, no locking was
needed.Signed-off-by: Jonathan Corbet
24 Oct, 2007
1 commit
-
None of the drivers with a struct pardevice's ->irq_func() hook ever
used the 'irq' argument passed to it, so remove it.Signed-off-by: Jeff Garzik
17 Oct, 2007
1 commit
-
This patch cleans up duplicate includes in
drivers/char/Signed-off-by: Jesper Juhl
Cc: Richard Purdie
Cc: Ralf Baechle
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
09 May, 2007
1 commit
-
Remove includes of where it is not used/needed.
Suggested by Al Viro.Builds cleanly on x86_64, i386, alpha, ia64, powerpc, sparc,
sparc64, and arm (all 59 defconfigs).Signed-off-by: Randy Dunlap
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds