From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ursula Braun Subject: Re: [PATCH net-next] net/smc: fix error return code in smc_setsockopt() Date: Fri, 1 Jun 2018 09:02:36 +0200 Message-ID: <34306217-624d-2aa0-0e8a-64867711029b@linux.ibm.com> References: <1527733882-149144-1-git-send-email-weiyongjun1@huawei.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: linux-s390@vger.kernel.org, netdev@vger.kernel.org, kernel-janitors@vger.kernel.org To: Wei Yongjun Return-path: Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:44122 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750805AbeFAHCn (ORCPT ); Fri, 1 Jun 2018 03:02:43 -0400 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w51704I5005443 for ; Fri, 1 Jun 2018 03:02:42 -0400 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0a-001b2d01.pphosted.com with ESMTP id 2jayhwc84p-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 01 Jun 2018 03:02:42 -0400 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 1 Jun 2018 08:02:40 +0100 In-Reply-To: <1527733882-149144-1-git-send-email-weiyongjun1@huawei.com> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 05/31/2018 04:31 AM, Wei Yongjun wrote: > Fix to return error code -EINVAL instead of 0 if optlen is invalid. > > Fixes: 01d2f7e2cdd3 ("net/smc: sockopts TCP_NODELAY and TCP_CORK") > Signed-off-by: Wei Yongjun > --- > net/smc/af_smc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c > index 2c369d4..973b447 100644 > --- a/net/smc/af_smc.c > +++ b/net/smc/af_smc.c > @@ -1420,7 +1420,7 @@ static int smc_setsockopt(struct socket *sock, int level, int optname, > return rc; > > if (optlen < sizeof(int)) > - return rc; > + return -EINVAL; > get_user(val, (int __user *)optval); > > lock_sock(sk); > Thanks for reporting this error. Your fix is fine, but I think we can get rid of this check at all, since it is already checked in the tcp-code invoked before with smc->clcsock->ops->setsockopt(smc->clcsock, level, optname, optval, optlen) From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ursula Braun Date: Fri, 01 Jun 2018 07:02:36 +0000 Subject: Re: [PATCH net-next] net/smc: fix error return code in smc_setsockopt() Message-Id: <34306217-624d-2aa0-0e8a-64867711029b@linux.ibm.com> List-Id: References: <1527733882-149144-1-git-send-email-weiyongjun1@huawei.com> In-Reply-To: <1527733882-149144-1-git-send-email-weiyongjun1@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Wei Yongjun Cc: linux-s390@vger.kernel.org, netdev@vger.kernel.org, kernel-janitors@vger.kernel.org On 05/31/2018 04:31 AM, Wei Yongjun wrote: > Fix to return error code -EINVAL instead of 0 if optlen is invalid. > > Fixes: 01d2f7e2cdd3 ("net/smc: sockopts TCP_NODELAY and TCP_CORK") > Signed-off-by: Wei Yongjun > --- > net/smc/af_smc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c > index 2c369d4..973b447 100644 > --- a/net/smc/af_smc.c > +++ b/net/smc/af_smc.c > @@ -1420,7 +1420,7 @@ static int smc_setsockopt(struct socket *sock, int level, int optname, > return rc; > > if (optlen < sizeof(int)) > - return rc; > + return -EINVAL; > get_user(val, (int __user *)optval); > > lock_sock(sk); > Thanks for reporting this error. Your fix is fine, but I think we can get rid of this check at all, since it is already checked in the tcp-code invoked before with smc->clcsock->ops->setsockopt(smc->clcsock, level, optname, optval, optlen)