From patchwork Sat Aug 29 18:31:49 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roel Kluin X-Patchwork-Id: 44701 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n7TIQPNG024964 for ; Sat, 29 Aug 2009 18:26:25 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752278AbZH2S0V (ORCPT ); Sat, 29 Aug 2009 14:26:21 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752282AbZH2S0V (ORCPT ); Sat, 29 Aug 2009 14:26:21 -0400 Received: from mail-ew0-f206.google.com ([209.85.219.206]:46255 "EHLO mail-ew0-f206.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752277AbZH2S0V (ORCPT ); Sat, 29 Aug 2009 14:26:21 -0400 Received: by ewy2 with SMTP id 2so2963981ewy.17 for ; Sat, 29 Aug 2009 11:26:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:content-type :content-transfer-encoding; bh=Eo5Jv/pfELffhVpHK1tCdK1AzkdluWgNDDDNmvv/0R0=; b=jXe6kNnyspy3RIMrhpCviVTlOELWPIGdLrxJTaoZJeu/5Hw0zzTGTiMMlABa+8Fafc NJT6h9XxklRqkBv2YmoP/sqfRtqMGRpC1al4AFn27hLxW+EUTfplQGu0QiiP2P7A6nsG wuiu2NmlBwp7Bu190LCsF3/ZjUDTqYTAM3Oq4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; b=fWtrwVP/dB5in0sALa/SzmpjnvLl0/IyS2/4jBQyw4w9RITszPN38BiNm4YV01PdPn 3xYrGSZTnykkeKypqOex9sg+PcGyJ1cCg3OCgFz+gyEV6ogCHPBSdCZqss7c+f1WRma4 UR0wh/QSF9zAw0VbS6fRVzCKF5PsRtTsXkQo8= Received: by 10.210.135.1 with SMTP id i1mr2011071ebd.48.1251570382322; Sat, 29 Aug 2009 11:26:22 -0700 (PDT) Received: from zoinx.mars (d133062.upc-d.chello.nl [213.46.133.62]) by mx.google.com with ESMTPS id 10sm735426eyz.17.2009.08.29.11.26.20 (version=SSLv3 cipher=RC4-MD5); Sat, 29 Aug 2009 11:26:21 -0700 (PDT) Message-ID: <4A997415.7010407@gmail.com> Date: Sat, 29 Aug 2009 20:31:49 +0200 From: Roel Kluin User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.1) Gecko/20090814 Fedora/3.0-2.6.b3.fc11 Thunderbird/3.0b3 MIME-Version: 1.0 To: Mauro Carvalho Chehab , linux-media@vger.kernel.org, Andrew Morton Subject: [PATCH] V4L/DVB (12098): dereference of state->internal in fe_stv0900_error stv0900_init_internal() Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org state->internal allocation may fail as well as the allocation of stv0900_first_inode or new_node->next_inode in append_internal(). Signed-off-by: Roel Kluin --- Is this the right thing to do if temp_int == NULL? -- To unsubscribe from this list: send the line "unsubscribe linux-media" 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/drivers/media/dvb/frontends/stv0900_core.c b/drivers/media/dvb/frontends/stv0900_core.c index 1da045f..b0aaf90 100644 --- a/drivers/media/dvb/frontends/stv0900_core.c +++ b/drivers/media/dvb/frontends/stv0900_core.c @@ -1407,7 +1407,14 @@ static enum fe_stv0900_error stv0900_init_internal(struct dvb_frontend *fe, return STV0900_NO_ERROR; } else { state->internal = kmalloc(sizeof(struct stv0900_internal), GFP_KERNEL); + if (state->internal == NULL) + return STV0900_INVALID_HANDLE; temp_int = append_internal(state->internal); + if (temp_int == NULL) { + kfree(state->internal); + state->internal == NULL; + return STV0900_INVALID_HANDLE; + } state->internal->dmds_used = 1; state->internal->i2c_adap = state->i2c_adap; state->internal->i2c_addr = state->config->demod_address;