Whamcloud - gitweb
LU-10554 lnet: Remove LASSERT on userspace data 00/31100/3
authorSonia Sharma <Sonia.Sharma@intel.com>
Wed, 31 Jan 2018 10:49:19 +0000 (02:49 -0800)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 6 Feb 2018 04:30:40 +0000 (04:30 +0000)
If the net information is not provided while adding
NI, it results in an LBUG. Remove the LASSERT on
userspace input and handle it gracefully.

Test-Parameters: trivial
Change-Id: I9d2b6f94cb35e94bc81d5c52936d32cbf833e597
Signed-off-by: Sonia Sharma <sonia.sharma@intel.com>
Reviewed-on: https://review.whamcloud.com/31100
Tested-by: Jenkins
Reviewed-by: Amir Shehata <amir.shehata@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lnet/lnet/api-ni.c

index b3e3eed..59171f3 100644 (file)
@@ -1846,8 +1846,6 @@ lnet_startup_lndnet(struct lnet_net *net, struct lnet_lnd_tunables *tun)
        if (lnet_net_unique(net->net_id, &the_lnet.ln_nets, &net_l)) {
                lnd_type = LNET_NETTYP(net->net_id);
 
-               LASSERT(libcfs_isknown_lnd(lnd_type));
-
                mutex_lock(&the_lnet.ln_lnd_mutex);
                lnd = lnet_find_lnd_by_type(lnd_type);
 
@@ -2747,7 +2745,7 @@ int lnet_dyn_add_ni(struct lnet_ioctl_config_ni *conf)
        struct lnet_ni *ni;
        struct lnet_ioctl_config_lnd_tunables *tun = NULL;
        int rc, i;
-       __u32 net_id;
+       __u32 net_id, lnd_type;
 
        /* get the tunables if they are available */
        if (conf->lic_cfg_hdr.ioc_len >=
@@ -2761,6 +2759,12 @@ int lnet_dyn_add_ni(struct lnet_ioctl_config_ni *conf)
                                                  tun);
 
        net_id = LNET_NIDNET(conf->lic_nid);
+       lnd_type = LNET_NETTYP(net_id);
+
+       if (!libcfs_isknown_lnd(lnd_type)) {
+               CERROR("No valid net and lnd information provided\n");
+               return -EINVAL;
+       }
 
        net = lnet_net_alloc(net_id, NULL);
        if (!net)