From: Dan Carpenter <dan.carpenter@oracle.com>
To: Ursula Braun <ubraun@linux.vnet.ibm.com>
Cc: "David S. Miller" <davem@davemloft.net>,
linux-s390@vger.kernel.org, netdev@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [patch net-next] smc: some potential use after free bugs
Date: Thu, 26 Jan 2017 14:32:51 +0300 [thread overview]
Message-ID: <20170126113250.GM4201@mwanda> (raw)
In-Reply-To: <d66e8e35-0be7-ea04-6e1e-7c214cc6c50b@linux.vnet.ibm.com>
On Thu, Jan 26, 2017 at 12:23:02PM +0100, Ursula Braun wrote:
>
> On 01/26/2017 10:05 AM, Dan Carpenter wrote:
> > Say we got really unlucky and these failed on the last iteration, then
> > it could lead to a use after free bug.
> thanks for reporting this! I had already a similar patch prepared, but not
> yet submitted. It contains all your added lines plus these additional
> pre-initializations at definition time:
>
> @@ -509,7 +509,7 @@ int smc_sndbuf_create(struct smc_sock *smc)
> struct smc_connection *conn = &smc->conn;
> struct smc_link_group *lgr = conn->lgr;
> int tmp_bufsize, tmp_bufsize_short;
> - struct smc_buf_desc *sndbuf_desc;
> + struct smc_buf_desc *sndbuf_desc = NULL;
> int rc;
>
> /* use socket send buffer size (w/o overhead) as start value */
>
> @@ -573,7 +575,7 @@ int smc_rmb_create(struct smc_sock *smc)
> struct smc_connection *conn = &smc->conn;
> struct smc_link_group *lgr = conn->lgr;
> int tmp_bufsize, tmp_bufsize_short;
> - struct smc_buf_desc *rmb_desc;
> + struct smc_buf_desc *rmb_desc = NULL;
> int rc;
>
> /* use socket recv buffer size (w/o overhead) as start value */
>
> If you do not contradict, I will post my enhanced patch version.
Those are obviously harmless changes...
My static checker knows those aren't required so it doesn't complain
about uninitialized variables. But not all static analysis tools are as
clever. ;)
regards,
dan carpenter
prev parent reply other threads:[~2017-01-26 11:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-26 9:05 [patch net-next] smc: some potential use after free bugs Dan Carpenter
2017-01-26 11:23 ` Ursula Braun
2017-01-26 11:32 ` Dan Carpenter [this message]
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=20170126113250.GM4201@mwanda \
--to=dan.carpenter@oracle.com \
--cc=davem@davemloft.net \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=ubraun@linux.vnet.ibm.com \
/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;
as well as URLs for NNTP newsgroup(s).