Re: [PATCHv2] Check whether divisor is non-zero before division

From: shichao lai
Date: Sat May 25 2024 - 00:35:28 EST


On Sat, May 25, 2024 at 10:24 AM Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:
> If alauda_init_media() returns an error, leave info->initialized
> unchanged. alauda_check_media() will return an error also, so the bad
> division won't take place.
>
> Alan Stern

Thanks! You also remind me that the return value from
alauda_init_media() is never used!
By this way, the workflow now seems to work correctly.
It tries to initialize multiple times, and finally disconnects due to
no response.

Now if possible, I will post a [PATCH v4] for this bug soon.
I want to know whether it is possible to add some tags like
Suggested-by or Reviewed-by for Dear Alan Stern, gregkh
and oneukum as thanks for your discussions.

e.g.
==== kernel log
[ 47.266129][ T4125] alauda_check_media: before init_media,
status[0]: 0000000000000036
[ 47.266555][ T4125] alauda_check_media: enter init_media
[ 47.467314][ T9] usb 1-1: USB disconnect, device number 2
root@syzkaller:~# [ 47.485304][ T4125] alauda_get_media_status: data=54, rc=4
[ 47.485640][ T4125] alauda_init_media: exit in 391
[ 47.486104][ T41] sd 2:0:0:0: [sdb] Read Capacity(10) failed:
Result: hostbyte=DID_ERROR driverbyte=DRIVER_OK
[ 47.486591][ T41] sd 2:0:0:0: [sdb] Sense not available.
[ 47.486889][ T41] sd 2:0:0:0: [sdb] 0 512-byte logical blocks: (0 B/0 B)
[ 47.487212][ T41] sd 2:0:0:0: [sdb] 0-byte physical blocks
[ 47.487515][ T41] sd 2:0:0:0: [sdb] Write Protect is off
[ 47.487813][ T41] sd 2:0:0:0: [sdb] Asking for cache data failed
[ 47.488104][ T41] sd 2:0:0:0: [sdb] Assuming drive cache: write through
[ 47.491396][ T41] sd 2:0:0:0: [sdb] Attached SCSI removable disk
[ 48.105309][ T1198] not responding...