From patchwork Mon Dec 6 07:36:11 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksey Senin X-Patchwork-Id: 377252 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oB67aEaf026442 for ; Mon, 6 Dec 2010 07:36:14 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751476Ab0LFHgN (ORCPT ); Mon, 6 Dec 2010 02:36:13 -0500 Received: from fwil.voltaire.com ([193.47.165.2]:32420 "EHLO Exil2010.voltaire.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751424Ab0LFHgN (ORCPT ); Mon, 6 Dec 2010 02:36:13 -0500 Received: from exil.voltaire.com (172.25.0.55) by Exil2010.voltaire.com (172.25.0.11) with Microsoft SMTP Server id 14.1.255.0; Mon, 6 Dec 2010 09:36:11 +0200 Received: from [172.25.5.190] ([172.25.5.190]) by exil.voltaire.com with Microsoft SMTPSVC(6.0.3790.4675); Mon, 6 Dec 2010 09:36:11 +0200 Message-ID: <4CFC926B.8060305@voltaire.com> Date: Mon, 6 Dec 2010 09:36:11 +0200 From: Aleksey Senin User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.9.1.11) Gecko/20100711 Thunderbird/3.0.6 MIME-Version: 1.0 To: Roland Dreier CC: , Moni Shoua , Nir Muchtar , Or Gerlitz Subject: [PATCH v3 2/4] RAW_PACKET QP capabilities check References: <4CFC918D.1090708@voltaire.com> <4CFC921D.3000907@voltaire.com> In-Reply-To: <4CFC921D.3000907@voltaire.com> X-OriginalArrivalTime: 06 Dec 2010 07:36:11.0495 (UTC) FILETIME=[4125EF70:01CB9518] Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Mon, 06 Dec 2010 07:36:14 +0000 (UTC) diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c index b342248..df149ed 100644 --- a/drivers/infiniband/core/uverbs_cmd.c +++ b/drivers/infiniband/core/uverbs_cmd.c @@ -1052,6 +1052,9 @@ ssize_t ib_uverbs_create_qp(struct ib_uverbs_file *file, if (copy_from_user(&cmd, buf, sizeof cmd)) return -EFAULT; + if (cmd.qp_type == IB_QPT_RAW_PACKET && !capable(CAP_NET_RAW)) + return -EPERM; + INIT_UDATA(&udata, buf + sizeof cmd, (unsigned long) cmd.response + sizeof resp, in_len - sizeof cmd, out_len - sizeof resp);