linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Jon Maloy <jon.maloy@ericsson.com>,
	"David S. Miller" <davem@davemloft.net>
Subject: [PATCH 4.19 11/42] tipc: dont assume linear buffer when reading ancillary data
Date: Wed, 21 Nov 2018 20:05:47 +0100	[thread overview]
Message-ID: <20181121183148.469188747@linuxfoundation.org> (raw)
In-Reply-To: <20181121183147.869199006@linuxfoundation.org>

4.19-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Jon Maloy <donmalo99@gmail.com>

[ Upstream commit 1c1274a56999fbdf9cf84e332b28448bb2d55221 ]

The code for reading ancillary data from a received buffer is assuming
the buffer is linear. To make this assumption true we have to linearize
the buffer before message data is read.

Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/tipc/socket.c |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -1548,16 +1548,17 @@ static void tipc_sk_set_orig_addr(struct
 /**
  * tipc_sk_anc_data_recv - optionally capture ancillary data for received message
  * @m: descriptor for message info
- * @msg: received message header
+ * @skb: received message buffer
  * @tsk: TIPC port associated with message
  *
  * Note: Ancillary data is not captured if not requested by receiver.
  *
  * Returns 0 if successful, otherwise errno
  */
-static int tipc_sk_anc_data_recv(struct msghdr *m, struct tipc_msg *msg,
+static int tipc_sk_anc_data_recv(struct msghdr *m, struct sk_buff *skb,
 				 struct tipc_sock *tsk)
 {
+	struct tipc_msg *msg;
 	u32 anc_data[3];
 	u32 err;
 	u32 dest_type;
@@ -1566,6 +1567,7 @@ static int tipc_sk_anc_data_recv(struct
 
 	if (likely(m->msg_controllen == 0))
 		return 0;
+	msg = buf_msg(skb);
 
 	/* Optionally capture errored message object(s) */
 	err = msg ? msg_errcode(msg) : 0;
@@ -1576,6 +1578,9 @@ static int tipc_sk_anc_data_recv(struct
 		if (res)
 			return res;
 		if (anc_data[1]) {
+			if (skb_linearize(skb))
+				return -ENOMEM;
+			msg = buf_msg(skb);
 			res = put_cmsg(m, SOL_TIPC, TIPC_RETDATA, anc_data[1],
 				       msg_data(msg));
 			if (res)
@@ -1737,9 +1742,10 @@ static int tipc_recvmsg(struct socket *s
 
 	/* Collect msg meta data, including error code and rejected data */
 	tipc_sk_set_orig_addr(m, skb);
-	rc = tipc_sk_anc_data_recv(m, hdr, tsk);
+	rc = tipc_sk_anc_data_recv(m, skb, tsk);
 	if (unlikely(rc))
 		goto exit;
+	hdr = buf_msg(skb);
 
 	/* Capture data if non-error msg, otherwise just set return value */
 	if (likely(!err)) {
@@ -1849,9 +1855,10 @@ static int tipc_recvstream(struct socket
 		/* Collect msg meta data, incl. error code and rejected data */
 		if (!copied) {
 			tipc_sk_set_orig_addr(m, skb);
-			rc = tipc_sk_anc_data_recv(m, hdr, tsk);
+			rc = tipc_sk_anc_data_recv(m, skb, tsk);
 			if (rc)
 				break;
+			hdr = buf_msg(skb);
 		}
 
 		/* Copy data if msg ok, otherwise return error/partial data */



  parent reply	other threads:[~2018-11-21 19:08 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-21 19:05 [PATCH 4.19 00/42] 4.19.4-stable review Greg Kroah-Hartman
2018-11-21 19:05 ` [PATCH 4.19 01/42] flow_dissector: do not dissect l4 ports for fragments Greg Kroah-Hartman
2018-11-21 19:05 ` [PATCH 4.19 02/42] ibmvnic: fix accelerated VLAN handling Greg Kroah-Hartman
2018-11-21 19:05 ` [PATCH 4.19 03/42] ip_tunnel: dont force DF when MTU is locked Greg Kroah-Hartman
2018-11-21 19:05 ` [PATCH 4.19 04/42] ipv6: fix a dst leak when removing its exception Greg Kroah-Hartman
2018-11-21 19:05 ` [PATCH 4.19 05/42] ipv6: Fix PMTU updates for UDP/raw sockets in presence of VRF Greg Kroah-Hartman
2018-11-21 19:05 ` [PATCH 4.19 06/42] net: bcmgenet: protect stop from timeout Greg Kroah-Hartman
2018-11-21 19:05 ` [PATCH 4.19 07/42] net-gro: reset skb->pkt_type in napi_reuse_skb() Greg Kroah-Hartman
2018-11-21 19:05 ` [PATCH 4.19 08/42] sctp: not allow to set asoc prsctp_enable by sockopt Greg Kroah-Hartman
2018-11-21 19:05 ` [PATCH 4.19 09/42] tcp: Fix SOF_TIMESTAMPING_RX_HARDWARE to use the latest timestamp during TCP coalescing Greg Kroah-Hartman
2018-11-21 19:05 ` [PATCH 4.19 10/42] tg3: Add PHY reset for 5717/5719/5720 in change ring and flow control paths Greg Kroah-Hartman
2018-11-21 19:05 ` Greg Kroah-Hartman [this message]
2018-11-21 19:05 ` [PATCH 4.19 12/42] tipc: fix lockdep warning when reinitilaizing sockets Greg Kroah-Hartman
2018-11-21 19:05 ` [PATCH 4.19 13/42] tuntap: fix multiqueue rx Greg Kroah-Hartman
2018-11-21 19:05 ` [PATCH 4.19 14/42] net: systemport: Protect stop from timeout Greg Kroah-Hartman
2018-11-21 19:05 ` [PATCH 4.19 15/42] net/sched: act_pedit: fix memory leak when IDR allocation fails Greg Kroah-Hartman
2018-11-21 19:05 ` [PATCH 4.19 16/42] net: sched: cls_flower: validate nested enc_opts_policy to avoid warning Greg Kroah-Hartman
2018-11-21 19:05 ` [PATCH 4.19 17/42] tipc: fix link re-establish failure Greg Kroah-Hartman
2018-11-21 19:05 ` [PATCH 4.19 18/42] net/mlx5e: Dont match on vlan non-existence if ethertype is wildcarded Greg Kroah-Hartman
2018-11-21 19:05 ` [PATCH 4.19 19/42] net/mlx5e: Claim TC hw offloads support only under a proper build config Greg Kroah-Hartman
2018-11-21 19:05 ` [PATCH 4.19 20/42] net/mlx5e: Adjust to max number of channles when re-attaching Greg Kroah-Hartman
2018-11-21 19:05 ` [PATCH 4.19 21/42] net/mlx5e: RX, verify received packet size in Linear Striding RQ Greg Kroah-Hartman
2018-11-21 19:05 ` [PATCH 4.19 22/42] Revert "sctp: remove sctp_transport_pmtu_check" Greg Kroah-Hartman
2018-11-21 19:05 ` [PATCH 4.19 23/42] net/mlx5e: Always use the match level enum when parsing TC rule match Greg Kroah-Hartman
2018-11-21 19:06 ` [PATCH 4.19 24/42] net/mlx5e: Fix selftest for small MTUs Greg Kroah-Hartman
2018-11-21 19:06 ` [PATCH 4.19 25/42] net/mlx5e: Removed unnecessary warnings in FEC caps query Greg Kroah-Hartman
2018-11-21 19:06 ` [PATCH 4.19 26/42] inet: frags: better deal with smp races Greg Kroah-Hartman
2018-11-21 19:06 ` [PATCH 4.19 27/42] l2tp: fix a sock refcnt leak in l2tp_tunnel_register Greg Kroah-Hartman
2018-11-21 19:06 ` [PATCH 4.19 28/42] net/mlx5: IPSec, Fix the SA context hash key Greg Kroah-Hartman
2018-11-21 19:06 ` [PATCH 4.19 29/42] net/mlx5e: IPoIB, Reset QP after channels are closed Greg Kroah-Hartman
2018-11-21 19:06 ` [PATCH 4.19 30/42] net: dsa: mv88e6xxx: Fix clearing of stats counters Greg Kroah-Hartman
2018-11-21 19:06 ` [PATCH 4.19 31/42] net: phy: realtek: fix RTL8201F sysfs name Greg Kroah-Hartman
2018-11-21 19:06 ` [PATCH 4.19 32/42] sctp: define SCTP_SS_DEFAULT for Stream schedulers Greg Kroah-Hartman
2018-11-21 19:06 ` [PATCH 4.19 33/42] net: qualcomm: rmnet: Fix incorrect assignment of real_dev Greg Kroah-Hartman
2018-11-21 19:06 ` [PATCH 4.19 34/42] net: dsa: microchip: initialize mutex before use Greg Kroah-Hartman
2018-11-21 19:06 ` [PATCH 4.19 35/42] sctp: fix strchange_flags name for Stream Change Event Greg Kroah-Hartman
2018-11-21 19:06 ` [PATCH 4.19 36/42] net: phy: mdio-gpio: Fix working over slow can_sleep GPIOs Greg Kroah-Hartman
2018-11-21 19:06 ` [PATCH 4.19 37/42] sctp: not increase streams incnt before sending addstrm_in request Greg Kroah-Hartman
2018-11-21 19:06 ` [PATCH 4.19 38/42] mlxsw: spectrum: Fix IP2ME CPU policer configuration Greg Kroah-Hartman
2018-11-21 19:06 ` [PATCH 4.19 39/42] net: smsc95xx: Fix MTU range Greg Kroah-Hartman
2018-11-21 19:06 ` [PATCH 4.19 40/42] rxrpc: Fix lockup due to no error backoff after ack transmit error Greg Kroah-Hartman
2018-11-21 19:06 ` [PATCH 4.19 41/42] usbnet: smsc95xx: disable carrier check while suspending Greg Kroah-Hartman
2018-11-21 19:06 ` [PATCH 4.19 42/42] Revert "x86/speculation: Enable cross-hyperthread spectre v2 STIBP mitigation" Greg Kroah-Hartman
2018-11-22  5:26 ` [PATCH 4.19 00/42] 4.19.4-stable review kernelci.org bot
2018-11-22  7:15 ` Harsh Shandilya
2018-11-22  8:24   ` Greg Kroah-Hartman
2018-11-22 16:36 ` Guenter Roeck
2018-11-23  7:16   ` Greg Kroah-Hartman
2018-11-22 20:53 ` Thomas Voegtle
2018-11-22 22:01   ` Thomas Voegtle
2018-11-22 22:30     ` Guenter Roeck
2018-11-23  6:52       ` Greg Kroah-Hartman
2018-11-23  7:45       ` Greg Kroah-Hartman
2018-11-23 12:06         ` Guenter Roeck
2018-11-23  6:51   ` Greg Kroah-Hartman
2018-11-23 15:40     ` Thomas Voegtle
2018-11-23 15:44       ` David Laight
2018-11-23  8:13 ` 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=20181121183148.469188747@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=davem@davemloft.net \
    --cc=jon.maloy@ericsson.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@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;
as well as URLs for NNTP newsgroup(s).