]> www.infradead.org Git - users/jedix/linux-maple.git/commit
xen/blkfront: Add WARN to deal with misbehaving backends.
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Fri, 25 May 2012 21:34:51 +0000 (17:34 -0400)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Wed, 5 Dec 2012 17:03:32 +0000 (12:03 -0500)
commit210971308a2e76b9f250b414d9f709e75229bc03
tree0dfd14f45117bbefd2b173516095c4efb38d87b0
parent4d14183827e1b9a83d50c8ad3218e5907990d0ff
xen/blkfront: Add WARN to deal with misbehaving backends.

Part of the ring structure is the 'id' field which is under
control of the frontend. The frontend stamps it with "some"
value (this some in this implementation being a value less
than BLK_RING_SIZE), and when it gets a response expects
said value to be in the response structure. We have a check
for the id field when spolling new requests but not when
de-spolling responses.

We also add an extra check in add_id_to_freelist to make
sure that the 'struct request' was not NULL - as we cannot
pass a NULL to __blk_end_request_all, otherwise that crashes
(and all the operations that the response is dealing with
end up with __blk_end_request_all).

Lastly we also print the name of the operation that failed.

[v1: s/BUG/WARN/ suggested by Stefano]
[v2: Add extra check in add_id_to_freelist]
[v3: Redid op_name per Jan's suggestion]
[v4: add const * and add WARN on failure returns]
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
(cherry picked from commit 6878c32e5cc0e40980abe51d1f02fb453e27493e)
drivers/block/xen-blkfront.c