linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Jozef Balga <jozef.balga@gmail.com>,
	Mauro Carvalho Chehab <mchehab+samsung@kernel.org>,
	Sasha Levin <alexander.levin@microsoft.com>
Subject: [PATCH 4.18 04/53] media: af9035: prevent buffer overflow on write
Date: Thu, 18 Oct 2018 19:53:57 +0200	[thread overview]
Message-ID: <20181018175417.327286614@linuxfoundation.org> (raw)
In-Reply-To: <20181018175416.561567978@linuxfoundation.org>

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

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

From: Jozef Balga <jozef.balga@gmail.com>

[ Upstream commit 312f73b648626a0526a3aceebb0a3192aaba05ce ]

When less than 3 bytes are written to the device, memcpy is called with
negative array size which leads to buffer overflow and kernel panic. This
patch adds a condition and returns -EOPNOTSUPP instead.
Fixes bugzilla issue 64871

[mchehab+samsung@kernel.org: fix a merge conflict and changed the
 condition to match the patch's comment, e. g. len == 3 could
 also be valid]
Signed-off-by: Jozef Balga <jozef.balga@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/media/usb/dvb-usb-v2/af9035.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--- a/drivers/media/usb/dvb-usb-v2/af9035.c
+++ b/drivers/media/usb/dvb-usb-v2/af9035.c
@@ -402,8 +402,10 @@ static int af9035_i2c_master_xfer(struct
 			if (msg[0].addr == state->af9033_i2c_addr[1])
 				reg |= 0x100000;
 
-			ret = af9035_wr_regs(d, reg, &msg[0].buf[3],
-					msg[0].len - 3);
+			ret = (msg[0].len >= 3) ? af9035_wr_regs(d, reg,
+							         &msg[0].buf[3],
+							         msg[0].len - 3)
+					        : -EOPNOTSUPP;
 		} else {
 			/* I2C write */
 			u8 buf[MAX_XFER_SIZE];



  parent reply	other threads:[~2018-10-18 17:58 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-18 17:53 [PATCH 4.18 00/53] 4.18.16-stable review Greg Kroah-Hartman
2018-10-18 17:53 ` [PATCH 4.18 01/53] soundwire: Fix duplicate stream state assignment Greg Kroah-Hartman
2018-10-18 17:53 ` [PATCH 4.18 02/53] soundwire: Fix incorrect exit after configuring stream Greg Kroah-Hartman
2018-10-18 17:53 ` [PATCH 4.18 03/53] soundwire: Fix acquiring bus lock twice during master release Greg Kroah-Hartman
2018-10-18 17:53 ` Greg Kroah-Hartman [this message]
2018-10-18 17:53 ` [PATCH 4.18 05/53] spi: gpio: Fix copy-and-paste error Greg Kroah-Hartman
2018-10-18 17:53 ` [PATCH 4.18 06/53] batman-adv: Avoid probe ELP information leak Greg Kroah-Hartman
2018-10-18 17:54 ` [PATCH 4.18 07/53] batman-adv: Fix segfault when writing to throughput_override Greg Kroah-Hartman
2018-10-18 17:54 ` [PATCH 4.18 08/53] batman-adv: Fix segfault when writing to sysfs elp_interval Greg Kroah-Hartman
2018-10-18 17:54 ` [PATCH 4.18 09/53] batman-adv: Prevent duplicated gateway_node entry Greg Kroah-Hartman
2018-10-18 17:54 ` [PATCH 4.18 10/53] batman-adv: Prevent duplicated nc_node entry Greg Kroah-Hartman
2018-10-18 17:54 ` [PATCH 4.18 11/53] batman-adv: Prevent duplicated softif_vlan entry Greg Kroah-Hartman
2018-10-18 17:54 ` [PATCH 4.18 12/53] batman-adv: Prevent duplicated global TT entry Greg Kroah-Hartman
2018-10-18 17:54 ` [PATCH 4.18 13/53] batman-adv: Prevent duplicated tvlv handler Greg Kroah-Hartman
2018-10-18 17:54 ` [PATCH 4.18 14/53] batman-adv: fix backbone_gw refcount on queue_work() failure Greg Kroah-Hartman
2018-10-18 17:54 ` [PATCH 4.18 15/53] batman-adv: fix hardif_neigh " Greg Kroah-Hartman
2018-10-18 17:54 ` [PATCH 4.18 16/53] cxgb4: fix abort_req_rss6 struct Greg Kroah-Hartman
2018-10-18 17:54 ` [PATCH 4.18 17/53] clocksource/drivers/ti-32k: Add CLOCK_SOURCE_SUSPEND_NONSTOP flag for non-am43 SoCs Greg Kroah-Hartman
2018-10-18 17:54 ` [PATCH 4.18 18/53] scsi: ibmvscsis: Fix a stringop-overflow warning Greg Kroah-Hartman
2018-10-18 17:54 ` [PATCH 4.18 19/53] scsi: ibmvscsis: Ensure partition name is properly NUL terminated Greg Kroah-Hartman
2018-10-18 17:54 ` [PATCH 4.18 20/53] intel_th: pci: Add Ice Lake PCH support Greg Kroah-Hartman
2018-10-18 17:54 ` [PATCH 4.18 21/53] Input: atakbd - fix Atari keymap Greg Kroah-Hartman
2018-10-18 17:54 ` [PATCH 4.18 22/53] Input: atakbd - fix Atari CapsLock behaviour Greg Kroah-Hartman
2018-10-18 17:54 ` [PATCH 4.18 23/53] selftests: pmtu: properly redirect stderr to /dev/null Greg Kroah-Hartman
2018-10-18 17:54 ` [PATCH 4.18 24/53] net: emac: fix fixed-link setup for the RTL8363SB switch Greg Kroah-Hartman
2018-10-18 17:54 ` [PATCH 4.18 25/53] ravb: do not write 1 to reserved bits Greg Kroah-Hartman
2018-10-18 17:54 ` [PATCH 4.18 26/53] net/smc: fix non-blocking connect problem Greg Kroah-Hartman
2018-10-18 17:54 ` [PATCH 4.18 27/53] net/smc: fix sizeof to int comparison Greg Kroah-Hartman
2018-10-18 17:54 ` [PATCH 4.18 28/53] qed: Fix populating the invalid stag value in multi function mode Greg Kroah-Hartman
2018-10-18 17:54 ` [PATCH 4.18 29/53] qed: Do not add VLAN 0 tag to untagged frames in multi-function mode Greg Kroah-Hartman
2018-10-18 17:54 ` [PATCH 4.18 30/53] PCI: dwc: Fix scheduling while atomic issues Greg Kroah-Hartman
2018-10-18 17:54 ` [PATCH 4.18 31/53] RDMA/uverbs: Fix validity check for modify QP Greg Kroah-Hartman
2018-10-18 17:54 ` [PATCH 4.18 32/53] scsi: lpfc: Synchronize access to remoteport via rport Greg Kroah-Hartman
2018-10-18 17:54 ` [PATCH 4.18 33/53] drm: mali-dp: Call drm_crtc_vblank_reset on device init Greg Kroah-Hartman
2018-10-18 17:54 ` [PATCH 4.18 34/53] scsi: ipr: System hung while dlpar adding primary ipr adapter back Greg Kroah-Hartman
2018-10-18 17:54 ` [PATCH 4.18 35/53] scsi: sd: dont crash the host on invalid commands Greg Kroah-Hartman
2018-10-18 17:54 ` [PATCH 4.18 36/53] bpf: sockmap only allow ESTABLISHED sock state Greg Kroah-Hartman
2018-10-18 17:54 ` [PATCH 4.18 37/53] bpf: sockmap, fix transition through disconnect without close Greg Kroah-Hartman
2018-10-18 17:54 ` [PATCH 4.18 38/53] bpf: test_maps, only support ESTABLISHED socks Greg Kroah-Hartman
2018-10-18 17:54 ` [PATCH 4.18 39/53] net/mlx4: Use cpumask_available for eq->affinity_mask Greg Kroah-Hartman
2018-10-18 17:54 ` [PATCH 4.18 40/53] clocksource/drivers/fttmr010: Fix set_next_event handler Greg Kroah-Hartman
2018-10-18 17:54 ` [PATCH 4.18 41/53] RDMA/bnxt_re: Fix system crash during RDMA resource initialization Greg Kroah-Hartman
2018-10-18 17:54 ` [PATCH 4.18 42/53] RISC-V: include linux/ftrace.h in asm-prototypes.h Greg Kroah-Hartman
2018-10-18 17:54 ` [PATCH 4.18 43/53] iommu/rockchip: Free irqs in shutdown handler Greg Kroah-Hartman
2018-10-18 17:54 ` [PATCH 4.18 44/53] pinctrl/amd: poll InterruptEnable bits in amd_gpio_irq_set_type Greg Kroah-Hartman
2018-10-18 17:54 ` [PATCH 4.18 45/53] powerpc/tm: Fix userspace r13 corruption Greg Kroah-Hartman
2018-10-18 17:54 ` [PATCH 4.18 46/53] powerpc/tm: Avoid possible userspace r1 corruption on reclaim Greg Kroah-Hartman
2018-10-18 17:54 ` [PATCH 4.18 47/53] powerpc/numa: Use associativity if VPHN hcall is successful Greg Kroah-Hartman
2018-10-18 17:54 ` [PATCH 4.18 48/53] iommu/amd: Return devid as alias for ACPI HID devices Greg Kroah-Hartman
2018-10-18 17:54 ` [PATCH 4.18 49/53] x86/boot: Fix kexec booting failure in the SEV bit detection code Greg Kroah-Hartman
2018-10-18 17:54 ` [PATCH 4.18 50/53] Revert "vfs: fix freeze protection in mnt_want_write_file() for overlayfs" Greg Kroah-Hartman
2018-10-18 17:54 ` [PATCH 4.18 51/53] mremap: properly flush TLB before releasing the page Greg Kroah-Hartman
2018-10-18 17:54 ` [PATCH 4.18 52/53] ARC: build: Get rid of toolchain check Greg Kroah-Hartman
2018-10-18 17:54 ` [PATCH 4.18 53/53] ARC: build: Dont set CROSS_COMPILE in archs Makefile Greg Kroah-Hartman
2018-10-19 12:43 ` [PATCH 4.18 00/53] 4.18.16-stable review Rafael David Tinoco
2018-10-19 15:44   ` Greg Kroah-Hartman
2018-10-19 15:50 ` Guenter Roeck
2018-10-20  6:42   ` Greg Kroah-Hartman
2018-10-19 20:43 ` Shuah Khan
2018-10-20  6:41   ` Greg Kroah-Hartman

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=20181018175417.327286614@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=alexander.levin@microsoft.com \
    --cc=jozef.balga@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab+samsung@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).