Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2631177pxj; Mon, 14 Jun 2021 03:32:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+3p7UBh8nkqkJptlDdzp4CRnwr0PYlpvuOg50ck9Mgd0eteLt5x81zORNA711bYYKdT5/ X-Received: by 2002:a17:906:8988:: with SMTP id gg8mr15001958ejc.266.1623666723333; Mon, 14 Jun 2021 03:32:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623666723; cv=none; d=google.com; s=arc-20160816; b=uSQTrspA9irqYQEBWasI/9ilrcHN2Gg0r3GO8GHxoRYNJD9afvo8LF5M7acH6ON992 RRvRd2J+/opLlBbW/Uzuy/pKm4cQL5Q6e0NDvyK9rmqQFj0B4eQQRVQY9Z/48ROfPPrx dCvglH071oB4WIbCy7kTcscMhVUdb8fE7hPrZNdPaMj3RzawM3KE+MKYG0I1U0JzqQs+ Y5kW1cCOWwtvTw7rZCKTICYiKk0ICkkXgA2q4uHzWqrVDtphWWDXo0t1BbsgM2Zr2DFm VU5QaqHa1WUIyeLTSgsRep0MQjgrsnYj8P9y9inhN/D98P1Q9TxjLfz+KTfGNTiNkGi5 6Onw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=U7vdiCNniMkCNjimHPBQPKjWzpT/N8kBhDmUU1ktkvA=; b=BR3oAUsbyX0BqHGCFWOOfJogYjHSJbKG34PxOVWvihM8iyDvmhAq8fEiqzHfapJ5Zn 9hlzb8PaoyVxxiFDLCmh9NminxzUbAQIEkqWV+77/NdXkYi9Qn1sX1HkEag0czS2xRzc 0RjwCuVw84cRfLmehJxsQt2aM5hhiRHN0W+eP7ZyAWW+nqTTFTBnqCX+1n7A3vgsIuuQ bSRv5pjCnwnOK3wu83jX0bwgL11WlL1UWgGbh4Jb68eRSnXqHXGjK82u/Kr9PIigU4B1 +8ooOwKZn1jj3tmirYxbAiGFnyG76Ild7IAOYTaM3jwTOi0eGH+4/exvhtRewWNJuZud w08g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Er5vgd8T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ka11si11742920ejc.367.2021.06.14.03.31.40; Mon, 14 Jun 2021 03:32:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Er5vgd8T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232968AbhFNKby (ORCPT + 99 others); Mon, 14 Jun 2021 06:31:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:37750 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232870AbhFNKbQ (ORCPT ); Mon, 14 Jun 2021 06:31:16 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9F0D9611BE; Mon, 14 Jun 2021 10:28:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623666538; bh=ULu45IxoBA8bSyPVdAwI4v61NLUB3zhof+dpMc7sFkc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Er5vgd8T5wPkMJSDRzvQ0vQASCXSinqibYnpQ+vQV3sFBHGctJRvfc+x4ISgA/5R5 UCmmbmWH0JPmMjzUuyYdXnCiEj2TMDAlr54FHoemgZGyRjkqb8C1KBzDEcqHPqnkoR 6YobWLOSd5xbeSpr0k7nv3KmzGR6kSbInORTICbg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+bfda097c12a00c8cae67@syzkaller.appspotmail.com, Johannes Berg , Jay Vosburgh , "David S. Miller" , Sasha Levin Subject: [PATCH 4.4 05/34] bonding: init notify_work earlier to avoid uninitialized use Date: Mon, 14 Jun 2021 12:26:56 +0200 Message-Id: <20210614102641.769184165@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210614102641.582612289@linuxfoundation.org> References: <20210614102641.582612289@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Johannes Berg [ Upstream commit 35d96e631860226d5dc4de0fad0a415362ec2457 ] If bond_kobj_init() or later kzalloc() in bond_alloc_slave() fail, then we call kobject_put() on the slave->kobj. This in turn calls the release function slave_kobj_release() which will always try to cancel_delayed_work_sync(&slave->notify_work), which shouldn't be done on an uninitialized work struct. Always initialize the work struct earlier to avoid problems here. Syzbot bisected this down to a completely pointless commit, some fault injection may have been at work here that caused the alloc failure in the first place, which may interact badly with bisect. Reported-by: syzbot+bfda097c12a00c8cae67@syzkaller.appspotmail.com Signed-off-by: Johannes Berg Acked-by: Jay Vosburgh Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/bonding/bond_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index a33e8a3b5f0a..d6363ae22052 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -1267,6 +1267,7 @@ static struct slave *bond_alloc_slave(struct bonding *bond, slave->bond = bond; slave->dev = slave_dev; + INIT_DELAYED_WORK(&slave->notify_work, bond_netdev_notify_work); if (bond_kobj_init(slave)) return NULL; @@ -1279,7 +1280,6 @@ static struct slave *bond_alloc_slave(struct bonding *bond, return NULL; } } - INIT_DELAYED_WORK(&slave->notify_work, bond_netdev_notify_work); return slave; } -- 2.30.2