lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABE8wwtrq=SuuhAvNDjpSbfPGE+N4cWjjmVGWq8UzaH6sM9kRg@mail.gmail.com>
Date:	Tue, 20 Dec 2011 23:30:14 -0800
From:	"Williams, Dan J" <dan.j.williams@...el.com>
To:	Tao Ma <tm@....ma>
Cc:	Meelis Roos <mroos@...ux.ee>, axboe@...nel.dk,
	Tao Ma <boyu.mt@...bao.com>,
	Linux Kernel list <linux-kernel@...r.kernel.org>,
	linux-scsi@...r.kernel.org, Ed Nadolski <edmund.nadolski@...el.com>
Subject: Re: [PATCH] block: fix blk_queue_end_tag()

On Tue, Dec 20, 2011 at 10:48 PM, Tao Ma <tm@....ma> wrote:
> On 12/21/2011 02:36 PM, Meelis Roos wrote:
>>>> -   if (unlikely(tag >= bqt->max_depth)) {
>>>> +   if (WARN_ONCE(tag >= bqt->real_max_depth,
>>>> +                 "%s: tag %d greater than tag map size: %d\n",
>>>> +                 __func__, tag, bqt->real_max_depth)) {
>>>>             /*
>>>>              * This can happen after tag depth has been reduced.
>>> Please also change the comments here since it should never happen in the
>>> right workload.
>>
>> What do you mean by right workload? Normal workload?
> yeah, so real_max_depth is the maximum depth we ever have. So in normal
> case(shrinking queue depth is also a normal user case), we should never
> arrive here. In another word, if tag >= real_max_depth, we should have a
> bug in the kernel.

So this is what Ed Nadolski suggested, just cut to the chase and do,
the following.  Seems like the comment is what got us into trouble in
the first place.

diff --git a/block/blk-tag.c b/block/blk-tag.c
index e74d6d1..e297d9d7 100644
--- a/block/blk-tag.c
+++ b/block/blk-tag.c
@@ -284,16 +284,7 @@ void blk_queue_end_tag(struct request_queue *q,
struct request *rq)
        struct blk_queue_tag *bqt = q->queue_tags;
        int tag = rq->tag;

-       BUG_ON(tag == -1);
-
-       if (unlikely(tag >= bqt->max_depth)) {
-               /*
-                * This can happen after tag depth has been reduced.
-                * But tag shouldn't be larger than real_max_depth.
-                */
-               WARN_ON(tag >= bqt->real_max_depth);
-               return;
-       }
+       BUG_ON(tag == -1 || tag > bqt->real_max_depth);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ