<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/drivers/char/ppdev.c, branch v4.9.147</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v4.9.147</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v4.9.147'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2017-04-12T10:41:10Z</updated>
<entry>
<title>ppdev: fix registering same device name</title>
<updated>2017-04-12T10:41:10Z</updated>
<author>
<name>Sudip Mukherjee</name>
<email>sudipm.mukherjee@gmail.com</email>
</author>
<published>2017-03-06T23:23:43Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=9c2b46e720d5b083268ca0131f513a90696f3a82'/>
<id>urn:sha1:9c2b46e720d5b083268ca0131f513a90696f3a82</id>
<content type='text'>
commit 9a69645dde1188723d80745c1bc6ee9af2cbe2a7 upstream.

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 &lt;stable@vger.kernel.org&gt; # v4.9+
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1414656
Bugzilla: https://bugs.archlinux.org/task/52322
Tested-by: James Feeney &lt;james@nurealm.net&gt;
Signed-off-by: Sudip Mukherjee &lt;sudip.mukherjee@codethink.co.uk&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;


</content>
</entry>
<entry>
<title>ppdev: check before attaching port</title>
<updated>2017-04-12T10:41:10Z</updated>
<author>
<name>Sudip Mukherjee</name>
<email>sudipm.mukherjee@gmail.com</email>
</author>
<published>2016-11-12T21:22:12Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=bf5202b58f61e8fe2dba5ec8cf5720225b1b9e4c'/>
<id>urn:sha1:bf5202b58f61e8fe2dba5ec8cf5720225b1b9e4c</id>
<content type='text'>
commit dd5c472a60e43549d789a17a8444513eec64bd7e upstream.

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 &lt;joe.lawrence@redhat.com&gt;
Signed-off-by: Sudip Mukherjee &lt;sudip.mukherjee@codethink.co.uk&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>ppdev: fix double-free of pp-&gt;pdev-&gt;name</title>
<updated>2016-11-10T14:24:02Z</updated>
<author>
<name>Jann Horn</name>
<email>jann@thejh.net</email>
</author>
<published>2016-10-30T22:19:24Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=b13d14339baaaa720e7e5448855f33ba501917aa'/>
<id>urn:sha1:b13d14339baaaa720e7e5448855f33ba501917aa</id>
<content type='text'>
free_pardevice() is called by parport_unregister_device() and already frees
pp-&gt;pdev-&gt;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-&gt;pdev-&gt;name == ffff88039cb264c0
[   60.316692] free_pardevice: freeing par_dev-&gt;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 &lt;jann@thejh.net&gt;
Acked-by: Sudip Mukherjee &lt;sudipm.mukherjee@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>ppdev: use new parport device model</title>
<updated>2016-08-31T12:22:49Z</updated>
<author>
<name>Sudip Mukherjee</name>
<email>sudipm.mukherjee@gmail.com</email>
</author>
<published>2016-06-01T12:20:08Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=8b7d3a9d903ee1d1f5febc8e74223e4e72720e35'/>
<id>urn:sha1:8b7d3a9d903ee1d1f5febc8e74223e4e72720e35</id>
<content type='text'>
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 &lt;sudip.mukherjee@codethink.co.uk&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>Revert "ppdev: use new parport device model"</title>
<updated>2016-03-25T16:02:13Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2016-03-25T16:02:13Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=1701f680407c6cc05121566cef5293d33881fe71'/>
<id>urn:sha1:1701f680407c6cc05121566cef5293d33881fe71</id>
<content type='text'>
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 the

        BUG_ON(!drv-&gt;bus-&gt;p);

at drivers/base/driver.c:153. The call chain is

  kernel_init -&gt;
    kernel_init_freeable -&gt;
      do_one_initcall -&gt;
        ppdev_init -&gt;
          __parport_register_driver -&gt;
            driver_register *BOOM*

Reported-by: kernel test robot &lt;fengguang.wu@intel.com&gt;
Reported-by: Ross Zwisler &lt;zwisler@gmail.com&gt;
Reported-by: Petr Mladek &lt;pmladek@suse.com&gt;
Cc: Sudip Mukherjee &lt;sudipm.mukherjee@gmail.com&gt;
Cc: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>ppdev: use dev_* macros</title>
<updated>2016-02-15T01:43:50Z</updated>
<author>
<name>Sudip Mukherjee</name>
<email>sudipm.mukherjee@gmail.com</email>
</author>
<published>2016-02-12T13:03:46Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=396ec3dea3d82d0a32906efe9803a8ef2647df51'/>
<id>urn:sha1:396ec3dea3d82d0a32906efe9803a8ef2647df51</id>
<content type='text'>
It is more preffered to use the dev_* family of macros instead of using
the generic pr_*.

Signed-off-by: Sudip Mukherjee &lt;sudip@vectorindia.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>ppdev: use new parport device model</title>
<updated>2016-02-15T01:43:50Z</updated>
<author>
<name>Sudip Mukherjee</name>
<email>sudipm.mukherjee@gmail.com</email>
</author>
<published>2016-02-12T13:03:45Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=e7223f18603374d235d8bb0398532323e5f318b9'/>
<id>urn:sha1:e7223f18603374d235d8bb0398532323e5f318b9</id>
<content type='text'>
Modify ppdev driver to use the new parallel port device model.

Signed-off-by: Sudip Mukherjee &lt;sudip@vectorindia.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>ppdev: remove space before tab</title>
<updated>2016-02-15T01:43:50Z</updated>
<author>
<name>Sudip Mukherjee</name>
<email>sudipm.mukherjee@gmail.com</email>
</author>
<published>2016-02-12T13:03:44Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=3c8db584323875a50696718c89d94cef0ed54f30'/>
<id>urn:sha1:3c8db584323875a50696718c89d94cef0ed54f30</id>
<content type='text'>
For alignment we should use tab in all possible places.
checkpatch was complaining for using space before tab.

Signed-off-by: Sudip Mukherjee &lt;sudip@vectorindia.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>ppdev: fix parenthesis alignment</title>
<updated>2016-02-15T01:43:50Z</updated>
<author>
<name>Sudip Mukherjee</name>
<email>sudipm.mukherjee@gmail.com</email>
</author>
<published>2016-02-12T13:03:43Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=a7c71c07a31fde429627f0c7eed5fb57cb986fa6'/>
<id>urn:sha1:a7c71c07a31fde429627f0c7eed5fb57cb986fa6</id>
<content type='text'>
checkpatch was complaining that the alignment was not matching with the
open parenthesis.

Signed-off-by: Sudip Mukherjee &lt;sudip@vectorindia.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>ppdev: remove braces</title>
<updated>2016-02-15T01:43:50Z</updated>
<author>
<name>Sudip Mukherjee</name>
<email>sudipm.mukherjee@gmail.com</email>
</author>
<published>2016-02-12T13:03:42Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=83e80605cc3ce6a2ac966151cd515f691e4835e0'/>
<id>urn:sha1:83e80605cc3ce6a2ac966151cd515f691e4835e0</id>
<content type='text'>
For single statement if and else blocks we do not need braces.

Signed-off-by: Sudip Mukherjee &lt;sudip@vectorindia.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
