virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: netdev@vger.kernel.org,
	virtualization@lists.linux-foundation.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	David Miller <davem@davemloft.net>,
	Guenter Roeck <linux@roeck-us.net>
Subject: [PATCH stable-only] virtio-net: fix build on m68k and sparc64
Date: Wed, 15 Jan 2014 10:26:08 +0200	[thread overview]
Message-ID: <1389774152-1526-1-git-send-email-mst@redhat.com> (raw)

As a result of backporting a bugfix, virtio_net started passing void *
to page_address, assuming that it will get silently converted to struct
page *. But this does not happen on architectures where page_address is
a macro, the result is build failure as the macro tries to dereference
void*.

Fix by reordering code slightly, so we always pass
struct page * to page_address.

Reported-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: David Miller <davem@davemloft.net>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---

David, Greg asked that this be put in stable ASAP to avoid
next release being broken.
I still didn't Cc stable directly as I know you prefer to do this
yourself.
Sorry about creating this mess, could you help fast-path it there please?

Thanks!

 drivers/net/virtio_net.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index b8665588..c8d5ee1 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -330,9 +330,9 @@ static struct sk_buff *receive_mergeable(struct net_device *dev,
 					 void *buf,
 					 unsigned int len)
 {
-	struct skb_vnet_hdr *hdr = page_address(buf);
-	int num_buf = hdr->mhdr.num_buffers;
 	struct page *page = buf;
+	struct skb_vnet_hdr *hdr = page_address(page);
+	int num_buf = hdr->mhdr.num_buffers;
 	struct sk_buff *skb = page_to_skb(rq, page, len);
 	int i;
 
-- 
MST

             reply	other threads:[~2014-01-15  8:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-15  8:26 Michael S. Tsirkin [this message]
2014-01-15  8:36 ` [PATCH stable-only] virtio-net: fix build on m68k and sparc64 Geert Uytterhoeven
2014-01-15  8:46   ` Michael S. Tsirkin
2014-01-15  9:01     ` Geert Uytterhoeven
2014-01-15  9:15       ` Michael S. Tsirkin

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=1389774152-1526-1-git-send-email-mst@redhat.com \
    --to=mst@redhat.com \
    --cc=davem@davemloft.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=netdev@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.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).