**Exhibit 10.4****KOMAG INCORPORATED****SECOND AMENDMENT TO STOCK OPTION AGREEMENTS**     This Second Amendment to Stock Option Agreements (the “**Second Amendment**”) is made this 3rd dayof October, 2006, by and between Thian H. Tan (“**Participant**”) and Komag Incorporated (the“**Company**”).     **WHEREAS**, the Company has previously granted Participant one or more options (each an “**Option**”and collectively, the “**Options**”) to purchase shares of Company common stock (“**Shares**”) under theCompany’s amended and restated 2002 Qualified Stock Plan (the “**Plan**”) and such Options have beenmemorialized in Participant’s Stock Option Agreements, including any Notices of Stock Option Grantsrelating thereto (the “**Option Agreements**”) and the Amendment to Stock Option Agreements datedFebruary 15, 2006 (the “**First Amendment**” and together with the Option Agreements, collectively, the“**Agreements**”);     **WHEREAS**, the Participant has resigned as the Company’s Chief Executive Officer following thecommencement of his successor as the Company’s Chief Executive Officer and is to provide servicesto the Company under the Consulting Services Agreement dated February 15, 2006 (the “**ConsultingAgreement**”);     **WHEREAS**, the parties agreed, pursuant to the First Amendment, that Participant would haveninety (90) days to exercise his Options following the date that Participant’s successor as ChiefExecutive Officer to the Company commenced employment with the Company even though Participantwould have had ninety (90) days following his termination as a “Service Provider” (as defined inthe Plan), which would have included providing services under the Consulting Agreement, to exercisehis Options had such amendment not been made pursuant to the First Amendment; and     **WHEREAS**, Participant and the Company desire to extend the period through which Participant mayexercise his Options through March 15, 2007, subject to earlier termination pursuant to Section17(c) of the Plan, and to permit Participant to exercise his Options and satisfy any applicable taxwithholding obligations in connection with the exercise of such Options through the transfer ofshares of Company common stock owned by Participant to the extent such transfer of shares does notresult in adverse financial accounting consequences to the Company (as determined by the Company inits sole discretion); and     **WHEREAS,**the Compensation Committee of the Board of Directors of the Company (the “**Committee**”)has determined that it is in the best interests of the Company and its stockholders to rewardParticipant for his service as the Company’s Chief Executive Officer and finding his successor andto ensure that the Company will have the continued dedication and objectivity of Participant toprovide services to the Company under the Consulting Agreement.     **NOW, THEREFORE,**the parties hereto agree that the Agreements are hereby amended as follows:
 

 
     1. Extension of Post-Employment Exercise Period. Notwithstanding anything to thecontrary set forth in the Agreements (especially the First Amendment), but subject to earliertermination pursuant to Section 17(c) of the Plan, Participant will have until March 15, 2007 toexercise each outstanding Option. To the extent Participant does not exercise an Option by March15, 2007, the Option will terminate and cease to remain outstanding and Participant will have nofurther right to acquire Shares subject thereto.     2. Use of Shares to Pay Exercise Price and Satisfy Tax Withholding Obligations.Notwithstanding anything to the contrary in the Agreements and pursuant to such procedures as theCompany establishes in its discretion, Participant will be permitted to pay the exercise price ofeach Option and satisfy any tax withholding obligations that arise upon exercise of an Option withshares of the Company’s common stock, but only to the extent doing so will not result adversefinancial accounting consequences to the Company, as determined by the Company in its solediscretion.     3. Stock Option Agreement. To the extent not expressly amended hereby, the Agreementswill remain in full force and effect.     4. No Guarantee of Continued Service. Participant acknowledges and agrees that thisSecond Amendment and the Agreements do not constitute an express or implied promise of continuedengagement as a Service Provider for any period, or at all, and shall not interfere in any way withParticipant’s right or the right of the Company (or the Parent or Subsidiary employing or retainingParticipant) to terminate Participant as a Service Provider at any time, with or without cause orwith or without notice.     5. Assignment. This Second Amendment will be binding upon and inure to the benefit of(a) the heirs, executors and legal representatives of Participant upon Participant’s death and (b)any successor of the Company. Any such successor of the Company will be deemed substituted for theCompany under the terms of this Second Amendment for all purposes. For this purpose, “**successor**”means any person, firm, corporation or other business entity which at any time, whether bypurchase, merger or otherwise, directly or indirectly acquires all or substantially all of theassets or business of the Company. None of the rights of Participant under this Second Amendmentmay be assigned or transferred except by will or the laws of descent and distribution. Any otherattempted assignment, transfer, conveyance or other disposition of Participant’s rights under thisSecond Amendment will be null and void.     6. Entire Agreement. This Second Amendment, taken together with the Agreements (tothe extent not amended hereby), represent the entire agreement of the parties and will supersedeany and all previous contracts, arrangements or understandings between the parties with respect tothe Participant’s stock option benefits. This Second Amendment may be amended at any time only bymutual written agreement of the parties hereto.     7. Counterparts. This Second Amendment may be executed in counterparts, and eachcounterpart will have the same force and effect as an original and will constitute an effective,binding agreement on the part of each of the undersigned. Execution and delivery of this SecondAmendment by exchange of facsimile copies bearing the facsimile signature of a party will
-2-

 
constitute a valid and binding execution and delivery of the Second Amendment by such party.Such facsimile copies will constitute enforceable original documents.     8. Headings. All captions and section headings used in this Second Amendment are forconvenient reference only and do not form a part of this Second Amendment.     9. Governing Law. This Second Amendment will be governed by the laws of the State ofCalifornia (with the exception of its conflict of laws provisions).     **IN WITNESS WHEREOF**, this Second Amendment has been entered into as of the date first set forthabove.         KOMAG INCORPORATED   PARTICIPANT           By: /S/ Jan Schwartz    /S/ Thian H. Tan   Its:   Treasurer   Thian H. Tan  
-3-