Patch "usb: misc: legousbtower: Fix NULL pointer deference" has been added to the 4.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    usb: misc: legousbtower: Fix NULL pointer deference

to the 4.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     usb-misc-legousbtower-fix-null-pointer-deference.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.


>From 2fae9e5a7babada041e2e161699ade2447a01989 Mon Sep 17 00:00:00 2001
From: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 19 Sep 2016 19:09:51 +0100
Subject: usb: misc: legousbtower: Fix NULL pointer deference

From: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

commit 2fae9e5a7babada041e2e161699ade2447a01989 upstream.

This patch fixes a NULL pointer dereference caused by a race codition in
the probe function of the legousbtower driver. It re-structures the
probe function to only register the interface after successfully reading
the board's firmware ID.

The probe function does not deregister the usb interface after an error
receiving the devices firmware ID. The device file registered
(/dev/usb/legousbtower%d) may be read/written globally before the probe
function returns. When tower_delete is called in the probe function
(after an r/w has been initiated), core dev structures are deleted while
the file operation functions are still running. If the 0 address is
mappable on the machine, this vulnerability can be used to create a
Local Priviege Escalation exploit via a write-what-where condition by
remapping dev->interrupt_out_buffer in tower_write. A forged USB device
and local program execution would be required for LPE. The USB device
would have to delay the control message in tower_probe and accept
the control urb in tower_open whilst guest code initiated a write to the
device file as tower_delete is called from the error in tower_probe.

This bug has existed since 2003. Patch tested by emulated device.

Reported-by: James Patrick-Evans <james@xxxxxxxxx>
Tested-by: James Patrick-Evans <james@xxxxxxxxx>
Signed-off-by: James Patrick-Evans <james@xxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
 drivers/usb/misc/legousbtower.c |   35 +++++++++++++++++------------------
 1 file changed, 17 insertions(+), 18 deletions(-)

--- a/drivers/usb/misc/legousbtower.c
+++ b/drivers/usb/misc/legousbtower.c
@@ -898,24 +898,6 @@ static int tower_probe (struct usb_inter
 	dev->interrupt_in_interval = interrupt_in_interval ? interrupt_in_interval : dev->interrupt_in_endpoint->bInterval;
 	dev->interrupt_out_interval = interrupt_out_interval ? interrupt_out_interval : dev->interrupt_out_endpoint->bInterval;
 
-	/* we can register the device now, as it is ready */
-	usb_set_intfdata (interface, dev);
-
-	retval = usb_register_dev (interface, &tower_class);
-
-	if (retval) {
-		/* something prevented us from registering this driver */
-		dev_err(idev, "Not able to get a minor for this device.\n");
-		usb_set_intfdata (interface, NULL);
-		goto error;
-	}
-	dev->minor = interface->minor;
-
-	/* let the user know what node this device is now attached to */
-	dev_info(&interface->dev, "LEGO USB Tower #%d now attached to major "
-		 "%d minor %d\n", (dev->minor - LEGO_USB_TOWER_MINOR_BASE),
-		 USB_MAJOR, dev->minor);
-
 	/* get the firmware version and log it */
 	result = usb_control_msg (udev,
 				  usb_rcvctrlpipe(udev, 0),
@@ -936,6 +918,23 @@ static int tower_probe (struct usb_inter
 		 get_version_reply.minor,
 		 le16_to_cpu(get_version_reply.build_no));
 
+	/* we can register the device now, as it is ready */
+	usb_set_intfdata (interface, dev);
+
+	retval = usb_register_dev (interface, &tower_class);
+
+	if (retval) {
+		/* something prevented us from registering this driver */
+		dev_err(idev, "Not able to get a minor for this device.\n");
+		usb_set_intfdata (interface, NULL);
+		goto error;
+	}
+	dev->minor = interface->minor;
+
+	/* let the user know what node this device is now attached to */
+	dev_info(&interface->dev, "LEGO USB Tower #%d now attached to major "
+		 "%d minor %d\n", (dev->minor - LEGO_USB_TOWER_MINOR_BASE),
+		 USB_MAJOR, dev->minor);
 
 exit:
 	return retval;


Patches currently in stable-queue which might be from gregkh@xxxxxxxxxxxxxxxxxxx are

queue-4.4/tile-define-at_vector_size_arch-for-arch_dlinfo.patch
queue-4.4/ib-mlx4-fix-code-indentation-in-qp1-mad-flow.patch
queue-4.4/printk-fix-parsing-of-brl-option.patch
queue-4.4/regulator-qcom_smd-fix-voltage-ranges-for-pm8x41.patch
queue-4.4/usb-misc-legousbtower-fix-null-pointer-deference.patch
queue-4.4/ib-ipoib-fix-memory-corruption-in-ipoib-cm-mode-connect-flow.patch
queue-4.4/iwlwifi-pcie-fix-access-to-scratch-buffer.patch
queue-4.4/fnic-pci_dma_mapping_error-doesn-t-return-an-error-code.patch
queue-4.4/dmaengine-at_xdmac-fix-debug-string.patch
queue-4.4/aio-mark-aio-pseudo-fs-noexec.patch
queue-4.4/mmc-pxamci-fix-potential-oops.patch
queue-4.4/sysctl-handle-error-writing-uint_max-to-u32-fields.patch
queue-4.4/dmaengine-at_xdmac-fix-to-pass-correct-device-identity-to-free_irq.patch
queue-4.4/avr32-off-by-one-in-at32_init_pio.patch
queue-4.4/arm-sa1100-fix-3.6864mhz-clock.patch
queue-4.4/kvm-nvmx-postpone-vmcs-changes-on-msr_ia32_apicbase-write.patch
queue-4.4/regulator-qcom_spmi-add-support-for-s4-supply-on-pm8941.patch
queue-4.4/gspca-avoid-unused-variable-warnings.patch
queue-4.4/tools-vm-slabinfo-fix-an-unintentional-printf.patch
queue-4.4/irqchip-gicv3-silence-noisy-debug_per_cpu_maps-warning.patch
queue-4.4/arm-8616-1-dt-respect-property-size-when-parsing-cpus.patch
queue-4.4/brcmfmac-fix-glob_skb-leak-in-brcmf_sdiod_recv_chain.patch
queue-4.4/usb-serial-cp210x-fix-hardware-flow-control-disable.patch
queue-4.4/pnfs-flexfiles-fix-layoutcommit-after-a-commit-to-ds.patch
queue-4.4/pstore-drop-file-opened-reference-count.patch
queue-4.4/mips-uprobes-fix-use-of-uninitialised-variable.patch
queue-4.4/drivers-perf-arm_pmu-fix-leak-in-error-path.patch
queue-4.4/mips-fix-uretprobe-implementation.patch
queue-4.4/kernel-fork-fix-clone_child_cleartid-regression-in-nscd.patch
queue-4.4/ipvs-fix-bind-to-link-local-mcast-ipv6-address-in-backup.patch
queue-4.4/brcmsmac-free-packet-if-dma_mapping_error-fails-in-dma_rxfill.patch
queue-4.4/usb-musb-fix-dma-for-host-mode.patch
queue-4.4/dm-log-writes-fix-bug-with-too-large-bios.patch
queue-4.4/pinctrl-flag-strict-is-a-field-in-struct-pinmux_ops.patch
queue-4.4/clk-xgene-add-missing-parenthesis-when-clearing-divider-value.patch
queue-4.4/batman-adv-remove-unused-callback-from-batadv_algo_ops-struct.patch
queue-4.4/x86-init-fix-cr4_init_shadow-on-cr4-less-machines.patch
queue-4.4/i40e-avoid-null-pointer-dereference.patch
queue-4.4/nfc-fdp-detect-errors-from-fdp_nci_create_conn.patch
queue-4.4/hwrng-omap-fix-assumption-that-runtime_get_sync-will-always-succeed.patch
queue-4.4/mips-malta-fix-iocu-disable-switch-read-for-mips64.patch
queue-4.4/ib-core-fix-use-after-free-in-send_leave-function.patch
queue-4.4/arm-shmobile-fix-regulator-quirk-for-gen2.patch
queue-4.4/arm-sa1100-register-clocks-early.patch
queue-4.4/mm-ksm-fix-endless-looping-in-allocating-memory-when-ksm-enable.patch
queue-4.4/svc-avoid-garbage-replies-when-pc_func-returns-rpc_drop_reply.patch
queue-4.4/asoc-intel-skylake-fix-error-return-code-in-skl_probe.patch
queue-4.4/can-dev-fix-deadlock-reported-after-bus-off.patch
queue-4.4/arm-sun5i-fix-typo-in-trip-point-temperature.patch
queue-4.4/regulator-qcom_spmi-update-mvs1-mvs2-switches-on-pm8941.patch
queue-4.4/iwlwifi-mvm-don-t-use-ret-when-not-initialised.patch
queue-4.4/arm-8618-1-decompressor-reset-ttbcr-fields-to-use-ttbr0-on-armv7.patch
queue-4.4/iwlmvm-mvm-set-correct-state-in-smart-fifo-configuration.patch
queue-4.4/ath9k-fix-programming-of-mincca-power-threshold.patch
queue-4.4/mips-uprobes-remove-incorrect-set_orig_insn.patch
queue-4.4/pnfs-files-fix-layoutcommit-after-a-commit-to-ds.patch
queue-4.4/regulator-qcom_spmi-add-support-for-get_mode-set_mode-on-switches.patch
queue-4.4/cpuset-handle-race-between-cpu-hotplug-and-cpuset_hotplug_work.patch
queue-4.4/x86-boot-initialize-fpu-and-x86_feature_always-even-if-we-don-t-have-cpuid.patch
queue-4.4/mtd-nand-davinci-reinitialize-the-hw-ecc-engine-in-4bit-hwctl.patch
queue-4.4/pinctrl-uniphier-fix-.pin_dbg_show-callback.patch
queue-4.4/em28xx-i2c-rt_mutex_trylock-returns-zero-on-failure.patch
queue-4.4/drm-radeon-si-dpm-add-workaround-for-for-jet-parts.patch
queue-4.4/ib-mlx4-use-correct-subnet-prefix-in-qp1-mads-under-sr-iov.patch
queue-4.4/arm64-debug-avoid-resetting-stepping-state-machine-when-tif_singlestep.patch
queue-4.4/perf-core-fix-pmu-filter_match-for-sw-led-groups.patch
queue-4.4/iwlwifi-mvm-fix-a-few-firmware-capability-checks.patch
queue-4.4/ib-ipoib-don-t-allow-mc-joins-during-light-mc-flush.patch
queue-4.4/nfs-don-t-drop-cb-requests-with-invalid-principals.patch
queue-4.4/blk-mq-actually-hook-up-defer-list-when-running-requests.patch
queue-4.4/gpio-sa1100-fix-irq-probing-for-ucb1x00.patch
queue-4.4/powerpc-prom-fix-sub-processor-option-passed-to-ibm-client-architecture-support.patch
queue-4.4/brcmsmac-initialize-power-in-brcms_c_stf_ss_algo_channel_get.patch
queue-4.4/arm-8617-1-dma-fix-dma_max_pfn.patch
queue-4.4/hwmon-adt7411-set-bit-3-in-cfg1-register.patch
queue-4.4/drm-nouveau-fifo-nv04-avoid-ramht-race-against-cookie-insertion.patch
queue-4.4/ceph-fix-race-during-filling-readdir-cache.patch
queue-4.4/nvmem-declare-nvmem_cell_read-consistently.patch
queue-4.4/asoc-omap-mcpdm-fix-irq-resource-handling.patch
queue-4.4/spi-sh-msiof-avoid-invalid-clock-generator-parameters.patch
queue-4.4/arm-sa1100-clear-reset-status-prior-to-reboot.patch
queue-4.4/usb-gadget-fsl_qe_udc-signedness-bug-in-qe_get_frame.patch
queue-4.4/ib-mlx4-fix-incorrect-mc-join-state-bit-masking-on-sr-iov.patch
queue-4.4/usb-musb-fix-dma-desired-mode-for-mentor-dma-engine.patch
queue-4.4/tpm-fix-byte-order-for-the-value-read-by-tpm2_get_tpm_pt.patch
queue-4.4/arm-sa1111-fix-pcmcia-suspend-resume.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]