Skip to content
Commit 51fe16c0 authored by Shichao Lai's avatar Shichao Lai Committed by Greg Kroah-Hartman
Browse files

usb-storage: alauda: Check whether the media is initialized

[ Upstream commit 16637fea ]

The member "uzonesize" of struct alauda_info will remain 0
if alauda_init_media() fails, potentially causing divide errors
in alauda_read_data() and alauda_write_lba().
- Add a member "media_initialized" to struct alauda_info.
- Change a condition in alauda_check_media() to ensure the
  first initialization.
- Add an error check for the return value of alauda_init_media().

Fixes: e80b0fad

 ("[PATCH] USB Storage: add alauda support")
Reported-by: default avatarxingwei lee <xrivendell7@gmail.com>
Reported-by: default avataryue sun <samsun1006219@gmail.com>
Reviewed-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarShichao Lai <shichaorai@gmail.com>
Link: https://lore.kernel.org/r/20240526012745.2852061-1-shichaorai@gmail.com
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 74cd0a42
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment