Skip to content

vchiq: fix NULL pointer deference when closing driver #1122

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions drivers/misc/vc04_services/interface/vchiq_arm/vchiq_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ int vchiu_queue_init(VCHIU_QUEUE_T *queue, int size)
queue->size = size;
queue->read = 0;
queue->write = 0;
queue->initialized = 1;

sema_init(&queue->pop, 0);
sema_init(&queue->push, 0);
Expand Down Expand Up @@ -76,6 +77,9 @@ int vchiu_queue_is_full(VCHIU_QUEUE_T *queue)

void vchiu_queue_push(VCHIU_QUEUE_T *queue, VCHIQ_HEADER_T *header)
{
if (!queue->initialized)
return;

while (queue->write == queue->read + queue->size) {
if (down_interruptible(&queue->pop) != 0) {
flush_signals(current);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ typedef struct {
int size;
int read;
int write;
int initialized;

struct semaphore pop;
struct semaphore push;
Expand Down