On Fri, Jul 13, 2018 at 01:26:29PM +0300, Kamal Heib wrote: > Make sure the providers implement the verbs callbacks before calling > them, otherwise return -EOPNOTSUPP. > > Signed-off-by: Kamal Heib <kamalheib1@xxxxxxxxx> > drivers/infiniband/core/mad.c | 10 ++++++---- > drivers/infiniband/core/uverbs_cmd.c | 3 ++- > drivers/infiniband/core/verbs.c | 6 ++++++ > 3 files changed, 14 insertions(+), 5 deletions(-) > > diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c > index 34e9b2768324..e528387605c8 100644 > +++ b/drivers/infiniband/core/mad.c > @@ -882,10 +882,12 @@ static int handle_outgoing_dr_smp(struct ib_mad_agent_private *mad_agent_priv, > } > > /* No GRH for DR SMP */ > - ret = device->process_mad(device, 0, port_num, &mad_wc, NULL, > - (const struct ib_mad_hdr *)smp, mad_size, > - (struct ib_mad_hdr *)mad_priv->mad, > - &mad_size, &out_mad_pkey_index); > + ret = device->process_mad ? > + device->process_mad(device, 0, port_num, &mad_wc, NULL, > + (const struct ib_mad_hdr *)smp, mad_size, > + (struct ib_mad_hdr *)mad_priv->mad, > + &mad_size, &out_mad_pkey_index) : > + -EOPNOTSUPP; And this shouldn't be needed here, though I'm not entirely show how come.. iwarp devices should be blocked form using umad entirely. Maybe ib_create_send_mad() should fail if process_mad isn't defined? Not sure. Do all rocee and IB drivers define it? Jason -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html