All of lore.kernel.org
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: P J P <ppandit@redhat.com>
Cc: Qemu Developers <qemu-devel@nongnu.org>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Michael Hanselmann <public@hansmi.ch>,
	Prasad J Pandit <pjp@fedoraproject.org>,
	"Michael S . Tsirkin" <mst@redhat.com>,
	Peter Maydell <peter.maydell@linaro.org>
Subject: Re: [Qemu-devel] [PATCH] i2c: pm_smbus: check smb_index before block transfer write
Date: Thu, 6 Dec 2018 10:48:38 +0100	[thread overview]
Message-ID: <20181206104838.51060074@redhat.com> (raw)
In-Reply-To: <20181206084816.30485-1-ppandit@redhat.com>

On Thu,  6 Dec 2018 14:18:16 +0530
P J P <ppandit@redhat.com> wrote:

> From: Prasad J Pandit <pjp@fedoraproject.org>
> 
> While performing block transfer write in smb_ioport_writeb(),
> 'smb_index' is incremented and used to index smb_data[] array.
> Check 'smb_index' value to avoid OOB access.
> 
> Reported-by: Michael Hanselmann <public@hansmi.ch>
> Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>

Peter,
is it possible for fix to make into 3.1?

> ---
>  hw/i2c/pm_smbus.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/hw/i2c/pm_smbus.c b/hw/i2c/pm_smbus.c
> index 685a2378ed..03062740cc 100644
> --- a/hw/i2c/pm_smbus.c
> +++ b/hw/i2c/pm_smbus.c
> @@ -240,6 +240,9 @@ static void smb_ioport_writeb(void *opaque, hwaddr addr, uint64_t val,
>              uint8_t read = s->smb_addr & 0x01;
>  
>              s->smb_index++;
> +            if (s->smb_index >= PM_SMBUS_MAX_MSG_SIZE) {
> +                s->smb_index = 0;
> +            }
>              if (!read && s->smb_index == s->smb_data0) {
>                  uint8_t prot = (s->smb_ctl >> 2) & 0x07;
>                  uint8_t cmd = s->smb_cmd;

  parent reply	other threads:[~2018-12-06  9:48 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-06  8:48 [Qemu-devel] [PATCH] i2c: pm_smbus: check smb_index before block transfer write P J P
2018-12-06  9:02 ` li qiang
2018-12-06 10:14   ` li qiang
2018-12-06 10:16   ` Peter Maydell
2018-12-06 10:34     ` li qiang
2018-12-06 10:46       ` Peter Maydell
2018-12-06 10:59         ` Li Qiang
2018-12-06 11:05           ` Peter Maydell
2018-12-06 11:12             ` Li Qiang
2018-12-06 11:13               ` Peter Maydell
2018-12-06  9:48 ` Igor Mammedov [this message]
2018-12-06 10:14   ` Peter Maydell
2018-12-06  9:58 ` Igor Mammedov
2018-12-06 11:08   ` P J P
2018-12-06 11:19     ` Peter Maydell
2018-12-06 11:22       ` Peter Maydell
2018-12-06 12:04         ` P J P
2018-12-06 12:22           ` P J P
2018-12-06 11:33 ` li qiang
2018-12-06 11:35 ` Michael Hanselmann
2018-12-06 20:16 ` Michael Hanselmann

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=20181206104838.51060074@redhat.com \
    --to=imammedo@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=pjp@fedoraproject.org \
    --cc=ppandit@redhat.com \
    --cc=public@hansmi.ch \
    --cc=qemu-devel@nongnu.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 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.