结构指针分配导致内核冻结

时间:2018-07-03 17:42:14

标签: linux pointers linux-kernel freeze kmalloc

我在Linux内核中具有如下结构:

struct st_fetch_point {

struct sk_buff *end_pkt ;
struct sk_buff *start_pkt ;
struct sk_buff *current_pkt ;
struct st_fetch_point *next_fortp ;
struct st_fetch_point *next_consec ;

};

我对定义的结构有四个指针,如下所示:

struct mptcp_tcp_sock {

struct st_fetch_point *start_fetch_point ;
struct st_fetch_point *last_fetch_point;
struct st_fetch_point *current_fetch_point;
struct st_fetch_point *first_fetch_point ;
struct tcp_sock *tp;
.......................
.......................

};

struct tcp_sock {

struct mptcp_tcp_sock *mptcp;
............................
............................

};

我只是在执行此操作:

first_fetch_point = kmalloc ((sizeof(struct st_fetch_point)), GFP_ATOMIC);
first_fetch_point->start_pkt = skb;   //skb value is a pointer to some memory address 
first_fetch_point->current_pkt = skb;
first_fetch_point->end_pkt = skb2;

然后,当我执行以下行时:

tp->mptcp->current_fetch_point = first_fetch_point ; // tp->mptcp->current_fetch_point = NULL before this point

内核冻结。我分配这些指针的方式有什么问题吗?我正在ubuntu平台上工作,并且确实在修复中导致内核冻结的问题。

0 个答案:

没有答案