All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Kurt Schwemmer <kurt.schwemmer@microsemi.com>,
	Logan Gunthorpe <logang@deltatee.com>
Cc: Stephen Bates <stephen.bates@microsemi.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	linux-pci@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH 1/2] switchtec: off by one in ioctl_event_ctl()
Date: Mon, 13 Mar 2017 10:50:04 +0000	[thread overview]
Message-ID: <20170313105004.GA24989@mwanda> (raw)

The > should be >= SWITCHTEC_IOCTL_MAX_EVENTS.  Otherwise we probably
read one space beyond the end of the loop, hit a sanity check and return
-EINVAL.  This bug doesn't look super serious.

Fixes: 61c2e02154a9 ("switchtec: Add IOCTLs to the Switchtec driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/pci/switch/switchtec.c b/drivers/pci/switch/switchtec.c
index 1f045c95dec6..82ae08956457 100644
--- a/drivers/pci/switch/switchtec.c
+++ b/drivers/pci/switch/switchtec.c
@@ -1049,7 +1049,7 @@ static int ioctl_event_ctl(struct switchtec_dev *stdev,
 	if (copy_from_user(&ctl, uctl, sizeof(ctl)))
 		return -EFAULT;
 
-	if (ctl.event_id > SWITCHTEC_IOCTL_MAX_EVENTS)
+	if (ctl.event_id >= SWITCHTEC_IOCTL_MAX_EVENTS)
 		return -EINVAL;
 
 	if (ctl.flags & SWITCHTEC_IOCTL_EVENT_FLAG_UNUSED)

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Kurt Schwemmer <kurt.schwemmer@microsemi.com>,
	Logan Gunthorpe <logang@deltatee.com>
Cc: Stephen Bates <stephen.bates@microsemi.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	linux-pci@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH 1/2] switchtec: off by one in ioctl_event_ctl()
Date: Mon, 13 Mar 2017 13:50:04 +0300	[thread overview]
Message-ID: <20170313105004.GA24989@mwanda> (raw)

The > should be >= SWITCHTEC_IOCTL_MAX_EVENTS.  Otherwise we probably
read one space beyond the end of the loop, hit a sanity check and return
-EINVAL.  This bug doesn't look super serious.

Fixes: 61c2e02154a9 ("switchtec: Add IOCTLs to the Switchtec driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/pci/switch/switchtec.c b/drivers/pci/switch/switchtec.c
index 1f045c95dec6..82ae08956457 100644
--- a/drivers/pci/switch/switchtec.c
+++ b/drivers/pci/switch/switchtec.c
@@ -1049,7 +1049,7 @@ static int ioctl_event_ctl(struct switchtec_dev *stdev,
 	if (copy_from_user(&ctl, uctl, sizeof(ctl)))
 		return -EFAULT;
 
-	if (ctl.event_id > SWITCHTEC_IOCTL_MAX_EVENTS)
+	if (ctl.event_id >= SWITCHTEC_IOCTL_MAX_EVENTS)
 		return -EINVAL;
 
 	if (ctl.flags & SWITCHTEC_IOCTL_EVENT_FLAG_UNUSED)

             reply	other threads:[~2017-03-13 10:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-13 10:50 Dan Carpenter [this message]
2017-03-13 10:50 ` [PATCH 1/2] switchtec: off by one in ioctl_event_ctl() Dan Carpenter
2017-03-13 16:38 ` Logan Gunthorpe
2017-03-13 16:38   ` Logan Gunthorpe
2017-03-16 19:30 ` Bjorn Helgaas
2017-03-16 19:30   ` Bjorn Helgaas

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=20170313105004.GA24989@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=bhelgaas@google.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kurt.schwemmer@microsemi.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=logang@deltatee.com \
    --cc=stephen.bates@microsemi.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.