From owner-svn-src-all@FreeBSD.ORG Fri Mar 26 08:42:11 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ADA97106564A; Fri, 26 Mar 2010 08:42:11 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9C2E38FC13; Fri, 26 Mar 2010 08:42:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2Q8gBcE093027; Fri, 26 Mar 2010 08:42:11 GMT (envelope-from netchild@svn.freebsd.org) Received: (from netchild@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2Q8gBfZ093025; Fri, 26 Mar 2010 08:42:11 GMT (envelope-from netchild@svn.freebsd.org) Message-Id: <201003260842.o2Q8gBfZ093025@svn.freebsd.org> From: Alexander Leidinger Date: Fri, 26 Mar 2010 08:42:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205678 - head/sys/compat/linux X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Mar 2010 08:42:11 -0000 Author: netchild Date: Fri Mar 26 08:42:11 2010 New Revision: 205678 URL: http://svn.freebsd.org/changeset/base/205678 Log: Fix some problems which may lead to a panic: - right order of src and dst in memcpy - NULL out the clips after freeing to prevent an accident Noticed by: hselasky Modified: head/sys/compat/linux/linux_ioctl.c Modified: head/sys/compat/linux/linux_ioctl.c ============================================================================== --- head/sys/compat/linux/linux_ioctl.c Fri Mar 26 08:05:30 2010 (r205677) +++ head/sys/compat/linux/linux_ioctl.c Fri Mar 26 08:42:11 2010 (r205678) @@ -2711,7 +2711,7 @@ linux_v4l_clip_copy(void *lvc, struct vi /* XXX: If there can be no concurrency: s/M_NOWAIT/M_WAITOK/ */ if ((*ppvc = malloc(sizeof(**ppvc), M_LINUX, M_NOWAIT)) == NULL) return (ENOMEM); /* XXX: linux has no ENOMEM here */ - memcpy(&vclip, *ppvc, sizeof(vclip)); + memcpy(*ppvc, &vclip, sizeof(vclip)); (*ppvc)->next = NULL; return (0); } @@ -2726,6 +2726,8 @@ linux_v4l_cliplist_free(struct video_win ppvc_next = &((*ppvc)->next); free(*ppvc, M_LINUX); } + vw->clips = NULL; + return (0); }