On Thu, Sep 10, 2020 at 05:00:43PM +0300, Leon Romanovsky wrote: > From: Leon Romanovsky <leonro@xxxxxxxxxx> > > The ioctl flow checks that the user provides only a supported > list of QP types, while write flow didn't do it and relied on > the driver to check it. Align those flows to fail as early as > possible. > > Reviewed-by: Maor Gottlieb <maorg@xxxxxxxxxxxx> > Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxx> > drivers/infiniband/core/uverbs_cmd.c | 17 +++++++++++++++-- > 1 file changed, 15 insertions(+), 2 deletions(-) > > diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c > index 408a1a4b67f6..b4e383505eda 100644 > +++ b/drivers/infiniband/core/uverbs_cmd.c > @@ -1275,8 +1275,21 @@ static int create_qp(struct uverbs_attr_bundle *attrs, > bool has_sq = true; > struct ib_device *ib_dev; > > - if (cmd->qp_type == IB_QPT_RAW_PACKET && !capable(CAP_NET_RAW)) > - return -EPERM; > + switch (cmd->qp_type) { > + case IB_QPT_RAW_PACKET: > + if (!capable(CAP_NET_RAW)) > + return -EPERM; > + fallthrough; I think the consensus is this fallthrough should be break Jason