Uploaded image for project: 'Lustre'
  1. Lustre
  2. LU-18997

lnet_sock_create may return NULL on error

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • Lustre 2.17.0
    • Lustre 2.17.0
    • 3
    • 9223372036854775807

      smatch highlighter that lnet_sock_create() has a path that tries to return ERR_PTR(0) which is NULL, that would break the callers expecting PTR_ERR:

                               if (interface >= 0 && remaddr) {
                                      struct sockaddr_in6 *rem = (void *)remaddr;
                                      struct net_device *dev;                                rcu_read_lock();
                                      dev = dev_get_by_index_rcu(ns, interface);
                                      if (!dev) {
                                              CERROR("No net device for interface %d\n",
                                                     interface);
                                              rcu_read_unlock();
                                              goto failed;
                                      }
      
      ...
      failed:
              sock_release(sock);
              return ERR_PTR(rc);
      }

      Introduced by https://review.whamcloud.com/c/fs/lustre-release/+/55582

            simmonsja James A Simmons
            green Oleg Drokin
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: