Repository navigation
Commit 0d83ab6
[SCSI] bnx2i: Fixed kernel panic due to illegal usage of sc->request->cpu
A kernel panic was observed when passing the sc->request->cpu = -1 to
retrieve the per_cpu variable pointer:
#0 [ffff880011203960] machine_kexec at ffffffff81022bc3
raspberrypi#1 [ffff8800112039b0] crash_kexec at ffffffff81088630
raspberrypi#2 [ffff880011203a80] __die at ffffffff8139ea20
raspberrypi#3 [ffff880011203aa0] no_context at ffffffff8102f3a7
raspberrypi#4 [ffff880011203ae0] __bad_area_nosemaphore at ffffffff8102f665
raspberrypi#5 [ffff880011203ba0] retint_signal at ffffffff8139dd1f
raspberrypi#6 [ffff880011203cc8] bnx2i_indicate_kcqe at ffffffffa03dc4f2
raspberrypi#7 [ffff880011203da8] service_kcqes at ffffffffa03cb04f
raspberrypi#8 [ffff880011203e68] cnic_service_bnx2x_kcq at ffffffffa03cb14a
raspberrypi#9 [ffff880011203e88] cnic_service_bnx2x_bh at ffffffffa03cb1b3
The problem lies in the slow path sg_io (and perhaps sg_scsi_ioctl) call to
blk_get_request->get_request/wait->blk_alloc_request->blk_rq_init which
re-initializes the request->cpu to -1. There is no assignment for cpu from
that to the request_fn call to low level drivers.
When this happens, the sc->request->cpu will be using the init value of
-1. This will create a kernel panic when it hits bnx2i because the code
refers it to get the per_cpu variables ptr.
This change is to put in a guard against that and also for cases when
bio affinity/queue completion to the same cpu is not enabled. In those
cases, the request->cpu will remain a -1 also.
This bug was created from commit: b5cf6b6
For the case when the blk layer did not setup the request->cpu, bnx2i
will complete the sc with the current CPU of the thread.
Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>1 parent 2dabc55 commit 0d83ab6
1 file changed
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1901 | 1901 | | |
1902 | 1902 | | |
1903 | 1903 | | |
| 1904 | + | |
1904 | 1905 | | |
1905 | 1906 | | |
1906 | 1907 | | |
| |||
1912 | 1913 | | |
1913 | 1914 | | |
1914 | 1915 | | |
1915 | | - | |
| 1916 | + | |
| 1917 | + | |
| 1918 | + | |
| 1919 | + | |
| 1920 | + | |
| 1921 | + | |
1916 | 1922 | | |
1917 | 1923 | | |
1918 | 1924 | | |
| |||
0 commit comments