Print this page
12976 system panics with error in IP module
Reviewed by: Andy Fiddaman <andy@omniosce.org>
Reviewed by: Paul Winder <p.winder@me.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/inet/tcp/tcp_output.c
          +++ new/usr/src/uts/common/inet/tcp/tcp_output.c
↓ open down ↓ 14 lines elided ↑ open up ↑
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
  24   24   * Copyright (c) 2014, 2017 by Delphix. All rights reserved.
  25      - * Copyright 2019 Joyent, Inc.
       25 + * Copyright 2020 Joyent, Inc.
  26   26   */
  27   27  
  28   28  /* This file contains all TCP output processing functions. */
  29   29  
  30   30  #include <sys/types.h>
  31   31  #include <sys/stream.h>
  32   32  #include <sys/strsun.h>
  33   33  #include <sys/strsubr.h>
  34   34  #include <sys/stropts.h>
  35   35  #include <sys/strlog.h>
↓ open down ↓ 1634 lines elided ↑ open up ↑
1670 1670           * we should delay the su_closed upcall until all eagers have
1671 1671           * dropped their references.
1672 1672           */
1673 1673          if (!tcp->tcp_wait_for_eagers) {
1674 1674                  tcp->tcp_detached = B_TRUE;
1675 1675                  connp->conn_rq = NULL;
1676 1676                  connp->conn_wq = NULL;
1677 1677  
1678 1678                  /* non-STREAM socket, release the upper handle */
1679 1679                  if (IPCL_IS_NONSTR(connp)) {
1680      -                        ASSERT(connp->conn_upper_handle != NULL);
1681      -                        (*connp->conn_upcalls->su_closed)
1682      -                            (connp->conn_upper_handle);
     1680 +                        sock_upcalls_t *upcalls = connp->conn_upcalls;
     1681 +                        sock_upper_handle_t handle = connp->conn_upper_handle;
     1682 +
     1683 +                        ASSERT(upcalls != NULL);
     1684 +                        ASSERT(upcalls->su_closed != NULL);
     1685 +                        ASSERT(handle != NULL);
     1686 +                        /*
     1687 +                         * Set these to NULL first because closed() will free
     1688 +                         * upper structures.  Acquire conn_lock because an
     1689 +                         * external caller like conn_get_socket_info() will
     1690 +                         * upcall if these are non-NULL.
     1691 +                         */
     1692 +                        mutex_enter(&connp->conn_lock);
1683 1693                          connp->conn_upper_handle = NULL;
1684 1694                          connp->conn_upcalls = NULL;
     1695 +                        mutex_exit(&connp->conn_lock);
     1696 +                        upcalls->su_closed(handle);
1685 1697                  }
1686 1698          }
1687 1699  
1688 1700          /* Signal tcp_close() to finish closing. */
1689 1701          mutex_enter(&tcp->tcp_closelock);
1690 1702          tcp->tcp_closed = 1;
1691 1703          cv_signal(&tcp->tcp_closecv);
1692 1704          mutex_exit(&tcp->tcp_closelock);
1693 1705  }
1694 1706  
↓ open down ↓ 2046 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX