From: Amit Pundir <amit.pundir@linaro.org>
To: Greg KH <gregkh@linuxfoundation.org>, Stable <stable@vger.kernel.org>
Cc: Michael Mera <dev@michaelmera.com>, Doug Ledford <dledford@redhat.com>
Subject: [PATCH for-4.9.y] IB/ocrdma: fix out of bounds access to local buffer
Date: Tue, 31 Jul 2018 18:32:22 +0530 [thread overview]
Message-ID: <1533042142-8681-6-git-send-email-amit.pundir@linaro.org> (raw)
In-Reply-To: <1533042142-8681-1-git-send-email-amit.pundir@linaro.org>
From: Michael Mera <dev@michaelmera.com>
commit 062d0f22a30c39840ea49b72cfcfc1aa4cc538fa upstream.
In write to debugfs file 'resource_stats' the local buffer 'tmp_str' is
written at index 'count-1' where 'count' is the size of the write, so
potentially 0.
This patch filters odd values for the write size/position to avoid this
type of problem.
Signed-off-by: Michael Mera <dev@michaelmera.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
---
Please cherry-pick it on 4.4.y as well.
Not applicable for 3.18.y
drivers/infiniband/hw/ocrdma/ocrdma_stats.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_stats.c b/drivers/infiniband/hw/ocrdma/ocrdma_stats.c
index 265943069b35..84349d976162 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_stats.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_stats.c
@@ -645,7 +645,7 @@ static ssize_t ocrdma_dbgfs_ops_write(struct file *filp,
struct ocrdma_stats *pstats = filp->private_data;
struct ocrdma_dev *dev = pstats->dev;
- if (count > 32)
+ if (*ppos != 0 || count == 0 || count > sizeof(tmp_str))
goto err;
if (copy_from_user(tmp_str, buffer, count))
--
2.7.4
prev parent reply other threads:[~2018-07-31 14:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-31 13:02 [PATCH for-4.14.y 1/5] mtd: nand: qcom: Add a NULL check for devm_kasprintf() Amit Pundir
2018-07-31 13:02 ` [PATCH for-4.14.y 2/5] phy: phy-mtk-tphy: use auto instead of force to bypass utmi signals Amit Pundir
2018-07-31 13:02 ` [PATCH for-4.14.y 3/5] Bluetooth: hci_ldisc: Allow sleeping while proto locks are held Amit Pundir
2018-07-31 13:02 ` [PATCH for-4.14.y 4/5] Bluetooth: hci_serdev: Init hci_uart proto_lock to avoid oops Amit Pundir
2018-07-31 13:02 ` [PATCH for-4.14.y 5/5] ARM: dts: imx6sx: fix irq for pcie bridge Amit Pundir
2018-08-13 17:20 ` Greg KH
2018-07-31 13:02 ` Amit Pundir [this message]
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=1533042142-8681-6-git-send-email-amit.pundir@linaro.org \
--to=amit.pundir@linaro.org \
--cc=dev@michaelmera.com \
--cc=dledford@redhat.com \
--cc=gregkh@linuxfoundation.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).