Module Name: src Committed By: snj Date: Mon Apr 6 01:37:29 UTC 2015
Modified Files: src/sys/kern [netbsd-7]: subr_tftproot.c src/sys/nfs [netbsd-7]: krpc_subr.c nfs_boot.c nfs_bootdhcp.c nfsdiskless.h Log Message: 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 To generate a diff of this commit: cvs rdiff -u -r1.12.12.1 -r1.12.12.2 src/sys/kern/subr_tftproot.c cvs rdiff -u -r1.37 -r1.37.38.1 src/sys/nfs/krpc_subr.c cvs rdiff -u -r1.81 -r1.81.4.1 src/sys/nfs/nfs_boot.c cvs rdiff -u -r1.52 -r1.52.34.1 src/sys/nfs/nfs_bootdhcp.c cvs rdiff -u -r1.30 -r1.30.34.1 src/sys/nfs/nfsdiskless.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/kern/subr_tftproot.c diff -u src/sys/kern/subr_tftproot.c:1.12.12.1 src/sys/kern/subr_tftproot.c:1.12.12.2 --- src/sys/kern/subr_tftproot.c:1.12.12.1 Sat Aug 30 14:09:53 2014 +++ src/sys/kern/subr_tftproot.c Mon Apr 6 01:37:29 2015 @@ -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. @@ -39,7 +39,7 @@ #include "opt_md.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/types.h> @@ -118,7 +118,7 @@ struct tftproot_handle { int tftproot_dhcpboot(device_t); static int tftproot_getfile(struct tftproot_handle *, struct lwp *); -static int tftproot_recv(struct mbuf *, void *); +static int tftproot_recv(struct mbuf **, void *); int tftproot_dhcpboot(device_t bootdv) @@ -350,10 +350,11 @@ out: } static int -tftproot_recv(struct mbuf *m, void *ctx) +tftproot_recv(struct mbuf **mp, void *ctx) { struct tftproot_handle *trh = ctx; struct tftphdr *tftp; + struct mbuf *m = *mp; size_t newlen; size_t hdrlen = sizeof(*tftp) - sizeof(tftp->th_data); @@ -380,7 +381,7 @@ tftproot_recv(struct mbuf *m, void *ctx) * Examine the TFTP header */ 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", __func__, __LINE__)); return -1; Index: src/sys/nfs/krpc_subr.c diff -u src/sys/nfs/krpc_subr.c:1.37 src/sys/nfs/krpc_subr.c:1.37.38.1 --- src/sys/nfs/krpc_subr.c:1.37 Sun Mar 15 17:20:09 2009 +++ src/sys/nfs/krpc_subr.c Mon Apr 6 01:37:29 2015 @@ -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 @@ -43,7 +43,7 @@ */ #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/systm.h> @@ -124,7 +124,7 @@ struct rpc_reply { #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 @@ -183,15 +183,16 @@ krpc_portmap(struct sockaddr_in *sin, u_ return 0; } -static int krpccheck(struct mbuf *m, void *context) +static int krpccheck(struct mbuf **mp, void *context) { struct rpc_reply *reply; + struct mbuf *m = *mp; /* Does the reply contain at least a header? */ if (m->m_pkthdr.len < MIN_REPLY_HDR) return(-1); 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) return(-1); } Index: src/sys/nfs/nfs_boot.c diff -u src/sys/nfs/nfs_boot.c:1.81 src/sys/nfs/nfs_boot.c:1.81.4.1 --- src/sys/nfs/nfs_boot.c:1.81 Fri Oct 25 20:46:29 2013 +++ src/sys/nfs/nfs_boot.c Mon Apr 6 01:37:29 2015 @@ -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. @@ -35,7 +35,7 @@ */ #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 #include "opt_nfs.h" @@ -432,7 +432,7 @@ int nfs_boot_sendrecv(struct socket *so, struct mbuf *nam, int (*sndproc)(struct mbuf *, void *, int), struct mbuf *snd, - int (*rcvproc)(struct mbuf *, void *), + int (*rcvproc)(struct mbuf **, void *), struct mbuf **rcv, struct mbuf **from_p, void *context, struct lwp *lwp) { @@ -510,7 +510,7 @@ send_again: panic("nfs_boot_sendrecv: return size"); #endif - if ((*rcvproc)(m, context)) + if ((*rcvproc)(&m, context)) continue; if (rcv) Index: src/sys/nfs/nfs_bootdhcp.c diff -u src/sys/nfs/nfs_bootdhcp.c:1.52 src/sys/nfs/nfs_bootdhcp.c:1.52.34.1 --- src/sys/nfs/nfs_bootdhcp.c:1.52 Mon Oct 4 23:48:22 2010 +++ src/sys/nfs/nfs_bootdhcp.c Mon Apr 6 01:37:29 2015 @@ -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. @@ -44,7 +44,7 @@ */ #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 #include "opt_nfs_boot.h" @@ -302,7 +302,7 @@ struct bootpcontext { }; static int bootpset (struct mbuf*, void*, int); -static int bootpcheck (struct mbuf*, void*); +static int bootpcheck (struct mbuf**, void*); static int bootpset(struct mbuf *m, void *context, int waited) @@ -318,10 +318,11 @@ bootpset(struct mbuf *m, void *context, } static int -bootpcheck(struct mbuf *m, void *context) +bootpcheck(struct mbuf **mp, void *context) { struct bootp *bootp; struct bootpcontext *bpc = context; + struct mbuf *m = *mp; u_int tag, len; u_char *p, *limit; @@ -343,7 +344,7 @@ bootpcheck(struct mbuf *m, void *context * don't make first checks more expensive than necessary */ 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) { DPRINTF(("bootpcheck: m_pullup failed\n")); return (-1); Index: src/sys/nfs/nfsdiskless.h diff -u src/sys/nfs/nfsdiskless.h:1.30 src/sys/nfs/nfsdiskless.h:1.30.34.1 --- src/sys/nfs/nfsdiskless.h:1.30 Mon Oct 4 23:48:23 2010 +++ src/sys/nfs/nfsdiskless.h Mon Apr 6 01:37:29 2015 @@ -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. @@ -79,7 +79,7 @@ int nfs_boot_enbroadcast (struct socket int nfs_boot_sobind_ipport (struct socket *, uint16_t, struct lwp *); int nfs_boot_sendrecv (struct socket *, 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 *); int nfs_bootdhcp (struct nfs_diskless *, struct lwp *, int *);