Linux-HyperV Archive on
 help / color / Atom feed
From: Andres Beltran <>
To: Stephen Hemminger <>
Cc: KY Srinivasan <>,
	Haiyang Zhang <>,
	Stephen Hemminger <>,
	Wei Liu <>,,,
	Michael Kelley <>,
	Andrea Parri <>,
	Saruhan Karademir <>
Subject: Re: [PATCH] Drivers: hv: vmbus: Fix variable assignments in hv_ringbuffer_read()
Date: Fri, 24 Jul 2020 19:04:27 -0400
Message-ID: <> (raw)
In-Reply-To: <20200724101047.34de7e49@hermes.lan>

On Fri, Jul 24, 2020 at 1:10 PM Stephen Hemminger
<> wrote:
> What is the rationale for this change, it may break other code.
> A common API model in Windows world where this originated
> is to have a call where caller first
> makes request and then if the requested buffer is not big enough the
> caller look at the actual length and allocate a bigger buffer.
> Did you audit all the users of this API to make sure they aren't doing that.

The rationale for the change was to solve instances like the one
@Haiyang Zhang pointed out, especially in hv_utils, which needs
additional hardening. Unfortunately, there is an instance in
hv_pci_onchannelcallback() that does what you just described. Thus,
the fix will have to be made to all the callers of vmbus_recvpacket()
and vmbus_recvpacket_raw() to make sure they check the return value,
which most callers are not doing now. Thanks for pointing out this
behavior. I was not aware that the length can be checked by callers to
allocate a bigger buffer.

  parent reply index

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-24 16:46 Andres Beltran
2020-07-24 17:10 ` Stephen Hemminger
2020-07-24 17:48   ` Haiyang Zhang
2020-07-24 23:04   ` Andres Beltran [this message]
2020-07-26 23:53     ` Haiyang Zhang

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='' \ \ \ \ \ \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-HyperV Archive on

Archives are clonable:
	git clone --mirror linux-hyperv/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-hyperv linux-hyperv/ \
	public-inbox-index linux-hyperv

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone