{"id":810225,"url":"http://patchwork.ozlabs.org/api/patches/810225/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-ext4/patch/20170905165123.22245-1-colin.king@canonical.com/","project":{"id":8,"url":"http://patchwork.ozlabs.org/api/projects/8/?format=json","name":"Linux ext4 filesystem development","link_name":"linux-ext4","list_id":"linux-ext4.vger.kernel.org","list_email":"linux-ext4@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170905165123.22245-1-colin.king@canonical.com>","list_archive_url":null,"date":"2017-09-05T16:51:23","name":"[ext4-next] ext4: fix null pointer dereference on sbi","commit_ref":null,"pull_url":null,"state":"accepted","archived":true,"hash":"01830de55b899405f4cf2c4218198528875dbcc7","submitter":{"id":2900,"url":"http://patchwork.ozlabs.org/api/people/2900/?format=json","name":"Colin Ian King","email":"colin.king@canonical.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-ext4/patch/20170905165123.22245-1-colin.king@canonical.com/mbox/","series":[{"id":1611,"url":"http://patchwork.ozlabs.org/api/series/1611/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-ext4/list/?series=1611","date":"2017-09-05T16:51:23","name":"[ext4-next] ext4: fix null pointer dereference on sbi","version":1,"mbox":"http://patchwork.ozlabs.org/series/1611/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/810225/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/810225/checks/","tags":{},"related":[],"headers":{"Return-Path":"<linux-ext4-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=linux-ext4-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xmt660CZ8z9sPs\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed,  6 Sep 2017 02:51:42 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1752403AbdIEQv2 (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tTue, 5 Sep 2017 12:51:28 -0400","from youngberry.canonical.com ([91.189.89.112]:51638 \"EHLO\n\tyoungberry.canonical.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1752191AbdIEQv1 (ORCPT\n\t<rfc822; linux-ext4@vger.kernel.org>); Tue, 5 Sep 2017 12:51:27 -0400","from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost)\n\tby youngberry.canonical.com with esmtpsa\n\t(TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76)\n\t(envelope-from <colin.king@canonical.com>)\n\tid 1dpH4O-0002es-Dz; Tue, 05 Sep 2017 16:51:24 +0000"],"From":"Colin King <colin.king@canonical.com>","To":"Theodore Ts'o <tytso@mit.edu>, Andreas Dilger <adilger.kernel@dilger.ca>,\n\tlinux-ext4@vger.kernel.org","Cc":"kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org,\n\tDan Williams <dan.j.williams@intel.com>","Subject":"[PATCH][ext4-next] ext4: fix null pointer dereference on sbi","Date":"Tue,  5 Sep 2017 17:51:23 +0100","Message-Id":"<20170905165123.22245-1-colin.king@canonical.com>","X-Mailer":"git-send-email 2.14.1","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"8bit","Sender":"linux-ext4-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<linux-ext4.vger.kernel.org>","X-Mailing-List":"linux-ext4@vger.kernel.org"},"content":"From: Colin Ian King <colin.king@canonical.com>\n\nIn the case of a kzalloc failure when allocating sbi we end up\nwith a null pointer dereference on sbi when assigning sbi->s_daxdev.\nFix this by moving the assignment of sbi->s_daxdev to after the\nnull pointer check of sbi.\n\nDetected by CoverityScan CID#1455379 (\"Dereference before null check\")\n\nFixes: 5e405595e5bf (\"ext4: perform dax_device lookup at mount\")\nSigned-off-by: Colin Ian King <colin.king@canonical.com>\n---\n fs/ext4/super.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)","diff":"diff --git a/fs/ext4/super.c b/fs/ext4/super.c\nindex 0e63fcd12c5b..71b9a667e1bc 100644\n--- a/fs/ext4/super.c\n+++ b/fs/ext4/super.c\n@@ -3422,10 +3422,10 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)\n \tunsigned int journal_ioprio = DEFAULT_JOURNAL_IOPRIO;\n \text4_group_t first_not_zeroed;\n \n-\tsbi->s_daxdev = dax_dev;\n \tif ((data && !orig_data) || !sbi)\n \t\tgoto out_free_base;\n \n+\tsbi->s_daxdev = dax_dev;\n \tsbi->s_blockgroup_lock =\n \t\tkzalloc(sizeof(struct blockgroup_lock), GFP_KERNEL);\n \tif (!sbi->s_blockgroup_lock)\n","prefixes":["ext4-next"]}