Re: [PATCH v1] SUNRPC: Augment server-side rpcgss tracepoints

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Chuck,

url:    https://github.com/0day-ci/linux/commits/Chuck-Lever/SUNRPC-Augment-server-side-rpcgss-tracepoints/20200623-050035
base:   git://git.linux-nfs.org/projects/trondmy/linux-nfs.git linux-next
config: x86_64-randconfig-m001-20200622 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

New smatch warnings:
net/sunrpc/auth_gss/svcauth_gss.c:1669 svcauth_gss_accept() error: uninitialized symbol 'gc'.

Old smatch warnings:
net/sunrpc/auth_gss/svcauth_gss.c:782 gss_write_verf() warn: returning -1 instead of -ENOMEM is sloppy

# https://github.com/0day-ci/linux/commit/af0f25db1397607ba75ceb1ce13c2b1419d2b156
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout af0f25db1397607ba75ceb1ce13c2b1419d2b156
vim +/gc +1669 net/sunrpc/auth_gss/svcauth_gss.c

^1da177e4c3f41 Linus Torvalds       2005-04-16  1521  static int
d8ed029d6000ba Alexey Dobriyan      2006-09-26  1522  svcauth_gss_accept(struct svc_rqst *rqstp, __be32 *authp)
^1da177e4c3f41 Linus Torvalds       2005-04-16  1523  {
^1da177e4c3f41 Linus Torvalds       2005-04-16  1524  	struct kvec	*argv = &rqstp->rq_arg.head[0];
^1da177e4c3f41 Linus Torvalds       2005-04-16  1525  	struct kvec	*resv = &rqstp->rq_res.head[0];
^1da177e4c3f41 Linus Torvalds       2005-04-16  1526  	u32		crlen;
^1da177e4c3f41 Linus Torvalds       2005-04-16  1527  	struct gss_svc_data *svcdata = rqstp->rq_auth_data;
^1da177e4c3f41 Linus Torvalds       2005-04-16  1528  	struct rpc_gss_wire_cred *gc;
                                                                                  ^^

^1da177e4c3f41 Linus Torvalds       2005-04-16  1529  	struct rsc	*rsci = NULL;
d8ed029d6000ba Alexey Dobriyan      2006-09-26  1530  	__be32		*rpcstart;
d8ed029d6000ba Alexey Dobriyan      2006-09-26  1531  	__be32		*reject_stat = resv->iov_base + resv->iov_len;
^1da177e4c3f41 Linus Torvalds       2005-04-16  1532  	int		ret;
b8be5674fa9a6f Vasily Averin        2018-12-24  1533  	struct sunrpc_net *sn = net_generic(SVC_NET(rqstp), sunrpc_net_id);
^1da177e4c3f41 Linus Torvalds       2005-04-16  1534  
^1da177e4c3f41 Linus Torvalds       2005-04-16  1535  	*authp = rpc_autherr_badcred;
^1da177e4c3f41 Linus Torvalds       2005-04-16  1536  	if (!svcdata)
^1da177e4c3f41 Linus Torvalds       2005-04-16  1537  		svcdata = kmalloc(sizeof(*svcdata), GFP_KERNEL);
^1da177e4c3f41 Linus Torvalds       2005-04-16  1538  	if (!svcdata)
^1da177e4c3f41 Linus Torvalds       2005-04-16  1539  		goto auth_err;
                                                                ^^^^^^^^^^^^^

^1da177e4c3f41 Linus Torvalds       2005-04-16  1540  	rqstp->rq_auth_data = svcdata;
5b304bc5bfccc8 J.Bruce Fields       2006-10-04  1541  	svcdata->verf_start = NULL;
^1da177e4c3f41 Linus Torvalds       2005-04-16  1542  	svcdata->rsci = NULL;
^1da177e4c3f41 Linus Torvalds       2005-04-16  1543  	gc = &svcdata->clcred;
^1da177e4c3f41 Linus Torvalds       2005-04-16  1544  
^1da177e4c3f41 Linus Torvalds       2005-04-16  1545  	/* start of rpc packet is 7 u32's back from here:
^1da177e4c3f41 Linus Torvalds       2005-04-16  1546  	 * xid direction rpcversion prog vers proc flavour
^1da177e4c3f41 Linus Torvalds       2005-04-16  1547  	 */
^1da177e4c3f41 Linus Torvalds       2005-04-16  1548  	rpcstart = argv->iov_base;
^1da177e4c3f41 Linus Torvalds       2005-04-16  1549  	rpcstart -= 7;
^1da177e4c3f41 Linus Torvalds       2005-04-16  1550  
^1da177e4c3f41 Linus Torvalds       2005-04-16  1551  	/* credential is:
^1da177e4c3f41 Linus Torvalds       2005-04-16  1552  	 *   version(==1), proc(0,1,2,3), seq, service (1,2,3), handle
25985edcedea63 Lucas De Marchi      2011-03-30  1553  	 * at least 5 u32s, and is preceded by length, so that makes 6.
^1da177e4c3f41 Linus Torvalds       2005-04-16  1554  	 */
^1da177e4c3f41 Linus Torvalds       2005-04-16  1555  
^1da177e4c3f41 Linus Torvalds       2005-04-16  1556  	if (argv->iov_len < 5 * 4)
^1da177e4c3f41 Linus Torvalds       2005-04-16  1557  		goto auth_err;
7699431301b189 Alexey Dobriyan      2006-09-26  1558  	crlen = svc_getnl(argv);
7699431301b189 Alexey Dobriyan      2006-09-26  1559  	if (svc_getnl(argv) != RPC_GSS_VERSION)
^1da177e4c3f41 Linus Torvalds       2005-04-16  1560  		goto auth_err;
7699431301b189 Alexey Dobriyan      2006-09-26  1561  	gc->gc_proc = svc_getnl(argv);
7699431301b189 Alexey Dobriyan      2006-09-26  1562  	gc->gc_seq = svc_getnl(argv);
7699431301b189 Alexey Dobriyan      2006-09-26  1563  	gc->gc_svc = svc_getnl(argv);
^1da177e4c3f41 Linus Torvalds       2005-04-16  1564  	if (svc_safe_getnetobj(argv, &gc->gc_ctx))
^1da177e4c3f41 Linus Torvalds       2005-04-16  1565  		goto auth_err;
^1da177e4c3f41 Linus Torvalds       2005-04-16  1566  	if (crlen != round_up_to_quad(gc->gc_ctx.len) + 5 * 4)
^1da177e4c3f41 Linus Torvalds       2005-04-16  1567  		goto auth_err;
^1da177e4c3f41 Linus Torvalds       2005-04-16  1568  
^1da177e4c3f41 Linus Torvalds       2005-04-16  1569  	if ((gc->gc_proc != RPC_GSS_PROC_DATA) && (rqstp->rq_proc != 0))
^1da177e4c3f41 Linus Torvalds       2005-04-16  1570  		goto auth_err;
^1da177e4c3f41 Linus Torvalds       2005-04-16  1571  
^1da177e4c3f41 Linus Torvalds       2005-04-16  1572  	*authp = rpc_autherr_badverf;
^1da177e4c3f41 Linus Torvalds       2005-04-16  1573  	switch (gc->gc_proc) {
^1da177e4c3f41 Linus Torvalds       2005-04-16  1574  	case RPC_GSS_PROC_INIT:
^1da177e4c3f41 Linus Torvalds       2005-04-16  1575  	case RPC_GSS_PROC_CONTINUE_INIT:
030d794bf49855 Simo Sorce           2012-05-25  1576  		if (use_gss_proxy(SVC_NET(rqstp)))
030d794bf49855 Simo Sorce           2012-05-25  1577  			return svcauth_gss_proxy_init(rqstp, gc, authp);
030d794bf49855 Simo Sorce           2012-05-25  1578  		else
030d794bf49855 Simo Sorce           2012-05-25  1579  			return svcauth_gss_legacy_init(rqstp, gc, authp);
^1da177e4c3f41 Linus Torvalds       2005-04-16  1580  	case RPC_GSS_PROC_DATA:
^1da177e4c3f41 Linus Torvalds       2005-04-16  1581  	case RPC_GSS_PROC_DESTROY:
21fcd02be34f73 J. Bruce Fields      2007-08-09  1582  		/* Look up the context, and check the verifier: */
^1da177e4c3f41 Linus Torvalds       2005-04-16  1583  		*authp = rpcsec_gsserr_credproblem;
a1db410d0bbadc Stanislav Kinsbursky 2012-01-19  1584  		rsci = gss_svc_searchbyctx(sn->rsc_cache, &gc->gc_ctx);
^1da177e4c3f41 Linus Torvalds       2005-04-16  1585  		if (!rsci)
^1da177e4c3f41 Linus Torvalds       2005-04-16  1586  			goto auth_err;
^1da177e4c3f41 Linus Torvalds       2005-04-16  1587  		switch (gss_verify_header(rqstp, rsci, rpcstart, gc, authp)) {
^1da177e4c3f41 Linus Torvalds       2005-04-16  1588  		case SVC_OK:
^1da177e4c3f41 Linus Torvalds       2005-04-16  1589  			break;
^1da177e4c3f41 Linus Torvalds       2005-04-16  1590  		case SVC_DENIED:
^1da177e4c3f41 Linus Torvalds       2005-04-16  1591  			goto auth_err;
^1da177e4c3f41 Linus Torvalds       2005-04-16  1592  		case SVC_DROP:
^1da177e4c3f41 Linus Torvalds       2005-04-16  1593  			goto drop;
^1da177e4c3f41 Linus Torvalds       2005-04-16  1594  		}
^1da177e4c3f41 Linus Torvalds       2005-04-16  1595  		break;
^1da177e4c3f41 Linus Torvalds       2005-04-16  1596  	default:
^1da177e4c3f41 Linus Torvalds       2005-04-16  1597  		*authp = rpc_autherr_rejectedcred;
^1da177e4c3f41 Linus Torvalds       2005-04-16  1598  		goto auth_err;
^1da177e4c3f41 Linus Torvalds       2005-04-16  1599  	}
^1da177e4c3f41 Linus Torvalds       2005-04-16  1600  
^1da177e4c3f41 Linus Torvalds       2005-04-16  1601  	/* now act upon the command: */
^1da177e4c3f41 Linus Torvalds       2005-04-16  1602  	switch (gc->gc_proc) {
^1da177e4c3f41 Linus Torvalds       2005-04-16  1603  	case RPC_GSS_PROC_DESTROY:
c5e434c98b49f4 Wei Yongjun          2007-05-09  1604  		if (gss_write_verf(rqstp, rsci->mechctx, gc->gc_seq))
c5e434c98b49f4 Wei Yongjun          2007-05-09  1605  			goto auth_err;
2b477c00f3bd87 Neil Brown           2016-12-22  1606  		/* Delete the entry from the cache_list and call cache_put */
2b477c00f3bd87 Neil Brown           2016-12-22  1607  		sunrpc_cache_unhash(sn->rsc_cache, &rsci->h);
^1da177e4c3f41 Linus Torvalds       2005-04-16  1608  		if (resv->iov_len + 4 > PAGE_SIZE)
^1da177e4c3f41 Linus Torvalds       2005-04-16  1609  			goto drop;
7699431301b189 Alexey Dobriyan      2006-09-26  1610  		svc_putnl(resv, RPC_SUCCESS);
^1da177e4c3f41 Linus Torvalds       2005-04-16  1611  		goto complete;
^1da177e4c3f41 Linus Torvalds       2005-04-16  1612  	case RPC_GSS_PROC_DATA:
^1da177e4c3f41 Linus Torvalds       2005-04-16  1613  		*authp = rpcsec_gsserr_ctxproblem;
5b304bc5bfccc8 J.Bruce Fields       2006-10-04  1614  		svcdata->verf_start = resv->iov_base + resv->iov_len;
^1da177e4c3f41 Linus Torvalds       2005-04-16  1615  		if (gss_write_verf(rqstp, rsci->mechctx, gc->gc_seq))
^1da177e4c3f41 Linus Torvalds       2005-04-16  1616  			goto auth_err;
^1da177e4c3f41 Linus Torvalds       2005-04-16  1617  		rqstp->rq_cred = rsci->cred;
^1da177e4c3f41 Linus Torvalds       2005-04-16  1618  		get_group_info(rsci->cred.cr_group_info);
^1da177e4c3f41 Linus Torvalds       2005-04-16  1619  		*authp = rpc_autherr_badcred;
^1da177e4c3f41 Linus Torvalds       2005-04-16  1620  		switch (gc->gc_svc) {
^1da177e4c3f41 Linus Torvalds       2005-04-16  1621  		case RPC_GSS_SVC_NONE:
^1da177e4c3f41 Linus Torvalds       2005-04-16  1622  			break;
^1da177e4c3f41 Linus Torvalds       2005-04-16  1623  		case RPC_GSS_SVC_INTEGRITY:
b620754bfeb8b0 J. Bruce Fields      2008-07-03  1624  			/* placeholders for length and seq. number: */
b620754bfeb8b0 J. Bruce Fields      2008-07-03  1625  			svc_putnl(resv, 0);
b620754bfeb8b0 J. Bruce Fields      2008-07-03  1626  			svc_putnl(resv, 0);
4c190e2f913f03 Jeff Layton          2013-02-06  1627  			if (unwrap_integ_data(rqstp, &rqstp->rq_arg,
^1da177e4c3f41 Linus Torvalds       2005-04-16  1628  					gc->gc_seq, rsci->mechctx))
dd35210e1e2cb4 Harshula Jayasuriya  2008-02-20  1629  				goto garbage_args;
a5cddc885b9945 J. Bruce Fields      2014-05-12  1630  			rqstp->rq_auth_slack = RPC_MAX_AUTH_SIZE;
b620754bfeb8b0 J. Bruce Fields      2008-07-03  1631  			break;
b620754bfeb8b0 J. Bruce Fields      2008-07-03  1632  		case RPC_GSS_SVC_PRIVACY:
^1da177e4c3f41 Linus Torvalds       2005-04-16  1633  			/* placeholders for length and seq. number: */
7699431301b189 Alexey Dobriyan      2006-09-26  1634  			svc_putnl(resv, 0);
7699431301b189 Alexey Dobriyan      2006-09-26  1635  			svc_putnl(resv, 0);
7c9fdcfb1b64c4 J. Bruce Fields      2006-06-30  1636  			if (unwrap_priv_data(rqstp, &rqstp->rq_arg,
7c9fdcfb1b64c4 J. Bruce Fields      2006-06-30  1637  					gc->gc_seq, rsci->mechctx))
dd35210e1e2cb4 Harshula Jayasuriya  2008-02-20  1638  				goto garbage_args;
a5cddc885b9945 J. Bruce Fields      2014-05-12  1639  			rqstp->rq_auth_slack = RPC_MAX_AUTH_SIZE * 2;
7c9fdcfb1b64c4 J. Bruce Fields      2006-06-30  1640  			break;
^1da177e4c3f41 Linus Torvalds       2005-04-16  1641  		default:
^1da177e4c3f41 Linus Torvalds       2005-04-16  1642  			goto auth_err;
^1da177e4c3f41 Linus Torvalds       2005-04-16  1643  		}
^1da177e4c3f41 Linus Torvalds       2005-04-16  1644  		svcdata->rsci = rsci;
^1da177e4c3f41 Linus Torvalds       2005-04-16  1645  		cache_get(&rsci->h);
d5497fc693a446 J. Bruce Fields      2012-05-14  1646  		rqstp->rq_cred.cr_flavor = gss_svc_to_pseudoflavor(
83523d083a045a Chuck Lever          2013-03-16  1647  					rsci->mechctx->mech_type,
83523d083a045a Chuck Lever          2013-03-16  1648  					GSS_C_QOP_DEFAULT,
83523d083a045a Chuck Lever          2013-03-16  1649  					gc->gc_svc);
^1da177e4c3f41 Linus Torvalds       2005-04-16  1650  		ret = SVC_OK;
^1da177e4c3f41 Linus Torvalds       2005-04-16  1651  		goto out;
^1da177e4c3f41 Linus Torvalds       2005-04-16  1652  	}
dd35210e1e2cb4 Harshula Jayasuriya  2008-02-20  1653  garbage_args:
dd35210e1e2cb4 Harshula Jayasuriya  2008-02-20  1654  	ret = SVC_GARBAGE;
dd35210e1e2cb4 Harshula Jayasuriya  2008-02-20  1655  	goto out;
^1da177e4c3f41 Linus Torvalds       2005-04-16  1656  auth_err:
21fcd02be34f73 J. Bruce Fields      2007-08-09  1657  	/* Restore write pointer to its original value: */
^1da177e4c3f41 Linus Torvalds       2005-04-16  1658  	xdr_ressize_check(rqstp, reject_stat);
^1da177e4c3f41 Linus Torvalds       2005-04-16  1659  	ret = SVC_DENIED;
^1da177e4c3f41 Linus Torvalds       2005-04-16  1660  	goto out;
^1da177e4c3f41 Linus Torvalds       2005-04-16  1661  complete:
^1da177e4c3f41 Linus Torvalds       2005-04-16  1662  	ret = SVC_COMPLETE;
^1da177e4c3f41 Linus Torvalds       2005-04-16  1663  	goto out;
^1da177e4c3f41 Linus Torvalds       2005-04-16  1664  drop:
4d712ef1db05c3 Chuck Lever          2016-11-29  1665  	ret = SVC_CLOSE;
^1da177e4c3f41 Linus Torvalds       2005-04-16  1666  out:
^1da177e4c3f41 Linus Torvalds       2005-04-16  1667  	if (rsci)
a1db410d0bbadc Stanislav Kinsbursky 2012-01-19  1668  		cache_put(&rsci->h, sn->rsc_cache);
af0f25db139760 Chuck Lever          2020-06-22 @1669  	trace_rpcgss_svc_authenticate(rqstp, gc);
                                                                                             ^^
Uninitialized.

^1da177e4c3f41 Linus Torvalds       2005-04-16  1670  	return ret;
^1da177e4c3f41 Linus Torvalds       2005-04-16  1671  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux