diff mbox

[trusty/utopic,SRU] xen-netfront: Remove BUGs on paged skb data which crosses a page boundary

Message ID 1417705602-20087-1-git-send-email-seth.forshee@canonical.com
State New
Headers show

Commit Message

Seth Forshee Dec. 4, 2014, 3:06 p.m. UTC
These BUGs can be erroneously triggered by frags which refer to
tail pages within a compound page. The data in these pages may
overrun the hardware page while still being contained within the
compound page, but since compound_order() evaluates to 0 for tail
pages the assertion fails. The code already iterates through
subsequent pages correctly in this scenario, so the BUGs are
unnecessary and can be removed.

Fixes: f36c374782e4 ("xen/netfront: handle compound page fragments on transmit")
Cc: <stable@vger.kernel.org> # 3.7+
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Reviewed-by: David Vrabel <david.vrabel@citrix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 8d609725d4357f499e2103e46011308b32f53513)
BugLink: http://bugs.launchpad.net/bugs/1275879
---
 drivers/net/xen-netfront.c | 5 -----
 1 file changed, 5 deletions(-)

Comments

Stefan Bader Dec. 4, 2014, 5:10 p.m. UTC | #1
ACK, though I guess we pick it up from stable ... though probably not that quick.
Seth Forshee Dec. 4, 2014, 5:27 p.m. UTC | #2
On Thu, Dec 04, 2014 at 06:10:12PM +0100, Stefan Bader wrote:
> ACK, though I guess we pick it up from stable ... though probably not that quick.

Yep, I'm just trying to get the fix in as quickly as possible. If it
will make it in just as quickly via stable then we can just let it
filter down.

Seth
Luis Henriques Dec. 4, 2014, 5:48 p.m. UTC | #3
On Thu, Dec 04, 2014 at 09:06:42AM -0600, Seth Forshee wrote:
> These BUGs can be erroneously triggered by frags which refer to
> tail pages within a compound page. The data in these pages may
> overrun the hardware page while still being contained within the
> compound page, but since compound_order() evaluates to 0 for tail
> pages the assertion fails. The code already iterates through
> subsequent pages correctly in this scenario, so the BUGs are
> unnecessary and can be removed.
> 
> Fixes: f36c374782e4 ("xen/netfront: handle compound page fragments on transmit")
> Cc: <stable@vger.kernel.org> # 3.7+
> Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
> Reviewed-by: David Vrabel <david.vrabel@citrix.com>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> (cherry picked from commit 8d609725d4357f499e2103e46011308b32f53513)
> BugLink: http://bugs.launchpad.net/bugs/1275879

Since this commit doesn't seem to be present in any kernel released by
Linus yet (it will be in the 3.18.0-rc8 or 3.18), it does not fulfill
the requirements to be queued for a stable tree.

So, if we want this in T and U soon, its probably better to go ahead
with the SRU.

Cheers,
--
Luís


> ---
>  drivers/net/xen-netfront.c | 5 -----
>  1 file changed, 5 deletions(-)
> 
> diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
> index fff9bbe..69e0cd6 100644
> --- a/drivers/net/xen-netfront.c
> +++ b/drivers/net/xen-netfront.c
> @@ -469,9 +469,6 @@ static void xennet_make_frags(struct sk_buff *skb, struct net_device *dev,
>  		len = skb_frag_size(frag);
>  		offset = frag->page_offset;
>  
> -		/* Data must not cross a page boundary. */
> -		BUG_ON(len + offset > PAGE_SIZE<<compound_order(page));
> -
>  		/* Skip unused frames from start of page */
>  		page += offset >> PAGE_SHIFT;
>  		offset &= ~PAGE_MASK;
> @@ -479,8 +476,6 @@ static void xennet_make_frags(struct sk_buff *skb, struct net_device *dev,
>  		while (len > 0) {
>  			unsigned long bytes;
>  
> -			BUG_ON(offset >= PAGE_SIZE);
> -
>  			bytes = PAGE_SIZE - offset;
>  			if (bytes > len)
>  				bytes = len;
> -- 
> 1.9.1
> 
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
Brad Figg Dec. 4, 2014, 6:06 p.m. UTC | #4
On 12/04/2014 07:06 AM, Seth Forshee wrote:
> These BUGs can be erroneously triggered by frags which refer to
> tail pages within a compound page. The data in these pages may
> overrun the hardware page while still being contained within the
> compound page, but since compound_order() evaluates to 0 for tail
> pages the assertion fails. The code already iterates through
> subsequent pages correctly in this scenario, so the BUGs are
> unnecessary and can be removed.
> 
> Fixes: f36c374782e4 ("xen/netfront: handle compound page fragments on transmit")
> Cc: <stable@vger.kernel.org> # 3.7+
> Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
> Reviewed-by: David Vrabel <david.vrabel@citrix.com>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> (cherry picked from commit 8d609725d4357f499e2103e46011308b32f53513)
> BugLink: http://bugs.launchpad.net/bugs/1275879
> ---
>  drivers/net/xen-netfront.c | 5 -----
>  1 file changed, 5 deletions(-)
> 
> diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
> index fff9bbe..69e0cd6 100644
> --- a/drivers/net/xen-netfront.c
> +++ b/drivers/net/xen-netfront.c
> @@ -469,9 +469,6 @@ static void xennet_make_frags(struct sk_buff *skb, struct net_device *dev,
>  		len = skb_frag_size(frag);
>  		offset = frag->page_offset;
>  
> -		/* Data must not cross a page boundary. */
> -		BUG_ON(len + offset > PAGE_SIZE<<compound_order(page));
> -
>  		/* Skip unused frames from start of page */
>  		page += offset >> PAGE_SHIFT;
>  		offset &= ~PAGE_MASK;
> @@ -479,8 +476,6 @@ static void xennet_make_frags(struct sk_buff *skb, struct net_device *dev,
>  		while (len > 0) {
>  			unsigned long bytes;
>  
> -			BUG_ON(offset >= PAGE_SIZE);
> -
>  			bytes = PAGE_SIZE - offset;
>  			if (bytes > len)
>  				bytes = len;
>
diff mbox

Patch

diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index fff9bbe..69e0cd6 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -469,9 +469,6 @@  static void xennet_make_frags(struct sk_buff *skb, struct net_device *dev,
 		len = skb_frag_size(frag);
 		offset = frag->page_offset;
 
-		/* Data must not cross a page boundary. */
-		BUG_ON(len + offset > PAGE_SIZE<<compound_order(page));
-
 		/* Skip unused frames from start of page */
 		page += offset >> PAGE_SHIFT;
 		offset &= ~PAGE_MASK;
@@ -479,8 +476,6 @@  static void xennet_make_frags(struct sk_buff *skb, struct net_device *dev,
 		while (len > 0) {
 			unsigned long bytes;
 
-			BUG_ON(offset >= PAGE_SIZE);
-
 			bytes = PAGE_SIZE - offset;
 			if (bytes > len)
 				bytes = len;