mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-26 19:35:18 +07:00
54a6a043fb
If mISDN_FsmNew() fails to allocate memory for jumpmatrix then null pointer dereference will occur on any write to jumpmatrix. The patch adds check on successful allocation and corresponding error handling. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Anton Vasilyev <vasilyev@ispras.ru> Signed-off-by: David S. Miller <davem@davemloft.net>
68 lines
1.7 KiB
C
68 lines
1.7 KiB
C
/*
|
|
*
|
|
* Author Karsten Keil <kkeil@novell.com>
|
|
*
|
|
* Thanks to Jan den Ouden
|
|
* Fritz Elfert
|
|
* Copyright 2008 by Karsten Keil <kkeil@novell.com>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
*/
|
|
|
|
#ifndef _MISDN_FSM_H
|
|
#define _MISDN_FSM_H
|
|
|
|
#include <linux/timer.h>
|
|
|
|
/* Statemachine */
|
|
|
|
struct FsmInst;
|
|
|
|
typedef void (*FSMFNPTR)(struct FsmInst *, int, void *);
|
|
|
|
struct Fsm {
|
|
FSMFNPTR *jumpmatrix;
|
|
int state_count, event_count;
|
|
char **strEvent, **strState;
|
|
};
|
|
|
|
struct FsmInst {
|
|
struct Fsm *fsm;
|
|
int state;
|
|
int debug;
|
|
void *userdata;
|
|
int userint;
|
|
void (*printdebug) (struct FsmInst *, char *, ...);
|
|
};
|
|
|
|
struct FsmNode {
|
|
int state, event;
|
|
void (*routine) (struct FsmInst *, int, void *);
|
|
};
|
|
|
|
struct FsmTimer {
|
|
struct FsmInst *fi;
|
|
struct timer_list tl;
|
|
int event;
|
|
void *arg;
|
|
};
|
|
|
|
extern int mISDN_FsmNew(struct Fsm *, struct FsmNode *, int);
|
|
extern void mISDN_FsmFree(struct Fsm *);
|
|
extern int mISDN_FsmEvent(struct FsmInst *, int , void *);
|
|
extern void mISDN_FsmChangeState(struct FsmInst *, int);
|
|
extern void mISDN_FsmInitTimer(struct FsmInst *, struct FsmTimer *);
|
|
extern int mISDN_FsmAddTimer(struct FsmTimer *, int, int, void *, int);
|
|
extern void mISDN_FsmRestartTimer(struct FsmTimer *, int, int, void *, int);
|
|
extern void mISDN_FsmDelTimer(struct FsmTimer *, int);
|
|
|
|
#endif
|