From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org, Dan Carpenter <dan.carpenter@oracle.com>,
Peilin Ye <yepeilin.cs@gmail.com>,
Ursula Braun <ubraun@linux.ibm.com>,
"David S. Miller" <davem@davemloft.net>
Subject: [PATCH 5.8 07/16] net/smc: Prevent kernel-infoleak in __smc_diag_dump()
Date: Wed, 26 Aug 2020 14:02:44 +0200 [thread overview]
Message-ID: <20200826114911.583260809@linuxfoundation.org> (raw)
In-Reply-To: <20200826114911.216745274@linuxfoundation.org>
From: Peilin Ye <yepeilin.cs@gmail.com>
[ Upstream commit ce51f63e63c52a4e1eee4dd040fb0ba0af3b43ab ]
__smc_diag_dump() is potentially copying uninitialized kernel stack memory
into socket buffers, since the compiler may leave a 4-byte hole near the
beginning of `struct smcd_diag_dmbinfo`. Fix it by initializing `dinfo`
with memset().
Fixes: 4b1b7d3b30a6 ("net/smc: add SMC-D diag support")
Suggested-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Peilin Ye <yepeilin.cs@gmail.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/smc/smc_diag.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
--- a/net/smc/smc_diag.c
+++ b/net/smc/smc_diag.c
@@ -170,13 +170,15 @@ static int __smc_diag_dump(struct sock *
(req->diag_ext & (1 << (SMC_DIAG_DMBINFO - 1))) &&
!list_empty(&smc->conn.lgr->list)) {
struct smc_connection *conn = &smc->conn;
- struct smcd_diag_dmbinfo dinfo = {
- .linkid = *((u32 *)conn->lgr->id),
- .peer_gid = conn->lgr->peer_gid,
- .my_gid = conn->lgr->smcd->local_gid,
- .token = conn->rmb_desc->token,
- .peer_token = conn->peer_token
- };
+ struct smcd_diag_dmbinfo dinfo;
+
+ memset(&dinfo, 0, sizeof(dinfo));
+
+ dinfo.linkid = *((u32 *)conn->lgr->id);
+ dinfo.peer_gid = conn->lgr->peer_gid;
+ dinfo.my_gid = conn->lgr->smcd->local_gid;
+ dinfo.token = conn->rmb_desc->token;
+ dinfo.peer_token = conn->peer_token;
if (nla_put(skb, SMC_DIAG_DMBINFO, sizeof(dinfo), &dinfo) < 0)
goto errout;
next prev parent reply other threads:[~2020-08-26 12:03 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-26 12:02 [PATCH 5.8 00/16] 5.8.5-rc1 review Greg Kroah-Hartman
2020-08-26 12:02 ` [PATCH 5.8 01/16] gre6: Fix reception with IP6_TNL_F_RCV_DSCP_COPY Greg Kroah-Hartman
2020-08-26 12:02 ` [PATCH 5.8 02/16] net: Fix potential wrong skb->protocol in skb_vlan_untag() Greg Kroah-Hartman
2020-08-26 12:02 ` [PATCH 5.8 03/16] net: nexthop: dont allow empty NHA_GROUP Greg Kroah-Hartman
2020-08-26 12:02 ` [PATCH 5.8 04/16] net: qrtr: fix usage of idr in port assignment to socket Greg Kroah-Hartman
2020-08-26 12:02 ` [PATCH 5.8 05/16] net/sched: act_ct: Fix skb double-free in tcf_ct_handle_fragments() error flow Greg Kroah-Hartman
2020-08-26 12:02 ` [PATCH 5.8 06/16] net: sctp: Fix negotiation of the number of data streams Greg Kroah-Hartman
2020-08-26 12:02 ` Greg Kroah-Hartman [this message]
2020-08-26 12:02 ` [PATCH 5.8 08/16] tipc: call rcu_read_lock() in tipc_aead_encrypt_done() Greg Kroah-Hartman
2020-08-26 12:02 ` [PATCH 5.8 09/16] tipc: fix uninit skb->data in tipc_nl_compat_dumpit() Greg Kroah-Hartman
2020-08-26 12:02 ` [PATCH 5.8 10/16] net: ena: Make missed_tx stat incremental Greg Kroah-Hartman
2020-08-26 12:02 ` [PATCH 5.8 11/16] ethtool: Fix preserving of wanted feature bits in netlink interface Greg Kroah-Hartman
2020-08-26 12:02 ` [PATCH 5.8 12/16] ethtool: Account for hw_features " Greg Kroah-Hartman
2020-08-26 12:02 ` [PATCH 5.8 13/16] ethtool: Dont omit the netlink reply if no features were changed Greg Kroah-Hartman
2020-08-26 12:02 ` [PATCH 5.8 14/16] netlink: fix state reallocation in policy export Greg Kroah-Hartman
2020-08-26 12:02 ` [PATCH 5.8 15/16] io_uring: fix missing ->mm on exit Greg Kroah-Hartman
2020-08-26 12:02 ` [PATCH 5.8 16/16] binfmt_flat: revert "binfmt_flat: dont offset the data start" Greg Kroah-Hartman
2020-08-26 16:04 ` [PATCH 5.8 00/16] 5.8.5-rc1 review Jon Hunter
2020-08-27 7:32 ` Greg Kroah-Hartman
2020-08-26 20:58 ` Guenter Roeck
2020-08-27 7:32 ` Greg Kroah-Hartman
2020-08-27 7:59 ` Naresh Kamboju
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=20200826114911.583260809@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=dan.carpenter@oracle.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=ubraun@linux.ibm.com \
--cc=yepeilin.cs@gmail.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).