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, Dan Carpenter <dan.carpenter@oracle.com>,
	"David S. Miller" <davem@davemloft.net>
Subject: [PATCH 4.14 11/75] net: dsa: bcm_sf2: fix buffer overflow doing set_rxnfc
Date: Mon,  6 May 2019 16:32:19 +0200	[thread overview]
Message-ID: <20190506143054.230811036@linuxfoundation.org> (raw)
In-Reply-To: <20190506143053.287515952@linuxfoundation.org>

From: Dan Carpenter <dan.carpenter@oracle.com>

[ Upstream commit f949a12fd697479f68d99dc65e9bbab68ee49043 ]

The "fs->location" is a u32 that comes from the user in ethtool_set_rxnfc().
We can't pass unclamped values to test_bit() or it results in an out of
bounds access beyond the end of the bitmap.

Fixes: 7318166cacad ("net: dsa: bcm_sf2: Add support for ethtool::rxnfc")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/dsa/bcm_sf2_cfp.c |    6 ++++++
 1 file changed, 6 insertions(+)

--- a/drivers/net/dsa/bcm_sf2_cfp.c
+++ b/drivers/net/dsa/bcm_sf2_cfp.c
@@ -130,6 +130,9 @@ static int bcm_sf2_cfp_rule_set(struct d
 	    (fs->m_ext.vlan_etype || fs->m_ext.data[1]))
 		return -EINVAL;
 
+	if (fs->location != RX_CLS_LOC_ANY && fs->location >= CFP_NUM_RULES)
+		return -EINVAL;
+
 	if (fs->location != RX_CLS_LOC_ANY &&
 	    test_bit(fs->location, priv->cfp.used))
 		return -EBUSY;
@@ -330,6 +333,9 @@ static int bcm_sf2_cfp_rule_del(struct b
 	int ret;
 	u32 reg;
 
+	if (loc >= CFP_NUM_RULES)
+		return -EINVAL;
+
 	/* Refuse deletion of unused rules, and the default reserved rule */
 	if (!test_bit(loc, priv->cfp.used) || loc == 0)
 		return -EINVAL;



  parent reply	other threads:[~2019-05-06 14:43 UTC|newest]

Thread overview: 81+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-06 14:32 [PATCH 4.14 00/75] 4.14.117-stable review Greg Kroah-Hartman
2019-05-06 14:32 ` [PATCH 4.14 01/75] ALSA: line6: use dynamic buffers Greg Kroah-Hartman
2019-05-06 14:32 ` [PATCH 4.14 02/75] ipv4: ip_do_fragment: Preserve skb_iif during fragmentation Greg Kroah-Hartman
2019-05-06 14:32 ` [PATCH 4.14 03/75] ipv6/flowlabel: wait rcu grace period before put_pid() Greg Kroah-Hartman
2019-05-06 14:32 ` [PATCH 4.14 04/75] ipv6: invert flowlabel sharing check in process and user mode Greg Kroah-Hartman
2019-05-06 14:32 ` [PATCH 4.14 05/75] sctp: avoid running the sctp state machine recursively Greg Kroah-Hartman
2019-05-06 14:32 ` [PATCH 4.14 06/75] packet: validate msg_namelen in send directly Greg Kroah-Hartman
2019-05-06 14:32 ` [PATCH 4.14 07/75] bnxt_en: Improve multicast address setup logic Greg Kroah-Hartman
2019-05-06 14:32 ` [PATCH 4.14 08/75] bnxt_en: Free short FW command HWRM memory in error path in bnxt_init_one() Greg Kroah-Hartman
2019-05-06 14:32 ` [PATCH 4.14 09/75] rxrpc: Fix net namespace cleanup Greg Kroah-Hartman
2019-05-06 14:32 ` [PATCH 4.14 10/75] net: phy: marvell: Fix buffer overrun with stats counters Greg Kroah-Hartman
2019-05-06 14:32 ` Greg Kroah-Hartman [this message]
2019-05-06 14:32 ` [PATCH 4.14 12/75] kasan: remove redundant initialization of variable real_size Greg Kroah-Hartman
2019-05-06 14:32 ` [PATCH 4.14 13/75] kasan: prevent compiler from optimizing away memset in tests Greg Kroah-Hartman
2019-05-06 14:32 ` [PATCH 4.14 14/75] arm64: Fix single stepping in kernel traps Greg Kroah-Hartman
2019-05-06 14:32 ` [PATCH 4.14 15/75] arm64: only advance singlestep for user instruction traps Greg Kroah-Hartman
2019-05-06 14:32 ` [PATCH 4.14 16/75] caif: reduce stack size with KASAN Greg Kroah-Hartman
2019-05-06 14:32 ` [PATCH 4.14 17/75] ALSA: hda/realtek - Add new Dell platform for headset mode Greg Kroah-Hartman
2019-05-06 14:32 ` [PATCH 4.14 18/75] ALSA: hda/realtek - Fixed Dell AIO speaker noise Greg Kroah-Hartman
2019-05-06 14:32 ` [PATCH 4.14 19/75] USB: yurex: Fix protection fault after device removal Greg Kroah-Hartman
2019-05-06 14:32 ` [PATCH 4.14 20/75] USB: w1 ds2490: Fix bug caused by improper use of altsetting array Greg Kroah-Hartman
2019-05-06 14:32 ` [PATCH 4.14 21/75] usb: usbip: fix isoc packet num validation in get_pipe Greg Kroah-Hartman
2019-05-06 14:32 ` [PATCH 4.14 22/75] USB: core: Fix unterminated string returned by usb_string() Greg Kroah-Hartman
2019-05-06 14:32 ` [PATCH 4.14 23/75] USB: core: Fix bug caused by duplicate interface PM usage counter Greg Kroah-Hartman
2019-05-06 14:32 ` [PATCH 4.14 24/75] mm: do not stall register_shrinker() Greg Kroah-Hartman
2019-05-06 14:32 ` [PATCH 4.14 25/75] nvme-loop: init nvmet_ctrl fatal_err_work when allocate Greg Kroah-Hartman
2019-05-06 14:32 ` [PATCH 4.14 26/75] HID: logitech: check the return value of create_singlethread_workqueue Greg Kroah-Hartman
2019-05-06 14:32 ` [PATCH 4.14 27/75] HID: debug: fix race condition with between rdesc_show() and device removal Greg Kroah-Hartman
2019-05-06 14:32 ` [PATCH 4.14 28/75] rtc: sh: Fix invalid alarm warning for non-enabled alarm Greg Kroah-Hartman
2019-05-06 14:32 ` [PATCH 4.14 29/75] batman-adv: Reduce claim hash refcnt only for removed entry Greg Kroah-Hartman
2019-05-06 14:32 ` [PATCH 4.14 30/75] batman-adv: Reduce tt_local " Greg Kroah-Hartman
2019-05-06 14:32 ` [PATCH 4.14 31/75] batman-adv: Reduce tt_global " Greg Kroah-Hartman
2019-05-06 14:32 ` [PATCH 4.14 32/75] ARM: dts: rockchip: Fix gpu opp node names for rk3288 Greg Kroah-Hartman
2019-05-06 14:32 ` [PATCH 4.14 33/75] igb: Fix WARN_ONCE on runtime suspend Greg Kroah-Hartman
2019-05-06 14:32 ` [PATCH 4.14 34/75] net/mlx5: E-Switch, Fix esw manager vport indication for more vport commands Greg Kroah-Hartman
2019-05-06 14:32 ` [PATCH 4.14 35/75] bonding: show full hw address in sysfs for slave entries Greg Kroah-Hartman
2019-05-06 14:32 ` [PATCH 4.14 36/75] net: stmmac: ratelimit RX error logs Greg Kroah-Hartman
2019-05-06 14:32 ` [PATCH 4.14 37/75] net: stmmac: dont overwrite discard_frame status Greg Kroah-Hartman
2019-05-06 14:32 ` [PATCH 4.14 38/75] net: stmmac: fix dropping of multi-descriptor RX frames Greg Kroah-Hartman
2019-05-06 14:32 ` [PATCH 4.14 39/75] net: stmmac: dont log oversized frames Greg Kroah-Hartman
2019-05-06 14:32 ` [PATCH 4.14 40/75] jffs2: fix use-after-free on symlink traversal Greg Kroah-Hartman
2019-05-06 14:32 ` [PATCH 4.14 41/75] debugfs: " Greg Kroah-Hartman
2019-05-06 14:32 ` [PATCH 4.14 42/75] rtc: da9063: set uie_unsupported when relevant Greg Kroah-Hartman
2019-05-06 14:32 ` [PATCH 4.14 43/75] HID: input: add mapping for Assistant key Greg Kroah-Hartman
2019-05-06 14:32 ` [PATCH 4.14 44/75] vfio/pci: use correct format characters Greg Kroah-Hartman
2019-05-06 14:32 ` [PATCH 4.14 45/75] scsi: core: add new RDAC LENOVO/DE_Series device Greg Kroah-Hartman
2019-05-06 14:32 ` [PATCH 4.14 46/75] scsi: storvsc: Fix calculation of sub-channel count Greg Kroah-Hartman
2019-05-06 14:32 ` [PATCH 4.14 47/75] net: hns: fix KASAN: use-after-free in hns_nic_net_xmit_hw() Greg Kroah-Hartman
2019-05-06 14:32 ` [PATCH 4.14 48/75] net: hns: Use NAPI_POLL_WEIGHT for hns driver Greg Kroah-Hartman
2019-05-06 14:32 ` [PATCH 4.14 49/75] net: hns: Fix probabilistic memory overwrite when HNS driver initialized Greg Kroah-Hartman
2019-05-06 14:32 ` [PATCH 4.14 50/75] net: hns: fix ICMP6 neighbor solicitation messages discard problem Greg Kroah-Hartman
2019-05-06 14:32 ` [PATCH 4.14 51/75] net: hns: Fix WARNING when remove HNS driver with SMMU enabled Greg Kroah-Hartman
2019-05-06 14:33 ` [PATCH 4.14 52/75] kmemleak: powerpc: skip scanning holes in the .bss section Greg Kroah-Hartman
2019-05-06 14:33 ` [PATCH 4.14 53/75] hugetlbfs: fix memory leak for resv_map Greg Kroah-Hartman
2019-05-06 14:33 ` [PATCH 4.14 54/75] sh: fix multiple function definition build errors Greg Kroah-Hartman
2019-05-06 14:33 ` [PATCH 4.14 55/75] xsysace: Fix error handling in ace_setup Greg Kroah-Hartman
2019-05-06 14:33 ` [PATCH 4.14 56/75] ARM: orion: dont use using 64-bit DMA masks Greg Kroah-Hartman
2019-05-06 14:33 ` [PATCH 4.14 57/75] ARM: iop: " Greg Kroah-Hartman
2019-05-06 14:33 ` [PATCH 4.14 58/75] perf/x86/amd: Update generic hardware cache events for Family 17h Greg Kroah-Hartman
2019-05-06 14:33 ` [PATCH 4.14 59/75] Bluetooth: btusb: request wake pin with NOAUTOEN Greg Kroah-Hartman
2019-05-06 14:33 ` [PATCH 4.14 60/75] staging: iio: adt7316: allow adt751x to use internal vref for all dacs Greg Kroah-Hartman
2019-05-06 14:33 ` [PATCH 4.14 61/75] staging: iio: adt7316: fix the dac read calculation Greg Kroah-Hartman
2019-05-06 14:33 ` [PATCH 4.14 62/75] staging: iio: adt7316: fix the dac write calculation Greg Kroah-Hartman
2019-05-06 14:33 ` [PATCH 4.14 63/75] scsi: RDMA/srpt: Fix a credit leak for aborted commands Greg Kroah-Hartman
2019-05-06 14:33 ` [PATCH 4.14 64/75] ASoC: stm32: fix sai driver name initialisation Greg Kroah-Hartman
2019-05-06 14:33 ` [PATCH 4.14 65/75] IB/core: Unregister notifier before freeing MAD security Greg Kroah-Hartman
2019-05-06 14:33 ` [PATCH 4.14 66/75] IB/core: Fix potential memory leak while creating MAD agents Greg Kroah-Hartman
2019-05-06 14:33 ` [PATCH 4.14 67/75] IB/core: Destroy QP if XRC QP fails Greg Kroah-Hartman
2019-05-06 14:33 ` [PATCH 4.14 68/75] Input: snvs_pwrkey - initialize necessary driver data before enabling IRQ Greg Kroah-Hartman
2019-05-06 14:33 ` [PATCH 4.14 69/75] Input: stmfts - acknowledge that setting brightness is a blocking call Greg Kroah-Hartman
2019-05-06 14:33 ` [PATCH 4.14 70/75] selinux: never allow relabeling on context mounts Greg Kroah-Hartman
2019-05-06 14:33 ` [PATCH 4.14 71/75] powerpc/mm/hash: Handle mmap_min_addr correctly in get_unmapped_area topdown search Greg Kroah-Hartman
2019-05-06 14:33 ` [PATCH 4.14 72/75] x86/mce: Improve error message when kernel cannot recover, p2 Greg Kroah-Hartman
2019-05-06 14:33 ` [PATCH 4.14 73/75] clk: x86: Add system specific quirk to mark clocks as critical Greg Kroah-Hartman
2019-05-06 14:33 ` [PATCH 4.14 74/75] i2c: i2c-stm32f7: Fix SDADEL minimum formula Greg Kroah-Hartman
2019-05-06 14:33 ` [PATCH 4.14 75/75] media: v4l2: i2c: ov7670: Fix PLL bypass register values Greg Kroah-Hartman
2019-05-07  7:19 ` [PATCH 4.14 00/75] 4.14.117-stable review Naresh Kamboju
2019-05-07 12:44 ` Jon Hunter
2019-05-07 18:38 ` Guenter Roeck
2019-05-07 20:26 ` shuah
2019-05-07 22:47 ` kernelci.org bot

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=20190506143054.230811036@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=dan.carpenter@oracle.com \
    --cc=davem@davemloft.net \
    --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).