diff options
author | Jerry Jelinek <jerry.jelinek@joyent.com> | 2019-04-08 12:04:37 +0000 |
---|---|---|
committer | Jerry Jelinek <jerry.jelinek@joyent.com> | 2019-04-08 12:04:37 +0000 |
commit | cf5e484e4a5c4f2d361170e543095ddcc6707af4 (patch) | |
tree | 982ce9368a2f443c604e09f61698e3f3af47ebe3 /usr/src | |
parent | fa83485c3551a3fd3848f1535acb98b30c6595a2 (diff) | |
parent | 640abd28701e4370024630347e96eb61db782c91 (diff) | |
download | illumos-joyent-cf5e484e4a5c4f2d361170e543095ddcc6707af4.tar.gz |
[illumos-gate merge]
commit 640abd28701e4370024630347e96eb61db782c91
10698 SMB client fails to connect to MacOS server
commit 61b1125e034639ef3109056fe0679cfbb4da7e49
10692 df dumps core
commit 9af7e4843362db2afb8704b6c35c03c9dd4ea930
10637 rdsv3: NULL pointer errors
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/cmd/fs.d/df.c | 43 | ||||
-rw-r--r-- | usr/src/uts/common/fs/smbclnt/netsmb/smb_iod.c | 13 | ||||
-rw-r--r-- | usr/src/uts/common/io/ib/clients/rdsv3/info.c | 4 | ||||
-rw-r--r-- | usr/src/uts/common/io/ib/clients/rdsv3/rdsv3_impl.c | 14 |
4 files changed, 45 insertions, 29 deletions
diff --git a/usr/src/cmd/fs.d/df.c b/usr/src/cmd/fs.d/df.c index ee7bf6e7d5..0cbe5f3263 100644 --- a/usr/src/cmd/fs.d/df.c +++ b/usr/src/cmd/fs.d/df.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ +/* All Rights Reserved */ /* @@ -28,6 +28,7 @@ /* * Copyright 2016 Jason King + * Copyright 2019 Nexenta Systems, Inc. All rights reserved. */ #include <dlfcn.h> @@ -1154,18 +1155,26 @@ number_to_string( int unit_from, /* from units of this size */ int unit_to) /* to units of this size */ { - if ((long long)number == (long long)-1) + if ((long long)number == (long long)-1) { (void) strcpy(buf, "-1"); - else { - if (unit_from == unit_to) - (void) sprintf(buf, "%llu", number); - else if (unit_from < unit_to) - (void) sprintf(buf, "%llu", - number / (unsigned long long)(unit_to / unit_from)); - else - (void) sprintf(buf, "%llu", - number * (unsigned long long)(unit_from / unit_to)); + return (buf); } + + /* don't crash if, i.e. fsp->f_frsize == 0 */ + if (unit_from <= 0) + unit_from = 1; + if (unit_to <= 0) + unit_to = 1; + + if (unit_from == unit_to) + (void) sprintf(buf, "%llu", number); + else if (unit_from < unit_to) + (void) sprintf(buf, "%llu", + number / (unsigned long long)(unit_to / unit_from)); + else + (void) sprintf(buf, "%llu", + number * (unsigned long long)(unit_from / unit_to)); + return (buf); } @@ -1370,11 +1379,11 @@ k_output(struct df_request *dfrp, struct statvfs64 *fsp) fsblkcnt64_t free_blocks = fsp->f_bfree; fsblkcnt64_t available_blocks = fsp->f_bavail; fsblkcnt64_t used_blocks; - char *file_system = DFR_SPECIAL(dfrp); + char *file_system = DFR_SPECIAL(dfrp); numbuf_t total_blocks_buf; numbuf_t used_blocks_buf; numbuf_t available_blocks_buf; - char capacity_buf[LINEBUF_SIZE]; + char capacity_buf[LINEBUF_SIZE]; /* * If the free block count is -1, don't trust anything but the total @@ -1492,7 +1501,7 @@ k_output(struct df_request *dfrp, struct statvfs64 *fsp) * The following is for internationalization support. */ static bool_int strings_initialized; -static char *files_str; +static char *files_str; static char *blocks_str; static char *total_str; static char *kilobytes_str; @@ -1728,8 +1737,8 @@ create_request_list( struct df_request *requests; struct df_request *dfrp; size_t size; - size_t i; - size_t request_index = 0; + size_t i; + size_t request_index = 0; size_t max_requests; int errors = 0; @@ -1967,7 +1976,7 @@ do_df(int argc, char *argv[]) * arguments, the filesystem types must match * * XXX: the alternative of doing this check here is to - * invoke prune_list, but then we have to + * invoke prune_list, but then we have to * modify this code to ignore invalid requests. */ if (F_option && ! EQ(fstype, FSType)) { diff --git a/usr/src/uts/common/fs/smbclnt/netsmb/smb_iod.c b/usr/src/uts/common/fs/smbclnt/netsmb/smb_iod.c index 48c8ef591d..a8b050ba29 100644 --- a/usr/src/uts/common/fs/smbclnt/netsmb/smb_iod.c +++ b/usr/src/uts/common/fs/smbclnt/netsmb/smb_iod.c @@ -37,7 +37,7 @@ * Use is subject to license terms. * * Portions Copyright (C) 2001 - 2013 Apple Inc. All rights reserved. - * Copyright 2018 Nexenta Systems, Inc. All rights reserved. + * Copyright 2019 Nexenta Systems, Inc. All rights reserved. */ #ifdef DEBUG @@ -807,6 +807,13 @@ top: } /* + * SMB2 Negotiate may return zero credits_granted, + * in which case we should assume it granted one. + */ + if (command == SMB2_NEGOTIATE && credits_granted == 0) + credits_granted = 1; + + /* * Apply the credit grant */ rw_enter(&vcp->iod_rqlock, RW_WRITER); @@ -1423,12 +1430,12 @@ nsmb_iod_connect(struct smb_vc *vcp, cred_t *cr) val = 1; err = SMB_TRAN_SETPARAM(vcp, SMBTP_TCP_NODELAY, &val); if (err != 0) { - cmn_err(CE_NOTE, "iod_connect: setopt TCP_NODELAY, err=%d", err); + cmn_err(CE_NOTE, "iod_connect: setopt TCP_NODELAY err=%d", err); } val = smb_connect_timeout * 1000; err = SMB_TRAN_SETPARAM(vcp, SMBTP_TCP_CON_TMO, &val); if (err != 0) { - cmn_err(CE_NOTE, "iod_connect: setopt TCP con tmo, err=%d", err); + cmn_err(CE_NOTE, "iod_connect: setopt TCP con tmo err=%d", err); } /* diff --git a/usr/src/uts/common/io/ib/clients/rdsv3/info.c b/usr/src/uts/common/io/ib/clients/rdsv3/info.c index 9a14b7d2ab..cf5930945d 100644 --- a/usr/src/uts/common/io/ib/clients/rdsv3/info.c +++ b/usr/src/uts/common/io/ib/clients/rdsv3/info.c @@ -137,7 +137,7 @@ rdsv3_info_ioctl(struct rsock *sock, int optname, char *optval, RDSV3_DPRINTF4("rdsv3_info_ioctl", "optname: %d lenp: %llx datap: %llx", optname, arg.lenp, arg.datap); - if (arg.lenp == NULL) { + if (arg.lenp == (uintptr_t)NULL) { RDSV3_DPRINTF2("rdsv3_info_ioctl", "arg.lenp is NULL"); return (EFAULT); } @@ -156,7 +156,7 @@ rdsv3_info_ioctl(struct rsock *sock, int optname, char *optval, /* a 0 len call is just trying to probe its length */ if (ulen == 0) { iter.addr = NULL; - } else if (arg.datap == NULL) { + } else if (arg.datap == (uintptr_t)NULL) { RDSV3_DPRINTF2("rdsv3_info_ioctl", "arg.datap is NULL, ulen set to: %d", ulen); return (EINVAL); diff --git a/usr/src/uts/common/io/ib/clients/rdsv3/rdsv3_impl.c b/usr/src/uts/common/io/ib/clients/rdsv3/rdsv3_impl.c index 412e0a7db9..5cc3160b3a 100644 --- a/usr/src/uts/common/io/ib/clients/rdsv3/rdsv3_impl.c +++ b/usr/src/uts/common/io/ib/clients/rdsv3/rdsv3_impl.c @@ -69,7 +69,7 @@ ddi_taskq_t *rdsv3_taskq = NULL; extern kmem_cache_t *rdsv3_alloc_cache; -extern unsigned int ip_ocsum(ushort_t *address, int halfword_count, +extern unsigned int ip_ocsum(ushort_t *address, int halfword_count, unsigned int sum); /* @@ -81,7 +81,7 @@ rdsv3_capable_interface(struct lifreq *lifrp) char ifname[LIFNAMSIZ]; char drv[MAXLINKNAMELEN]; uint_t ppa; - char *cp; + char *cp; RDSV3_DPRINTF4("rdsv3_capable_interface", "Enter"); @@ -286,7 +286,7 @@ rdsv3_capable_interface_old(struct ifreq *ifrp) char ifname[IFNAMSIZ]; char drv[MAXLINKNAMELEN]; uint_t ppa; - char *cp; + char *cp; RDSV3_DPRINTF4("rdsv3_capable_interface_old", "Enter"); @@ -1093,7 +1093,7 @@ rdsv3_trans_init() int rdsv3_put_cmsg(struct nmsghdr *msg, int level, int type, size_t size, - void *payload) + void *payload) { struct cmsghdr *cp; char *bp; @@ -1300,13 +1300,13 @@ rdsv3_ib_free_hdrs(ib_device_t *dev, struct rdsv3_ib_connection *ic) ASSERT(ic->i_mr != NULL); ic->i_send_hdrs = NULL; - ic->i_send_hdrs_dma = NULL; + ic->i_send_hdrs_dma = 0; ic->i_recv_hdrs = NULL; - ic->i_recv_hdrs_dma = NULL; + ic->i_recv_hdrs_dma = 0; ic->i_ack = NULL; - ic->i_ack_dma = NULL; + ic->i_ack_dma = 0; (void) ibt_deregister_mr(ib_get_ibt_hca_hdl(dev), ic->i_mr->hdl); |