]> git.kernelconcepts.de Git - karo-tx-linux.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>
Tue, 12 Jun 2012 12:29:04 +0000 (08:29 -0400)
commit6878c32e5cc0e40980abe51d1f02fb453e27493e
tree363367cfe3c0f836854485216650b1b3073dab04
parent8c9ce606a60e4a0cb447bdc082ce383b96b227b4
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>
drivers/block/xen-blkfront.c