linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: gregkh@linuxfoundation.org
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Ian Abbott <abbotti@mev.co.uk>
Subject: [PATCH 4.4 50/75] staging: comedi: addi_apci_1500: Fix endian problem for command sample
Date: Mon, 15 Mar 2021 14:52:04 +0100	[thread overview]
Message-ID: <20210315135209.882783287@linuxfoundation.org> (raw)
In-Reply-To: <20210315135208.252034256@linuxfoundation.org>

From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

From: Ian Abbott <abbotti@mev.co.uk>

commit ac0bbf55ed3be75fde1f8907e91ecd2fd589bde3 upstream.

The digital input subdevice supports Comedi asynchronous commands that
read interrupt status information.  This uses 16-bit Comedi samples (of
which only the bottom 8 bits contain status information).  However, the
interrupt handler is calling `comedi_buf_write_samples()` with the
address of a 32-bit variable `unsigned int status`.  On a bigendian
machine, this will copy 2 bytes from the wrong end of the variable.  Fix
it by changing the type of the variable to `unsigned short`.

Fixes: a8c66b684efa ("staging: comedi: addi_apci_1500: rewrite the subdevice support functions")
Cc: <stable@vger.kernel.org> #4.0+
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Link: https://lore.kernel.org/r/20210223143055.257402-3-abbotti@mev.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/staging/comedi/drivers/addi_apci_1500.c |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

--- a/drivers/staging/comedi/drivers/addi_apci_1500.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1500.c
@@ -217,7 +217,7 @@ static irqreturn_t apci1500_interrupt(in
 	struct comedi_device *dev = d;
 	struct apci1500_private *devpriv = dev->private;
 	struct comedi_subdevice *s = dev->read_subdev;
-	unsigned int status = 0;
+	unsigned short status = 0;
 	unsigned int val;
 
 	val = inl(devpriv->amcc + AMCC_OP_REG_INTCSR);
@@ -247,14 +247,14 @@ static irqreturn_t apci1500_interrupt(in
 	 *
 	 *    Mask     Meaning
 	 * ----------  ------------------------------------------
-	 * 0x00000001  Event 1 has occurred
-	 * 0x00000010  Event 2 has occurred
-	 * 0x00000100  Counter/timer 1 has run down (not implemented)
-	 * 0x00001000  Counter/timer 2 has run down (not implemented)
-	 * 0x00010000  Counter 3 has run down (not implemented)
-	 * 0x00100000  Watchdog has run down (not implemented)
-	 * 0x01000000  Voltage error
-	 * 0x10000000  Short-circuit error
+	 * 0b00000001  Event 1 has occurred
+	 * 0b00000010  Event 2 has occurred
+	 * 0b00000100  Counter/timer 1 has run down (not implemented)
+	 * 0b00001000  Counter/timer 2 has run down (not implemented)
+	 * 0b00010000  Counter 3 has run down (not implemented)
+	 * 0b00100000  Watchdog has run down (not implemented)
+	 * 0b01000000  Voltage error
+	 * 0b10000000  Short-circuit error
 	 */
 	comedi_buf_write_samples(s, &status, 1);
 	comedi_handle_events(dev, s);



  parent reply	other threads:[~2021-03-15 13:57 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-15 13:51 [PATCH 4.4 00/75] 4.4.262-rc1 review gregkh
2021-03-15 13:51 ` [PATCH 4.4 01/75] uapi: nfnetlink_cthelper.h: fix userspace compilation error gregkh
2021-03-15 13:51 ` [PATCH 4.4 02/75] ath9k: fix transmitting to stations in dynamic SMPS mode gregkh
2021-03-15 13:51 ` [PATCH 4.4 03/75] net: Fix gro aggregation for udp encaps with zero csum gregkh
2021-03-15 13:51 ` [PATCH 4.4 04/75] can: skb: can_skb_set_owner(): fix ref counting if socket was closed before setting skb ownership gregkh
2021-03-15 13:51 ` [PATCH 4.4 05/75] can: flexcan: assert FRZ bit in flexcan_chip_freeze() gregkh
2021-03-15 13:51 ` [PATCH 4.4 06/75] can: flexcan: enable RX FIFO after FRZ/HALT valid gregkh
2021-03-15 13:51 ` [PATCH 4.4 07/75] netfilter: x_tables: gpf inside xt_find_revision() gregkh
2021-03-15 13:51 ` [PATCH 4.4 08/75] cifs: return proper error code in statfs(2) gregkh
2021-03-15 13:51 ` [PATCH 4.4 09/75] floppy: fix lock_fdc() signal handling gregkh
2021-03-15 13:51 ` [PATCH 4.4 10/75] Revert "mm, slub: consider rest of partial list if acquire_slab() fails" gregkh
2021-03-15 13:51 ` [PATCH 4.4 11/75] futex: Change locking rules gregkh
2021-03-15 13:51 ` [PATCH 4.4 12/75] futex: Cure exit race gregkh
2021-03-15 13:51 ` [PATCH 4.4 13/75] futex: fix dead code in attach_to_pi_owner() gregkh
2021-03-15 13:51 ` [PATCH 4.4 14/75] net/mlx4_en: update moderation when config reset gregkh
2021-03-15 13:51 ` [PATCH 4.4 15/75] net: lapbether: Remove netif_start_queue / netif_stop_queue gregkh
2021-03-15 13:51 ` [PATCH 4.4 16/75] net: davicom: Fix regulator not turned off on failed probe gregkh
2021-03-15 13:51 ` [PATCH 4.4 17/75] net: davicom: Fix regulator not turned off on driver removal gregkh
2021-03-15 13:51 ` [PATCH 4.4 18/75] media: usbtv: Fix deadlock on suspend gregkh
2021-03-15 13:51 ` [PATCH 4.4 19/75] mmc: mxs-mmc: Fix a resource leak in an error handling path in mxs_mmc_probe() gregkh
2021-03-15 13:51 ` [PATCH 4.4 20/75] mmc: mediatek: fix race condition between msdc_request_timeout and irq gregkh
2021-03-15 13:51 ` [PATCH 4.4 21/75] powerpc/perf: Record counter overflow always if SAMPLE_IP is unset gregkh
2021-03-15 13:51 ` [PATCH 4.4 22/75] PCI: xgene-msi: Fix race in installing chained irq handler gregkh
2021-03-15 13:51 ` [PATCH 4.4 23/75] s390/smp: __smp_rescan_cpus() - move cpumask away from stack gregkh
2021-03-15 13:51 ` [PATCH 4.4 24/75] scsi: libiscsi: Fix iscsi_prep_scsi_cmd_pdu() error handling gregkh
2021-03-15 13:51 ` [PATCH 4.4 25/75] ALSA: hda/hdmi: Cancel pending works before suspend gregkh
2021-03-15 13:51 ` [PATCH 4.4 26/75] ALSA: hda: Avoid spurious unsol event handling during S3/S4 gregkh
2021-03-15 13:51 ` [PATCH 4.4 27/75] ALSA: usb-audio: Fix "cannot get freq eq" errors on Dell AE515 sound bar gregkh
2021-03-15 13:51 ` [PATCH 4.4 28/75] s390/dasd: fix hanging DASD driver unbind gregkh
2021-03-15 13:51 ` [PATCH 4.4 29/75] mmc: core: Fix partition switch time for eMMC gregkh
2021-03-15 13:51 ` [PATCH 4.4 30/75] scripts/recordmcount.{c,pl}: support -ffunction-sections .text.* section names gregkh
2021-03-15 13:51 ` [PATCH 4.4 31/75] libertas: fix a potential NULL pointer dereference gregkh
2021-03-15 13:51 ` [PATCH 4.4 32/75] Goodix Fingerprint device is not a modem gregkh
2021-03-15 13:51 ` [PATCH 4.4 33/75] usb: gadget: f_uac2: always increase endpoint max_packet_size by one audio slot gregkh
2021-03-15 13:51 ` [PATCH 4.4 34/75] usb: renesas_usbhs: Clear PIPECFG for re-enabling pipe with other EPNUM gregkh
2021-03-15 13:51 ` [PATCH 4.4 35/75] xhci: Improve detection of device initiated wake signal gregkh
2021-03-15 13:51 ` [PATCH 4.4 36/75] USB: serial: io_edgeport: fix memory leak in edge_startup gregkh
2021-03-15 13:51 ` [PATCH 4.4 37/75] USB: serial: ch341: add new Product ID gregkh
2021-03-15 13:51 ` [PATCH 4.4 38/75] USB: serial: cp210x: add ID for Acuity Brands nLight Air Adapter gregkh
2021-03-15 13:51 ` [PATCH 4.4 39/75] USB: serial: cp210x: add some more GE USB IDs gregkh
2021-03-15 13:51 ` [PATCH 4.4 40/75] usbip: fix stub_dev to check for stream socket gregkh
2021-03-15 13:51 ` [PATCH 4.4 41/75] usbip: fix vhci_hcd " gregkh
2021-03-15 13:51 ` [PATCH 4.4 42/75] usbip: fix stub_dev usbip_sockfd_store() races leading to gpf gregkh
2021-03-15 13:51 ` [PATCH 4.4 43/75] staging: rtl8192u: fix ->ssid overflow in r8192_wx_set_scan() gregkh
2021-03-15 13:51 ` [PATCH 4.4 44/75] staging: rtl8188eu: prevent ->ssid overflow in rtw_wx_set_scan() gregkh
2021-03-15 13:51 ` [PATCH 4.4 45/75] staging: rtl8712: unterminated string leads to read overflow gregkh
2021-03-15 13:52 ` [PATCH 4.4 46/75] staging: rtl8188eu: fix potential memory corruption in rtw_check_beacon_data() gregkh
2021-03-15 13:52 ` [PATCH 4.4 47/75] staging: rtl8712: Fix possible buffer overflow in r8712_sitesurvey_cmd gregkh
2021-03-15 13:52 ` [PATCH 4.4 48/75] staging: rtl8192e: Fix possible buffer overflow in _rtl92e_wx_set_scan gregkh
2021-03-15 13:52 ` [PATCH 4.4 49/75] staging: comedi: addi_apci_1032: Fix endian problem for COS sample gregkh
2021-03-15 13:52 ` gregkh [this message]
2021-03-15 13:52 ` [PATCH 4.4 51/75] staging: comedi: adv_pci1710: Fix endian problem for AI command data gregkh
2021-03-15 13:52 ` [PATCH 4.4 52/75] staging: comedi: das6402: " gregkh
2021-03-15 13:52 ` [PATCH 4.4 53/75] staging: comedi: das800: " gregkh
2021-03-15 13:52 ` [PATCH 4.4 54/75] staging: comedi: dmm32at: " gregkh
2021-03-15 13:52 ` [PATCH 4.4 55/75] staging: comedi: me4000: " gregkh
2021-03-15 13:52 ` [PATCH 4.4 56/75] staging: comedi: pcl711: " gregkh
2021-03-15 13:52 ` [PATCH 4.4 57/75] staging: comedi: pcl818: " gregkh
2021-03-15 13:52 ` [PATCH 4.4 58/75] NFSv4.2: fix return value of _nfs4_get_security_label() gregkh
2021-03-15 13:52 ` [PATCH 4.4 59/75] block: rsxx: fix error return code of rsxx_pci_probe() gregkh
2021-03-15 13:52 ` [PATCH 4.4 60/75] prctl: fix PR_SET_MM_AUXV kernel stack leak gregkh
2021-03-15 13:52 ` [PATCH 4.4 61/75] alpha: add $(src)/ rather than $(obj)/ to make source file path gregkh
2021-03-15 13:52 ` [PATCH 4.4 62/75] alpha: merge build rules of division routines gregkh
2021-03-15 13:52 ` [PATCH 4.4 63/75] alpha: make short build log available for " gregkh
2021-03-15 13:52 ` [PATCH 4.4 64/75] alpha: Package string routines together gregkh
2021-03-15 13:52 ` [PATCH 4.4 65/75] alpha: move exports to actual definitions gregkh
2021-03-15 13:52 ` [PATCH 4.4 66/75] alpha: get rid of tail-zeroing in __copy_user() gregkh
2021-03-15 13:52 ` [PATCH 4.4 67/75] alpha: switch __copy_user() and __do_clean_user() to normal calling conventions gregkh
2021-03-15 13:52 ` [PATCH 4.4 68/75] powerpc/64s: Fix instruction encoding for lis in ppc_function_entry() gregkh
2021-03-15 13:52 ` [PATCH 4.4 69/75] media: hdpvr: Fix an error handling path in hdpvr_probe() gregkh
2021-03-15 13:52 ` [PATCH 4.4 70/75] KVM: arm64: Fix exclusive limit for IPA size gregkh
2021-03-15 13:52 ` [PATCH 4.4 71/75] iio: imu: adis16400: release allocated memory on failure gregkh
2021-03-15 13:52 ` [PATCH 4.4 72/75] iio: imu: adis16400: fix memory leak gregkh
2021-03-15 13:52 ` [PATCH 4.4 73/75] xen/events: reset affinity of 2-level event when tearing it down gregkh
2021-03-15 13:52 ` [PATCH 4.4 74/75] xen/events: dont unmask an event channel when an eoi is pending gregkh
2021-03-15 13:52 ` [PATCH 4.4 75/75] xen/events: avoid handling the same event on two cpus at the same time gregkh
2021-03-15 21:05 ` [PATCH 4.4 00/75] 4.4.262-rc1 review Pavel Machek
2021-03-15 21:29 ` Guenter Roeck
2021-03-15 22:57 ` Jason Self
2021-03-16 12:07 ` Naresh Kamboju

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210315135209.882783287@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=abbotti@mev.co.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).