Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bc78c573 authored by Denis Efremov's avatar Denis Efremov Committed by NeilBrown
Browse files

md/linear: rcu_dereference outside read-lock section



According to the comment in linear_stop function
rcu_dereference in linear_start and linear_stop functions
occurs under reconfig_mutex. The patch represents this
agreement in code and prevents lockdep complaint.

Found by Linux Driver Verification project (linuxtesting.org)

Signed-off-by: default avatarDenis Efremov <yefremov.denis@gmail.com>
Signed-off-by: default avatarNeilBrown <neilb@suse.de>
parent 02f3939e
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -244,7 +244,9 @@ static int linear_add(struct mddev *mddev, struct md_rdev *rdev)
	if (!newconf)
		return -ENOMEM;

	oldconf = rcu_dereference(mddev->private);
	oldconf = rcu_dereference_protected(mddev->private,
					    lockdep_is_held(
						    &mddev->reconfig_mutex));
	mddev->raid_disks++;
	rcu_assign_pointer(mddev->private, newconf);
	md_set_array_sectors(mddev, linear_size(mddev, 0, 0));
@@ -256,7 +258,10 @@ static int linear_add(struct mddev *mddev, struct md_rdev *rdev)

static int linear_stop (struct mddev *mddev)
{
	struct linear_conf *conf = mddev->private;
	struct linear_conf *conf =
		rcu_dereference_protected(mddev->private,
					  lockdep_is_held(
						  &mddev->reconfig_mutex));

	/*
	 * We do not require rcu protection here since