Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[PATCH] swiotlb: Don't DoS us with 'swiotlb buffer is full'

140 views
Skip to first unread message

Konrad Rzeszutek Wilk

unread,
Dec 31, 2013, 11:00:02 AM12/31/13
to
There is no need for that so lets use ratelimiting.
Also add some extra information to be helpful.

CC: Stefano Stabellini <stefano.s...@eu.citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konra...@oracle.com>
---
lib/swiotlb.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/swiotlb.c b/lib/swiotlb.c
index e4399fa..7c97bd2 100644
--- a/lib/swiotlb.c
+++ b/lib/swiotlb.c
@@ -505,7 +505,8 @@ phys_addr_t swiotlb_tbl_map_single(struct device *hwdev,

not_found:
spin_unlock_irqrestore(&io_tlb_lock, flags);
- dev_warn(hwdev, "swiotlb buffer is full\n");
+ if (printk_ratelimit())
+ dev_warn(hwdev, "swiotlb buffer is full (sz: %ld bytes)\n", size);
return SWIOTLB_MAP_ERROR;
found:
spin_unlock_irqrestore(&io_tlb_lock, flags);
--
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majo...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Stefano Stabellini

unread,
Jan 3, 2014, 8:40:04 AM1/3/14
to
On Tue, 31 Dec 2013, Konrad Rzeszutek Wilk wrote:
> There is no need for that so lets use ratelimiting.
> Also add some extra information to be helpful.
>
> CC: Stefano Stabellini <stefano.s...@eu.citrix.com>
> Signed-off-by: Konrad Rzeszutek Wilk <konra...@oracle.com>

lib/swiotlb.c: In function 'swiotlb_tbl_map_single':
lib/swiotlb.c:509:3: warning: format '%ld' expects argument of type 'long int', but argument 3 has type 'size_t' [-Wformat=]

Konrad Rzeszutek Wilk

unread,
Jan 3, 2014, 1:40:02 PM1/3/14
to
On Fri, Jan 03, 2014 at 01:35:52PM +0000, Stefano Stabellini wrote:
> On Tue, 31 Dec 2013, Konrad Rzeszutek Wilk wrote:
> > There is no need for that so lets use ratelimiting.
> > Also add some extra information to be helpful.
> >
> > CC: Stefano Stabellini <stefano.s...@eu.citrix.com>
> > Signed-off-by: Konrad Rzeszutek Wilk <konra...@oracle.com>
>
> lib/swiotlb.c: In function 'swiotlb_tbl_map_single':
> lib/swiotlb.c:509:3: warning: format '%ld' expects argument of type 'long int', but argument 3 has type 'size_t' [-Wformat=]

:-)

I had this feeling that the %ld would not work on 32-bit
or other platforms but decided to resist the urge and just
post it as is.

Will fix it up!

Konrad Rzeszutek Wilk

unread,
Jan 6, 2014, 1:50:02 PM1/6/14
to
On Fri, Jan 03, 2014 at 01:35:52PM +0000, Stefano Stabellini wrote:
> On Tue, 31 Dec 2013, Konrad Rzeszutek Wilk wrote:
> > There is no need for that so lets use ratelimiting.
> > Also add some extra information to be helpful.
> >
> > CC: Stefano Stabellini <stefano.s...@eu.citrix.com>
> > Signed-off-by: Konrad Rzeszutek Wilk <konra...@oracle.com>
>
> lib/swiotlb.c: In function 'swiotlb_tbl_map_single':
> lib/swiotlb.c:509:3: warning: format '%ld' expects argument of type 'long int', but argument 3 has type 'size_t' [-Wformat=]
>

How about this:

From c83a2ab5d5fbc502b4165262a2983c2ad646f061 Mon Sep 17 00:00:00 2001
From: Konrad Rzeszutek Wilk <konra...@oracle.com>
Date: Mon, 16 Dec 2013 14:05:01 -0500
Subject: [PATCH] swiotlb: Don't DoS us with 'swiotlb buffer is full' (v2)

There is no need for that so lets use ratelimiting.
Also add some extra information to be helpful.

CC: Stefano Stabellini <stefano.s...@eu.citrix.com>
[v2: s/ld/zs on the printk]
Signed-off-by: Konrad Rzeszutek Wilk <konra...@oracle.com>
---
lib/swiotlb.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/swiotlb.c b/lib/swiotlb.c
index e4399fa..4634ac9 100644
--- a/lib/swiotlb.c
+++ b/lib/swiotlb.c
@@ -505,7 +505,8 @@ phys_addr_t swiotlb_tbl_map_single(struct device *hwdev,

not_found:
spin_unlock_irqrestore(&io_tlb_lock, flags);
- dev_warn(hwdev, "swiotlb buffer is full\n");
+ if (printk_ratelimit())
+ dev_warn(hwdev, "swiotlb buffer is full (sz: %zd bytes)\n", size);

Stefano Stabellini

unread,
Jan 7, 2014, 8:10:02 AM1/7/14
to
On Mon, 6 Jan 2014, Konrad Rzeszutek Wilk wrote:
> On Fri, Jan 03, 2014 at 01:35:52PM +0000, Stefano Stabellini wrote:
> > On Tue, 31 Dec 2013, Konrad Rzeszutek Wilk wrote:
> > > There is no need for that so lets use ratelimiting.
> > > Also add some extra information to be helpful.
> > >
> > > CC: Stefano Stabellini <stefano.s...@eu.citrix.com>
> > > Signed-off-by: Konrad Rzeszutek Wilk <konra...@oracle.com>
> >
> > lib/swiotlb.c: In function 'swiotlb_tbl_map_single':
> > lib/swiotlb.c:509:3: warning: format '%ld' expects argument of type 'long int', but argument 3 has type 'size_t' [-Wformat=]
> >
>
> How about this:
>
> >From c83a2ab5d5fbc502b4165262a2983c2ad646f061 Mon Sep 17 00:00:00 2001
> From: Konrad Rzeszutek Wilk <konra...@oracle.com>
> Date: Mon, 16 Dec 2013 14:05:01 -0500
> Subject: [PATCH] swiotlb: Don't DoS us with 'swiotlb buffer is full' (v2)
>
> There is no need for that so lets use ratelimiting.
> Also add some extra information to be helpful.
>
> CC: Stefano Stabellini <stefano.s...@eu.citrix.com>
> [v2: s/ld/zs on the printk]
> Signed-off-by: Konrad Rzeszutek Wilk <konra...@oracle.com>

Acked-by: Stefano Stabellini <stefano.s...@eu.citrix.com>
0 new messages