From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linuxfoundation.org ([140.211.169.12]:56589 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753229AbbIZRtO (ORCPT ); Sat, 26 Sep 2015 13:49:14 -0400 Subject: Patch "IB/uverbs: reject invalid or unknown opcodes" has been added to the 4.2-stable tree To: hch@lst.de, dledford@redhat.com, gregkh@linuxfoundation.org, jgunthorpe@obsidianresearch.com, sagig@mellanox.com Cc: , From: Date: Sat, 26 Sep 2015 10:49:13 -0700 Message-ID: <1443289753164146@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org List-ID: This is a note to let you know that I've just added the patch titled IB/uverbs: reject invalid or unknown opcodes to the 4.2-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: ib-uverbs-reject-invalid-or-unknown-opcodes.patch and it can be found in the queue-4.2 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >>From b632ffa7cee439ba5dce3b3bc4a5cbe2b3e20133 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Wed, 26 Aug 2015 11:00:37 +0200 Subject: IB/uverbs: reject invalid or unknown opcodes From: Christoph Hellwig commit b632ffa7cee439ba5dce3b3bc4a5cbe2b3e20133 upstream. We have many WR opcodes that are only supported in kernel space and/or require optional information to be copied into the WR structure. Reject all those not explicitly handled so that we can't pass invalid information to drivers. Signed-off-by: Christoph Hellwig Reviewed-by: Jason Gunthorpe Reviewed-by: Sagi Grimberg Signed-off-by: Doug Ledford Signed-off-by: Greg Kroah-Hartman --- drivers/infiniband/core/uverbs_cmd.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) --- a/drivers/infiniband/core/uverbs_cmd.c +++ b/drivers/infiniband/core/uverbs_cmd.c @@ -2346,6 +2346,12 @@ ssize_t ib_uverbs_post_send(struct ib_uv next->send_flags = user_wr->send_flags; if (is_ud) { + if (next->opcode != IB_WR_SEND && + next->opcode != IB_WR_SEND_WITH_IMM) { + ret = -EINVAL; + goto out_put; + } + next->wr.ud.ah = idr_read_ah(user_wr->wr.ud.ah, file->ucontext); if (!next->wr.ud.ah) { @@ -2385,9 +2391,11 @@ ssize_t ib_uverbs_post_send(struct ib_uv user_wr->wr.atomic.compare_add; next->wr.atomic.swap = user_wr->wr.atomic.swap; next->wr.atomic.rkey = user_wr->wr.atomic.rkey; + case IB_WR_SEND: break; default: - break; + ret = -EINVAL; + goto out_put; } } Patches currently in stable-queue which might be from hch@lst.de are queue-4.2/ib-uverbs-reject-invalid-or-unknown-opcodes.patch queue-4.2/nfsd-fix-an-fs_layout_types-layout_types-encode-bug.patch queue-4.2/ib-srp-handle-partial-connection-success-correctly.patch