svn commit: r283706 - stable/10/sys/netinet
Michael Tuexen
tuexen at FreeBSD.org
Fri May 29 11:47:55 UTC 2015
Author: tuexen
Date: Fri May 29 11:47:54 2015
New Revision: 283706
URL: https://svnweb.freebsd.org/changeset/base/283706
Log:
MFC r275967:
Fix and harmonize the validation of PR-SCTP policies.
Reported by: Coverity
CID: 1232044
Modified:
stable/10/sys/netinet/sctp_usrreq.c
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/sys/netinet/sctp_usrreq.c
==============================================================================
--- stable/10/sys/netinet/sctp_usrreq.c Fri May 29 11:43:51 2015 (r283705)
+++ stable/10/sys/netinet/sctp_usrreq.c Fri May 29 11:47:54 2015 (r283706)
@@ -3640,10 +3640,10 @@ flags_out:
policy = sprstat->sprstat_policy;
#if defined(SCTP_DETAILED_STR_STATS)
if ((stcb != NULL) &&
- (policy != SCTP_PR_SCTP_NONE) &&
(sid < stcb->asoc.streamoutcnt) &&
- ((policy == SCTP_PR_SCTP_ALL) ||
- (PR_SCTP_VALID_POLICY(policy)))) {
+ (policy != SCTP_PR_SCTP_NONE) &&
+ ((policy <= SCTP_PR_SCTP_MAX) ||
+ (policy == SCTP_PR_SCTP_ALL))) {
if (policy == SCTP_PR_SCTP_ALL) {
sprstat->sprstat_abandoned_unsent = stcb->asoc.strmout[sid].abandoned_unsent[0];
sprstat->sprstat_abandoned_sent = stcb->asoc.strmout[sid].abandoned_sent[0];
@@ -3653,8 +3653,8 @@ flags_out:
}
#else
if ((stcb != NULL) &&
- (policy == SCTP_PR_SCTP_ALL) &&
- (sid < stcb->asoc.streamoutcnt)) {
+ (sid < stcb->asoc.streamoutcnt) &&
+ (policy == SCTP_PR_SCTP_ALL)) {
sprstat->sprstat_abandoned_unsent = stcb->asoc.strmout[sid].abandoned_unsent[0];
sprstat->sprstat_abandoned_sent = stcb->asoc.strmout[sid].abandoned_sent[0];
#endif
@@ -3677,8 +3677,8 @@ flags_out:
policy = sprstat->sprstat_policy;
if ((stcb != NULL) &&
(policy != SCTP_PR_SCTP_NONE) &&
- ((policy == SCTP_PR_SCTP_ALL) ||
- (PR_SCTP_VALID_POLICY(policy)))) {
+ ((policy <= SCTP_PR_SCTP_MAX) ||
+ (policy == SCTP_PR_SCTP_ALL))) {
if (policy == SCTP_PR_SCTP_ALL) {
sprstat->sprstat_abandoned_unsent = stcb->asoc.abandoned_unsent[0];
sprstat->sprstat_abandoned_sent = stcb->asoc.abandoned_sent[0];
@@ -6042,7 +6042,7 @@ sctp_setopt(struct socket *so, int optna
SCTP_CHECK_AND_CAST(info, optval, struct sctp_default_prinfo, optsize);
SCTP_FIND_STCB(inp, stcb, info->pr_assoc_id);
- if (PR_SCTP_INVALID_POLICY(info->pr_policy)) {
+ if (info->pr_policy > SCTP_PR_SCTP_MAX) {
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
error = EINVAL;
break;
More information about the svn-src-stable-10
mailing list