davidker / unisys

Master repository for new changes to drivers/staging/unisys and drivers/visorbus
Other
2 stars 1 forks source link

visorhba: visor_thread_start(): setting 'thrinfo->id = 0' in error path isn't enough #33

Closed selltc closed 8 years ago

selltc commented 8 years ago

Even though we do thrinfo->id = 0 in the error path, this isn't enough to prevent the code from accessing thrinfo->task later on, even though it is an invalid value.

Source: Dan Carpenter dan.carpenter@oracle.com Mon 5/2/2016 5:53 AM

visor_thread_start(): I'm nervous about the error handling here. Is setting ->id to zero really sufficient to prevent dereferencing ->task?

See KanBoard-991

selltc commented 8 years ago

Commit a6c51b1825a983fd17e0947ae972de3810085c2a is my first-crack at this. It is regression-test and checkpatch clean.

selltc commented 8 years ago

I should add this paragraph to the commit a6c51b1825a983fd17e0947ae972de3810085c2a comment:

Also, the other thread-related fields in visor_thread_info (has_stopped and id)
were not being used, so visor_thead_info was just removed.

I can push another commit with an updated comment if that's the best way to do it.

selltc commented 8 years ago

I pushed commit a9b0f13e75fad39bca957a825eaacfbc8c391c4f with the revised comment. It is identical to the first commit other than the comment.

selltc commented 8 years ago

Greg posted this to his staging-testing on 5/6, and later to staging-next on 5/9: