Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1458168

[PATCH 4.6 22/96] pps: do not crash when failed to register

From Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Newsgroups linux.kernel
Subject [PATCH 4.6 22/96] pps: do not crash when failed to register
Date 2016-08-08 21:50 +0200
Message-ID <s3YIH-5FD-35@gated-at.bofh.it> (permalink)
References <s3YfD-5sp-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


4.6-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Jiri Slaby <jslaby@suse.cz>

commit 368301f2fe4b07e5fb71dba3cc566bc59eb6705f upstream.

With this command sequence:

  modprobe plip
  modprobe pps_parport
  rmmod pps_parport

the partport_pps modules causes this crash:

  BUG: unable to handle kernel NULL pointer dereference at (null)
  IP: parport_detach+0x1d/0x60 [pps_parport]
  Oops: 0000 [#1] SMP
  ...
  Call Trace:
    parport_unregister_driver+0x65/0xc0 [parport]
    SyS_delete_module+0x187/0x210

The sequence that builds up to this is:

 1) plip is loaded and takes the parport device for exclusive use:

    plip0: Parallel port at 0x378, using IRQ 7.

 2) pps_parport then fails to grab the device:

    pps_parport: parallel port PPS client
    parport0: cannot grant exclusive access for device pps_parport
    pps_parport: couldn't register with parport0

 3) rmmod of pps_parport is then killed because it tries to access
    pardev->name, but pardev (taken from port->cad) is NULL.

So add a check for NULL in the test there too.

Link: http://lkml.kernel.org/r/20160714115245.12651-1-jslaby@suse.cz
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Acked-by: Rodolfo Giometti <giometti@enneenne.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/pps/clients/pps_parport.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/pps/clients/pps_parport.c
+++ b/drivers/pps/clients/pps_parport.c
@@ -195,7 +195,7 @@ static void parport_detach(struct parpor
 	struct pps_client_pp *device;
 
 	/* FIXME: oooh, this is ugly! */
-	if (strcmp(pardev->name, KBUILD_MODNAME))
+	if (!pardev || strcmp(pardev->name, KBUILD_MODNAME))
 		/* not our port */
 		return;
 

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 4.6 00/96] 4.6.6-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-08 21:40 +0200
  [PATCH 4.6 06/96] dmaengine: at_xdmac: fix residue corruption Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-08 21:40 +0200
  [PATCH 4.6 25/96] arc: unwind: warn only once if DW2_UNWIND is disabled Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-08 21:40 +0200
  [PATCH 4.6 48/96] cgroup: remove redundant cleanup in css_create Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-08 21:40 +0200
  [PATCH 4.6 47/96] pinctrl: imx: Do not treat a PIN without MUX register as an error Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-08 21:40 +0200
  [PATCH 4.6 31/96] xen-blkfront: fix resume issues after a migration Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-08 21:40 +0200
  [PATCH 4.6 57/96] cpufreq: Avoid false-positive WARN_ON()s in cpufreq_update_policy() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-08 21:40 +0200
  [PATCH 4.6 37/96] Input: elantech - add more IC body types to the list Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-08 21:40 +0200
  [PATCH 4.6 08/96] mm, sl[au]b: add __GFP_ATOMIC to the GFP reclaim mask Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-08 21:40 +0200
  [PATCH 4.6 52/96] locks: use file_inode() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-08 21:40 +0200
  [PATCH 4.6 30/96] xenbus: dont bail early from xenbus_dev_request_and_reply() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-08 21:40 +0200
  [PATCH 4.6 21/96] radix-tree: fix radix_tree_iter_retry() for tagged iterators. Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-08 21:50 +0200
  [PATCH 4.6 14/96] mm, compaction: prevent VM_BUG_ON when terminating freeing scanner Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-08 21:50 +0200
  [PATCH 4.6 18/96] vmlinux.lds: account for destructor sections Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-08 21:50 +0200
  [PATCH 4.6 22/96] pps: do not crash when failed to register Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-08 21:50 +0200
  [PATCH 4.6 02/96] x86/quirks: Apply nvidia_bugs quirk only on root bus Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-08 21:50 +0200
  [PATCH 4.6 16/96] mm, meminit: always return a valid node from early_pfn_to_nid Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-08 21:50 +0200
  [PATCH 4.6 10/96] memcg: css_alloc should return an ERR_PTR value on error Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-08 21:50 +0200
  Re: [PATCH 4.6 00/96] 4.6.6-stable review Guenter Roeck <linux@roeck-us.net> - 2016-08-09 07:10 +0200
    Re: [PATCH 4.6 00/96] 4.6.6-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-09 10:30 +0200
      Re: [PATCH 4.6 00/96] 4.6.6-stable review Paul Burton <paul.burton@imgtec.com> - 2016-08-09 10:40 +0200
        Re: [PATCH 4.6 00/96] 4.6.6-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-09 10:40 +0200
          Re: [PATCH 4.6 00/96] 4.6.6-stable review Guenter Roeck <linux@roeck-us.net> - 2016-08-09 18:20 +0200
            Re: [PATCH 4.6 00/96] 4.6.6-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-09 19:30 +0200
              Re: [PATCH 4.6 00/96] 4.6.6-stable review Guenter Roeck <linux@roeck-us.net> - 2016-08-10 03:30 +0200
  Re: [PATCH 4.6 00/96] 4.6.6-stable review Shuah Khan <shuah.kh@samsung.com> - 2016-08-09 17:20 +0200
    Re: [PATCH 4.6 00/96] 4.6.6-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-09 19:30 +0200

csiph-web