From: "ira.weiny" <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: Jason Gunthorpe
<jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
Cc: "Hefty,
Sean" <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
"dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org"
<dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
"linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
"hal-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org"
<hal-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
Subject: Re: [PATCH 08/14] IB/core: Add rdma_max_mad_size helper
Date: Wed, 20 May 2015 20:12:52 -0400 [thread overview]
Message-ID: <20150521001251.GF22981@phlsvsds.ph.intel.com> (raw)
In-Reply-To: <20150520213404.GA6293-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
On Wed, May 20, 2015 at 03:34:04PM -0600, Jason Gunthorpe wrote:
> On Wed, May 20, 2015 at 05:31:28PM -0400, ira.weiny wrote:
> > > I'm not really sure it makes sense to have the drivers set this, since
> > > the value is fixed based on the existing caps. The core could fill it
> > > in, then we don't have to check the driver's work.
> > >
> > > If the driver fills it then the core should do
> > >
> > > BUG_ON(!mad_cap && max_mad_size != 0)
> >
> > The driver does fill this in, and the core check this as part of this patch.
> >
> > diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c
> > index 8055195b5d60..ea25e9467cb5 100644
> > +++ b/drivers/infiniband/core/mad.c
> > @@ -2937,6 +2937,10 @@ static int ib_mad_port_open(struct ib_device *device,
> > unsigned long flags;
> > char name[sizeof "ib_mad123"];
> > int has_smi;
> > + size_t max_mad_size = rdma_max_mad_size(device, port_num);
> > +
> > + if (WARN_ON(max_mad_size < IB_MGMT_MAD_SIZE))
> > + return -EFAULT;
>
> Should be BUG_ON
I think that is a bit strong. There is nothing in this condition which
warrants a kernel panic. The WARN_ON allows someone to unload their driver and
fix the problem.
> In the wrong place
> Not the test I asked for.
Right, sorry I missread your comment because I was more concerned about the
case where a driver specifies they want MAD support but then report 0 for the
MAD size. That is much more dangerous.
I'll add verification to the immutable data with your check.
Ira
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2015-05-21 0:12 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-20 8:13 [PATCH 00/14] IB/mad: Add support for OPA MAD processing ira.weiny-ral2JQCrhuEAvxtiuMwx3w
[not found] ` <1432109615-19564-1-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-05-20 8:13 ` [PATCH 01/14] IB/mad: Clean up ib_find_send_mad ira.weiny-ral2JQCrhuEAvxtiuMwx3w
[not found] ` <1432109615-19564-2-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-05-20 18:22 ` Jason Gunthorpe
[not found] ` <20150520182221.GF28496-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-05-21 0:28 ` ira.weiny
2015-05-21 1:32 ` ira.weiny
2015-05-20 8:13 ` [PATCH 02/14] IB/mad: Create an RMPP Base header ira.weiny-ral2JQCrhuEAvxtiuMwx3w
[not found] ` <1432109615-19564-3-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-05-20 18:27 ` Jason Gunthorpe
[not found] ` <20150520182735.GG28496-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-05-20 21:23 ` ira.weiny
[not found] ` <20150520212344.GB22981-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
2015-05-20 22:03 ` Jason Gunthorpe
[not found] ` <20150520220333.GA5970-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-05-27 18:13 ` ira.weiny
2015-05-20 8:13 ` [PATCH 03/14] IB/mad: Create handle_ib_smi ira.weiny-ral2JQCrhuEAvxtiuMwx3w
[not found] ` <1432109615-19564-4-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-05-20 17:24 ` Hefty, Sean
[not found] ` <1828884A29C6694DAF28B7E6B8A82373A8FDDA89-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-05-20 17:52 ` ira.weiny
[not found] ` <20150520175230.GA14309-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
2015-05-20 18:11 ` Hefty, Sean
2015-05-20 18:28 ` Jason Gunthorpe
[not found] ` <20150520182832.GH28496-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-05-21 1:34 ` ira.weiny
2015-05-20 8:13 ` [PATCH 04/14] IB/mad: Add helper function for smi_handle_dr_smp_send ira.weiny-ral2JQCrhuEAvxtiuMwx3w
2015-05-20 8:13 ` [PATCH 05/14] IB/mad: Add helper function for smi_handle_dr_smp_recv ira.weiny-ral2JQCrhuEAvxtiuMwx3w
2015-05-20 8:13 ` [PATCH 06/14] IB/mad: Add helper function for smi_check_forward_dr_smp ira.weiny-ral2JQCrhuEAvxtiuMwx3w
[not found] ` <1432109615-19564-7-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-05-20 17:32 ` Hefty, Sean
[not found] ` <1828884A29C6694DAF28B7E6B8A82373A8FDDAA6-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-05-20 17:56 ` ira.weiny
2015-05-20 8:13 ` [PATCH 07/14] IB/mad: Add base version to ib_create_send_mad ira.weiny-ral2JQCrhuEAvxtiuMwx3w
2015-05-20 8:13 ` [PATCH 08/14] IB/core: Add rdma_max_mad_size helper ira.weiny-ral2JQCrhuEAvxtiuMwx3w
[not found] ` <1432109615-19564-9-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-05-20 17:37 ` Hefty, Sean
[not found] ` <1828884A29C6694DAF28B7E6B8A82373A8FDDACE-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-05-20 18:02 ` ira.weiny
[not found] ` <20150520180226.GC14309-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
2015-05-20 18:19 ` Jason Gunthorpe
[not found] ` <20150520181928.GE28496-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-05-20 19:03 ` ira.weiny
[not found] ` <20150520190352.GA22981-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
2015-05-20 19:08 ` Hefty, Sean
2015-05-20 19:43 ` Jason Gunthorpe
[not found] ` <20150520194314.GA3344-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-05-20 21:31 ` ira.weiny
[not found] ` <20150520213128.GD22981-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
2015-05-20 21:34 ` Jason Gunthorpe
[not found] ` <20150520213404.GA6293-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-05-21 0:12 ` ira.weiny [this message]
2015-05-21 0:19 ` ira.weiny
2015-05-20 8:13 ` [PATCH 09/14] IB/mad: Convert allocations from kmem_cache to kmalloc ira.weiny-ral2JQCrhuEAvxtiuMwx3w
[not found] ` <1432109615-19564-10-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-05-20 17:53 ` Hefty, Sean
[not found] ` <1828884A29C6694DAF28B7E6B8A82373A8FDDAFC-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-05-20 22:32 ` ira.weiny
2015-05-20 8:13 ` [PATCH 10/14] IB/mad: Add MAD size parameters to process_mad ira.weiny-ral2JQCrhuEAvxtiuMwx3w
[not found] ` <1432109615-19564-11-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-05-20 18:49 ` Jason Gunthorpe
[not found] ` <20150520184914.GI28496-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-05-21 20:44 ` ira.weiny
2015-05-20 8:13 ` [PATCH 11/14] IB/core: Add rdma_cap_opa_mad helper ira.weiny-ral2JQCrhuEAvxtiuMwx3w
[not found] ` <1432109615-19564-12-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-05-20 18:50 ` Jason Gunthorpe
2015-05-20 8:13 ` [PATCH 12/14] IB/mad: Add partial Intel OPA MAD support ira.weiny-ral2JQCrhuEAvxtiuMwx3w
2015-05-20 8:13 ` [PATCH 13/14] " ira.weiny-ral2JQCrhuEAvxtiuMwx3w
2015-05-20 8:13 ` [PATCH 14/14] IB/mad: Add final OPA MAD processing ira.weiny-ral2JQCrhuEAvxtiuMwx3w
[not found] ` <1432109615-19564-15-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-05-20 18:59 ` Jason Gunthorpe
[not found] ` <20150520185901.GK28496-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-05-21 16:23 ` ira.weiny
2015-05-20 21:11 ` Suri Shelvapille
[not found] ` <CY1PR03MB1440B98A7FE0A82E1BE53D75DEC20-DUcFgbLRNhB/HYnSB+xpdWP7xZHs9kq/vxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2015-05-20 21:26 ` ira.weiny
2015-05-28 7:03 ` [PATCH 00/14] IB/mad: Add support for " Or Gerlitz
2015-05-28 7:07 ` Or Gerlitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150521001251.GF22981@phlsvsds.ph.intel.com \
--to=ira.weiny-ral2jqcrhueavxtiumwx3w@public.gmane.org \
--cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=hal-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org \
--cc=jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).