Make ng_ksocket fulfill lower protocol stack layers alignment requirements
on platforms with strict alignment constraints. This fixes kernel panics on arm and probably other architectures. PR: sparc64/80410
This commit is contained in:
parent
148ac1dacc
commit
5c100aeaad
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=206017
@ -902,12 +902,24 @@ ng_ksocket_rcvdata(hook_p hook, item_p item)
|
||||
struct sockaddr *sa = NULL;
|
||||
int error;
|
||||
struct mbuf *m;
|
||||
#ifdef ALIGNED_POINTER
|
||||
struct mbuf *n;
|
||||
#endif /* ALIGNED_POINTER */
|
||||
struct sa_tag *stag;
|
||||
|
||||
/* Extract data */
|
||||
NGI_GET_M(item, m);
|
||||
NG_FREE_ITEM(item);
|
||||
|
||||
#ifdef ALIGNED_POINTER
|
||||
if (!ALIGNED_POINTER(mtod(m, caddr_t), uint32_t)) {
|
||||
n = m_defrag(m, M_NOWAIT);
|
||||
if (n == NULL) {
|
||||
m_freem(m);
|
||||
return (ENOBUFS);
|
||||
}
|
||||
m = n;
|
||||
}
|
||||
#endif /* ALIGNED_POINTER */
|
||||
/*
|
||||
* Look if socket address is stored in packet tags.
|
||||
* If sockaddr is ours, or provided by a third party (zero id),
|
||||
|
Loading…
Reference in New Issue
Block a user