]> git.baikalelectronics.ru Git - kernel.git/commit
IB/uverbs: Check reserved fields in create_flow
authorYann Droneaud <ydroneaud@opteya.com>
Wed, 11 Dec 2013 22:01:49 +0000 (23:01 +0100)
committerRoland Dreier <roland@purestorage.com>
Fri, 20 Dec 2013 18:54:32 +0000 (10:54 -0800)
commitaa66c8e491a28172bd9a7fd8b9b67e3c42d90eb0
tree09d416e757e1f4d844618cc0f8ac71534eb01b38
parent8179103cebae6c8bb94d418c2c20308210d28ee9
IB/uverbs: Check reserved fields in create_flow

As noted by Daniel Vetter in its article "Botching up ioctls"[1]

  "Check *all* unused fields and flags and all the padding for whether
   it's 0, and reject the ioctl if that's not the case.  Otherwise
   your nice plan for future extensions is going right down the
   gutters since someone *will* submit an ioctl struct with random
   stack garbage in the yet unused parts. Which then bakes in the ABI
   that those fields can never be used for anything else but garbage."

It's important to ensure that reserved fields are set to known value,
so that it will be possible to use them latter to extend the ABI.

The same reasonning apply to comp_mask field present in newer uverbs
command: per commit 2033e7c7ecc0 ("IB/core: Better checking of
userspace values for receive flow steering"), unsupported values in
comp_mask are rejected.

[1] http://blog.ffwll.ch/2013/11/botching-up-ioctls.html

Link: http://marc.info/?i=cover.1386798254.git.ydroneaud@opteya.com>
Signed-off-by: Yann Droneaud <ydroneaud@opteya.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
drivers/infiniband/core/uverbs_cmd.c