Skip to contentSkip to conversation

net/af_iucv: fix virtual vs physical address confusion

PATCH Applied Alexander Gordeev 4 participants 6 messages Feb 15, 2024 – Feb 23, 2024

Subsystems (4)
lore
Share & tools
lore

Alexander Gordeev

author maintainer
#0 lore raw

PATCH 1/1 net/af_iucv: fix virtual vs physical address confusion

Fix virtual vs physical address confusion. This does not fix a bug since virtual and physical address spaces are currently the same.

---
 net/iucv/af_iucv.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
net/iucv/af_iucv.c +4 -6
index 498a0c35b7bb..4aa1c72e6c49 100644
@@ -1060,13 +1060,12 @@ static int iucv_sock_sendmsg(struct socket *sock, struct msghdr *msg,
 			int i;
 
 			/* skip iucv_array lying in the headroom */
-			iba[0].address = (u32)(addr_t)skb->data;
+			iba[0].address = (u32)virt_to_phys(skb->data);
 			iba[0].length = (u32)skb_headlen(skb);
 			for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
 				skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
 
-				iba[i + 1].address =
-					(u32)(addr_t)skb_frag_address(frag);
+				iba[i + 1].address = (u32)virt_to_phys(skb_frag_address(frag));
 				iba[i + 1].length = (u32)skb_frag_size(frag);
 			}
 			err = pr_iucv->message_send(iucv->path, &txmsg,
@@ -1162,13 +1161,12 @@ static void iucv_process_message(struct sock *sk, struct sk_buff *skb,
 			struct iucv_array *iba = (struct iucv_array *)skb->head;
 			int i;
 
-			iba[0].address = (u32)(addr_t)skb->data;
+			iba[0].address = (u32)virt_to_phys(skb->data);
 			iba[0].length = (u32)skb_headlen(skb);
 			for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
 				skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
 
-				iba[i + 1].address =
-					(u32)(addr_t)skb_frag_address(frag);
+				iba[i + 1].address = (u32)virt_to_phys(skb_frag_address(frag));
 				iba[i + 1].length = (u32)skb_frag_size(frag);
 			}
 			rc = pr_iucv->message_receive(path, msg,
Signature · 1 line
2.40.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 34 lines · Alexander Gordeev

Fix virtual vs physical address confusion. This does not fix a bug since virtual and physical address spaces are currently the same.

---
 net/iucv/af_iucv.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
net/iucv/af_iucv.c +3 -4
index 498a0c35b7bb..4aa1c72e6c49 100644
@@ -1060,13 +1060,12 @@ static int iucv_sock_sendmsg(struct socket *sock, struct msghdr *msg,
 			int i;
 
 			/* skip iucv_array lying in the headroom */
-			iba[0].address = (u32)(addr_t)skb->data;
+			iba[0].address = (u32)virt_to_phys(skb->data);
 			iba[0].length = (u32)skb_headlen(skb);
 			for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
 				skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
 
-				iba[i + 1].address =
-					(u32)(addr_t)skb_frag_address(frag);
+				iba[i + 1].address = (u32)virt_to_phys(skb_frag_address(frag));
 				iba[i + 1].length = (u32)skb_frag_size(frag);
 			}
 			err = pr_iucv->message_send(iucv->path, &txmsg,
@@ -1162,13 +1161,12 @@ static void iucv_process_message(struct sock *sk, struct sk_buff *skb,
 			struct iucv_array *iba = (struct iucv_array *)skb->head;
 			int i;
 
-			iba[0].address = (u32)(addr_t)skb->data;
+			iba[0].address = (u32)virt_to_phys(skb->data);

net/iucv/af_iucv.c static void iucv_process_message(struct sock *sk, struct sk_buff *skb, · line 1172

Quoted 10 lines
net/iucv/af_iucv.c +1 -2
 			iba[0].length = (u32)skb_headlen(skb);
 			for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
 				skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
 
-				iba[i + 1].address =
-					(u32)(addr_t)skb_frag_address(frag);
+				iba[i + 1].address = (u32)virt_to_phys(skb_frag_address(frag));
 				iba[i + 1].length = (u32)skb_frag_size(frag);
 			}
 			rc = pr_iucv->message_receive(path, msg,

I would have preferred to do all the translations in __iucv_* functions in iucv.c, but I understand that for __iucv_message_receive() this would mean significant changes.

maintainer
#2 lore raw
Quoted 2 lines · On Thu, 15 Feb 2024 14:36:57 +0100 Alexandra Winter wrote:

I would have preferred to do all the translations in __iucv_* functions in iucv.c, but I understand that for __iucv_message_receive() this would mean significant changes.

FWIW we're assuming this is going via the s390 tree. Please let us know if you prefer networking to pick it up.

maintainer
#3 lore raw
Quoted 7 lines · Jakub Kicinski
Quoted 2 lines · On Thu, 15 Feb 2024 14:36:57 +0100 Alexandra Winter wrote:

I would have preferred to do all the translations in __iucv_* functions in iucv.c, but I understand that for __iucv_message_receive() this would mean significant changes.

FWIW we're assuming this is going via the s390 tree. Please let us know if you prefer networking to pick it up.

Hello Jakub and maintainers,

please take this patch via net-next, as it belongs to the net/iucv module. Please excuse that it was not flagged with [PATCH net-next]

Kind regards
Alexandra

maintainer
#4 lore raw
Quoted 7 lines · On Thu, 22 Feb 2024 15:41:23 +0100 Alexandra Winter wrote:
Quoted 2 lines

FWIW we're assuming this is going via the s390 tree. Please let us know if you prefer networking to pick it up.

Hello Jakub and maintainers,

please take this patch via net-next, as it belongs to the net/iucv module. Please excuse that it was not flagged with [PATCH net-next]

Done! Hopefully nobody screams at us for the use of virt_to_phys() :)

#5 lore raw
In reply to Alexander Gordeev
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 7 lines · On Thu, 15 Feb 2024 09:05:00 +0100 you wrote:

Fix virtual vs physical address confusion. This does not fix a bug since virtual and physical address spaces are currently the same.

---
 net/iucv/af_iucv.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

Here is the summary with links:
- net/af_iucv: fix virtual vs physical address confusion

    https://git.kernel.org/netdev/net-next/c/9eda38dc9150

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html