Pull up following revision(s) (requested by hikaru in ticket #656):
sys/kern/subr_tftproot.c: revision 1.14 sys/nfs/krpc_subr.c: revision 1.39 sys/nfs/nfs_boot.c: revision 1.82 sys/nfs/nfs_bootdhcp.c: revision 1.53 sys/nfs/nfsdiskless.h: revision 1.31 m_pullup() is called in rcvproc callback functions, so nfs_boot_sendrecv() should keep track of the head of mbuf chain. fixes kern/48746
This commit is contained in:
parent
99ce9afee1
commit
e392c11ebb
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: subr_tftproot.c,v 1.12.12.1 2014/08/30 14:09:53 martin Exp $ */
|
/* $NetBSD: subr_tftproot.c,v 1.12.12.2 2015/04/06 01:37:29 snj Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2007 Emmanuel Dreyfus, all rights reserved.
|
* Copyright (c) 2007 Emmanuel Dreyfus, all rights reserved.
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
#include "opt_md.h"
|
#include "opt_md.h"
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: subr_tftproot.c,v 1.12.12.1 2014/08/30 14:09:53 martin Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: subr_tftproot.c,v 1.12.12.2 2015/04/06 01:37:29 snj Exp $");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
@ -118,7 +118,7 @@ struct tftproot_handle {
|
||||||
int tftproot_dhcpboot(device_t);
|
int tftproot_dhcpboot(device_t);
|
||||||
|
|
||||||
static int tftproot_getfile(struct tftproot_handle *, struct lwp *);
|
static int tftproot_getfile(struct tftproot_handle *, struct lwp *);
|
||||||
static int tftproot_recv(struct mbuf *, void *);
|
static int tftproot_recv(struct mbuf **, void *);
|
||||||
|
|
||||||
int
|
int
|
||||||
tftproot_dhcpboot(device_t bootdv)
|
tftproot_dhcpboot(device_t bootdv)
|
||||||
|
@ -350,10 +350,11 @@ out:
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
tftproot_recv(struct mbuf *m, void *ctx)
|
tftproot_recv(struct mbuf **mp, void *ctx)
|
||||||
{
|
{
|
||||||
struct tftproot_handle *trh = ctx;
|
struct tftproot_handle *trh = ctx;
|
||||||
struct tftphdr *tftp;
|
struct tftphdr *tftp;
|
||||||
|
struct mbuf *m = *mp;
|
||||||
size_t newlen;
|
size_t newlen;
|
||||||
size_t hdrlen = sizeof(*tftp) - sizeof(tftp->th_data);
|
size_t hdrlen = sizeof(*tftp) - sizeof(tftp->th_data);
|
||||||
|
|
||||||
|
@ -380,7 +381,7 @@ tftproot_recv(struct mbuf *m, void *ctx)
|
||||||
* Examine the TFTP header
|
* Examine the TFTP header
|
||||||
*/
|
*/
|
||||||
if (m->m_len > sizeof(*tftp)) {
|
if (m->m_len > sizeof(*tftp)) {
|
||||||
if ((m = m_pullup(m, sizeof(*tftp))) == NULL) {
|
if ((m = *mp = m_pullup(m, sizeof(*tftp))) == NULL) {
|
||||||
DPRINTF(("%s():%d m_pullup failed\n",
|
DPRINTF(("%s():%d m_pullup failed\n",
|
||||||
__func__, __LINE__));
|
__func__, __LINE__));
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: krpc_subr.c,v 1.37 2009/03/15 17:20:09 cegger Exp $ */
|
/* $NetBSD: krpc_subr.c,v 1.37.38.1 2015/04/06 01:37:29 snj Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1995 Gordon Ross, Adam Glass
|
* Copyright (c) 1995 Gordon Ross, Adam Glass
|
||||||
|
@ -43,7 +43,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: krpc_subr.c,v 1.37 2009/03/15 17:20:09 cegger Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: krpc_subr.c,v 1.37.38.1 2015/04/06 01:37:29 snj Exp $");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
|
@ -124,7 +124,7 @@ struct rpc_reply {
|
||||||
|
|
||||||
#define MIN_REPLY_HDR 16 /* xid, dir, astat, errno */
|
#define MIN_REPLY_HDR 16 /* xid, dir, astat, errno */
|
||||||
|
|
||||||
static int krpccheck(struct mbuf*, void*);
|
static int krpccheck(struct mbuf**, void*);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Call portmap to lookup a port number for a particular rpc program
|
* Call portmap to lookup a port number for a particular rpc program
|
||||||
|
@ -183,15 +183,16 @@ krpc_portmap(struct sockaddr_in *sin, u_int prog, u_int vers, u_int proto, u_int
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int krpccheck(struct mbuf *m, void *context)
|
static int krpccheck(struct mbuf **mp, void *context)
|
||||||
{
|
{
|
||||||
struct rpc_reply *reply;
|
struct rpc_reply *reply;
|
||||||
|
struct mbuf *m = *mp;
|
||||||
|
|
||||||
/* Does the reply contain at least a header? */
|
/* Does the reply contain at least a header? */
|
||||||
if (m->m_pkthdr.len < MIN_REPLY_HDR)
|
if (m->m_pkthdr.len < MIN_REPLY_HDR)
|
||||||
return(-1);
|
return(-1);
|
||||||
if (m->m_len < sizeof(struct rpc_reply)) {
|
if (m->m_len < sizeof(struct rpc_reply)) {
|
||||||
m = m_pullup(m, sizeof(struct rpc_reply));
|
m = *mp = m_pullup(m, sizeof(struct rpc_reply));
|
||||||
if (m == NULL)
|
if (m == NULL)
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: nfs_boot.c,v 1.81 2013/10/25 20:46:29 martin Exp $ */
|
/* $NetBSD: nfs_boot.c,v 1.81.4.1 2015/04/06 01:37:29 snj Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1995, 1997 The NetBSD Foundation, Inc.
|
* Copyright (c) 1995, 1997 The NetBSD Foundation, Inc.
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: nfs_boot.c,v 1.81 2013/10/25 20:46:29 martin Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: nfs_boot.c,v 1.81.4.1 2015/04/06 01:37:29 snj Exp $");
|
||||||
|
|
||||||
#ifdef _KERNEL_OPT
|
#ifdef _KERNEL_OPT
|
||||||
#include "opt_nfs.h"
|
#include "opt_nfs.h"
|
||||||
|
@ -432,7 +432,7 @@ int
|
||||||
nfs_boot_sendrecv(struct socket *so, struct mbuf *nam,
|
nfs_boot_sendrecv(struct socket *so, struct mbuf *nam,
|
||||||
int (*sndproc)(struct mbuf *, void *, int),
|
int (*sndproc)(struct mbuf *, void *, int),
|
||||||
struct mbuf *snd,
|
struct mbuf *snd,
|
||||||
int (*rcvproc)(struct mbuf *, void *),
|
int (*rcvproc)(struct mbuf **, void *),
|
||||||
struct mbuf **rcv, struct mbuf **from_p,
|
struct mbuf **rcv, struct mbuf **from_p,
|
||||||
void *context, struct lwp *lwp)
|
void *context, struct lwp *lwp)
|
||||||
{
|
{
|
||||||
|
@ -510,7 +510,7 @@ send_again:
|
||||||
panic("nfs_boot_sendrecv: return size");
|
panic("nfs_boot_sendrecv: return size");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((*rcvproc)(m, context))
|
if ((*rcvproc)(&m, context))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (rcv)
|
if (rcv)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: nfs_bootdhcp.c,v 1.52 2010/10/04 23:48:22 cyber Exp $ */
|
/* $NetBSD: nfs_bootdhcp.c,v 1.52.34.1 2015/04/06 01:37:29 snj Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1995, 1997 The NetBSD Foundation, Inc.
|
* Copyright (c) 1995, 1997 The NetBSD Foundation, Inc.
|
||||||
|
@ -44,7 +44,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: nfs_bootdhcp.c,v 1.52 2010/10/04 23:48:22 cyber Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: nfs_bootdhcp.c,v 1.52.34.1 2015/04/06 01:37:29 snj Exp $");
|
||||||
|
|
||||||
#ifdef _KERNEL_OPT
|
#ifdef _KERNEL_OPT
|
||||||
#include "opt_nfs_boot.h"
|
#include "opt_nfs_boot.h"
|
||||||
|
@ -302,7 +302,7 @@ struct bootpcontext {
|
||||||
};
|
};
|
||||||
|
|
||||||
static int bootpset (struct mbuf*, void*, int);
|
static int bootpset (struct mbuf*, void*, int);
|
||||||
static int bootpcheck (struct mbuf*, void*);
|
static int bootpcheck (struct mbuf**, void*);
|
||||||
|
|
||||||
static int
|
static int
|
||||||
bootpset(struct mbuf *m, void *context, int waited)
|
bootpset(struct mbuf *m, void *context, int waited)
|
||||||
|
@ -318,10 +318,11 @@ bootpset(struct mbuf *m, void *context, int waited)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
bootpcheck(struct mbuf *m, void *context)
|
bootpcheck(struct mbuf **mp, void *context)
|
||||||
{
|
{
|
||||||
struct bootp *bootp;
|
struct bootp *bootp;
|
||||||
struct bootpcontext *bpc = context;
|
struct bootpcontext *bpc = context;
|
||||||
|
struct mbuf *m = *mp;
|
||||||
u_int tag, len;
|
u_int tag, len;
|
||||||
u_char *p, *limit;
|
u_char *p, *limit;
|
||||||
|
|
||||||
|
@ -343,7 +344,7 @@ bootpcheck(struct mbuf *m, void *context)
|
||||||
* don't make first checks more expensive than necessary
|
* don't make first checks more expensive than necessary
|
||||||
*/
|
*/
|
||||||
if (m->m_len < offsetof(struct bootp, bp_sname)) {
|
if (m->m_len < offsetof(struct bootp, bp_sname)) {
|
||||||
m = m_pullup(m, offsetof(struct bootp, bp_sname));
|
m = *mp = m_pullup(m, offsetof(struct bootp, bp_sname));
|
||||||
if (m == NULL) {
|
if (m == NULL) {
|
||||||
DPRINTF(("bootpcheck: m_pullup failed\n"));
|
DPRINTF(("bootpcheck: m_pullup failed\n"));
|
||||||
return (-1);
|
return (-1);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: nfsdiskless.h,v 1.30 2010/10/04 23:48:23 cyber Exp $ */
|
/* $NetBSD: nfsdiskless.h,v 1.30.34.1 2015/04/06 01:37:29 snj Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1995, 1997 The NetBSD Foundation, Inc.
|
* Copyright (c) 1995, 1997 The NetBSD Foundation, Inc.
|
||||||
|
@ -79,7 +79,7 @@ int nfs_boot_enbroadcast (struct socket *);
|
||||||
int nfs_boot_sobind_ipport (struct socket *, uint16_t, struct lwp *);
|
int nfs_boot_sobind_ipport (struct socket *, uint16_t, struct lwp *);
|
||||||
int nfs_boot_sendrecv (struct socket *, struct mbuf *,
|
int nfs_boot_sendrecv (struct socket *, struct mbuf *,
|
||||||
int (*)(struct mbuf*, void*, int), struct mbuf*,
|
int (*)(struct mbuf*, void*, int), struct mbuf*,
|
||||||
int (*)(struct mbuf*, void*), struct mbuf**,
|
int (*)(struct mbuf**, void*), struct mbuf**,
|
||||||
struct mbuf**, void*, struct lwp *);
|
struct mbuf**, void*, struct lwp *);
|
||||||
|
|
||||||
int nfs_bootdhcp (struct nfs_diskless *, struct lwp *, int *);
|
int nfs_bootdhcp (struct nfs_diskless *, struct lwp *, int *);
|
||||||
|
|
Loading…
Reference in New Issue