From: "D. Wythe" <alibuda@linux.alibaba.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
Karsten Graul <kgraul@linux.ibm.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
linux-s390@vger.kernel.org, netdev@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH net-next] net/smc: unlock on error paths in __smc_setsockopt()
Date: Sat, 19 Feb 2022 15:05:27 +0800 [thread overview]
Message-ID: <89147077-fadc-e5fc-ce91-0f3d4403c5f2@linux.alibaba.com> (raw)
In-Reply-To: <20220218153259.GA4392@kili>
在 2022/2/18 下午11:32, Dan Carpenter 写道:
> These two error paths need to release_sock(sk) before returning.
>
> Fixes: a6a6fe27bab4 ("net/smc: Dynamic control handshake limitation by socket options")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> net/smc/af_smc.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
> index d873afe2d4dc..38faf2b60327 100644
> --- a/net/smc/af_smc.c
> +++ b/net/smc/af_smc.c
> @@ -2715,10 +2715,14 @@ static int __smc_setsockopt(struct socket *sock, int level, int optname,
> lock_sock(sk);
> switch (optname) {
> case SMC_LIMIT_HS:
> - if (optlen < sizeof(int))
> - return -EINVAL;
> - if (copy_from_sockptr(&val, optval, sizeof(int)))
> - return -EFAULT;
> + if (optlen < sizeof(int)) {
> + rc = -EINVAL;
> + break;
> + }
> + if (copy_from_sockptr(&val, optval, sizeof(int))) {
> + rc = -EFAULT;
> + break;
> + }
>
> smc->limit_smc_hs = !!val;
> rc = 0;
My mistake... thanks for your fixes.
Reviewed-by: D. Wythe <alibuda@linux.alibaba.com>
next prev parent reply other threads:[~2022-02-19 7:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-18 15:32 [PATCH net-next] net/smc: unlock on error paths in __smc_setsockopt() Dan Carpenter
2022-02-19 7:05 ` D. Wythe [this message]
2022-02-19 19:00 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=89147077-fadc-e5fc-ce91-0f3d4403c5f2@linux.alibaba.com \
--to=alibuda@linux.alibaba.com \
--cc=dan.carpenter@oracle.com \
--cc=davem@davemloft.net \
--cc=kernel-janitors@vger.kernel.org \
--cc=kgraul@linux.ibm.com \
--cc=kuba@kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox