From patchwork Sun Sep 27 20:57:02 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarek Poplawski X-Patchwork-Id: 34356 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 98D0EB7B8A for ; Mon, 28 Sep 2009 06:59:03 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752221AbZI0U6T (ORCPT ); Sun, 27 Sep 2009 16:58:19 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751880AbZI0U6S (ORCPT ); Sun, 27 Sep 2009 16:58:18 -0400 Received: from fg-out-1718.google.com ([72.14.220.157]:40012 "EHLO fg-out-1718.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750912AbZI0U6S (ORCPT ); Sun, 27 Sep 2009 16:58:18 -0400 Received: by fg-out-1718.google.com with SMTP id 22so596754fge.1 for ; Sun, 27 Sep 2009 13:58:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=tajQHGnQCrqfZCFUT+L97Ac4M0dmFPSPzLlJ0OnfKhY=; b=BEbLQ4FIcxRTCDOqjQKKE+PZw7Cx05l+OpJI2eaG98ph+yBFdCHcD0R0bQn+bnw/Kf TphpC60EDzmzV+fCV5l4gdqwrkVzxY6yJwMQ8VNz22j/CFtoXE5zOUvHlTBe7ozWrGDu G9PCG1S11tX1/oXkxJjjqVQoGA8iyoZ3nQkPk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=wUtu6CsBMz5xYRigO5P7FmFT6yB5is72KDHkkRBgWh8/vSULRaKpKCgaZeWNwIzZ/h DGrxjAlZASGheyZns+GhUtM0NtdmV75f2Ep38xGDpxIN9fUKuUwJmzMMVI4TduGznR5j 1dGwADVcfNhwPWQ9Jb8d6L15i7ehcOA7VfbqE= Received: by 10.86.249.30 with SMTP id w30mr2775413fgh.35.1254085100894; Sun, 27 Sep 2009 13:58:20 -0700 (PDT) Received: from del.dom.local ([79.162.142.44]) by mx.google.com with ESMTPS id 3sm817845fge.28.2009.09.27.13.58.03 (version=SSLv3 cipher=RC4-MD5); Sun, 27 Sep 2009 13:58:20 -0700 (PDT) Date: Sun, 27 Sep 2009 22:57:02 +0200 From: Jarek Poplawski To: Ralf Baechle DL5RB Cc: David Miller , Bernard Pidoux F6BVP , Bernard Pidoux , Linux Netdev List , linux-hams Subject: [PATCH] ax25: Fix possible oops in ax25_make_new Message-ID: <20090927205701.GA7205@del.dom.local> References: <20090921201157.GA5460@del.dom.local> <4ABA9058.3010605@free.fr> <20090925131038.GA14778@ff.dom.local> <20090925134052.GA1661@linux-mips.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20090925134052.GA1661@linux-mips.org> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org In ax25_make_new, if kmemdup of digipeat returns an error, there would be an oops in sk_free while calling sk_destruct, because sk_protinfo is NULL at the moment; move sk->sk_destruct initialization after this. BTW of reported-by: Bernard Pidoux F6BVP Signed-off-by: Jarek Poplawski --- net/ax25/af_ax25.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c index fbcac76..9884639 100644 --- a/net/ax25/af_ax25.c +++ b/net/ax25/af_ax25.c @@ -900,7 +900,6 @@ struct sock *ax25_make_new(struct sock *osk, struct ax25_dev *ax25_dev) sock_init_data(NULL, sk); - sk->sk_destruct = ax25_free_sock; sk->sk_type = osk->sk_type; sk->sk_priority = osk->sk_priority; sk->sk_protocol = osk->sk_protocol; @@ -938,6 +937,7 @@ struct sock *ax25_make_new(struct sock *osk, struct ax25_dev *ax25_dev) } sk->sk_protinfo = ax25; + sk->sk_destruct = ax25_free_sock; ax25->sk = sk; return sk;