Skip to content

Commit

Permalink
drivers/misc/sgi-gru: fix dereference of ERR_PTR
Browse files Browse the repository at this point in the history
gru_alloc_gts() can fail and it can return ERR_PTR(errvalue). We should
not dereference it if it has returned error. And incase it has returned
error then wait for some time and try again.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Acked-by: Dimitri Sivanich <sivanich@sgi.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Sudip Mukherjee authored and Greg Kroah-Hartman committed Sep 21, 2015
1 parent c2ed545 commit bba57f8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/misc/sgi-gru/grukservices.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,12 @@ static void gru_load_kernel_context(struct gru_blade_state *bs, int blade_id)
down_write(&bs->bs_kgts_sema);

if (!bs->bs_kgts) {
bs->bs_kgts = gru_alloc_gts(NULL, 0, 0, 0, 0, 0);
do {
bs->bs_kgts = gru_alloc_gts(NULL, 0, 0, 0, 0, 0);
if (!IS_ERR(bs->bs_kgts))
break;
msleep(1);
} while (true);
bs->bs_kgts->ts_user_blade_id = blade_id;
}
kgts = bs->bs_kgts;
Expand Down

0 comments on commit bba57f8

Please sign in to comment.