Skip to content

Commit

Permalink
libata: fix ata_host_start()
Browse files Browse the repository at this point in the history
[ Upstream commit 355a803 ]

The loop on entry of ata_host_start() may not initialize host->ops to a
non NULL value. The test on the host_stop field of host->ops must then
be preceded by a check that host->ops is not NULL.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Link: https://lore.kernel.org/r/20210816014456.2191776-3-damien.lemoal@wdc.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
damien-lemoal authored and gregkh committed Sep 15, 2021
1 parent 258e7b7 commit a3a9bd9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/ata/libata-core.c
Expand Up @@ -5573,7 +5573,7 @@ int ata_host_start(struct ata_host *host)
have_stop = 1;
}

if (host->ops->host_stop)
if (host->ops && host->ops->host_stop)
have_stop = 1;

if (have_stop) {
Expand Down

0 comments on commit a3a9bd9

Please sign in to comment.