From: Juergen Gross Date: Fri, 15 Jan 2021 08:29:36 +0000 (+0100) Subject: tools/libxenevtchn: check xenevtchn_open() flags for not supported bits X-Git-Tag: archive/raspbian/4.16.0+51-g0941d6cb-1+rpi1~2^2~42^2~1144 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=f7918dc8f94c1640ba18341d7812f5c461d064ce;p=xen.git tools/libxenevtchn: check xenevtchn_open() flags for not supported bits Refuse a call of xenevtchn_open() with unsupported bits in flags being set. This will change behavior for callers passing junk in flags today, but those would otherwise get probably unwanted side effects when the flags they specify today get any meaning. So checking flags is the right thing to do. Suggested-by: Andrew Cooper Signed-off-by: Juergen Gross Reviewed-by: Andrew Cooper --- diff --git a/tools/libs/evtchn/core.c b/tools/libs/evtchn/core.c index 72d92e28bf..79990d0027 100644 --- a/tools/libs/evtchn/core.c +++ b/tools/libs/evtchn/core.c @@ -13,6 +13,7 @@ * License along with this library; If not, see . */ +#include #include #include @@ -31,9 +32,16 @@ static int all_restrict_cb(Xentoolcore__Active_Handle *ah, domid_t domid) xenevtchn_handle *xenevtchn_open(xentoollog_logger *logger, unsigned int flags) { - xenevtchn_handle *xce = malloc(sizeof(*xce)); + xenevtchn_handle *xce; int rc; + if ( flags ) + { + errno = EINVAL; + return NULL; + } + + xce = malloc(sizeof(*xce)); if ( !xce ) return NULL;